56 #include "contiki-conf.h"
57 #include <msp430/flash.h>
61 infomem_read(
void *buffer,
unsigned int offset,
unsigned char size)
63 uint8_t *address = (uint8_t *)INFOMEM_START + offset;
64 memcpy(buffer, address, size);
70 char backup[INFOMEM_BLOCK_SIZE];
79 if(offset > (2 * INFOMEM_BLOCK_SIZE)) {
83 flash = (uint8_t *)INFOMEM_START;
88 memcpy(backup, flash, INFOMEM_BLOCK_SIZE);
91 va_start(argp, count);
93 buffer = (uint8_t *)backup + offset;
94 for(i = 0; i < count; i++) {
95 data = va_arg(argp, uint8_t *);
96 size = va_arg(argp, uint16_t);
97 memcpy(buffer, data, size);
104 FCTL2 = FWKEY + FSSEL1 + FN2;
108 FCTL1 = FWKEY + ERASE;
113 buffer = (uint8_t *)backup;
114 for(i = 0; i < INFOMEM_BLOCK_SIZE; i++) {
115 *flash++ = *buffer++;
119 FCTL3 = FWKEY + LOCK;