drivers/sensors: Change some *err() message to *info() messages if what was a *dbg() message does not indicate and error condition.
This commit is contained in:
parent
cffef35644
commit
27bc1a2221
@ -305,7 +305,7 @@ static void adxl345_interrupt(FAR struct adxl345_config_s *config, FAR void *arg
|
||||
ret = work_queue(HPWORK, &priv->work, adxl345_worker, priv, 0);
|
||||
if (ret != 0)
|
||||
{
|
||||
snllerr("Failed to queue work: %d\n", ret);
|
||||
snllerr("ERROR: Failed to queue work: %d\n", ret);
|
||||
}
|
||||
}
|
||||
|
||||
@ -397,7 +397,7 @@ ADXL345_HANDLE adxl345_instantiate(FAR struct i2c_master_s *dev,
|
||||
priv = (FAR struct adxl345_dev_s *)kmm_zalloc(sizeof(struct adxl345_dev_s));
|
||||
if (!priv)
|
||||
{
|
||||
snerr("Failed to allocate the device structure!\n");
|
||||
snerr("ERROR: Failed to allocate the device structure!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -418,7 +418,7 @@ ADXL345_HANDLE adxl345_instantiate(FAR struct i2c_master_s *dev,
|
||||
ret = adxl345_checkid(priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Wrong Device ID!\n");
|
||||
snerr("ERROR: Wrong Device ID!\n");
|
||||
kmm_free(priv);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ uint8_t adxl345_getreg8(FAR struct adxl345_dev_s *priv, uint8_t regaddr)
|
||||
ret = I2C_TRANSFER(priv->i2c, msg, 2);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("I2C_TRANSFER failed: %d\n", ret);
|
||||
snerr("ERROR: I2C_TRANSFER failed: %d\n", ret);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -154,7 +154,7 @@ void adxl345_putreg8(FAR struct adxl345_dev_s *priv,
|
||||
ret = I2C_TRANSFER(priv->i2c, &msg, 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("I2C_TRANSFER failed: %d\n", ret);
|
||||
snerr("ERROR: I2C_TRANSFER failed: %d\n", ret);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -204,7 +204,7 @@ uint16_t adxl345_getreg16(FAR struct adxl345_dev_s *priv, uint8_t regaddr)
|
||||
ret = I2C_TRANSFER(priv->i2c, msg, 2);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("I2C_TRANSFER failed: %d\n", ret);
|
||||
snerr("ERROR: I2C_TRANSFER failed: %d\n", ret);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ static int as5048b_readu8(FAR struct as5048b_dev_s *priv, uint8_t regaddr,
|
||||
ret = i2c_write(priv->i2c, &config, ®addr, sizeof(regaddr));
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_write failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_write failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -148,11 +148,11 @@ static int as5048b_readu8(FAR struct as5048b_dev_s *priv, uint8_t regaddr,
|
||||
ret = i2c_read(priv->i2c, &config, regval, sizeof(*regval));
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_read failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_read failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
snerr("addr: %02x value: %02x ret: %d\n", regaddr, *regval, ret);
|
||||
sninfo("addr: %02x value: %02x ret: %d\n", regaddr, *regval, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ static int as5048b_readu16(FAR struct as5048b_dev_s *priv, uint8_t regaddrhi,
|
||||
ret = as5048b_readu8(priv, regaddrhi, &hi);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("as5048b_readu8 failed: %d\n", ret);
|
||||
snerr("ERROR: as5048b_readu8 failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -184,13 +184,13 @@ static int as5048b_readu16(FAR struct as5048b_dev_s *priv, uint8_t regaddrhi,
|
||||
ret = as5048b_readu8(priv, regaddrlo, &lo);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("as5048b_readu8 failed: %d\n", ret);
|
||||
snerr("ERROR: as5048b_readu8 failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
*regval = (uint16_t)hi << 6 | (uint16_t)lo;
|
||||
snerr("addrhi: %02x addrlo: %02x value: %04x ret: %d\n",
|
||||
regaddrhi, regaddrlo, *regval, ret);
|
||||
sninfo("addrhi: %02x addrlo: %02x value: %04x ret: %d\n",
|
||||
regaddrhi, regaddrlo, *regval, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ static int as5048b_writeu8(FAR struct as5048b_dev_s *priv, uint8_t regaddr,
|
||||
uint8_t buffer[2];
|
||||
int ret;
|
||||
|
||||
snerr("addr: %02x value: %02x\n", regaddr, regval);
|
||||
sninfo("addr: %02x value: %02x\n", regaddr, regval);
|
||||
|
||||
/* Set up the I2C configuration */
|
||||
|
||||
@ -227,7 +227,7 @@ static int as5048b_writeu8(FAR struct as5048b_dev_s *priv, uint8_t regaddr,
|
||||
ret = i2c_write(priv->i2c, &config, buffer, sizeof(buffer));
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_write failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_write failed: %d\n", ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -246,7 +246,7 @@ static int as5048b_writeu16(FAR struct as5048b_dev_s *priv, uint8_t regaddrhi,
|
||||
{
|
||||
int ret;
|
||||
|
||||
snerr("addrhi: %02x addrlo: %02x value: %04x\n",
|
||||
sninfo("addrhi: %02x addrlo: %02x value: %04x\n",
|
||||
regaddrhi, regaddrlo, regval);
|
||||
|
||||
/* Write the high 8 bits of the 13-bit value */
|
||||
@ -254,7 +254,7 @@ static int as5048b_writeu16(FAR struct as5048b_dev_s *priv, uint8_t regaddrhi,
|
||||
ret = as5048b_writeu8(priv, regaddrhi, (uint8_t)(regval >> 6));
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("as5048b_writeu8 failed: %d\n", ret);
|
||||
snerr("ERROR: as5048b_writeu8 failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -263,7 +263,7 @@ static int as5048b_writeu16(FAR struct as5048b_dev_s *priv, uint8_t regaddrhi,
|
||||
ret = as5048b_writeu8(priv, regaddrhi, (uint8_t)regval);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("as5048b_writeu8 failed: %d\n", ret);
|
||||
snerr("ERROR: as5048b_writeu8 failed: %d\n", ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -285,11 +285,11 @@ static int as5048b_readzero(FAR struct as5048b_dev_s *priv,
|
||||
ret = as5048b_readu16(priv, AS5048B_ZEROHI_REG, AS5048B_ZEROLO_REG, zero);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("as5048b_readu16 failed: %d\n", ret);
|
||||
snerr("ERROR: as5048b_readu16 failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
snerr("zero: %04x ret: %d\n", *zero, ret);
|
||||
sninfo("zero: %04x ret: %d\n", *zero, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -305,12 +305,12 @@ static int as5048b_writezero(FAR struct as5048b_dev_s *priv, uint16_t zero)
|
||||
{
|
||||
int ret;
|
||||
|
||||
snerr("zero: %04x\n", zero);
|
||||
sninfo("zero: %04x\n", zero);
|
||||
|
||||
ret = as5048b_writeu16(priv, AS5048B_ZEROHI_REG, AS5048B_ZEROLO_REG, zero);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("as5048b_writeu16 failed: %d\n", ret);
|
||||
snerr("ERROR: as5048b_writeu16 failed: %d\n", ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -331,11 +331,11 @@ static int as5048b_readagc(FAR struct as5048b_dev_s *priv, FAR uint8_t *agc)
|
||||
ret = as5048b_readu8(priv, AS5048B_AGC_REG, agc);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("as5048b_readu8 failed: %d\n", ret);
|
||||
snerr("ERROR: as5048b_readu8 failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
snerr("agc: %02x ret: %d\n", *agc, ret);
|
||||
sninfo("agc: %02x ret: %d\n", *agc, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -354,11 +354,11 @@ static int as5048b_readdiag(FAR struct as5048b_dev_s *priv, FAR uint8_t *diag)
|
||||
ret = as5048b_readu8(priv, AS5048B_DIAG_REG, diag);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("as5048b_readu8 failed: %d\n", ret);
|
||||
snerr("ERROR: as5048b_readu8 failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
snerr("diag: %02x ret: %d\n", *diag, ret);
|
||||
sninfo("diag: %02x ret: %d\n", *diag, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -377,11 +377,11 @@ static int as5048b_readmag(FAR struct as5048b_dev_s *priv, FAR uint16_t *mag)
|
||||
ret = as5048b_readu16(priv, AS5048B_MAGHI_REG, AS5048B_MAGLO_REG, mag);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("as5048b_readu16 failed: %d\n", ret);
|
||||
snerr("ERROR: as5048b_readu16 failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
snerr("mag: %04x ret: %d\n", *mag, ret);
|
||||
sninfo("mag: %04x ret: %d\n", *mag, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -400,11 +400,11 @@ static int as5048b_readang(FAR struct as5048b_dev_s *priv, FAR uint16_t *ang)
|
||||
ret = as5048b_readu16(priv, AS5048B_ANGHI_REG, AS5048B_ANGLO_REG, ang);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("as5048b_readu16 failed: %d\n", ret);
|
||||
snerr("ERROR: as5048b_readu16 failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
snerr("ang: %04x ret: %d\n", *ang, ret);
|
||||
sninfo("ang: %04x ret: %d\n", *ang, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -452,7 +452,7 @@ static int as5048b_position(FAR struct qe_lowerhalf_s *lower,
|
||||
ret = as5048b_readang(priv, &ang);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("as5048b_readang failed: %d\n", ret);
|
||||
snerr("ERROR: as5048b_readang failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -477,21 +477,21 @@ static int as5048b_reset(FAR struct qe_lowerhalf_s *lower)
|
||||
ret = as5048b_writezero(priv, 0);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("as5048b_writezero failed: %d\n", ret);
|
||||
snerr("ERROR: as5048b_writezero failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = as5048b_readang(priv, &ang);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("as5048b_readang failed: %d\n", ret);
|
||||
snerr("ERROR: as5048b_readang failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = as5048b_writezero(priv, ang);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("as5048b_writezero failed: %d\n", ret);
|
||||
snerr("ERROR: as5048b_writezero failed: %d\n", ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -521,7 +521,8 @@ static int as5048b_ioctl(FAR struct qe_lowerhalf_s *lower, int cmd,
|
||||
{
|
||||
*ptr = (int32_t)zero;
|
||||
}
|
||||
snerr("zero: %04x ret: %d\n", *ptr, ret);
|
||||
|
||||
sninfo("zero: %04x ret: %d\n", *ptr, ret);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -532,7 +533,7 @@ static int as5048b_ioctl(FAR struct qe_lowerhalf_s *lower, int cmd,
|
||||
FAR uint8_t *ptr = (FAR uint8_t *)((uintptr_t)arg);
|
||||
DEBUGASSERT(ptr != NULL);
|
||||
ret = as5048b_readagc(priv, ptr);
|
||||
snerr("agc: %02x ret: %d\n", *ptr, ret);
|
||||
sninfo("agc: %02x ret: %d\n", *ptr, ret);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -543,7 +544,7 @@ static int as5048b_ioctl(FAR struct qe_lowerhalf_s *lower, int cmd,
|
||||
FAR uint8_t *ptr = (FAR uint8_t *)((uintptr_t)arg);
|
||||
DEBUGASSERT(ptr != NULL);
|
||||
ret = as5048b_readdiag(priv, ptr);
|
||||
snerr("diag: %02x ret: %d\n", *ptr, ret);
|
||||
sninfo("diag: %02x ret: %d\n", *ptr, ret);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -559,12 +560,13 @@ static int as5048b_ioctl(FAR struct qe_lowerhalf_s *lower, int cmd,
|
||||
{
|
||||
*ptr = (int32_t)mag;
|
||||
}
|
||||
snerr("mag: %04x ret: %d\n", *ptr, ret);
|
||||
|
||||
sninfo("mag: %04x ret: %d\n", *ptr, ret);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
snerr("Unrecognized cmd: %d arg: %ld\n", cmd, arg);
|
||||
snerr("ERROR: Unrecognized cmd: %d arg: %ld\n", cmd, arg);
|
||||
ret = -ENOTTY;
|
||||
break;
|
||||
}
|
||||
@ -604,7 +606,7 @@ FAR struct qe_lowerhalf_s *as5048b_initialize(FAR struct i2c_master_s *i2c,
|
||||
priv = (FAR struct as5048b_dev_s *)kmm_malloc(sizeof(*priv));
|
||||
if (priv == NULL)
|
||||
{
|
||||
snerr("Failed to allocate instance\n");
|
||||
snerr("ERROR: Failed to allocate instance\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ static int bh1750fvi_read16(FAR struct bh1750fvi_dev_s *priv,
|
||||
|
||||
*regval = (uint16_t)((buffer[0]<<8) | (buffer[1]));
|
||||
|
||||
snerr("value: %08x ret: %d\n", *regval, ret);
|
||||
sninfo("value: %08x ret: %d\n", *regval, ret);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -169,7 +169,7 @@ static int bh1750fvi_write8(FAR struct bh1750fvi_dev_s *priv, uint8_t regval)
|
||||
struct i2c_config_s config;
|
||||
int ret;
|
||||
|
||||
snerr("value: %02x\n", regval);
|
||||
sninfo("value: %02x\n", regval);
|
||||
|
||||
/* Set up the I2C configuration */
|
||||
|
||||
@ -182,7 +182,7 @@ static int bh1750fvi_write8(FAR struct bh1750fvi_dev_s *priv, uint8_t regval)
|
||||
ret = i2c_write(priv->i2c, &config, ®val, 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_write failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_write failed: %d\n", ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -236,14 +236,14 @@ static ssize_t bh1750fvi_read(FAR struct file *filep, FAR char *buffer,
|
||||
|
||||
if (buflen != 2)
|
||||
{
|
||||
snerr("You need to read 2 bytes from this sensor!\n");
|
||||
snerr("ERROR: You need to read 2 bytes from this sensor!\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = bh1750fvi_read16(priv, &lux);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Error reading light sensor!\n");
|
||||
snerr("ERROR: Error reading light sensor!\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -283,7 +283,7 @@ static int bh1750fvi_ioctl(FAR struct file *filep, int cmd,
|
||||
ret = bh1750fvi_write8(priv, BH1750FVI_CONTINUOUS_HRM);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Cannot change to Continuously H-Resolution Mode!\n");
|
||||
snerr("ERROR: Cannot change to Continuously H-Resolution Mode!\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -295,7 +295,7 @@ static int bh1750fvi_ioctl(FAR struct file *filep, int cmd,
|
||||
ret = bh1750fvi_write8(priv, BH1750FVI_CONTINUOUS_HRM2);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Cannot change to Continuously H-Resolution Mode2!\n");
|
||||
snerr("ERROR: Cannot change to Continuously H-Resolution Mode2!\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -307,7 +307,7 @@ static int bh1750fvi_ioctl(FAR struct file *filep, int cmd,
|
||||
ret = bh1750fvi_write8(priv, BH1750FVI_CONTINUOUS_LRM);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Cannot change to Continuously L-Resolution Mode!\n");
|
||||
snerr("ERROR: Cannot change to Continuously L-Resolution Mode!\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -319,7 +319,7 @@ static int bh1750fvi_ioctl(FAR struct file *filep, int cmd,
|
||||
ret = bh1750fvi_write8(priv, BH1750FVI_ONETIME_HRM);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Cannot change to One Time H-Resolution Mode!\n");
|
||||
snerr("ERROR: Cannot change to One Time H-Resolution Mode!\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -331,7 +331,7 @@ static int bh1750fvi_ioctl(FAR struct file *filep, int cmd,
|
||||
ret = bh1750fvi_write8(priv, BH1750FVI_ONETIME_HRM2);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Cannot change to One Time H-Resolution Mode2!\n");
|
||||
snerr("ERROR: Cannot change to One Time H-Resolution Mode2!\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -343,7 +343,7 @@ static int bh1750fvi_ioctl(FAR struct file *filep, int cmd,
|
||||
ret = bh1750fvi_write8(priv, BH1750FVI_ONETIME_LRM);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Cannot change to One Time L-Resolution Mode!\n");
|
||||
snerr("ERROR: Cannot change to One Time L-Resolution Mode!\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -361,7 +361,7 @@ static int bh1750fvi_ioctl(FAR struct file *filep, int cmd,
|
||||
ret = bh1750fvi_write8(priv, reg);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Cannot Change Measure Time at MEASURE_TIMEH!\n");
|
||||
snerr("ERROR: Cannot Change Measure Time at MEASURE_TIMEH!\n");
|
||||
}
|
||||
|
||||
reg = BH1750FVI_MEASURE_TIMEL | (*ptr & 0x1F);
|
||||
@ -369,13 +369,13 @@ static int bh1750fvi_ioctl(FAR struct file *filep, int cmd,
|
||||
ret = bh1750fvi_write8(priv, reg);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Cannot Change Measure Time at MEASURE_TIMEL!\n");
|
||||
snerr("ERROR: Cannot Change Measure Time at MEASURE_TIMEL!\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
snerr("Unrecognized cmd: %d\n", cmd);
|
||||
snerr("ERROR: Unrecognized cmd: %d\n", cmd);
|
||||
ret = -ENOTTY;
|
||||
break;
|
||||
}
|
||||
@ -419,7 +419,7 @@ int bh1750fvi_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||
|
||||
if (priv == NULL)
|
||||
{
|
||||
snerr("Failed to allocate instance\n");
|
||||
snerr("ERROR: Failed to allocate instance\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -431,7 +431,7 @@ int bh1750fvi_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||
ret = bh1750fvi_write8(priv, BH1750FVI_POWERON);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Failed to power-on the BH1750FVI!\n");
|
||||
snerr("ERROR: Failed to power-on the BH1750FVI!\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -440,7 +440,7 @@ int bh1750fvi_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||
ret = bh1750fvi_write8(priv, BH1750FVI_CONTINUOUS_HRM);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Failed to enable the Continuosly H-Resolution Mode!\n");
|
||||
snerr("ERROR: Failed to enable the Continuosly H-Resolution Mode!\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -449,7 +449,7 @@ int bh1750fvi_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||
ret = register_driver(devpath, &g_bh1750fvi_fops, 0666, priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Failed to register driver: %d\n", ret);
|
||||
snerr("ERROR: Failed to register driver: %d\n", ret);
|
||||
kmm_free(priv);
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ static uint8_t bmp180_getreg8(FAR struct bmp180_dev_s *priv, uint8_t regaddr)
|
||||
ret = i2c_write(priv->i2c, &config, ®addr, 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_write failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_write failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -207,7 +207,7 @@ static uint8_t bmp180_getreg8(FAR struct bmp180_dev_s *priv, uint8_t regaddr)
|
||||
ret = i2c_read(priv->i2c, &config, ®val, 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_read failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_read failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -240,7 +240,7 @@ static uint16_t bmp180_getreg16(FAR struct bmp180_dev_s *priv, uint8_t regaddr)
|
||||
ret = i2c_write(priv->i2c, &config, ®addr, 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_write failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_write failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -249,7 +249,7 @@ static uint16_t bmp180_getreg16(FAR struct bmp180_dev_s *priv, uint8_t regaddr)
|
||||
ret = i2c_read(priv->i2c, &config, (uint8_t *)®val, 2);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_read failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_read failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -292,7 +292,7 @@ static void bmp180_putreg8(FAR struct bmp180_dev_s *priv, uint8_t regaddr,
|
||||
ret = i2c_write(priv->i2c, &config, (uint8_t *) &data, 2);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_write failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_write failed: %d\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -320,7 +320,7 @@ static int bmp180_checkid(FAR struct bmp180_dev_s *priv)
|
||||
{
|
||||
/* ID is not Correct */
|
||||
|
||||
snerr("Wrong Device ID!\n");
|
||||
snerr("ERROR: Wrong Device ID!\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@ -543,13 +543,13 @@ static ssize_t bmp180_read(FAR struct file *filep, FAR char *buffer,
|
||||
|
||||
if (!buffer)
|
||||
{
|
||||
snerr("Buffer is null\n");
|
||||
snerr("ERROR: Buffer is null\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buflen != 4)
|
||||
{
|
||||
snerr("You can't read something other than 32 bits (4 bytes)\n");
|
||||
snerr("ERROR: You can't read something other than 32 bits (4 bytes)\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -602,7 +602,7 @@ int bmp180_register(FAR const char *devpath, FAR struct i2c_master_s *i2c)
|
||||
priv = (FAR struct bmp180_dev_s *)kmm_malloc(sizeof(struct bmp180_dev_s));
|
||||
if (!priv)
|
||||
{
|
||||
snerr("Failed to allocate instance\n");
|
||||
snerr("ERROR: Failed to allocate instance\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -615,7 +615,7 @@ int bmp180_register(FAR const char *devpath, FAR struct i2c_master_s *i2c)
|
||||
ret = bmp180_checkid(priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Failed to register driver: %d\n", ret);
|
||||
snerr("ERROR: Failed to register driver: %d\n", ret);
|
||||
kmm_free(priv);
|
||||
return ret;
|
||||
}
|
||||
@ -629,7 +629,7 @@ int bmp180_register(FAR const char *devpath, FAR struct i2c_master_s *i2c)
|
||||
ret = register_driver(devpath, &g_bmp180fops, 0666, priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Failed to register driver: %d\n", ret);
|
||||
snerr("ERROR: Failed to register driver: %d\n", ret);
|
||||
kmm_free(priv);
|
||||
}
|
||||
|
||||
|
@ -195,7 +195,7 @@ static int lm75_readb16(FAR struct lm75_dev_s *priv, uint8_t regaddr,
|
||||
ret = lm75_i2c_write(priv, ®addr, 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_write failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_write failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@ static int lm75_readb16(FAR struct lm75_dev_s *priv, uint8_t regaddr,
|
||||
ret = lm75_i2c_read(priv, buffer, 2);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_read failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_read failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -214,7 +214,7 @@ static int lm75_readb16(FAR struct lm75_dev_s *priv, uint8_t regaddr,
|
||||
*/
|
||||
|
||||
*regvalue = b8tob16((b8_t)buffer[0] << 8 | (b8_t)buffer[1]);
|
||||
snerr("addr: %02x value: %08x ret: %d\n", regaddr, *regvalue, ret);
|
||||
sninfo("addr: %02x value: %08x ret: %d\n", regaddr, *regvalue, ret);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -232,7 +232,7 @@ static int lm75_writeb16(FAR struct lm75_dev_s *priv, uint8_t regaddr,
|
||||
uint8_t buffer[3];
|
||||
b8_t regb8;
|
||||
|
||||
snerr("addr: %02x value: %08x\n", regaddr, regval);
|
||||
sninfo("addr: %02x value: %08x\n", regaddr, regval);
|
||||
|
||||
/* Set up a 3 byte message to send */
|
||||
|
||||
@ -265,11 +265,11 @@ static int lm75_readtemp(FAR struct lm75_dev_s *priv, FAR b16_t *temp)
|
||||
ret = lm75_readb16(priv, LM75_TEMP_REG, &temp16);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("lm75_readb16 failed: %d\n", ret);
|
||||
snerr("ERROR: lm75_readb16 failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
snerr("Centigrade: %08x\n", temp16);
|
||||
sninfo("Centigrade: %08x\n", temp16);
|
||||
|
||||
/* Was fahrenheit requested? */
|
||||
|
||||
@ -278,7 +278,7 @@ static int lm75_readtemp(FAR struct lm75_dev_s *priv, FAR b16_t *temp)
|
||||
/* Centigrade to Fahrenheit conversion: F = 9*C/5 + 32 */
|
||||
|
||||
temp16 = b16mulb16(temp16, B16_9DIV5) + B16_32;
|
||||
snerr("Fahrenheit: %08x\n", temp16);
|
||||
sninfo("Fahrenheit: %08x\n", temp16);
|
||||
}
|
||||
|
||||
*temp = temp16;
|
||||
@ -305,14 +305,14 @@ static int lm75_readconf(FAR struct lm75_dev_s *priv, FAR uint8_t *conf)
|
||||
ret = lm75_i2c_write(priv, &buffer, 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_write failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_write failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Restart and read 8-bits from the register */
|
||||
|
||||
ret = lm75_i2c_read(priv, conf, 1);
|
||||
snerr("conf: %02x ret: %d\n", *conf, ret);
|
||||
sninfo("conf: %02x ret: %d\n", *conf, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -328,7 +328,7 @@ static int lm75_writeconf(FAR struct lm75_dev_s *priv, uint8_t conf)
|
||||
{
|
||||
uint8_t buffer[2];
|
||||
|
||||
snerr("conf: %02x\n", conf);
|
||||
sninfo("conf: %02x\n", conf);
|
||||
|
||||
/* Set up a 2 byte message to send */
|
||||
|
||||
@ -384,7 +384,7 @@ static ssize_t lm75_read(FAR struct file *filep, FAR char *buffer, size_t buflen
|
||||
nsamples = buflen / sizeof(b16_t);
|
||||
ptr = (FAR b16_t *)buffer;
|
||||
|
||||
snerr("buflen: %d nsamples: %d\n", buflen, nsamples);
|
||||
sninfo("buflen: %d nsamples: %d\n", buflen, nsamples);
|
||||
|
||||
/* Get the requested number of samples */
|
||||
|
||||
@ -397,7 +397,7 @@ static ssize_t lm75_read(FAR struct file *filep, FAR char *buffer, size_t buflen
|
||||
ret = lm75_readtemp(priv, &temp);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("lm75_readtemp failed: %d\n", ret);
|
||||
snerr("ERROR: lm75_readtemp failed: %d\n", ret);
|
||||
return (ssize_t)ret;
|
||||
}
|
||||
|
||||
@ -438,7 +438,7 @@ static int lm75_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
FAR uint8_t *ptr = (FAR uint8_t *)((uintptr_t)arg);
|
||||
DEBUGASSERT(ptr != NULL);
|
||||
ret = lm75_readconf(priv, ptr);
|
||||
snerr("conf: %02x ret: %d\n", *ptr, ret);
|
||||
sninfo("conf: %02x ret: %d\n", *ptr, ret);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -446,7 +446,7 @@ static int lm75_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case SNIOC_WRITECONF:
|
||||
ret = lm75_writeconf(priv, (uint8_t)arg);
|
||||
snerr("conf: %02x ret: %d\n", *(FAR uint8_t *)arg, ret);
|
||||
sninfo("conf: %02x ret: %d\n", *(FAR uint8_t *)arg, ret);
|
||||
break;
|
||||
|
||||
/* Shutdown the LM75, Arg: None */
|
||||
@ -460,7 +460,7 @@ static int lm75_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
ret = lm75_writeconf(priv, conf | LM75_CONF_SHUTDOWN);
|
||||
}
|
||||
|
||||
snerr("conf: %02x ret: %d\n", conf | LM75_CONF_SHUTDOWN, ret);
|
||||
sninfo("conf: %02x ret: %d\n", conf | LM75_CONF_SHUTDOWN, ret);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -475,7 +475,7 @@ static int lm75_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
ret = lm75_writeconf(priv, conf & ~LM75_CONF_SHUTDOWN);
|
||||
}
|
||||
|
||||
snerr("conf: %02x ret: %d\n", conf & ~LM75_CONF_SHUTDOWN, ret);
|
||||
sninfo("conf: %02x ret: %d\n", conf & ~LM75_CONF_SHUTDOWN, ret);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -483,14 +483,14 @@ static int lm75_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case SNIOC_FAHRENHEIT:
|
||||
priv->fahrenheit = true;
|
||||
snerr("Fahrenheit\n");
|
||||
sninfo("Fahrenheit\n");
|
||||
break;
|
||||
|
||||
/* Report Samples in Centigrade */
|
||||
|
||||
case SNIOC_CENTIGRADE:
|
||||
priv->fahrenheit = false;
|
||||
snerr("Centigrade\n");
|
||||
sninfo("Centigrade\n");
|
||||
break;
|
||||
|
||||
/* Read THYS temperature register. Arg: b16_t* pointer */
|
||||
@ -500,7 +500,7 @@ static int lm75_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
FAR b16_t *ptr = (FAR b16_t *)((uintptr_t)arg);
|
||||
DEBUGASSERT(ptr != NULL);
|
||||
ret = lm75_readb16(priv, LM75_THYS_REG, ptr);
|
||||
snerr("THYS: %08x ret: %d\n", *ptr, ret);
|
||||
sninfo("THYS: %08x ret: %d\n", *ptr, ret);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -508,7 +508,7 @@ static int lm75_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case SNIOC_WRITETHYS:
|
||||
ret = lm75_writeb16(priv, LM75_THYS_REG, (b16_t)arg);
|
||||
snerr("THYS: %08x ret: %d\n", (b16_t)arg, ret);
|
||||
sninfo("THYS: %08x ret: %d\n", (b16_t)arg, ret);
|
||||
break;
|
||||
|
||||
/* Read TOS (Over-temp Shutdown Threshold) Register. Arg: b16_t* pointer */
|
||||
@ -518,7 +518,7 @@ static int lm75_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
FAR b16_t *ptr = (FAR b16_t *)((uintptr_t)arg);
|
||||
DEBUGASSERT(ptr != NULL);
|
||||
ret = lm75_readb16(priv, LM75_TOS_REG, ptr);
|
||||
snerr("TOS: %08x ret: %d\n", *ptr, ret);
|
||||
sninfo("TOS: %08x ret: %d\n", *ptr, ret);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -526,11 +526,11 @@ static int lm75_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case SNIOC_WRITETOS:
|
||||
ret = lm75_writeb16(priv, LM75_TOS_REG, (b16_t)arg);
|
||||
snerr("TOS: %08x ret: %d\n", (b16_t)arg, ret);
|
||||
sninfo("TOS: %08x ret: %d\n", (b16_t)arg, ret);
|
||||
break;
|
||||
|
||||
default:
|
||||
snerr("Unrecognized cmd: %d\n", cmd);
|
||||
sninfo("Unrecognized cmd: %d\n", cmd);
|
||||
ret = -ENOTTY;
|
||||
break;
|
||||
}
|
||||
@ -578,7 +578,7 @@ int lm75_register(FAR const char *devpath, FAR struct i2c_master_s *i2c, uint8_t
|
||||
priv = (FAR struct lm75_dev_s *)kmm_malloc(sizeof(struct lm75_dev_s));
|
||||
if (priv == NULL)
|
||||
{
|
||||
snerr("Failed to allocate instance\n");
|
||||
snerr("ERROR: Failed to allocate instance\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -591,7 +591,7 @@ int lm75_register(FAR const char *devpath, FAR struct i2c_master_s *i2c, uint8_t
|
||||
ret = register_driver(devpath, &g_lm75fops, 0666, priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Failed to register driver: %d\n", ret);
|
||||
snerr("ERROR: Failed to register driver: %d\n", ret);
|
||||
kmm_free(priv);
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ static int lm92_readb16(FAR struct lm92_dev_s *priv, uint8_t regaddr,
|
||||
ret = lm92_i2c_write(priv, ®addr, 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_write failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_write failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -207,7 +207,7 @@ static int lm92_readb16(FAR struct lm92_dev_s *priv, uint8_t regaddr,
|
||||
ret = lm92_i2c_read(priv, buffer, 2);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_read failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_read failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -218,7 +218,7 @@ static int lm92_readb16(FAR struct lm92_dev_s *priv, uint8_t regaddr,
|
||||
*regvalue = (b16_t)((uint32_t)(buffer[0] & (1 << 7)) << 24 |
|
||||
(uint32_t)(buffer[0] & ~(1 << 7)) << 17 |
|
||||
(uint32_t)(buffer[1] & ~7) << 9);
|
||||
snerr("addr: %02x value: %08x ret: %d\n", regaddr, *regvalue, ret);
|
||||
sninfo("addr: %02x value: %08x ret: %d\n", regaddr, *regvalue, ret);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -236,7 +236,7 @@ static int lm92_writeb16(FAR struct lm92_dev_s *priv, uint8_t regaddr,
|
||||
{
|
||||
uint8_t buffer[3];
|
||||
|
||||
snerr("addr: %02x value: %08x\n", regaddr, regval);
|
||||
sninfo("addr: %02x value: %08x\n", regaddr, regval);
|
||||
|
||||
/* Set up a 3-byte message to send */
|
||||
|
||||
@ -268,11 +268,11 @@ static int lm92_readtemp(FAR struct lm92_dev_s *priv, FAR b16_t *temp)
|
||||
ret = lm92_readb16(priv, LM92_TEMP_REG, &temp16);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("lm92_readb16 failed: %d\n", ret);
|
||||
snerr("ERROR: lm92_readb16 failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
snerr("Centigrade: %08x\n", temp16);
|
||||
sninfo("Centigrade: %08x\n", temp16);
|
||||
|
||||
/* Was Fahrenheit requested? */
|
||||
|
||||
@ -281,7 +281,7 @@ static int lm92_readtemp(FAR struct lm92_dev_s *priv, FAR b16_t *temp)
|
||||
/* Centigrade to Fahrenheit conversion: F = 9*C/5 + 32 */
|
||||
|
||||
temp16 = b16mulb16(temp16, B16_9DIV5) + B16_32;
|
||||
snerr("Fahrenheit: %08x\n", temp16);
|
||||
sninfo("Fahrenheit: %08x\n", temp16);
|
||||
}
|
||||
|
||||
*temp = temp16;
|
||||
@ -308,14 +308,14 @@ static int lm92_readconf(FAR struct lm92_dev_s *priv, FAR uint8_t *conf)
|
||||
ret = lm92_i2c_write(priv, &buffer, 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_write failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_write failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Restart and read 8 bits from the register */
|
||||
|
||||
ret = lm92_i2c_read(priv, conf, 1);
|
||||
snerr("conf: %02x ret: %d\n", *conf, ret);
|
||||
sninfo("conf: %02x ret: %d\n", *conf, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -331,7 +331,7 @@ static int lm92_writeconf(FAR struct lm92_dev_s *priv, uint8_t conf)
|
||||
{
|
||||
uint8_t buffer[2];
|
||||
|
||||
snerr("conf: %02x\n", conf);
|
||||
sninfo("conf: %02x\n", conf);
|
||||
|
||||
/* Set up a 2-byte message to send */
|
||||
|
||||
@ -364,7 +364,7 @@ static int lm92_readid(FAR struct lm92_dev_s *priv, FAR uint16_t *id)
|
||||
ret = lm92_i2c_write(priv, ®addr, 1);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_write failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_write failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -373,12 +373,12 @@ static int lm92_readid(FAR struct lm92_dev_s *priv, FAR uint16_t *id)
|
||||
ret = lm92_i2c_read(priv, buffer, 2);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_read failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_read failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
*id = (uint16_t)buffer[0] << 8 | (uint16_t)buffer[1];
|
||||
snerr("id: %04x ret: %d\n", *id, ret);
|
||||
sninfo("id: %04x ret: %d\n", *id, ret);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -427,7 +427,7 @@ static ssize_t lm92_read(FAR struct file *filep, FAR char *buffer,
|
||||
nsamples = buflen / sizeof(b16_t);
|
||||
ptr = (FAR b16_t *)buffer;
|
||||
|
||||
snerr("buflen: %d nsamples: %d\n", buflen, nsamples);
|
||||
sninfo("buflen: %d nsamples: %d\n", buflen, nsamples);
|
||||
|
||||
/* Get the requested number of samples */
|
||||
|
||||
@ -440,7 +440,7 @@ static ssize_t lm92_read(FAR struct file *filep, FAR char *buffer,
|
||||
ret = lm92_readtemp(priv, &temp);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("lm92_readtemp failed: %d\n", ret);
|
||||
snerr("ERROR: lm92_readtemp failed: %d\n", ret);
|
||||
return (ssize_t)ret;
|
||||
}
|
||||
|
||||
@ -481,7 +481,7 @@ static int lm92_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
FAR uint8_t *ptr = (FAR uint8_t *)((uintptr_t)arg);
|
||||
DEBUGASSERT(ptr != NULL);
|
||||
ret = lm92_readconf(priv, ptr);
|
||||
snerr("conf: %02x ret: %d\n", *ptr, ret);
|
||||
sninfo("conf: %02x ret: %d\n", *ptr, ret);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -489,7 +489,7 @@ static int lm92_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case SNIOC_WRITECONF:
|
||||
ret = lm92_writeconf(priv, (uint8_t)arg);
|
||||
snerr("conf: %02x ret: %d\n", *(uint8_t *)arg, ret);
|
||||
sninfo("conf: %02x ret: %d\n", *(uint8_t *)arg, ret);
|
||||
break;
|
||||
|
||||
/* Shutdown the LM92. Arg: None */
|
||||
@ -503,7 +503,7 @@ static int lm92_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
ret = lm92_writeconf(priv, conf | LM92_CONF_SHUTDOWN);
|
||||
}
|
||||
|
||||
snerr("conf: %02x ret: %d\n", conf | LM92_CONF_SHUTDOWN, ret);
|
||||
sninfo("conf: %02x ret: %d\n", conf | LM92_CONF_SHUTDOWN, ret);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -518,7 +518,7 @@ static int lm92_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
ret = lm92_writeconf(priv, conf & ~LM92_CONF_SHUTDOWN);
|
||||
}
|
||||
|
||||
snerr("conf: %02x ret: %d\n", conf & ~LM92_CONF_SHUTDOWN, ret);
|
||||
sninfo("conf: %02x ret: %d\n", conf & ~LM92_CONF_SHUTDOWN, ret);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -526,14 +526,14 @@ static int lm92_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case SNIOC_FAHRENHEIT:
|
||||
priv->fahrenheit = true;
|
||||
snerr("Fahrenheit\n");
|
||||
sninfo("Fahrenheit\n");
|
||||
break;
|
||||
|
||||
/* Report samples in Centigrade. Arg: None */
|
||||
|
||||
case SNIOC_CENTIGRADE:
|
||||
priv->fahrenheit = false;
|
||||
snerr("Centigrade\n");
|
||||
sninfo("Centigrade\n");
|
||||
break;
|
||||
|
||||
/* Read THYS temperature register. Arg: b16_t* pointer */
|
||||
@ -543,7 +543,7 @@ static int lm92_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
FAR b16_t *ptr = (FAR b16_t *)((uintptr_t)arg);
|
||||
DEBUGASSERT(ptr != NULL);
|
||||
ret = lm92_readb16(priv, LM92_THYS_REG, ptr);
|
||||
snerr("THYS: %08x ret: %d\n", *ptr, ret);
|
||||
sninfo("THYS: %08x ret: %d\n", *ptr, ret);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -551,7 +551,7 @@ static int lm92_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case SNIOC_WRITETHYS:
|
||||
ret = lm92_writeb16(priv, LM92_THYS_REG, (b16_t)arg);
|
||||
snerr("THYS: %08x ret: %d\n", (b16_t)arg, ret);
|
||||
sninfo("THYS: %08x ret: %d\n", (b16_t)arg, ret);
|
||||
break;
|
||||
|
||||
/* Read TCRIT temperature register. Arg: b16_t* pointer */
|
||||
@ -561,7 +561,7 @@ static int lm92_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
FAR b16_t *ptr = (FAR b16_t *)((uintptr_t)arg);
|
||||
DEBUGASSERT(ptr != NULL);
|
||||
ret = lm92_readb16(priv, LM92_TCRIT_REG, ptr);
|
||||
snerr("TCRIT: %08x ret: %d\n", *ptr, ret);
|
||||
sninfo("TCRIT: %08x ret: %d\n", *ptr, ret);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -569,7 +569,7 @@ static int lm92_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case SNIOC_WRITETCRIT:
|
||||
ret = lm92_writeb16(priv, LM92_TCRIT_REG, (b16_t)arg);
|
||||
snerr("TCRIT: %08x ret: %d\n", (b16_t)arg, ret);
|
||||
sninfo("TCRIT: %08x ret: %d\n", (b16_t)arg, ret);
|
||||
break;
|
||||
|
||||
/* Read TLOW temperature register. Arg: b16_t* pointer */
|
||||
@ -579,7 +579,7 @@ static int lm92_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
FAR b16_t *ptr = (FAR b16_t *)((uintptr_t)arg);
|
||||
DEBUGASSERT(ptr != NULL);
|
||||
ret = lm92_readb16(priv, LM92_TLOW_REG, ptr);
|
||||
snerr("TLOW: %08x ret: %d\n", *ptr, ret);
|
||||
sninfo("TLOW: %08x ret: %d\n", *ptr, ret);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -587,7 +587,7 @@ static int lm92_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case SNIOC_WRITETLOW:
|
||||
ret = lm92_writeb16(priv, LM92_TLOW_REG, (b16_t)arg);
|
||||
snerr("TLOW: %08x ret: %d\n", (b16_t)arg, ret);
|
||||
sninfo("TLOW: %08x ret: %d\n", (b16_t)arg, ret);
|
||||
break;
|
||||
|
||||
/* Read THIGH temperature register. Arg: b16_t* pointer */
|
||||
@ -597,7 +597,7 @@ static int lm92_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
FAR b16_t *ptr = (FAR b16_t *)((uintptr_t)arg);
|
||||
DEBUGASSERT(ptr != NULL);
|
||||
ret = lm92_readb16(priv, LM92_THIGH_REG, ptr);
|
||||
snerr("THIGH: %08x ret: %d\n", *ptr, ret);
|
||||
sninfo("THIGH: %08x ret: %d\n", *ptr, ret);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -605,7 +605,7 @@ static int lm92_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case SNIOC_WRITETHIGH:
|
||||
ret = lm92_writeb16(priv, LM92_THIGH_REG, (b16_t)arg);
|
||||
snerr("THIGH: %08x ret: %d\n", (b16_t)arg, ret);
|
||||
sninfo("THIGH: %08x ret: %d\n", (b16_t)arg, ret);
|
||||
break;
|
||||
|
||||
/* Read from the identification register. Arg: uint16_t* pointer */
|
||||
@ -615,12 +615,12 @@ static int lm92_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
FAR uint16_t *ptr = (FAR uint16_t *)((uintptr_t)arg);
|
||||
DEBUGASSERT(ptr != NULL);
|
||||
ret = lm92_readid(priv, ptr);
|
||||
snerr("id: %04x ret: %d\n", *ptr, ret);
|
||||
sninfo("id: %04x ret: %d\n", *ptr, ret);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
snerr("Unrecognized cmd: %d\n", cmd);
|
||||
snerr("ERROR: Unrecognized cmd: %d\n", cmd);
|
||||
ret = -ENOTTY;
|
||||
break;
|
||||
}
|
||||
@ -668,7 +668,7 @@ int lm92_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||
priv = (FAR struct lm92_dev_s *)kmm_malloc(sizeof(struct lm92_dev_s));
|
||||
if (priv == NULL)
|
||||
{
|
||||
snerr("Failed to allocate instance\n");
|
||||
snerr("ERROR: Failed to allocate instance\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -681,7 +681,7 @@ int lm92_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||
ret = register_driver(devpath, &g_lm92fops, 0666, priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Failed to register driver: %d\n", ret);
|
||||
snerr("ERROR: Failed to register driver: %d\n", ret);
|
||||
kmm_free(priv);
|
||||
}
|
||||
|
||||
|
@ -660,7 +660,7 @@ static int lsm9ds1_readreg8(FAR struct lsm9ds1_dev_s *priv, uint8_t regaddr,
|
||||
ret = i2c_write(priv->i2c, &config, ®addr, sizeof(regaddr));
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_write failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_write failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -669,7 +669,7 @@ static int lsm9ds1_readreg8(FAR struct lsm9ds1_dev_s *priv, uint8_t regaddr,
|
||||
ret = i2c_read(priv->i2c, &config, regval, sizeof(*regval));
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_read failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_read failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -712,7 +712,7 @@ static int lsm9ds1_writereg8(FAR struct lsm9ds1_dev_s *priv, uint8_t regaddr,
|
||||
ret = i2c_write(priv->i2c, &config, buffer, sizeof(buffer));
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_write failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_write failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -741,7 +741,7 @@ static int lsm9ds1_modifyreg8(FAR struct lsm9ds1_dev_s *priv, uint8_t regaddr,
|
||||
ret = lsm9ds1_readreg8(priv, regaddr, ®val);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("lsm9ds1_readreg8 failed: %d\n", ret);
|
||||
snerr("ERROR: lsm9ds1_readreg8 failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -751,7 +751,7 @@ static int lsm9ds1_modifyreg8(FAR struct lsm9ds1_dev_s *priv, uint8_t regaddr,
|
||||
ret = lsm9ds1_writereg8(priv, regaddr, regval);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("lsm9ds1_writereg8 failed: %d\n", ret);
|
||||
snerr("ERROR: lsm9ds1_writereg8 failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -793,13 +793,13 @@ static int lsm9ds1accelgyro_config(FAR struct lsm9ds1_dev_s *priv)
|
||||
ret = lsm9ds1_readreg8(priv, LSM9DS1_WHO_AM_I, ®val);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("lsm9ds1_readreg8 failed: %d\n", ret);
|
||||
snerr("ERROR: lsm9ds1_readreg8 failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (regval != LSM9DS1_WHO_AM_I_VALUE)
|
||||
{
|
||||
snerr("Invalid device identification %02x\n", regval);
|
||||
snerr("ERROR: Invalid device identification %02x\n", regval);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@ -1047,13 +1047,13 @@ static int lsm9ds1mag_config(FAR struct lsm9ds1_dev_s *priv)
|
||||
ret = lsm9ds1_readreg8(priv, LSM9DS1_WHO_AM_I_M, ®val);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("lsm9ds1_readreg8 failed: %d\n", ret);
|
||||
snerr("ERROR: lsm9ds1_readreg8 failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (regval != LSM9DS1_WHO_AM_I_M_VALUE)
|
||||
{
|
||||
snerr("Invalid device identification %02x\n", regval);
|
||||
snerr("ERROR: Invalid device identification %02x\n", regval);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@ -1280,7 +1280,7 @@ static ssize_t lsm9ds1_read(FAR struct file *filep, FAR char *buffer,
|
||||
ret = lsm9ds1_readreg8(priv, regaddr, &lo);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("lsm9ds1_readreg8 failed: %d\n", ret);
|
||||
snerr("ERROR: lsm9ds1_readreg8 failed: %d\n", ret);
|
||||
return (ssize_t)ret;
|
||||
}
|
||||
|
||||
@ -1291,7 +1291,7 @@ static ssize_t lsm9ds1_read(FAR struct file *filep, FAR char *buffer,
|
||||
ret = lsm9ds1_readreg8(priv, regaddr, &hi);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("lsm9ds1_readreg8 failed: %d\n", ret);
|
||||
snerr("ERROR: lsm9ds1_readreg8 failed: %d\n", ret);
|
||||
return (ssize_t)ret;
|
||||
}
|
||||
|
||||
@ -1390,20 +1390,20 @@ static int lsm9ds1_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case SNIOC_SETSAMPLERATE:
|
||||
ret = priv->ops->setsamplerate(priv, (uint32_t)arg);
|
||||
snerr("sample rate: %08x ret: %d\n", (uint32_t)arg, ret);
|
||||
sninfo("sample rate: %08x ret: %d\n", (uint32_t)arg, ret);
|
||||
break;
|
||||
|
||||
/* Set the full-scale range. Arg: uint32_t value. */
|
||||
|
||||
case SNIOC_SETFULLSCALE:
|
||||
ret = priv->ops->setfullscale(priv, (uint32_t)arg);
|
||||
snerr("full-scale range: %08x ret: %d\n", (uint32_t)arg, ret);
|
||||
sninfo("full-scale range: %08x ret: %d\n", (uint32_t)arg, ret);
|
||||
break;
|
||||
|
||||
/* Unrecognized commands */
|
||||
|
||||
default:
|
||||
snerr("Unrecognized cmd: %d arg: %lu\n", cmd, arg);
|
||||
snerr("ERROR: Unrecognized cmd: %d arg: %lu\n", cmd, arg);
|
||||
ret = -ENOTTY;
|
||||
break;
|
||||
}
|
||||
@ -1453,7 +1453,7 @@ static int lsm9ds1_register(FAR const char *devpath,
|
||||
priv = (FAR struct lsm9ds1_dev_s *)kmm_malloc(sizeof(*priv));
|
||||
if (priv == NULL)
|
||||
{
|
||||
snerr("Failed to allocate instance\n");
|
||||
snerr("ERROR: Failed to allocate instance\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -1468,7 +1468,7 @@ static int lsm9ds1_register(FAR const char *devpath,
|
||||
ret = priv->ops->config(priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Failed to configure device: %d\n", ret);
|
||||
snerr("ERROR: Failed to configure device: %d\n", ret);
|
||||
kmm_free(priv);
|
||||
return ret;
|
||||
}
|
||||
@ -1478,7 +1478,7 @@ static int lsm9ds1_register(FAR const char *devpath,
|
||||
ret = register_driver(devpath, &g_fops, 0666, priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Failed to register driver: %d\n", ret);
|
||||
snerr("ERROR: Failed to register driver: %d\n", ret);
|
||||
kmm_free(priv);
|
||||
return ret;
|
||||
}
|
||||
|
@ -189,13 +189,13 @@ static ssize_t max31855_read(FAR struct file *filep, FAR char *buffer, size_t bu
|
||||
|
||||
if (!buffer)
|
||||
{
|
||||
snerr("Buffer is null\n");
|
||||
snerr("ERROR: Buffer is null\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (buflen != 2)
|
||||
{
|
||||
snerr("You can't read something other than 16 bits (2 bytes)\n");
|
||||
snerr("ERROR: You can't read something other than 16 bits (2 bytes)\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -218,7 +218,7 @@ static ssize_t max31855_read(FAR struct file *filep, FAR char *buffer, size_t bu
|
||||
regval |= (regmsb & 0xFF00) << 8;
|
||||
regval |= (regmsb & 0xFF) << 24;
|
||||
|
||||
snerr("Read from MAX31855 = 0x%08X\n", regval);
|
||||
sninfo("Read from MAX31855 = 0x%08X\n", regval);
|
||||
|
||||
/* If negative, fix signal bits */
|
||||
|
||||
@ -235,21 +235,21 @@ static ssize_t max31855_read(FAR struct file *filep, FAR char *buffer, size_t bu
|
||||
|
||||
if (regval & MAX31855_FAULT)
|
||||
{
|
||||
snerr("Error: A fault was detected by MAX31855:\n");
|
||||
snerr("ERROR: A fault was detected by MAX31855:\n");
|
||||
|
||||
if (regval & MAX31855_SHORT_VCC)
|
||||
{
|
||||
snerr("The thermocouple input is shorted to VCC!\n");
|
||||
snerr(" The thermocouple input is shorted to VCC!\n");
|
||||
}
|
||||
|
||||
if (regval & MAX31855_SHORT_GND)
|
||||
{
|
||||
snerr("The thermocouple input is shorted to GND!\n");
|
||||
snerr(" The thermocouple input is shorted to GND!\n");
|
||||
}
|
||||
|
||||
if (regval & MAX31855_OPEN_CIRCUIT)
|
||||
{
|
||||
snerr("The thermocouple input is not connected!\n");
|
||||
snerr(" The thermocouple input is not connected!\n");
|
||||
}
|
||||
|
||||
ret = -EINVAL;
|
||||
@ -308,7 +308,7 @@ int max31855_register(FAR const char *devpath, FAR struct spi_dev_s *spi)
|
||||
priv = (FAR struct max31855_dev_s *)kmm_malloc(sizeof(struct max31855_dev_s));
|
||||
if (priv == NULL)
|
||||
{
|
||||
snerr("Failed to allocate instance\n");
|
||||
snerr("ERROR: Failed to allocate instance\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -320,7 +320,7 @@ int max31855_register(FAR const char *devpath, FAR struct spi_dev_s *spi)
|
||||
ret = register_driver(devpath, &g_max31855fops, 0666, priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Failed to register driver: %d\n", ret);
|
||||
snerr("ERROR: Failed to register driver: %d\n", ret);
|
||||
kmm_free(priv);
|
||||
}
|
||||
|
||||
|
@ -185,13 +185,13 @@ static ssize_t max6675_read(FAR struct file *filep, FAR char *buffer, size_t buf
|
||||
|
||||
if (!buffer)
|
||||
{
|
||||
snerr("Buffer is null\n");
|
||||
snerr("ERROR: Buffer is null\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (buflen != 2)
|
||||
{
|
||||
snerr("You can't read something other than 16 bits (2 bytes)\n");
|
||||
snerr("ERROR: You can't read something other than 16 bits (2 bytes)\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ static ssize_t max6675_read(FAR struct file *filep, FAR char *buffer, size_t buf
|
||||
regval = (regmsb & 0xFF00) >> 8;
|
||||
regval |= (regmsb & 0xFF) << 8;
|
||||
|
||||
snerr("Read from MAX6675 = 0x%04X\n", regval);
|
||||
sninfo("Read from MAX6675 = 0x%04X\n", regval);
|
||||
|
||||
/* Verify if the device ID bit is really zero */
|
||||
|
||||
@ -226,7 +226,7 @@ static ssize_t max6675_read(FAR struct file *filep, FAR char *buffer, size_t buf
|
||||
|
||||
if (regval & MAX6675_OPEN_CIRCUIT)
|
||||
{
|
||||
snerr("The thermocouple input is not connected!\n");
|
||||
snerr("ERROR: The thermocouple input is not connected!\n");
|
||||
ret = -EINVAL;
|
||||
}
|
||||
|
||||
@ -285,7 +285,7 @@ int max6675_register(FAR const char *devpath, FAR struct spi_dev_s *spi)
|
||||
priv = (FAR struct max6675_dev_s *)kmm_malloc(sizeof(struct max6675_dev_s));
|
||||
if (priv == NULL)
|
||||
{
|
||||
snerr("Failed to allocate instance\n");
|
||||
snerr("ERROR: Failed to allocate instance\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -297,7 +297,7 @@ int max6675_register(FAR const char *devpath, FAR struct spi_dev_s *spi)
|
||||
ret = register_driver(devpath, &g_max6675fops, 0666, priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Failed to register driver: %d\n", ret);
|
||||
snerr("ERROR: Failed to register driver: %d\n", ret);
|
||||
kmm_free(priv);
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ static int mb7040_measurerange(FAR struct mb7040_dev_s *priv)
|
||||
uint8_t regaddr;
|
||||
int ret;
|
||||
|
||||
snerr("addr: %02x\n", regaddr);
|
||||
sninfo("addr: %02x\n", regaddr);
|
||||
|
||||
/* Set up the I2C configuration */
|
||||
|
||||
@ -146,7 +146,7 @@ static int mb7040_measurerange(FAR struct mb7040_dev_s *priv)
|
||||
ret = i2c_write(priv->i2c, &config, ®addr, sizeof(regaddr));
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_write failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_write failed: %d\n", ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -178,12 +178,12 @@ static int mb7040_readrange(FAR struct mb7040_dev_s *priv,
|
||||
ret = i2c_read(priv->i2c, &config, buffer, sizeof(buffer));
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_read failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_read failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
*range = (uint16_t)buffer[0] << 8 | (uint16_t)buffer[1];
|
||||
snerr("range: %04x ret: %d\n", *range, ret);
|
||||
sninfo("range: %04x ret: %d\n", *range, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -201,7 +201,7 @@ static int mb7040_changeaddr(FAR struct mb7040_dev_s *priv, uint8_t addr)
|
||||
uint8_t buffer[3];
|
||||
int ret;
|
||||
|
||||
snerr("new addr: %02x\n", addr);
|
||||
sninfo("new addr: %02x\n", addr);
|
||||
|
||||
/* Sanity check */
|
||||
|
||||
@ -225,7 +225,7 @@ static int mb7040_changeaddr(FAR struct mb7040_dev_s *priv, uint8_t addr)
|
||||
ret = i2c_write(priv->i2c, &config, buffer, sizeof(buffer));
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_write failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_write failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -324,7 +324,8 @@ static int mb7040_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
{
|
||||
*ptr = (int32_t)range;
|
||||
}
|
||||
snerr("range: %04x ret: %d\n", *ptr, ret);
|
||||
|
||||
sninfo("range: %04x ret: %d\n", *ptr, ret);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -332,13 +333,13 @@ static int mb7040_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case SNIOC_CHANGEADDR:
|
||||
ret = mb7040_changeaddr(priv, (uint8_t)arg);
|
||||
snerr("new addr: %02x ret: %d\n", *(uint8_t *)arg, ret);
|
||||
sninfo("new addr: %02x ret: %d\n", *(uint8_t *)arg, ret);
|
||||
break;
|
||||
|
||||
/* Unrecognized commands */
|
||||
|
||||
default:
|
||||
snerr("Unrecognized cmd: %d arg: %ld\n", cmd, arg);
|
||||
snerr("ERROR: Unrecognized cmd: %d arg: %ld\n", cmd, arg);
|
||||
ret = -ENOTTY;
|
||||
break;
|
||||
}
|
||||
@ -381,7 +382,7 @@ int mb7040_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||
priv = (FAR struct mb7040_dev_s *)kmm_malloc(sizeof(*priv));
|
||||
if (priv == NULL)
|
||||
{
|
||||
snerr("Failed to allocate instance\n");
|
||||
snerr("ERROR: Failed to allocate instance\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -393,7 +394,7 @@ int mb7040_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||
ret = register_driver(devpath, &g_fops, 0666, priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Failed to register driver: %d\n", ret);
|
||||
snerr("ERROR: Failed to register driver: %d\n", ret);
|
||||
kmm_free(priv);
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ static int mcp9844_read_u16(FAR struct mcp9844_dev_s *priv,
|
||||
|
||||
*value = (((uint16_t)(buffer[0]))<<8) + ((uint16_t)(buffer[1]));
|
||||
|
||||
snerr("addr: %02x value: %08x ret: %d\n", regaddr, *value, ret);
|
||||
sninfo("addr: %02x value: %08x ret: %d\n", regaddr, *value, ret);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -174,7 +174,7 @@ static int mcp9844_write_u16(FAR struct mcp9844_dev_s *priv,
|
||||
{
|
||||
struct i2c_config_s config;
|
||||
|
||||
snerr("addr: %02x value: %08x\n", regaddr, regval);
|
||||
sninfo("addr: %02x value: %08x\n", regaddr, regval);
|
||||
|
||||
/* Set up a 3 byte message to send */
|
||||
|
||||
@ -293,7 +293,7 @@ static int mcp9844_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
}
|
||||
else
|
||||
{
|
||||
snerr("ioctl::SNIOC_READTEMP - mcp9844_read_u16 failed - no temperature retrieved\n");
|
||||
snerr("ERROR: ioctl::SNIOC_READTEMP - mcp9844_read_u16 failed - no temperature retrieved\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -303,13 +303,13 @@ static int mcp9844_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
ret = mcp9844_write_u16(priv, MCP9844_RESO_REG, (uint16_t)(arg));
|
||||
if (ret != OK)
|
||||
{
|
||||
snerr("ioctl::SNIOC_SETRESOLUTION - mcp9844_write_u16 failed - no resolution set\n");
|
||||
snerr("ERROR: ioctl::SNIOC_SETRESOLUTION - mcp9844_write_u16 failed - no resolution set\n");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
snerr("Unrecognized cmd: %d\n", cmd);
|
||||
snerr("ERROR: Unrecognized cmd: %d\n", cmd);
|
||||
ret = -ENOTTY;
|
||||
break;
|
||||
}
|
||||
@ -351,7 +351,7 @@ int mcp9844_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||
|
||||
if (priv == NULL)
|
||||
{
|
||||
snerr("Failed to allocate instance\n");
|
||||
snerr("ERROR: Failed to allocate instance\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -363,7 +363,7 @@ int mcp9844_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||
int ret = register_driver(devpath, &g_mcp9844_fops, 0666, priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Failed to register driver: %d\n", ret);
|
||||
snerr("ERROR: Failed to register driver: %d\n", ret);
|
||||
kmm_free(priv);
|
||||
}
|
||||
|
||||
|
@ -176,25 +176,25 @@ static void mpl115a_updatecaldata(FAR struct mpl115a_dev_s *priv)
|
||||
|
||||
priv->mpl115a_cal_a0 = mpl115a_getreg8(priv, MPL115A_BASE_CMD | (MPL115A_A0_MSB << 1)) << 8;
|
||||
priv->mpl115a_cal_a0 |= mpl115a_getreg8(priv, MPL115A_BASE_CMD | (MPL115A_A0_LSB << 1));
|
||||
snerr("a0 = %d\n", priv->mpl115a_cal_a0);
|
||||
sninfo("a0 = %d\n", priv->mpl115a_cal_a0);
|
||||
|
||||
/* Get b1 coefficient */
|
||||
|
||||
priv->mpl115a_cal_b1 = mpl115a_getreg8(priv, MPL115A_BASE_CMD | (MPL115A_B1_MSB << 1)) << 8;
|
||||
priv->mpl115a_cal_b1 |= mpl115a_getreg8(priv, MPL115A_BASE_CMD | (MPL115A_B1_LSB << 1));
|
||||
snerr("b1 = %d\n", priv->mpl115a_cal_b1);
|
||||
sninfo("b1 = %d\n", priv->mpl115a_cal_b1);
|
||||
|
||||
/* Get b2 coefficient */
|
||||
|
||||
priv->mpl115a_cal_b2 = mpl115a_getreg8(priv, MPL115A_BASE_CMD | (MPL115A_B2_MSB << 1)) << 8;
|
||||
priv->mpl115a_cal_b2 |= mpl115a_getreg8(priv, MPL115A_BASE_CMD | (MPL115A_B2_LSB << 1));
|
||||
snerr("b2 = %d\n", priv->mpl115a_cal_b2);
|
||||
sninfo("b2 = %d\n", priv->mpl115a_cal_b2);
|
||||
|
||||
/* Get c12 coefficient */
|
||||
|
||||
priv->mpl115a_cal_c12 = mpl115a_getreg8(priv, MPL115A_BASE_CMD | (MPL115A_C12_MSB << 1)) << 8;
|
||||
priv->mpl115a_cal_c12 |= mpl115a_getreg8(priv, MPL115A_BASE_CMD | (MPL115A_C12_LSB << 1));
|
||||
snerr("c12 = %d\n", priv->mpl115a_cal_c12);
|
||||
sninfo("c12 = %d\n", priv->mpl115a_cal_c12);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -220,13 +220,13 @@ static void mpl115a_read_press_temp(FAR struct mpl115a_dev_s *priv)
|
||||
priv->mpl115a_pressure |= mpl115a_getreg8(priv, MPL115A_BASE_CMD | (MPL115A_PADC_LSB << 1));
|
||||
priv->mpl115a_pressure >>= 6; /* Padc is 10bit unsigned */
|
||||
|
||||
snerr("Pressure = %d\n", priv->mpl115a_pressure);
|
||||
sninfo("Pressure = %d\n", priv->mpl115a_pressure);
|
||||
|
||||
priv->mpl115a_temperature = mpl115a_getreg8(priv, MPL115A_BASE_CMD | (MPL115A_TADC_MSB << 1)) << 8;
|
||||
priv->mpl115a_temperature |= mpl115a_getreg8(priv, MPL115A_BASE_CMD | (MPL115A_TADC_LSB << 1));
|
||||
priv->mpl115a_temperature >>= 6; /* Tadc is 10bit unsigned */
|
||||
|
||||
snerr("Temperature = %d\n", priv->mpl115a_temperature);
|
||||
sninfo("Temperature = %d\n", priv->mpl115a_temperature);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -274,7 +274,7 @@ static int mpl115a_getpressure(FAR struct mpl115a_dev_s *priv)
|
||||
* This may be eliminated by right shifting the result 4 bits.
|
||||
*/
|
||||
|
||||
snerr("Final Pressure = %d\n", pressure >> 4);
|
||||
sninfo("Final Pressure = %d\n", pressure >> 4);
|
||||
return pressure;
|
||||
}
|
||||
|
||||
@ -316,13 +316,13 @@ static ssize_t mpl115a_read(FAR struct file *filep, FAR char *buffer, size_t buf
|
||||
|
||||
if (!buffer)
|
||||
{
|
||||
snerr("Buffer is null\n");
|
||||
snerr("ERROR: Buffer is null\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (buflen != 2)
|
||||
{
|
||||
snerr("You can't read something other than 16 bits (2 bytes)\n");
|
||||
snerr("ERROR: You can't read something other than 16 bits (2 bytes)\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -378,7 +378,7 @@ int mpl115a_register(FAR const char *devpath, FAR struct spi_dev_s *spi)
|
||||
priv = (FAR struct mpl115a_dev_s *)kmm_malloc(sizeof(struct mpl115a_dev_s));
|
||||
if (!priv)
|
||||
{
|
||||
snerr("Failed to allocate instance\n");
|
||||
snerr("ERROR: Failed to allocate instance\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -397,7 +397,7 @@ int mpl115a_register(FAR const char *devpath, FAR struct spi_dev_s *spi)
|
||||
ret = register_driver(devpath, &g_mpl115afops, 0666, priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Failed to register driver: %d\n", ret);
|
||||
snerr("ERROR: Failed to register driver: %d\n", ret);
|
||||
kmm_free(priv);
|
||||
}
|
||||
|
||||
|
@ -306,14 +306,14 @@ static int ms58xx_readu16(FAR struct ms58xx_dev_s *priv, uint8_t regaddr,
|
||||
uint8_t buffer[2];
|
||||
int ret;
|
||||
|
||||
snerr("addr: %02x\n", regaddr);
|
||||
sninfo("addr: %02x\n", regaddr);
|
||||
|
||||
/* Write the register address */
|
||||
|
||||
ret = ms58xx_i2c_write(priv, ®addr, sizeof(regaddr));
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_write failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_write failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -322,12 +322,12 @@ static int ms58xx_readu16(FAR struct ms58xx_dev_s *priv, uint8_t regaddr,
|
||||
ret = ms58xx_i2c_read(priv, buffer, sizeof(buffer));
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_read failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_read failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
*regval = (uint16_t)buffer[0] << 8 | (uint16_t)buffer[1];
|
||||
snerr("value: %04x ret: %d\n", *regval, ret);
|
||||
sninfo("value: %04x ret: %d\n", *regval, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -346,14 +346,14 @@ static int ms58xx_readadc(FAR struct ms58xx_dev_s *priv, FAR uint32_t *adc)
|
||||
int ret;
|
||||
|
||||
regaddr = MS58XX_ADC_REG;
|
||||
snerr("addr: %02x\n", regaddr);
|
||||
sninfo("addr: %02x\n", regaddr);
|
||||
|
||||
/* Write the register address */
|
||||
|
||||
ret = ms58xx_i2c_write(priv, ®addr, sizeof(regaddr));
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_write failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_write failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -362,7 +362,7 @@ static int ms58xx_readadc(FAR struct ms58xx_dev_s *priv, FAR uint32_t *adc)
|
||||
ret = ms58xx_i2c_read(priv, buffer, sizeof(buffer));
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_read failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_read failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -370,7 +370,7 @@ static int ms58xx_readadc(FAR struct ms58xx_dev_s *priv, FAR uint32_t *adc)
|
||||
(uint32_t)buffer[1] << 8 |
|
||||
(uint32_t)buffer[2];
|
||||
|
||||
snerr("adc: %06x ret: %d\n", *adc, ret);
|
||||
sninfo("adc: %06x ret: %d\n", *adc, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -483,7 +483,7 @@ static int ms58xx_setosr(FAR struct ms58xx_dev_s *priv, uint16_t osr)
|
||||
{
|
||||
int ret = OK;
|
||||
|
||||
snerr("osr: %04x\n", osr);
|
||||
sninfo("osr: %04x\n", osr);
|
||||
|
||||
switch (priv->model)
|
||||
{
|
||||
@ -558,7 +558,7 @@ static int ms58xx_readprom(FAR struct ms58xx_dev_s *priv)
|
||||
ret = ms58xx_readu16(priv, MS58XX_PROM_REG + i * 2, prom + i);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("ms58xx_readu16 failed: %d\n", ret);
|
||||
snerr("ERROR: ms58xx_readu16 failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@ -568,7 +568,7 @@ static int ms58xx_readprom(FAR struct ms58xx_dev_s *priv)
|
||||
|
||||
if (crc != ms58xx_crc(prom, crcindex, crcmask))
|
||||
{
|
||||
snerr("crc mismatch\n");
|
||||
snerr("ERROR: crc mismatch\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@ -620,14 +620,14 @@ static int ms58xx_reset(FAR struct ms58xx_dev_s *priv)
|
||||
int ret;
|
||||
|
||||
regaddr = MS58XX_RESET_REG;
|
||||
snerr("addr: %02x\n", regaddr);
|
||||
sninfo("addr: %02x\n", regaddr);
|
||||
|
||||
/* Write the register address */
|
||||
|
||||
ret = ms58xx_i2c_write(priv, ®addr, sizeof(regaddr));
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_write failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_write failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -636,7 +636,7 @@ static int ms58xx_reset(FAR struct ms58xx_dev_s *priv)
|
||||
ret = ms58xx_readprom(priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("ms58xx_readprom failed: %d\n", ret);
|
||||
snerr("ERROR: ms58xx_readprom failed: %d\n", ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -656,14 +656,14 @@ static int ms58xx_convert(FAR struct ms58xx_dev_s *priv, uint8_t regaddr,
|
||||
int ret;
|
||||
|
||||
regaddr |= priv->osr;
|
||||
snerr("addr: %02x\n", regaddr);
|
||||
sninfo("addr: %02x\n", regaddr);
|
||||
|
||||
/* Write the register address */
|
||||
|
||||
ret = ms58xx_i2c_write(priv, ®addr, sizeof(regaddr));
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("i2c_write failed: %d\n", ret);
|
||||
snerr("ERROR: i2c_write failed: %d\n", ret);
|
||||
}
|
||||
|
||||
/* Wait for the conversion to end */
|
||||
@ -675,7 +675,7 @@ static int ms58xx_convert(FAR struct ms58xx_dev_s *priv, uint8_t regaddr,
|
||||
ret = ms58xx_readadc(priv, regval);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("ms58xx_readadc failed: %d\n", ret);
|
||||
snerr("ERROR: ms58xx_readadc failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -714,14 +714,14 @@ static int ms58xx_measure(FAR struct ms58xx_dev_s *priv)
|
||||
ret = ms58xx_convert(priv, MS58XX_PRESS_REG, &rawpress);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("ms58xx_convert failed: %d\n", ret);
|
||||
snerr("ERROR: ms58xx_convert failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ms58xx_convert(priv, MS58XX_TEMP_REG, &rawtemp);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("ms58xx_convert failed: %d\n", ret);
|
||||
snerr("ERROR: ms58xx_convert failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -923,7 +923,7 @@ static int ms58xx_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
FAR int32_t *ptr = (FAR int32_t *)((uintptr_t)arg);
|
||||
DEBUGASSERT(ptr != NULL);
|
||||
*ptr = priv->temp;
|
||||
snerr("temp: %08x\n", *ptr);
|
||||
sninfo("temp: %08x\n", *ptr);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -934,7 +934,7 @@ static int ms58xx_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
FAR int32_t *ptr = (FAR int32_t *)((uintptr_t)arg);
|
||||
DEBUGASSERT(ptr != NULL);
|
||||
*ptr = priv->press;
|
||||
snerr("press: %08x\n", *ptr);
|
||||
sninfo("press: %08x\n", *ptr);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -949,13 +949,13 @@ static int ms58xx_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
||||
|
||||
case SNIOC_OVERSAMPLING:
|
||||
ret = ms58xx_setosr(priv, (uint16_t)arg);
|
||||
snerr("osr: %04x ret: %d\n", *(uint16_t *)arg, ret);
|
||||
sninfo("osr: %04x ret: %d\n", *(uint16_t *)arg, ret);
|
||||
break;
|
||||
|
||||
/* Unrecognized commands */
|
||||
|
||||
default:
|
||||
snerr("Unrecognized cmd: %d arg: %ld\n", cmd, arg);
|
||||
snerr("ERROR: Unrecognized cmd: %d arg: %ld\n", cmd, arg);
|
||||
ret = -ENOTTY;
|
||||
break;
|
||||
}
|
||||
@ -1010,7 +1010,7 @@ int ms58xx_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||
priv = (FAR struct ms58xx_dev_s *)kmm_malloc(sizeof(*priv));
|
||||
if (priv == NULL)
|
||||
{
|
||||
snerr("Failed to allocate instance\n");
|
||||
snerr("ERROR: Failed to allocate instance\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -1177,14 +1177,14 @@ int ms58xx_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||
ret = ms58xx_setosr(priv, osr);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("ms58xx_setosr failed: %d\n", ret);
|
||||
snerr("ERROR: ms58xx_setosr failed: %d\n", ret);
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = ms58xx_reset(priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("ms58xx_reset failed: %d\n", ret);
|
||||
snerr("ERROR: ms58xx_reset failed: %d\n", ret);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@ -1193,7 +1193,7 @@ int ms58xx_register(FAR const char *devpath, FAR struct i2c_master_s *i2c,
|
||||
ret = register_driver(devpath, &g_fops, 0666, priv);
|
||||
if (ret < 0)
|
||||
{
|
||||
snerr("Failed to register driver: %d\n", ret);
|
||||
snerr("ERROR: Failed to register driver: %d\n", ret);
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -371,7 +371,7 @@ int qe_register(FAR const char *devpath, FAR struct qe_lowerhalf_s *lower)
|
||||
upper = (FAR struct qe_upperhalf_s *)kmm_zalloc(sizeof(struct qe_upperhalf_s));
|
||||
if (!upper)
|
||||
{
|
||||
snerr("Allocation failed\n");
|
||||
snerr("ERROR: Allocation failed\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user