Integrate use of new wireless debug macros. Replace ad hoc debug macros. Convert obsolete dbg() macros to current info(), warn(), err() macros.

This commit is contained in:
Gregory Nutt 2017-03-15 14:37:17 -06:00
parent 15b2046748
commit f985b52587
3 changed files with 39 additions and 37 deletions

View file

@ -283,7 +283,7 @@ static void at86rf23x_setreg(FAR struct spi_dev_s *spi, uint32_t addr,
SPI_SELECT(spi, SPIDEV_IEEE802154, false); SPI_SELECT(spi, SPIDEV_IEEE802154, false);
at86rf23x_unlock(spi); at86rf23x_unlock(spi);
vdbg("0x%02X->r[0x%02X]\n", val, addr); wlinfo("0x%02X->r[0x%02X]\n", val, addr);
} }
/**************************************************************************** /****************************************************************************
@ -311,7 +311,7 @@ static uint8_t at86rf23x_getreg(FAR struct spi_dev_s *spi, uint32_t addr)
at86rf23x_unlock(spi); at86rf23x_unlock(spi);
vdbg("r[0x%02X]=0x%02X\n",addr,val[1]); wlinfo("r[0x%02X]=0x%02X\n",addr,val[1]);
return val[1]; return val[1];
} }
@ -456,7 +456,7 @@ static int at86rf23x_setTRXstate(FAR struct at86rf23x_dev_s *dev,
(status != TRX_STATUS_TXARETON) && (status != TRX_STATUS_TXARETON) &&
(status != TRX_STATUS_PON)) (status != TRX_STATUS_PON))
{ {
dbg("Invalid State\n"); wlerr("ERROR: Invalid State\n");
return ERROR; return ERROR;
} }
@ -632,17 +632,17 @@ static int at86rf23x_setTRXstate(FAR struct at86rf23x_dev_s *dev,
break; break;
default: default:
dbg("%s \n", EINVAL_STR); wlerr("ERRPR: %s \n", EINVAL_STR);
init_status = 0;/* Placed this here to keep compiler happy when not in debug */ init_status = 0;/* Placed this here to keep compiler happy when not in debug */
return -EINVAL; return -EINVAL;
} }
if (ret == ERROR) if (ret == ERROR)
{ {
dbg("State Transistion Error\n"); wlerr("ERROR: State Transistion Error\n");
} }
vdbg("Radio state change state[0x%02x]->state[0x%02x]\n", init_status, status); wlinfo("Radio state change state[0x%02x]->state[0x%02x]\n", init_status, status);
return ret; return ret;
} }
@ -671,7 +671,7 @@ static int at86rf23x_setchannel(FAR struct ieee802154_radio_s *ieee,
if (chan < 11 || chan > 26) if (chan < 11 || chan > 26)
{ {
dbg("Invalid requested chan: %d\n",chan); wlerr("ERROR: Invalid requested chan: %d\n",chan);
return -EINVAL; return -EINVAL;
} }
@ -681,7 +681,7 @@ static int at86rf23x_setchannel(FAR struct ieee802154_radio_s *ieee,
if ((TRX_STATUS_SLEEP == state) || (TRX_STATUS_PON == state)) if ((TRX_STATUS_SLEEP == state) || (TRX_STATUS_PON == state))
{ {
dbg("Radio in invalid mode [%02x] to set the channel\n", state); wlerr("ERROR: Radio in invalid mode [%02x] to set the channel\n", state);
return ERROR; return ERROR;
} }
@ -693,7 +693,7 @@ static int at86rf23x_setchannel(FAR struct ieee802154_radio_s *ieee,
dev->channel = chan; dev->channel = chan;
vdbg("CHANNEL Changed to %d\n", chan); wlinfo("CHANNEL Changed to %d\n", chan);
return OK; return OK;
} }
@ -1200,7 +1200,7 @@ int at86rf23x_initialize(FAR struct at86rf23x_dev_s *dev)
part = at86rf23x_getreg(dev->spi, RF23X_REG_PART); part = at86rf23x_getreg(dev->spi, RF23X_REG_PART);
version = at86rf23x_getreg(dev->spi, RF23X_REG_VERSION); version = at86rf23x_getreg(dev->spi, RF23X_REG_VERSION);
dbg("Radio part: 0x%02x version: 0x%02x found\n", part, version); wlinfo("Radio part: 0x%02x version: 0x%02x found\n", part, version);
return OK; return OK;
} }
@ -1236,7 +1236,7 @@ static int at86rf23x_resetrf(FAR struct at86rf23x_dev_s *dev)
if (retry_cnt == RF23X_MAX_RETRY_RESET_TO_TRX_OFF) if (retry_cnt == RF23X_MAX_RETRY_RESET_TO_TRX_OFF)
{ {
dbg("Reset of transceiver failed\n"); wlerr("ERROR: Reset of transceiver failed\n");
return ERROR; return ERROR;
} }
@ -1346,9 +1346,11 @@ static int at86rf23x_regdump(FAR struct at86rf23x_dev_s *dev)
len += sprintf(buf+len, "%02x ", at86rf23x_getreg(dev->spi, i)); len += sprintf(buf+len, "%02x ", at86rf23x_getreg(dev->spi, i));
/* At the end of each 15 regs or end of rf233s regs and actually print dbg message*/ /* At the end of each 15 regs or end of rf233s regs and actually print
* debug message.
*/
if ((i&15)==15 || i == 0x2f) if ((i&15) == 15 || i == 0x2f)
{ {
sprintf(buf+len, "\n"); sprintf(buf+len, "\n");
printf("%s",buf); printf("%s",buf);
@ -1373,7 +1375,7 @@ static void at86rf23x_irqworker(FAR void *arg)
FAR struct at86rf23x_dev_s *dev = (FAR struct at86rf23x_dev_s *)arg; FAR struct at86rf23x_dev_s *dev = (FAR struct at86rf23x_dev_s *)arg;
uint8_t irq_status = at86rf23x_getreg(dev->spi, RF23X_REG_IRQ_STATUS); uint8_t irq_status = at86rf23x_getreg(dev->spi, RF23X_REG_IRQ_STATUS);
vdbg("IRQ: 0x%02X\n", irq_status); wlinfo("IRQ: 0x%02X\n", irq_status);
if ((irq_status & (1<<3)) != 0) if ((irq_status & (1<<3)) != 0)
{ {
@ -1388,7 +1390,7 @@ static void at86rf23x_irqworker(FAR void *arg)
} }
else else
{ {
dbg("Unknown IRQ Status: %d\n", irq_status); wlerr("ERROR: Unknown IRQ Status: %d\n", irq_status);
/* Re enable the IRQ even if we don't know how to handle previous /* Re enable the IRQ even if we don't know how to handle previous
* status. * status.
@ -1410,7 +1412,7 @@ static void at86rf23x_irqwork_rx(FAR struct at86rf23x_dev_s *dev)
{ {
uint8_t rx_len; uint8_t rx_len;
vdbg("6LOWPAN:Rx IRQ\n"); wlinfo("6LOWPAN:Rx IRQ\n");
rx_len = at86rf23x_readframe(dev->spi, dev->ieee.rxbuf->data); rx_len = at86rf23x_readframe(dev->spi, dev->ieee.rxbuf->data);
@ -1440,7 +1442,7 @@ static void at86rf23x_irqwork_rx(FAR struct at86rf23x_dev_s *dev)
static void at86rf23x_irqwork_tx(FAR struct at86rf23x_dev_s *dev) static void at86rf23x_irqwork_tx(FAR struct at86rf23x_dev_s *dev)
{ {
vdbg("6LOWPAN:Tx IRQ\n"); wlinfo("6LOWPAN:Tx IRQ\n");
/* TODO: /* TODO:
* There needs to be more here but for now just alert the waiting * There needs to be more here but for now just alert the waiting
@ -1482,7 +1484,7 @@ static int at86rf23x_transmit(FAR struct ieee802154_radio_s *ieee,
} }
else else
{ {
dbg("Transmit could not put the radio in a Tx state\n"); wlerr("ERROR: Transmit could not put the radio in a Tx state\n");
return ERROR; return ERROR;
} }

View file

@ -342,7 +342,7 @@ static uint8_t mrf24j40_getreg(FAR struct spi_dev_s *spi, uint32_t addr)
SPI_SELECT (spi, SPIDEV_IEEE802154, false); SPI_SELECT (spi, SPIDEV_IEEE802154, false);
mrf24j40_unlock(spi); mrf24j40_unlock(spi);
/*winfo("r[%04X]=%02X\n", addr, rx[len-1]);*/ /*wlinfo("r[%04X]=%02X\n", addr, rx[len-1]);*/
return rx[len-1]; return rx[len-1];
} }
@ -482,7 +482,7 @@ static int mrf24j40_setrxmode(FAR struct mrf24j40_radio_s *dev, int mode)
mrf24j40_setreg(dev->spi, MRF24J40_RXMCR, reg); mrf24j40_setreg(dev->spi, MRF24J40_RXMCR, reg);
dev->rxmode = mode; dev->rxmode = mode;
winfo("%u\n", (unsigned)mode); wlinfo("%u\n", (unsigned)mode);
return OK; return OK;
} }
@ -508,7 +508,7 @@ static int mrf24j40_setchannel(FAR struct ieee802154_radio_s *ieee,
FAR struct mrf24j40_radio_s *dev = (FAR struct mrf24j40_radio_s *)ieee; FAR struct mrf24j40_radio_s *dev = (FAR struct mrf24j40_radio_s *)ieee;
if (chan<11 || chan>26) if (chan<11 || chan>26)
{ {
werr("ERROR: Invalid chan: %d\n",chan); wlerr("ERROR: Invalid chan: %d\n",chan);
return -EINVAL; return -EINVAL;
} }
@ -523,7 +523,7 @@ static int mrf24j40_setchannel(FAR struct ieee802154_radio_s *ieee,
mrf24j40_resetrfsm(dev); mrf24j40_resetrfsm(dev);
dev->channel = chan; dev->channel = chan;
//winfo("%u\n", (unsigned)chan); //wlinfo("%u\n", (unsigned)chan);
return OK; return OK;
} }
@ -563,7 +563,7 @@ static int mrf24j40_setpanid(FAR struct ieee802154_radio_s *ieee,
mrf24j40_setreg(dev->spi, MRF24J40_PANIDL, (uint8_t)(panid&0xFF)); mrf24j40_setreg(dev->spi, MRF24J40_PANIDL, (uint8_t)(panid&0xFF));
dev->panid = panid; dev->panid = panid;
winfo("%04X\n", (unsigned)panid); wlinfo("%04X\n", (unsigned)panid);
return OK; return OK;
} }
@ -605,7 +605,7 @@ static int mrf24j40_setsaddr(FAR struct ieee802154_radio_s *ieee,
mrf24j40_setreg(dev->spi, MRF24J40_SADRL, (uint8_t)(saddr&0xFF)); mrf24j40_setreg(dev->spi, MRF24J40_SADRL, (uint8_t)(saddr&0xFF));
dev->saddr = saddr; dev->saddr = saddr;
winfo("%04X\n", (unsigned)saddr); wlinfo("%04X\n", (unsigned)saddr);
return OK; return OK;
} }
@ -817,7 +817,7 @@ static int mrf24j40_settxpower(FAR struct ieee802154_radio_s *ieee,
return -EINVAL; return -EINVAL;
} }
winfo("remaining attenuation: %d mBm\n",txpwr); wlinfo("remaining attenuation: %d mBm\n",txpwr);
switch(txpwr/100) switch(txpwr/100)
{ {
@ -935,7 +935,7 @@ static int mrf24j40_regdump(FAR struct mrf24j40_radio_s *dev)
char buf[4+16*3+2+1]; char buf[4+16*3+2+1];
int len=0; int len=0;
winfo("Short regs:\n"); wlinfo("Short regs:\n");
for (i = 0; i < 0x40; i++) for (i = 0; i < 0x40; i++)
{ {
@ -948,11 +948,11 @@ static int mrf24j40_regdump(FAR struct mrf24j40_radio_s *dev)
if ((i & 15) == 15) if ((i & 15) == 15)
{ {
sprintf(buf+len, "\n"); sprintf(buf+len, "\n");
winfo("%s", buf); wlinfo("%s", buf);
} }
} }
winfo("Long regs:\n"); wlinfo("Long regs:\n");
for (i=0x80000200;i<0x80000250;i++) for (i=0x80000200;i<0x80000250;i++)
{ {
if ((i&15)==0) if ((i&15)==0)
@ -964,7 +964,7 @@ static int mrf24j40_regdump(FAR struct mrf24j40_radio_s *dev)
if ((i & 15) == 15) if ((i & 15) == 15)
{ {
sprintf(buf+len, "\n"); sprintf(buf+len, "\n");
winfo("%s", buf); wlinfo("%s", buf);
} }
} }
@ -990,7 +990,7 @@ static int mrf24j40_ioctl(FAR struct ieee802154_radio_s *ieee, int cmd,
return mrf24j40_regdump(dev); return mrf24j40_regdump(dev);
case 1001: dev->paenabled = (uint8_t)arg; case 1001: dev->paenabled = (uint8_t)arg;
winfo("PA %sabled\n", arg ? "en" : "dis"); wlinfo("PA %sabled\n", arg ? "en" : "dis");
return OK; return OK;
default: default:
@ -1081,7 +1081,7 @@ static int mrf24j40_transmit(FAR struct ieee802154_radio_s *ieee, FAR struct iee
fc1 = packet->data[0]; fc1 = packet->data[0];
fc2 = packet->data[1]; fc2 = packet->data[1];
// winfo("fc1 %02X fc2 %02X\n", fc1,fc2); // wlinfo("fc1 %02X fc2 %02X\n", fc1,fc2);
if ((fc2 & IEEE802154_FC2_DADDR) == IEEE802154_DADDR_SHORT) if ((fc2 & IEEE802154_FC2_DADDR) == IEEE802154_DADDR_SHORT)
{ {
@ -1111,7 +1111,7 @@ static int mrf24j40_transmit(FAR struct ieee802154_radio_s *ieee, FAR struct iee
hlen += 8; /* Ext saddr */ hlen += 8; /* Ext saddr */
} }
// winfo("hlen %d\n",hlen); // wlinfo("hlen %d\n",hlen);
/* Header len, 0, TODO for security modes */ /* Header len, 0, TODO for security modes */
@ -1170,7 +1170,7 @@ static void mrf24j40_irqwork_tx(FAR struct mrf24j40_radio_s *dev)
dev->ieee.txretries = (reg & MRF24J40_TXSTAT_X_MASK) >> MRF24J40_TXSTAT_X_SHIFT; dev->ieee.txretries = (reg & MRF24J40_TXSTAT_X_MASK) >> MRF24J40_TXSTAT_X_SHIFT;
dev->ieee.txbusy = (reg & MRF24J40_TXSTAT_CCAFAIL) == MRF24J40_TXSTAT_CCAFAIL; dev->ieee.txbusy = (reg & MRF24J40_TXSTAT_CCAFAIL) == MRF24J40_TXSTAT_CCAFAIL;
//winfo("TXSTAT%02X!\n", txstat); //wlinfo("TXSTAT%02X!\n", txstat);
#warning TODO report errors #warning TODO report errors
UNUSED(txstat); UNUSED(txstat);
@ -1232,7 +1232,7 @@ static void mrf24j40_irqwork_rx(FAR struct mrf24j40_radio_s *dev)
uint32_t index; uint32_t index;
uint8_t reg; uint8_t reg;
/*winfo("!\n");*/ /*wlinfo("!\n");*/
/* Disable rx int */ /* Disable rx int */
@ -1248,7 +1248,7 @@ static void mrf24j40_irqwork_rx(FAR struct mrf24j40_radio_s *dev)
addr = MRF24J40_RXBUF_BASE; addr = MRF24J40_RXBUF_BASE;
dev->ieee.rxbuf->len = mrf24j40_getreg(dev->spi, addr++); dev->ieee.rxbuf->len = mrf24j40_getreg(dev->spi, addr++);
/*winfo("len %3d\n", dev->ieee.rxbuf->len);*/ /*wlinfo("len %3d\n", dev->ieee.rxbuf->len);*/
for (index = 0; index < dev->ieee.rxbuf->len; index++) for (index = 0; index < dev->ieee.rxbuf->len; index++)
{ {
@ -1303,7 +1303,7 @@ static void mrf24j40_irqworker(FAR void *arg)
/* Read and store INTSTAT - this clears the register. */ /* Read and store INTSTAT - this clears the register. */
intstat = mrf24j40_getreg(dev->spi, MRF24J40_INTSTAT); intstat = mrf24j40_getreg(dev->spi, MRF24J40_INTSTAT);
// winfo("INT%02X\n", intstat); // wlinfo("INT%02X\n", intstat);
/* Do work according to the pending interrupts */ /* Do work according to the pending interrupts */

View file

@ -353,7 +353,7 @@ static ssize_t ieee802154dev_write(FAR struct file *filep,
if (sem_timedwait(&dev->child->txsem, &timeout)) if (sem_timedwait(&dev->child->txsem, &timeout))
{ {
_err("Radio Device timedout on Tx\n"); wlerr("Radio Device timedout on Tx\n");
} }
done: done: