45 #ifndef CFS_COFFEE_ARCH_H
46 #define CFS_COFFEE_ARCH_H
48 #include "contiki-conf.h"
59 #define FLASH_START 0x8000000
61 #define FLASH_PAGE_SIZE 1024
63 #define FLASH_PAGES 125
66 #define COFFEE_PAGE_SIZE (FLASH_PAGE_SIZE/4)
73 #define COFFEE_ADDRESS 0x8010c00
75 #if (COFFEE_ADDRESS & 0x3FF) != 0
76 #error "COFFEE_ADDRESS not aligned to a 1024-bytes page boundary."
79 #define COFFEE_PAGES ((FLASH_PAGES*FLASH_PAGE_SIZE- \
80 (COFFEE_ADDRESS-FLASH_START))/COFFEE_PAGE_SIZE)
81 #define COFFEE_START (COFFEE_ADDRESS & ~(COFFEE_PAGE_SIZE-1))
82 #define COFFEE_SIZE (COFFEE_PAGES*COFFEE_PAGE_SIZE)
85 #define COFFEE_SECTOR_SIZE FLASH_PAGE_SIZE
86 #define COFFEE_NAME_LENGTH 20
98 #define COFFEE_MAX_OPEN_FILES 4
99 #define COFFEE_FD_SET_SIZE 8
100 #define COFFEE_DYN_SIZE (COFFEE_PAGE_SIZE*1)
102 #define COFFEE_MICRO_LOGS 0
103 #define COFFEE_LOG_TABLE_LIMIT 16
104 #define COFFEE_LOG_SIZE 128
106 #if COFFEE_PAGES <= 127
107 #define coffee_page_t int8_t
108 #elif COFFEE_PAGES <= 0x7FFF
109 #define coffee_page_t int16_t
112 #define COFFEE_WRITE(buf, size, offset) \
113 stm32w_flash_write(COFFEE_START + offset, buf, size)
115 #define COFFEE_READ(buf, size, offset) \
116 stm32w_flash_read(COFFEE_START + offset, buf, size)
118 #define COFFEE_ERASE(sector) \
119 stm32w_flash_erase(sector)
122 void stm32w_flash_read(uint32_t address,
void *data, uint32_t length);
124 void stm32w_flash_write(uint32_t address,
const void *data, uint32_t length);
126 void stm32w_flash_erase(uint8_t sector);
128 int coffee_file_test(
void);
Header for flash for APIs.
Return codes for API functions and module definitions.