42 #ifndef CFS_COFFEE_ARCH_H
43 #define CFS_COFFEE_ARCH_H
45 #include "contiki-conf.h"
47 #include "hal/error.h"
56 #define FLASH_START 0x8000000
58 #define FLASH_PAGE_SIZE 1024
60 #define FLASH_PAGES 125
64 #define COFFEE_PAGE_SIZE (FLASH_PAGE_SIZE/4)
70 #define COFFEE_ADDRESS 0x8010c00
72 #if (COFFEE_ADDRESS & 0x3FF) !=0
73 #error "COFFEE_ADDRESS not aligned to a 1024-bytes page boundary."
75 #define COFFEE_PAGES ((FLASH_PAGES*FLASH_PAGE_SIZE-(COFFEE_ADDRESS-FLASH_START))/COFFEE_PAGE_SIZE)
76 #define COFFEE_START (COFFEE_ADDRESS & ~(COFFEE_PAGE_SIZE-1))
77 #define COFFEE_SIZE (COFFEE_PAGES*COFFEE_PAGE_SIZE)
80 #define COFFEE_SECTOR_SIZE FLASH_PAGE_SIZE
81 #define COFFEE_NAME_LENGTH 20
91 #define COFFEE_MAX_OPEN_FILES 4
92 #define COFFEE_FD_SET_SIZE 8
93 #define COFFEE_DYN_SIZE (COFFEE_PAGE_SIZE*1)
94 #define COFFEE_MICRO_LOGS 0
95 #define COFFEE_LOG_TABLE_LIMIT 16 // It doesnt' matter as
96 #define COFFEE_LOG_SIZE 128 // COFFEE_MICRO_LOGS is 0.
99 #if COFFEE_PAGES <= 127
100 #define coffee_page_t int8_t
101 #elif COFFEE_PAGES <= 0x7FFF
102 #define coffee_page_t int16_t
106 #define COFFEE_WRITE(buf, size, offset) \
107 stm32w_flash_write(COFFEE_START + offset, buf, size)
109 #define COFFEE_READ(buf, size, offset) \
110 stm32w_flash_read(COFFEE_START + offset, buf, size)
112 #define COFFEE_ERASE(sector) \
113 stm32w_flash_erase(sector)
116 void stm32w_flash_read(int32u address,
void * data, int32u length);
117 void stm32w_flash_write(int32u address,
const void * data, int32u length);
118 void stm32w_flash_erase(int8u sector);
120 int coffee_file_test(
void);