Commit 725bede6f51610650d2f23ff47e50165aff250c9
authorStephan Veigl <veigl@gmx.net>
Fri, 24 Jun 2011 12:33:02 +0000 (14:33 +0200)
committerMichel Pollet <buserror@gmail.com>
Wed, 14 Sep 2011 07:17:51 +0000 (08:17 +0100)
- add tests_assert_uart_receive_avr() function (called by tests_assert_uart_receive() and test cases)
- fix DDR settings

Signed-off-by: Stephan Veigl <veigl@gmx.net>
4 files changed:
tests/atmega48_watchdog_test.c
tests/atmega88_timer16.c
tests/tests.c
tests/tests.h

index bae181c7e4c076a3db835742c27ceeff4083b6fe..cbcf4be70561235164a806b8d0cb12d9314ca6f9 100644 (file)
@@ -55,7 +55,8 @@ ISR(WDT_vect)
 int main()
 {
        stdout = &mystdout;
-
+       DDRD = (1<<PD1); // configure TxD as output
+       
        wdt_enable(WDTO_120MS);
 
        // enable watchdog interupt
index f8e14f58bb5b4f4dbe06bd0a63c23690afeed821..31e5327a7a8432eeed86bb936811b82fb6f3431a 100644 (file)
@@ -69,7 +69,7 @@ int main()
        // timer prescaler to 64
        TCCR1B |= (0<<CS12 | 1<<CS11 | 1<<CS10);
 
-       DDRB = 5;
+       DDRB = 0x0B;
        
        //
        // now enable a tick counter
index 44d70c7ace3ec7e0680e2066806c4821c56f8862..c21b1ac46bf6a8ac4610f2ef1a35df6e70ef841c 100644 (file)
@@ -176,11 +176,10 @@ static void init_output_buffer(struct output_buffer *buf) {
        buf->maxlen = 4096;
 }
 
-void tests_assert_uart_receive(const char *elfname,
+void tests_assert_uart_receive_avr(avr_t *avr,
                               unsigned long run_usec,
                               const char *expected,
                               char uart) {
-       avr_t *avr = tests_init_avr(elfname);
        struct output_buffer buf;
        init_output_buffer(&buf);
 
@@ -199,6 +198,18 @@ void tests_assert_uart_receive(const char *elfname,
                _fail(NULL, 0, "UART outputs differ: expected \"%s\", got \"%s\"", expected, buf.str);
 }
 
+void tests_assert_uart_receive(const char *elfname,
+                              unsigned long run_usec,
+                              const char *expected,
+                              char uart) {
+       avr_t *avr = tests_init_avr(elfname);
+
+       tests_assert_uart_receive_avr(avr,
+                              run_usec,
+                              expected,
+                              uart);
+}
+
 void tests_assert_cycles_at_least(unsigned long n) {
        if (tests_cycle_count < n)
                _fail(NULL, 0, "Program ran for too few cycles (%"
index 14e435bee64ae927fc0f3af9862cb33f49584288..1496b931269927a534569b90e990966564628894 100644 (file)
@@ -28,6 +28,10 @@ void tests_assert_uart_receive(const char *elfname,
                               unsigned long run_usec,
                               const char *expected, // what we should get
                               char uart);
+void tests_assert_uart_receive_avr(avr_t *avr,
+                              unsigned long run_usec,
+                              const char *expected,
+                              char uart);                                 
 
 void tests_assert_cycles_at_least(unsigned long n);
 void tests_assert_cycles_at_most(unsigned long n);