From 62dea0dc173ece90867f2aabd0af63c353517bfd Mon Sep 17 00:00:00 2001 From: NĂ©lio Laranjeiro Date: Tue, 21 Oct 2008 13:38:44 +0200 Subject: avr/modules/flash: (see ticket #36) * Update the defines. * Modified the define for the flash page mask. * Update the sector_next function (Not tested yet). --- digital/avr/modules/flash/flash.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'digital/avr/modules/flash/flash.h') diff --git a/digital/avr/modules/flash/flash.h b/digital/avr/modules/flash/flash.h index 80bff9ec..205eedf1 100644 --- a/digital/avr/modules/flash/flash.h +++ b/digital/avr/modules/flash/flash.h @@ -29,11 +29,11 @@ #define FLASH_ADDRESS_HIGH 0x1FFFFF #define FLASH_ADDRESS_ERROR 0xFFFFFF -#define FLASH_ADDRESS_INC_MASK(val) (val = (val+1) & FLASH_HIGH_ADDRESS) +#define FLASH_ADDRESS_INC_MASK(val) ((val) = (val+1) & FLASH_HIGH_ADDRESS) #define FLASH_PAGE_SIZE 0x1000 -#define FLASH_PAGE_MASK (0xFFF) -#define FLASH_PAGE(val) (val & FLASH_PAGE_MASK) +#define FLASH_PAGE_MASK (FLASH_ADDRESS_HIGH & FLASH_PAGE_SIZE) +#define FLASH_PAGE(val) ((val) & FLASH_PAGE_MASK) #define FLASH_ERASE_FULL 0x60 #define FLASH_ERASE_4K 0x20 @@ -104,10 +104,11 @@ uint8_t flash_init (void); /** Find the next sector to write. - * \return the address of the next sector. - */ + * \param addr the address to start the research. + * \return the address of the next sector. + */ uint32_t -flash_sector_next (void); +flash_sector_next (uint32_t addr); /** Write in the flash byte provided in parameter. * \param data the buffer to store the data. -- cgit v1.2.3