11 #include "Driver_Flash.h"
12 #include "flash_layout.h"
16 #ifndef PS_FLASH_DEV_NAME
17 #error "PS_FLASH_DEV_NAME must be defined by the target in flash_layout.h"
21 #ifndef PS_SECTOR_SIZE
22 #error "PS_SECTOR_SIZE must be defined by the target in flash_layout.h"
26 #ifndef PS_SECTORS_PER_BLOCK
27 #error "PS_SECTORS_PER_BLOCK must be defined by the target in flash_layout.h"
31 #ifndef PS_FLASH_PROGRAM_UNIT
32 #error "PS_FLASH_PROGRAM_UNIT must be defined by the target in flash_layout.h"
33 #elif (PS_FLASH_PROGRAM_UNIT < 1 || PS_FLASH_PROGRAM_UNIT > PS_SECTOR_SIZE)
34 #error "PS_FLASH_PROGRAM_UNIT must be between 1 and PS_SECTOR_SIZE inclusive"
35 #elif (PS_FLASH_PROGRAM_UNIT & (PS_FLASH_PROGRAM_UNIT - 1) != 0)
36 #error "PS_FLASH_PROGRAM_UNIT must be a power of two"
42 #ifndef PS_RAM_FS_SIZE
43 #error "PS_RAM_FS_SIZE must be defined by the target in flash_layout.h"
45 #define FLASH_INFO_INIT its_flash_ram_init
46 #define FLASH_INFO_READ its_flash_ram_read
47 #define FLASH_INFO_WRITE its_flash_ram_write
48 #define FLASH_INFO_FLUSH its_flash_ram_flush
49 #define FLASH_INFO_ERASE its_flash_ram_erase
51 #elif (PS_FLASH_PROGRAM_UNIT <= 16)
53 #define FLASH_INFO_INIT its_flash_nor_init
54 #define FLASH_INFO_READ its_flash_nor_read
55 #define FLASH_INFO_WRITE its_flash_nor_write
56 #define FLASH_INFO_FLUSH its_flash_nor_flush
57 #define FLASH_INFO_ERASE its_flash_nor_erase
60 #define PS_FLASH_ALIGNMENT PS_FLASH_PROGRAM_UNIT
64 #define FLASH_INFO_INIT its_flash_nand_init
65 #define FLASH_INFO_READ its_flash_nand_read
66 #define FLASH_INFO_WRITE its_flash_nand_write
67 #define FLASH_INFO_FLUSH its_flash_nand_flush
68 #define FLASH_INFO_ERASE its_flash_nand_erase
73 #define PS_FLASH_ALIGNMENT 1
77 #define FLASH_INFO_BLOCK_SIZE (PS_SECTOR_SIZE * PS_SECTORS_PER_BLOCK)
80 #define FLASH_INFO_MAX_FILE_SIZE ITS_UTILS_ALIGN(PS_MAX_OBJECT_SIZE, \
84 #define FLASH_INFO_MAX_NUM_FILES PS_MAX_NUM_OBJECTS
87 #define FLASH_INFO_ERASE_VAL 0xFFU
91 static uint8_t ps_block_data[PS_RAM_FS_SIZE];
92 #define FLASH_INFO_DEV ps_block_data
96 #define FLASH_INFO_DEV &PS_FLASH_DEV_NAME
107 .sector_size = PS_SECTOR_SIZE,
#define FLASH_INFO_BLOCK_SIZE
Implementations of the flash interface functions for a NOR flash device. See its_flash.h for full documentation of functions.
Implementations of the flash interface functions for a NAND flash device. See its_flash.h for full documentation of functions.
Implementations of the flash interface functions for an emulated flash device using RAM...
#define FLASH_INFO_MAX_NUM_FILES
#define FLASH_INFO_ERASE_VAL
struct its_flash_info_t its_flash_info_external
struct flash_fs_info_t fs_info
#define FLASH_INFO_MAX_FILE_SIZE
ARM_DRIVER_FLASH PS_FLASH_DEV_NAME
Structure containing the required information about a flash device to be used by the ITS Flash FS...
psa_status_t(* init)(const struct its_flash_info_t *info)
Initialize the Flash Interface.
#define PS_FLASH_ALIGNMENT