Lines Matching refs:can_device
71 struct rt_can_device can_device; member
121 static rt_err_t swm_can_config(struct rt_can_device *can_device, struct can_configure *cfg) in swm_can_config() argument
127 RT_ASSERT(can_device); in swm_can_config()
129 can_dev = (struct swm_can_device *)can_device->parent.user_data; in swm_can_config()
173 static rt_err_t swm_can_control(struct rt_can_device *can_device, int cmd, void *arg) in swm_can_control() argument
179 RT_ASSERT(can_device != RT_NULL); in swm_can_control()
180 can_dev = (struct swm_can_device *)can_device->parent.user_data; in swm_can_control()
269 if (argval != can_dev->can_device.config.mode) in swm_can_control()
271 can_dev->can_device.config.mode = argval; in swm_can_control()
272 return swm_can_config(&can_dev->can_device, &can_dev->can_device.config); in swm_can_control()
289 if (argval != can_dev->can_device.config.baud_rate) in swm_can_control()
291 can_dev->can_device.config.baud_rate = argval; in swm_can_control()
292 return swm_can_config(&can_dev->can_device, &can_dev->can_device.config); in swm_can_control()
302 if (argval != can_dev->can_device.config.privmode) in swm_can_control()
304 can_dev->can_device.config.privmode = argval; in swm_can_control()
305 return swm_can_config(&can_dev->can_device, &can_dev->can_device.config); in swm_can_control()
310 can_dev->can_device.status.rcverrcnt = can_dev->can_cfg->CANx->RXERR; in swm_can_control()
311 can_dev->can_device.status.snderrcnt = can_dev->can_cfg->CANx->TXERR; in swm_can_control()
312 can_dev->can_device.status.lasterrtype = (can_dev->can_cfg->CANx->ECC >> 6) & 0x03; in swm_can_control()
313 can_dev->can_device.status.errcode = can_dev->can_cfg->CANx->ECC & 0x1F; in swm_can_control()
314 rt_memcpy(arg, &can_dev->can_device.status, sizeof(can_dev->can_device.status)); in swm_can_control()
322 static int swm_can_sendmsg(struct rt_can_device *can_device, const void *buf, rt_uint32_t box_num) in swm_can_sendmsg() argument
327 RT_ASSERT(can_device != RT_NULL); in swm_can_sendmsg()
328 can_dev = (struct swm_can_device *)can_device->parent.user_data; in swm_can_sendmsg()
404 static int swm_can_recvmsg(struct rt_can_device *can_device, void *buf, rt_uint32_t fifo) in swm_can_recvmsg() argument
408 RT_ASSERT(can_device != RT_NULL); in swm_can_recvmsg()
409 can_dev = (struct swm_can_device *)can_device->parent.user_data; in swm_can_recvmsg()
456 static void swm_can_isr(struct rt_can_device *can_device) in swm_can_isr() argument
459 RT_ASSERT(can_device != RT_NULL); in swm_can_isr()
460 can_dev = (struct swm_can_device *)can_device->parent.user_data; in swm_can_isr()
466 rt_hw_can_isr(can_device, RT_CAN_EVENT_RX_IND); in swm_can_isr()
470 rt_hw_can_isr(can_device, RT_CAN_EVENT_RXOF_IND); in swm_can_isr()
474 rt_hw_can_isr(can_device, RT_CAN_EVENT_TX_DONE); in swm_can_isr()
497 swm_can_isr(&(can_obj[CAN0_INDEX].can_device)); in CAN0_Handler()
509 swm_can_isr(&(can_obj[CAN0_INDEX].can_device)); in CAN1_Handler()
542 can_obj[i].can_device.config = config; in swm_can_init()
544 result = rt_hw_can_register(&can_obj[i].can_device, in swm_can_init()