summaryrefslogtreecommitdiffhomepage
path: root/digital/avr
diff options
context:
space:
mode:
Diffstat (limited to 'digital/avr')
-rw-r--r--digital/avr/modules/flash/flash.c2
-rw-r--r--digital/avr/modules/flash/flash.h1
-rw-r--r--digital/avr/modules/flash/test/test-flash.c12
3 files changed, 8 insertions, 7 deletions
diff --git a/digital/avr/modules/flash/flash.c b/digital/avr/modules/flash/flash.c
index db5645aa..69277266 100644
--- a/digital/avr/modules/flash/flash.c
+++ b/digital/avr/modules/flash/flash.c
@@ -152,7 +152,7 @@ flash_sector_next (uint32_t addr)
/* Search for the next address to start writing. */
for (addr = FLASH_PAGE (addr);
(rsp != 0xFF) && (addr < FLASH_ADDRESS_HIGH);
- addr += FLASH_PAGE_SIZE - 1)
+ addr += FLASH_PAGE_SIZE)
{
rsp = flash_read (addr);
}
diff --git a/digital/avr/modules/flash/flash.h b/digital/avr/modules/flash/flash.h
index 205eedf1..06c64f54 100644
--- a/digital/avr/modules/flash/flash.h
+++ b/digital/avr/modules/flash/flash.h
@@ -29,7 +29,6 @@
#define FLASH_ADDRESS_HIGH 0x1FFFFF
#define FLASH_ADDRESS_ERROR 0xFFFFFF
-#define FLASH_ADDRESS_INC_MASK(val) ((val) = (val+1) & FLASH_HIGH_ADDRESS)
#define FLASH_PAGE_SIZE 0x1000
#define FLASH_PAGE_MASK (FLASH_ADDRESS_HIGH & FLASH_PAGE_SIZE)
diff --git a/digital/avr/modules/flash/test/test-flash.c b/digital/avr/modules/flash/test/test-flash.c
index 5d1ba0f6..5ccd3b39 100644
--- a/digital/avr/modules/flash/test/test-flash.c
+++ b/digital/avr/modules/flash/test/test-flash.c
@@ -86,9 +86,10 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
* - 1b: byte. */
flash_write (addr, args[3]);
break;
- case c ('p', 0):
- /* Find the next page to write. */
- addr = flash_sector_next (0);
+ case c ('p', 3):
+ /* Find the next page to write.
+ * - 3b: the start address. */
+ addr = flash_sector_next (addr);
proto_send3b ('p', addr >> 16, addr >> 8, addr);
break;
default:
@@ -114,11 +115,12 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
int
main (void)
{
+ uint8_t status;
uart0_init ();
proto_send0 ('z');
proto_send0 ('c');
- flash_init ();
- proto_send0 ('f');
+ status = flash_init ();
+ proto_send1b ('f', status);
while (1)
proto_accept (uart0_getc ());