From: Michel Pollet Date: Wed, 14 Sep 2011 08:18:13 +0000 (+0100) Subject: core: Added a log level X-Git-Tag: v1.0a9~3 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=d37a537b82579f94a9e0bb7999f2fc50642d8228;p=sx%2Fsimavr.git core: Added a log level added log_level to avr_t to control the output of the simavr library (minimal usage) Signed-off-by: Markus Lampert Signed-off-by: Michel Pollet --- diff --git a/simavr/sim/sim_avr.c b/simavr/sim/sim_avr.c index 885bbdc..dab66e2 100644 --- a/simavr/sim/sim_avr.c +++ b/simavr/sim/sim_avr.c @@ -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; diff --git a/simavr/sim/sim_avr.h b/simavr/sim/sim_avr.h index b8091b6..bc895aa 100644 --- a/simavr/sim/sim_avr.h +++ b/simavr/sim/sim_avr.h @@ -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;