drivers/wireless: Change some *err() message to *info() messages if what was a *dbg() message does not indicate and error condition.

This commit is contained in:
Gregory Nutt 2016-06-11 19:03:57 -06:00
parent 27bc1a2221
commit f12da847d8
6 changed files with 75 additions and 89 deletions

View File

@ -251,7 +251,7 @@ static inline void cc3000_devgive(FAR struct cc3000_dev_s *priv)
static inline void cc3000_configspi(FAR struct spi_dev_s *spi)
{
nerr("Mode: %d Bits: 8 Frequency: %d\n",
ninfo("Mode: %d Bits: 8 Frequency: %d\n",
CONFIG_CC3000_SPI_MODE, CONFIG_CC3000_SPI_FREQUENCY);
SPI_SETMODE(spi, CONFIG_CC3000_SPI_MODE);
@ -500,7 +500,7 @@ static void * select_thread_func(FAR void *arg)
if (priv->sockets[s].sd == CLOSE_SLOT)
{
priv->sockets[s].sd = FREE_SLOT;
waitllerr("Close\n");
waitllinfo("Close\n");
int count;
do
{
@ -509,7 +509,7 @@ static void * select_thread_func(FAR void *arg)
{
/* Release the waiting threads */
waitllerr("Closed Signaled %d\n", count);
waitllinfo("Closed Signaled %d\n", count);
sem_post(&priv->sockets[s].semwait);
}
}
@ -556,17 +556,17 @@ static void * select_thread_func(FAR void *arg)
{
if (ret > 0 && CC3000_FD_ISSET(priv->sockets[s].sd, &readsds)) /* and has pending data */
{
waitllerr("Signaled %d\n", priv->sockets[s].sd);
waitllinfo("Signaled %d\n", priv->sockets[s].sd);
sem_post(&priv->sockets[s].semwait); /* release the waiting thread */
}
else if (ret > 0 && CC3000_FD_ISSET(priv->sockets[s].sd, &exceptsds)) /* or has pending exception */
{
waitllerr("Signaled %d (exception)\n", priv->sockets[s].sd);
waitllinfo("Signaled %d (exception)\n", priv->sockets[s].sd);
sem_post(&priv->sockets[s].semwait); /* release the waiting thread */
}
else if (priv->sockets[s].received_closed_event) /* or remote has closed connection and we have now read all of HW buffer. */
{
waitllerr("Signaled %d (closed & empty)\n", priv->sockets[s].sd);
waitllinfo("Signaled %d (closed & empty)\n", priv->sockets[s].sd);
priv->sockets[s].emptied_and_remotely_closed = true;
sem_post(&priv->sockets[s].semwait); /* release the waiting thread */
}
@ -1071,7 +1071,7 @@ static ssize_t cc3000_read(FAR struct file *filep, FAR char *buffer, size_t len)
if (len < priv->rx_buffer_max_len)
{
nerr("Unsupported read size: %d\n", len);
nerr("ERROR: Unsupported read size: %d\n", len);
nread = -ENOSYS;
goto errout_with_sem;
}
@ -1531,7 +1531,7 @@ int cc3000_register(FAR struct spi_dev_s *spi,
priv = (FAR struct cc3000_dev_s *)kmm_malloc(sizeof(struct cc3000_dev_s));
if (!priv)
{
nerr("kmm_malloc(%d) failed\n", sizeof(struct cc3000_dev_s));
nerr("ERROR: kmm_malloc(%d) failed\n", sizeof(struct cc3000_dev_s));
return -ENOMEM;
}
#endif
@ -1565,7 +1565,7 @@ int cc3000_register(FAR struct spi_dev_s *spi,
ret = config->irq_attach(config, cc3000_interrupt);
if (ret < 0)
{
nerr("Failed to attach interrupt\n");
nerr("ERROR: Failed to attach interrupt\n");
goto errout_with_priv;
}
@ -1577,7 +1577,7 @@ int cc3000_register(FAR struct spi_dev_s *spi,
ret = register_driver(drvname, &cc3000_fops, 0666, priv);
if (ret < 0)
{
nerr("register_driver() failed: %d\n", ret);
nerr("ERROR: register_driver() failed: %d\n", ret);
goto errout_with_priv;
}

View File

@ -57,26 +57,6 @@
#include <nuttx/wireless/cc3000.h>
#include <nuttx/wireless/cc3000/cc3000_common.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#undef SPI_DEBUG /* Define to enable debug */
#undef SPI_VERBOSE /* Define to enable verbose debug */
#ifdef SPI_DEBUG
# define spierr llerr
# ifdef SPI_VERBOSE
# define spiinfo llerr
# else
# define spiinfo(x...)
# endif
#else
# undef SPI_VERBOSE
# define spierr(x...)
# define spiinfo(x...)
#endif
/****************************************************************************
* Private Types
****************************************************************************/
@ -223,7 +203,7 @@ static void *unsoliced_thread_func(void *parameter)
sizeof(spiconf.rx_buffer), 0);
if (nbytes > 0)
{
nllerr("%d Processed\n", nbytes);
nllinfo("%d Processed\n", nbytes);
spiconf.pfRxHandler(spiconf.rx_buffer.pbuffer);
}
}

View File

@ -63,6 +63,7 @@
#endif
#define waitllerr(x,...) // llerr
#define waitllinfo(x,...) // llinfo
/****************************************************************************
* Private Types
@ -194,13 +195,13 @@ int cc3000_closesocket(int sockfd)
int ret;
#ifdef CONFIG_CC3000_MT
waitllerr("remove\n");
waitllinfo("remove\n");
cc3000_remove_socket(sockfd);
#endif
cc3000_lib_lock();
waitllerr("Call closesocketl\n");
waitllinfo("Call closesocketl\n");
ret = cc3000_closesocket_impl(sockfd);
waitllerr("return closesocket\n");
waitllinfo("return closesocket\n");
cc3000_lib_unlock();
return ret;
}
@ -267,7 +268,7 @@ int cc3000_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
if (setsockopt(sockfd, CC3000_SOL_SOCKET, CC3000_SOCKOPT_ACCEPT_NONBLOCK,
&non_blocking, sizeof(non_blocking)) < 0)
{
nerr("setsockopt failure %d\n", errno);
nerr("ERROR: setsockopt failure %d\n", errno);
return -errno;
}
@ -282,7 +283,7 @@ int cc3000_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
if (setsockopt(sockfd, CC3000_SOL_SOCKET, CC3000_SOCKOPT_ACCEPT_NONBLOCK,
&nonBlocking, sizeof(nonBlocking)) < 0)
{
nerr("setsockopt failure %d\n", errno);
nerr("ERROR: setsockopt failure %d\n", errno);
return -errno;
}
@ -596,9 +597,9 @@ ssize_t cc3000_recv(int sockfd, FAR void *buf, size_t len, int flags)
ssize_t ret;
#ifdef CONFIG_CC3000_MT
waitllerr("wait\n");
waitllinfo("wait\n");
ret = cc3000_wait_data(sockfd);
waitllerr("wait %d\n", ret);
waitllinfo("wait %d\n", ret);
if (ret == -ECONNABORTED)
{
@ -612,9 +613,9 @@ ssize_t cc3000_recv(int sockfd, FAR void *buf, size_t len, int flags)
#endif
cc3000_lib_lock();
waitllerr("recv\n");
waitllinfo("recv\n");
ret = cc3000_recv_impl(sockfd, buf, len, flags);
waitllerr("recv %d\n", ret);
waitllinfo("recv %d\n", ret);
cc3000_lib_unlock();
return ret;
}

View File

@ -169,7 +169,7 @@ static int mrf24j40_transmit (FAR struct ieee802154_dev_s *ieee, FAR stru
static struct mrf24j40_dev_s g_mrf24j40_devices[1];
static const struct ieee802154_devops_s mrf24j40_devops =
static const struct ieee802154_devops_s mrf24j40_devops =
{
mrf24j40_setchannel, mrf24j40_getchannel,
mrf24j40_setpanid , mrf24j40_getpanid,
@ -303,7 +303,7 @@ static uint8_t mrf24j40_getreg(FAR struct spi_dev_s *spi, uint32_t addr)
SPI_SELECT (spi, SPIDEV_IEEE802154, false);
mrf24j40_unlock(spi);
/*err("r[%04X]=%02X\n",addr,rx[len-1]);*/
/*winfo("r[%04X]=%02X\n", addr, rx[len-1]);*/
return rx[len-1];
}
@ -443,7 +443,7 @@ static int mrf24j40_setrxmode(FAR struct mrf24j40_dev_s *dev, int mode)
mrf24j40_setreg(dev->spi, MRF24J40_RXMCR, reg);
dev->rxmode = mode;
err("%u\n",(unsigned)mode);
winfo("%u\n", (unsigned)mode);
return OK;
}
@ -467,10 +467,10 @@ static int mrf24j40_setchannel(FAR struct ieee802154_dev_s *ieee,
uint8_t chan)
{
FAR struct mrf24j40_dev_s *dev = (FAR struct mrf24j40_dev_s *)ieee;
if (chan<11 || chan>26)
{
err("Invalid chan: %d\n",chan);
werr("ERROR: Invalid chan: %d\n",chan);
return -EINVAL;
}
@ -485,7 +485,7 @@ static int mrf24j40_setchannel(FAR struct ieee802154_dev_s *ieee,
mrf24j40_resetrfsm(dev);
dev->channel = chan;
//err("%u\n",(unsigned)chan);
//winfo("%u\n", (unsigned)chan);
return OK;
}
@ -525,7 +525,7 @@ static int mrf24j40_setpanid(FAR struct ieee802154_dev_s *ieee,
mrf24j40_setreg(dev->spi, MRF24J40_PANIDL, (uint8_t)(panid&0xFF));
dev->panid = panid;
err("%04X\n",(unsigned)panid);
winfo("%04X\n", (unsigned)panid);
return OK;
}
@ -567,7 +567,7 @@ static int mrf24j40_setsaddr(FAR struct ieee802154_dev_s *ieee,
mrf24j40_setreg(dev->spi, MRF24J40_SADRL, (uint8_t)(saddr&0xFF));
dev->saddr = saddr;
err("%04X\n",(unsigned)saddr);
winfo("%04X\n", (unsigned)saddr);
return OK;
}
@ -779,7 +779,7 @@ static int mrf24j40_settxpower(FAR struct ieee802154_dev_s *ieee,
return -EINVAL;
}
llerr("remaining attenuation: %d mBm\n",txpwr);
llinfo("remaining attenuation: %d mBm\n",txpwr);
switch(txpwr/100)
{
@ -897,7 +897,7 @@ static int mrf24j40_regdump(FAR struct mrf24j40_dev_s *dev)
char buf[4+16*3+2+1];
int len=0;
err("Short regs:\n");
winfo("Short regs:\n");
for (i = 0; i < 0x40; i++)
{
@ -910,11 +910,11 @@ static int mrf24j40_regdump(FAR struct mrf24j40_dev_s *dev)
if ((i & 15) == 15)
{
sprintf(buf+len, "\n");
err("%s",buf);
winfo("%s", buf);
}
}
err("Long regs:\n");
winfo("Long regs:\n");
for (i=0x80000200;i<0x80000250;i++)
{
if ((i&15)==0)
@ -926,7 +926,7 @@ static int mrf24j40_regdump(FAR struct mrf24j40_dev_s *dev)
if ((i & 15) == 15)
{
sprintf(buf+len, "\n");
err("%s",buf);
winfo("%s", buf);
}
}
@ -952,7 +952,7 @@ static int mrf24j40_ioctl(FAR struct ieee802154_dev_s *ieee, int cmd,
return mrf24j40_regdump(dev);
case 1001: dev->paenabled = (uint8_t)arg;
err("PA %sabled\n",arg?"en":"dis");
winfo("PA %sabled\n", arg ? "en" : "dis");
return OK;
default:
@ -1037,13 +1037,13 @@ static int mrf24j40_transmit(FAR struct ieee802154_dev_s *ieee, FAR struct ieee8
reg = mrf24j40_getreg(dev->spi, MRF24J40_INTCON);
reg &= ~MRF24J40_INTCON_TXNIE;
mrf24j40_setreg(dev->spi, MRF24J40_INTCON, reg);
/* Analyze frame control to compute header length */
fc1 = packet->data[0];
fc2 = packet->data[1];
// err("fc1 %02X fc2 %02X\n", fc1,fc2);
// winfo("fc1 %02X fc2 %02X\n", fc1,fc2);
if ((fc2 & IEEE802154_FC2_DADDR) == IEEE802154_DADDR_SHORT)
{
@ -1073,7 +1073,7 @@ static int mrf24j40_transmit(FAR struct ieee802154_dev_s *ieee, FAR struct ieee8
hlen += 8; /* Ext saddr */
}
// err("hlen %d\n",hlen);
// winfo("hlen %d\n",hlen);
/* Header len, 0, TODO for security modes */
@ -1090,7 +1090,7 @@ static int mrf24j40_transmit(FAR struct ieee802154_dev_s *ieee, FAR struct ieee8
mrf24j40_setreg(dev->spi, addr++, packet->data[ret]);
}
/* If the frame control field contains
/* If the frame control field contains
* an acknowledgment request, set the TXNACKREQ bit.
* See IEEE 802.15.4/2003 7.2.1.1 page 112 for info.
*/
@ -1131,7 +1131,7 @@ static void mrf24j40_irqwork_tx(FAR struct mrf24j40_dev_s *dev)
* channel_busy = (tmp & (1 << CCAFAIL));
*/
//err("TXSTAT%02X!\n", txstat);
//winfo("TXSTAT%02X!\n", txstat);
#warning TODO report errors
UNUSED(txstat);
@ -1159,7 +1159,7 @@ static int mrf24j40_rxenable(FAR struct ieee802154_dev_s *ieee, bool state,
{
FAR struct mrf24j40_dev_s *dev = (FAR struct mrf24j40_dev_s *)ieee;
uint8_t reg;
if (state)
{
mrf24j40_pacontrol(dev, MRF24J40_PA_AUTO);
@ -1193,7 +1193,7 @@ static void mrf24j40_irqwork_rx(FAR struct mrf24j40_dev_s *dev)
uint32_t index;
uint8_t reg;
/*err("!\n");*/
/*winfo("!\n");*/
/* Disable rx int */
@ -1209,7 +1209,7 @@ static void mrf24j40_irqwork_rx(FAR struct mrf24j40_dev_s *dev)
addr = 0x80000300;
dev->ieee.rxbuf->len = mrf24j40_getreg(dev->spi, addr++);
/*err("len %3d\n", dev->ieee.rxbuf->len);*/
/*winfo("len %3d\n", dev->ieee.rxbuf->len);*/
for (index = 0; index < dev->ieee.rxbuf->len; index++)
{
@ -1264,7 +1264,7 @@ static void mrf24j40_irqworker(FAR void *arg)
/* Read and store INTSTAT - this clears the register. */
intstat = mrf24j40_getreg(dev->spi, MRF24J40_INTSTAT);
// err("INT%02X\n", intstat);
// winfo("INT%02X\n", intstat);
/* Do work according to the pending interrupts */
@ -1375,7 +1375,7 @@ FAR struct ieee802154_dev_s *mrf24j40_init(FAR struct spi_dev_s *spi,
dev->lower = lower;
dev->spi = spi;
mrf24j40_initialize(dev);
mrf24j40_setchannel(&dev->ieee, 11);

View File

@ -551,7 +551,7 @@ static void nrf24l01_worker(FAR void *arg)
bool ce = nrf24l01_chipenable(dev, false);
werr("RX_DR is set!\n");
winfo("RX_DR is set!\n");
/* Read and store all received payloads */
@ -586,8 +586,8 @@ static void nrf24l01_worker(FAR void *arg)
status = nrf24l01_readreg(dev, NRF24L01_FIFO_STATUS, &fifo_status, 1);
werr("FIFO_STATUS=%02x\n", fifo_status);
werr("STATUS=%02x\n", status);
winfo("FIFO_STATUS=%02x\n", fifo_status);
winfo("STATUS=%02x\n", status);
}
while (!(fifo_status | NRF24L01_RX_EMPTY));
@ -736,7 +736,7 @@ static int dosend(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data, size_
{
/* Unexpected... */
werr("No TX_DS nor MAX_RT bit set in STATUS reg!\n");
werr("ERROR: No TX_DS nor MAX_RT bit set in STATUS reg!\n");
result = -EIO;
}
@ -1257,7 +1257,7 @@ int nrf24l01_register(FAR struct spi_dev_s *spi, FAR struct nrf24l01_config_s *c
result = register_driver(DEV_NAME, &nrf24l01_fops, 0666, dev);
if (result < 0)
{
werr("register_driver() failed: %d\n", result);
werr("ERROR: register_driver() failed: %d\n", result);
nrf24l01_unregister(dev);
}
@ -1658,7 +1658,7 @@ int nrf24l01_sendto(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data,
if ((dev->en_aa & 1) && (memcmp(destaddr, dev->pipe0addr, dev->addrlen)))
{
werr("Change pipe #0 addr to dest addr\n");
winfo("Change pipe #0 addr to dest addr\n");
nrf24l01_writereg(dev, NRF24L01_RX_ADDR_P0, destaddr, NRF24L01_MAX_ADDR_LEN);
pipeaddrchg = true;
}
@ -1670,7 +1670,7 @@ int nrf24l01_sendto(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data,
/* Restore pipe #0 addr */
nrf24l01_writereg(dev, NRF24L01_RX_ADDR_P0, dev->pipe0addr, NRF24L01_MAX_ADDR_LEN);
werr("Pipe #0 default addr restored\n");
winfo("Pipe #0 default addr restored\n");
}
nrf24l01_unlock(dev->spi);

View File

@ -57,12 +57,15 @@
****************************************************************************/
#ifdef CONFIG_WL_PN532_DEBUG
# define pn532err err
# define pn532err err
# define pn532info info
#else
# ifdef CONFIG_CPP_HAVE_VARARGS
# define pn532err(x...)
# define pn532info(x...)
# else
# define pn532err (void)
# define pn532err (void)
# define pn532info (void)
# endif
#endif
@ -226,7 +229,8 @@ bool pn532_rx_frame_is_valid(struct pn532_frame *f, bool check_data)
if (f->start_code != PN532_SOF)
{
pn532err("Frame startcode 0x%X != 0x%X\n", PN532_SOF, f->start_code);
pn532err("ERROR: Frame startcode 0x%X != 0x%X\n",
PN532_SOF, f->start_code);
return false;
}
@ -238,7 +242,7 @@ bool pn532_rx_frame_is_valid(struct pn532_frame *f, bool check_data)
chk = pn532_checksum(f->len);
if (chk != f->lcs)
{
pn532err("Frame data len checksum failed");
pn532err("ERROR: Frame data len checksum failed");
return false;
}
@ -247,7 +251,8 @@ bool pn532_rx_frame_is_valid(struct pn532_frame *f, bool check_data)
chk = pn532_data_checksum(&f->tfi, f->len);
if (chk != f->data[f->len-1])
{
pn532err("Frame data checksum failed: calc=0x%X != 0x%X", chk, f->data[f->len-1]);
pn532err("ERROR: Frame data checksum failed: calc=0x%X != 0x%X",
chk, f->data[f->len-1]);
return false;
}
}
@ -303,7 +308,7 @@ static int pn532_wait_rx_ready(struct pn532_dev_s *dev, int timeout)
{
if (--timeout == 0x00)
{
pn532err("wait RX timeout!\n");
pn532err("ERROR: wait RX timeout!\n");
return -ETIMEDOUT;
}
@ -414,7 +419,7 @@ int pn532_read_ack(struct pn532_dev_s *dev)
}
else
{
pn532err("ACK NOK");
pn532info("ACK NOK");
res = 0;
}
@ -460,7 +465,7 @@ int pn532_write_frame(struct pn532_dev_s *dev, struct pn532_frame *f)
{
if (!pn532_read_ack(dev))
{
pn532err("command FAILED\n");
pn532err("ERROR: command FAILED\n");
res = -EIO;
}
}
@ -580,8 +585,8 @@ int pn532_get_fw_version(struct pn532_dev_s *dev,
if (f->data[0] == PN532_COMMAND_GETFIRMWAREVERSION + 1)
{
fw = (struct pn_firmware_version*) &f->data[1];
pn532err("FW: %d.%d on IC:0x%X (Features: 0x%X)\n",
fw->ver, fw->rev, fw->ic, fw->support);
pn532info("FW: %d.%d on IC:0x%X (Features: 0x%X)\n",
fw->ver, fw->rev, fw->ic, fw->support);
if (fv)
{
memcpy(fv, fw, sizeof(struct pn_firmware_version));
@ -611,7 +616,7 @@ int pn532_write_gpio(struct pn532_dev_s *dev, uint8_t p3, uint8_t p7)
{
pn532_read(dev, cmd_buffer, 10);
tracetx("Resp:", cmd_buffer, 10);
pn532err("TFI=%x, data0=%X", f->tfi, f->data[0]);
pn532info("TFI=%x, data0=%X", f->tfi, f->data[0]);
if ((f->tfi == PN532_PN532TOHOST) && (f->data[0] == PN532_COMMAND_WRITEGPIO+1))
{
res = OK;
@ -723,15 +728,15 @@ uint32_t pn532_read_passive_target_id(struct pn532_dev_s *dev, uint8_t baudrate)
if (r->nbtg == 1)
{
pn532err("Found %d card(s)\n", r->nbtg);
pn532info("Found %d card(s)\n", r->nbtg);
/* now supports only type_a cards
* if (poll_mode == PN532_POLL_MOD_106KBPS_A)
*/
struct pn_target_type_a *t = (struct pn_target_type_a *) &r->target_data;
pn532err("sens:0x%x sel:0x%x", t->sens_res, t->sel_res);
pn532err("idlen:0x%x ", t->nfcid_len);
pn532info("sens:0x%x sel:0x%x", t->sens_res, t->sel_res);
pn532info("idlen:0x%x ", t->nfcid_len);
/* generate 32bit cid from id (could be longer)
* HACK: Using only top 4 bytes.
@ -817,7 +822,7 @@ static int irq_handler(int irq, FAR void *context)
(void) irq;
(void) context;
/* pn532err("*IRQ*\n"); */
/* pn532info("*IRQ*\n"); */
/* work_queue(HPWORK, &g_dev->irq_work, pn532_worker, dev, 0); */
return OK;
@ -1064,7 +1069,7 @@ static int _ioctl(FAR struct file *filep, int cmd, unsigned long arg)
break;
default:
pn532err("Unrecognized cmd: %d\n", cmd);
pn532err("ERROR: Unrecognized cmd: %d\n", cmd);
ret = -EINVAL;
break;
}
@ -1105,7 +1110,7 @@ int pn532_register(FAR const char *devpath, FAR struct spi_dev_s *spi,
dev = (FAR struct pn532_dev_s *)kmm_malloc(sizeof(struct pn532_dev_s));
if (!dev)
{
pn532err("Failed to allocate instance\n");
pn532err("ERROR: Failed to allocate instance\n");
return -ENOMEM;
}
@ -1123,7 +1128,7 @@ int pn532_register(FAR const char *devpath, FAR struct spi_dev_s *spi,
ret = register_driver(devpath, &g_pn532fops, 0666, dev);
if (ret < 0)
{
pn532err("Failed to register driver: %d\n", ret);
pn532err("ERROR: Failed to register driver: %d\n", ret);
kmm_free(dev);
}