summaryrefslogtreecommitdiffhomepage
path: root/digital/avr/modules/flash/test/test-flash.c
diff options
context:
space:
mode:
authorNélio Laranjeiro2008-03-05 23:48:19 +0100
committerNélio Laranjeiro2008-03-05 23:48:19 +0100
commit93b2480091b13dbea6a1f1a7265cecbb6718aa56 (patch)
tree06364935bd6fcb554fe4200d123f03938df5ea8a /digital/avr/modules/flash/test/test-flash.c
parent2697928e9c98c86f862ba86a306f3edc36b385b7 (diff)
Added the polling of the busy device status for the write process.
The function write_array shall be fix in a few time.
Diffstat (limited to 'digital/avr/modules/flash/test/test-flash.c')
-rw-r--r--digital/avr/modules/flash/test/test-flash.c26
1 files changed, 23 insertions, 3 deletions
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 ());
}