cores: Move static to front of declaration
[simavr] / tests / tests.c
index 44d70c7..d502fde 100644 (file)
@@ -38,6 +38,7 @@ static avr_cycle_count_t
 cycle_timer_longjmp_cb(struct avr_t *avr, avr_cycle_count_t when, void *param) {
        jmp_buf *jmp = param;
        longjmp(*jmp, LJR_CYCLE_TIMER);
+       return 0;       // clear warning
 }
 
 static jmp_buf *special_deinit_jmpbuf = NULL;
@@ -60,7 +61,7 @@ static int my_avr_run(avr_t * avr)
        // if we just re-enabled the interrupts...
        // double buffer the I flag, to detect that edge
        if (avr->sreg[S_I] && !avr->i_shadow)
-               avr->pending_wait++;
+               avr->interrupts.pending_wait++;
        avr->i_shadow = avr->sreg[S_I];
 
        // run the cycle timers, get the suggested sleep time
@@ -176,11 +177,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 +199,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 (%"