The dbg_log API is DISCARDED. Change all dbg_log to LOG_X.

This commit is contained in:
armink 2018-11-02 10:14:08 +08:00
parent 5a70247898
commit 83b7b763b7
17 changed files with 309 additions and 312 deletions

View File

@ -53,7 +53,7 @@ int gpio_set_func(enum gpio_port port, enum gpio_pin pin, rt_uint8_t func)
if (func & 0x8) if (func & 0x8)
{ {
dbg_log(DBG_WARNING, "[line]:%d There is a warning with parameter input\n", __LINE__); LOG_W("[line]:%d There is a warning with parameter input", __LINE__);
return RT_EINVAL; return RT_EINVAL;
} }
@ -65,7 +65,7 @@ int gpio_set_func(enum gpio_port port, enum gpio_pin pin, rt_uint8_t func)
data |= func << offset; data |= func << offset;
writel(data, addr); writel(data, addr);
dbg_log(DBG_LOG, "[line]:%d offset:%d addr:%08x data:%08x\n", __LINE__, offset, addr, *((rt_uint32_t *)addr)); LOG_D("[line]:%d offset:%d addr:%08x data:%08x", __LINE__, offset, addr, *((rt_uint32_t *)addr));
return RT_EOK; return RT_EOK;
} }
@ -80,7 +80,7 @@ int gpio_set_value(enum gpio_port port, enum gpio_pin pin, rt_uint8_t value)
if (value & 0xE) if (value & 0xE)
{ {
dbg_log(DBG_WARNING, "[line]:%d There is a warning with parameter input\n", __LINE__); LOG_W("[line]:%d There is a warning with parameter input", __LINE__);
return RT_EINVAL; return RT_EINVAL;
} }
@ -92,7 +92,7 @@ int gpio_set_value(enum gpio_port port, enum gpio_pin pin, rt_uint8_t value)
data |= value << offset; data |= value << offset;
writel(data, addr); writel(data, addr);
dbg_log(DBG_LOG, "[line]:%d offset:%d addr:%08x data:%08x\n", __LINE__, offset, addr, *((rt_uint32_t *)addr)); LOG_D("[line]:%d offset:%d addr:%08x data:%08x", __LINE__, offset, addr, *((rt_uint32_t *)addr));
return RT_EOK; return RT_EOK;
} }
@ -110,7 +110,7 @@ int gpio_get_value(enum gpio_port port, enum gpio_pin pin)
data = readl(addr); data = readl(addr);
dbg_log(DBG_LOG, "[line]:%d offset:%d addr:%08x data:%08x\n", __LINE__, offset, addr, *((rt_uint32_t *)addr)); LOG_D("[line]:%d offset:%d addr:%08x data:%08x", __LINE__, offset, addr, *((rt_uint32_t *)addr));
return (data >> offset) & 0x01; return (data >> offset) & 0x01;
} }
@ -125,7 +125,7 @@ int gpio_set_pull_mode(enum gpio_port port, enum gpio_pin pin, enum gpio_pull p
if (pull & 0xC) if (pull & 0xC)
{ {
dbg_log(DBG_WARNING, "[line]:%d There is a warning with parameter input\n", __LINE__); LOG_W("[line]:%d There is a warning with parameter input", __LINE__);
return RT_EINVAL; return RT_EINVAL;
} }
@ -138,7 +138,7 @@ int gpio_set_pull_mode(enum gpio_port port, enum gpio_pin pin, enum gpio_pull p
data |= pull << offset; data |= pull << offset;
writel(data, addr); writel(data, addr);
dbg_log(DBG_LOG, "[line]:%d offset:%d addr:%08x data:%08x\n", __LINE__, offset, addr, *((rt_uint32_t *)addr)); LOG_D("[line]:%d offset:%d addr:%08x data:%08x", __LINE__, offset, addr, *((rt_uint32_t *)addr));
return RT_EOK; return RT_EOK;
} }
@ -153,7 +153,7 @@ int gpio_set_drive_level(enum gpio_port port, enum gpio_pin pin, enum gpio_drv_l
if (level & 0xC) if (level & 0xC)
{ {
dbg_log(DBG_WARNING, "[line]:%d There is a warning with parameter input\n", __LINE__); LOG_W("[line]:%d There is a warning with parameter input", __LINE__);
return RT_EINVAL; return RT_EINVAL;
} }
@ -166,7 +166,7 @@ int gpio_set_drive_level(enum gpio_port port, enum gpio_pin pin, enum gpio_drv_l
data |= level << offset; data |= level << offset;
writel(data, addr); writel(data, addr);
dbg_log(DBG_LOG, "[line]:%d offset:%d addr:%08x data:%08x\n", __LINE__, offset, addr, *((rt_uint32_t *)addr)); LOG_D("[line]:%d offset:%d addr:%08x data:%08x", __LINE__, offset, addr, *((rt_uint32_t *)addr));
return RT_EOK; return RT_EOK;
} }
@ -187,7 +187,7 @@ void gpio_direction_input(enum gpio_port port, enum gpio_pin pin)
data |= IO_INPUT << offset; data |= IO_INPUT << offset;
writel(data, addr); writel(data, addr);
dbg_log(DBG_LOG, "[line]:%d offset:%d addr:%08x data:%08x\n", __LINE__, offset, addr, *((rt_uint32_t *)addr)); LOG_D("[line]:%d offset:%d addr:%08x data:%08x", __LINE__, offset, addr, *((rt_uint32_t *)addr));
} }
void gpio_direction_output(enum gpio_port port, enum gpio_pin pin, int value) void gpio_direction_output(enum gpio_port port, enum gpio_pin pin, int value)
@ -208,7 +208,7 @@ void gpio_direction_output(enum gpio_port port, enum gpio_pin pin, int value)
data |= IO_OUTPUT << offset; data |= IO_OUTPUT << offset;
writel(data, addr); writel(data, addr);
dbg_log(DBG_LOG, "[line]:%d offset:%d addr:%08x data:%08x\n", __LINE__, offset, addr, *((rt_uint32_t *)addr)); LOG_D("[line]:%d offset:%d addr:%08x data:%08x", __LINE__, offset, addr, *((rt_uint32_t *)addr));
} }
/********************************************************* /*********************************************************
** IRQ ** IRQ
@ -237,7 +237,7 @@ void gpio_select_irq_clock(enum gpio_port port, enum gpio_irq_clock clock)
data &= ~0x01; data &= ~0x01;
data |= clock; data |= clock;
writel(data, addr); writel(data, addr);
dbg_log(DBG_LOG, "[line]:%d addr:%08x data:%08x\n", __LINE__, addr, *((rt_uint32_t *)addr)); LOG_D("[line]:%d addr:%08x data:%08x", __LINE__, addr, *((rt_uint32_t *)addr));
} }
void gpio_set_debounce(enum gpio_port port, enum gpio_direction_type prescaler) void gpio_set_debounce(enum gpio_port port, enum gpio_direction_type prescaler)
@ -253,7 +253,7 @@ void gpio_set_debounce(enum gpio_port port, enum gpio_direction_type prescaler)
data &= ~(0x07 << 4); data &= ~(0x07 << 4);
data |= prescaler << 4; data |= prescaler << 4;
writel(data, addr); writel(data, addr);
dbg_log(DBG_LOG, "[line]:%d addr:%08x data:%08x\n", __LINE__, addr, *((rt_uint32_t *)addr)); LOG_D("[line]:%d addr:%08x data:%08x", __LINE__, addr, *((rt_uint32_t *)addr));
} }
void gpio_irq_enable(enum gpio_port port, enum gpio_pin pin) void gpio_irq_enable(enum gpio_port port, enum gpio_pin pin)
@ -272,7 +272,7 @@ void gpio_irq_enable(enum gpio_port port, enum gpio_pin pin)
data |= 0x1 << offset; data |= 0x1 << offset;
writel(data, addr); writel(data, addr);
gpio_select_irq_clock(port, GPIO_IRQ_HOSC_24MHZ); gpio_select_irq_clock(port, GPIO_IRQ_HOSC_24MHZ);
dbg_log(DBG_LOG, "[line]:%d offset:%d addr:%08x data:%08x\n", __LINE__, offset, addr, *((rt_uint32_t *)addr)); LOG_D("[line]:%d offset:%d addr:%08x data:%08x", __LINE__, offset, addr, *((rt_uint32_t *)addr));
} }
void gpio_irq_disable(enum gpio_port port, enum gpio_pin pin) void gpio_irq_disable(enum gpio_port port, enum gpio_pin pin)
@ -292,7 +292,7 @@ void gpio_irq_disable(enum gpio_port port, enum gpio_pin pin)
data &= ~(0x1 << offset); data &= ~(0x1 << offset);
writel(data, addr); writel(data, addr);
dbg_log(DBG_LOG, "[line]:%d offset:%d addr:%08x data:%08x\n", __LINE__, offset, addr, *((rt_uint32_t *)addr)); LOG_D("[line]:%d offset:%d addr:%08x data:%08x", __LINE__, offset, addr, *((rt_uint32_t *)addr));
} }
void gpio_set_irq_type(enum gpio_port port, enum gpio_pin pin, enum gpio_irq_type irq_type) void gpio_set_irq_type(enum gpio_port port, enum gpio_pin pin, enum gpio_irq_type irq_type)
@ -312,7 +312,7 @@ void gpio_set_irq_type(enum gpio_port port, enum gpio_pin pin, enum gpio_irq_ty
data |= irq_type << offset; data |= irq_type << offset;
writel(data, addr); writel(data, addr);
dbg_log(DBG_LOG, "[line]:%d offset:%d addr:%08x data:%08x\n", __LINE__, offset, addr, *((rt_uint32_t *)addr)); LOG_D("[line]:%d offset:%d addr:%08x data:%08x", __LINE__, offset, addr, *((rt_uint32_t *)addr));
} }
static struct gpio_irq_def _g_gpio_irq_tbl[GPIO_PORT_NUM]; static struct gpio_irq_def _g_gpio_irq_tbl[GPIO_PORT_NUM];
@ -353,7 +353,7 @@ static void gpio_irq_handler(int irq, void *param)
{ {
if ((pend & 0x1) && (irq_def->irq_cb[pin] != RT_NULL)) if ((pend & 0x1) && (irq_def->irq_cb[pin] != RT_NULL))
{ {
dbg_log(DBG_LOG, "do irq callback...\n", port, pin); LOG_D("do irq callback...", port, pin);
irq_def->irq_cb[pin](irq_def->irq_arg[pin]); irq_def->irq_cb[pin](irq_def->irq_arg[pin]);
} }
pin++; pin++;
@ -452,7 +452,7 @@ static void pin_mode(struct rt_device *dev, rt_base_t pin, rt_base_t mode)
{ {
if ((pin > PIN_NUM(pin_index)) || (pin_index[pin].magic != PIN_MAGIC)) if ((pin > PIN_NUM(pin_index)) || (pin_index[pin].magic != PIN_MAGIC))
{ {
dbg_log(DBG_ERROR, "pin:%d value wrongful\n", pin); LOG_E("pin:%d value wrongful", pin);
return; return;
} }
@ -463,7 +463,7 @@ static void pin_write(struct rt_device *dev, rt_base_t pin, rt_base_t value)
{ {
if ((pin > PIN_NUM(pin_index)) || (pin_index[pin].magic != PIN_MAGIC)) if ((pin > PIN_NUM(pin_index)) || (pin_index[pin].magic != PIN_MAGIC))
{ {
dbg_log(DBG_ERROR, "pin:%d value wrongful\n", pin); LOG_E("pin:%d value wrongful", pin);
return; return;
} }
@ -474,7 +474,7 @@ static int pin_read(struct rt_device *device, rt_base_t pin)
{ {
if ((pin > PIN_NUM(pin_index)) || (pin_index[pin].magic != PIN_MAGIC)) if ((pin > PIN_NUM(pin_index)) || (pin_index[pin].magic != PIN_MAGIC))
{ {
dbg_log(DBG_ERROR, "pin:%d value wrongful\n", pin); LOG_E("pin:%d value wrongful", pin);
return 0; return 0;
} }
@ -485,7 +485,7 @@ static rt_err_t pin_attach_irq(struct rt_device *device, rt_int32_t pin, rt_uint
{ {
if ((pin > PIN_NUM(pin_index)) || (pin_index[pin].magic != PIN_MAGIC)) if ((pin > PIN_NUM(pin_index)) || (pin_index[pin].magic != PIN_MAGIC))
{ {
dbg_log(DBG_ERROR, "pin:%d value wrongful\n", pin); LOG_E("pin:%d value wrongful", pin);
return RT_ERROR; return RT_ERROR;
} }
@ -497,7 +497,7 @@ static rt_err_t pin_detach_irq(struct rt_device *device, rt_int32_t pin)
{ {
if ((pin > PIN_NUM(pin_index)) || (pin_index[pin].magic != PIN_MAGIC)) if ((pin > PIN_NUM(pin_index)) || (pin_index[pin].magic != PIN_MAGIC))
{ {
dbg_log(DBG_ERROR, "pin:%d value wrongful\n", pin); LOG_E("pin:%d value wrongful", pin);
return RT_ERROR; return RT_ERROR;
} }
@ -510,7 +510,7 @@ rt_err_t pin_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_t ena
{ {
if ((pin > PIN_NUM(pin_index)) || (pin_index[pin].magic != PIN_MAGIC)) if ((pin > PIN_NUM(pin_index)) || (pin_index[pin].magic != PIN_MAGIC))
{ {
dbg_log(DBG_ERROR, "pin:%d value wrongful\n", pin); LOG_E("pin:%d value wrongful", pin);
return RT_ERROR; return RT_ERROR;
} }

View File

@ -99,7 +99,7 @@ static void mmc_delay_us(int us)
static void mmc_dump_errinfo(unsigned int err) static void mmc_dump_errinfo(unsigned int err)
{ {
dbg_log(DBG_ERROR, "[err]:0x%08x, %s%s%s%s%s%s%s%s%s%s%s\n", LOG_E("[err]:0x%08x, %s%s%s%s%s%s%s%s%s%s%s",
err, err,
err & SDXC_RespErr ? " RE" : "", err & SDXC_RespErr ? " RE" : "",
err & SDXC_RespCRCErr ? " RCE" : "", err & SDXC_RespCRCErr ? " RCE" : "",
@ -130,7 +130,7 @@ static int mmc_update_clk(tina_mmc_t mmc)
} }
if (!timeout) if (!timeout)
{ {
dbg_log(DBG_ERROR, "mmc update clk failed\n"); LOG_E("mmc update clk failed");
return -RT_ERROR; return -RT_ERROR;
} }
/* clean interrupt */ /* clean interrupt */
@ -189,8 +189,8 @@ static rt_err_t mmc_trans_data_by_dma(tina_mmc_t mmc, struct mmc_xfe_des *xfe)
pdes[des_idx].buf_addr_ptr2 = (unsigned long)&pdes[des_idx+1]; pdes[des_idx].buf_addr_ptr2 = (unsigned long)&pdes[des_idx+1];
} }
dbg_log(DBG_LOG, "frag %d, remain %d, des[%d](%08x): " \ LOG_D("frag %d, remain %d, des[%d](%08x): " \
"[0] = %08x, [1] = %08x, [2] = %08x, [3] = %08x\n", \ "[0] = %08x, [1] = %08x, [2] = %08x, [3] = %08x", \
i, remain, des_idx, (unsigned int)&pdes[des_idx], i, remain, des_idx, (unsigned int)&pdes[des_idx],
(unsigned int)((unsigned int*)&pdes[des_idx])[0], (unsigned int)((unsigned int*)&pdes[des_idx])[1], (unsigned int)((unsigned int*)&pdes[des_idx])[0], (unsigned int)((unsigned int*)&pdes[des_idx])[1],
(unsigned int)((unsigned int*)&pdes[des_idx])[2], (unsigned int)((unsigned int*)&pdes[des_idx])[3]); (unsigned int)((unsigned int*)&pdes[des_idx])[2], (unsigned int)((unsigned int*)&pdes[des_idx])[3]);
@ -243,7 +243,7 @@ static rt_err_t mmc_trans_data_by_cpu(tina_mmc_t mmc, struct mmc_xfe_des *xfe)
if (timeout <= 0) if (timeout <= 0)
{ {
dbg_log(DBG_ERROR, "write data by cpu failed status:0x%08x\n", mmc->star_reg); LOG_E("write data by cpu failed status:0x%08x", mmc->star_reg);
return -RT_ERROR; return -RT_ERROR;
} }
mmc->fifo_reg = buff[i]; mmc->fifo_reg = buff[i];
@ -258,7 +258,7 @@ static rt_err_t mmc_trans_data_by_cpu(tina_mmc_t mmc, struct mmc_xfe_des *xfe)
if (timeout <= 0) if (timeout <= 0)
{ {
dbg_log(DBG_ERROR, "read data by cpu failed status:0x%08x\n", mmc->star_reg); LOG_E("read data by cpu failed status:0x%08x", mmc->star_reg);
return -RT_ERROR; return -RT_ERROR;
} }
buff[i] = mmc->fifo_reg; buff[i] = mmc->fifo_reg;
@ -279,7 +279,7 @@ static rt_err_t mmc_config_clock(tina_mmc_t mmc, int clk)
mmc->ckcr_reg = rval; mmc->ckcr_reg = rval;
if (mmc_update_clk(mmc) != RT_EOK) if (mmc_update_clk(mmc) != RT_EOK)
{ {
dbg_log(DBG_ERROR, "clk update fail line:%d\n", __LINE__); LOG_E("clk update fail line:%d", __LINE__);
return -RT_ERROR; return -RT_ERROR;
} }
@ -298,7 +298,7 @@ static rt_err_t mmc_config_clock(tina_mmc_t mmc, int clk)
mmc->ckcr_reg = rval; mmc->ckcr_reg = rval;
if(mmc_update_clk(mmc) != RT_EOK) if(mmc_update_clk(mmc) != RT_EOK)
{ {
dbg_log(DBG_ERROR, "clk update fail line:%d\n", __LINE__); LOG_E("clk update fail line:%d", __LINE__);
return -RT_ERROR; return -RT_ERROR;
} }
@ -307,12 +307,12 @@ static rt_err_t mmc_config_clock(tina_mmc_t mmc, int clk)
static rt_err_t mmc_set_ios(tina_mmc_t mmc, int clk, int bus_width) static rt_err_t mmc_set_ios(tina_mmc_t mmc, int clk, int bus_width)
{ {
dbg_log(DBG_LOG, "mmc set io bus width:%d clock:%d\n", \ LOG_D("mmc set io bus width:%d clock:%d", \
(bus_width == MMCSD_BUS_WIDTH_8 ? 8 : (bus_width == MMCSD_BUS_WIDTH_4 ? 4 : 1)), clk); (bus_width == MMCSD_BUS_WIDTH_8 ? 8 : (bus_width == MMCSD_BUS_WIDTH_4 ? 4 : 1)), clk);
/* change clock */ /* change clock */
if (clk && (mmc_config_clock(mmc, clk) != RT_EOK)) if (clk && (mmc_config_clock(mmc, clk) != RT_EOK))
{ {
dbg_log(DBG_ERROR, "update clock failed\n"); LOG_E("update clock failed");
return -RT_ERROR; return -RT_ERROR;
} }
@ -349,13 +349,13 @@ static int mmc_send_cmd(struct rt_mmcsd_host *host, struct rt_mmcsd_cmd *cmd)
status = mmc->star_reg; status = mmc->star_reg;
while (status & (1 << 9)) while (status & (1 << 9))
{ {
dbg_log(DBG_LOG, "note: check card busy\n"); LOG_D("note: check card busy");
status = mmc->star_reg; status = mmc->star_reg;
if (!timeout--) if (!timeout--)
{ {
err = -1; err = -1;
dbg_log(DBG_ERROR, "mmc cmd12 busy timeout data:0x%08x\n", status); LOG_E("mmc cmd12 busy timeout data:0x%08x", status);
return err; return err;
} }
mmc_delay_us(1); mmc_delay_us(1);
@ -397,7 +397,7 @@ static int mmc_send_cmd(struct rt_mmcsd_host *host, struct rt_mmcsd_cmd *cmd)
mmc->bycr_reg = bytecnt; mmc->bycr_reg = bytecnt;
} }
dbg_log(DBG_LOG, "cmd %d(0x%08x), arg 0x%08x\n", cmd->cmd_code, cmdval | cmd->cmd_code, cmd->arg); LOG_D("cmd %d(0x%08x), arg 0x%08x", cmd->cmd_code, cmdval | cmd->cmd_code, cmd->arg);
mmc->cagr_reg = cmd->arg; mmc->cagr_reg = cmd->arg;
if (!data) if (!data)
{ {
@ -412,7 +412,7 @@ static int mmc_send_cmd(struct rt_mmcsd_host *host, struct rt_mmcsd_cmd *cmd)
*/ */
if (data) if (data)
{ {
dbg_log(DBG_LOG, "mmc trans data %d bytes addr:0x%08x\n", bytecnt, data); LOG_D("mmc trans data %d bytes addr:0x%08x", bytecnt, data);
#ifdef CONFIG_MMC_USE_DMA #ifdef CONFIG_MMC_USE_DMA
if (bytecnt > 64) if (bytecnt > 64)
{ {
@ -478,13 +478,13 @@ static int mmc_send_cmd(struct rt_mmcsd_host *host, struct rt_mmcsd_cmd *cmd)
cmd->resp[2] = mmc->resp1_reg; cmd->resp[2] = mmc->resp1_reg;
cmd->resp[1] = mmc->resp2_reg; cmd->resp[1] = mmc->resp2_reg;
cmd->resp[0] = mmc->resp3_reg; cmd->resp[0] = mmc->resp3_reg;
dbg_log(DBG_LOG, "mmc resp 0x%08x 0x%08x 0x%08x 0x%08x\n", LOG_D("mmc resp 0x%08x 0x%08x 0x%08x 0x%08x",
cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3]); cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3]);
} }
else else
{ {
cmd->resp[0] = mmc->resp0_reg; cmd->resp[0] = mmc->resp0_reg;
dbg_log(DBG_LOG, "mmc resp 0x%08x\n", cmd->resp[0]); LOG_D("mmc resp 0x%08x", cmd->resp[0]);
} }
out: out:
@ -516,16 +516,16 @@ out:
mmc->gctl_reg = mmc->gctl_reg | 0x80000000; mmc->gctl_reg = mmc->gctl_reg | 0x80000000;
mmc->dbgc_reg = 0xdeb; mmc->dbgc_reg = 0xdeb;
timeout = 1000; timeout = 1000;
dbg_log(DBG_LOG, "Read remain data\n"); LOG_D("Read remain data");
while (mmc->bbcr_reg < 512) while (mmc->bbcr_reg < 512)
{ {
unsigned int tmp = mmc->fifo_reg; unsigned int tmp = mmc->fifo_reg;
tmp = tmp; tmp = tmp;
dbg_log(DBG_LOG, "Read data 0x%08x, bbcr 0x%04x\n", tmp, mmc->bbcr_reg); LOG_D("Read data 0x%08x, bbcr 0x%04x", tmp, mmc->bbcr_reg);
mmc_delay_us(1); mmc_delay_us(1);
if (!(timeout--)) if (!(timeout--))
{ {
dbg_log(DBG_ERROR, "Read remain data timeout\n"); LOG_E("Read remain data timeout");
break; break;
} }
} }
@ -536,7 +536,7 @@ out:
mmc_update_clk(mmc); mmc_update_clk(mmc);
cmd->err = -RT_ETIMEOUT; cmd->err = -RT_ETIMEOUT;
dbg_log(DBG_ERROR, "mmc cmd %d err\n", cmd->cmd_code); LOG_E("mmc cmd %d err", cmd->cmd_code);
} }
mmc->gctl_reg &= ~(0x1 << 4); mmc->gctl_reg &= ~(0x1 << 4);
@ -744,13 +744,13 @@ int tina_sdio_init(void)
host = mmcsd_alloc_host(); host = mmcsd_alloc_host();
if (!host) if (!host)
{ {
dbg_log(DBG_ERROR, "alloc host failed\n"); LOG_E("alloc host failed");
goto err; goto err;
} }
if (rt_sem_init(&_sdio_drv.rt_sem, "sdio_sem", RT_NULL, RT_IPC_FLAG_FIFO)) if (rt_sem_init(&_sdio_drv.rt_sem, "sdio_sem", RT_NULL, RT_IPC_FLAG_FIFO))
{ {
dbg_log(DBG_ERROR, "sem init failed\n"); LOG_E("sem init failed");
goto err; goto err;
} }
_sdio_drv.mmc_des = (tina_mmc_t)MMC0_BASE_ADDR; _sdio_drv.mmc_des = (tina_mmc_t)MMC0_BASE_ADDR;

View File

@ -33,25 +33,22 @@
#define SPI_BUS_MAX_CLK (30 * 1000 * 1000) #define SPI_BUS_MAX_CLK (30 * 1000 * 1000)
//#define DEBUG
#define DBG_ENABLE #define DBG_ENABLE
#define DBG_SECTION_NAME "SPI" #define DBG_SECTION_NAME "SPI"
#ifdef DEBUG
#define DBG_LEVEL DBG_LOG
#else
#define DBG_LEVEL DBG_WARNING #define DBG_LEVEL DBG_WARNING
#endif /* DEBUG */
#define DBG_COLOR #define DBG_COLOR
#include <rtdbg.h> #include <rtdbg.h>
#ifdef RT_USING_SPI #ifdef RT_USING_SPI
//#define DEBUG
#define ARR_LEN(__N) (sizeof(__N) / sizeof(__N[0])) #define ARR_LEN(__N) (sizeof(__N) / sizeof(__N[0]))
#ifdef DEBUG
#define DEBUG_PRINTF(...) rt_kprintf(__VA_ARGS__)
#else
#define DEBUG_PRINTF(...)
#endif
#define __SPI_STATIC_INLINE__ rt_inline #define __SPI_STATIC_INLINE__ rt_inline
/* /*
@ -451,30 +448,30 @@ static rt_err_t configure(struct rt_spi_device *device,
struct tina_spi *_spi_info = (struct tina_spi *)spi_bus->parent.user_data; struct tina_spi *_spi_info = (struct tina_spi *)spi_bus->parent.user_data;
SPI_T *spi = _spi_info->spi; SPI_T *spi = _spi_info->spi;
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
RT_ASSERT(device != RT_NULL); RT_ASSERT(device != RT_NULL);
RT_ASSERT(configuration != RT_NULL); RT_ASSERT(configuration != RT_NULL);
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
DEBUG_PRINTF("spi address: %08X\n", (rt_uint32_t)spi); LOG_D("spi address: %08X", (rt_uint32_t)spi);
SPI_Disable(spi); SPI_Disable(spi);
SPI_Reset(spi); SPI_Reset(spi);
SPI_ResetRxFifo(spi); SPI_ResetRxFifo(spi);
SPI_ResetTxFifo(spi); SPI_ResetTxFifo(spi);
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
/* data_width */ /* data_width */
if (configuration->data_width != 8) if (configuration->data_width != 8)
{ {
DEBUG_PRINTF("error: data_width is %d\n", configuration->data_width); LOG_D("error: data_width is %d", configuration->data_width);
return RT_EIO; return RT_EIO;
} }
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
SPI_SetDuplex(spi, SPI_TCTRL_DHB_FULL_DUPLEX); SPI_SetDuplex(spi, SPI_TCTRL_DHB_FULL_DUPLEX);
SPI_SetMode(spi, SPI_CTRL_MODE_MASTER); SPI_SetMode(spi, SPI_CTRL_MODE_MASTER);
@ -510,7 +507,7 @@ static rt_err_t configure(struct rt_spi_device *device,
rt_uint32_t max_hz; rt_uint32_t max_hz;
rt_uint32_t div; rt_uint32_t div;
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
max_hz = configuration->max_hz; max_hz = configuration->max_hz;
@ -520,14 +517,14 @@ static rt_err_t configure(struct rt_spi_device *device,
} }
spi_clock = ahb_get_clk(); spi_clock = ahb_get_clk();
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
div = (spi_clock + max_hz - 1) / max_hz; div = (spi_clock + max_hz - 1) / max_hz;
dbg_log(DBG_LOG, "configuration->max_hz: %d\n", configuration->max_hz); LOG_D("configuration->max_hz: %d", configuration->max_hz);
dbg_log(DBG_LOG, "max freq: %d\n", max_hz); LOG_D("max freq: %d", max_hz);
dbg_log(DBG_LOG, "spi_clock: %d\n", spi_clock); LOG_D("spi_clock: %d", spi_clock);
dbg_log(DBG_LOG, "div: %d\n", div); LOG_D("div: %d", div);
SPI_SetClkDiv(spi, div / 2); SPI_SetClkDiv(spi, div / 2);
} /* baudrate */ } /* baudrate */
@ -536,7 +533,7 @@ static rt_err_t configure(struct rt_spi_device *device,
SPI_SetDataSize(spi, 0, 0); SPI_SetDataSize(spi, 0, 0);
SPI_Enable(spi); SPI_Enable(spi);
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
return RT_EOK; return RT_EOK;
}; };
@ -552,19 +549,19 @@ static rt_uint32_t xfer(struct rt_spi_device *device, struct rt_spi_message *mes
RT_ASSERT(device != NULL); RT_ASSERT(device != NULL);
RT_ASSERT(message != NULL); RT_ASSERT(message != NULL);
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
DEBUG_PRINTF("spi_info: %08X\n", (rt_uint32_t)_spi_info); LOG_D("spi_info: %08X", (rt_uint32_t)_spi_info);
DEBUG_PRINTF("spi address: %08X\n", (rt_uint32_t)spi); LOG_D("spi address: %08X", (rt_uint32_t)spi);
/* take CS */ /* take CS */
if (message->cs_take) if (message->cs_take)
{ {
SPI_ManualChipSelect(spi, tina_spi_cs->cs); SPI_ManualChipSelect(spi, tina_spi_cs->cs);
SPI_SetCsLevel(spi, false); SPI_SetCsLevel(spi, false);
DEBUG_PRINTF("spi take cs\n"); LOG_D("spi take cs");
} }
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
{ {
if ((config->data_width <= 8) && (message->length > 0)) if ((config->data_width <= 8) && (message->length > 0))
@ -574,7 +571,7 @@ static rt_uint32_t xfer(struct rt_spi_device *device, struct rt_spi_message *mes
rt_uint32_t tx_size = message->length; rt_uint32_t tx_size = message->length;
rt_uint32_t rx_size = message->length; rt_uint32_t rx_size = message->length;
DEBUG_PRINTF("spi poll transfer start: %d\n", tx_size); LOG_D("spi poll transfer start: %d", tx_size);
SPI_ResetTxFifo(spi); SPI_ResetTxFifo(spi);
SPI_ResetRxFifo(spi); SPI_ResetRxFifo(spi);
@ -582,7 +579,7 @@ static rt_uint32_t xfer(struct rt_spi_device *device, struct rt_spi_message *mes
SPI_StartTransmit(spi); SPI_StartTransmit(spi);
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
while (tx_size > 0 || rx_size > 0) while (tx_size > 0 || rx_size > 0)
{ {
@ -611,25 +608,25 @@ static rt_uint32_t xfer(struct rt_spi_device *device, struct rt_spi_message *mes
} }
} }
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
if ((tx_size != 0) || (rx_size != 0)) if ((tx_size != 0) || (rx_size != 0))
{ {
DEBUG_PRINTF("spi_tx_rx error with tx count = %d, rx count = %d.\n", tx_size, rx_size); LOG_D("spi_tx_rx error with tx count = %d, rx count = %d.", tx_size, rx_size);
return 0; return 0;
} }
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
while (SPI_IntState(spi, SPI_INT_TRANSFER_COMPLETE) == 0); while (SPI_IntState(spi, SPI_INT_TRANSFER_COMPLETE) == 0);
SPI_ClearInt(spi, SPI_INT_TRANSFER_COMPLETE); SPI_ClearInt(spi, SPI_INT_TRANSFER_COMPLETE);
DEBUG_PRINTF("spi poll transfer finsh\n"); LOG_D("spi poll transfer finsh");
} }
else if (config->data_width > 8) else if (config->data_width > 8)
{ {
DEBUG_PRINTF("data width: %d\n", config->data_width); LOG_D("data width: %d", config->data_width);
RT_ASSERT(NULL); RT_ASSERT(NULL);
} }
} }
@ -638,7 +635,7 @@ static rt_uint32_t xfer(struct rt_spi_device *device, struct rt_spi_message *mes
if (message->cs_release) if (message->cs_release)
{ {
SPI_SetCsLevel(spi, true); SPI_SetCsLevel(spi, true);
DEBUG_PRINTF("spi release cs\n"); LOG_D("spi release cs");
} }
return message->length; return message->length;
@ -676,7 +673,7 @@ rt_err_t tina_spi_bus_register(SPI_T *spi, const char *spi_bus_name)
{ {
int i; int i;
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
RT_ASSERT(spi_bus_name != RT_NULL); RT_ASSERT(spi_bus_name != RT_NULL);
@ -688,67 +685,67 @@ rt_err_t tina_spi_bus_register(SPI_T *spi, const char *spi_bus_name)
bus_gate_clk_enalbe(spis[i].spi_gate); bus_gate_clk_enalbe(spis[i].spi_gate);
spis[i].spi_bus->parent.user_data = (void *)&spis[i]; spis[i].spi_bus->parent.user_data = (void *)&spis[i];
DEBUG_PRINTF("bus addr: %08X\n", (rt_uint32_t)spis[i].spi_bus); LOG_D("bus addr: %08X", (rt_uint32_t)spis[i].spi_bus);
DEBUG_PRINTF("user_data: %08X\n", (rt_uint32_t)spis[i].spi_bus->parent.user_data); LOG_D("user_data: %08X", (rt_uint32_t)spis[i].spi_bus->parent.user_data);
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
rt_spi_bus_register(spis[i].spi_bus, spi_bus_name, &tina_spi_ops); rt_spi_bus_register(spis[i].spi_bus, spi_bus_name, &tina_spi_ops);
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
return RT_EOK; return RT_EOK;
} }
} }
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
return RT_ERROR; return RT_ERROR;
} }
int rt_hw_spi_init(void) int rt_hw_spi_init(void)
{ {
DEBUG_PRINTF("register spi bus\n"); LOG_D("register spi bus");
#ifdef TINA_USING_SPI0 #ifdef TINA_USING_SPI0
/* register spi bus */ /* register spi bus */
{ {
rt_err_t result; rt_err_t result;
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
gpio_set_func(GPIO_PORT_C, GPIO_PIN_0, IO_FUN_1); gpio_set_func(GPIO_PORT_C, GPIO_PIN_0, IO_FUN_1);
gpio_set_func(GPIO_PORT_C, GPIO_PIN_2, IO_FUN_1); gpio_set_func(GPIO_PORT_C, GPIO_PIN_2, IO_FUN_1);
gpio_set_func(GPIO_PORT_C, GPIO_PIN_3, IO_FUN_1); gpio_set_func(GPIO_PORT_C, GPIO_PIN_3, IO_FUN_1);
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
result = tina_spi_bus_register((SPI_T *)SPI0_BASE_ADDR, "spi0"); result = tina_spi_bus_register((SPI_T *)SPI0_BASE_ADDR, "spi0");
if (result != RT_EOK) if (result != RT_EOK)
{ {
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
return result; return result;
} }
} }
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
/* attach cs */ /* attach cs */
{ {
static struct rt_spi_device spi_device; static struct rt_spi_device spi_device;
static struct tina_spi_cs spi_cs; static struct tina_spi_cs spi_cs;
rt_err_t result; rt_err_t result;
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
spi_cs.cs = SPI_TCTRL_SS_SEL_SS0; spi_cs.cs = SPI_TCTRL_SS_SEL_SS0;
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
gpio_set_func(GPIO_PORT_C, GPIO_PIN_1, IO_FUN_1); gpio_set_func(GPIO_PORT_C, GPIO_PIN_1, IO_FUN_1);
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
result = rt_spi_bus_attach_device(&spi_device, "spi00", "spi0", (void *)&spi_cs); result = rt_spi_bus_attach_device(&spi_device, "spi00", "spi0", (void *)&spi_cs);
if (result != RT_EOK) if (result != RT_EOK)
{ {
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
return result; return result;
} }
} }
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); LOG_D("%s -> %d", __FUNCTION__, __LINE__);
#endif #endif
#ifdef TINA_USING_SPI1 #ifdef TINA_USING_SPI1
@ -763,12 +760,12 @@ int rt_hw_spi_init(void)
result = tina_spi_bus_register((SPI_T *)SPI1_BASE_ADDR, "spi1"); result = tina_spi_bus_register((SPI_T *)SPI1_BASE_ADDR, "spi1");
if (result != RT_EOK) if (result != RT_EOK)
{ {
DEBUG_PRINTF("register spi bus faild: %d\n", result); LOG_D("register spi bus faild: %d", result);
return result; return result;
} }
} }
DEBUG_PRINTF("attach cs\n"); LOG_D("attach cs");
/* attach cs */ /* attach cs */
{ {
static struct rt_spi_device spi_device; static struct rt_spi_device spi_device;
@ -781,7 +778,7 @@ int rt_hw_spi_init(void)
result = rt_spi_bus_attach_device(&spi_device, "spi10", "spi1", (void *)&spi_cs); result = rt_spi_bus_attach_device(&spi_device, "spi10", "spi1", (void *)&spi_cs);
if (result != RT_EOK) if (result != RT_EOK)
{ {
DEBUG_PRINTF("attach cs faild: %d\n", result); LOG_D("attach cs faild: %d", result);
return result; return result;
} }
} }

View File

@ -672,13 +672,13 @@ static void _enet_config(void)
/* Set SMI to get PHY link status. */ /* Set SMI to get PHY link status. */
sysClock = CLOCK_GetFreq(kCLOCK_AhbClk); sysClock = CLOCK_GetFreq(kCLOCK_AhbClk);
dbg_log(DBG_LOG, "deinit\n"); LOG_D("deinit");
ENET_Deinit(imxrt_eth_device.enet_base); ENET_Deinit(imxrt_eth_device.enet_base);
dbg_log(DBG_LOG, "init\n"); LOG_D("init");
ENET_Init(imxrt_eth_device.enet_base, &imxrt_eth_device.enet_handle, &config, &buffConfig, &imxrt_eth_device.dev_addr[0], sysClock); ENET_Init(imxrt_eth_device.enet_base, &imxrt_eth_device.enet_handle, &config, &buffConfig, &imxrt_eth_device.dev_addr[0], sysClock);
dbg_log(DBG_LOG, "set call back\n"); LOG_D("set call back");
ENET_SetCallback(&imxrt_eth_device.enet_handle, _enet_callback, &imxrt_eth_device); ENET_SetCallback(&imxrt_eth_device.enet_handle, _enet_callback, &imxrt_eth_device);
dbg_log(DBG_LOG, "active read\n"); LOG_D("active read");
ENET_ActiveRead(imxrt_eth_device.enet_base); ENET_ActiveRead(imxrt_eth_device.enet_base);
} }
@ -722,7 +722,7 @@ static void packet_dump(const char *msg, const struct pbuf *p)
/* initialize the interface */ /* initialize the interface */
static rt_err_t rt_imxrt_eth_init(rt_device_t dev) static rt_err_t rt_imxrt_eth_init(rt_device_t dev)
{ {
dbg_log(DBG_LOG, "rt_imxrt_eth_init...\n"); LOG_D("rt_imxrt_eth_init...");
_enet_config(); _enet_config();
return RT_EOK; return RT_EOK;
@ -730,33 +730,33 @@ static rt_err_t rt_imxrt_eth_init(rt_device_t dev)
static rt_err_t rt_imxrt_eth_open(rt_device_t dev, rt_uint16_t oflag) static rt_err_t rt_imxrt_eth_open(rt_device_t dev, rt_uint16_t oflag)
{ {
dbg_log(DBG_LOG, "rt_imxrt_eth_open...\n"); LOG_D("rt_imxrt_eth_open...");
return RT_EOK; return RT_EOK;
} }
static rt_err_t rt_imxrt_eth_close(rt_device_t dev) static rt_err_t rt_imxrt_eth_close(rt_device_t dev)
{ {
dbg_log(DBG_LOG, "rt_imxrt_eth_close...\n"); LOG_D("rt_imxrt_eth_close...");
return RT_EOK; return RT_EOK;
} }
static rt_size_t rt_imxrt_eth_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size) static rt_size_t rt_imxrt_eth_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size)
{ {
dbg_log(DBG_LOG, "rt_imxrt_eth_read...\n"); LOG_D("rt_imxrt_eth_read...");
rt_set_errno(-RT_ENOSYS); rt_set_errno(-RT_ENOSYS);
return 0; return 0;
} }
static rt_size_t rt_imxrt_eth_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size) static rt_size_t rt_imxrt_eth_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size)
{ {
dbg_log(DBG_LOG, "rt_imxrt_eth_write...\n"); LOG_D("rt_imxrt_eth_write...");
rt_set_errno(-RT_ENOSYS); rt_set_errno(-RT_ENOSYS);
return 0; return 0;
} }
static rt_err_t rt_imxrt_eth_control(rt_device_t dev, int cmd, void *args) static rt_err_t rt_imxrt_eth_control(rt_device_t dev, int cmd, void *args)
{ {
dbg_log(DBG_LOG, "rt_imxrt_eth_control...\n"); LOG_D("rt_imxrt_eth_control...");
switch (cmd) switch (cmd)
{ {
case NIOCTL_GADDR: case NIOCTL_GADDR:
@ -965,7 +965,7 @@ rt_err_t rt_imxrt_eth_tx(rt_device_t dev, struct pbuf *p)
RT_ASSERT(p != NULL); RT_ASSERT(p != NULL);
RT_ASSERT(enet_handle != RT_NULL); RT_ASSERT(enet_handle != RT_NULL);
dbg_log(DBG_LOG, "rt_imxrt_eth_tx: %d\n", p->len); LOG_D("rt_imxrt_eth_tx: %d", p->len);
#ifdef ETH_TX_DUMP #ifdef ETH_TX_DUMP
packet_dump("send", p); packet_dump("send", p);
@ -1019,18 +1019,18 @@ struct pbuf *rt_imxrt_eth_rx(rt_device_t dev)
} }
else else
{ {
dbg_log(DBG_LOG, " A frame read failed\n"); LOG_D(" A frame read failed");
pbuf_free(p); pbuf_free(p);
} }
} }
else else
{ {
dbg_log(DBG_LOG, " pbuf_alloc faild\n"); LOG_D(" pbuf_alloc faild");
} }
} }
else if (status == kStatus_ENET_RxFrameError) else if (status == kStatus_ENET_RxFrameError)
{ {
dbg_log(DBG_WARNING, "ENET_GetRxFrameSize: kStatus_ENET_RxFrameError\n"); LOG_W("ENET_GetRxFrameSize: kStatus_ENET_RxFrameError");
/* Update the received buffer when error happened. */ /* Update the received buffer when error happened. */
/* Get the error information of the received g_frame. */ /* Get the error information of the received g_frame. */
ENET_GetRxErrBeforeReadFrame(enet_handle, error_statistic); ENET_GetRxErrBeforeReadFrame(enet_handle, error_statistic);
@ -1068,20 +1068,20 @@ static void phy_monitor_thread_entry(void *parameter)
if (kPHY_Speed10M == speed) if (kPHY_Speed10M == speed)
{ {
dbg_log(DBG_LOG, "10M\n"); LOG_D("10M");
} }
else else
{ {
dbg_log(DBG_LOG, "100M\n"); LOG_D("100M");
} }
if (kPHY_HalfDuplex == duplex) if (kPHY_HalfDuplex == duplex)
{ {
dbg_log(DBG_LOG, "half dumplex\n"); LOG_D("half dumplex");
} }
else else
{ {
dbg_log(DBG_LOG, "full dumplex\n"); LOG_D("full dumplex");
} }
if ((imxrt_eth_device.speed != (enet_mii_speed_t)speed) if ((imxrt_eth_device.speed != (enet_mii_speed_t)speed)
@ -1090,19 +1090,19 @@ static void phy_monitor_thread_entry(void *parameter)
imxrt_eth_device.speed = (enet_mii_speed_t)speed; imxrt_eth_device.speed = (enet_mii_speed_t)speed;
imxrt_eth_device.duplex = (enet_mii_duplex_t)duplex; imxrt_eth_device.duplex = (enet_mii_duplex_t)duplex;
dbg_log(DBG_LOG, "link up, and update eth mode.\n"); LOG_D("link up, and update eth mode.");
rt_imxrt_eth_init((rt_device_t)&imxrt_eth_device); rt_imxrt_eth_init((rt_device_t)&imxrt_eth_device);
} }
else else
{ {
dbg_log(DBG_LOG, "link up, eth not need re-config.\n"); LOG_D("link up, eth not need re-config.");
} }
dbg_log(DBG_LOG, "link up.\n"); LOG_D("link up.");
eth_device_linkchange(&imxrt_eth_device.parent, RT_TRUE); eth_device_linkchange(&imxrt_eth_device.parent, RT_TRUE);
} }
else // link down else // link down
{ {
dbg_log(DBG_LOG, "link down.\n"); LOG_D("link down.");
eth_device_linkchange(&imxrt_eth_device.parent, RT_FALSE); eth_device_linkchange(&imxrt_eth_device.parent, RT_FALSE);
} }
} }
@ -1152,20 +1152,20 @@ static int rt_hw_imxrt_eth_init(void)
imxrt_eth_device.parent.eth_rx = rt_imxrt_eth_rx; imxrt_eth_device.parent.eth_rx = rt_imxrt_eth_rx;
imxrt_eth_device.parent.eth_tx = rt_imxrt_eth_tx; imxrt_eth_device.parent.eth_tx = rt_imxrt_eth_tx;
dbg_log(DBG_LOG, "sem init: tx_wait\r\n"); LOG_D("sem init: tx_wait\r");
/* init tx semaphore */ /* init tx semaphore */
rt_sem_init(&imxrt_eth_device.tx_wait, "tx_wait", 0, RT_IPC_FLAG_FIFO); rt_sem_init(&imxrt_eth_device.tx_wait, "tx_wait", 0, RT_IPC_FLAG_FIFO);
/* register eth device */ /* register eth device */
dbg_log(DBG_LOG, "eth_device_init start\r\n"); LOG_D("eth_device_init start\r");
state = eth_device_init(&(imxrt_eth_device.parent), "e0"); state = eth_device_init(&(imxrt_eth_device.parent), "e0");
if (RT_EOK == state) if (RT_EOK == state)
{ {
dbg_log(DBG_LOG, "eth_device_init success\r\n"); LOG_D("eth_device_init success\r");
} }
else else
{ {
dbg_log(DBG_LOG, "eth_device_init faild: %d\r\n", state); LOG_D("eth_device_init faild: %d\r", state);
} }
eth_device_linkchange(&imxrt_eth_device.parent, RT_FALSE); eth_device_linkchange(&imxrt_eth_device.parent, RT_FALSE);

View File

@ -376,13 +376,13 @@ static void _enet_config(void)
/* Set SMI to get PHY link status. */ /* Set SMI to get PHY link status. */
sysClock = CLOCK_GetFreq(kCLOCK_AhbClk); sysClock = CLOCK_GetFreq(kCLOCK_AhbClk);
dbg_log(DBG_LOG, "deinit\n"); LOG_D("deinit");
ENET_Deinit(imxrt_eth_device.enet_base); ENET_Deinit(imxrt_eth_device.enet_base);
dbg_log(DBG_LOG, "init\n"); LOG_D("init");
ENET_Init(imxrt_eth_device.enet_base, &imxrt_eth_device.enet_handle, &config, &buffConfig, &imxrt_eth_device.dev_addr[0], sysClock); ENET_Init(imxrt_eth_device.enet_base, &imxrt_eth_device.enet_handle, &config, &buffConfig, &imxrt_eth_device.dev_addr[0], sysClock);
dbg_log(DBG_LOG, "set call back\n"); LOG_D("set call back");
ENET_SetCallback(&imxrt_eth_device.enet_handle, _enet_callback, &imxrt_eth_device); ENET_SetCallback(&imxrt_eth_device.enet_handle, _enet_callback, &imxrt_eth_device);
dbg_log(DBG_LOG, "active read\n"); LOG_D("active read");
ENET_ActiveRead(imxrt_eth_device.enet_base); ENET_ActiveRead(imxrt_eth_device.enet_base);
} }
@ -426,7 +426,7 @@ static void packet_dump(const char *msg, const struct pbuf *p)
/* initialize the interface */ /* initialize the interface */
static rt_err_t rt_imxrt_eth_init(rt_device_t dev) static rt_err_t rt_imxrt_eth_init(rt_device_t dev)
{ {
dbg_log(DBG_LOG, "rt_imxrt_eth_init...\n"); LOG_D("rt_imxrt_eth_init...");
_enet_config(); _enet_config();
return RT_EOK; return RT_EOK;
@ -434,33 +434,33 @@ static rt_err_t rt_imxrt_eth_init(rt_device_t dev)
static rt_err_t rt_imxrt_eth_open(rt_device_t dev, rt_uint16_t oflag) static rt_err_t rt_imxrt_eth_open(rt_device_t dev, rt_uint16_t oflag)
{ {
dbg_log(DBG_LOG, "rt_imxrt_eth_open...\n"); LOG_D("rt_imxrt_eth_open...");
return RT_EOK; return RT_EOK;
} }
static rt_err_t rt_imxrt_eth_close(rt_device_t dev) static rt_err_t rt_imxrt_eth_close(rt_device_t dev)
{ {
dbg_log(DBG_LOG, "rt_imxrt_eth_close...\n"); LOG_D("rt_imxrt_eth_close...");
return RT_EOK; return RT_EOK;
} }
static rt_size_t rt_imxrt_eth_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size) static rt_size_t rt_imxrt_eth_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size)
{ {
dbg_log(DBG_LOG, "rt_imxrt_eth_read...\n"); LOG_D("rt_imxrt_eth_read...");
rt_set_errno(-RT_ENOSYS); rt_set_errno(-RT_ENOSYS);
return 0; return 0;
} }
static rt_size_t rt_imxrt_eth_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size) static rt_size_t rt_imxrt_eth_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size)
{ {
dbg_log(DBG_LOG, "rt_imxrt_eth_write...\n"); LOG_D("rt_imxrt_eth_write...");
rt_set_errno(-RT_ENOSYS); rt_set_errno(-RT_ENOSYS);
return 0; return 0;
} }
static rt_err_t rt_imxrt_eth_control(rt_device_t dev, int cmd, void *args) static rt_err_t rt_imxrt_eth_control(rt_device_t dev, int cmd, void *args)
{ {
dbg_log(DBG_LOG, "rt_imxrt_eth_control...\n"); LOG_D("rt_imxrt_eth_control...");
switch (cmd) switch (cmd)
{ {
case NIOCTL_GADDR: case NIOCTL_GADDR:
@ -668,7 +668,7 @@ rt_err_t rt_imxrt_eth_tx(rt_device_t dev, struct pbuf *p)
RT_ASSERT(p != NULL); RT_ASSERT(p != NULL);
RT_ASSERT(enet_handle != RT_NULL); RT_ASSERT(enet_handle != RT_NULL);
dbg_log(DBG_LOG, "rt_imxrt_eth_tx: %d\n", p->len); LOG_D("rt_imxrt_eth_tx: %d", p->len);
#ifdef ETH_TX_DUMP #ifdef ETH_TX_DUMP
packet_dump("send", p); packet_dump("send", p);
@ -722,18 +722,18 @@ struct pbuf *rt_imxrt_eth_rx(rt_device_t dev)
} }
else else
{ {
dbg_log(DBG_LOG, " A frame read failed\n"); LOG_D(" A frame read failed");
pbuf_free(p); pbuf_free(p);
} }
} }
else else
{ {
dbg_log(DBG_LOG, " pbuf_alloc faild\n"); LOG_D(" pbuf_alloc faild");
} }
} }
else if (status == kStatus_ENET_RxFrameError) else if (status == kStatus_ENET_RxFrameError)
{ {
dbg_log(DBG_WARNING, "ENET_GetRxFrameSize: kStatus_ENET_RxFrameError\n"); LOG_W("ENET_GetRxFrameSize: kStatus_ENET_RxFrameError");
/* Update the received buffer when error happened. */ /* Update the received buffer when error happened. */
/* Get the error information of the received g_frame. */ /* Get the error information of the received g_frame. */
ENET_GetRxErrBeforeReadFrame(enet_handle, error_statistic); ENET_GetRxErrBeforeReadFrame(enet_handle, error_statistic);
@ -771,20 +771,20 @@ static void phy_monitor_thread_entry(void *parameter)
if (kPHY_Speed10M == speed) if (kPHY_Speed10M == speed)
{ {
dbg_log(DBG_LOG, "10M\n"); LOG_D("10M");
} }
else else
{ {
dbg_log(DBG_LOG, "100M\n"); LOG_D("100M");
} }
if (kPHY_HalfDuplex == duplex) if (kPHY_HalfDuplex == duplex)
{ {
dbg_log(DBG_LOG, "half dumplex\n"); LOG_D("half dumplex");
} }
else else
{ {
dbg_log(DBG_LOG, "full dumplex\n"); LOG_D("full dumplex");
} }
if ((imxrt_eth_device.speed != (enet_mii_speed_t)speed) if ((imxrt_eth_device.speed != (enet_mii_speed_t)speed)
@ -793,19 +793,19 @@ static void phy_monitor_thread_entry(void *parameter)
imxrt_eth_device.speed = (enet_mii_speed_t)speed; imxrt_eth_device.speed = (enet_mii_speed_t)speed;
imxrt_eth_device.duplex = (enet_mii_duplex_t)duplex; imxrt_eth_device.duplex = (enet_mii_duplex_t)duplex;
dbg_log(DBG_LOG, "link up, and update eth mode.\n"); LOG_D("link up, and update eth mode.");
rt_imxrt_eth_init((rt_device_t)&imxrt_eth_device); rt_imxrt_eth_init((rt_device_t)&imxrt_eth_device);
} }
else else
{ {
dbg_log(DBG_LOG, "link up, eth not need re-config.\n"); LOG_D("link up, eth not need re-config.");
} }
dbg_log(DBG_LOG, "link up.\n"); LOG_D("link up.");
eth_device_linkchange(&imxrt_eth_device.parent, RT_TRUE); eth_device_linkchange(&imxrt_eth_device.parent, RT_TRUE);
} }
else // link down else // link down
{ {
dbg_log(DBG_LOG, "link down.\n"); LOG_D("link down.");
eth_device_linkchange(&imxrt_eth_device.parent, RT_FALSE); eth_device_linkchange(&imxrt_eth_device.parent, RT_FALSE);
} }
} }
@ -846,20 +846,20 @@ static int rt_hw_imxrt_eth_init(void)
imxrt_eth_device.parent.eth_rx = rt_imxrt_eth_rx; imxrt_eth_device.parent.eth_rx = rt_imxrt_eth_rx;
imxrt_eth_device.parent.eth_tx = rt_imxrt_eth_tx; imxrt_eth_device.parent.eth_tx = rt_imxrt_eth_tx;
dbg_log(DBG_LOG, "sem init: tx_wait\r\n"); LOG_D("sem init: tx_wait\r");
/* init tx semaphore */ /* init tx semaphore */
rt_sem_init(&imxrt_eth_device.tx_wait, "tx_wait", 0, RT_IPC_FLAG_FIFO); rt_sem_init(&imxrt_eth_device.tx_wait, "tx_wait", 0, RT_IPC_FLAG_FIFO);
/* register eth device */ /* register eth device */
dbg_log(DBG_LOG, "eth_device_init start\r\n"); LOG_D("eth_device_init start\r");
state = eth_device_init(&(imxrt_eth_device.parent), "e0"); state = eth_device_init(&(imxrt_eth_device.parent), "e0");
if (RT_EOK == state) if (RT_EOK == state)
{ {
dbg_log(DBG_LOG, "eth_device_init success\r\n"); LOG_D("eth_device_init success\r");
} }
else else
{ {
dbg_log(DBG_LOG, "eth_device_init faild: %d\r\n", state); LOG_D("eth_device_init faild: %d\r", state);
} }
eth_device_linkchange(&imxrt_eth_device.parent, RT_FALSE); eth_device_linkchange(&imxrt_eth_device.parent, RT_FALSE);

View File

@ -676,13 +676,13 @@ static void _enet_config(void)
/* Set SMI to get PHY link status. */ /* Set SMI to get PHY link status. */
sysClock = CLOCK_GetFreq(kCLOCK_AhbClk); sysClock = CLOCK_GetFreq(kCLOCK_AhbClk);
dbg_log(DBG_LOG, "deinit\n"); LOG_D("deinit");
ENET_Deinit(imxrt_eth_device.enet_base); ENET_Deinit(imxrt_eth_device.enet_base);
dbg_log(DBG_LOG, "init\n"); LOG_D("init");
ENET_Init(imxrt_eth_device.enet_base, &imxrt_eth_device.enet_handle, &config, &buffConfig, &imxrt_eth_device.dev_addr[0], sysClock); ENET_Init(imxrt_eth_device.enet_base, &imxrt_eth_device.enet_handle, &config, &buffConfig, &imxrt_eth_device.dev_addr[0], sysClock);
dbg_log(DBG_LOG, "set call back\n"); LOG_D("set call back");
ENET_SetCallback(&imxrt_eth_device.enet_handle, _enet_callback, &imxrt_eth_device); ENET_SetCallback(&imxrt_eth_device.enet_handle, _enet_callback, &imxrt_eth_device);
dbg_log(DBG_LOG, "active read\n"); LOG_D("active read");
ENET_ActiveRead(imxrt_eth_device.enet_base); ENET_ActiveRead(imxrt_eth_device.enet_base);
} }
@ -726,7 +726,7 @@ static void packet_dump(const char *msg, const struct pbuf *p)
/* initialize the interface */ /* initialize the interface */
static rt_err_t rt_imxrt_eth_init(rt_device_t dev) static rt_err_t rt_imxrt_eth_init(rt_device_t dev)
{ {
dbg_log(DBG_LOG, "rt_imxrt_eth_init...\n"); LOG_D("rt_imxrt_eth_init...");
_enet_config(); _enet_config();
return RT_EOK; return RT_EOK;
@ -734,33 +734,33 @@ static rt_err_t rt_imxrt_eth_init(rt_device_t dev)
static rt_err_t rt_imxrt_eth_open(rt_device_t dev, rt_uint16_t oflag) static rt_err_t rt_imxrt_eth_open(rt_device_t dev, rt_uint16_t oflag)
{ {
dbg_log(DBG_LOG, "rt_imxrt_eth_open...\n"); LOG_D("rt_imxrt_eth_open...");
return RT_EOK; return RT_EOK;
} }
static rt_err_t rt_imxrt_eth_close(rt_device_t dev) static rt_err_t rt_imxrt_eth_close(rt_device_t dev)
{ {
dbg_log(DBG_LOG, "rt_imxrt_eth_close...\n"); LOG_D("rt_imxrt_eth_close...");
return RT_EOK; return RT_EOK;
} }
static rt_size_t rt_imxrt_eth_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size) static rt_size_t rt_imxrt_eth_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size)
{ {
dbg_log(DBG_LOG, "rt_imxrt_eth_read...\n"); LOG_D("rt_imxrt_eth_read...");
rt_set_errno(-RT_ENOSYS); rt_set_errno(-RT_ENOSYS);
return 0; return 0;
} }
static rt_size_t rt_imxrt_eth_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size) static rt_size_t rt_imxrt_eth_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size)
{ {
dbg_log(DBG_LOG, "rt_imxrt_eth_write...\n"); LOG_D("rt_imxrt_eth_write...");
rt_set_errno(-RT_ENOSYS); rt_set_errno(-RT_ENOSYS);
return 0; return 0;
} }
static rt_err_t rt_imxrt_eth_control(rt_device_t dev, int cmd, void *args) static rt_err_t rt_imxrt_eth_control(rt_device_t dev, int cmd, void *args)
{ {
dbg_log(DBG_LOG, "rt_imxrt_eth_control...\n"); LOG_D("rt_imxrt_eth_control...");
switch (cmd) switch (cmd)
{ {
case NIOCTL_GADDR: case NIOCTL_GADDR:
@ -969,7 +969,7 @@ rt_err_t rt_imxrt_eth_tx(rt_device_t dev, struct pbuf *p)
RT_ASSERT(p != NULL); RT_ASSERT(p != NULL);
RT_ASSERT(enet_handle != RT_NULL); RT_ASSERT(enet_handle != RT_NULL);
dbg_log(DBG_LOG, "rt_imxrt_eth_tx: %d\n", p->len); LOG_D("rt_imxrt_eth_tx: %d", p->len);
#ifdef ETH_TX_DUMP #ifdef ETH_TX_DUMP
packet_dump("send", p); packet_dump("send", p);
@ -1023,18 +1023,18 @@ struct pbuf *rt_imxrt_eth_rx(rt_device_t dev)
} }
else else
{ {
dbg_log(DBG_LOG, " A frame read failed\n"); LOG_D(" A frame read failed");
pbuf_free(p); pbuf_free(p);
} }
} }
else else
{ {
dbg_log(DBG_LOG, " pbuf_alloc faild\n"); LOG_D(" pbuf_alloc faild");
} }
} }
else if (status == kStatus_ENET_RxFrameError) else if (status == kStatus_ENET_RxFrameError)
{ {
dbg_log(DBG_WARNING, "ENET_GetRxFrameSize: kStatus_ENET_RxFrameError\n"); LOG_W("ENET_GetRxFrameSize: kStatus_ENET_RxFrameError");
/* Update the received buffer when error happened. */ /* Update the received buffer when error happened. */
/* Get the error information of the received g_frame. */ /* Get the error information of the received g_frame. */
ENET_GetRxErrBeforeReadFrame(enet_handle, error_statistic); ENET_GetRxErrBeforeReadFrame(enet_handle, error_statistic);
@ -1072,20 +1072,20 @@ static void phy_monitor_thread_entry(void *parameter)
if (kPHY_Speed10M == speed) if (kPHY_Speed10M == speed)
{ {
dbg_log(DBG_LOG, "10M\n"); LOG_D("10M");
} }
else else
{ {
dbg_log(DBG_LOG, "100M\n"); LOG_D("100M");
} }
if (kPHY_HalfDuplex == duplex) if (kPHY_HalfDuplex == duplex)
{ {
dbg_log(DBG_LOG, "half dumplex\n"); LOG_D("half dumplex");
} }
else else
{ {
dbg_log(DBG_LOG, "full dumplex\n"); LOG_D("full dumplex");
} }
if ((imxrt_eth_device.speed != (enet_mii_speed_t)speed) if ((imxrt_eth_device.speed != (enet_mii_speed_t)speed)
@ -1094,19 +1094,19 @@ static void phy_monitor_thread_entry(void *parameter)
imxrt_eth_device.speed = (enet_mii_speed_t)speed; imxrt_eth_device.speed = (enet_mii_speed_t)speed;
imxrt_eth_device.duplex = (enet_mii_duplex_t)duplex; imxrt_eth_device.duplex = (enet_mii_duplex_t)duplex;
dbg_log(DBG_LOG, "link up, and update eth mode.\n"); LOG_D("link up, and update eth mode.");
rt_imxrt_eth_init((rt_device_t)&imxrt_eth_device); rt_imxrt_eth_init((rt_device_t)&imxrt_eth_device);
} }
else else
{ {
dbg_log(DBG_LOG, "link up, eth not need re-config.\n"); LOG_D("link up, eth not need re-config.");
} }
dbg_log(DBG_LOG, "link up.\n"); LOG_D("link up.");
eth_device_linkchange(&imxrt_eth_device.parent, RT_TRUE); eth_device_linkchange(&imxrt_eth_device.parent, RT_TRUE);
} }
else // link down else // link down
{ {
dbg_log(DBG_LOG, "link down.\n"); LOG_D("link down.");
eth_device_linkchange(&imxrt_eth_device.parent, RT_FALSE); eth_device_linkchange(&imxrt_eth_device.parent, RT_FALSE);
} }
} }
@ -1156,20 +1156,20 @@ static int rt_hw_imxrt_eth_init(void)
imxrt_eth_device.parent.eth_rx = rt_imxrt_eth_rx; imxrt_eth_device.parent.eth_rx = rt_imxrt_eth_rx;
imxrt_eth_device.parent.eth_tx = rt_imxrt_eth_tx; imxrt_eth_device.parent.eth_tx = rt_imxrt_eth_tx;
dbg_log(DBG_LOG, "sem init: tx_wait\r\n"); LOG_D("sem init: tx_wait\r");
/* init tx semaphore */ /* init tx semaphore */
rt_sem_init(&imxrt_eth_device.tx_wait, "tx_wait", 0, RT_IPC_FLAG_FIFO); rt_sem_init(&imxrt_eth_device.tx_wait, "tx_wait", 0, RT_IPC_FLAG_FIFO);
/* register eth device */ /* register eth device */
dbg_log(DBG_LOG, "eth_device_init start\r\n"); LOG_D("eth_device_init start\r");
state = eth_device_init(&(imxrt_eth_device.parent), "e0"); state = eth_device_init(&(imxrt_eth_device.parent), "e0");
if (RT_EOK == state) if (RT_EOK == state)
{ {
dbg_log(DBG_LOG, "eth_device_init success\r\n"); LOG_D("eth_device_init success\r");
} }
else else
{ {
dbg_log(DBG_LOG, "eth_device_init faild: %d\r\n", state); LOG_D("eth_device_init faild: %d\r", state);
} }
eth_device_linkchange(&imxrt_eth_device.parent, RT_FALSE); eth_device_linkchange(&imxrt_eth_device.parent, RT_FALSE);

View File

@ -380,13 +380,13 @@ static void _enet_config(void)
/* Set SMI to get PHY link status. */ /* Set SMI to get PHY link status. */
sysClock = CLOCK_GetFreq(kCLOCK_AhbClk); sysClock = CLOCK_GetFreq(kCLOCK_AhbClk);
dbg_log(DBG_LOG, "deinit\n"); LOG_D("deinit");
ENET_Deinit(imxrt_eth_device.enet_base); ENET_Deinit(imxrt_eth_device.enet_base);
dbg_log(DBG_LOG, "init\n"); LOG_D("init");
ENET_Init(imxrt_eth_device.enet_base, &imxrt_eth_device.enet_handle, &config, &buffConfig, &imxrt_eth_device.dev_addr[0], sysClock); ENET_Init(imxrt_eth_device.enet_base, &imxrt_eth_device.enet_handle, &config, &buffConfig, &imxrt_eth_device.dev_addr[0], sysClock);
dbg_log(DBG_LOG, "set call back\n"); LOG_D("set call back");
ENET_SetCallback(&imxrt_eth_device.enet_handle, _enet_callback, &imxrt_eth_device); ENET_SetCallback(&imxrt_eth_device.enet_handle, _enet_callback, &imxrt_eth_device);
dbg_log(DBG_LOG, "active read\n"); LOG_D("active read");
ENET_ActiveRead(imxrt_eth_device.enet_base); ENET_ActiveRead(imxrt_eth_device.enet_base);
} }
@ -430,7 +430,7 @@ static void packet_dump(const char *msg, const struct pbuf *p)
/* initialize the interface */ /* initialize the interface */
static rt_err_t rt_imxrt_eth_init(rt_device_t dev) static rt_err_t rt_imxrt_eth_init(rt_device_t dev)
{ {
dbg_log(DBG_LOG, "rt_imxrt_eth_init...\n"); LOG_D("rt_imxrt_eth_init...");
_enet_config(); _enet_config();
return RT_EOK; return RT_EOK;
@ -438,33 +438,33 @@ static rt_err_t rt_imxrt_eth_init(rt_device_t dev)
static rt_err_t rt_imxrt_eth_open(rt_device_t dev, rt_uint16_t oflag) static rt_err_t rt_imxrt_eth_open(rt_device_t dev, rt_uint16_t oflag)
{ {
dbg_log(DBG_LOG, "rt_imxrt_eth_open...\n"); LOG_D("rt_imxrt_eth_open...");
return RT_EOK; return RT_EOK;
} }
static rt_err_t rt_imxrt_eth_close(rt_device_t dev) static rt_err_t rt_imxrt_eth_close(rt_device_t dev)
{ {
dbg_log(DBG_LOG, "rt_imxrt_eth_close...\n"); LOG_D("rt_imxrt_eth_close...");
return RT_EOK; return RT_EOK;
} }
static rt_size_t rt_imxrt_eth_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size) static rt_size_t rt_imxrt_eth_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size)
{ {
dbg_log(DBG_LOG, "rt_imxrt_eth_read...\n"); LOG_D("rt_imxrt_eth_read...");
rt_set_errno(-RT_ENOSYS); rt_set_errno(-RT_ENOSYS);
return 0; return 0;
} }
static rt_size_t rt_imxrt_eth_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size) static rt_size_t rt_imxrt_eth_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size)
{ {
dbg_log(DBG_LOG, "rt_imxrt_eth_write...\n"); LOG_D("rt_imxrt_eth_write...");
rt_set_errno(-RT_ENOSYS); rt_set_errno(-RT_ENOSYS);
return 0; return 0;
} }
static rt_err_t rt_imxrt_eth_control(rt_device_t dev, int cmd, void *args) static rt_err_t rt_imxrt_eth_control(rt_device_t dev, int cmd, void *args)
{ {
dbg_log(DBG_LOG, "rt_imxrt_eth_control...\n"); LOG_D("rt_imxrt_eth_control...");
switch (cmd) switch (cmd)
{ {
case NIOCTL_GADDR: case NIOCTL_GADDR:
@ -672,7 +672,7 @@ rt_err_t rt_imxrt_eth_tx(rt_device_t dev, struct pbuf *p)
RT_ASSERT(p != NULL); RT_ASSERT(p != NULL);
RT_ASSERT(enet_handle != RT_NULL); RT_ASSERT(enet_handle != RT_NULL);
dbg_log(DBG_LOG, "rt_imxrt_eth_tx: %d\n", p->len); LOG_D("rt_imxrt_eth_tx: %d", p->len);
#ifdef ETH_TX_DUMP #ifdef ETH_TX_DUMP
packet_dump("send", p); packet_dump("send", p);
@ -726,18 +726,18 @@ struct pbuf *rt_imxrt_eth_rx(rt_device_t dev)
} }
else else
{ {
dbg_log(DBG_LOG, " A frame read failed\n"); LOG_D(" A frame read failed");
pbuf_free(p); pbuf_free(p);
} }
} }
else else
{ {
dbg_log(DBG_LOG, " pbuf_alloc faild\n"); LOG_D(" pbuf_alloc faild");
} }
} }
else if (status == kStatus_ENET_RxFrameError) else if (status == kStatus_ENET_RxFrameError)
{ {
dbg_log(DBG_WARNING, "ENET_GetRxFrameSize: kStatus_ENET_RxFrameError\n"); LOG_W("ENET_GetRxFrameSize: kStatus_ENET_RxFrameError");
/* Update the received buffer when error happened. */ /* Update the received buffer when error happened. */
/* Get the error information of the received g_frame. */ /* Get the error information of the received g_frame. */
ENET_GetRxErrBeforeReadFrame(enet_handle, error_statistic); ENET_GetRxErrBeforeReadFrame(enet_handle, error_statistic);
@ -775,20 +775,20 @@ static void phy_monitor_thread_entry(void *parameter)
if (kPHY_Speed10M == speed) if (kPHY_Speed10M == speed)
{ {
dbg_log(DBG_LOG, "10M\n"); LOG_D("10M");
} }
else else
{ {
dbg_log(DBG_LOG, "100M\n"); LOG_D("100M");
} }
if (kPHY_HalfDuplex == duplex) if (kPHY_HalfDuplex == duplex)
{ {
dbg_log(DBG_LOG, "half dumplex\n"); LOG_D("half dumplex");
} }
else else
{ {
dbg_log(DBG_LOG, "full dumplex\n"); LOG_D("full dumplex");
} }
if ((imxrt_eth_device.speed != (enet_mii_speed_t)speed) if ((imxrt_eth_device.speed != (enet_mii_speed_t)speed)
@ -797,19 +797,19 @@ static void phy_monitor_thread_entry(void *parameter)
imxrt_eth_device.speed = (enet_mii_speed_t)speed; imxrt_eth_device.speed = (enet_mii_speed_t)speed;
imxrt_eth_device.duplex = (enet_mii_duplex_t)duplex; imxrt_eth_device.duplex = (enet_mii_duplex_t)duplex;
dbg_log(DBG_LOG, "link up, and update eth mode.\n"); LOG_D("link up, and update eth mode.");
rt_imxrt_eth_init((rt_device_t)&imxrt_eth_device); rt_imxrt_eth_init((rt_device_t)&imxrt_eth_device);
} }
else else
{ {
dbg_log(DBG_LOG, "link up, eth not need re-config.\n"); LOG_D("link up, eth not need re-config.");
} }
dbg_log(DBG_LOG, "link up.\n"); LOG_D("link up.");
eth_device_linkchange(&imxrt_eth_device.parent, RT_TRUE); eth_device_linkchange(&imxrt_eth_device.parent, RT_TRUE);
} }
else // link down else // link down
{ {
dbg_log(DBG_LOG, "link down.\n"); LOG_D("link down.");
eth_device_linkchange(&imxrt_eth_device.parent, RT_FALSE); eth_device_linkchange(&imxrt_eth_device.parent, RT_FALSE);
} }
} }
@ -850,20 +850,20 @@ static int rt_hw_imxrt_eth_init(void)
imxrt_eth_device.parent.eth_rx = rt_imxrt_eth_rx; imxrt_eth_device.parent.eth_rx = rt_imxrt_eth_rx;
imxrt_eth_device.parent.eth_tx = rt_imxrt_eth_tx; imxrt_eth_device.parent.eth_tx = rt_imxrt_eth_tx;
dbg_log(DBG_LOG, "sem init: tx_wait\r\n"); LOG_D("sem init: tx_wait\r");
/* init tx semaphore */ /* init tx semaphore */
rt_sem_init(&imxrt_eth_device.tx_wait, "tx_wait", 0, RT_IPC_FLAG_FIFO); rt_sem_init(&imxrt_eth_device.tx_wait, "tx_wait", 0, RT_IPC_FLAG_FIFO);
/* register eth device */ /* register eth device */
dbg_log(DBG_LOG, "eth_device_init start\r\n"); LOG_D("eth_device_init start\r");
state = eth_device_init(&(imxrt_eth_device.parent), "e0"); state = eth_device_init(&(imxrt_eth_device.parent), "e0");
if (RT_EOK == state) if (RT_EOK == state)
{ {
dbg_log(DBG_LOG, "eth_device_init success\r\n"); LOG_D("eth_device_init success\r");
} }
else else
{ {
dbg_log(DBG_LOG, "eth_device_init faild: %d\r\n", state); LOG_D("eth_device_init faild: %d\r", state);
} }
eth_device_linkchange(&imxrt_eth_device.parent, RT_FALSE); eth_device_linkchange(&imxrt_eth_device.parent, RT_FALSE);

View File

@ -103,7 +103,7 @@ void aaci_ac97_write(rt_uint16_t reg, rt_uint16_t val)
if (v & (AACI_SLFR_1TXB | AACI_SLFR_2TXB)) if (v & (AACI_SLFR_1TXB | AACI_SLFR_2TXB))
{ {
dbg_log(DBG_ERROR, "timeout waiting for write to complete\n"); LOG_E("timeout waiting for write to complete");
} }
} }
@ -126,7 +126,7 @@ rt_uint16_t aaci_ac97_read(rt_uint16_t reg)
if (v & AACI_SLFR_1TXB) if (v & AACI_SLFR_1TXB)
{ {
dbg_log(DBG_ERROR, "timeout on slot 1 TX busy\n"); LOG_E("timeout on slot 1 TX busy");
v = ~0x0; v = ~0x0;
return v; return v;
} }
@ -142,7 +142,7 @@ rt_uint16_t aaci_ac97_read(rt_uint16_t reg)
if (v != (AACI_SLFR_1RXV | AACI_SLFR_2RXV)) if (v != (AACI_SLFR_1RXV | AACI_SLFR_2RXV))
{ {
dbg_log(DBG_ERROR, "timeout on RX valid\n"); LOG_E("timeout on RX valid");
v = ~0x0; v = ~0x0;
return v; return v;
} }
@ -157,12 +157,12 @@ rt_uint16_t aaci_ac97_read(rt_uint16_t reg)
} }
else if (--retries) else if (--retries)
{ {
dbg_log(DBG_ERROR, "ac97 read back fail. retry\n"); LOG_E("ac97 read back fail. retry");
continue; continue;
} }
else else
{ {
dbg_log(DBG_ERROR, "wrong ac97 register read back (%x != %x)\n", v, reg); LOG_E("wrong ac97 register read back (%x != %x)", v, reg);
v = ~0x0; v = ~0x0;
} }
} }
@ -277,7 +277,7 @@ rt_err_t aaci_pl041_irq_register(int channle, pl041_irq_fun_t fun, void *user_da
{ {
if (channle < 0 || channle >= PL041_CHANNLE_NUM) if (channle < 0 || channle >= PL041_CHANNLE_NUM)
{ {
dbg_log(DBG_ERROR, "%s channle:%d err.\n", __FUNCTION__, channle); LOG_E("%s channle:%d err.", __FUNCTION__, channle);
return -RT_ERROR; return -RT_ERROR;
} }
irq_tbl[channle].fun = fun; irq_tbl[channle].fun = fun;
@ -289,7 +289,7 @@ rt_err_t aaci_pl041_irq_unregister(int channle)
{ {
if (channle < 0 || channle >= PL041_CHANNLE_NUM) if (channle < 0 || channle >= PL041_CHANNLE_NUM)
{ {
dbg_log(DBG_ERROR, "%s channle:%d err.\n", __FUNCTION__, channle); LOG_E("%s channle:%d err.", __FUNCTION__, channle);
return -RT_ERROR; return -RT_ERROR;
} }
irq_tbl[channle].fun = RT_NULL; irq_tbl[channle].fun = RT_NULL;
@ -312,17 +312,17 @@ static void aaci_pl041_irq_handle(int irqno, void *param)
m = mask & 0x7f; m = mask & 0x7f;
if (m & AACI_ISR_ORINTR) if (m & AACI_ISR_ORINTR)
{ {
dbg_log(DBG_WARNING, "RX overrun on chan %d\n", channle); LOG_W("RX overrun on chan %d", channle);
} }
if (m & AACI_ISR_RXTOINTR) if (m & AACI_ISR_RXTOINTR)
{ {
dbg_log(DBG_WARNING, "RX timeout on chan %d\n", channle); LOG_W("RX timeout on chan %d", channle);
} }
if (mask & AACI_ISR_URINTR) if (mask & AACI_ISR_URINTR)
{ {
dbg_log(DBG_WARNING, "TX underrun on chan %d\n", channle); LOG_W("TX underrun on chan %d", channle);
} }
p_status = (void *)((rt_uint32_t)(&PL041->sr1) + channle * 0x14); p_status = (void *)((rt_uint32_t)(&PL041->sr1) + channle * 0x14);

View File

@ -196,47 +196,47 @@ static void keyboard_report_event(void * device, rt_uint32_t flag, rt_uint8_t da
{ {
if (map[i].data == data) if (map[i].data == data)
{ {
dbg_log(DBG_LOG,"KEY info:\n"); LOG_D("KEY info:");
if (flag & KBD_CAPS_LOCK) if (flag & KBD_CAPS_LOCK)
{ {
dbg_log(DBG_LOG,"CAPS:LOCK\n"); LOG_D("CAPS:LOCK");
} }
else else
{ {
dbg_log(DBG_LOG,"CAPS:UNLOCK\n"); LOG_D("CAPS:UNLOCK");
} }
if (flag & KBD_LEFT_SHIFT) if (flag & KBD_LEFT_SHIFT)
{ {
mod |= RTGUI_KMOD_LSHIFT; mod |= RTGUI_KMOD_LSHIFT;
dbg_log(DBG_LOG,"SHIFT:LEFT\n"); LOG_D("SHIFT:LEFT");
} }
else if (flag & KBD_RIGHT_SHIFT) else if (flag & KBD_RIGHT_SHIFT)
{ {
mod |= RTGUI_KMOD_RSHIFT; mod |= RTGUI_KMOD_RSHIFT;
dbg_log(DBG_LOG,"SHIFT:RIGHT\n"); LOG_D("SHIFT:RIGHT");
} }
else else
{ {
dbg_log(DBG_LOG,"SHIFT:NULL\n"); LOG_D("SHIFT:NULL");
} }
if (flag & KBD_LEFT_CTRL) if (flag & KBD_LEFT_CTRL)
{ {
mod |= RTGUI_KMOD_LCTRL; mod |= RTGUI_KMOD_LCTRL;
dbg_log(DBG_LOG,"CTRL:LEFT\n"); LOG_D("CTRL:LEFT");
} }
else if (flag & KBD_RIGHT_CTRL) else if (flag & KBD_RIGHT_CTRL)
{ {
mod |= RTGUI_KMOD_RCTRL; mod |= RTGUI_KMOD_RCTRL;
dbg_log(DBG_LOG,"CTRL:RIGHT\n"); LOG_D("CTRL:RIGHT");
} }
else else
{ {
dbg_log(DBG_LOG,"CTRL:NULL\n"); LOG_D("CTRL:NULL");
} }
dbg_log(DBG_LOG,"flag:0x%08x value:0x%x key:%s status:%s\n", \ LOG_D("flag:0x%08x value:0x%x key:%s status:%s", \
flag, data, map[i].normal_key, press ==0 ? "UP" : "DOWN"); flag, data, map[i].normal_key, press ==0 ? "UP" : "DOWN");
find_key = 1; find_key = 1;
break; break;
@ -244,7 +244,7 @@ static void keyboard_report_event(void * device, rt_uint32_t flag, rt_uint8_t da
} }
if (find_key == 0) if (find_key == 0)
{ {
dbg_log(DBG_LOG,"flag:0x%08x value:0x%x key:%s status:%s\n", \ LOG_D("flag:0x%08x value:0x%x key:%s status:%s", \
flag, data, "UNKNOWN", press ==0 ? "UP" : "DOWN"); flag, data, "UNKNOWN", press ==0 ? "UP" : "DOWN");
return; return;
} }
@ -435,14 +435,14 @@ int rt_hw_keyboard_init(void)
if(((id >> 12) & 0xff) != 0x41 || (id & 0xfff) != 0x050) if(((id >> 12) & 0xff) != 0x41 || (id & 0xfff) != 0x050)
{ {
dbg_log(DBG_ERROR, "read id fail id:0x%08x\n", id); LOG_E("read id fail id:0x%08x", id);
return RT_ERROR; return RT_ERROR;
} }
pdat = rt_malloc(sizeof(struct keyboard_pl050_pdata_t)); pdat = rt_malloc(sizeof(struct keyboard_pl050_pdata_t));
if(!pdat) if(!pdat)
{ {
dbg_log(DBG_ERROR, "malloc memory\n", id); LOG_E("malloc memory", id);
return RT_ERROR; return RT_ERROR;
} }
rt_memset(pdat, 0, sizeof(struct keyboard_pl050_pdata_t)); rt_memset(pdat, 0, sizeof(struct keyboard_pl050_pdata_t));

View File

@ -115,7 +115,7 @@ void push_event_touch_move(int x, int y)
emouse.ts = rt_tick_get(); emouse.ts = rt_tick_get();
emouse.id = emouse_id; emouse.id = emouse_id;
dbg_log(DBG_LOG, "[line]:%d motion event id:%d x:%d y:%d\n", __LINE__, emouse.id, x, y); LOG_D("[line]:%d motion event id:%d x:%d y:%d", __LINE__, emouse.id, x, y);
rtgui_server_post_event(&emouse.parent, sizeof(emouse)); rtgui_server_post_event(&emouse.parent, sizeof(emouse));
} }
@ -134,7 +134,7 @@ void push_event_touch_begin(int x, int y)
emouse.y = y; emouse.y = y;
emouse.ts = rt_tick_get(); emouse.ts = rt_tick_get();
emouse.id = emouse_id; emouse.id = emouse_id;
dbg_log(DBG_LOG, "[line]:%d down event id:%d x:%d y:%d\n", __LINE__, emouse.id, x, y); LOG_D("[line]:%d down event id:%d x:%d y:%d", __LINE__, emouse.id, x, y);
rtgui_server_post_event(&emouse.parent, sizeof(emouse)); rtgui_server_post_event(&emouse.parent, sizeof(emouse));
} }
@ -152,7 +152,7 @@ void push_event_touch_end(int x, int y)
emouse.ts = rt_tick_get(); emouse.ts = rt_tick_get();
emouse.id = emouse_id; emouse.id = emouse_id;
dbg_log(DBG_LOG, "[line]:%d up event id:%d x:%d y:%d\n", __LINE__, emouse.id, x, y); LOG_D("[line]:%d up event id:%d x:%d y:%d", __LINE__, emouse.id, x, y);
rtgui_server_post_event(&emouse.parent, sizeof(emouse)); rtgui_server_post_event(&emouse.parent, sizeof(emouse));
} }
@ -239,14 +239,14 @@ int rt_hw_mouse_init(void)
if(((id >> 12) & 0xff) != 0x41 || (id & 0xfff) != 0x050) if(((id >> 12) & 0xff) != 0x41 || (id & 0xfff) != 0x050)
{ {
dbg_log(DBG_ERROR, "read id fail id:0x%08x\n", id); LOG_E("read id fail id:0x%08x", id);
return RT_ERROR; return RT_ERROR;
} }
pdat = rt_malloc(sizeof(struct mouse_pl050_pdata_t)); pdat = rt_malloc(sizeof(struct mouse_pl050_pdata_t));
if(!pdat) if(!pdat)
{ {
dbg_log(DBG_ERROR, "malloc memory\n", id); LOG_E("malloc memory", id);
return RT_ERROR; return RT_ERROR;
} }
rt_memset(pdat, 0, sizeof(struct mouse_pl050_pdata_t)); rt_memset(pdat, 0, sizeof(struct mouse_pl050_pdata_t));

View File

@ -121,14 +121,14 @@ static rt_err_t pl180_transfer_command(struct sdhci_pl180_pdata_t * pdat, struct
do { do {
status = read32(pdat->virt + PL180_STATUS); status = read32(pdat->virt + PL180_STATUS);
} while(!(status & (PL180_STAT_CMD_SENT | PL180_STAT_CMD_RESP_END | PL180_STAT_CMD_TIME_OUT | PL180_STAT_CMD_CRC_FAIL))); } while(!(status & (PL180_STAT_CMD_SENT | PL180_STAT_CMD_RESP_END | PL180_STAT_CMD_TIME_OUT | PL180_STAT_CMD_CRC_FAIL)));
dbg_log(DBG_LOG, "mmc status done!\n"); LOG_D("mmc status done!");
if(cmd->resptype & PL180_RSP_PRESENT) if(cmd->resptype & PL180_RSP_PRESENT)
{ {
cmd->response[0] = read32(pdat->virt + PL180_RESP0); cmd->response[0] = read32(pdat->virt + PL180_RESP0);
if(cmd->resptype & PL180_RSP_136BIT) if(cmd->resptype & PL180_RSP_136BIT)
{ {
dbg_log(DBG_LOG, "136bit response\n"); LOG_D("136bit response");
cmd->response[1] = read32(pdat->virt + PL180_RESP1); cmd->response[1] = read32(pdat->virt + PL180_RESP1);
cmd->response[2] = read32(pdat->virt + PL180_RESP2); cmd->response[2] = read32(pdat->virt + PL180_RESP2);
cmd->response[3] = read32(pdat->virt + PL180_RESP3); cmd->response[3] = read32(pdat->virt + PL180_RESP3);
@ -344,17 +344,17 @@ static void mmc_request_send(struct rt_mmcsd_host *host, struct rt_mmcsd_req *re
req->cmd->err = sdhci_pl180_transfer(sdhci, &cmd, RT_NULL); req->cmd->err = sdhci_pl180_transfer(sdhci, &cmd, RT_NULL);
} }
dbg_log(DBG_INFO, "cmdarg:%d\n", cmd.cmdarg); LOG_I("cmdarg:%d", cmd.cmdarg);
dbg_log(DBG_INFO, "cmdidx:%d\n", cmd.cmdidx); LOG_I("cmdidx:%d", cmd.cmdidx);
dbg_log(DBG_INFO, "[0]:0x%08x [1]:0x%08x [2]:0x%08x [3]:0x%08x\n", cmd.response[0], cmd.response[1], cmd.response[2], cmd.response[3]); LOG_I("[0]:0x%08x [1]:0x%08x [2]:0x%08x [3]:0x%08x", cmd.response[0], cmd.response[1], cmd.response[2], cmd.response[3]);
req->cmd->resp[3] = cmd.response[3]; req->cmd->resp[3] = cmd.response[3];
req->cmd->resp[2] = cmd.response[2]; req->cmd->resp[2] = cmd.response[2];
req->cmd->resp[1] = cmd.response[1]; req->cmd->resp[1] = cmd.response[1];
req->cmd->resp[0] = cmd.response[0]; req->cmd->resp[0] = cmd.response[0];
if(req->cmd->err) if(req->cmd->err)
dbg_log(DBG_ERROR, "transfer cmd err \n"); LOG_E("transfer cmd err ");
if (req->stop) if (req->stop)
{ {
@ -381,7 +381,7 @@ static void mmc_set_iocfg(struct rt_mmcsd_host *host, struct rt_mmcsd_io_cfg *io
sdhci_pl180_setclock(sdhci, io_cfg->clock); sdhci_pl180_setclock(sdhci, io_cfg->clock);
sdhci_pl180_setwidth(sdhci, io_cfg->bus_width); sdhci_pl180_setwidth(sdhci, io_cfg->bus_width);
dbg_log(DBG_INFO, "clock:%d bus_width:%d\n", io_cfg->clock, io_cfg->bus_width); LOG_I("clock:%d bus_width:%d", io_cfg->clock, io_cfg->bus_width);
} }
static const struct rt_mmcsd_host_ops ops = static const struct rt_mmcsd_host_ops ops =
@ -403,14 +403,14 @@ int pl180_init(void)
host = mmcsd_alloc_host(); host = mmcsd_alloc_host();
if (!host) if (!host)
{ {
dbg_log(DBG_ERROR, "alloc host failed\n"); LOG_E("alloc host failed");
goto err; goto err;
} }
sdhci = rt_malloc(sizeof(struct sdhci_t)); sdhci = rt_malloc(sizeof(struct sdhci_t));
if (!sdhci) if (!sdhci)
{ {
dbg_log(DBG_ERROR, "alloc sdhci failed\n"); LOG_E("alloc sdhci failed");
goto err; goto err;
} }
rt_memset(sdhci, 0, sizeof(struct sdhci_t)); rt_memset(sdhci, 0, sizeof(struct sdhci_t));
@ -421,10 +421,10 @@ int pl180_init(void)
((read32((virt + 0xfe4)) & 0xff) << 8) | ((read32((virt + 0xfe4)) & 0xff) << 8) |
((read32((virt + 0xfe0)) & 0xff) << 0)); ((read32((virt + 0xfe0)) & 0xff) << 0));
dbg_log(DBG_LOG, "id=0x%08x\n", id); LOG_D("id=0x%08x", id);
if(((id >> 12) & 0xff) != 0x41 || (id & 0xfff) != 0x181) if(((id >> 12) & 0xff) != 0x41 || (id & 0xfff) != 0x181)
{ {
dbg_log(DBG_ERROR, "check id failed\n"); LOG_E("check id failed");
goto err; goto err;
} }

View File

@ -107,7 +107,7 @@ static inline int check_error_status(struct jzmmc_host *host, unsigned int statu
{ {
if (status & ERROR_STAT) if (status & ERROR_STAT)
{ {
dbg_log(DBG_LOG, "Error status->0x%08X: cmd=%d\n", status, host->cmd->cmd_code); LOG_D("Error status->0x%08X: cmd=%d", status, host->cmd->cmd_code);
return -1; return -1;
} }
return 0; return 0;
@ -160,16 +160,16 @@ static int jzmmc_polling_status(struct jzmmc_host *host, unsigned int status)
if (!cnt) if (!cnt)
{ {
dbg_log(DBG_LOG, "polling status(0x%08X) time out, " LOG_D("polling status(0x%08X) time out, "
"op=%d, status=0x%08X\n", status, "op=%d, status=0x%08X", status,
host->cmd->cmd_code, msc_readl(host, MSC_STAT_OFFSET)); host->cmd->cmd_code, msc_readl(host, MSC_STAT_OFFSET));
return -1; return -1;
} }
if (msc_readl(host, MSC_STAT_OFFSET) & ERROR_STAT) if (msc_readl(host, MSC_STAT_OFFSET) & ERROR_STAT)
{ {
dbg_log(DBG_LOG, "polling status(0x%08X) error, " LOG_D("polling status(0x%08X) error, "
"op=%d, status=0x%08X\n", status, "op=%d, status=0x%08X", status,
host->cmd->cmd_code, msc_readl(host, MSC_STAT_OFFSET)); host->cmd->cmd_code, msc_readl(host, MSC_STAT_OFFSET));
return -1; return -1;
} }
@ -220,7 +220,7 @@ static void jzmmc_command_done(struct jzmmc_host *host, struct rt_mmcsd_cmd *cmd
cmd->resp[0] |= res & 0xff; cmd->resp[0] |= res & 0xff;
} }
dbg_log(DBG_LOG, "error:%d cmd->resp [%08X, %08X, %08X, %08X]\r\n\r\n", LOG_D("error:%d cmd->resp [%08X, %08X, %08X, %08X]\r\n\r",
cmd->err, cmd->err,
cmd->resp[0], cmd->resp[0],
cmd->resp[1], cmd->resp[1],
@ -244,7 +244,7 @@ static void jzmmc_data_done(struct jzmmc_host *host)
{ {
jzmmc_stop_dma(host); jzmmc_stop_dma(host);
data->bytes_xfered = 0; data->bytes_xfered = 0;
dbg_log(DBG_LOG, "error when request done\n"); LOG_D("error when request done");
} }
} }
@ -288,11 +288,11 @@ rt_inline void jzmmc_submit_dma(struct jzmmc_host *host, struct rt_mmcsd_data *d
host->dma_desc.da = virt_to_phys(host->_dma_buffer); host->dma_desc.da = virt_to_phys(host->_dma_buffer);
if (data->flags & DATA_DIR_WRITE) if (data->flags & DATA_DIR_WRITE)
{ {
dbg_log(DBG_LOG, "%d ->", data->blks * data->blksize); LOG_D("%d ->", data->blks * data->blksize);
memcpy(host->_dma_buffer, data->buf, data->blks * data->blksize); memcpy(host->_dma_buffer, data->buf, data->blks * data->blksize);
rt_hw_dcache_flush_range((rt_ubase_t)(host->_dma_buffer), data->blks * data->blksize); rt_hw_dcache_flush_range((rt_ubase_t)(host->_dma_buffer), data->blks * data->blksize);
dbg_log(DBG_LOG, "| 0x%08x\n", data->buf); LOG_D("| 0x%08x", data->buf);
} }
} }
else else
@ -322,7 +322,7 @@ rt_inline void jzmmc_dma_start(struct jzmmc_host *host, struct rt_mmcsd_data *da
#ifndef DMA_BUFFER #ifndef DMA_BUFFER
if ((dma_addr & (DMA_ALIGN - 1)) || (dma_len & (DMA_ALIGN - 1))) if ((dma_addr & (DMA_ALIGN - 1)) || (dma_len & (DMA_ALIGN - 1)))
{ {
dbg_log(DBG_LOG, "DMA align, addr=0x%08x\n", dma_addr); LOG_D("DMA align, addr=0x%08x", dma_addr);
dmac |= DMAC_ALIGNEN; dmac |= DMAC_ALIGNEN;
if (dma_addr & (DMA_ALIGN - 1)) if (dma_addr & (DMA_ALIGN - 1))
{ {
@ -330,7 +330,7 @@ rt_inline void jzmmc_dma_start(struct jzmmc_host *host, struct rt_mmcsd_data *da
} }
} }
#endif #endif
dbg_log(DBG_LOG, "DMA start: nda 0x%08x, da 0x%08x, len 0x%04x, cmd 0x%08x\n", virt_to_phys(&(host->dma_desc)), LOG_D("DMA start: nda 0x%08x, da 0x%08x, len 0x%04x, cmd 0x%08x", virt_to_phys(&(host->dma_desc)),
host->dma_desc.da, host->dma_desc.len, host->dma_desc.dcmd); host->dma_desc.da, host->dma_desc.len, host->dma_desc.dcmd);
rt_hw_dcache_flush_range((rt_ubase_t)(&(host->dma_desc)), 32); rt_hw_dcache_flush_range((rt_ubase_t)(&(host->dma_desc)), 32);
@ -366,19 +366,19 @@ static int wait_cmd_response(struct jzmmc_host *host)
if(ret == RT_EOK) if(ret == RT_EOK)
{ {
dbg_log(DBG_LOG, "wait response OK!\r\n"); LOG_D("wait response OK!\r");
} }
else else
{ {
uint32_t value; uint32_t value;
value = msc_readl(host, MSC_STAT_OFFSET); value = msc_readl(host, MSC_STAT_OFFSET);
dbg_log(DBG_LOG, "stat=0x%08x\n", value); LOG_D("stat=0x%08x", value);
value = msc_readl(host, MSC_IREG_OFFSET); value = msc_readl(host, MSC_IREG_OFFSET);
dbg_log(DBG_LOG, "iflag=0x%08x\n", value); LOG_D("iflag=0x%08x", value);
host->cmd->err = ret; host->cmd->err = ret;
dbg_log(DBG_LOG, "wait END_CMD_RES timeout[uncompletion]\r\n"); LOG_D("wait END_CMD_RES timeout[uncompletion]\r");
return -1; return -1;
} }
@ -570,7 +570,7 @@ static void jzmmc_data_start(struct jzmmc_host *host, struct rt_mmcsd_data *data
} }
else else
{ {
dbg_log(DBG_LOG, "msc status: 0x%08x\n", msc_readl(host, MSC_STAT_OFFSET)); LOG_D("msc status: 0x%08x", msc_readl(host, MSC_STAT_OFFSET));
clear_msc_irq(host, IFLG_DATA_TRAN_DONE | IFLG_DMAEND | IFLG_DMA_DATA_DONE | IFLG_TIMEOUT_RES); clear_msc_irq(host, IFLG_DATA_TRAN_DONE | IFLG_DMAEND | IFLG_DMA_DATA_DONE | IFLG_TIMEOUT_RES);
disable_msc_irq(host, IMASK_DMA_DATA_DONE | IMASK_CRC_READ_ERR); disable_msc_irq(host, IMASK_DMA_DATA_DONE | IMASK_CRC_READ_ERR);
@ -582,7 +582,7 @@ static void jzmmc_data_start(struct jzmmc_host *host, struct rt_mmcsd_data *data
{ {
rt_hw_dcache_invalidate_range((rt_ubase_t)(host->_dma_buffer), data->blks * data->blksize); rt_hw_dcache_invalidate_range((rt_ubase_t)(host->_dma_buffer), data->blks * data->blksize);
memcpy(data->buf, host->_dma_buffer, data->blks * data->blksize); memcpy(data->buf, host->_dma_buffer, data->blks * data->blksize);
dbg_log(DBG_LOG, "0x%08x <-| %d\n", data->buf, data->blks * data->blksize); LOG_D("0x%08x <-| %d", data->buf, data->blks * data->blksize);
} }
else else
{ {
@ -630,8 +630,8 @@ static void jzmmc_command_start(struct jzmmc_host *host, struct rt_mmcsd_cmd *cm
enable_msc_irq(host, imsk); enable_msc_irq(host, imsk);
} }
dbg_log(DBG_LOG, "dat: 0x%08x\n", host->cmdat); LOG_D("dat: 0x%08x", host->cmdat);
dbg_log(DBG_LOG, "resp type: %d\n", cmd->flags & RESP_MASK); LOG_D("resp type: %d", cmd->flags & RESP_MASK);
writel(0xFF, host->hw_base + MSC_RESTO_OFFSET); writel(0xFF, host->hw_base + MSC_RESTO_OFFSET);
writel(0xFFFFFFFF, host->hw_base + MSC_RDTO_OFFSET); writel(0xFFFFFFFF, host->hw_base + MSC_RDTO_OFFSET);
@ -661,7 +661,7 @@ static void jzmmc_sdio_request(struct rt_mmcsd_host *mmc, struct rt_mmcsd_req *r
host->cmd = req->cmd; host->cmd = req->cmd;
host->cmdat = 0; host->cmdat = 0;
dbg_log(DBG_LOG, "CMD: %d ARG: %08X\n", req->cmd->cmd_code, req->cmd->arg); LOG_D("CMD: %d ARG: %08X", req->cmd->cmd_code, req->cmd->arg);
if (host->data) if (host->data)
{ {
direction = (host->data->flags & DATA_DIR_WRITE)? 'w' : 'r'; direction = (host->data->flags & DATA_DIR_WRITE)? 'w' : 'r';
@ -688,10 +688,10 @@ static void jzmmc_sdio_request(struct rt_mmcsd_host *mmc, struct rt_mmcsd_req *r
if(host->data) if(host->data)
{ {
dbg_log(DBG_LOG, "with data, datalen = %d\n", host->data->blksize * host->data->blks); LOG_D("with data, datalen = %d", host->data->blksize * host->data->blks);
if (host->data->blksize * host->data->blks < PIO_THRESHOLD) if (host->data->blksize * host->data->blks < PIO_THRESHOLD)
{ {
dbg_log(DBG_LOG, " pio mode!\n"); LOG_D(" pio mode!");
enable_pio_mode(host); enable_pio_mode(host);
} }
@ -726,36 +726,36 @@ static void jzmmc_isr(int irqno, void* param)
if(pending_ & IFLG_CRC_RES_ERR) if(pending_ & IFLG_CRC_RES_ERR)
{ {
dbg_log(DBG_WARNING, "RES CRC err\n"); LOG_W("RES CRC err");
} }
if(pending_ & IFLG_CRC_READ_ERR) if(pending_ & IFLG_CRC_READ_ERR)
{ {
dbg_log(DBG_WARNING, "READ CRC err\n"); LOG_W("READ CRC err");
} }
if(pending_ & IFLG_CRC_WRITE_ERR) if(pending_ & IFLG_CRC_WRITE_ERR)
{ {
dbg_log(DBG_WARNING, "WRITE CRC err\n"); LOG_W("WRITE CRC err");
} }
if (pending & IFLG_TIMEOUT_RES) if (pending & IFLG_TIMEOUT_RES)
{ {
host->cmd->err = -RT_ETIMEOUT; host->cmd->err = -RT_ETIMEOUT;
dbg_log(DBG_LOG, "TIMEOUT\n"); LOG_D("TIMEOUT");
} }
else if (pending & IFLG_CRC_READ_ERR) else if (pending & IFLG_CRC_READ_ERR)
{ {
host->cmd->err = -RT_EIO; host->cmd->err = -RT_EIO;
dbg_log(DBG_WARNING, "CRC READ\n"); LOG_W("CRC READ");
} }
else if (pending & (IFLG_CRC_RES_ERR | IFLG_CRC_WRITE_ERR | IFLG_TIMEOUT_READ)) else if (pending & (IFLG_CRC_RES_ERR | IFLG_CRC_WRITE_ERR | IFLG_TIMEOUT_READ))
{ {
dbg_log(DBG_ERROR, "MSC ERROR, pending=0x%08x\n", pending); LOG_E("MSC ERROR, pending=0x%08x", pending);
} }
if (pending & (IFLG_DMA_DATA_DONE | IFLG_WR_ALL_DONE)) if (pending & (IFLG_DMA_DATA_DONE | IFLG_WR_ALL_DONE))
{ {
dbg_log(DBG_LOG, "msc DMA end!\n"); LOG_D("msc DMA end!");
/* disable interrupt */ /* disable interrupt */
rt_hw_interrupt_mask(host->irqno); rt_hw_interrupt_mask(host->irqno);
@ -823,17 +823,17 @@ static void jzmmc_sdio_set_iocfg(struct rt_mmcsd_host *host,
struct jzmmc_host * jz_sdio = host->private_data; struct jzmmc_host * jz_sdio = host->private_data;
rt_uint32_t clkdiv; rt_uint32_t clkdiv;
dbg_log(DBG_LOG, "set_iocfg clock: %d\n", io_cfg->clock); LOG_D("set_iocfg clock: %d", io_cfg->clock);
if (io_cfg->bus_width == MMCSD_BUS_WIDTH_4) if (io_cfg->bus_width == MMCSD_BUS_WIDTH_4)
{ {
dbg_log(DBG_LOG, "MMC: Setting controller bus width to 4\n"); LOG_D("MMC: Setting controller bus width to 4");
jz_sdio->flags |= MSC_CMDAT_BUS_WIDTH_4BIT; jz_sdio->flags |= MSC_CMDAT_BUS_WIDTH_4BIT;
} }
else else
{ {
jz_sdio->flags &= ~(MSC_CMDAT_BUS_WIDTH_4BIT); jz_sdio->flags &= ~(MSC_CMDAT_BUS_WIDTH_4BIT);
dbg_log(DBG_LOG, "MMC: Setting controller bus width to 1\n"); LOG_D("MMC: Setting controller bus width to 1");
} }
if (io_cfg->clock) if (io_cfg->clock)
@ -866,16 +866,16 @@ static void jzmmc_sdio_set_iocfg(struct rt_mmcsd_host *host,
if (clkrt > 7) if (clkrt > 7)
{ {
dbg_log(DBG_ERROR, "invalid value of CLKRT: " LOG_E("invalid value of CLKRT: "
"ios->clock=%d clk_want=%d " "ios->clock=%d clk_want=%d "
"clk_set=%d clkrt=%X,\n", "clk_set=%d clkrt=%X,",
io_cfg->clock, clk_want, clk_set, clkrt); io_cfg->clock, clk_want, clk_set, clkrt);
return; return;
} }
if (!clkrt) if (!clkrt)
{ {
dbg_log(DBG_LOG, "clk_want: %u, clk_set: %luHz\n", io_cfg->clock, clk_get_rate(jz_sdio->clock)); LOG_D("clk_want: %u, clk_set: %luHz", io_cfg->clock, clk_get_rate(jz_sdio->clock));
} }
writel(clkrt, jz_sdio->hw_base + MSC_CLKRT_OFFSET); writel(clkrt, jz_sdio->hw_base + MSC_CLKRT_OFFSET);
@ -905,25 +905,25 @@ static void jzmmc_sdio_set_iocfg(struct rt_mmcsd_host *host,
switch (io_cfg->power_mode) switch (io_cfg->power_mode)
{ {
case MMCSD_POWER_OFF: case MMCSD_POWER_OFF:
dbg_log(DBG_LOG, "MMCSD_POWER_OFF\r\n"); LOG_D("MMCSD_POWER_OFF\r");
break; break;
case MMCSD_POWER_UP: case MMCSD_POWER_UP:
dbg_log(DBG_LOG, "MMCSD_POWER_UP\r\n"); LOG_D("MMCSD_POWER_UP\r");
break; break;
case MMCSD_POWER_ON: case MMCSD_POWER_ON:
dbg_log(DBG_LOG, "MMCSD_POWER_ON\r\n"); LOG_D("MMCSD_POWER_ON\r");
jzmmc_hardware_init(jz_sdio); jzmmc_hardware_init(jz_sdio);
// jz_mmc_set_clock(jz_sdio, io_cfg->clock); // jz_mmc_set_clock(jz_sdio, io_cfg->clock);
break; break;
default: default:
dbg_log(DBG_LOG, "unknown power_mode %d\n", io_cfg->power_mode); LOG_D("unknown power_mode %d", io_cfg->power_mode);
break; break;
} }
} }
static rt_int32_t jzmmc_sdio_detect(struct rt_mmcsd_host *host) static rt_int32_t jzmmc_sdio_detect(struct rt_mmcsd_host *host)
{ {
dbg_log(DBG_LOG, "jz47xx_SD_Detect\n"); LOG_D("jz47xx_SD_Detect");
return 0; return 0;
} }
@ -931,7 +931,7 @@ static rt_int32_t jzmmc_sdio_detect(struct rt_mmcsd_host *host)
static void jzmmc_sdio_enable_sdio_irq(struct rt_mmcsd_host *host, static void jzmmc_sdio_enable_sdio_irq(struct rt_mmcsd_host *host,
rt_int32_t enable) rt_int32_t enable)
{ {
dbg_log(DBG_LOG, "jz47xx_sdio_enable_sdio_irq, enable:%d\n", enable); LOG_D("jz47xx_sdio_enable_sdio_irq, enable:%d", enable);
} }
static const struct rt_mmcsd_host_ops ops = static const struct rt_mmcsd_host_ops ops =

View File

@ -185,7 +185,7 @@ int fd_new(void)
if (idx == fdt->maxfd) if (idx == fdt->maxfd)
{ {
idx = -(1 + DFS_FD_OFFSET); idx = -(1 + DFS_FD_OFFSET);
dbg_log(DBG_ERROR, "DFS fd new is failed! Could not found an empty fd entry."); LOG_E( "DFS fd new is failed! Could not found an empty fd entry.");
goto __result; goto __result;
} }

View File

@ -46,7 +46,7 @@ int dfs_file_open(struct dfs_fd *fd, const char *path, int flags)
return -ENOMEM; return -ENOMEM;
} }
dbg_log(DBG_LOG, "open file:%s\n", fullpath); LOG_D("open file:%s", fullpath);
/* Check whether file is already open */ /* Check whether file is already open */
if (fd_is_open(fullpath) == 0) if (fd_is_open(fullpath) == 0)
@ -65,7 +65,7 @@ int dfs_file_open(struct dfs_fd *fd, const char *path, int flags)
return -ENOENT; return -ENOENT;
} }
dbg_log(DBG_LOG, "open in filesystem:%s\n", fs->ops->name); LOG_D("open in filesystem:%s", fs->ops->name);
fd->fops = fs->ops->fops; /* set file ops */ fd->fops = fs->ops->fops; /* set file ops */
/* initialize the fd item */ /* initialize the fd item */
@ -82,7 +82,7 @@ int dfs_file_open(struct dfs_fd *fd, const char *path, int flags)
else else
fd->path = rt_strdup(dfs_subdir(fs->path, fullpath)); fd->path = rt_strdup(dfs_subdir(fs->path, fullpath));
rt_free(fullpath); rt_free(fullpath);
dbg_log(DBG_LOG, "Actual file path: %s\n", fd->path); LOG_D("Actual file path: %s", fd->path);
} }
else else
{ {
@ -105,7 +105,7 @@ int dfs_file_open(struct dfs_fd *fd, const char *path, int flags)
rt_free(fd->path); rt_free(fd->path);
fd->path = NULL; fd->path = NULL;
dbg_log(DBG_ERROR, "open failed\n"); LOG_E("open failed");
return result; return result;
} }
@ -117,7 +117,7 @@ int dfs_file_open(struct dfs_fd *fd, const char *path, int flags)
fd->flags |= DFS_F_DIRECTORY; fd->flags |= DFS_F_DIRECTORY;
} }
dbg_log(DBG_INFO, "open successful\n"); LOG_I("open successful");
return 0; return 0;
} }
@ -375,8 +375,8 @@ int dfs_file_stat(const char *path, struct stat *buf)
if ((fs = dfs_filesystem_lookup(fullpath)) == NULL) if ((fs = dfs_filesystem_lookup(fullpath)) == NULL)
{ {
dbg_log(DBG_ERROR, LOG_E(
"can't find mounted filesystem on this path:%s\n", fullpath); "can't find mounted filesystem on this path:%s", fullpath);
rt_free(fullpath); rt_free(fullpath);
return -ENOENT; return -ENOENT;
@ -405,8 +405,8 @@ int dfs_file_stat(const char *path, struct stat *buf)
if (fs->ops->stat == NULL) if (fs->ops->stat == NULL)
{ {
rt_free(fullpath); rt_free(fullpath);
dbg_log(DBG_ERROR, LOG_E(
"the filesystem didn't implement this function\n"); "the filesystem didn't implement this function");
return -ENOSYS; return -ENOSYS;
} }

View File

@ -55,7 +55,7 @@ int dfs_register(const struct dfs_filesystem_ops *ops)
if (empty == NULL) if (empty == NULL)
{ {
rt_set_errno(-ENOSPC); rt_set_errno(-ENOSPC);
dbg_log(DBG_ERROR, "There is no space to register this file system (%d).\n", ops->name); LOG_E("There is no space to register this file system (%d).", ops->name);
ret = -1; ret = -1;
} }
else if (ret == RT_EOK) else if (ret == RT_EOK)
@ -304,7 +304,7 @@ int dfs_mount(const char *device_name,
if ((fs == NULL) && (iter == &filesystem_table[DFS_FILESYSTEMS_MAX])) if ((fs == NULL) && (iter == &filesystem_table[DFS_FILESYSTEMS_MAX]))
{ {
rt_set_errno(-ENOSPC); rt_set_errno(-ENOSPC);
dbg_log(DBG_ERROR, "There is no space to mount this file system (%s).\n", filesystemtype); LOG_E("There is no space to mount this file system (%s).", filesystemtype);
goto err1; goto err1;
} }
@ -437,7 +437,7 @@ int dfs_mkfs(const char *fs_name, const char *device_name)
if (dev_id == NULL) if (dev_id == NULL)
{ {
rt_set_errno(-ENODEV); rt_set_errno(-ENODEV);
dbg_log(DBG_ERROR, "Device (%s) was not found\n", device_name); LOG_E("Device (%s) was not found", device_name);
return -1; return -1;
} }
@ -458,7 +458,7 @@ int dfs_mkfs(const char *fs_name, const char *device_name)
const struct dfs_filesystem_ops *ops = filesystem_operation_table[index]; const struct dfs_filesystem_ops *ops = filesystem_operation_table[index];
if (ops->mkfs == NULL) if (ops->mkfs == NULL)
{ {
dbg_log(DBG_ERROR, "The file system (%s) mkfs function was not implement\n", fs_name); LOG_E("The file system (%s) mkfs function was not implement", fs_name);
rt_set_errno(-ENOSYS); rt_set_errno(-ENOSYS);
return -1; return -1;
} }
@ -466,7 +466,7 @@ int dfs_mkfs(const char *fs_name, const char *device_name)
return ops->mkfs(dev_id); return ops->mkfs(dev_id);
} }
dbg_log(DBG_ERROR, "File system (%s) was not found.\n", fs_name); LOG_E("File system (%s) was not found.", fs_name);
return -1; return -1;
} }

View File

@ -70,19 +70,19 @@ static int serial_fops_open(struct dfs_fd *fd)
switch (fd->flags & O_ACCMODE) switch (fd->flags & O_ACCMODE)
{ {
case O_RDONLY: case O_RDONLY:
dbg_log(DBG_LOG, "fops open: O_RDONLY!\n"); LOG_D("fops open: O_RDONLY!");
flags = RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_RDONLY; flags = RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_RDONLY;
break; break;
case O_WRONLY: case O_WRONLY:
dbg_log(DBG_LOG, "fops open: O_WRONLY!\n"); LOG_D("fops open: O_WRONLY!");
flags = RT_DEVICE_FLAG_WRONLY; flags = RT_DEVICE_FLAG_WRONLY;
break; break;
case O_RDWR: case O_RDWR:
dbg_log(DBG_LOG, "fops open: O_RDWR!\n"); LOG_D("fops open: O_RDWR!");
flags = RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_RDWR; flags = RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_RDWR;
break; break;
default: default:
dbg_log(DBG_ERROR, "fops open: unknown mode - %d!\n", fd->flags & O_ACCMODE); LOG_E("fops open: unknown mode - %d!", fd->flags & O_ACCMODE);
break; break;
} }
@ -559,7 +559,7 @@ static rt_err_t rt_serial_open(struct rt_device *dev, rt_uint16_t oflag)
RT_ASSERT(dev != RT_NULL); RT_ASSERT(dev != RT_NULL);
serial = (struct rt_serial_device *)dev; serial = (struct rt_serial_device *)dev;
dbg_log(DBG_LOG, "open serial device: 0x%08x with open flag: 0x%04x\n", LOG_D("open serial device: 0x%08x with open flag: 0x%04x",
dev, oflag); dev, oflag);
/* check device flag with the open flag */ /* check device flag with the open flag */
if ((oflag & RT_DEVICE_FLAG_DMA_RX) && !(dev->flag & RT_DEVICE_FLAG_DMA_RX)) if ((oflag & RT_DEVICE_FLAG_DMA_RX) && !(dev->flag & RT_DEVICE_FLAG_DMA_RX))

View File

@ -41,7 +41,7 @@ void rt_thread_handle_sig(rt_bool_t clean_state);
static void _signal_default_handler(int signo) static void _signal_default_handler(int signo)
{ {
dbg_log(DBG_INFO, "handled signo[%d] with default action.\n", signo); LOG_I("handled signo[%d] with default action.", signo);
return ; return ;
} }
@ -60,7 +60,7 @@ static void _signal_entry(void *parameter)
tid->sp = tid->sig_ret; tid->sp = tid->sig_ret;
tid->sig_ret = RT_NULL; tid->sig_ret = RT_NULL;
dbg_log(DBG_LOG, "switch back to: 0x%08x\n", tid->sp); LOG_D("switch back to: 0x%08x", tid->sp);
tid->stat &= ~RT_THREAD_STAT_SIGNAL; tid->stat &= ~RT_THREAD_STAT_SIGNAL;
rt_hw_context_switch_to((rt_uint32_t) & (tid->sp)); rt_hw_context_switch_to((rt_uint32_t) & (tid->sp));
@ -119,7 +119,7 @@ static void _signal_deliver(rt_thread_t tid)
(void *)((char *)tid->sig_ret - 32), RT_NULL); (void *)((char *)tid->sig_ret - 32), RT_NULL);
rt_hw_interrupt_enable(level); rt_hw_interrupt_enable(level);
dbg_log(DBG_LOG, "signal stack pointer @ 0x%08x\n", tid->sp); LOG_D("signal stack pointer @ 0x%08x", tid->sp);
/* re-schedule */ /* re-schedule */
rt_schedule(); rt_schedule();
@ -268,7 +268,7 @@ __done:
{ {
*si = si_node->si; *si = si_node->si;
dbg_log(DBG_LOG, "sigwait: %d sig raised!\n", signo); LOG_D("sigwait: %d sig raised!", signo);
if (si_prev) si_prev->list.next = si_node->list.next; if (si_prev) si_prev->list.next = si_node->list.next;
else tid->si_list = si_node->list.next; else tid->si_list = si_node->list.next;
@ -320,7 +320,7 @@ void rt_thread_handle_sig(rt_bool_t clean_state)
handler = tid->sig_vectors[signo]; handler = tid->sig_vectors[signo];
rt_hw_interrupt_enable(level); rt_hw_interrupt_enable(level);
dbg_log(DBG_LOG, "handle signal: %d, handler 0x%08x\n", signo, handler); LOG_D("handle signal: %d, handler 0x%08x", signo, handler);
if (handler) handler(signo); if (handler) handler(signo);
level = rt_hw_interrupt_disable(); level = rt_hw_interrupt_disable();
@ -378,7 +378,7 @@ void rt_thread_free_sig(rt_thread_t tid)
struct rt_slist_node *node; struct rt_slist_node *node;
struct siginfo_node *si_node; struct siginfo_node *si_node;
dbg_log(DBG_LOG, "free signal info list\n"); LOG_D("free signal info list");
node = &(si_list->list); node = &(si_list->list);
do do
{ {
@ -404,7 +404,7 @@ int rt_thread_kill(rt_thread_t tid, int sig)
RT_ASSERT(tid != RT_NULL); RT_ASSERT(tid != RT_NULL);
if (!sig_valid(sig)) return -RT_EINVAL; if (!sig_valid(sig)) return -RT_EINVAL;
dbg_log(DBG_INFO, "send signal: %d\n", sig); LOG_I("send signal: %d", sig);
si.si_signo = sig; si.si_signo = sig;
si.si_code = SI_USER; si.si_code = SI_USER;
si.si_value.sival_ptr = RT_NULL; si.si_value.sival_ptr = RT_NULL;
@ -462,7 +462,7 @@ int rt_thread_kill(rt_thread_t tid, int sig)
} }
else else
{ {
dbg_log(DBG_ERROR, "The allocation of signal info node failed.\n"); LOG_E("The allocation of signal info node failed.");
} }
/* deliver signal to this thread */ /* deliver signal to this thread */
@ -476,7 +476,7 @@ int rt_system_signal_init(void)
_rt_siginfo_pool = rt_mp_create("signal", RT_SIG_INFO_MAX, sizeof(struct siginfo_node)); _rt_siginfo_pool = rt_mp_create("signal", RT_SIG_INFO_MAX, sizeof(struct siginfo_node));
if (_rt_siginfo_pool == RT_NULL) if (_rt_siginfo_pool == RT_NULL)
{ {
dbg_log(DBG_ERROR, "create memory pool for signal info failed.\n"); LOG_E("create memory pool for signal info failed.");
RT_ASSERT(0); RT_ASSERT(0);
} }