Commit d37a537b82579f94a9e0bb7999f2fc50642d8228
authorMichel Pollet <buserror@gmail.com>
Wed, 14 Sep 2011 08:18:13 +0000 (09:18 +0100)
committerMichel Pollet <buserror@gmail.com>
Wed, 14 Sep 2011 08:18:13 +0000 (09:18 +0100)
added log_level to avr_t to control the output of the
simavr library (minimal usage)

Signed-off-by: Markus Lampert <mlampert@telus.net>
Signed-off-by: Michel Pollet <buserror@gmail.com>
2 files changed:
simavr/sim/sim_avr.c
simavr/sim/sim_avr.h

index 885bbdcb156450c5f1f8ccb4323003baf51be5f2..dab66e2070389b524710bb0a704bf0983fa841c3 100644 (file)
@@ -52,6 +52,7 @@ int avr_init(avr_t * avr)
        avr->run = avr_callback_run_raw;
        avr->sleep = avr_callback_sleep_raw;
        avr->state = cpu_Running;
+       avr->log = 1;
        avr_reset(avr); 
        return 0;
 }
@@ -210,7 +211,8 @@ void avr_callback_run_gdb(avr_t * avr)
 
        if (avr->state == cpu_Sleeping) {
                if (!avr->sreg[S_I]) {
-                       if ( avr->log_level) printf("simavr: sleeping with interrupts off, quitting gracefully\n");
+                       if (avr->log)
+                               printf("simavr: sleeping with interrupts off, quitting gracefully\n");
                        avr_terminate(avr);
                        avr->state = cpu_Done;
                        return;
@@ -263,7 +265,8 @@ void avr_callback_run_raw(avr_t * avr)
 
        if (avr->state == cpu_Sleeping) {
                if (!avr->sreg[S_I]) {
-                       if ( avr->log_level) printf("simavr: sleeping with interrupts off, quitting gracefully\n");
+                       if (avr->log)
+                               printf("simavr: sleeping with interrupts off, quitting gracefully\n");
                        avr_terminate(avr);
                        avr->state = cpu_Done;
                        return;
index b8091b6219f8003aa48d3a72105b293d0885cb0a..bc895aaf777eb80e1d30614116af6bfe3cca7d65 100644 (file)
@@ -249,7 +249,8 @@ typedef struct avr_t {
        uint32_t        pending[2];             // pending interrupts
 
        // DEBUG ONLY -- value ignored if CONFIG_SIMAVR_TRACE = 0
-       int             trace;
+       int             trace : 1,
+                       log : 2; // log level, default to 1
 
        // Only used if CONFIG_SIMAVR_TRACE is defined
        struct avr_trace_data_t *trace_data;