Lines Matching refs:frame

101 	/* The CAN frame and config the ELM327 is sending/using,
170 /* Schedule a CAN frame and necessary config changes to be sent to the TTY. */
171 static void can327_send_frame(struct can327 *elm, struct can_frame *frame)
176 if (elm->can_frame_to_send.can_id != frame->can_id) {
178 if ((frame->can_id ^ elm->can_frame_to_send.can_id)
181 (frame->can_id & CAN_EFF_FLAG ? 0 : CAN327_CAN_CONFIG_SEND_SFF) |
189 if (frame->can_id & CAN_EFF_FLAG) {
202 /* Schedule the CAN frame itself. */
203 elm->can_frame_to_send = *frame;
284 struct can_frame *frame;
301 skb = alloc_can_err_skb(elm->dev, &frame);
305 frame->can_id |= CAN_ERR_BUSOFF;
329 struct can_frame *frame;
334 skb = alloc_can_err_skb(elm->dev, &frame);
348 * emit this kind of error frame instead.
350 frame->can_id |= CAN_ERR_CRTL;
351 frame->data[1] = CAN_ERR_CRTL_RX_OVERFLOW;
353 frame->can_id |= CAN_ERR_BUSERROR;
355 frame->can_id |= CAN_ERR_PROT;
357 frame->can_id |= CAN_ERR_PROT;
359 frame->can_id |= CAN_ERR_PROT;
360 frame->data[2] = CAN_ERR_PROT_OVERLOAD;
362 frame->can_id |= CAN_ERR_PROT;
363 frame->data[2] = CAN_ERR_PROT_TX;
368 frame->can_id |= CAN_ERR_CRTL;
372 * Emit a generic error frame.
393 struct can_frame *frame;
401 skb = alloc_can_skb(elm->dev, &frame);
437 frame->can_id = CAN_EFF_FLAG;
450 /* The line is too short to be a valid frame hex dump.
462 frame->len = (hex_to_bin(elm->rxbuf[datastart - 2]) << 0);
465 if (frame->can_id & CAN_EFF_FLAG) {
466 frame->can_id |= (hex_to_bin(elm->rxbuf[0]) << 28) |
475 frame->can_id |= (hex_to_bin(elm->rxbuf[0]) << 8) |
480 /* Check for RTR frame */
483 frame->can_id |= CAN_RTR_FLAG;
489 if (!(frame->can_id & CAN_RTR_FLAG) &&
490 (hexlen < frame->len * 3 + datastart)) {
491 /* Incomplete frame.
493 * Emit an error frame and exit.
495 frame->can_id = CAN_ERR_FLAG | CAN_ERR_CRTL;
496 frame->len = CAN_ERR_DLC;
497 frame->data[1] = CAN_ERR_CRTL_RX_OVERFLOW;
509 for (i = 0; i < frame->len; i++) {
510 frame->data[i] =
515 /* Feed the frame to the network layer. */
550 struct can_frame *frame = &elm->can_frame_to_send;
552 * which is currently an 8 byte CAN frame's payload hexdump.
606 (frame->can_id & CAN_EFF_MASK) >> 24);
611 frame->can_id & CAN_EFF_MASK & ((1 << 24) - 1));
616 frame->can_id & CAN_SFF_MASK);
619 if (frame->can_id & CAN_RTR_FLAG) {
620 /* Send an RTR frame. Their DLC is fixed.
625 /* Send a regular CAN data frame */
628 for (i = 0; i < frame->len; i++) {
631 frame->data[i]);
816 struct can_frame *frame = (struct can_frame *)skb->data;
835 can327_send_frame(elm, frame);
839 dev->stats.tx_bytes += frame->can_id & CAN_RTR_FLAG ? 0 : frame->len;