summaryrefslogtreecommitdiff
path: root/digital/avr/modules/flash/flash.h
diff options
context:
space:
mode:
authorNélio Laranjeiro2008-10-21 13:38:44 +0200
committerNélio Laranjeiro2008-10-21 13:38:44 +0200
commit62dea0dc173ece90867f2aabd0af63c353517bfd (patch)
tree98e88407ff068f896fcfdb054da9cff6fa86a617 /digital/avr/modules/flash/flash.h
parent7500ab5bbecf67689c5069d2a8ae358b4f75899c (diff)
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).
Diffstat (limited to 'digital/avr/modules/flash/flash.h')
-rw-r--r--digital/avr/modules/flash/flash.h13
1 files changed, 7 insertions, 6 deletions
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.