diff --git a/bsp/hc32/tests/test_adc.c b/bsp/hc32/tests/test_adc.c index 349e7353a19..2641c664553 100644 --- a/bsp/hc32/tests/test_adc.c +++ b/bsp/hc32/tests/test_adc.c @@ -111,7 +111,7 @@ static int adc_vol_sample(int argc, char **argv) else { rt_kprintf("The chip hasn't the adc unit!\r\n"); - return RT_ERROR; + return -RT_ERROR; } } @@ -120,7 +120,7 @@ static int adc_vol_sample(int argc, char **argv) if (adc_dev == RT_NULL) { rt_kprintf("adc sample run failed! can't find %s device!\r\n", adc_device); - return RT_ERROR; + return -RT_ERROR; } #if defined(BSP_ADC1_USING_DMA) || defined(BSP_ADC2_USING_DMA) || defined(BSP_ADC3_USING_DMA) diff --git a/bsp/hc32/tests/test_can.c b/bsp/hc32/tests/test_can.c index fe9c960593e..f12e2785098 100644 --- a/bsp/hc32/tests/test_can.c +++ b/bsp/hc32/tests/test_can.c @@ -329,7 +329,7 @@ int can_sample(int argc, char **argv) else { rt_kprintf("The chip hasn't the can unit!\r\n"); - return RT_ERROR; + return -RT_ERROR; } } else @@ -347,7 +347,7 @@ int can_sample(int argc, char **argv) if (!can_dev) { rt_kprintf("find %s failed!\n", can_name); - return RT_ERROR; + return -RT_ERROR; } if (can_mutex == RT_NULL) diff --git a/bsp/hc32/tests/test_dac.c b/bsp/hc32/tests/test_dac.c index 98edc761901..c9e77e3c38e 100644 --- a/bsp/hc32/tests/test_dac.c +++ b/bsp/hc32/tests/test_dac.c @@ -50,7 +50,7 @@ static int dac_vol_sample(int argc, char *argv[]) else { rt_kprintf("The chip hasn't the dac unit!\r\n"); - return RT_ERROR; + return -RT_ERROR; } } @@ -59,13 +59,13 @@ static int dac_vol_sample(int argc, char *argv[]) if (dac_dev == RT_NULL) { rt_kprintf("dac sample run failed! can't find %s device!\n", dac_device_name); - return RT_ERROR; + return -RT_ERROR; } if (RT_EOK != rt_device_control(&dac_dev->parent, RT_DAC_CMD_GET_RESOLUTION, &convertBits)) { rt_kprintf("dac sample can't read resolution!\n"); - return RT_ERROR; + return -RT_ERROR; } convertBits = (1 << (rt_uint8_t)convertBits); for (channel = 1; channel < 3; channel++) @@ -79,7 +79,7 @@ static int dac_vol_sample(int argc, char *argv[]) if (value > DAC_MAX_OUTPUT_VALUE) { rt_kprintf("invalid dac value!!! \n"); - return RT_ERROR; + return -RT_ERROR; } } rt_dac_write(dac_dev, channel, value); diff --git a/bsp/hc32/tests/test_hwtimer.c b/bsp/hc32/tests/test_hwtimer.c index ff1e305f01e..3bb8d7738c7 100644 --- a/bsp/hc32/tests/test_hwtimer.c +++ b/bsp/hc32/tests/test_hwtimer.c @@ -71,7 +71,7 @@ static int hwtimer_sample(int argc, char *argv[]) if ((argc != 4) || (rt_strcmp("oneshot", argv[2]) && rt_strcmp("period", argv[2]))) { _hwtimer_cmd_print_usage(); - return RT_ERROR; + return -RT_ERROR; } /* 查找定时器设备 */ @@ -79,7 +79,7 @@ static int hwtimer_sample(int argc, char *argv[]) if (hw_dev == RT_NULL) { rt_kprintf("hwtimer sample run failed! can't find %s device!\n", argv[1]); - return RT_ERROR; + return -RT_ERROR; } else { @@ -116,7 +116,7 @@ static int hwtimer_sample(int argc, char *argv[]) if (rt_device_write(hw_dev, 0, &timeout_s, sizeof(timeout_s)) != sizeof(timeout_s)) { rt_kprintf("set timeout value failed\n"); - return RT_ERROR; + return -RT_ERROR; } tick = rt_tick_get(); rt_kprintf("set timeout (%d) ms successful\n", atoi(argv[3])); diff --git a/bsp/hc32/tests/test_pulse_encoder.c b/bsp/hc32/tests/test_pulse_encoder.c index 008d9d55af1..000699e85e2 100644 --- a/bsp/hc32/tests/test_pulse_encoder.c +++ b/bsp/hc32/tests/test_pulse_encoder.c @@ -159,7 +159,7 @@ static int encoder_sample(int argc, char **argv) if ((argc != 4)) { _pulse_cmd_print_usage(); - return RT_ERROR; + return -RT_ERROR; } rt_pin_mode(TEST_IO_A_PIN, PIN_MODE_OUTPUT); @@ -170,7 +170,7 @@ static int encoder_sample(int argc, char **argv) { rt_kprintf("encoder_sample run failed! can't find %s device!\n", argv[1]); _pulse_cmd_print_usage(); - return RT_ERROR; + return -RT_ERROR; } rt_device_open(pulse_encoder_dev, RT_DEVICE_OFLAG_RDONLY); rt_device_control(pulse_encoder_dev, PULSE_ENCODER_CMD_CLEAR_COUNT, RT_NULL); @@ -188,7 +188,7 @@ static int encoder_sample(int argc, char **argv) rt_kprintf("**************Self-test failed**************\n"); rt_device_close(pulse_encoder_dev); _pulse_cmd_print_usage(); - return RT_ERROR; + return -RT_ERROR; } else { diff --git a/bsp/hc32/tests/test_pwm.c b/bsp/hc32/tests/test_pwm.c index 4dd8a607e01..d675dd89737 100644 --- a/bsp/hc32/tests/test_pwm.c +++ b/bsp/hc32/tests/test_pwm.c @@ -33,14 +33,14 @@ static rt_int32_t pwm_sample(int argc, char *argv[]) if (argc != 2) { - return RT_ERROR; + return -RT_ERROR; } pwm_dev = (struct rt_device_pwm *)rt_device_find(argv[1]); if (pwm_dev == RT_NULL) { rt_kprintf("pwm sample run failed! can't find %s device!\n", argv[1]); - return RT_ERROR; + return -RT_ERROR; } rt_pwm_set(pwm_dev, PWM_DEV_CHANNEL, period, pulse); diff --git a/bsp/hc32/tests/test_rtc.c b/bsp/hc32/tests/test_rtc.c index 2e07374f1a8..8aa0bde8d87 100644 --- a/bsp/hc32/tests/test_rtc.c +++ b/bsp/hc32/tests/test_rtc.c @@ -98,7 +98,7 @@ static int rtc_sample(int argc, char *argv[]) rt_kprintf("\'8\': dump all alarm \n"); rt_kprintf("\'9\': delete all alarm \n"); #endif /* RT_USING_ALARM */ - return RT_ERROR; + return -RT_ERROR; } idx = *(argv[1]) - '0'; @@ -110,12 +110,12 @@ static int rtc_sample(int argc, char *argv[]) if (!rtc_dev) { rt_kprintf("find %s failed\n", SAMPLE_RTC_NAME); - return RT_ERROR; + return -RT_ERROR; } if (RT_EOK != rt_device_open(rtc_dev, RT_NULL)) { rt_kprintf("failed to open %s\n", SAMPLE_RTC_NAME); - return RT_ERROR; + return -RT_ERROR; } rt_kprintf("rtc opened\n"); break; @@ -124,7 +124,7 @@ static int rtc_sample(int argc, char *argv[]) if (argc < 3) { rt_kprintf("unsurpported command\n"); - return RT_ERROR; + return -RT_ERROR; } temp1 = ((argv[2][0] - '0') * 10) + \ (argv[2][1] - '0'); @@ -135,7 +135,7 @@ static int rtc_sample(int argc, char *argv[]) if (RT_EOK != set_time(temp1, temp2, temp3)) { rt_kprintf("set RTC time failed\n"); - return RT_ERROR; + return -RT_ERROR; } rt_kprintf("\nset RTC time as %2d:%2d:%2d\n", temp1, temp2, temp3); break; @@ -152,7 +152,7 @@ static int rtc_sample(int argc, char *argv[]) if (RT_EOK != set_date(temp1, temp2, temp3)) { rt_kprintf("failed to set date for %s\n", SAMPLE_RTC_NAME); - return RT_ERROR; + return -RT_ERROR; } rt_kprintf("\nset RTC date as %4d-%2d-%2d\n", temp1, temp2, temp3); break; @@ -190,7 +190,7 @@ static int rtc_sample(int argc, char *argv[]) if (RT_NULL == ptr_alarm) { rt_kprintf("failed to create rtc alarm\n"); - return RT_ERROR; + return -RT_ERROR; } callback_counter = 2; ++alarm_idx; @@ -200,7 +200,7 @@ static int rtc_sample(int argc, char *argv[]) if (RT_EOK != rt_alarm_start(ptr_alarm)) { rt_kprintf("failed to start rtc alarm\n"); - return RT_ERROR; + return -RT_ERROR; } rt_kprintf("rtc alarm started\n"); break; @@ -208,7 +208,7 @@ static int rtc_sample(int argc, char *argv[]) if (RT_EOK != rt_alarm_stop(ptr_alarm)) { rt_kprintf("failed to stop rtc alarm\n"); - return RT_ERROR; + return -RT_ERROR; } rt_kprintf("rtc alarm stopped\n"); break; @@ -216,7 +216,7 @@ static int rtc_sample(int argc, char *argv[]) if (argc < 3) { rt_kprintf("unkown para to control rtc alarm\n"); - return RT_ERROR; + return -RT_ERROR; } switch (argv[2][0]) { @@ -253,7 +253,7 @@ static int rtc_sample(int argc, char *argv[]) if (RT_EOK != rt_device_close(rtc_dev)) { rt_kprintf("failed to close RTC\n"); - return RT_ERROR; + return -RT_ERROR; } rt_kprintf("unkown rtc command, rtc closed \n"); break; diff --git a/bsp/hc32/tests/test_soft_i2c.c b/bsp/hc32/tests/test_soft_i2c.c index 11feb42d759..4cce95dabde 100644 --- a/bsp/hc32/tests/test_soft_i2c.c +++ b/bsp/hc32/tests/test_soft_i2c.c @@ -140,7 +140,7 @@ static int sw_i2c_sample(int argc, char *argv[]) rt_kprintf("sw_i2c_sample %d: oled ssd1306 init\n", SSD1306_CMD_INIT); rt_kprintf("sw_i2c_sample %d: write ssd1306 \n", SSD1306_CMD_DISPLAY); rt_kprintf("sw_i2c_sample %d: turn off ssd1306\n", SSD1306_CMD_DEINIT); - return RT_ERROR; + return -RT_ERROR; } switch (*argv[1] - '0') @@ -150,7 +150,7 @@ static int sw_i2c_sample(int argc, char *argv[]) if (NULL == rt_i2c_dev) { rt_kprintf("failed to find i2c device %s\n", SW_I2C_NAME); - return RT_ERROR; + return -RT_ERROR; } break; /* communicate with eeprom to soft i2c read function */ diff --git a/bsp/hc32/tests/test_uart_v1.c b/bsp/hc32/tests/test_uart_v1.c index 0986bc34922..c53d3d8472a 100644 --- a/bsp/hc32/tests/test_uart_v1.c +++ b/bsp/hc32/tests/test_uart_v1.c @@ -187,7 +187,7 @@ int uart_sample_v1(int argc, char *argv[]) else { rt_kprintf("argc error!\n"); - return RT_ERROR; + return -RT_ERROR; } /* 查找系统中的串口设备 */ @@ -195,7 +195,7 @@ int uart_sample_v1(int argc, char *argv[]) if (!serial) { rt_kprintf("find %s failed!\n", uart_name); - return RT_ERROR; + return -RT_ERROR; } /* modify configure */ @@ -256,7 +256,7 @@ int uart_sample_v1(int argc, char *argv[]) else { rt_kprintf("communication mode error, please input cmd: uart_sample_v1 %s int or uart_sample_v1 uartx dma!\n", uart_name); - return RT_ERROR; + return -RT_ERROR; } if (thread != RT_NULL) @@ -265,7 +265,7 @@ int uart_sample_v1(int argc, char *argv[]) } else { - ret = RT_ERROR; + ret = -RT_ERROR; } return ret; diff --git a/bsp/hc32/tests/test_uart_v2.c b/bsp/hc32/tests/test_uart_v2.c index 12d2985a70e..72a354fe55b 100644 --- a/bsp/hc32/tests/test_uart_v2.c +++ b/bsp/hc32/tests/test_uart_v2.c @@ -208,7 +208,7 @@ int uart_sample_v2(int argc, char *argv[]) else { rt_kprintf("argc error!\n"); - return RT_ERROR; + return -RT_ERROR; } /* 查找串口设备 */ @@ -216,7 +216,7 @@ int uart_sample_v2(int argc, char *argv[]) if (!serial) { rt_kprintf("find %s failed!\n", uart_name); - return RT_ERROR; + return -RT_ERROR; } /* modify configure */ @@ -277,7 +277,7 @@ int uart_sample_v2(int argc, char *argv[]) else { rt_kprintf("communication mode error, please input cmd: uart_sample_v2 %s int or uart_sample_v1 uartx dma!\n", uart_name); - return RT_ERROR; + return -RT_ERROR; } if (thread != RT_NULL) @@ -286,7 +286,7 @@ int uart_sample_v2(int argc, char *argv[]) } else { - ret = RT_ERROR; + ret = -RT_ERROR; } return ret; diff --git a/bsp/hc32/tests/test_usbd.c b/bsp/hc32/tests/test_usbd.c index 27b3a1014a3..bb99b92bbde 100644 --- a/bsp/hc32/tests/test_usbd.c +++ b/bsp/hc32/tests/test_usbd.c @@ -56,7 +56,7 @@ static int cdc_sample(void) if (cdc_dev == RT_NULL) { rt_kprintf("cdc sample run failed! can't find %s device!\n", USBD_DEV_NAME); - return RT_ERROR; + return -RT_ERROR; } /* 以读写方式打开设备 */ @@ -74,7 +74,7 @@ static int cdc_sample(void) if (rt_device_write(cdc_dev, 0, str_write, sizeof(str_write)) != sizeof(str_write)) { rt_kprintf("send test message failed\n"); - return RT_ERROR; + return -RT_ERROR; } /* 延时1000ms */ rt_thread_mdelay(1000); @@ -159,7 +159,7 @@ static int rt_hw_spi_flash_with_sfud_init(void) rt_hw_spi_flash_reset(SPI_FLASH_DEVICE_NAME); if (RT_NULL == rt_sfud_flash_probe(SPI_FLASH_CHIP, SPI_FLASH_DEVICE_NAME)) { - return RT_ERROR; + return -RT_ERROR; } } @@ -211,7 +211,7 @@ static int hid_sample(void) if (hid_dev == RT_NULL) { rt_kprintf("hid sample run failed! can't find %s device!\n", USBD_DEV_NAME); - return RT_ERROR; + return -RT_ERROR; } /* 以收中断方式打开设备 */ @@ -296,7 +296,7 @@ static int winusb_sample(void) if (winusb_dev == RT_NULL) { rt_kprintf("winusb sample run failed! can't find %s device!\n", WINUSB_DEV_NAME); - return RT_ERROR; + return -RT_ERROR; } /* 以读写方式打开设备 */ diff --git a/bsp/hc32/tests/test_wdt.c b/bsp/hc32/tests/test_wdt.c index 85763023589..5827be269b7 100644 --- a/bsp/hc32/tests/test_wdt.c +++ b/bsp/hc32/tests/test_wdt.c @@ -66,14 +66,14 @@ static int wdt_sample(int argc, char *argv[]) if (!wdg_dev) { rt_kprintf("find %s failed!\n", WDT_DEVICE_NAME); - return RT_ERROR; + return -RT_ERROR; } ret = rt_device_init(wdg_dev); if (ret != RT_EOK) { rt_kprintf("init %s failed!\n", WDT_DEVICE_NAME); - return RT_ERROR; + return -RT_ERROR; } /* Set timeout (Unit:S) */ @@ -81,7 +81,7 @@ static int wdt_sample(int argc, char *argv[]) if (ret != RT_EOK) { rt_kprintf("set %s timeout failed!\n", WDT_DEVICE_NAME); - return RT_ERROR; + return -RT_ERROR; } /* Get the time when it real effective */