reconfigured coffee to use larger sectors and no micrologs, changed the architecture specific erase function accordingly

This commit is contained in:
nifi 2009-09-21 14:16:32 +00:00
parent 6b60454f2d
commit a71cd04144
2 changed files with 22 additions and 8 deletions

View File

@ -40,11 +40,19 @@
#include "cfs-coffee-arch.h"
static const unsigned char nullb[COFFEE_SECTOR_SIZE] = {0};
static const unsigned char nullb[COFFEE_SECTOR_SIZE < 32 ? COFFEE_SECTOR_SIZE : 32] = {0};
void
cfs_coffee_arch_erase(uint16_t sector)
{
eeprom_write(COFFEE_START + sector * COFFEE_SECTOR_SIZE,
(unsigned char *)nullb, sizeof(nullb));
unsigned int i;
for(i = 0; i <= COFFEE_SECTOR_SIZE - sizeof(nullb); i += sizeof(nullb)) {
eeprom_write(COFFEE_START + sector * COFFEE_SECTOR_SIZE + i,
(unsigned char *)nullb, sizeof(nullb));
}
if(i < COFFEE_SECTOR_SIZE) {
eeprom_write(COFFEE_START + sector * COFFEE_SECTOR_SIZE + i,
(unsigned char *)nullb, COFFEE_SECTOR_SIZE - i);
}
}

View File

@ -44,18 +44,24 @@
#include "contiki-conf.h"
#include "dev/eeprom.h"
#define COFFEE_SECTOR_SIZE 64UL
#define COFFEE_SECTOR_SIZE 1024UL
#define COFFEE_PAGE_SIZE 64UL
#define COFFEE_START CFS_EEPROM_CONF_OFFSET
#define COFFEE_START COFFEE_SECTOR_SIZE
#define COFFEE_SIZE (32 * 1024U - COFFEE_START)
#define COFFEE_NAME_LENGTH 16
#define COFFEE_MAX_OPEN_FILES 4
#define COFFEE_FD_SET_SIZE 4
#define COFFEE_MAX_OPEN_FILES 2
#define COFFEE_FD_SET_SIZE 2
#define COFFEE_LOG_TABLE_LIMIT 16
#define COFFEE_DIR_CACHE_ENTRIES 1
#define COFFEE_DYN_SIZE 1024
#define COFFEE_LOG_SIZE 256
#define COFFEE_MICRO_LOGS 0
#if COFFEE_START < CFS_EEPROM_CONF_OFFSET
#error COFFEE_START must be at least as large as CFS_EEPROM_CONF_OFFSET
#error Change in cfs-coffee-arch.h
#endif /* COFFEE_START < CFS_EEPROM_CONF_OFFSET */
#define COFFEE_WRITE(buf, size, offset) \
eeprom_write(COFFEE_START + (offset), (unsigned char *)(buf), (size))