Skip to content

Commit

Permalink
os/ : Add common debug log messages
Browse files Browse the repository at this point in the history
Edit Debug log message with a common log messages
  • Loading branch information
abhishek-samsung authored and NayanaNagaraj23 committed Aug 23, 2024
1 parent 3e46963 commit d07b2ac
Show file tree
Hide file tree
Showing 171 changed files with 985 additions and 659 deletions.
7 changes: 4 additions & 3 deletions os/drivers/analog/adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
#include <tinyara/arch.h>
#include <tinyara/semaphore.h>
#include <tinyara/analog/adc.h>
#include <tinyara/common_logs/common_logs.h>

#include <tinyara/irq.h>

Expand Down Expand Up @@ -254,7 +255,7 @@ static ssize_t adc_read(FAR struct file *filep, FAR char *buffer,
int ret = 0;
int msglen;

avdbg("buflen: %d\n", (int)buflen);
avdbg("%s %d\n", clog_message_str[CMN_LOG_VALUE_OF], (int)buflen);

if (buflen % 5 == 0)
msglen = 5;
Expand Down Expand Up @@ -357,7 +358,7 @@ static ssize_t adc_read(FAR struct file *filep, FAR char *buffer,
leave_critical_section(flags);
}

avdbg("Returning: %d\n", ret);
avdbg("%s %d\n", clog_message_str[CMN_LOG_VALUE_OF], ret);
return ret;
}

Expand Down Expand Up @@ -544,7 +545,7 @@ int adc_register(FAR const char *path, FAR struct adc_dev_s *dev)
DEBUGASSERT(dev->ad_ops != NULL && dev->ad_ops->ao_bind != NULL);
ret = dev->ad_ops->ao_bind(dev, &g_adc_callback);
if (ret < 0) {
avdbg("ERROR: Failed to bind callbacks: %d\n", ret);
avdbg("%s %d\n", clog_message_str[CMN_LOG_FAILED_OP], ret);
return ret;
}

Expand Down
7 changes: 4 additions & 3 deletions os/drivers/audio/alc1019.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include <tinyara/math.h>
#include <math.h>
#include <tinyara/i2c.h>
#include <tinyara/common_logs/common_logs.h>

#include "alc1019.h"
#include "alc1019scripts.h"
Expand Down Expand Up @@ -99,7 +100,7 @@ static int alc1019_writereg_3byte(FAR struct alc1019_dev_s *priv, uint8_t regadd

ret = i2c_write(dev, alc1019_i2c_config, (uint8_t *)reg, 3);
if (ret < 0) {
auddbg("Error, cannot write reg 0x%x/0x%x/0x%x\n", regaddr_h, regaddr_l, regval);
auddbg("%s, 0x%x/0x%x/0x%x\n", clog_message_str[CMN_LOG_FAILED_OP] ,regaddr_h, regaddr_l, regval);
}
return ret;
}
Expand Down Expand Up @@ -433,12 +434,12 @@ static int alc1019_configure(FAR struct audio_lowerhalf_s *dev, FAR const struct

ret = -EDOM;
if (caps->ac_channels != ALC1019_CHANNELS) {
auddbg("ERROR: Unsupported number of channels: %d\n", caps->ac_channels);
auddbg("%s#1 %d\n", clog_message_str[CMN_LOG_INVALID_VAL], caps->ac_channels);
break;
}

if (caps->ac_controls.b[2] != ALC1019_BPSAMP) {
auddbg("ERROR: Unsupported bits per sample: %d\n", caps->ac_controls.b[2]);
auddbg("%s#2 %d\n",clog_message_str[CMN_LOG_INVALID_VAL], caps->ac_controls.b[2]);
break;
}

Expand Down
1 change: 1 addition & 0 deletions os/drivers/audio/alc5658.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
#include <math.h>
#include <tinyara/i2c.h>
#include <stdbool.h>
#include <tinyara/common_logs/common_logs.h>

#include "alc5658.h"
#include "alc5658scripts.h"
Expand Down
21 changes: 11 additions & 10 deletions os/drivers/audio/audio_null.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
#include <tinyara/fs/ioctl.h>
#include <tinyara/audio/audio.h>
#include <tinyara/audio/audio_null.h>
#include <tinyara/common_logs/common_logs.h>

/****************************************************************************
* Pre-processor Definitions
Expand Down Expand Up @@ -702,10 +703,10 @@ static int null_registerprocess(FAR struct audio_lowerhalf_s *dev, mqd_t mq)
priv->process_terminate = false;
ret = pthread_create(&priv->process_threadid, &tattr, null_processthread, (pthread_addr_t) priv);
if (ret != OK) {
auddbg("ERROR: pthread_create failed: %d\n", ret);
auddbg("%s %d\n",clog_message_str[CMN_LOG_FAILED_OP], ret);
} else {
pthread_setname_np(priv->process_threadid, "null audio process");
auddbg("Created worker thread\n");
auddbg("%s \n", clog_message_str[CMN_LOG_PERFORMING_OP]);
}

audvdbg("Return %d\n", ret);
Expand Down Expand Up @@ -766,7 +767,7 @@ static int null_start(FAR struct audio_lowerhalf_s *dev)
audvdbg("Starting worker thread\n");
ret = pthread_create(&priv->worker_threadid, &tattr, null_workerthread, (pthread_addr_t) priv);
if (ret != OK) {
auddbg("ERROR: pthread_create failed: %d\n", ret);
auddbg("%s %d\n",clog_message_str[CMN_LOG_FAILED_OP], ret);
} else {
pthread_setname_np(priv->worker_threadid, "null audio");
auddbg("Created worker thread\n");
Expand Down Expand Up @@ -961,12 +962,12 @@ static int null_ioctl(FAR struct audio_lowerhalf_s *dev, int cmd, unsigned long
#endif
ret = null_registerprocess(dev, (mqd_t) arg);
if (ret != OK) {
auddbg("Process Start Failed ret : %d\n", ret);
auddbg("%s#1 %d \n", clog_message_str[CMN_LOG_FAILED_OP], ret);
return ret;
}
ret = OK;
#else
auddbg("Register Process Failed - Device Doesn't support\n");
auddbg("%s#2 \n", clog_message_str[CMN_LOG_FAILED_OP]);
ret = -EINVAL;
#endif
}
Expand All @@ -975,13 +976,13 @@ static int null_ioctl(FAR struct audio_lowerhalf_s *dev, int cmd, unsigned long
#ifdef CONFIG_AUDIO_PROCESSING_FEATURES
ret = null_unregisterprocess(dev);
if (ret != OK) {
auddbg("Process Start Failed ret : %d\n", ret);
auddbg("%s#3 %d \n", clog_message_str[CMN_LOG_FAILED_OP], ret);
return ret;
}
ret = OK;

#else
auddbg("UnRegister Process Failed - Device Doesn't support\n");
auddbg("%s#4 \n", clog_message_str[CMN_LOG_FAILED_OP]);
ret = -EINVAL;
#endif
}
Expand All @@ -995,7 +996,7 @@ static int null_ioctl(FAR struct audio_lowerhalf_s *dev, int cmd, unsigned long
sem_post(&priv->processing_sem);
ret = OK;
#else
auddbg("start Process Failed - Device Doesn't support\n");
auddbg("%s #5\n", clog_message_str[CMN_LOG_FAILED_OP]);
ret = -EINVAL;
#endif
}
Expand All @@ -1008,7 +1009,7 @@ static int null_ioctl(FAR struct audio_lowerhalf_s *dev, int cmd, unsigned long
priv->process_terminate = true;
ret = OK;
#else
auddbg("start Process Failed - Device Doesn't support\n");
auddbg("%s #6\n:", clog_message_str[CMN_LOG_FAILED_OP]);
ret = -EINVAL;
#endif
}
Expand Down Expand Up @@ -1112,6 +1113,6 @@ FAR struct audio_lowerhalf_s *audio_null_initialize(void)
return &priv->dev;
}

auddbg("ERROR: Failed to allocate null audio device\n");
auddbg("%s \n", clog_message_str[CMN_LOG_FAILED_OP]);
return NULL;
}
1 change: 1 addition & 0 deletions os/drivers/audio/cx20921.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
#include <tinyara/audio/cx20921.h>
#include <tinyara/math.h>
#include <math.h>
#include <tinyara/common_logs/common_logs.h>

#include "cx20921.h"

Expand Down
3 changes: 2 additions & 1 deletion os/drivers/audio/i2schar.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
#include <tinyara/fs/fs.h>
#include <tinyara/audio/audio.h>
#include <tinyara/audio/i2s.h>
#include <tinyara/common_logs/common_logs.h>

/****************************************************************************
* Pre-processor Definitions
Expand Down Expand Up @@ -311,7 +312,7 @@ static ssize_t i2schar_write(FAR struct file *filep, FAR const char *buffer, siz

ret = I2S_SEND(priv->i2s, apb, i2schar_txcallback, priv, CONFIG_AUDIO_I2SCHAR_TXTIMEOUT);
if (ret < 0) {
lldbg("ERROR: I2S_SEND returned: %d\n", ret);
lldbg("%s %d \n", clog_message_str[CMN_LOG_INVALID_VAL], ret);
goto errout_with_reference;
}

Expand Down
15 changes: 8 additions & 7 deletions os/drivers/audio/tas5749.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
#include <tinyara/math.h>
#include <math.h>
#include <tinyara/i2c.h>
#include <tinyara/common_logs/common_logs.h>

#include "tas5749.h"
#include "tas5749scripts.h"
Expand Down Expand Up @@ -158,7 +159,7 @@ uint8_t tas5749_readreg_1byte(FAR struct tas5749_dev_s *priv, uint8_t regaddr)
uint8_t reg_w[4];
reg_w[0] = regaddr;
if (i2c_writeread(dev, tas5749_i2c_config, reg_w, 1, reg, 1) < 0) {
auddbg("Error, cannot read reg %x\n", regaddr);
auddbg("%s %d\n", clog_message_str[CMN_LOG_FAILED_OP],regaddr);
return FAIL_8;
}
return reg[0];
Expand All @@ -183,12 +184,12 @@ uint32_t tas5749_readreg_4byte(FAR struct tas5749_dev_s *priv, uint8_t regaddr)

ret = i2c_write(dev, tas5749_i2c_config, reg, 1);
if (ret < 0) {
auddbg("Error, cannot read reg %x\n", regaddr);
auddbg("%s %d\n", clog_message_str[CMN_LOG_FAILED_OP],regaddr);
return FAIL_32;
}
ret = i2c_read(dev, tas5749_i2c_config, reg, 4);
if (ret < 0) {
auddbg("Error, cannot read reg %x\n", regaddr);
auddbg("%s %d\n", clog_message_str[CMN_LOG_FAILED_OP],regaddr);
return FAIL_32;
}
regval = ((reg[0] << 24) | (reg[1] << 16) | (reg[2] << 8) | (reg[3] << 24));
Expand Down Expand Up @@ -225,7 +226,7 @@ static int tas5749_writereg_1byte(FAR struct tas5749_dev_s *priv, uint8_t regadd

ret = i2c_write(dev, tas5749_i2c_config, (uint8_t *)reg, 2);
if (ret < 0) {
auddbg("Error, cannot write reg %x\n", regaddr);
auddbg("%s %d\n", clog_message_str[CMN_LOG_FAILED_OP],regaddr);
}
return ret;
}
Expand All @@ -252,7 +253,7 @@ static int tas5749_writereg_4byte(FAR struct tas5749_dev_s *priv, uint8_t regadd

ret = i2c_write(dev, tas5749_i2c_config, (uint8_t *)reg, 5);
if (ret < 0) {
auddbg("Error, cannot write reg %x\n", regaddr);
auddbg("%s %d\n", clog_message_str[CMN_LOG_FAILED_OP],regaddr);
}
return ret;
}
Expand Down Expand Up @@ -991,7 +992,7 @@ static int tas5749_ioctl(FAR struct audio_lowerhalf_s *dev, int cmd, unsigned lo
tas5749_writereg_1byte(priv, (uint8_t)0x01, 0x00);
regval = tas5749_readreg_1byte(priv, 0x01);
if (regval != 0x00) {
auddbg("ERROR: Amp has some error! 0x%02x \n", regval);
auddbg("%s 0x%02x \n", clog_message_str[CMN_LOG_INVALID_VAL],regval);
}

/* Resume I2S */
Expand Down Expand Up @@ -1237,7 +1238,7 @@ FAR struct audio_lowerhalf_s *tas5749_initialize(FAR struct i2c_dev_s *i2c, FAR
/* Verify that TAS5749 is present and available on this I2C */
regval = tas5749_readreg_1byte(priv, TAS5749_TI_DEVICE_ID);
if (regval != TAS5749_TI_DEVICE_ID_VAL) {
auddbg("ERROR: TAS5749 not found: ID=%04x\n", regval);
auddbg("%s %04xn", clog_message_str[CMN_LOG_INVALID_VAL],regval);
goto errout_with_dev;
}

Expand Down
5 changes: 3 additions & 2 deletions os/drivers/bch/bchdev_register.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
#include <debug.h>

#include <tinyara/fs/fs.h>
#include <tinyara/common_logs/common_logs.h>

#include "bch.h"

Expand All @@ -83,14 +84,14 @@ int bchdev_register(FAR const char *blkdev, FAR const char *chardev, bool readon
/* Setup the BCH lib functions */
ret = bchlib_setup(blkdev, readonly, &handle);
if (ret < 0) {
fdbg("ERROR: bchlib_setup failed: %d\n", -ret);
fdbg("%s #1 %d\n", clog_message_str[CMN_LOG_FAILED_OP],-ret);
return ret;
}

/* Then setup the character device */
ret = register_driver(chardev, &bch_fops, 0666, handle);
if (ret < 0) {
fdbg("ERROR: register_driver failed: %d\n", -ret);
fdbg("%s #2 %d\n", clog_message_str[CMN_LOG_FAILED_OP],-ret);
bchlib_teardown(handle);
handle = NULL;
}
Expand Down
3 changes: 2 additions & 1 deletion os/drivers/bch/bchdev_unregister.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@

#include <tinyara/fs/fs.h>
#include <tinyara/fs/ioctl.h>
#include <tinyara/common_logs/common_logs.h>

#include "bch.h"

Expand Down Expand Up @@ -97,7 +98,7 @@ int bchdev_unregister(FAR const char *chardev)
/* Open the character driver associated with chardev */
fd = open(chardev, O_RDONLY);
if (fd < 0) {
fdbg("ERROR: Failed to open %s: %d\n", chardev, errno);
fdbg("%s %s %d\n", clog_message_str[CMN_LOG_FAILED_OP],chardev,errno);
return -errno;
}

Expand Down
5 changes: 3 additions & 2 deletions os/drivers/bch/bchlib_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
#include <debug.h>

#include "bch.h"
#include <tinyara/common_logs/common_logs.h>

#if defined(CONFIG_BCH_ENCRYPTION)
# include <crypto/crypto.h>
Expand Down Expand Up @@ -147,7 +148,7 @@ int bchlib_flushsector(FAR struct bchlib_s *bch)
/* Write the sector to the media */
ret = inode->u.i_bops->write(inode, bch->buffer, bch->sector, 1);
if (ret < 0) {
fdbg("Write failed: %d\n");
fdbg("%s\n", clog_message_str[CMN_LOG_FILE_WRITE_ERROR]);
}

#if defined(CONFIG_BCH_ENCRYPTION)
Expand Down Expand Up @@ -188,7 +189,7 @@ int bchlib_readsector(FAR struct bchlib_s *bch, size_t sector)

ret = inode->u.i_bops->read(inode, bch->buffer, sector, 1);
if (ret < 0) {
fdbg("Read failed: %d\n");
fdbg("%s\n", clog_message_str[CMN_LOG_FILE_READ_ERROR]);
}
bch->sector = sector;
#if defined(CONFIG_BCH_ENCRYPTION)
Expand Down
5 changes: 3 additions & 2 deletions os/drivers/bch/bchlib_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
#include <errno.h>
#include <assert.h>
#include <debug.h>
#include <tinyara/common_logs/common_logs.h>

#include "bch.h"

Expand Down Expand Up @@ -108,7 +109,7 @@ ssize_t bchlib_read(FAR void *handle, FAR char *buffer, size_t offset, size_t le
}

if (bch->sectsize <= 0) {
fdbg("ERROR: Invalid sector size bch->sectsize = %d\n", bch->sectsize);
fdbg("%s bch->sectsize : %d\n", clog_message_str[CMN_LOG_VALUE_OF],bch->sectsize);
return -1;
}

Expand Down Expand Up @@ -162,7 +163,7 @@ ssize_t bchlib_read(FAR void *handle, FAR char *buffer, size_t offset, size_t le
ret = bch->inode->u.i_bops->read(bch->inode, (FAR uint8_t *)buffer,
sector, nsectors);
if (ret < 0) {
fdbg("ERROR: Read failed: %d\n");
fdbg("%s\n", clog_message_str[CMN_LOG_FILE_READ_ERROR]);
return ret;
}

Expand Down
Loading

0 comments on commit d07b2ac

Please sign in to comment.