rt_device_write的函数很简单的,断言,判断ref_count, 调用dev->write函数。代码如下所示:
serial和can死掉,那就是这两个外设的写操作死掉了,建议再深入去查一下原因,更加准确说明现象、提供详细的log等。在drv_usart.h/drv_can.c中具体的写操作函数中找原因。
rt_size_t rt_device_write(rt_device_t dev,
rt_off_t pos,
const void *buffer,
rt_size_t size)
{
RT_ASSERT(dev != RT_NULL);
RT_ASSERT(rt_object_get_type(&dev->parent) == RT_Object_Class_Device);
if (dev->ref_count == 0)
{
rt_set_errno(-RT_ERROR);
return 0;
}
/* call device_write interface */
if (device_write != RT_NULL)
{
return device_write(dev, pos, buffer, size);
}
/* set error code */
rt_set_errno(-RT_ENOSYS);
return 0;
}
rt_device_write的函数很简单的,断言,判断ref_count, 调用dev->write函数。代码如下所示:
serial和can死掉,那就是这两个外设的写操作死掉了,建议再深入去查一下原因,更加准确说明现象、提供详细的log等。在drv_usart.h/drv_can.c中具体的写操作函数中找原因。
rt_size_t rt_device_write(rt_device_t dev,
rt_off_t pos,
const void *buffer,
rt_size_t size)
{
RT_ASSERT(dev != RT_NULL);
RT_ASSERT(rt_object_get_type(&dev->parent) == RT_Object_Class_Device);
if (dev->ref_count == 0)
{
rt_set_errno(-RT_ERROR);
return 0;
}
/* call device_write interface */
if (device_write != RT_NULL)
{
return device_write(dev, pos, buffer, size);
}
/* set error code */
rt_set_errno(-RT_ENOSYS);
return 0;
}
举报