Lines Matching refs:msg
183 } msg; member
227 struct esd_usb2_msg *msg) in esd_usb2_rx_event() argument
232 u32 id = le32_to_cpu(msg->msg.rx.id) & ESD_IDMASK; in esd_usb2_rx_event()
235 u8 state = msg->msg.rx.data[0]; in esd_usb2_rx_event()
236 u8 ecc = msg->msg.rx.data[1]; in esd_usb2_rx_event()
237 u8 txerr = msg->msg.rx.data[2]; in esd_usb2_rx_event()
238 u8 rxerr = msg->msg.rx.data[3]; in esd_usb2_rx_event()
313 struct esd_usb2_msg *msg) in esd_usb2_rx_can_msg() argument
324 id = le32_to_cpu(msg->msg.rx.id); in esd_usb2_rx_can_msg()
327 esd_usb2_rx_event(priv, msg); in esd_usb2_rx_can_msg()
336 cf->can_dlc = get_can_dlc(msg->msg.rx.dlc & ~ESD_RTR); in esd_usb2_rx_can_msg()
341 if (msg->msg.rx.dlc & ESD_RTR) { in esd_usb2_rx_can_msg()
345 cf->data[i] = msg->msg.rx.data[i]; in esd_usb2_rx_can_msg()
357 struct esd_usb2_msg *msg) in esd_usb2_tx_done_msg() argument
366 context = &priv->tx_contexts[msg->msg.txdone.hnd & (MAX_TX_URBS - 1)]; in esd_usb2_tx_done_msg()
368 if (!msg->msg.txdone.status) { in esd_usb2_tx_done_msg()
408 struct esd_usb2_msg *msg; in esd_usb2_read_bulk_callback() local
410 msg = (struct esd_usb2_msg *)(urb->transfer_buffer + pos); in esd_usb2_read_bulk_callback()
412 switch (msg->msg.hdr.cmd) { in esd_usb2_read_bulk_callback()
414 if (msg->msg.rx.net >= dev->net_count) { in esd_usb2_read_bulk_callback()
419 esd_usb2_rx_can_msg(dev->nets[msg->msg.rx.net], msg); in esd_usb2_read_bulk_callback()
423 if (msg->msg.txdone.net >= dev->net_count) { in esd_usb2_read_bulk_callback()
428 esd_usb2_tx_done_msg(dev->nets[msg->msg.txdone.net], in esd_usb2_read_bulk_callback()
429 msg); in esd_usb2_read_bulk_callback()
433 pos += msg->msg.hdr.len << 2; in esd_usb2_read_bulk_callback()
524 static int esd_usb2_send_msg(struct esd_usb2 *dev, struct esd_usb2_msg *msg) in esd_usb2_send_msg() argument
530 msg, in esd_usb2_send_msg()
531 msg->msg.hdr.len << 2, in esd_usb2_send_msg()
537 struct esd_usb2_msg *msg) in esd_usb2_wait_msg() argument
543 msg, in esd_usb2_wait_msg()
544 sizeof(*msg), in esd_usb2_wait_msg()
620 struct esd_usb2_msg *msg; in esd_usb2_start() local
623 msg = kmalloc(sizeof(*msg), GFP_KERNEL); in esd_usb2_start()
624 if (!msg) { in esd_usb2_start()
642 msg->msg.hdr.cmd = CMD_IDADD; in esd_usb2_start()
643 msg->msg.hdr.len = 2 + ESD_MAX_ID_SEGMENT; in esd_usb2_start()
644 msg->msg.filter.net = priv->index; in esd_usb2_start()
645 msg->msg.filter.option = ESD_ID_ENABLE; /* start with segment 0 */ in esd_usb2_start()
647 msg->msg.filter.mask[i] = cpu_to_le32(0xffffffff); in esd_usb2_start()
649 msg->msg.filter.mask[ESD_MAX_ID_SEGMENT] = cpu_to_le32(0x00000001); in esd_usb2_start()
651 err = esd_usb2_send_msg(dev, msg); in esd_usb2_start()
667 kfree(msg); in esd_usb2_start()
720 struct esd_usb2_msg *msg; in esd_usb2_start_xmit() local
747 msg = (struct esd_usb2_msg *)buf; in esd_usb2_start_xmit()
749 msg->msg.hdr.len = 3; /* minimal length */ in esd_usb2_start_xmit()
750 msg->msg.hdr.cmd = CMD_CAN_TX; in esd_usb2_start_xmit()
751 msg->msg.tx.net = priv->index; in esd_usb2_start_xmit()
752 msg->msg.tx.dlc = cf->can_dlc; in esd_usb2_start_xmit()
753 msg->msg.tx.id = cpu_to_le32(cf->can_id & CAN_ERR_MASK); in esd_usb2_start_xmit()
756 msg->msg.tx.dlc |= ESD_RTR; in esd_usb2_start_xmit()
759 msg->msg.tx.id |= cpu_to_le32(ESD_EXTID); in esd_usb2_start_xmit()
762 msg->msg.tx.data[i] = cf->data[i]; in esd_usb2_start_xmit()
764 msg->msg.hdr.len += (cf->can_dlc + 3) >> 2; in esd_usb2_start_xmit()
787 msg->msg.tx.hnd = 0x80000000 | i; /* returned in TX done message */ in esd_usb2_start_xmit()
790 msg->msg.hdr.len << 2, in esd_usb2_start_xmit()
845 struct esd_usb2_msg *msg; in esd_usb2_close() local
848 msg = kmalloc(sizeof(*msg), GFP_KERNEL); in esd_usb2_close()
849 if (!msg) in esd_usb2_close()
853 msg->msg.hdr.cmd = CMD_IDADD; in esd_usb2_close()
854 msg->msg.hdr.len = 2 + ESD_MAX_ID_SEGMENT; in esd_usb2_close()
855 msg->msg.filter.net = priv->index; in esd_usb2_close()
856 msg->msg.filter.option = ESD_ID_ENABLE; /* start with segment 0 */ in esd_usb2_close()
858 msg->msg.filter.mask[i] = 0; in esd_usb2_close()
859 if (esd_usb2_send_msg(priv->usb2, msg) < 0) in esd_usb2_close()
863 msg->msg.hdr.len = 2; in esd_usb2_close()
864 msg->msg.hdr.cmd = CMD_SETBAUD; in esd_usb2_close()
865 msg->msg.setbaud.net = priv->index; in esd_usb2_close()
866 msg->msg.setbaud.rsvd = 0; in esd_usb2_close()
867 msg->msg.setbaud.baud = cpu_to_le32(ESD_USB2_NO_BAUDRATE); in esd_usb2_close()
868 if (esd_usb2_send_msg(priv->usb2, msg) < 0) in esd_usb2_close()
877 kfree(msg); in esd_usb2_close()
905 struct esd_usb2_msg *msg; in esd_usb2_set_bittiming() local
932 msg = kmalloc(sizeof(*msg), GFP_KERNEL); in esd_usb2_set_bittiming()
933 if (!msg) in esd_usb2_set_bittiming()
936 msg->msg.hdr.len = 2; in esd_usb2_set_bittiming()
937 msg->msg.hdr.cmd = CMD_SETBAUD; in esd_usb2_set_bittiming()
938 msg->msg.setbaud.net = priv->index; in esd_usb2_set_bittiming()
939 msg->msg.setbaud.rsvd = 0; in esd_usb2_set_bittiming()
940 msg->msg.setbaud.baud = cpu_to_le32(canbtr); in esd_usb2_set_bittiming()
944 err = esd_usb2_send_msg(priv->usb2, msg); in esd_usb2_set_bittiming()
946 kfree(msg); in esd_usb2_set_bittiming()
1050 struct esd_usb2_msg *msg; in esd_usb2_probe() local
1065 msg = kmalloc(sizeof(*msg), GFP_KERNEL); in esd_usb2_probe()
1066 if (!msg) { in esd_usb2_probe()
1072 msg->msg.hdr.cmd = CMD_VERSION; in esd_usb2_probe()
1073 msg->msg.hdr.len = 2; in esd_usb2_probe()
1074 msg->msg.version.rsvd = 0; in esd_usb2_probe()
1075 msg->msg.version.flags = 0; in esd_usb2_probe()
1076 msg->msg.version.drv_version = 0; in esd_usb2_probe()
1078 err = esd_usb2_send_msg(dev, msg); in esd_usb2_probe()
1084 err = esd_usb2_wait_msg(dev, msg); in esd_usb2_probe()
1090 dev->net_count = (int)msg->msg.version_reply.nets; in esd_usb2_probe()
1091 dev->version = le32_to_cpu(msg->msg.version_reply.version); in esd_usb2_probe()
1110 kfree(msg); in esd_usb2_probe()