Lines Matching refs:msg
43 can_msg_t msg; in stm32_CEC_CAN_IRQ() local
47 msg.ide = !!(rir & CAN_RI0R_IDE); in stm32_CEC_CAN_IRQ()
48 msg.rtr = !!(rir & CAN_RI0R_RTR); in stm32_CEC_CAN_IRQ()
49 msg.id = (rir >> 21) & ((1 << 11) - 1); in stm32_CEC_CAN_IRQ()
50 if (msg.ide) { in stm32_CEC_CAN_IRQ()
52 msg.id_ex = (rir >> 3) & ((1 << 18) - 1); in stm32_CEC_CAN_IRQ()
55 msg.dlc = mailbox->RDTR & CAN_RDT0R_DLC; in stm32_CEC_CAN_IRQ()
60 msg.data[0] = data & 0xff; in stm32_CEC_CAN_IRQ()
61 msg.data[1] = (data >> 8) & 0xff; in stm32_CEC_CAN_IRQ()
62 msg.data[2] = (data >> 16) & 0xff; in stm32_CEC_CAN_IRQ()
63 msg.data[3] = (data >> 24) & 0xff; in stm32_CEC_CAN_IRQ()
66 msg.data[4] = data & 0xff; in stm32_CEC_CAN_IRQ()
67 msg.data[5] = (data >> 8) & 0xff; in stm32_CEC_CAN_IRQ()
68 msg.data[6] = (data >> 16) & 0xff; in stm32_CEC_CAN_IRQ()
69 msg.data[7] = (data >> 24) & 0xff; in stm32_CEC_CAN_IRQ()
73 cbuf_write(&can_rx_buf, &msg, sizeof(msg), false); in stm32_CEC_CAN_IRQ()
94 int stm32_can_transmit(stm32_can_t *can, const can_msg_t *msg) { in stm32_can_transmit() argument
101 if (msg->ide) { in stm32_can_transmit()
103 mailbox->TIR = (msg->id << 21) | (msg->id_ex << 3) | CAN_TI0R_IDE in stm32_can_transmit()
104 | (msg->rtr ? CAN_TI0R_RTR : 0); in stm32_can_transmit()
106 mailbox->TIR = (msg->id << 21) | (msg->rtr ? CAN_TI0R_RTR : 0); in stm32_can_transmit()
111 mailbox->TDTR |= msg->dlc & CAN_TDT0R_DLC; in stm32_can_transmit()
114 mailbox->TDLR = msg->data[3] << 24 | msg->data[2] << 16 in stm32_can_transmit()
115 | msg->data[1] << 8 | msg->data[0]; in stm32_can_transmit()
116 mailbox->TDHR = msg->data[7] << 24 | msg->data[6] << 16 in stm32_can_transmit()
117 | msg->data[5] << 8 | msg->data[4]; in stm32_can_transmit()
188 ssize_t can_send(const can_msg_t *msg) { in can_send() argument
193 ret = stm32_can_transmit(can, msg); in can_send()
199 ssize_t can_recv(can_msg_t *msg, bool block) { in can_recv() argument
203 bytes_read = cbuf_read(&can_rx_buf, msg, sizeof(*msg), block); in can_recv()
204 if (cbuf_space_avail(&can_rx_buf) >= sizeof(*msg)) { in can_recv()
208 return bytes_read > 0 ? msg->dlc : -EWOULDBLOCK; in can_recv()