11 #include "Driver_Flash.h"
12 #include "flash_layout.h"
15 #ifndef ITS_FLASH_DEV_NAME
16 #error "ITS_FLASH_DEV_NAME must be defined by the target in flash_layout.h"
20 #ifndef ITS_SECTOR_SIZE
21 #error "ITS_SECTOR_SIZE must be defined by the target in flash_layout.h"
25 #ifndef ITS_SECTORS_PER_BLOCK
26 #error "ITS_SECTORS_PER_BLOCK must be defined by the target in flash_layout.h"
30 #ifndef ITS_FLASH_PROGRAM_UNIT
31 #error "ITS_FLASH_PROGRAM_UNIT must be defined by the target in flash_layout.h"
32 #elif (ITS_FLASH_PROGRAM_UNIT < 1 || ITS_FLASH_PROGRAM_UNIT > ITS_SECTOR_SIZE)
33 #error "ITS_FLASH_PROGRAM_UNIT must be between 1 and ITS_SECTOR_SIZE inclusive"
34 #elif (ITS_FLASH_PROGRAM_UNIT & (ITS_FLASH_PROGRAM_UNIT - 1) != 0)
35 #error "ITS_FLASH_PROGRAM_UNIT must be a power of two"
41 #ifndef ITS_RAM_FS_SIZE
42 #error "ITS_RAM_FS_SIZE must be defined by the target in flash_layout.h"
44 #define FLASH_INFO_INIT its_flash_ram_init
45 #define FLASH_INFO_READ its_flash_ram_read
46 #define FLASH_INFO_WRITE its_flash_ram_write
47 #define FLASH_INFO_FLUSH its_flash_ram_flush
48 #define FLASH_INFO_ERASE its_flash_ram_erase
50 #elif (ITS_FLASH_PROGRAM_UNIT <= 16)
52 #define FLASH_INFO_INIT its_flash_nor_init
53 #define FLASH_INFO_READ its_flash_nor_read
54 #define FLASH_INFO_WRITE its_flash_nor_write
55 #define FLASH_INFO_FLUSH its_flash_nor_flush
56 #define FLASH_INFO_ERASE its_flash_nor_erase
59 #define ITS_FLASH_ALIGNMENT ITS_FLASH_PROGRAM_UNIT
63 #define FLASH_INFO_INIT its_flash_nand_init
64 #define FLASH_INFO_READ its_flash_nand_read
65 #define FLASH_INFO_WRITE its_flash_nand_write
66 #define FLASH_INFO_FLUSH its_flash_nand_flush
67 #define FLASH_INFO_ERASE its_flash_nand_erase
72 #define ITS_FLASH_ALIGNMENT 1
76 #define FLASH_INFO_BLOCK_SIZE (ITS_SECTOR_SIZE * ITS_SECTORS_PER_BLOCK)
79 #define FLASH_INFO_MAX_FILE_SIZE ITS_UTILS_ALIGN(ITS_MAX_ASSET_SIZE, \
83 #define FLASH_INFO_MAX_NUM_FILES (ITS_NUM_ASSETS + 1)
86 #define FLASH_INFO_ERASE_VAL 0xFFU
90 static uint8_t its_block_data[ITS_RAM_FS_SIZE];
91 #define FLASH_INFO_DEV its_block_data
95 #define FLASH_INFO_DEV &ITS_FLASH_DEV_NAME
106 .sector_size = ITS_SECTOR_SIZE,
ARM_DRIVER_FLASH ITS_FLASH_DEV_NAME
#define FLASH_INFO_MAX_FILE_SIZE
Implementations of the flash interface functions for a NOR flash device. See its_flash.h for full documentation of functions.
#define FLASH_INFO_MAX_NUM_FILES
struct its_flash_info_t its_flash_info_internal
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_ERASE_VAL
#define ITS_FLASH_ALIGNMENT
struct flash_fs_info_t fs_info
#define FLASH_INFO_BLOCK_SIZE
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.