static int rt_rtc_alarm_init(void); #endif /* rtc 与 alrm,共用 control函数 */ static rt_err_t rt_rtc_control(rt_device_t dev, int cmd, void *args) { rt_err_t result = RT_EOK; #ifdef RT_USING_ALARM struct rt_rtc_wkalarm *p_wkalarm = RT_NULL; #endif RT_ASSERT(dev != R...
如果NULL肯定是用户代码写错了,于是进入rt_device_open函数的第一件事就是RT_ASSERT(dev != RT_NULL...
RT_ASSERT(shell != RT_NULL); dev = rt_device_find(device_name); if(dev == RT_NULL) { rt_kprintf("finsh: can not find device: %s\n", device_name); return; } /* check whether it's a same device */ if(dev == shell->device)return; /* open this device and set the new d...
经过软件调试,发现:自己关闭了 RT_ASSERT功能!!开启RT_ASSERT功能 分析原因 要开启:#define RT_...
RT_ASSERT(device_name != RT_NULL);rt_err_tresult;structrt_spi_device*spi_device;structstm32_hw_spi_cs*cs_pin;/* initialize the cs pin && select the slave*/GPIO_InitTypeDef GPIO_Initure; GPIO_Initure.Pin = cs_gpio_pin; GPIO_Initure.Mode = GPIO_MODE_OUTPUT_PP; ...
p = NULL; } } else break; } } else { LWIP_ASSERT("Should not happen!n",0); } } } 3.2 数据发送 当协议栈需要发送数据时,调用netif的linkoutput接口,在linkoutput中,将数据封装成消息发送给etx线程,最终通过eth_device的eth_tx接口将数据发送出去。
{rt_err_tresult;structrt_spi_messagemessage;RT_ASSERT(device != RT_NULL); RT_ASSERT(device->bus != RT_NULL); result =rt_mutex_take(&(device->bus->lock), RT_WAITING_FOREVER);if(result == RT_EOK) {if(device->bus->owner != device) ...
rt_err_t rt_imxrt_eth_tx(rt_device_t dev, struct pbuf *p) { rt_err_t result = RT_EOK; enet_handle_t * enet_handle = &imxrt_eth_device.enet_handle; RT_ASSERT(p != NULL); RT_ASSERT(enet_handle != RT_NULL); dbg_log(DBG_LOG, "rt_imxrt_eth_t...
还是建议不要在ASSERT内写太复杂的计算,而更多是判断。所以,最好也用不ASSERT的方式编译过代码,运行过代码。 未来也可以加入,RT_ASSERT_RET(condition, ret)的方式来处理condition不满足时应该返回,跳出函数的处理。 Originally posted by @BernardXiong in #8537 (com
, NULL); RT_ASSERT(result == RT_EOK); } return result; } 我们看到,该函数名是rt_为前缀的,要被RT-Thread上层函数调用,具体是在drv_common.c中通过宏RT_USING_SERIAL控制的初始函数: RT_WEAK void rt_hw_board_init() { ... /* USART driver initialization is open by default */ #ifdef...