summaryrefslogtreecommitdiff
path: root/digital/avr/modules/flash/test/test-write-onebyte.c
diff options
context:
space:
mode:
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 ());