summaryrefslogtreecommitdiffhomepage
path: root/digital/avr/modules/flash/test
diff options
context:
space:
mode:
authorNicolas Schodet2008-03-02 11:26:02 +0100
committerNicolas Schodet2008-03-02 11:26:02 +0100
commita87ddfd43ed21ce3227b41624066d2b4ea468e7e (patch)
treeecacfaa3b54ecf8417dc6b0c2609331df2c67bab /digital/avr/modules/flash/test
parenta276fe77c7289d4955b947250a778cf780287147 (diff)
* digital/avr/modules/spi, digital/avr/modules/flash:
- master should drive SS. - to receive, master should send something. - testing SPIF before the first sent does not work. - fixed flash test.
Diffstat (limited to 'digital/avr/modules/flash/test')
-rw-r--r--digital/avr/modules/flash/test/Makefile7
-rw-r--r--digital/avr/modules/flash/test/test-flash.c24
2 files changed, 22 insertions, 9 deletions
diff --git a/digital/avr/modules/flash/test/Makefile b/digital/avr/modules/flash/test/Makefile
index 9fcc8790..ff34bc7f 100644
--- a/digital/avr/modules/flash/test/Makefile
+++ b/digital/avr/modules/flash/test/Makefile
@@ -1,5 +1,5 @@
BASE = ../../..
-PROGS = test_flash
+AVR_PROGS = test_flash
test_flash_SOURCES = test-flash.c
MODULES = utils spi flash proto uart
CONFIGFILE = avrconfig.h
@@ -9,9 +9,4 @@ AVR_MCU = atmega128
# -Os : size
OPTIMIZE = -O2
-# Test compilations.
-#TEST_MCU = atmega8 atmega8535 atmega128
-#TEST_CONFIGFILES = avrconfig_ring.h avrconfig_polling.h avrconfig_twoports.h
-#avrconfig_twoports_TEST_MCU = atmega128
-
include $(BASE)/make/Makefile.gen
diff --git a/digital/avr/modules/flash/test/test-flash.c b/digital/avr/modules/flash/test/test-flash.c
index e90db20f..08417f64 100644
--- a/digital/avr/modules/flash/test/test-flash.c
+++ b/digital/avr/modules/flash/test/test-flash.c
@@ -26,19 +26,37 @@
#include "io.h"
#include "../flash.h"
#include "modules/proto/proto.h"
+#include "modules/utils/utils.h"
+#include "modules/uart/uart.h"
void
proto_callback (uint8_t cmd, uint8_t size, uint8_t *args)
{
- //TODO Still don't know what to to
+#define c(cmd, size) (cmd << 8 | size)
+ switch (c (cmd, size))
+ {
+ case c ('z', 0):
+ /* Reset */
+ utils_reset ();
+ break;
+ default:
+ /* Error */
+ proto_send0 ('?');
+ return;
+ }
+ /* Acknowledge what has been done */
+ proto_send (cmd, size, args);
}
int
main (void)
{
+ uart0_init ();
proto_send0 ('z');
+ proto_send0 ('c');
flash_init ();
-
- while (1);
+ proto_send0 ('f');
+ while (1)
+ proto_accept (uart0_getc ());
}