From 7e1e72e29349a8248901d4d4f466d1c9b556344d Mon Sep 17 00:00:00 2001 From: NĂ©lio Laranjeiro Date: Thu, 13 Mar 2008 00:35:33 +0100 Subject: Flash module... Still a problem with the write array... --- .../avr/modules/flash/test/test-write-onebyte.c | 25 ++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'digital/avr/modules/flash/test/test-write-onebyte.c') diff --git a/digital/avr/modules/flash/test/test-write-onebyte.c b/digital/avr/modules/flash/test/test-write-onebyte.c index 7ab5094c..0c27c86a 100644 --- a/digital/avr/modules/flash/test/test-write-onebyte.c +++ b/digital/avr/modules/flash/test/test-write-onebyte.c @@ -29,7 +29,7 @@ #include "modules/utils/utils.h" #include "modules/uart/uart.h" -#define TEST_BASE 0x00 +#define TEST_BASE 0x224 void proto_callback (uint8_t cmd, uint8_t size, uint8_t *args) @@ -41,6 +41,16 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args) /* Reset */ utils_reset (); break; + case c ('e', 0): + /* Erase full */ + flash_erase (FLASH_ERASE_FULL, 0); + break; + case c ('s', 0): + /* print flash status */ + proto_send1b ('s', flash_read_status()); + case c ('w', 0): + /* Send the write enable flash command. */ + flash_send_command (FLASH_WREN); default: /* Error */ proto_send0 ('?'); @@ -58,8 +68,19 @@ main (void) proto_send0 ('c'); flash_init (); proto_send0 ('f'); + + flash_send_command (FLASH_WREN); + proto_send1b ('s', flash_read_status ()); + flash_write (TEST_BASE, 'a'); - proto_send1b ('o',flash_read(TEST_BASE)); + proto_send2b ('o', flash_read_status (), flash_read(TEST_BASE)); + + flash_write (TEST_BASE + 1, 'a'); + proto_send2b ('o', flash_read_status (), flash_read(TEST_BASE + 1)); + + /* read */ + proto_send1b ('r', flash_read (TEST_BASE)); + proto_send1b ('r', flash_read (TEST_BASE + 1)); while (1) proto_accept (uart0_getc ()); -- cgit v1.2.3