From 93b2480091b13dbea6a1f1a7265cecbb6718aa56 Mon Sep 17 00:00:00 2001 From: NĂ©lio Laranjeiro Date: Wed, 5 Mar 2008 23:48:19 +0100 Subject: Added the polling of the busy device status for the write process. The function write_array shall be fix in a few time. --- digital/avr/modules/flash/test/test-flash.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'digital/avr/modules/flash/test') diff --git a/digital/avr/modules/flash/test/test-flash.c b/digital/avr/modules/flash/test/test-flash.c index 35d4049d..ace1de8a 100644 --- a/digital/avr/modules/flash/test/test-flash.c +++ b/digital/avr/modules/flash/test/test-flash.c @@ -29,6 +29,8 @@ #include "modules/utils/utils.h" #include "modules/uart/uart.h" +#define TEST_BASE 0x50 + void proto_callback (uint8_t cmd, uint8_t size, uint8_t *args) { @@ -51,14 +53,32 @@ proto_callback (uint8_t cmd, uint8_t size, uint8_t *args) int main (void) { + uint8_t data[26]; + uint8_t data_rsp[26]; + uint8_t i; + uart0_init (); proto_send0 ('z'); proto_send0 ('c'); flash_init (); proto_send0 ('f'); - flash_write (0x10, 'a'); - utils_delay_us (FLASH_TBP_US); - proto_send1b ('o',flash_read(0x10)); + /*flash_write (TEST_BASE, 'a'); + proto_send1b ('o',flash_read(TEST_BASE)); +*/ + for (i = 0; i < 26; i++) + { + data[i] = i + 'a'; + } + + /* Write a full array. */ + flash_write_array (TEST_BASE + 1, data, 26); + + /* Read a full array. */ + flash_read_array (TEST_BASE + 1, data_rsp, 26); + + /* Print the data_rsp to the i2c */ + proto_send ('g', 26, data_rsp); + while (1) proto_accept (uart0_getc ()); } -- cgit v1.2.3