Skip to content

Commit

Permalink
work on liblogger, use predefined macro instead of VERBOSE(l,x) -- pa…
Browse files Browse the repository at this point in the history
…rt 1

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/wsim@495 c0ef0dea-404d-0410-ad65-84cceb5f200a
  • Loading branch information
afraboul committed Jan 11, 2011
1 parent 34f047e commit e142290
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 58 deletions.
16 changes: 8 additions & 8 deletions machine/machine_mon.c
Expand Up @@ -171,7 +171,7 @@ void machine_monitor_add_trace(int access_type)
*
*/

VERBOSE(6,"machine:monitor: watchpoint trace for addr 0x%04x pc=0x%04x val=0x%04x type=%s\n",
INFO("machine:monitor: watchpoint trace for addr 0x%04x pc=0x%04x val=0x%04x type=%s\n",
addr, mcu_get_pc(), value, mode2str(access_type));
#endif

Expand Down Expand Up @@ -222,12 +222,12 @@ void machine_monitor_add_trace(int access_type)
break;
case 1:
mcu_jtag_write_byte(v_addr, v_value);
VERBOSE(6," modify:byte variable \"%s\" [0x%04x:%d] = %d (0x%04x)\n",
INFO(" modify:byte variable \"%s\" [0x%04x:%d] = %d (0x%04x)\n",
watchpoint[index].name, v_addr, v_size, v_value, v_value);
break;
case 2:
mcu_jtag_write_word(v_addr, v_value);
VERBOSE(6," modify:word variable \"%s\" [0x%04x:%d] = %d (0x%04x)\n",
INFO(" modify:word variable \"%s\" [0x%04x:%d] = %d (0x%04x)\n",
watchpoint[index].name, v_addr, v_size, v_value, v_value);
break;
default:
Expand Down Expand Up @@ -260,24 +260,24 @@ void machine_monitor_add_trace(int access_type)
break;

case '1': // char
VERBOSE(6,"machine:monitor(%d): Variable:%s at:0x%04x (char) = '%c'\n",
INFO("machine:monitor(%d): Variable:%s at:0x%04x (char) = '%c'\n",
logString[0], watchpoint[ index ].name,watchpoint[ index ].addr,logString[1]);
break;
case '2': // Byte (int8)
VERBOSE(6,"machine:monitor(%d): Variable:%s at:0x%04x (int8) = '%d'\n",
INFO("machine:monitor(%d): Variable:%s at:0x%04x (int8) = '%d'\n",
logString[0], watchpoint[ index ].name,watchpoint[ index ].addr,logString[1]);
break;
case '3': // Int (int16)
int16 = ((logString[2] & 0xff) << 8) | (logString[1] & 0xff);
VERBOSE(6,"machine:monitor(%d): Variable:%s at:0x%04x (int16) = '%d'\n",
INFO("machine:monitor(%d): Variable:%s at:0x%04x (int16) = '%d'\n",
logString[0], watchpoint[ index ].name,watchpoint[ index ].addr,int16);
break;
case '4': // string
VERBOSE(6,"machine:monitor(%d): Variable:%s at:0x%04x (str) = '%s'\n",
INFO("machine:monitor(%d): Variable:%s at:0x%04x (str) = '%s'\n",
logString[0], watchpoint[ index ].name,watchpoint[ index ].addr,&logString[1]);
break;
default:
VERBOSE(6,"machine:monitor(%d): Variable:%s at:0x%04x (Unknown type) = '%s'\n",
INFO("machine:monitor(%d): Variable:%s at:0x%04x (Unknown type) = '%s'\n",
logString[0], watchpoint[ index ].name,watchpoint[ index ].addr,iter,logString);
break;
}
Expand Down
5 changes: 2 additions & 3 deletions platforms/ez430rf/ez430rf.c
Expand Up @@ -395,14 +395,14 @@ int devices_update(void)
if (((b & (0x10)) == 0) &&
((SYSTEM_BUTTON_LAST & (0x10)) != 0))
{
VERBOSE(3,"%s: button 1 pressed\n",NAME);
INFO("%s: button 1 pressed\n",NAME);
msp430_digiIO_dev_write(PORT1, 0x00, 0x04);
}

if (((b & (0x10)) != 0) &&
((SYSTEM_BUTTON_LAST & (0x10)) == 0))
{
VERBOSE(3,"%s: button 1 released\n",NAME);
INFO("%s: button 1 released\n",NAME);
msp430_digiIO_dev_write(PORT1, 0x04, 0x04);
}

Expand All @@ -411,7 +411,6 @@ int devices_update(void)
}
break;
case UI_EVENT_QUIT: /* q */
HW_DMSG_UI("%s: UI event QUIT\n",NAME);
mcu_signal_add(SIG_UI);
break;
case UI_EVENT_NONE:
Expand Down
1 change: 0 additions & 1 deletion platforms/ot2006/ot2006.c
Expand Up @@ -305,7 +305,6 @@ int devices_update()
}
break;
case UI_EVENT_QUIT:
HW_DMSG_UI(" devices UI event QUIT\n");
MCU_SIGNAL = SIG_UI;
break;
case UI_EVENT_NONE:
Expand Down
17 changes: 8 additions & 9 deletions platforms/otsetre/otsetre.c
Expand Up @@ -381,47 +381,47 @@ int devices_update()
if ((machine.ui.b_down & UI_BUTTON_1) != 0)
{
b &= ~0x10;
VERBOSE(3,"%s: button 1 pressed\n", NAME);
INFO("%s: button 1 pressed\n", NAME);
}
if ((machine.ui.b_down & UI_BUTTON_2) != 0)
{
b &= ~0x20;
VERBOSE(3,"%s: button 2 pressed\n", NAME);
INFO("%s: button 2 pressed\n", NAME);
}
if ((machine.ui.b_down & UI_BUTTON_3) != 0)
{
b &= ~0x40;
VERBOSE(3,"%s: button 3 pressed\n", NAME);
INFO("%s: button 3 pressed\n", NAME);
}
if ((machine.ui.b_down & UI_BUTTON_4) != 0)
{
b &= ~0x80;
VERBOSE(3,"%s: button 4 pressed\n", NAME);
INFO("%s: button 4 pressed\n", NAME);
}

if (b != BUTTONS_LAST)
{
int i;
/* VERBOSE(3,"%s: b 0x%02x last 0x%02x\n",NAME,b,BUTTONS_LAST); */
/* HW_DMSG_PLATFORM(3,"%s: b 0x%02x last 0x%02x\n",NAME,b,BUTTONS_LAST); */
for(i=0; i<4; i++)
{
if (((b & (0x10<<i)) == 0) &&
((BUTTONS_LAST & (0x10<<i)) != 0))
{
VERBOSE(3,"%s: button %d pressed\n",NAME,i+1);
INFO("%s: button %d pressed\n",NAME,i+1);
}

if (((b & (0x10<<i)) != 0) &&
((BUTTONS_LAST & (0x10<<i)) == 0))
{
VERBOSE(3,"%s: button %d released\n",NAME,i+1);
INFO("%s: button %d released\n",NAME,i+1);
}
}
}

/* P4.4-7 */
/* 4 buttons mask */
VERBOSE(4,"%s: port4 write 0x%02x\n",NAME,b);
HW_DMSG_PLATFORM(4,"%s: port4 write 0x%02x\n",NAME,b);
msp430_digiIO_dev_write(PORT4, b, 0xf0);
/* p1.7 // Dallas, high to low interrupt */
/* Logical or binded to p1.7 for IRQ */
Expand All @@ -432,7 +432,6 @@ int devices_update()
}
break;
case UI_EVENT_QUIT:
HW_DMSG_UI("%s: UI event QUIT\n",NAME);
mcu_signal_add(SIG_UI);
break;
case UI_EVENT_NONE:
Expand Down
13 changes: 6 additions & 7 deletions platforms/powwow/powwow.c
Expand Up @@ -338,44 +338,43 @@ devices_update()
if ((machine.ui.b_down & UI_BUTTON_1) != 0)
{
b &= ~0x01;
VERBOSE(4,"%s: button 1 pressed\n", NAME);
INFO("%s: button 1 pressed\n", NAME);
}
if ((machine.ui.b_down & UI_BUTTON_2) != 0)
{
b &= ~0x02;
VERBOSE(4,"%s: button 2 pressed\n", NAME);
INFO("%s: button 2 pressed\n", NAME);
}

if (b != BUTTONS_LAST)
{
int i;
VERBOSE(4,"%s: b 0x%02x last 0x%02x\n",NAME,b,BUTTONS_LAST);
HW_DMSG_PLATFORM(4,"%s: b 0x%02x last 0x%02x\n",NAME,b,BUTTONS_LAST);
for(i=0; i<2; i++)
{
if (((b & (0x01<<i)) == 0) &&
((BUTTONS_LAST & (0x01<<i)) != 0))
{
VERBOSE(3,"%s: button %d pressed\n",NAME,i+1);
INFO("%s: button %d pressed\n",NAME,i+1);
}

if (((b & (0x01<<i)) != 0) &&
((BUTTONS_LAST & (0x01<<i)) == 0))
{
VERBOSE(3,"%s: button %d released\n",NAME,i+1);
INFO("%s: button %d released\n",NAME,i+1);
}
}
}

// Button 1->p1.6, button 2->p1.7
// 2 buttons mask
VERBOSE(4,"%s: port1 write 0x%02x\n",NAME,b<<6);
HW_DMSG_PLATFORM(4,"%s: port1 write 0x%02x\n",NAME,b<<6);
msp430_digiIO_dev_write(PORT1, b<<6, 0xC0);

BUTTONS_LAST = b;
}
break;
case UI_EVENT_QUIT:
HW_DMSG_UI("%s: UI event QUIT\n",NAME);
mcu_signal_add(SIG_UI);
break;
case UI_EVENT_NONE:
Expand Down
6 changes: 3 additions & 3 deletions platforms/senslab/senslab.c
Expand Up @@ -226,17 +226,17 @@ int devices_create(void)

if (xt1_opt.value) {
xin_freq = atoi(xt1_opt.value);
VERBOSE(1,"senslab: xt1 external crystal set to %d Hz\n",xin_freq);
INFO("senslab: xt1 external crystal set to %d Hz\n",xin_freq);
}

if (xt2_opt.value) {
xt2_freq = atoi(xt2_opt.value);
VERBOSE(1,"senslab: xt2 external crystal set to %d Hz\n",xt2_freq);
INFO("senslab: xt2 external crystal set to %d Hz\n",xt2_freq);
}

/*if (xosc_opt.value) {
xosc_freq = atoi(xosc_opt.value);
VERBOSE(1,"senslab: xosc external crystal set to %d Hz\n",xosc_freq);
INFO("senslab: xosc external crystal set to %d Hz\n",xosc_freq);
}*/

/*********************************/
Expand Down
7 changes: 4 additions & 3 deletions platforms/wasp/waspx.c
Expand Up @@ -21,9 +21,10 @@
#include "libgui/ui.h"


#define NO_UPDATE_LOOP_PRINT
#if defined(UPDATE_LOOP_PRINT)
#define HW_UP(x...) VERBOSE(2,x)
#define UPDATE_LOOP_PRINT 0

#if UPDATE_LOOP_PRINT != 0
#define HW_UP(x...) INFO(x)
#else
#define HW_UP(x...) do {} while(0)
#endif
Expand Down
13 changes: 6 additions & 7 deletions platforms/wisenode/wisenode.c
Expand Up @@ -139,17 +139,17 @@ int devices_create(void)

if (xt1_opt.value) {
xin_freq = atoi(xt1_opt.value);
VERBOSE(1,"%s: xt1 external crystal set to %d Hz\n",NAME,xin_freq);
INFO("%s: xt1 external crystal set to %d Hz\n",NAME,xin_freq);
}

if (xt2_opt.value) {
xt2_freq = atoi(xt2_opt.value);
VERBOSE(1,"%s: xt2 external crystal set to %d Hz\n",NAME,xt2_freq);
INFO("%s: xt2 external crystal set to %d Hz\n",NAME,xt2_freq);
}

if (xosc_opt.value) {
xosc_freq = atoi(xosc_opt.value);
VERBOSE(1,"%s: xosc external crystal set to %d Hz\n",NAME,xosc_freq);
INFO("%s: xosc external crystal set to %d Hz\n",NAME,xosc_freq);
}

/*********************************/
Expand Down Expand Up @@ -536,12 +536,12 @@ int devices_update(void)
if ((machine.ui.b_down & UI_BUTTON_1) != 0)
{
b &= ~0x80;
VERBOSE(3,"%s: button 1 pressed\n",NAME);
INFO("%s: button 1 pressed\n",NAME);
}
if ((machine.ui.b_down & UI_BUTTON_2) != 0)
{
b &= ~0x40;
VERBOSE(3,"%s: button 2 pressed\n",NAME);
INFO("%s: button 2 pressed\n",NAME);
}

msp430_digiIO_dev_write(PORT2, b, 0xC0);
Expand All @@ -550,8 +550,7 @@ int devices_update(void)
break; /* UI_EVENT_USER */

case UI_EVENT_QUIT:
HW_DMSG_UI("%s: UI event QUIT\n",NAME);
mcu_signal_add(SIG_HOST | SIGTERM);
mcu_signal_add(SIG_UI);
break;
case UI_EVENT_NONE:
break;
Expand Down
6 changes: 3 additions & 3 deletions platforms/wsn430/wsn430.c
Expand Up @@ -191,17 +191,17 @@ int devices_create(void)

if (xt1_opt.value) {
xin_freq = atoi(xt1_opt.value);
VERBOSE(1,"wsn430: xt1 external crystal set to %d Hz\n",xin_freq);
INFO("wsn430: xt1 external crystal set to %d Hz\n",xin_freq);
}

if (xt2_opt.value) {
xt2_freq = atoi(xt2_opt.value);
VERBOSE(1,"wsn430: xt2 external crystal set to %d Hz\n",xt2_freq);
INFO("wsn430: xt2 external crystal set to %d Hz\n",xt2_freq);
}

if (xosc_opt.value) {
xosc_freq = atoi(xosc_opt.value);
VERBOSE(1,"wsn430: xosc external crystal set to %d Hz\n",xosc_freq);
INFO("wsn430: xosc external crystal set to %d Hz\n",xosc_freq);
}

/*********************************/
Expand Down
28 changes: 14 additions & 14 deletions src/main.c
Expand Up @@ -171,24 +171,24 @@ static void main_run_mode(struct options_t* o)

static void main_end(enum wsim_end_mode_t mode)
{
VERBOSE(1,"wsim:end mode %s (%d)\n", wsim_end_mode_str(mode), mode);
MESSAGE("wsim:end mode %s (%d)\n", wsim_end_mode_str(mode), mode);
/* simulation done */
if (o.do_dump)
{
VERBOSE(2,"wsim:dumper: dump machine state in [%s]\n",o.dumpfile);
INFO("wsim:dumper: dump machine state in [%s]\n",o.dumpfile);
machine_dump(o.dumpfile);
}

/* finishing traces */
if (o.do_trace)
{
VERBOSE(2,"wsim:tracer: finalize trace in [%s]\n",o.tracefile);
INFO("wsim:tracer: finalize trace in [%s]\n",o.tracefile);
tracer_close();
}

if (o.do_etrace)
{
VERBOSE(2,"wsim:tracer: finalize eTrace in [%s]\n",o.etracefile);
INFO("wsim:tracer: finalize eTrace in [%s]\n",o.etracefile);
etracer_close();
}

Expand Down Expand Up @@ -237,21 +237,20 @@ int main(int argc, char* argv[])
logpkt_init(o.do_logpkt, o.logpkt, o.logpktfilename);

OUTPUT("WSim %s, rev %s\n", PACKAGE_VERSION, extract_revision_number());
OUTPUT("copyright 2005, 2006, 2007, 2008, 2009, 2010\n");
OUTPUT("copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011\n");
OUTPUT("Citi Lab, INRIA, INSA de Lyon\n");
VERBOSE(2,"A. Fraboulet, G. Chelius, E. Fleury\n");
VERBOSE(2,"wsim:pid:%d\n",getpid());
OUTPUT("wsim:pid:%d\n",getpid());

switch (sizeof(long))
{
case 4:
VERBOSE(2,"wsim: 32 bits edition\n");
INFO("wsim: 32 bits edition\n");
break;
case 8:
VERBOSE(2,"wsim: 64 bits edition\n");
INFO("wsim: 64 bits edition\n");
break;
default:
VERBOSE(2,"wsim: alien edition\n");
INFO("wsim: alien edition\n");
break;
}

Expand Down Expand Up @@ -291,12 +290,14 @@ int main(int argc, char* argv[])
/* preload flash with file */
if (o.do_preload)
{
INFO("wsim: preloading file %s\n",o.preload);
mcu_hexfile_load(o.preload);
}

/* elf loading */
if (strcmp(o.progname,"none") != 0)
{
INFO("wsim: loading file %s\n",o.progname);
if (machine_load_elf(o.progname,o.verbose))
{
ERROR("wsim: error while loading Elf file\n");
Expand Down Expand Up @@ -334,21 +335,20 @@ int main(int argc, char* argv[])

if (o.do_etrace_at_begin)
{
VERBOSE(2,"wsim: starting eSimu tracer at wsim start\n");
INFO("wsim: starting eSimu tracer at wsim start\n");
etracer_start();
}

if (o.do_monitor || o.do_modify)
{
VERBOSE(2,"wsim: starting memory monitor\n");
INFO("wsim: starting memory monitor\n");
machine_monitor(o.monitor, o.modify);
VERBOSE(2,"wsim: end of memory monitor settings\n");
}

/* tracer creation */
if (o.do_trace)
{
VERBOSE(2,"wsim: starting tracer\n");
INFO("wsim: starting tracer\n");
tracer_start();
}

Expand Down

0 comments on commit e142290

Please sign in to comment.