summaryrefslogtreecommitdiff
path: root/digital/avr/modules/flash/test/test-write-onebyte.c
diff options
context:
space:
mode:
authorNélio Laranjeiro2008-03-13 00:35:33 +0100
committerNélio Laranjeiro2008-03-13 00:35:33 +0100
commit7e1e72e29349a8248901d4d4f466d1c9b556344d (patch)
tree6d7705bfb5e1300d13b23a31e0f9cc9d2c6a51eb /digital/avr/modules/flash/test/test-write-onebyte.c
parent40eb8ed5e80d6e6e361c6092b26957905de2028b (diff)
Flash module...
Still a problem with the write array...
Diffstat (limited to 'digital/avr/modules/flash/test/test-write-onebyte.c')
-rw-r--r--digital/avr/modules/flash/test/test-write-onebyte.c25
1 files changed, 23 insertions, 2 deletions
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 ());