S32 SDK
flash_mx25l6433f_driver.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 NXP
3  * All rights reserved.
4  *
5  * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR
6  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
7  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
8  * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
9  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
10  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
11  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
12  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
13  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
14  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
15  * THE POSSIBILITY OF SUCH DAMAGE.
16  */
17 
18 #ifndef FLASH_MX25L6433F_DRIVER_H
19 #define FLASH_MX25L6433F_DRIVER_H
20 
21 #include <stddef.h>
22 #include <stdbool.h>
23 #include "device_registers.h"
24 #include "status.h"
25 #include "quadspi_driver.h"
26 
32 /*******************************************************************************
33  * Enumerations.
34  ******************************************************************************/
35 
36 
40 typedef enum
41 {
45 
46 
50 typedef enum
51 {
55 
56 
60 typedef enum
61 {
72 
73 
74 /*******************************************************************************
75 * Definitions
76 ******************************************************************************/
77 
85 typedef struct
86 {
87  bool dmaSupport;
90 
91 
100 typedef struct
101 {
103  uint8_t lastCommand; /* Last command executed by the driver */
104  flash_mx25l6433f_drv_strength_t outputDriverStrength; /* Output driver level of the device */
105  bool dmaSupport; /* Enables DMA support in the driver */
108 
109 
110 
114 typedef struct
115 {
119 
120 
121 /*******************************************************************************
122  * API
123  ******************************************************************************/
129 #if defined(__cplusplus)
130 extern "C" {
131 #endif
132 
133 
150 status_t FLASH_MX25L6433F_DRV_Init(uint32_t instance,
151  const flash_mx25l6433f_user_config_t * userConfigPtr,
152  flash_mx25l6433f_state_t * state);
153 
154 
165 status_t FLASH_MX25L6433F_DRV_Deinit(uint32_t instance);
166 
167 
181  flash_mx25l6433f_prot_dir_t direction,
183 
184 
194  flash_mx25l6433f_prot_dir_t * direction,
196 
197 
205 
206 
216 
217 
227 status_t FLASH_MX25L6433F_DRV_Read(uint32_t instance,
228  uint32_t address,
229  uint8_t * data,
230  uint32_t size);
231 
232 
240 status_t FLASH_MX25L6433F_DRV_Erase4K(uint32_t instance, uint32_t address);
241 
242 
250 status_t FLASH_MX25L6433F_DRV_Erase32K(uint32_t instance, uint32_t address);
251 
252 
260 status_t FLASH_MX25L6433F_DRV_Erase64K(uint32_t instance, uint32_t address);
261 
262 
269 status_t FLASH_MX25L6433F_DRV_EraseAll(uint32_t instance);
270 
271 
280 status_t FLASH_MX25L6433F_DRV_EraseVerify(uint32_t instance, uint32_t address, uint32_t size);
281 
282 
292 status_t FLASH_MX25L6433F_DRV_Program(uint32_t instance,
293  uint32_t address,
294  uint8_t * data,
295  uint32_t size);
296 
297 
308  uint32_t address,
309  const uint8_t * data,
310  uint32_t size);
311 
312 
319 status_t FLASH_MX25L6433F_DRV_GetStatus(uint32_t instance);
320 
321 
328 status_t FLASH_MX25L6433F_DRV_Reset(uint32_t instance);
329 
330 
337 status_t FLASH_MX25L6433F_DRV_EnterOTP(uint32_t instance);
338 
339 
346 status_t FLASH_MX25L6433F_DRV_ExitOTP(uint32_t instance);
347 
348 
355 status_t FLASH_MX25L6433F_DRV_EnterDPD(uint32_t instance);
356 
357 
364 status_t FLASH_MX25L6433F_DRV_ExitDPD(uint32_t instance);
365 
366 
367 
369 #if defined(__cplusplus)
370 }
371 #endif
372 
375 #endif /* FLASH_MX25L6433F_DRIVER_H */
376 /*******************************************************************************
377  * EOF
378  ******************************************************************************/
status_t FLASH_MX25L6433F_DRV_Deinit(uint32_t instance)
De-initialize the MX25L6433F flash driver.
status_t FLASH_MX25L6433F_DRV_SetSecureLock(uint32_t instance)
Locks the customer sector of the secured OTP area.
status_t FLASH_MX25L6433F_DRV_Erase32K(uint32_t instance, uint32_t address)
Erase a 32k block in the serial flash.
status_t FLASH_MX25L6433F_DRV_Erase64K(uint32_t instance, uint32_t address)
Erase a 64k block in the serial flash.
status_t FLASH_MX25L6433F_DRV_EnterOTP(uint32_t instance)
Enters OTP mode.
status_t FLASH_MX25L6433F_DRV_Reset(uint32_t instance)
Reset the serial flash device.
status_t FLASH_MX25L6433F_DRV_Erase4K(uint32_t instance, uint32_t address)
Erase a 4k sector in the serial flash.
status_t FLASH_MX25L6433F_DRV_EraseAll(uint32_t instance)
Erases the entire serial flash.
status_t
Status return codes. Common error codes will be a unified enumeration (C enum) that will contain all ...
Definition: status.h:44
Driver internal context structure.
status_t FLASH_MX25L6433F_DRV_Init(uint32_t instance, const flash_mx25l6433f_user_config_t *userConfigPtr, flash_mx25l6433f_state_t *state)
Initializes the serial flash memory driver.
status_t FLASH_MX25L6433F_DRV_ExitDPD(uint32_t instance)
Exits Deep Power Down mode.
status_t FLASH_MX25L6433F_DRV_GetSecureLock(uint32_t instance, flash_mx25l6433f_secure_lock_t *lock)
Get lock status of the secured OTP area.
status_t FLASH_MX25L6433F_DRV_EraseVerify(uint32_t instance, uint32_t address, uint32_t size)
Checks whether or not an area in the serial flash is erased.
status_t FLASH_MX25L6433F_DRV_SetProtection(uint32_t instance, flash_mx25l6433f_prot_dir_t direction, flash_mx25l6433f_prot_size_t size)
Configure protected area of the device.
status_t FLASH_MX25L6433F_DRV_GetStatus(uint32_t instance)
Get the status of the last operation.
flash_mx25l6433f_drv_strength_t outputDriverStrength
status_t FLASH_MX25L6433F_DRV_ProgramVerify(uint32_t instance, uint32_t address, const uint8_t *data, uint32_t size)
Verifies the correctness of the programmed data.
status_t FLASH_MX25L6433F_DRV_Program(uint32_t instance, uint32_t address, uint8_t *data, uint32_t size)
Writes data in serial flash.
flash_mx25l6433f_prot_size_t
Size of flash protected area Implements : flash_mx25l6433f_prot_size_t_Class.
flash_mx25l6433f_drv_strength_t
Flash device drive strength Implements : flash_mx25l6433f_drv_strength_t_Class.
Flash protection settings Implements : flash_mx25l6433f_secure_lock_t_Class.
status_t FLASH_MX25L6433F_DRV_GetProtection(uint32_t instance, flash_mx25l6433f_prot_dir_t *direction, flash_mx25l6433f_prot_size_t *size)
Get protected area of the device.
status_t FLASH_MX25L6433F_DRV_EnterDPD(uint32_t instance)
Enters Deep Power Down mode.
status_t FLASH_MX25L6433F_DRV_Read(uint32_t instance, uint32_t address, uint8_t *data, uint32_t size)
Read data from serial flash.
Driver configuration structure.
flash_mx25l6433f_prot_dir_t
Flash protection direction Implements : flash_mx25l6433f_prot_dir_t_Class.
status_t FLASH_MX25L6433F_DRV_ExitOTP(uint32_t instance)
Exits OTP mode.