@@ -42,14 +42,14 @@ extern "C" {
42
42
*/
43
43
44
44
/** Initialize the flash peripheral and the flash_t object
45
- *
45
+ *
46
46
* @param obj The flash object
47
47
* @return 0 for success, -1 for error
48
48
*/
49
49
int32_t flash_init (flash_t * obj );
50
50
51
51
/** Uninitialize the flash peripheral and the flash_t object
52
- *
52
+ *
53
53
* @param obj The flash object
54
54
* @return 0 for success, -1 for error
55
55
*/
@@ -64,9 +64,20 @@ int32_t flash_free(flash_t *obj);
64
64
*/
65
65
int32_t flash_erase_sector (flash_t * obj , uint32_t address );
66
66
67
+ /** Read data starting at defined address
68
+ *
69
+ * This function has a WEAK implementation using memcpy for backwards compatibility.
70
+ * @param obj The flash object
71
+ * @param address Address to begin reading from
72
+ * @param data The buffer to read data into
73
+ * @param size The number of bytes to read
74
+ * @return 0 for success, -1 for error
75
+ */
76
+ int32_t flash_read (flash_t * obj , uint32_t address , uint8_t * data , uint32_t size );
77
+
67
78
/** Program one page starting at defined address
68
- *
69
- * The page should be at page boundary, should not cross multiple sectors.
79
+ *
80
+ * The page should be at page boundary, should not cross multiple sectors.
70
81
* This function does not do any check for address alignments or if size is aligned to a page size.
71
82
* @param obj The flash object
72
83
* @param address The sector starting address
@@ -77,30 +88,30 @@ int32_t flash_erase_sector(flash_t *obj, uint32_t address);
77
88
int32_t flash_program_page (flash_t * obj , uint32_t address , const uint8_t * data , uint32_t size );
78
89
79
90
/** Get sector size
80
- *
91
+ *
81
92
* @param obj The flash object
82
93
* @param address The sector starting address
83
94
* @return The size of a sector
84
95
*/
85
96
uint32_t flash_get_sector_size (const flash_t * obj , uint32_t address );
86
97
87
98
/** Get page size
88
- *
99
+ *
89
100
* @param obj The flash object
90
101
* @param address The page starting address
91
102
* @return The size of a page
92
103
*/
93
104
uint32_t flash_get_page_size (const flash_t * obj );
94
105
95
106
/** Get start address for the flash region
96
- *
107
+ *
97
108
* @param obj The flash object
98
109
* @return The start address for the flash region
99
110
*/
100
111
uint32_t flash_get_start_address (const flash_t * obj );
101
112
102
113
/** Get the flash region size
103
- *
114
+ *
104
115
* @param obj The flash object
105
116
* @return The flash region size
106
117
*/
0 commit comments