[errno code][-RT_ERROR] fix that use RT_ERROR without -

This commit is contained in:
Meco Man 2023-03-17 00:12:16 -04:00 committed by Man, Jianting (Meco)
parent de963feef4
commit 0f461e870c
272 changed files with 639 additions and 644 deletions

View File

@ -198,7 +198,7 @@ static rt_err_t timer_ctrl(rt_hwtimer_t *timer, rt_uint32_t cmd, void *arg)
if (result != CY_RSLT_SUCCESS) if (result != CY_RSLT_SUCCESS)
{ {
LOG_E("cyhal_timer_set_frequency error\r\n"); LOG_E("cyhal_timer_set_frequency error\r\n");
return RT_ERROR; return -RT_ERROR;
} }
} }
break; break;
@ -301,7 +301,7 @@ int hwtimer_sample()
if (hw_dev == RT_NULL) if (hw_dev == RT_NULL)
{ {
rt_kprintf("hwtimer sample run failed! can't find %s device!\n", HWTIMER_DEV_NAME); rt_kprintf("hwtimer sample run failed! can't find %s device!\n", HWTIMER_DEV_NAME);
return RT_ERROR; return -RT_ERROR;
} }
ret = rt_device_open(hw_dev, RT_DEVICE_OFLAG_RDWR); ret = rt_device_open(hw_dev, RT_DEVICE_OFLAG_RDWR);
@ -329,7 +329,7 @@ int hwtimer_sample()
if (rt_device_write(hw_dev, 0, &timeout_s, sizeof(timeout_s)) != sizeof(timeout_s)) if (rt_device_write(hw_dev, 0, &timeout_s, sizeof(timeout_s)) != sizeof(timeout_s))
{ {
rt_kprintf("set timeout value failed\n"); rt_kprintf("set timeout value failed\n");
return RT_ERROR; return -RT_ERROR;
} }
while (1) while (1)

View File

@ -243,7 +243,7 @@ static int pwm_sample(int argc, char *argv[])
if (pwm_dev == RT_NULL) if (pwm_dev == RT_NULL)
{ {
rt_kprintf("pwm sample run failed! can't find %s device!\n", PWM_DEV_NAME); rt_kprintf("pwm sample run failed! can't find %s device!\n", PWM_DEV_NAME);
return RT_ERROR; return -RT_ERROR;
} }
rt_pwm_set(pwm_dev, PWM_DEV_CHANNEL, period, pulse); rt_pwm_set(pwm_dev, PWM_DEV_CHANNEL, period, pulse);

View File

@ -153,7 +153,7 @@ static int rt_hw_rtc_init(void)
if (rt_hw_rtc_register(&ifx32_rtc_dev, "rtc", RT_DEVICE_FLAG_RDWR, RT_NULL) != RT_EOK) if (rt_hw_rtc_register(&ifx32_rtc_dev, "rtc", RT_DEVICE_FLAG_RDWR, RT_NULL) != RT_EOK)
{ {
LOG_E("rtc init failed"); LOG_E("rtc init failed");
result = RT_ERROR; result = -RT_ERROR;
} }
else else
{ {

View File

@ -60,7 +60,7 @@ static void ifx_spi_init(struct ifx_spi *ifx_spi)
result = cyhal_spi_init(ifx_spi->spi_obj, ifx_spi->mosi_pin, ifx_spi->miso_pin, ifx_spi->sck_pin, result = cyhal_spi_init(ifx_spi->spi_obj, ifx_spi->mosi_pin, ifx_spi->miso_pin, ifx_spi->sck_pin,
NC, NULL, ifx_spi->spi_obj->data_bits, ifx_spi->spi_obj->mode, false); NC, NULL, ifx_spi->spi_obj->data_bits, ifx_spi->spi_obj->mode, false);
RT_ASSERT(result != RT_ERROR); RT_ASSERT(result == RT_EOK);
rt_kprintf("[%s] Freq:[%d]HZ\n", ifx_spi->bus_name, ifx_spi->freq); rt_kprintf("[%s] Freq:[%d]HZ\n", ifx_spi->bus_name, ifx_spi->freq);

View File

@ -182,7 +182,7 @@ static rt_err_t ifx_configure(struct rt_serial_device *serial, struct serial_con
result = cyhal_uart_set_baud(uart->config->uart_obj, cfg->baud_rate, NULL); result = cyhal_uart_set_baud(uart->config->uart_obj, cfg->baud_rate, NULL);
} }
RT_ASSERT(result != RT_ERROR); RT_ASSERT(result == RT_EOK);
return RT_EOK; return RT_EOK;
} }

View File

@ -60,7 +60,7 @@ static rt_err_t wdt_control(rt_watchdog_t *wdt_device, int cmd, void *arg)
/* Initialize the WDT */ /* Initialize the WDT */
int result = cyhal_wdt_init(cfg->WDTx, (rt_uint32_t)timeout_ms); int result = cyhal_wdt_init(cfg->WDTx, (rt_uint32_t)timeout_ms);
/* WDT initialization failed. Stop program execution */ /* WDT initialization failed. Stop program execution */
RT_ASSERT(result != RT_ERROR); RT_ASSERT(result == RT_EOK);
} }
break; break;

View File

@ -234,7 +234,7 @@ int Slider_ctrl_sample(void)
} }
else else
{ {
ret = RT_ERROR; ret = -RT_ERROR;
} }
return ret; return ret;

View File

@ -32,7 +32,7 @@ static int rt_spi_device_init(void)
if (RT_NULL == spi_dev) if (RT_NULL == spi_dev)
{ {
rt_kprintf("spi sample run failed! can't find %s device!\n", SPI_NAME); rt_kprintf("spi sample run failed! can't find %s device!\n", SPI_NAME);
return RT_ERROR; return -RT_ERROR;
} }
rt_spi_configure(spi_dev, &cfg); rt_spi_configure(spi_dev, &cfg);

View File

@ -234,7 +234,7 @@ int Slider_ctrl_sample(void)
} }
else else
{ {
ret = RT_ERROR; ret = -RT_ERROR;
} }
return ret; return ret;

View File

@ -32,7 +32,7 @@ static int rt_spi_device_init(void)
if (RT_NULL == spi_dev) if (RT_NULL == spi_dev)
{ {
rt_kprintf("spi sample run failed! can't find %s device!\n", SPI_NAME); rt_kprintf("spi sample run failed! can't find %s device!\n", SPI_NAME);
return RT_ERROR; return -RT_ERROR;
} }
rt_spi_configure(spi_dev, &cfg); rt_spi_configure(spi_dev, &cfg);

View File

@ -234,7 +234,7 @@ int Slider_ctrl_sample(void)
} }
else else
{ {
ret = RT_ERROR; ret = -RT_ERROR;
} }
return ret; return ret;

View File

@ -32,7 +32,7 @@ static int rt_spi_device_init(void)
if (RT_NULL == spi_dev) if (RT_NULL == spi_dev)
{ {
rt_kprintf("spi sample run failed! can't find %s device!\n", SPI_NAME); rt_kprintf("spi sample run failed! can't find %s device!\n", SPI_NAME);
return RT_ERROR; return -RT_ERROR;
} }
rt_spi_configure(spi_dev, &cfg); rt_spi_configure(spi_dev, &cfg);

View File

@ -235,7 +235,7 @@ int Slider_ctrl_sample(void)
} }
else else
{ {
ret = RT_ERROR; ret = -RT_ERROR;
} }
return ret; return ret;

View File

@ -32,7 +32,7 @@ static int rt_spi_device_init(void)
if (RT_NULL == spi_dev) if (RT_NULL == spi_dev)
{ {
rt_kprintf("spi sample run failed! can't find %s device!\n", SPI_NAME); rt_kprintf("spi sample run failed! can't find %s device!\n", SPI_NAME);
return RT_ERROR; return -RT_ERROR;
} }
rt_spi_configure(spi_dev, &cfg); rt_spi_configure(spi_dev, &cfg);

View File

@ -234,7 +234,7 @@ int Slider_ctrl_sample(void)
} }
else else
{ {
ret = RT_ERROR; ret = -RT_ERROR;
} }
return ret; return ret;

View File

@ -32,7 +32,7 @@ static int rt_spi_device_init(void)
if (RT_NULL == spi_dev) if (RT_NULL == spi_dev)
{ {
rt_kprintf("spi sample run failed! can't find %s device!\n", SPI_NAME); rt_kprintf("spi sample run failed! can't find %s device!\n", SPI_NAME);
return RT_ERROR; return -RT_ERROR;
} }
rt_spi_configure(spi_dev, &cfg); rt_spi_configure(spi_dev, &cfg);

View File

@ -235,7 +235,7 @@ int Slider_ctrl_sample(void)
} }
else else
{ {
ret = RT_ERROR; ret = -RT_ERROR;
} }
return ret; return ret;

View File

@ -32,7 +32,7 @@ static int rt_spi_device_init(void)
if (RT_NULL == spi_dev) if (RT_NULL == spi_dev)
{ {
rt_kprintf("spi sample run failed! can't find %s device!\n", SPI_NAME); rt_kprintf("spi sample run failed! can't find %s device!\n", SPI_NAME);
return RT_ERROR; return -RT_ERROR;
} }
rt_spi_configure(spi_dev, &cfg); rt_spi_configure(spi_dev, &cfg);

View File

@ -235,7 +235,7 @@ int Slider_ctrl_sample(void)
} }
else else
{ {
ret = RT_ERROR; ret = -RT_ERROR;
} }
return ret; return ret;

View File

@ -32,7 +32,7 @@ static int rt_spi_device_init(void)
if (RT_NULL == spi_dev) if (RT_NULL == spi_dev)
{ {
rt_kprintf("spi sample run failed! can't find %s device!\n", SPI_NAME); rt_kprintf("spi sample run failed! can't find %s device!\n", SPI_NAME);
return RT_ERROR; return -RT_ERROR;
} }
rt_spi_configure(spi_dev, &cfg); rt_spi_configure(spi_dev, &cfg);

View File

@ -30,14 +30,14 @@ static int wdt_feed_init(void)
if (!wdg_dev) if (!wdg_dev)
{ {
rt_kprintf("find %s failed!\n", device_name); rt_kprintf("find %s failed!\n", device_name);
return RT_ERROR; return -RT_ERROR;
} }
ret = rt_device_control(wdg_dev, RT_DEVICE_CTRL_WDT_SET_TIMEOUT, &timeout); ret = rt_device_control(wdg_dev, RT_DEVICE_CTRL_WDT_SET_TIMEOUT, &timeout);
if (ret != RT_EOK) if (ret != RT_EOK)
{ {
rt_kprintf("set %s timeout failed!\n", device_name); rt_kprintf("set %s timeout failed!\n", device_name);
return RT_ERROR; return -RT_ERROR;
} }
ret = rt_device_control(wdg_dev, RT_DEVICE_CTRL_WDT_START, RT_NULL); ret = rt_device_control(wdg_dev, RT_DEVICE_CTRL_WDT_START, RT_NULL);
if (ret != RT_EOK) if (ret != RT_EOK)

View File

@ -85,7 +85,7 @@ static rt_ssize_t air105_i2c_slv_xfer(struct rt_i2c_bus_device *bus,
struct rt_i2c_msg msgs[], struct rt_i2c_msg msgs[],
rt_uint32_t num) rt_uint32_t num)
{ {
return RT_ERROR; return -RT_ENOSYS;
} }
static rt_err_t air105_i2c_bus_control(struct rt_i2c_bus_device *bus, static rt_err_t air105_i2c_bus_control(struct rt_i2c_bus_device *bus,
rt_uint32_t cmd, rt_uint32_t cmd,

View File

@ -232,7 +232,7 @@ static rt_err_t air105_control(struct rt_serial_device *serial, int cmd, void *a
} }
break; break;
default: default:
return RT_ERROR; return -RT_EINVAL;
} }
return RT_EOK; return RT_EOK;

View File

@ -51,7 +51,7 @@ static rt_err_t hal_pin_attach_irq(struct rt_device *device, rt_int32_t pin,
if (ret < 0) if (ret < 0)
{ {
rt_kprintf("gpio to irq error, irq num:%lu error num: %d", irq, ret); rt_kprintf("gpio to irq error, irq num:%lu error num: %d", irq, ret);
return RT_ERROR; return -RT_ERROR;
} }
level = rt_hw_interrupt_disable(); level = rt_hw_interrupt_disable();
@ -61,7 +61,7 @@ static rt_err_t hal_pin_attach_irq(struct rt_device *device, rt_int32_t pin,
{ {
rt_hw_interrupt_enable(level); rt_hw_interrupt_enable(level);
rt_kprintf("request irq error, irq num:%lu error num: %d", irq, ret); rt_kprintf("request irq error, irq num:%lu error num: %d", irq, ret);
return RT_ERROR; return -RT_ERROR;
} }
rt_hw_interrupt_enable(level); rt_hw_interrupt_enable(level);
@ -78,7 +78,7 @@ static rt_err_t hal_pin_detach_irq(struct rt_device *device, rt_int32_t pin)
if (ret < 0) if (ret < 0)
{ {
rt_kprintf("gpio to irq error, irq num:%lu error num: %d", irq, ret); rt_kprintf("gpio to irq error, irq num:%lu error num: %d", irq, ret);
return RT_ERROR; return -RT_ERROR;
} }
level = rt_hw_interrupt_disable(); level = rt_hw_interrupt_disable();
@ -87,7 +87,7 @@ static rt_err_t hal_pin_detach_irq(struct rt_device *device, rt_int32_t pin)
{ {
rt_hw_interrupt_enable(level); rt_hw_interrupt_enable(level);
rt_kprintf("free irq error, error num: %d", ret); rt_kprintf("free irq error, error num: %d", ret);
return RT_ERROR; return -RT_ERROR;
} }
return RT_EOK; return RT_EOK;
} }
@ -101,7 +101,7 @@ static rt_err_t hal_pin_irq_enable(struct rt_device *device, rt_base_t pin, rt_u
if (ret < 0) if (ret < 0)
{ {
rt_kprintf("gpio to irq error, irq num:%lu error num: %d", irq, ret); rt_kprintf("gpio to irq error, irq num:%lu error num: %d", irq, ret);
return RT_ERROR; return -RT_ERROR;
} }
if (enabled == PIN_IRQ_ENABLE) if (enabled == PIN_IRQ_ENABLE)
@ -110,7 +110,7 @@ static rt_err_t hal_pin_irq_enable(struct rt_device *device, rt_base_t pin, rt_u
if (ret < 0) if (ret < 0)
{ {
rt_kprintf("request irq error, error num: %d", ret); rt_kprintf("request irq error, error num: %d", ret);
return RT_ERROR; return -RT_ERROR;
} }
} }
else else
@ -119,7 +119,7 @@ static rt_err_t hal_pin_irq_enable(struct rt_device *device, rt_base_t pin, rt_u
if (ret < 0) if (ret < 0)
{ {
rt_kprintf("disable irq error, irq num:%lu, error num: %d", irq, ret); rt_kprintf("disable irq error, irq num:%lu, error num: %d", irq, ret);
return RT_ERROR; return -RT_ERROR;
} }
} }

View File

@ -262,7 +262,7 @@ int is_enough_desc_available(struct dma_desc *entry)
if(desc->desc0.tx.own != 0) if(desc->desc0.tx.own != 0)
{ {
printf("desc %08x desc0 %08x desc1 %08x\n",desc,desc->desc0,desc->desc1); printf("desc %08x desc0 %08x desc1 %08x\n",desc,desc->desc0,desc->desc1);
return RT_ERROR; return -RT_ERROR;
} }
return RT_EOK; return RT_EOK;
@ -284,7 +284,7 @@ int wait_tx_completed(struct dma_desc *entry)
if(timeout_cnt > 1000) if(timeout_cnt > 1000)
{ {
printf("emac send data timeout \n"); printf("emac send data timeout \n");
return RT_ERROR; return -RT_ERROR;
} }
} }
desc_tag_clean(desc); desc_tag_clean(desc);
@ -307,13 +307,13 @@ static rt_err_t rt_geth_xmit(rt_device_t dev, struct pbuf *p)
unsigned int i = 0; unsigned int i = 0;
unsigned int copy_offset = 0; unsigned int copy_offset = 0;
if (!rt_geth_dev.phy_link_status) return RT_ERROR; if (!rt_geth_dev.phy_link_status) return -RT_ERROR;
first = rt_geth_dev.get_buffer_config.dma_desc_tx + tx_dirty; first = rt_geth_dev.get_buffer_config.dma_desc_tx + tx_dirty;
ret = is_enough_desc_available(first); ret = is_enough_desc_available(first);
if(ret < 0) if(ret < 0)
{ {
return RT_ERROR; return -RT_ERROR;
} }
copy_offset = 0; copy_offset = 0;
@ -326,7 +326,7 @@ static rt_err_t rt_geth_xmit(rt_device_t dev, struct pbuf *p)
if(copy_offset >= ((1 << 11) - 1)) if(copy_offset >= ((1 << 11) - 1))
{ {
printf("send data exceed max len copy_offset %d\n",copy_offset); printf("send data exceed max len copy_offset %d\n",copy_offset);
return RT_ERROR; return -RT_ERROR;
} }
} }

View File

@ -230,7 +230,7 @@ rt_err_t cpu_set_pll_clk(int clk)
//PLL1 rate = ((24000000 * n * k) >> 0) / m (p is ignored) //PLL1 rate = ((24000000 * n * k) >> 0) / m (p is ignored)
CCU->pll_cpu_ctrl = (0x1 << 31) | (m << 0) | (k << 4) | (n << 8) | (p << 16); CCU->pll_cpu_ctrl = (0x1 << 31) | (m << 0) | (k << 4) | (n << 8) | (p << 16);
if (wait_pll_stable((rt_uint32_t)(&CCU->pll_cpu_ctrl))) if (wait_pll_stable((rt_uint32_t)(&CCU->pll_cpu_ctrl)))
return RT_ERROR; return -RT_ERROR;
CCU->cpu_clk_src = cpu_src << 16; CCU->cpu_clk_src = cpu_src << 16;
@ -267,7 +267,7 @@ rt_err_t audio_set_pll_clk(int clk)
n = clk / n_temp; n = clk / n_temp;
m = _24MHZ_ * 2 / m_temp; m = _24MHZ_ * 2 / m_temp;
if ((n > 128) || (m > 32) || (clk != (_24MHZ_ * n * 2) / m)) if ((n > 128) || (m > 32) || (clk != (_24MHZ_ * n * 2) / m))
return RT_ERROR; return -RT_ERROR;
CCU->pll_audio_ctrl &= ~(0x1 << 31); CCU->pll_audio_ctrl &= ~(0x1 << 31);
n = (n - 1) & 0x7f; n = (n - 1) & 0x7f;
@ -276,7 +276,7 @@ rt_err_t audio_set_pll_clk(int clk)
CCU->pll_audio_ctrl = (0x1 << 31) | (0x0 << 24) | (n << 8) | m; CCU->pll_audio_ctrl = (0x1 << 31) | (0x0 << 24) | (n << 8) | m;
if (wait_pll_stable((rt_uint32_t)(&CCU->pll_audio_ctrl))) if (wait_pll_stable((rt_uint32_t)(&CCU->pll_audio_ctrl)))
return RT_ERROR; return -RT_ERROR;
else else
return RT_EOK; return RT_EOK;
} }
@ -312,7 +312,7 @@ rt_err_t video_set_pll_clk(int clk)
m = _24MHZ_ / m_temp; m = _24MHZ_ / m_temp;
if ((n > 128) || (m > 16) || (clk != (_24MHZ_ * n) / m)) if ((n > 128) || (m > 16) || (clk != (_24MHZ_ * n) / m))
return RT_ERROR; return -RT_ERROR;
CCU->pll_video_ctrl &= ~(0x1 << 31); CCU->pll_video_ctrl &= ~(0x1 << 31);
n = (n - 1) & 0x7f; n = (n - 1) & 0x7f;
@ -321,7 +321,7 @@ rt_err_t video_set_pll_clk(int clk)
CCU->pll_video_ctrl = (0x1 << 31) | (0x0 << 30) | (0x1 << 24) | (n << 8) | m; CCU->pll_video_ctrl = (0x1 << 31) | (0x0 << 30) | (0x1 << 24) | (n << 8) | m;
if (wait_pll_stable((rt_uint32_t)(&CCU->pll_video_ctrl))) if (wait_pll_stable((rt_uint32_t)(&CCU->pll_video_ctrl)))
return RT_ERROR; return -RT_ERROR;
else else
return RT_EOK; return RT_EOK;
} }
@ -357,7 +357,7 @@ rt_err_t ve_set_pll_clk(int clk)
m = _24MHZ_ / m_temp; m = _24MHZ_ / m_temp;
if ((n > 128) || (m > 16) || (clk != (_24MHZ_ * n) / m)) if ((n > 128) || (m > 16) || (clk != (_24MHZ_ * n) / m))
return RT_ERROR; return -RT_ERROR;
CCU->pll_ve_ctrl &= ~(0x1 << 31); CCU->pll_ve_ctrl &= ~(0x1 << 31);
n = (n - 1) & 0x7f; n = (n - 1) & 0x7f;
@ -365,7 +365,7 @@ rt_err_t ve_set_pll_clk(int clk)
//clk = (24 * n) / m //clk = (24 * n) / m
CCU->pll_ve_ctrl = (0x1 << 31) | (0x1 << 24) | (n << 8) | m; CCU->pll_ve_ctrl = (0x1 << 31) | (0x1 << 24) | (n << 8) | m;
if (wait_pll_stable((rt_uint32_t)(&CCU->pll_ve_ctrl))) if (wait_pll_stable((rt_uint32_t)(&CCU->pll_ve_ctrl)))
return RT_ERROR; return -RT_ERROR;
else else
return RT_EOK; return RT_EOK;
} }
@ -388,7 +388,7 @@ rt_err_t periph_set_pll_clk(int clk)
} }
if ((n > 32) || (k > 4) || (clk != (_24MHZ_ * n * k))) if ((n > 32) || (k > 4) || (clk != (_24MHZ_ * n * k)))
return RT_ERROR; return -RT_ERROR;
temp_data = CCU->ahb_apb_hclkc_cfg; temp_data = CCU->ahb_apb_hclkc_cfg;
clk_src = (temp_data >> 12) & 0x3; clk_src = (temp_data >> 12) & 0x3;
temp_data &= ~(0x3 << 12); temp_data &= ~(0x3 << 12);
@ -400,7 +400,7 @@ rt_err_t periph_set_pll_clk(int clk)
//clk = 24 * n *k //clk = 24 * n *k
CCU->pll_periph_ctrl = (0x1 << 31) | (0x1 << 18) | (n << 8) | (k << 4) || (0x1); CCU->pll_periph_ctrl = (0x1 << 31) | (0x1 << 18) | (n << 8) | (k << 4) || (0x1);
if (wait_pll_stable((rt_uint32_t)(&CCU->pll_periph_ctrl))) if (wait_pll_stable((rt_uint32_t)(&CCU->pll_periph_ctrl)))
return RT_ERROR; return -RT_ERROR;
temp_data = CCU->ahb_apb_hclkc_cfg; temp_data = CCU->ahb_apb_hclkc_cfg;
temp_data &= ~(0x3 << 12); temp_data &= ~(0x3 << 12);
@ -423,7 +423,7 @@ rt_err_t cpu_set_clk(int clk)
return RT_EOK; return RT_EOK;
if (cpu_set_pll_clk(clk)) if (cpu_set_pll_clk(clk))
return RT_ERROR; return -RT_ERROR;
CCU->ahb_apb_hclkc_cfg &= ~(0x3 << 16); CCU->ahb_apb_hclkc_cfg &= ~(0x3 << 16);
CCU->cpu_clk_src = CLK_PLL_SRC << 16; CCU->cpu_clk_src = CLK_PLL_SRC << 16;

View File

@ -469,7 +469,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))
{ {
LOG_E("pin:%d value wrongful", pin); LOG_E("pin:%d value wrongful", pin);
return RT_ERROR; return -RT_ERROR;
} }
gpio_set_irq_callback(pin_index[pin].pin_port, pin_index[pin].pin, hdr, args); gpio_set_irq_callback(pin_index[pin].pin_port, pin_index[pin].pin, hdr, args);
@ -481,7 +481,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))
{ {
LOG_E("pin:%d value wrongful", pin); LOG_E("pin:%d value wrongful", pin);
return RT_ERROR; return -RT_ERROR;
} }
gpio_clear_irq_callback(pin_index[pin].pin_port, pin_index[pin].pin); gpio_clear_irq_callback(pin_index[pin].pin_port, pin_index[pin].pin);
@ -494,7 +494,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))
{ {
LOG_E("pin:%d value wrongful", pin); LOG_E("pin:%d value wrongful", pin);
return RT_ERROR; return -RT_ERROR;
} }
if (enabled) if (enabled)

View File

@ -774,7 +774,7 @@ err:
rt_free(host); rt_free(host);
} }
return RT_ERROR; return -RT_ERROR;
} }
INIT_APP_EXPORT(tina_sdio_init); INIT_APP_EXPORT(tina_sdio_init);
#endif #endif

View File

@ -680,7 +680,7 @@ rt_err_t tina_spi_bus_register(SPI_T *spi, const char *spi_bus_name)
LOG_D("%s -> %d", __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)

View File

@ -27,12 +27,9 @@
#define DEBUG_PRINTF(...) #define DEBUG_PRINTF(...)
#endif #endif
#ifdef TINA_USING_SPI_FLASH #if defined(TINA_USING_SPI_FLASH) && defined(RT_USING_SFUD)
#include "spi_flash.h" #include "spi_flash.h"
#include <spi_flash_sfud.h>
#if defined(RT_USING_SFUD)
#include "spi_flash_sfud.h"
rt_spi_flash_device_t spi_device; rt_spi_flash_device_t spi_device;
int rt_hw_spi_flash_with_sfud_init(void) int rt_hw_spi_flash_with_sfud_init(void)
{ {
@ -41,14 +38,11 @@ int rt_hw_spi_flash_with_sfud_init(void)
if (spi_device == NULL) if (spi_device == NULL)
{ {
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
return RT_ERROR; return -RT_ERROR;
}; };
DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__); DEBUG_PRINTF("%s -> %d\n", __FUNCTION__, __LINE__);
return RT_EOK; return RT_EOK;
} }
INIT_PREV_EXPORT(rt_hw_spi_flash_with_sfud_init); INIT_PREV_EXPORT(rt_hw_spi_flash_with_sfud_init);
#endif /* defined(TINA_USING_SPI_FLASH) && defined(RT_USING_SFUD) */
#endif
#endif

View File

@ -301,7 +301,7 @@ static int rt_hw_rtc_init(void)
if (rt_hw_rtc_register(&apm32_rtc_dev, "rtc", RT_DEVICE_FLAG_RDWR, RT_NULL) != RT_EOK) if (rt_hw_rtc_register(&apm32_rtc_dev, "rtc", RT_DEVICE_FLAG_RDWR, RT_NULL) != RT_EOK)
{ {
LOG_E("rtc init failed"); LOG_E("rtc init failed");
result = RT_ERROR; result = -RT_ERROR;
} }
else else
{ {

View File

@ -93,7 +93,7 @@ static int uart_sample(int argc, char *argv[])
if (!serial) if (!serial)
{ {
rt_kprintf("find %s failed!\n", uart_name); rt_kprintf("find %s failed!\n", uart_name);
return RT_ERROR; return -RT_ERROR;
} }
rt_sem_init(&rx_sem, "rx_sem", 0, RT_IPC_FLAG_FIFO); rt_sem_init(&rx_sem, "rx_sem", 0, RT_IPC_FLAG_FIFO);
@ -110,7 +110,7 @@ static int uart_sample(int argc, char *argv[])
} }
else else
{ {
ret = RT_ERROR; ret = -RT_ERROR;
} }
return ret; return ret;
@ -253,14 +253,14 @@ static int wdt_sample(int argc, char *argv[])
if (!wdt_dev) if (!wdt_dev)
{ {
rt_kprintf("find %s failed!\n", device_name); rt_kprintf("find %s failed!\n", device_name);
return RT_ERROR; return -RT_ERROR;
} }
ret = rt_device_control(wdt_dev, RT_DEVICE_CTRL_WDT_SET_TIMEOUT, &timeout); ret = rt_device_control(wdt_dev, RT_DEVICE_CTRL_WDT_SET_TIMEOUT, &timeout);
if (ret != RT_EOK) if (ret != RT_EOK)
{ {
rt_kprintf("set %s timeout failed!\n", device_name); rt_kprintf("set %s timeout failed!\n", device_name);
return RT_ERROR; return -RT_ERROR;
} }
ret = rt_device_control(wdt_dev, RT_DEVICE_CTRL_WDT_START, RT_NULL); ret = rt_device_control(wdt_dev, RT_DEVICE_CTRL_WDT_START, RT_NULL);
@ -351,7 +351,7 @@ int can_sample(int argc, char *argv[])
if (!can_dev) if (!can_dev)
{ {
rt_kprintf("find %s failed!\n", can_name); rt_kprintf("find %s failed!\n", can_name);
return RT_ERROR; return -RT_ERROR;
} }
rt_sem_init(&rx_sem, "rx_sem", 0, RT_IPC_FLAG_FIFO); rt_sem_init(&rx_sem, "rx_sem", 0, RT_IPC_FLAG_FIFO);
@ -500,7 +500,7 @@ static int hwtimer_sample(int argc, char *argv[])
if (hw_dev == RT_NULL) if (hw_dev == RT_NULL)
{ {
rt_kprintf("hwtimer sample run failed! can't find %s device!\n", HWTIMER_DEV_NAME); rt_kprintf("hwtimer sample run failed! can't find %s device!\n", HWTIMER_DEV_NAME);
return RT_ERROR; return -RT_ERROR;
} }
ret = rt_device_open(hw_dev, RT_DEVICE_OFLAG_RDWR); ret = rt_device_open(hw_dev, RT_DEVICE_OFLAG_RDWR);
@ -526,7 +526,7 @@ static int hwtimer_sample(int argc, char *argv[])
if (rt_device_write(hw_dev, 0, &timeout_s, sizeof(timeout_s)) != sizeof(timeout_s)) if (rt_device_write(hw_dev, 0, &timeout_s, sizeof(timeout_s)) != sizeof(timeout_s))
{ {
rt_kprintf("set timeout value failed\n"); rt_kprintf("set timeout value failed\n");
return RT_ERROR; return -RT_ERROR;
} }
rt_thread_mdelay(1000); rt_thread_mdelay(1000);

View File

@ -455,7 +455,7 @@ static rt_err_t rt_at32_emac_control(rt_device_t dev, int cmd, void *args)
*/ */
rt_err_t rt_at32_emac_tx(rt_device_t dev, struct pbuf *p) rt_err_t rt_at32_emac_tx(rt_device_t dev, struct pbuf *p)
{ {
rt_err_t ret = RT_ERROR; rt_err_t ret = -RT_ERROR;
struct pbuf *q; struct pbuf *q;
rt_uint32_t offset; rt_uint32_t offset;

View File

@ -445,7 +445,7 @@ static rt_err_t efm_spiSd_writeBlock(void *buffer, rt_uint8_t token)
rt_uint8_t buf_res[8]; /* Expect a byte for data response */ rt_uint8_t buf_res[8]; /* Expect a byte for data response */
rt_uint8_t i; rt_uint8_t i;
ret = RT_ERROR; ret = -RT_ERROR;
sdcard_debug("SPISD: Write block\n"); sdcard_debug("SPISD: Write block\n");
do do
{ {

View File

@ -112,7 +112,7 @@ static rt_ssize_t es32f0_master_xfer(struct rt_i2c_bus_device *bus,
{ {
struct rt_i2c_msg *msg; struct rt_i2c_msg *msg;
rt_uint32_t i; rt_uint32_t i;
rt_err_t ret = RT_ERROR; rt_err_t ret = -RT_ERROR;
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
{ {

View File

@ -162,7 +162,7 @@ rt_err_t spi_configure(struct rt_spi_device *device,
return RT_EOK; return RT_EOK;
} }
static rt_uint32_t spixfer(struct rt_spi_device *device, struct rt_spi_message *message) static rt_ssize_t spixfer(struct rt_spi_device *device, struct rt_spi_message *message)
{ {
rt_err_t res; rt_err_t res;
spi_handle_t *hspi; spi_handle_t *hspi;
@ -208,7 +208,7 @@ static rt_uint32_t spixfer(struct rt_spi_device *device, struct rt_spi_message *
} }
if (res != RT_EOK) if (res != RT_EOK)
return RT_ERROR; return -RT_ERROR;
else else
return message->length; return message->length;

View File

@ -271,7 +271,7 @@ static rt_ssize_t es32f3_master_xfer(struct rt_i2c_bus_device *bus,
{ {
struct rt_i2c_msg *msg; struct rt_i2c_msg *msg;
rt_uint32_t i; rt_uint32_t i;
rt_err_t ret = RT_ERROR; rt_err_t ret = -RT_ERROR;
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
{ {

View File

@ -162,7 +162,7 @@ rt_err_t spi_configure(struct rt_spi_device *device,
return RT_EOK; return RT_EOK;
} }
static rt_uint32_t spixfer(struct rt_spi_device *device, struct rt_spi_message *message) static rt_ssize_t spixfer(struct rt_spi_device *device, struct rt_spi_message *message)
{ {
rt_err_t res; rt_err_t res;
spi_handle_t *hspi; spi_handle_t *hspi;
@ -208,7 +208,7 @@ static rt_uint32_t spixfer(struct rt_spi_device *device, struct rt_spi_message *
} }
if (res != RT_EOK) if (res != RT_EOK)
return RT_ERROR; return -RT_ERROR;
else else
return message->length; return message->length;

View File

@ -62,7 +62,7 @@ static rt_err_t ft2004_cmdOperation(struct ft2004_qspi_bus *qspi_bus_p, struct r
if (qspi_message->instruction.qspi_lines == 0) if (qspi_message->instruction.qspi_lines == 0)
{ {
LOG_E("instruction is not valid"); LOG_E("instruction is not valid");
return RT_ERROR; return -RT_ERROR;
} }
cmd_pack.cmd = qspi_message->instruction.content; cmd_pack.cmd = qspi_message->instruction.content;
@ -130,13 +130,13 @@ static rt_err_t ft2004_cmdOperation(struct ft2004_qspi_bus *qspi_bus_p, struct r
} }
#endif #endif
return (ret == FQSPI_SUCCESS) ? RT_EOK : RT_ERROR; return (ret == FQSPI_SUCCESS) ? RT_EOK : -RT_ERROR;
} }
static rt_uint32_t ft2004_qspi_xfer(struct ft2004_qspi_bus *qspi_bus_p, struct rt_spi_message *message) static rt_ssize_t ft2004_qspi_xfer(struct ft2004_qspi_bus *qspi_bus_p, struct rt_spi_message *message)
{ {
struct rt_qspi_message *qspi_message = (struct rt_qspi_message *)message; struct rt_qspi_message *qspi_message = (struct rt_qspi_message *)message;
rt_uint32_t ret_length = 0; rt_ssize_t ret_length = 0;
const rt_uint8_t *sndb = message->send_buf; const rt_uint8_t *sndb = message->send_buf;
rt_uint8_t *rcvb = message->recv_buf; rt_uint8_t *rcvb = message->recv_buf;
rt_int32_t length = message->length; rt_int32_t length = message->length;
@ -159,7 +159,7 @@ static rt_uint32_t ft2004_qspi_xfer(struct ft2004_qspi_bus *qspi_bus_p, struct r
if (qspi_config_p->channel >= FT_QSPI_MAX_CS_NUM) if (qspi_config_p->channel >= FT_QSPI_MAX_CS_NUM)
{ {
LOG_E("invalid channel[%x] ", qspi_config_p->channel); LOG_E("invalid channel[%x] ", qspi_config_p->channel);
return RT_ERROR; return -RT_ERROR;
} }
switch (cmd) switch (cmd)
{ {

View File

@ -38,7 +38,7 @@ static rt_err_t _sdcard_mount(void)
if (mmcsd_wait_cd_changed(rt_tick_from_millisecond(5000)) == -RT_ETIMEOUT) if (mmcsd_wait_cd_changed(rt_tick_from_millisecond(5000)) == -RT_ETIMEOUT)
{ {
rt_kprintf("timeout \r\n"); rt_kprintf("timeout \r\n");
return RT_ERROR; return -RT_ERROR;
} }
device = rt_device_find("sd0"); device = rt_device_find("sd0");
} }
@ -54,7 +54,7 @@ static rt_err_t _sdcard_mount(void)
else else
{ {
LOG_W("sd card mount to '/' failed!"); LOG_W("sd card mount to '/' failed!");
return RT_ERROR; return -RT_ERROR;
} }
} }

View File

@ -408,7 +408,7 @@ static rt_err_t uart03_configure(struct rt_serial_device *serial, struct serial_
uart->uart_regs->ESCR_f.ESBL = 1; uart->uart_regs->ESCR_f.ESBL = 1;
break; break;
default: default:
return RT_ERROR; return -RT_ERROR;
} }
/* set data bits */ /* set data bits */
@ -440,7 +440,7 @@ static rt_err_t uart03_configure(struct rt_serial_device *serial, struct serial_
uart->uart_regs->ESCR_f.L2 = 1; uart->uart_regs->ESCR_f.L2 = 1;
break; break;
default: default:
return RT_ERROR; return -RT_ERROR;
} }
/* set parity */ /* set parity */
@ -458,7 +458,7 @@ static rt_err_t uart03_configure(struct rt_serial_device *serial, struct serial_
uart->uart_regs->ESCR_f.P = 1; uart->uart_regs->ESCR_f.P = 1;
break; break;
default: default:
return RT_ERROR; return -RT_ERROR;
} }
/* set bit order */ /* set bit order */
@ -471,7 +471,7 @@ static rt_err_t uart03_configure(struct rt_serial_device *serial, struct serial_
uart->uart_regs->SMR_f.BDS = 1; uart->uart_regs->SMR_f.BDS = 1;
break; break;
default: default:
return RT_ERROR; return -RT_ERROR;
} }
/* set NRZ mode */ /* set NRZ mode */
@ -484,7 +484,7 @@ static rt_err_t uart03_configure(struct rt_serial_device *serial, struct serial_
uart->uart_regs->ESCR_f.INV = 1; uart->uart_regs->ESCR_f.INV = 1;
break; break;
default: default:
return RT_ERROR; return -RT_ERROR;
} }
uart->uart_regs->SCR = SCR_RXE | SCR_TXE | SCR_RIE; uart->uart_regs->SCR = SCR_RXE | SCR_TXE | SCR_RIE;
@ -588,7 +588,7 @@ static rt_err_t uart47_configure(struct rt_serial_device *serial, struct serial_
uart->uart_regs->ESCR_f.ESBL = 1; uart->uart_regs->ESCR_f.ESBL = 1;
break; break;
default: default:
return RT_ERROR; return -RT_ERROR;
} }
/* set data bits */ /* set data bits */
@ -620,7 +620,7 @@ static rt_err_t uart47_configure(struct rt_serial_device *serial, struct serial_
uart->uart_regs->ESCR_f.L2 = 1; uart->uart_regs->ESCR_f.L2 = 1;
break; break;
default: default:
return RT_ERROR; return -RT_ERROR;
} }
/* set parity */ /* set parity */
@ -638,7 +638,7 @@ static rt_err_t uart47_configure(struct rt_serial_device *serial, struct serial_
uart->uart_regs->ESCR_f.P = 1; uart->uart_regs->ESCR_f.P = 1;
break; break;
default: default:
return RT_ERROR; return -RT_ERROR;
} }
/* set bit order */ /* set bit order */
@ -651,7 +651,7 @@ static rt_err_t uart47_configure(struct rt_serial_device *serial, struct serial_
uart->uart_regs->SMR_f.BDS = 1; uart->uart_regs->SMR_f.BDS = 1;
break; break;
default: default:
return RT_ERROR; return -RT_ERROR;
} }
/* set NRZ mode */ /* set NRZ mode */
@ -664,7 +664,7 @@ static rt_err_t uart47_configure(struct rt_serial_device *serial, struct serial_
uart->uart_regs->ESCR_f.INV = 1; uart->uart_regs->ESCR_f.INV = 1;
break; break;
default: default:
return RT_ERROR; return -RT_ERROR;
} }
/* configure fifo */ /* configure fifo */

View File

@ -59,7 +59,7 @@ static int rt_hw_spi_flash_with_sfud_init(void)
{ {
if (RT_NULL == rt_sfud_flash_probe(SPI_FLASH_CHIP, SPI_FLASH_DEVICE_NAME)) if (RT_NULL == rt_sfud_flash_probe(SPI_FLASH_CHIP, SPI_FLASH_DEVICE_NAME))
{ {
return RT_ERROR; return -RT_ERROR;
}; };
return RT_EOK; return RT_EOK;

View File

@ -229,7 +229,7 @@ static rt_ssize_t gd32_i2c_xfer(struct rt_i2c_bus_device *bus, struct rt_i2c_msg
{ {
struct rt_i2c_msg *msg; struct rt_i2c_msg *msg;
rt_uint32_t i; rt_uint32_t i;
rt_err_t ret = RT_ERROR; rt_err_t ret = -RT_ERROR;
struct gd32_i2c_bus *gd32_i2c = (struct gd32_i2c_bus *)bus; struct gd32_i2c_bus *gd32_i2c = (struct gd32_i2c_bus *)bus;

View File

@ -43,7 +43,7 @@ static int rt_hw_spi_flash_with_sfud_init(void)
{ {
if (RT_NULL == rt_sfud_flash_probe(SPI_FLASH_DEVICE_NAME, SPI_DEVICE_NAME)) if (RT_NULL == rt_sfud_flash_probe(SPI_FLASH_DEVICE_NAME, SPI_DEVICE_NAME))
{ {
return RT_ERROR; return -RT_ERROR;
} }
return RT_EOK; return RT_EOK;

View File

@ -229,7 +229,7 @@ static rt_ssize_t gd32_i2c_xfer(struct rt_i2c_bus_device *bus, struct rt_i2c_msg
{ {
struct rt_i2c_msg *msg; struct rt_i2c_msg *msg;
rt_uint32_t i; rt_uint32_t i;
rt_err_t ret = RT_ERROR; rt_err_t ret = -RT_ERROR;
struct gd32_i2c_bus *gd32_i2c = (struct gd32_i2c_bus *)bus; struct gd32_i2c_bus *gd32_i2c = (struct gd32_i2c_bus *)bus;

View File

@ -43,7 +43,7 @@ static int rt_hw_spi_flash_with_sfud_init(void)
{ {
if (RT_NULL == rt_sfud_flash_probe(SPI_FLASH_DEVICE_NAME, SPI_DEVICE_NAME)) if (RT_NULL == rt_sfud_flash_probe(SPI_FLASH_DEVICE_NAME, SPI_DEVICE_NAME))
{ {
return RT_ERROR; return -RT_ERROR;
} }
return RT_EOK; return RT_EOK;

View File

@ -230,7 +230,7 @@ static rt_ssize_t gd32_i2c_xfer(struct rt_i2c_bus_device *bus, struct rt_i2c_msg
{ {
struct rt_i2c_msg *msg; struct rt_i2c_msg *msg;
rt_uint32_t i; rt_uint32_t i;
rt_err_t ret = RT_ERROR; rt_err_t ret = -RT_ERROR;
struct gd32_i2c_bus *gd32_i2c = (struct gd32_i2c_bus *)bus; struct gd32_i2c_bus *gd32_i2c = (struct gd32_i2c_bus *)bus;

View File

@ -44,7 +44,7 @@ static int rt_hw_spi_flash_with_sfud_init(void)
{ {
if (RT_NULL == rt_sfud_flash_probe(SPI_FLASH_DEVICE_NAME, SPI_DEVICE_NAME)) if (RT_NULL == rt_sfud_flash_probe(SPI_FLASH_DEVICE_NAME, SPI_DEVICE_NAME))
{ {
return RT_ERROR; return -RT_ERROR;
} }
return RT_EOK; return RT_EOK;

View File

@ -320,6 +320,6 @@ rt_err_t gd32_spi_bus_register(uint32_t spi_periph,
} }
} }
return RT_ERROR; return -RT_ERROR;
} }
#endif #endif

View File

@ -76,7 +76,7 @@ static int rt_hw_spi_flash_with_sfud_init(void)
{ {
if (RT_NULL == rt_sfud_flash_probe(SPI_FLASH_CHIP, SPI_FLASH_DEVICE_NAME)) if (RT_NULL == rt_sfud_flash_probe(SPI_FLASH_CHIP, SPI_FLASH_DEVICE_NAME))
{ {
return RT_ERROR; return -RT_ERROR;
}; };
return RT_EOK; return RT_EOK;

View File

@ -231,7 +231,7 @@ static rt_ssize_t gd32_i2c_xfer(struct rt_i2c_bus_device *bus, struct rt_i2c_msg
{ {
struct rt_i2c_msg *msg; struct rt_i2c_msg *msg;
rt_uint32_t i; rt_uint32_t i;
rt_err_t ret = RT_ERROR; rt_err_t ret = -RT_ERROR;
struct gd32_i2c_bus *gd32_i2c = (struct gd32_i2c_bus *)bus; struct gd32_i2c_bus *gd32_i2c = (struct gd32_i2c_bus *)bus;

View File

@ -156,7 +156,7 @@ rt_err_t TCA9539_WritePin(uint8_t u8Port, uint8_t u8Pin, uint8_t u8PinState)
u8TempData[0] = u8Port + TCA9539_REG_OUTPUT_PORT0; u8TempData[0] = u8Port + TCA9539_REG_OUTPUT_PORT0;
if (RT_EOK != BSP_TCA9539_I2C_Read(i2c_bus, u8TempData[0], &u8TempData[1], 1U)) if (RT_EOK != BSP_TCA9539_I2C_Read(i2c_bus, u8TempData[0], &u8TempData[1], 1U))
{ {
return RT_ERROR; return -RT_ERROR;
} }
if (0U == u8PinState) if (0U == u8PinState)
{ {
@ -168,7 +168,7 @@ rt_err_t TCA9539_WritePin(uint8_t u8Port, uint8_t u8Pin, uint8_t u8PinState)
} }
if (RT_EOK != BSP_TCA9539_I2C_Write(i2c_bus, u8TempData[0], &u8TempData[1], 1U)) if (RT_EOK != BSP_TCA9539_I2C_Write(i2c_bus, u8TempData[0], &u8TempData[1], 1U))
{ {
return RT_ERROR; return -RT_ERROR;
} }
return RT_EOK; return RT_EOK;
@ -196,7 +196,7 @@ rt_err_t TCA9539_ReadPin(uint8_t u8Port, uint8_t u8Pin, uint8_t *pu8PinState)
u8TempData[0] = u8Port + TCA9539_REG_INPUT_PORT0; u8TempData[0] = u8Port + TCA9539_REG_INPUT_PORT0;
if (RT_EOK != BSP_TCA9539_I2C_Read(i2c_bus, u8TempData[0], &u8TempData[1], 1U)) if (RT_EOK != BSP_TCA9539_I2C_Read(i2c_bus, u8TempData[0], &u8TempData[1], 1U))
{ {
return RT_ERROR; return -RT_ERROR;
} }
if (0U != (u8TempData[1] & u8Pin)) if (0U != (u8TempData[1] & u8Pin))
{ {
@ -219,7 +219,7 @@ rt_err_t TCA9539_ReadPin(uint8_t u8Port, uint8_t u8Pin, uint8_t *pu8PinState)
* This parameter can be one or any combination of the following values: * This parameter can be one or any combination of the following values:
* @arg @ref TCA9539_Pin_Definition * @arg @ref TCA9539_Pin_Definition
* @retval rt_err_t: * @retval rt_err_t:
* - RT_ERROR * - -RT_ERROR
* - RT_EOK * - RT_EOK
*/ */
rt_err_t TCA9539_TogglePin(uint8_t u8Port, uint8_t u8Pin) rt_err_t TCA9539_TogglePin(uint8_t u8Port, uint8_t u8Pin)
@ -229,12 +229,12 @@ rt_err_t TCA9539_TogglePin(uint8_t u8Port, uint8_t u8Pin)
u8TempData[0] = u8Port + TCA9539_REG_OUTPUT_PORT0; u8TempData[0] = u8Port + TCA9539_REG_OUTPUT_PORT0;
if (RT_EOK != BSP_TCA9539_I2C_Read(i2c_bus, u8TempData[0], &u8TempData[1], 1U)) if (RT_EOK != BSP_TCA9539_I2C_Read(i2c_bus, u8TempData[0], &u8TempData[1], 1U))
{ {
return RT_ERROR; return -RT_ERROR;
} }
u8TempData[1] ^= u8Pin; u8TempData[1] ^= u8Pin;
if (RT_EOK != BSP_TCA9539_I2C_Write(i2c_bus, u8TempData[0], &u8TempData[1], 1U)) if (RT_EOK != BSP_TCA9539_I2C_Write(i2c_bus, u8TempData[0], &u8TempData[1], 1U))
{ {
return RT_ERROR; return -RT_ERROR;
} }
return RT_EOK; return RT_EOK;
@ -252,7 +252,7 @@ rt_err_t TCA9539_TogglePin(uint8_t u8Port, uint8_t u8Pin)
* This parameter can be one of the following values: * This parameter can be one of the following values:
* @arg @ref TCA9539_Direction_Definition * @arg @ref TCA9539_Direction_Definition
* @retval rt_err_t: * @retval rt_err_t:
* - RT_ERROR * - -RT_ERROR
* - RT_EOK * - RT_EOK
*/ */
rt_err_t TCA9539_ConfigPin(uint8_t u8Port, uint8_t u8Pin, uint8_t u8Dir) rt_err_t TCA9539_ConfigPin(uint8_t u8Port, uint8_t u8Pin, uint8_t u8Dir)
@ -262,7 +262,7 @@ rt_err_t TCA9539_ConfigPin(uint8_t u8Port, uint8_t u8Pin, uint8_t u8Dir)
u8TempData[0] = u8Port + TCA9539_REG_CONFIG_PORT0; u8TempData[0] = u8Port + TCA9539_REG_CONFIG_PORT0;
if (RT_EOK != BSP_TCA9539_I2C_Read(i2c_bus, u8TempData[0], &u8TempData[1], 1U)) if (RT_EOK != BSP_TCA9539_I2C_Read(i2c_bus, u8TempData[0], &u8TempData[1], 1U))
{ {
return RT_ERROR; return -RT_ERROR;
} }
if (TCA9539_DIR_OUT == u8Dir) if (TCA9539_DIR_OUT == u8Dir)
{ {
@ -274,7 +274,7 @@ rt_err_t TCA9539_ConfigPin(uint8_t u8Port, uint8_t u8Pin, uint8_t u8Dir)
} }
if (RT_EOK != BSP_TCA9539_I2C_Write(i2c_bus, u8TempData[0], &u8TempData[1], 1U)) if (RT_EOK != BSP_TCA9539_I2C_Write(i2c_bus, u8TempData[0], &u8TempData[1], 1U))
{ {
return RT_ERROR; return -RT_ERROR;
} }
return RT_EOK; return RT_EOK;
@ -284,7 +284,7 @@ rt_err_t TCA9539_ConfigPin(uint8_t u8Port, uint8_t u8Pin, uint8_t u8Dir)
* @brief Initialize TCA9539. * @brief Initialize TCA9539.
* @param [in] None * @param [in] None
* @retval rt_err_t: * @retval rt_err_t:
* - RT_ERROR * - -RT_ERROR
* - RT_EOK * - RT_EOK
*/ */
int TCA9539_Init(void) int TCA9539_Init(void)
@ -298,19 +298,19 @@ int TCA9539_Init(void)
if (i2c_bus == RT_NULL) if (i2c_bus == RT_NULL)
{ {
rt_kprintf("can't find %s device!\n", BSP_TCA9539_I2C_BUS_NAME); rt_kprintf("can't find %s device!\n", BSP_TCA9539_I2C_BUS_NAME);
return RT_ERROR; return -RT_ERROR;
} }
/* All Pins are input as default */ /* All Pins are input as default */
u8TempData[0] = TCA9539_REG_CONFIG_PORT0; u8TempData[0] = TCA9539_REG_CONFIG_PORT0;
u8TempData[1] = 0xFFU; u8TempData[1] = 0xFFU;
if (RT_EOK != BSP_TCA9539_I2C_Write(i2c_bus, u8TempData[0], &u8TempData[1], 1U)) if (RT_EOK != BSP_TCA9539_I2C_Write(i2c_bus, u8TempData[0], &u8TempData[1], 1U))
{ {
return RT_ERROR; return -RT_ERROR;
} }
u8TempData[0] = TCA9539_REG_CONFIG_PORT1; u8TempData[0] = TCA9539_REG_CONFIG_PORT1;
if (RT_EOK != BSP_TCA9539_I2C_Write(i2c_bus, u8TempData[0], &u8TempData[1], 1U)) if (RT_EOK != BSP_TCA9539_I2C_Write(i2c_bus, u8TempData[0], &u8TempData[1], 1U))
{ {
return RT_ERROR; return -RT_ERROR;
} }
return RT_EOK; return RT_EOK;

View File

@ -160,7 +160,7 @@ static rt_err_t _adc_enable(struct rt_adc_device *device, rt_uint32_t channel, r
static rt_err_t _adc_convert(struct rt_adc_device *device, rt_uint32_t channel, rt_uint32_t *value) static rt_err_t _adc_convert(struct rt_adc_device *device, rt_uint32_t channel, rt_uint32_t *value)
{ {
rt_err_t rt_ret = RT_ERROR; rt_err_t rt_ret = -RT_ERROR;
if (!value) if (!value)
{ {

View File

@ -390,7 +390,7 @@ static int _can_sendmsg(struct rt_can_device *can, const void *buf, rt_uint32_t
ll_ret = CAN_FillTxFrame(p_can_dev->instance, CAN_TX_BUF_PTB, &stc_tx_frame); ll_ret = CAN_FillTxFrame(p_can_dev->instance, CAN_TX_BUF_PTB, &stc_tx_frame);
if (ll_ret != LL_OK) if (ll_ret != LL_OK)
{ {
return RT_ERROR; return -RT_ERROR;
} }
/* Request transmission */ /* Request transmission */
CAN_StartTx(p_can_dev->instance, CAN_TX_REQ_PTB); CAN_StartTx(p_can_dev->instance, CAN_TX_REQ_PTB);

View File

@ -219,7 +219,7 @@ static rt_err_t rt_hc32_eth_control(rt_device_t dev, int cmd, void *args)
/* transmit data*/ /* transmit data*/
rt_err_t rt_hc32_eth_tx(rt_device_t dev, struct pbuf *p) rt_err_t rt_hc32_eth_tx(rt_device_t dev, struct pbuf *p)
{ {
rt_err_t errval = RT_ERROR; rt_err_t errval = -RT_ERROR;
struct pbuf *q; struct pbuf *q;
uint8_t *txBuffer; uint8_t *txBuffer;
__IO stc_eth_dma_desc_t *DmaTxDesc; __IO stc_eth_dma_desc_t *DmaTxDesc;

View File

@ -176,7 +176,7 @@ static rt_err_t drv_pwm_set(CM_TMRA_TypeDef *TMRAx, struct rt_pwm_configuration
if (u64val < 0xFFFF) break; if (u64val < 0xFFFF) break;
u64val /= 2; u64val /= 2;
} }
if (div_bit > 10) return RT_ERROR; if (div_bit > 10) return -RT_ERROR;
// //
TMRA_SetClockDiv(TMRAx, div_bit << TMRA_BCSTR_CKDIV_POS); TMRA_SetClockDiv(TMRAx, div_bit << TMRA_BCSTR_CKDIV_POS);
u32clkFreq = get_tmra_clk_freq(TMRAx); u32clkFreq = get_tmra_clk_freq(TMRAx);

View File

@ -272,7 +272,7 @@ static void phy_monitor_thread_entry(void *args)
int phy_device_register(void) int phy_device_register(void)
{ {
rt_err_t err = RT_ERROR; rt_err_t err = -RT_ERROR;
rt_thread_t thread_phy_monitor; rt_thread_t thread_phy_monitor;
/* Set ops for PHY */ /* Set ops for PHY */
@ -308,7 +308,7 @@ int phy_device_register(void)
} }
else else
{ {
err = RT_ERROR; err = -RT_ERROR;
} }
return err; return err;

View File

@ -251,7 +251,7 @@ static void phy_monitor_thread_entry(void *args)
int phy_device_register(void) int phy_device_register(void)
{ {
rt_err_t err = RT_ERROR; rt_err_t err = -RT_ERROR;
rt_thread_t thread_phy_monitor; rt_thread_t thread_phy_monitor;
/* Set ops for PHY */ /* Set ops for PHY */
@ -287,7 +287,7 @@ int phy_device_register(void)
} }
else else
{ {
err = RT_ERROR; err = -RT_ERROR;
} }
return err; return err;

View File

@ -99,7 +99,7 @@ static rt_err_t init_adc_config(hpm_rtt_adc *adc)
cfg.adc_clk_div = 1; cfg.adc_clk_div = 1;
ret = adc12_init(adc->adc_base, &cfg); ret = adc12_init(adc->adc_base, &cfg);
if (ret != status_success) { if (ret != status_success) {
return RT_ERROR; return -RT_ERROR;
} }
#endif #endif
@ -113,7 +113,7 @@ static rt_err_t init_adc_config(hpm_rtt_adc *adc)
cfg.sel_sync_ahb = true; cfg.sel_sync_ahb = true;
ret = adc16_init(adc->adc_base, &cfg); ret = adc16_init(adc->adc_base, &cfg);
if (ret != status_success) { if (ret != status_success) {
return RT_ERROR; return -RT_ERROR;
} }
#endif #endif
return RT_EOK; return RT_EOK;
@ -131,7 +131,7 @@ static rt_err_t init_channel_config(hpm_rtt_adc *adc)
ret = adc12_init_channel(adc->adc_base, &ch_cfg); ret = adc12_init_channel(adc->adc_base, &ch_cfg);
if (ret != status_success) { if (ret != status_success) {
return RT_ERROR; return -RT_ERROR;
} }
#endif #endif
@ -145,7 +145,7 @@ static rt_err_t init_channel_config(hpm_rtt_adc *adc)
ret = adc16_init_channel(adc->adc_base, &ch_cfg); ret = adc16_init_channel(adc->adc_base, &ch_cfg);
if (ret != status_success) { if (ret != status_success) {
return RT_ERROR; return -RT_ERROR;
} }
#endif #endif
return RT_EOK; return RT_EOK;
@ -160,12 +160,12 @@ static rt_err_t hpm_adc_enabled(struct rt_adc_device *device, rt_uint32_t channe
hpm_adc_handler = (hpm_rtt_adc *)device->parent.user_data; hpm_adc_handler = (hpm_rtt_adc *)device->parent.user_data;
ret = init_adc_config(hpm_adc_handler); ret = init_adc_config(hpm_adc_handler);
if (ret != RT_EOK) { if (ret != RT_EOK) {
return RT_ERROR; return -RT_ERROR;
} }
hpm_adc_handler->channel = channel; hpm_adc_handler->channel = channel;
ret = init_channel_config(hpm_adc_handler); ret = init_channel_config(hpm_adc_handler);
if (ret != RT_EOK) { if (ret != RT_EOK) {
return RT_ERROR; return -RT_ERROR;
} }
return RT_EOK; return RT_EOK;
@ -208,7 +208,7 @@ int rt_hw_adc_init(void)
for (uint32_t i = 0; i < adc_nums; i++) { for (uint32_t i = 0; i < adc_nums; i++) {
ret = rt_hw_adc_register(&hpm_adc_config_tbl[i].hpm_adc_device, hpm_adc_config_tbl[i].adc_name, &hpm_adc_ops, &hpm_adc_config_tbl[i]); ret = rt_hw_adc_register(&hpm_adc_config_tbl[i].hpm_adc_device, hpm_adc_config_tbl[i].adc_name, &hpm_adc_ops, &hpm_adc_config_tbl[i]);
if (ret != RT_EOK) { if (ret != RT_EOK) {
ret = RT_ERROR; ret = -RT_ERROR;
break; break;
} }
} }

View File

@ -239,7 +239,7 @@ static rt_err_t rt_hpm_eth_control(rt_device_t dev, int cmd, void * args)
static rt_err_t rt_hpm_eth_tx(rt_device_t dev, struct pbuf * p) static rt_err_t rt_hpm_eth_tx(rt_device_t dev, struct pbuf * p)
{ {
rt_err_t ret = RT_ERROR; rt_err_t ret = -RT_ERROR;
uint32_t status; uint32_t status;
enet_device *enet_dev = (enet_device *)dev->user_data; enet_device *enet_dev = (enet_device *)dev->user_data;
uint32_t tx_buff_size = enet_dev->desc.tx_buff_cfg.size; uint32_t tx_buff_size = enet_dev->desc.tx_buff_cfg.size;
@ -436,7 +436,7 @@ SDK_DECLARE_EXT_ISR_M(IRQn_ENET1, isr_enet1)
int rt_hw_eth_init(void) int rt_hw_eth_init(void)
{ {
rt_err_t err = RT_ERROR; rt_err_t err = -RT_ERROR;
for (uint32_t i = 0; i < ARRAY_SIZE(s_geths); i++) for (uint32_t i = 0; i < ARRAY_SIZE(s_geths); i++)
{ {

View File

@ -74,7 +74,7 @@ static rt_ssize_t hpm_i2c_master_transfer(struct rt_i2c_bus_device *bus, struct
struct hpm_i2c *i2c_info = (struct hpm_i2c *)bus; struct hpm_i2c *i2c_info = (struct hpm_i2c *)bus;
hpm_stat_t i2c_stat = status_success; hpm_stat_t i2c_stat = status_success;
rt_err_t ret = RT_ERROR; rt_err_t ret = -RT_ERROR;
rt_uint32_t i; rt_uint32_t i;
for (i = 0; i < num; i++) for (i = 0; i < num; i++)

View File

@ -434,7 +434,7 @@ static rt_err_t hpm_i2s_start(struct rt_audio_device* audio, int stream)
} }
if (RT_EOK != hpm_i2s_transmit(&hpm_audio->audio, NULL, hpm_audio->rx_buff, I2S_FIFO_SIZE)) { if (RT_EOK != hpm_i2s_transmit(&hpm_audio->audio, NULL, hpm_audio->rx_buff, I2S_FIFO_SIZE)) {
return RT_ERROR; return -RT_ERROR;
} }
} else { } else {
return -RT_ERROR; return -RT_ERROR;

View File

@ -217,7 +217,7 @@ static rt_err_t hpm_pdm_start(struct rt_audio_device* audio, int stream)
} }
if (RT_EOK != hpm_pdm_dma_transmit()) { if (RT_EOK != hpm_pdm_dma_transmit()) {
return RT_ERROR; return -RT_ERROR;
} }
} }
@ -254,7 +254,7 @@ static rt_err_t hpm_pdm_dma_transmit()
if (status_success != dma_setup_channel(dma_resource.base, dma_resource.channel, &ch_config)) { if (status_success != dma_setup_channel(dma_resource.base, dma_resource.channel, &ch_config)) {
LOG_E("dma setup channel failed\n"); LOG_E("dma setup channel failed\n");
return RT_ERROR; return -RT_ERROR;
} }
if (l1c_dc_is_enabled()) { if (l1c_dc_is_enabled()) {

View File

@ -704,7 +704,7 @@ hpm_stat_t hpm_uart_dma_tx_init(struct hpm_uart *uart_ctx)
return status; return status;
} }
static int hpm_uart_dma_config(struct rt_serial_device *serial, void *arg) static rt_err_t hpm_uart_dma_config(struct rt_serial_device *serial, void *arg)
{ {
rt_ubase_t ctrl_arg = (rt_ubase_t) arg; rt_ubase_t ctrl_arg = (rt_ubase_t) arg;
struct hpm_uart *uart = (struct hpm_uart *)serial->parent.user_data; struct hpm_uart *uart = (struct hpm_uart *)serial->parent.user_data;
@ -720,7 +720,7 @@ static int hpm_uart_dma_config(struct rt_serial_device *serial, void *arg)
config.src_fixed = true; config.src_fixed = true;
config.size_in_byte = serial->config.rx_bufsz; config.size_in_byte = serial->config.rx_bufsz;
if (status_success != dma_setup_handshake(uart->rx_chn_ctx.resource.base, &config)) { if (status_success != dma_setup_handshake(uart->rx_chn_ctx.resource.base, &config)) {
return RT_ERROR; return -RT_ERROR;
} }
uint32_t mux = DMA_SOC_CHN_TO_DMAMUX_CHN(uart->rx_chn_ctx.resource.base, uart->rx_dma_mux); uint32_t mux = DMA_SOC_CHN_TO_DMAMUX_CHN(uart->rx_chn_ctx.resource.base, uart->rx_dma_mux);
dmamux_config(BOARD_UART_DMAMUX, uart->rx_chn_ctx.resource.channel, mux, true); dmamux_config(BOARD_UART_DMAMUX, uart->rx_chn_ctx.resource.channel, mux, true);
@ -1288,7 +1288,7 @@ int rt_hw_uart_init(void)
} }
if (RT_EOK != hpm_uart_config()) { if (RT_EOK != hpm_uart_config()) {
return RT_ERROR; return -RT_ERROR;
} }
for (uint32_t i = 0; i < sizeof(uarts) / sizeof(uarts[0]); i++) { for (uint32_t i = 0; i < sizeof(uarts) / sizeof(uarts[0]); i++) {

View File

@ -263,7 +263,7 @@ static rt_err_t can_control(struct rt_can_device *can_dev, int cmd, void *arg)
if (filter_mask == 0xffffffff) if (filter_mask == 0xffffffff)
{ {
LOG_E("%s filter is full!\n", can->name); LOG_E("%s filter is full!\n", can->name);
res = RT_ERROR; res = -RT_ERROR;
break; break;
} }
else if (filter_mask == 0) else if (filter_mask == 0)
@ -316,7 +316,7 @@ static rt_err_t can_control(struct rt_can_device *can_dev, int cmd, void *arg)
{ {
if (filter_mask & (1 << item->hdr_bank)) if (filter_mask & (1 << item->hdr_bank))
{ {
res = RT_ERROR; res = -RT_ERROR;
LOG_E("%s hdr%d filter already set!\n", can->name, item->hdr_bank); LOG_E("%s hdr%d filter already set!\n", can->name, item->hdr_bank);
break; break;
} }
@ -338,28 +338,28 @@ static rt_err_t can_control(struct rt_can_device *can_dev, int cmd, void *arg)
break; break;
case RT_CAN_CMD_SET_BAUD: case RT_CAN_CMD_SET_BAUD:
res = RT_ERROR; res = -RT_ERROR;
break; break;
case RT_CAN_CMD_SET_MODE: case RT_CAN_CMD_SET_MODE:
res = RT_ERROR; res = -RT_ERROR;
break; break;
case RT_CAN_CMD_SET_PRIV: case RT_CAN_CMD_SET_PRIV:
res = RT_ERROR; res = -RT_ERROR;
break; break;
case RT_CAN_CMD_GET_STATUS: case RT_CAN_CMD_GET_STATUS:
FLEXCAN_GetBusErrCount(can->base, (rt_uint8_t *)(&can->can_dev.status.snderrcnt), (rt_uint8_t *)(&can->can_dev.status.rcverrcnt)); FLEXCAN_GetBusErrCount(can->base, (rt_uint8_t *)(&can->can_dev.status.snderrcnt), (rt_uint8_t *)(&can->can_dev.status.rcverrcnt));
rt_memcpy(arg, &can->can_dev.status, sizeof(can->can_dev.status)); rt_memcpy(arg, &can->can_dev.status, sizeof(can->can_dev.status));
break; break;
default: default:
res = RT_ERROR; res = -RT_ERROR;
break; break;
} }
return res; return res;
} }
static int can_send(struct rt_can_device *can_dev, const void *buf, rt_uint32_t boxno) static rt_ssize_t can_send(struct rt_can_device *can_dev, const void *buf, rt_uint32_t boxno)
{ {
struct imxrt_can *can; struct imxrt_can *can;
struct rt_can_msg *msg; struct rt_can_msg *msg;
@ -420,14 +420,14 @@ static int can_send(struct rt_can_device *can_dev, const void *buf, rt_uint32_t
ret = RT_EOK; ret = RT_EOK;
break; break;
case kStatus_Fail: case kStatus_Fail:
ret = RT_ERROR; ret = -RT_ERROR;
break; break;
case kStatus_FLEXCAN_TxBusy: case kStatus_FLEXCAN_TxBusy:
ret = RT_EBUSY; ret = -RT_EBUSY;
break; break;
} }
return ret; return (rt_ssize_t)ret;
} }
static int can_recv(struct rt_can_device *can_dev, void *buf, rt_uint32_t boxno) static int can_recv(struct rt_can_device *can_dev, void *buf, rt_uint32_t boxno)

View File

@ -375,7 +375,7 @@ static rt_err_t imxrt_i2c_bus_control(struct rt_i2c_bus_device *bus,
rt_uint32_t cmd, rt_uint32_t cmd,
rt_uint32_t arg) rt_uint32_t arg)
{ {
return RT_ERROR; return -RT_ERROR;
} }
#endif #endif

View File

@ -183,7 +183,7 @@ static int rtc_sample(int argc, char *argv[])
if (!device) if (!device)
{ {
LOG_E("find %s failed!", RTC_NAME); LOG_E("find %s failed!", RTC_NAME);
return RT_ERROR; return -RT_ERROR;
} }
if(rt_device_open(device, 0) != RT_EOK) if(rt_device_open(device, 0) != RT_EOK)

View File

@ -220,7 +220,7 @@ static rt_err_t drv_ehci0_usbd_init(rt_device_t device)
else else
{ {
rt_kprintf("USB_DeviceInit ehci0 error\r\n"); rt_kprintf("USB_DeviceInit ehci0 error\r\n");
return RT_ERROR; return -RT_ERROR;
} }
return RT_EOK; return RT_EOK;
} }

View File

@ -390,7 +390,7 @@ static rt_err_t drv_lcd_init(rt_device_t dev)
if(!lcd) if(!lcd)
{ {
return RT_ERROR; return -RT_ERROR;
} }
drv_lcd_hw_init(lcd); drv_lcd_hw_init(lcd);
/* reset LCD */ /* reset LCD */

View File

@ -134,7 +134,7 @@ static rt_err_t rt_dc_init(rt_device_t dev)
if (mode<0) if (mode<0)
{ {
rt_kprintf("\n\n\nunsupported framebuffer resolution\n\n\n"); rt_kprintf("\n\n\nunsupported framebuffer resolution\n\n\n");
return RT_ERROR; return -RT_ERROR;
} }
DC_FB_CONFIG = 0x0; DC_FB_CONFIG = 0x0;

View File

@ -276,7 +276,7 @@ static rt_err_t control(struct rt_can_device *can, int cmd, void *arg)
argval != RT_CAN_MODE_LOOPBACK || argval != RT_CAN_MODE_LOOPBACK ||
argval != RT_CAN_MODE_LOOPBACKANLISTEN) argval != RT_CAN_MODE_LOOPBACKANLISTEN)
{ {
return RT_ERROR; return -RT_ERROR;
} }
if (argval != can->config.mode) if (argval != can->config.mode)
{ {
@ -294,7 +294,7 @@ static rt_err_t control(struct rt_can_device *can, int cmd, void *arg)
argval != CAN100kBaud && argval != CAN100kBaud &&
argval != CAN50kBaud ) argval != CAN50kBaud )
{ {
return RT_ERROR; return -RT_ERROR;
} }
if (argval != can->config.baud_rate) if (argval != can->config.baud_rate)
{ {

View File

@ -229,7 +229,7 @@ static int rt_touch_init(void)
return rt_thread_startup(thread); return rt_thread_startup(thread);
} }
return RT_ERROR; return -RT_ERROR;
} }
INIT_APP_EXPORT(rt_touch_init); INIT_APP_EXPORT(rt_touch_init);

View File

@ -36,7 +36,7 @@ static rt_err_t wdt_stop(void)
if (ret != RT_EOK) if (ret != RT_EOK)
{ {
rt_kprintf("Wdog_Disable error!\n"); rt_kprintf("Wdog_Disable error!\n");
return RT_ERROR; return -RT_ERROR;
} }
return ret; return ret;
} }
@ -50,7 +50,7 @@ static rt_err_t wdt_start(int mode)
if (ret != RT_EOK) if (ret != RT_EOK)
{ {
rt_kprintf("Wdog_Disable error!\n"); rt_kprintf("Wdog_Disable error!\n");
return RT_ERROR; return -RT_ERROR;
} }
if((mode == RESTENABLE) || (mode == INTERRUPTENABLE)) if((mode == RESTENABLE) || (mode == INTERRUPTENABLE))
@ -62,7 +62,7 @@ static rt_err_t wdt_start(int mode)
if (ret != RT_EOK) if (ret != RT_EOK)
{ {
rt_kprintf("Wdog_Enable error!\n"); rt_kprintf("Wdog_Enable error!\n");
return RT_ERROR; return -RT_ERROR;
} }
return ret; return ret;
@ -79,7 +79,7 @@ static rt_err_t wdt_keepalive(void)
if (ret != 0) if (ret != 0)
{ {
rt_kprintf("LS1C_Wdog_ClrTimeout error!\n"); rt_kprintf("LS1C_Wdog_ClrTimeout error!\n");
return RT_ERROR; return -RT_ERROR;
} }
return ret; return ret;
@ -106,7 +106,7 @@ static rt_err_t wdt_set_timeout(rt_uint32_t second)
if (ret != RT_EOK) if (ret != RT_EOK)
{ {
rt_kprintf("Wdog_LoadValue error!\n"); rt_kprintf("Wdog_LoadValue error!\n");
return RT_ERROR; return -RT_ERROR;
} }
return ret; return ret;
} }

View File

@ -44,7 +44,7 @@ static rt_err_t ls2k_uart_set_buad(struct rt_serial_device *serial, struct seria
UART_LCR(uart_dev->base) = 0x80; // Activate buadcfg UART_LCR(uart_dev->base) = 0x80; // Activate buadcfg
UART_LSB(uart_dev->base) = brtc & 0xff; UART_LSB(uart_dev->base) = brtc & 0xff;
UART_MSB(uart_dev->base) = brtc >> 8; UART_MSB(uart_dev->base) = brtc >> 8;
if (((((short)UART_MSB(uart_dev->base)) << 8) | UART_LSB(uart_dev->base)) != brtc) ret = RT_ERROR; if (((((short)UART_MSB(uart_dev->base)) << 8) | UART_LSB(uart_dev->base)) != brtc) ret = -RT_ERROR;
UART_LCR(uart_dev->base) = CFCR_8BITS; // Back to normal UART_LCR(uart_dev->base) = CFCR_8BITS; // Back to normal
UART_MCR(uart_dev->base) = MCR_IENABLE/* | MCR_DTR | MCR_RTS*/; UART_MCR(uart_dev->base) = MCR_IENABLE/* | MCR_DTR | MCR_RTS*/;
UART_IER(uart_dev->base) = 0; UART_IER(uart_dev->base) = 0;

View File

@ -146,7 +146,7 @@ static int lpc_pin_read(rt_device_t dev, rt_base_t pin)
int portx, piny, value; int portx, piny, value;
if(pin > PIN_MAX_VAL) if(pin > PIN_MAX_VAL)
return RT_ERROR; return -RT_ERROR;
portx = get_port(pin); portx = get_port(pin);
piny = get_pin(pin); piny = get_pin(pin);
@ -187,7 +187,7 @@ static rt_err_t lpc_pin_attach_irq(struct rt_device *device, rt_int32_t pin,
int portx, piny, trigger_mode, pin_initx, pintsel, pin_cfg, i; int portx, piny, trigger_mode, pin_initx, pintsel, pin_cfg, i;
if(pin > PIN_MAX_VAL) if(pin > PIN_MAX_VAL)
return RT_ERROR; return -RT_ERROR;
portx = get_port(pin); portx = get_port(pin);
piny = get_pin(pin); piny = get_pin(pin);
@ -228,7 +228,7 @@ static rt_err_t lpc_pin_attach_irq(struct rt_device *device, rt_int32_t pin,
} }
if(i >= IRQ_MAX_VAL) if(i >= IRQ_MAX_VAL)
return RT_ERROR; return -RT_ERROR;
/* open clk */ /* open clk */
CLOCK_EnableClock(kCLOCK_InputMux); CLOCK_EnableClock(kCLOCK_InputMux);
@ -258,7 +258,7 @@ static rt_err_t lpc_pin_detach_irq(struct rt_device *device, rt_int32_t pin)
int i; int i;
if(pin > PIN_MAX_VAL) if(pin > PIN_MAX_VAL)
return RT_ERROR; return -RT_ERROR;
for(i = 0; i < IRQ_MAX_VAL; i++) for(i = 0; i < IRQ_MAX_VAL; i++)
{ {
@ -280,7 +280,7 @@ static rt_err_t lpc_pin_irq_enable(struct rt_device *device, rt_base_t pin,
int irqn_type, i; int irqn_type, i;
if(pin > PIN_MAX_VAL) if(pin > PIN_MAX_VAL)
return RT_ERROR; return -RT_ERROR;
for(i = 0; i < IRQ_MAX_VAL; i++) for(i = 0; i < IRQ_MAX_VAL; i++)
{ {
@ -318,7 +318,7 @@ static rt_err_t lpc_pin_irq_enable(struct rt_device *device, rt_base_t pin,
} }
if(i >= IRQ_MAX_VAL) if(i >= IRQ_MAX_VAL)
return RT_ERROR; return -RT_ERROR;
return RT_EOK; return RT_EOK;
} }

View File

@ -26,7 +26,7 @@ int rt_hw_flash_init(void)
if(rt_sfud_flash_probe("flash0", "spi20") == RT_NULL) if(rt_sfud_flash_probe("flash0", "spi20") == RT_NULL)
{ {
return RT_ERROR; return -RT_ERROR;
} }
return RT_EOK; return RT_EOK;

View File

@ -288,7 +288,7 @@ static rt_err_t lpc_emac_phy_init(phy_speed_t * speed, phy_duplex_t * duplex)
eth_device_linkchange(&lpc_emac_device.parent, RT_FALSE); eth_device_linkchange(&lpc_emac_device.parent, RT_FALSE);
ETH_PRINTF("PHY_Init failed!\n"); ETH_PRINTF("PHY_Init failed!\n");
return RT_ERROR; return -RT_ERROR;
} }
/* Wait for link up and get the actual PHY link speed. */ /* Wait for link up and get the actual PHY link speed. */
@ -428,7 +428,7 @@ rt_err_t lpc_emac_tx(rt_device_t dev, struct pbuf *p)
if (p->tot_len > ENET_TXBUFF_SIZE) if (p->tot_len > ENET_TXBUFF_SIZE)
{ {
return RT_ERROR; return -RT_ERROR;
} }
packet_dump("TX dump", p); packet_dump("TX dump", p);
@ -439,7 +439,7 @@ rt_err_t lpc_emac_tx(rt_device_t dev, struct pbuf *p)
result = rt_sem_take(&lpc_emac_device.tx_wait, RT_TICK_PER_SECOND/10); result = rt_sem_take(&lpc_emac_device.tx_wait, RT_TICK_PER_SECOND/10);
if (result != RT_EOK) if (result != RT_EOK)
{ {
return RT_ERROR; return -RT_ERROR;
} }
} }
@ -453,7 +453,7 @@ rt_err_t lpc_emac_tx(rt_device_t dev, struct pbuf *p)
if ((result == kStatus_ENET_TxFrameFail) || (result == kStatus_ENET_TxFrameOverLen) || (result == kStatus_ENET_TxFrameBusy)) if ((result == kStatus_ENET_TxFrameFail) || (result == kStatus_ENET_TxFrameOverLen) || (result == kStatus_ENET_TxFrameBusy))
{ {
return RT_ERROR; return -RT_ERROR;
} }
return RT_EOK; return RT_EOK;

View File

@ -149,7 +149,7 @@ static rt_ssize_t lpc_i2c_xfer(struct rt_i2c_bus_device *bus,
struct rt_i2c_msg *msg; struct rt_i2c_msg *msg;
i2c_master_transfer_t xfer = {0}; i2c_master_transfer_t xfer = {0};
rt_uint32_t i; rt_uint32_t i;
rt_err_t ret = RT_ERROR; rt_err_t ret = -RT_ERROR;
struct lpc_i2c_bus *lpc_i2c = (struct lpc_i2c_bus *)bus; struct lpc_i2c_bus *lpc_i2c = (struct lpc_i2c_bus *)bus;

View File

@ -89,7 +89,7 @@ static rt_ssize_t lpc_i2c_xfer(struct rt_i2c_bus_device *bus,
struct rt_i2c_msg *msg; struct rt_i2c_msg *msg;
i2c_master_transfer_t xfer = {0}; i2c_master_transfer_t xfer = {0};
rt_uint32_t i; rt_uint32_t i;
rt_err_t ret = RT_ERROR; rt_err_t ret = -RT_ERROR;
struct lpc_i2c_bus *lpc_i2c = (struct lpc_i2c_bus *)bus; struct lpc_i2c_bus *lpc_i2c = (struct lpc_i2c_bus *)bus;

View File

@ -118,7 +118,7 @@ int mma8562_hw_init(void)
if (val != kMMA8562_WHO_AM_I_Device_ID) if (val != kMMA8562_WHO_AM_I_Device_ID)
{ {
rt_kprintf("MMA8562: Unexpected result from WHO_AM_I (0x%02x)\n", val); rt_kprintf("MMA8562: Unexpected result from WHO_AM_I (0x%02x)\n", val);
return RT_ERROR; return -RT_ERROR;
} }
/* please refer to the "example FXOS8700CQ Driver Code" in FXOS8700 datasheet. */ /* please refer to the "example FXOS8700CQ Driver Code" in FXOS8700 datasheet. */

View File

@ -206,7 +206,7 @@ static rt_int8_t lpc_pin_read(rt_device_t dev, rt_base_t pin)
int value; int value;
if ((pin > __ARRAY_LEN(lpc_pin_map)) || (pin == 0)) if ((pin > __ARRAY_LEN(lpc_pin_map)) || (pin == 0))
{ {
return RT_ERROR; return -RT_ERROR;
} }
value = GPIO_PinRead(lpc_pin_map[pin].gpio, lpc_pin_map[pin].gpio_port, lpc_pin_map[pin].gpio_pin); value = GPIO_PinRead(lpc_pin_map[pin].gpio, lpc_pin_map[pin].gpio_port, lpc_pin_map[pin].gpio_pin);
@ -268,7 +268,7 @@ static rt_err_t lpc_pin_attach_irq(struct rt_device *device,
if ((pin > __ARRAY_LEN(lpc_pin_map)) || (pin == 0)) if ((pin > __ARRAY_LEN(lpc_pin_map)) || (pin == 0))
{ {
return RT_ERROR; return -RT_ERROR;
} }
switch (mode) switch (mode)
@ -307,7 +307,7 @@ static rt_err_t lpc_pin_attach_irq(struct rt_device *device,
} }
if(i >= IRQ_MAX_VAL) if(i >= IRQ_MAX_VAL)
return RT_ERROR; return -RT_ERROR;
/* Initialize PINT */ /* Initialize PINT */
PINT_Init(PINT); PINT_Init(PINT);
@ -342,7 +342,7 @@ static rt_err_t lpc_pin_detach_irq(struct rt_device *device, rt_base_t pin)
if ((pin > __ARRAY_LEN(lpc_pin_map)) || (pin == 0)) if ((pin > __ARRAY_LEN(lpc_pin_map)) || (pin == 0))
{ {
return RT_ERROR; return -RT_ERROR;
} }
for(i = 0; i < IRQ_MAX_VAL; i++) for(i = 0; i < IRQ_MAX_VAL; i++)
@ -365,7 +365,7 @@ static rt_err_t lpc_pin_irq_enable(struct rt_device *device, rt_base_t pin, rt_u
if ((pin > __ARRAY_LEN(lpc_pin_map)) || (pin == 0)) if ((pin > __ARRAY_LEN(lpc_pin_map)) || (pin == 0))
{ {
return RT_ERROR; return -RT_ERROR;
} }
for(i = 0; i < IRQ_MAX_VAL; i++) for(i = 0; i < IRQ_MAX_VAL; i++)
@ -404,7 +404,7 @@ static rt_err_t lpc_pin_irq_enable(struct rt_device *device, rt_base_t pin, rt_u
} }
if(i >= IRQ_MAX_VAL) if(i >= IRQ_MAX_VAL)
return RT_ERROR; return -RT_ERROR;
return RT_EOK; return RT_EOK;
} }

View File

@ -38,7 +38,7 @@ static struct mcu_drv_spi spi_bus_obj[sizeof(spi_config) / sizeof(spi_config[0])
* @brief This function config spi bus * @brief This function config spi bus
* @param device * @param device
* @param configuration * @param configuration
* @retval RT_EOK / RT_ERROR * @retval RT_EOK / -RT_ERROR
*/ */
static rt_err_t spi_configure(struct rt_spi_device *device, static rt_err_t spi_configure(struct rt_spi_device *device,
struct rt_spi_configuration *configuration) struct rt_spi_configuration *configuration)
@ -63,7 +63,7 @@ static rt_err_t spi_configure(struct rt_spi_device *device,
break; break;
default: default:
LOG_E("spi_configure mode error %x\n", configuration->mode); LOG_E("spi_configure mode error %x\n", configuration->mode);
return RT_ERROR; return -RT_ERROR;
} }
tmp_spi->spixfer_req.width = SPI17Y_WIDTH_1; tmp_spi->spixfer_req.width = SPI17Y_WIDTH_1;
@ -119,7 +119,7 @@ static const struct rt_spi_ops nrfx_spi_ops =
/*spi bus init*/ /*spi bus init*/
static int rt_hw_spi_bus_init(void) static int rt_hw_spi_bus_init(void)
{ {
rt_err_t result = RT_ERROR; rt_err_t result = -RT_ERROR;
for (int i = 0; i < sizeof(spi_config) / sizeof(spi_config[0]); i++) for (int i = 0; i < sizeof(spi_config) / sizeof(spi_config[0]); i++)
{ {
spi_bus_obj[i].spi_instance = spi_config[i].spi_instance; spi_bus_obj[i].spi_instance = spi_config[i].spi_instance;
@ -155,7 +155,7 @@ rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name,
if (result != RT_EOK) if (result != RT_EOK)
{ {
LOG_E("%s attach to %s faild, %d", device_name, bus_name, result); LOG_E("%s attach to %s faild, %d", device_name, bus_name, result);
result = RT_ERROR; result = -RT_ERROR;
} }
/* TODO: SET THE GPIO */ /* TODO: SET THE GPIO */

View File

@ -22,7 +22,7 @@
* @param bus_name spi bus name "spi0"/"spi1"/"spi2" * @param bus_name spi bus name "spi0"/"spi1"/"spi2"
* @param device_name spi device name "spi0x"/"spi1x"/"spi2x" * @param device_name spi device name "spi0x"/"spi1x"/"spi2x"
* @param ss_pin spi ss pin number * @param ss_pin spi ss pin number
* @retval RT_ERROR / RT_EOK * @retval -RT_ERROR / RT_EOK
*/ */
rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name, rt_uint32_t ss_pin); rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name, rt_uint32_t ss_pin);

View File

@ -266,7 +266,7 @@ static void can_thread_entry(void* parameter)
* *
* @param msg - message to be sent, timeouts - wait timeouts for Tx completion. * @param msg - message to be sent, timeouts - wait timeouts for Tx completion.
* *
* @return RT_OK or RT_ERROR. * @return RT_OK or -RT_ERROR.
*/ */
rt_err_t can_send_message(struct can_message *msg, rt_uint32_t timeouts) rt_err_t can_send_message(struct can_message *msg, rt_uint32_t timeouts)
@ -276,7 +276,7 @@ rt_err_t can_send_message(struct can_message *msg, rt_uint32_t timeouts)
if (RT_NULL == msg) if (RT_NULL == msg)
{ {
rt_kprintf("can_send_message input message error\r\n"); rt_kprintf("can_send_message input message error\r\n");
return RT_ERROR; return -RT_ERROR;
} }
can_async_write(&CAN_0, msg); can_async_write(&CAN_0, msg);

View File

@ -332,7 +332,7 @@ static void rt_sam_eth_monitor(void *parameter)
* *
* @param * @param
* *
* @return RT_OK or RT_ERROR. * @return RT_OK or -RT_ERROR.
*/ */
static int rt_hw_sam_eth_init(void) static int rt_hw_sam_eth_init(void)

View File

@ -93,7 +93,7 @@ static rt_err_t sam_i2c_bus_control(struct rt_i2c_bus_device *bus,
rt_uint32_t cmd, rt_uint32_t cmd,
rt_uint32_t arg) rt_uint32_t arg)
{ {
return RT_ERROR; return -RT_ERROR;
struct sam_i2c_bus *sam_i2c = (struct sam_i2c_bus *)bus; struct sam_i2c_bus *sam_i2c = (struct sam_i2c_bus *)bus;
RT_ASSERT(bus != RT_NULL); RT_ASSERT(bus != RT_NULL);

View File

@ -340,7 +340,7 @@ static rt_ssize_t rt_i2c_xfer(struct rt_i2c_bus_device *bus, struct rt_i2c_msg m
{ {
struct rt_i2c_msg *msg; struct rt_i2c_msg *msg;
rt_uint32_t i; rt_uint32_t i;
rt_err_t ret = RT_ERROR; rt_err_t ret = -RT_ERROR;
struct rt_i2c_bus *rt_i2c = (struct rt_i2c_bus *)bus; struct rt_i2c_bus *rt_i2c = (struct rt_i2c_bus *)bus;

View File

@ -103,7 +103,7 @@ static rt_err_t n32_spi_init(struct n32_spi *spi_drv, struct rt_spi_configuratio
if (cfg->mode & RT_SPI_SLAVE) if (cfg->mode & RT_SPI_SLAVE)
{ {
/* SPI_InitStructure->SpiMode = SPI_MODE_SLAVE; */ /* SPI_InitStructure->SpiMode = SPI_MODE_SLAVE; */
return RT_ERROR; return -RT_ERROR;
} }
else else
{ {

View File

@ -864,7 +864,7 @@ static int adc_vol_sample(int argc, char *argv[])
if (adc_dev == RT_NULL) if (adc_dev == RT_NULL)
{ {
rt_kprintf("adc sample run failed! can't find %s device!\n", ADC_DEV_NAME); rt_kprintf("adc sample run failed! can't find %s device!\n", ADC_DEV_NAME);
return RT_ERROR; return -RT_ERROR;
} }
for (int i = 1; i <= 18; ++i) for (int i = 1; i <= 18; ++i)
@ -900,7 +900,7 @@ static int hwtimer_init(const char *name)
if (hw_dev == RT_NULL) if (hw_dev == RT_NULL)
{ {
rt_kprintf("hwtimer sample run failed! can't find %s device!\n", name); rt_kprintf("hwtimer sample run failed! can't find %s device!\n", name);
return RT_ERROR; return -RT_ERROR;
} }
ret = rt_device_open(hw_dev, RT_DEVICE_OFLAG_RDWR); ret = rt_device_open(hw_dev, RT_DEVICE_OFLAG_RDWR);
if (ret != RT_EOK) if (ret != RT_EOK)
@ -921,7 +921,7 @@ static int hwtimer_init(const char *name)
if (rt_device_write(hw_dev, 0, &timeout_s, sizeof(timeout_s)) != sizeof(timeout_s)) if (rt_device_write(hw_dev, 0, &timeout_s, sizeof(timeout_s)) != sizeof(timeout_s))
{ {
rt_kprintf("set timeout value failed\n"); rt_kprintf("set timeout value failed\n");
return RT_ERROR; return -RT_ERROR;
} }
rt_thread_mdelay(3500); rt_thread_mdelay(3500);

View File

@ -266,7 +266,7 @@ static rt_err_t nrf5x_pin_attach_irq(struct rt_device *device, rt_int32_t pin,
case NRFX_ERROR_NO_MEM: case NRFX_ERROR_NO_MEM:
return RT_ENOMEM; return RT_ENOMEM;
default: default:
return RT_ERROR; return -RT_ERROR;
} }
} }

View File

@ -397,7 +397,7 @@ static int pwm_led_sample(int argc, char *argv[])
if (pwm_dev == RT_NULL) if (pwm_dev == RT_NULL)
{ {
rt_kprintf("pwm sample run failed! can't find %s device!\n", PWM_DEV_NAME); rt_kprintf("pwm sample run failed! can't find %s device!\n", PWM_DEV_NAME);
return RT_ERROR; return -RT_ERROR;
} }
rt_pwm_set(pwm_dev, PWM_DEV_CHANNEL, period, pulse); rt_pwm_set(pwm_dev, PWM_DEV_CHANNEL, period, pulse);

View File

@ -143,7 +143,7 @@ nrfx_spim_evt_handler_t spi_handler[] = {spi0_handler, spi1_handler, spi2_handle
* @brief This function config spi bus * @brief This function config spi bus
* @param device * @param device
* @param configuration * @param configuration
* @retval RT_EOK / RT_ERROR * @retval RT_EOK / -RT_ERROR
*/ */
static rt_err_t spi_configure(struct rt_spi_device *device, static rt_err_t spi_configure(struct rt_spi_device *device,
struct rt_spi_configuration *configuration) struct rt_spi_configuration *configuration)
@ -191,7 +191,7 @@ static rt_err_t spi_configure(struct rt_spi_device *device,
break; break;
default: default:
LOG_E("spi_configure mode error %x\n",configuration->mode); LOG_E("spi_configure mode error %x\n",configuration->mode);
return RT_ERROR; return -RT_ERROR;
} }
/* spi frequency config */ /* spi frequency config */
switch (configuration->max_hz / 1000) switch (configuration->max_hz / 1000)
@ -229,7 +229,7 @@ static rt_err_t spi_configure(struct rt_spi_device *device,
if(NRFX_SUCCESS == nrf_ret) if(NRFX_SUCCESS == nrf_ret)
return RT_EOK; return RT_EOK;
return RT_ERROR; return -RT_ERROR;
} }
static rt_uint32_t spixfer(struct rt_spi_device *device, struct rt_spi_message *message) static rt_uint32_t spixfer(struct rt_spi_device *device, struct rt_spi_message *message)
@ -288,7 +288,7 @@ static const struct rt_spi_ops nrfx_spi_ops =
/*spi bus init*/ /*spi bus init*/
static int rt_hw_spi_bus_init(void) static int rt_hw_spi_bus_init(void)
{ {
rt_err_t result = RT_ERROR; rt_err_t result = -RT_ERROR;
for (int i = 0; i < sizeof(spi_config) / sizeof(spi_config[0]); i++) for (int i = 0; i < sizeof(spi_config) / sizeof(spi_config[0]); i++)
{ {
spi_bus_obj[i].spi = spi_config[i].spi; spi_bus_obj[i].spi = spi_config[i].spi;
@ -324,7 +324,7 @@ rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name,
if (result != RT_EOK) if (result != RT_EOK)
{ {
LOG_E("%s attach to %s faild, %d", device_name, bus_name, result); LOG_E("%s attach to %s faild, %d", device_name, bus_name, result);
result = RT_ERROR; result = -RT_ERROR;
} }
RT_ASSERT(result == RT_EOK); RT_ASSERT(result == RT_EOK);
return result; return result;
@ -453,7 +453,7 @@ nrfx_spi_evt_handler_t spi_handler[] = {spi0_handler, spi1_handler, spi2_handler
* @brief This function config spi bus * @brief This function config spi bus
* @param device * @param device
* @param configuration * @param configuration
* @retval RT_EOK / RT_ERROR * @retval RT_EOK / -RT_ERROR
*/ */
static rt_err_t spi_configure(struct rt_spi_device *device, static rt_err_t spi_configure(struct rt_spi_device *device,
struct rt_spi_configuration *configuration) struct rt_spi_configuration *configuration)
@ -501,7 +501,7 @@ static rt_err_t spi_configure(struct rt_spi_device *device,
break; break;
default: default:
LOG_E("spi_configure mode error %x\n",configuration->mode); LOG_E("spi_configure mode error %x\n",configuration->mode);
return RT_ERROR; return -RT_ERROR;
} }
/* spi frequency config */ /* spi frequency config */
switch (configuration->max_hz / 1000) switch (configuration->max_hz / 1000)
@ -539,7 +539,7 @@ static rt_err_t spi_configure(struct rt_spi_device *device,
if(NRFX_SUCCESS == nrf_ret) if(NRFX_SUCCESS == nrf_ret)
return RT_EOK; return RT_EOK;
return RT_ERROR; return -RT_ERROR;
} }
static rt_uint32_t spixfer(struct rt_spi_device *device, struct rt_spi_message *message) static rt_uint32_t spixfer(struct rt_spi_device *device, struct rt_spi_message *message)
@ -598,7 +598,7 @@ static const struct rt_spi_ops nrfx_spi_ops =
/*spi bus init*/ /*spi bus init*/
static int rt_hw_spi_bus_init(void) static int rt_hw_spi_bus_init(void)
{ {
rt_err_t result = RT_ERROR; rt_err_t result = -RT_ERROR;
for (int i = 0; i < sizeof(spi_config) / sizeof(spi_config[0]); i++) for (int i = 0; i < sizeof(spi_config) / sizeof(spi_config[0]); i++)
{ {
spi_bus_obj[i].spi = spi_config[i].spi; spi_bus_obj[i].spi = spi_config[i].spi;
@ -634,7 +634,7 @@ rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name,
if (result != RT_EOK) if (result != RT_EOK)
{ {
LOG_E("%s attach to %s faild, %d", device_name, bus_name, result); LOG_E("%s attach to %s faild, %d", device_name, bus_name, result);
result = RT_ERROR; result = -RT_ERROR;
} }
RT_ASSERT(result == RT_EOK); RT_ASSERT(result == RT_EOK);
return result; return result;

View File

@ -25,7 +25,7 @@
* @param bus_name spi bus name "spi0"/"spi1"/"spi2" * @param bus_name spi bus name "spi0"/"spi1"/"spi2"
* @param device_name spi device name "spi0x"/"spi1x"/"spi2x" * @param device_name spi device name "spi0x"/"spi1x"/"spi2x"
* @param ss_pin spi ss pin number * @param ss_pin spi ss pin number
* @retval RT_ERROR / RT_EOK * @retval -RT_ERROR / RT_EOK
*/ */
rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name, rt_uint32_t ss_pin); rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name, rt_uint32_t ss_pin);
@ -97,7 +97,7 @@ struct nrfx_drv_spi_pin_config
* @param bus_name spi bus name "spi0"/"spi1"/"spi2" * @param bus_name spi bus name "spi0"/"spi1"/"spi2"
* @param device_name spi device name "spi0x"/"spi1x"/"spi2x" * @param device_name spi device name "spi0x"/"spi1x"/"spi2x"
* @param ss_pin spi ss pin number * @param ss_pin spi ss pin number
* @retval RT_ERROR / RT_EOK * @retval -RT_ERROR / RT_EOK
*/ */
rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name, rt_uint32_t ss_pin); rt_err_t rt_hw_spi_device_attach(const char *bus_name, const char *device_name, rt_uint32_t ss_pin);

View File

@ -161,7 +161,7 @@ static rt_err_t _uart_ctrl(struct rt_serial_device *serial, int cmd, void *arg)
break; break;
default: default:
return RT_ERROR; return -RT_ERROR;
} }
return RT_EOK; return RT_EOK;

View File

@ -123,7 +123,7 @@ static rt_ssize_t gd32_i2c_xfer(struct rt_i2c_bus_device *device, struct rt_i2c_
{ {
struct rt_i2c_msg *msg; struct rt_i2c_msg *msg;
rt_uint32_t i; rt_uint32_t i;
rt_err_t ret = RT_ERROR; rt_err_t ret = -RT_ERROR;
rt_uint16_t last_flags; rt_uint16_t last_flags;
RT_ASSERT(device != RT_NULL); RT_ASSERT(device != RT_NULL);

View File

@ -134,7 +134,7 @@ static rt_err_t nu_get_adc_value(struct rt_adc_device *device, rt_uint32_t chann
int rt_hw_adc_init(void) int rt_hw_adc_init(void)
{ {
rt_err_t result = RT_ERROR; rt_err_t result = -RT_ERROR;
int nu_sel = 0; int nu_sel = 0;
while (nu_adc_arr[nu_sel].name != 0) while (nu_adc_arr[nu_sel].name != 0)

View File

@ -179,7 +179,7 @@ static rt_err_t nu_capture_get_pulsewidth(struct rt_inputcapture_device *inputca
} }
else else
{ {
ret = RT_ERROR; ret = -RT_ERROR;
} }
return -(ret); return -(ret);
} }
@ -201,7 +201,7 @@ static void bpwm_config(nu_capture_t *nu_capture)
static rt_err_t nu_bpwm_init(nu_capture_t *nu_capture) static rt_err_t nu_bpwm_init(nu_capture_t *nu_capture)
{ {
rt_err_t ret = RT_ERROR; rt_err_t ret = -RT_ERROR;
static rt_bool_t bBPWM0Inited = RT_FALSE; static rt_bool_t bBPWM0Inited = RT_FALSE;
static rt_bool_t bBPWM1Inited = RT_FALSE; static rt_bool_t bBPWM1Inited = RT_FALSE;
@ -249,7 +249,7 @@ static rt_err_t nu_capture_init(struct rt_inputcapture_device *inputcapture)
if (nu_bpwm_init(nu_capture) != RT_EOK) if (nu_bpwm_init(nu_capture) != RT_EOK)
{ {
rt_kprintf("Failed to initialize BPWM.\n"); rt_kprintf("Failed to initialize BPWM.\n");
ret = RT_ERROR; ret = -RT_ERROR;
} }
return -(ret); return -(ret);

View File

@ -239,7 +239,7 @@ static rt_err_t nu_gpio_irq_enable(struct rt_device *device, rt_base_t pin, rt_u
irqindex = nu_find_irqindex(pin); irqindex = nu_find_irqindex(pin);
if (irqindex == -(RT_ERROR)) if (irqindex == -(RT_ERROR))
{ {
ret = RT_ERROR; ret = -RT_ERROR;
goto exit_nu_gpio_irq_enable; goto exit_nu_gpio_irq_enable;
} }

View File

@ -301,7 +301,7 @@ static rt_ssize_t nu_i2c_mst_xfer(struct rt_i2c_bus_device *bus,
/* Public functions -------------------------------------------------------------*/ /* Public functions -------------------------------------------------------------*/
int rt_hw_i2c_init(void) int rt_hw_i2c_init(void)
{ {
rt_err_t ret = RT_ERROR; rt_err_t ret = -RT_ERROR;
SYS_UnlockReg(); SYS_UnlockReg();

View File

@ -681,7 +681,7 @@ static rt_err_t nu_pdma_sgtbls_valid(nu_pdma_desc_t head)
{ {
rt_kprintf("The distance is over %d between 0x%08x and 0x%08x. \n", NU_PDMA_SG_LIMITED_DISTANCE, PDMA->SCATBA, node); rt_kprintf("The distance is over %d between 0x%08x and 0x%08x. \n", NU_PDMA_SG_LIMITED_DISTANCE, PDMA->SCATBA, node);
rt_kprintf("Please use nu_pdma_sgtbl_allocate to allocate valid sg-table.\n"); rt_kprintf("Please use nu_pdma_sgtbl_allocate to allocate valid sg-table.\n");
return RT_ERROR; return -RT_ERROR;
} }
node = (nu_pdma_desc_t)(node->NEXT + PDMA->SCATBA); node = (nu_pdma_desc_t)(node->NEXT + PDMA->SCATBA);

Some files were not shown because too many files have changed in this diff Show More