| 86 | } |
| 87 | |
| 88 | static int _can_sendmsg(struct rt_can_device *can, const void *buf, rt_uint32_t box_num) |
| 89 | { |
| 90 | struct ft2004_can *drv_can; |
| 91 | struct rt_can_msg *pmsg = (struct rt_can_msg *)buf; |
| 92 | struct FCan_Frame can_frame = {0}; |
| 93 | RT_ASSERT(can); |
| 94 | drv_can = (struct ft2004_can *)can->parent.user_data; |
| 95 | RT_ASSERT(drv_can); |
| 96 | |
| 97 | /* Check the parameters */ |
| 98 | RT_ASSERT(pmsg->len <= 8U); |
| 99 | |
| 100 | if (RT_CAN_STDID == pmsg->ide) |
| 101 | { |
| 102 | can_frame.CanId = pmsg->id; |
| 103 | } |
| 104 | else |
| 105 | { |
| 106 | can_frame.CanId = pmsg->id; |
| 107 | can_frame.CanId |= CAN_EFF_FLAG; |
| 108 | } |
| 109 | |
| 110 | if (RT_CAN_DTR == pmsg->rtr) |
| 111 | { |
| 112 | } |
| 113 | else |
| 114 | { |
| 115 | can_frame.CanId |= CAN_RTR_FLAG; |
| 116 | } |
| 117 | |
| 118 | can_frame.CanDlc = pmsg->len & 0x0FU; |
| 119 | memcpy(can_frame.data, pmsg->data, 8); |
| 120 | |
| 121 | return (FCan_SendByIrq(&drv_can->can_handle, &can_frame, 1, RT_NULL) == 1) ? RT_EOK : -RT_ERROR; |
| 122 | } |
| 123 | |
| 124 | static int _can_recvmsg(struct rt_can_device *can, void *buf, rt_uint32_t fifo) |
| 125 | { |
nothing calls this directly
no test coverage detected