mirror of https://github.com/RT-Thread/rt-thread
bsp: k230: use utest asset api
Use utest assert API for utest cases. Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
This commit is contained in:
parent
f4e619a17c
commit
890a4bad72
|
@ -71,27 +71,15 @@ static void test_wdt_feed(void)
|
||||||
|
|
||||||
/* Find the watchdog device according to the name and obtain the handle */
|
/* Find the watchdog device according to the name and obtain the handle */
|
||||||
wdg_dev = rt_device_find(IWDG_DEVICE_NAME);
|
wdg_dev = rt_device_find(IWDG_DEVICE_NAME);
|
||||||
if (!wdg_dev)
|
uassert_not_null(wdg_dev);
|
||||||
{
|
|
||||||
LOG_E("find %s failed!\n", IWDG_DEVICE_NAME);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize the device */
|
/* Initialize the device */
|
||||||
ret = rt_device_init(wdg_dev);
|
ret = rt_device_init(wdg_dev);
|
||||||
if (ret != RT_EOK)
|
uassert_int_equal(ret, RT_EOK);
|
||||||
{
|
|
||||||
LOG_E("initialize %s failed!\n", IWDG_DEVICE_NAME);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set the watchdog timeout time */
|
/* Set the watchdog timeout time */
|
||||||
ret = rt_device_control(wdg_dev, KD_DEVICE_CTRL_WDT_SET_TIMEOUT, &timeout);
|
ret = rt_device_control(wdg_dev, KD_DEVICE_CTRL_WDT_SET_TIMEOUT, &timeout);
|
||||||
if (ret != RT_EOK)
|
uassert_int_equal(ret, RT_EOK);
|
||||||
{
|
|
||||||
LOG_E("set %s timeout failed!\n", IWDG_DEVICE_NAME);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
flag_feed = 1; /* Set feed the dog sign */
|
flag_feed = 1; /* Set feed the dog sign */
|
||||||
|
|
||||||
|
@ -118,27 +106,15 @@ static void test_wdt_nofeed(void)
|
||||||
|
|
||||||
/* Find the watchdog device according to the name and obtain the handle */
|
/* Find the watchdog device according to the name and obtain the handle */
|
||||||
wdg_dev = rt_device_find(IWDG_DEVICE_NAME);
|
wdg_dev = rt_device_find(IWDG_DEVICE_NAME);
|
||||||
if (!wdg_dev)
|
uassert_not_null(wdg_dev);
|
||||||
{
|
|
||||||
LOG_E("find %s failed!\n", IWDG_DEVICE_NAME);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize the device */
|
/* Initialize the device */
|
||||||
ret = rt_device_init(wdg_dev);
|
ret = rt_device_init(wdg_dev);
|
||||||
if (ret != RT_EOK)
|
uassert_int_equal(ret, RT_EOK);
|
||||||
{
|
|
||||||
LOG_E("initialize %s failed!\n", IWDG_DEVICE_NAME);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set the watchdog timeout time */
|
/* Set the watchdog timeout time */
|
||||||
ret = rt_device_control(wdg_dev, KD_DEVICE_CTRL_WDT_SET_TIMEOUT, &timeout);
|
ret = rt_device_control(wdg_dev, KD_DEVICE_CTRL_WDT_SET_TIMEOUT, &timeout);
|
||||||
if (ret != RT_EOK)
|
uassert_int_equal(ret, RT_EOK);
|
||||||
{
|
|
||||||
LOG_E("set %s timeout failed!\n", IWDG_DEVICE_NAME);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
flag_feed = 0; /* Do not feed the dog */
|
flag_feed = 0; /* Do not feed the dog */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue