res = rt_device_control(can_dev, RT_CAN_CMD_SET_FILTER, &cfg); RT_ASSERT(res == RT_EOK); #endif while (1) { /* hdr 值为 - 1,表示直接从 uselist 链表读取数据 */ rxmsg.hdr = -1; /* 阻塞等待接收信号量 */ rt_sem_take(&rx_sem, RT_WAITING_FOREVER); /* 从 CAN 读取一帧...
其 功 能 不 等 同 于 RT_ASSERT。 2.2 测试单元运行宏 UTEST_UNIT_RUN(test_unit_func) 测试用例中,使用 UTEST_UNIT_RUN 宏执行指定的测试单元函数 test_unit_func。测试单元(test unit)必须使用 UTEST_UNIT_RUN 宏执行。 2.3 测试用例导出宏 UTEST_TC_EXPORT(testcase, name, init, cleanup 测...
RT_ASSERT(serial != RT_NULL); RT_ASSERT(cfg != RT_NULL); uart = rt_container_of(serial, struct stm32_uart, serial); uart->handle.Instance = uart->config->Instance; uart->handle.Init.BaudRate = cfg->baud_rate; uart->handle.Init.Mode = UART_MODE_TX_RX; uart->handle.Init.O...
经过软件调试,发现:自己关闭了 RT_ASSERT功能!!开启RT_ASSERT功能 分析原因 要开启:#define RT_...
RT_ASSERT(result == RT_EOK); /* if not define RT_USING_HEAP, using to eliminate the warning */ (void)result; #endif rt_thread_startup(tid);//将"main"线程挂载到优先级表上;优先级=RT_THREAD_PRIORITY_MAX / 3; } voidmain_thread_entry(void*parameter) ...
RT_ASSERT(rx_fifo != RT_NULL); /* disable interrupt */ level = rt_hw_interrupt_disable(); len = _serial_fifo_calc_data_len(rx_fifo); if ((len == 0) && // non-blocking io mode (serial->parent.open_flag & RT_DEVICE_OFLAG_NONBLOCKING) == RT_DEVICE_OFLAG_NONBLOCKING) { ...
然后接下来检查init_tick参数的合法性RT_ASSERT(timer->init_tick<RT_TICK_MAX/2);这里利用了init_tick是一个无符号32bit变量的溢出回归的特性(无符号32位整数的表示范围:0到0xffffffff)设计的一个技巧。其中定时器最大的定时值必须小于RT_TICK_MAX /2,另外RT_TICK_MAX是与init_tick类型想同的一个32bit的...
RT_ASSERT(rt_object_get_type(&sem->parent.parent) == RT_Object_Class_Semaphore); if (cmd == RT_IPC_CMD_RESET) { rt_ubase_t value; /* get value */ value = (rt_ubase_t)arg; /* disable interrupt */ level = rt_hw_interrupt_disable(); ...
RT_ASSERT(ret == RT_EOK); ret = rt_thread_init(&mmcsd_detect_thread, "mmcsd_detect", mmcsd_detect, RT_NULL,&mmcsd_stack[0], RT_MMCSD_STACK_SIZE, RT_MMCSD_THREAD_PREORITY, 20);if (ret == RT_EOK) { rt_thread_startup(&mmcsd_detect_thread); ...
RT_ASSERT(device->bus != RT_NULL); RT_ASSERT(device->bus->parent.user_data != RT_NULL); RT_ASSERT(message != RT_NULL); struct stm32_spi *spi_drv = rt_container_of(device->bus, struct stm32_spi, spi_bus); SPI_HandleTypeDef*spi_handle = &spi_drv->handle; ...