1 /**
2  ****************************************************************************************
3  *
4  * @file flash.h
5  *
6  * @brief Flash driver interface
7  *
8  * Copyright (C) RivieraWaves 2009-2015
9  *
10  *
11  ****************************************************************************************
12  */
13 
14 #ifndef FLASH_H_
15 #define FLASH_H_
16 
17 #include <stdint.h>               // standard integer functions
18 
19 /**
20  ****************************************************************************************
21  * @addtogroup FLASH
22  * @ingroup DRIVERS
23  *
24  * @brief Flash memory driver
25  *
26  * @{
27  ****************************************************************************************
28  */
29 
30 /*
31  * DEFINES
32  ****************************************************************************************
33  */
34 
35 
36 
37 /*
38  * FUNCTION DECLARATIONS
39  ****************************************************************************************
40  */
41 
42 /**
43  ****************************************************************************************
44  * @brief Initialize flash driver.
45  ****************************************************************************************
46  */
47 void eif_flash_init(void);
48 
49 /**
50  ****************************************************************************************
51  * @brief   Identify the flash device.
52  *
53  * This function is used to read the flash device ID.
54  *
55  * Note: callback parameter is not used
56  *
57  * @param[out]   id          Pointer to id location
58  * @param[in]    callback    Callback for end of identification
59  * @return       status      0 if operation can start successfully
60  ****************************************************************************************
61  */
62 uint8_t eif_flash_identify(uint8_t* id);
63 
64 /**
65  ****************************************************************************************
66  * @brief   Erase a flash section.
67  *
68  * This function is used to erase a part of the flash memory.
69  *
70  * Note: callback parameter is not used
71  *
72  * @param[in]    flash_type  Flash type
73  * @param[in]    offset      Starting offset from the beginning of the flash device
74  * @param[in]    size        Size of the portion of flash to erase
75  * @param[in]    callback    Callback for end of erase
76  * @return       status      0 if operation can start successfully
77  ****************************************************************************************
78  */
79 uint8_t eif_flash_erase(uint32_t offset, uint32_t size);
80 
81 /**
82  ****************************************************************************************
83  * @brief   Write a flash section.
84  *
85  * This function is used to write a part of the flash memory.
86  *
87  * Note: callback parameter is not used
88  *
89  * @param[in]    offset      Starting offset from the beginning of the flash device
90  * @param[in]    length      Size of the portion of flash to write
91  * @param[in]    buffer      Pointer on data to write
92  * @return       status      0 if operation can start successfully
93  ****************************************************************************************
94  */
95 uint8_t eif_flash_write( uint32_t offset, uint32_t length, uint8_t *buffer);
96 
97 /**
98  ****************************************************************************************
99  * @brief   Read a flash section.
100  *
101  * This function is used to read a part of the flash memory.
102  *
103  * Note: callback parameter is not used
104  *
105  * @param[in]    offset      Starting offset from the beginning of the flash device
106  * @param[in]    length      Size of the portion of flash to read
107  * @param[out]   buffer      Pointer on data to read
108  * @return       status      0 if operation can start successfully
109  ****************************************************************************************
110  */
111 uint8_t eif_flash_read(uint32_t offset, uint32_t length, uint8_t *buffer);
112 
113 
114 /// @} FLASH
115 
116 #endif // FLASH_H_
117 
118