rusEFI
The most advanced open source ECU
|
#include <isotp.h>
Public Member Functions | |
CanStreamerState (ICanTransport *p_transport, int p_busIndex, int p_txFrameId) | |
int | sendFrame (const IsoTpFrameHeader &header, const uint8_t *data, int num, can_sysinterval_t timeout) |
int | receiveFrame (CANRxFrame *rxmsg, uint8_t *buf, int num, can_sysinterval_t timeout) |
int | getDataFromFifo (uint8_t *rxbuf, size_t &numBytes) |
int | sendDataTimeout (const uint8_t *txbuf, int numBytes, can_sysinterval_t timeout) |
can_msg_t | streamAddToTxTimeout (size_t *np, const uint8_t *txbuf, can_sysinterval_t timeout) |
can_msg_t | streamFlushTx (can_sysinterval_t timeout) |
can_msg_t | streamReceiveTimeout (size_t *np, uint8_t *rxbuf, can_sysinterval_t timeout) |
Data Fields | |
fifo_buffer< uint8_t, CAN_FIFO_BUF_SIZE > | rxFifoBuf |
fifo_buffer< uint8_t, CAN_FIFO_BUF_SIZE > | txFifoBuf |
int | isoHeaderByteIndex = 0 |
int | waitingForNumBytes = 0 |
int | waitingForFrameIndex = 0 |
ICanTransport * | transport |
int | busIndex |
int | txFrameId |
|
inline |
int CanStreamerState::getDataFromFifo | ( | uint8_t * | rxbuf, |
size_t & | numBytes | ||
) |
Definition at line 235 of file isotp.cpp.
Referenced by streamReceiveTimeout().
int CanStreamerState::receiveFrame | ( | CANRxFrame * | rxmsg, |
uint8_t * | buf, | ||
int | num, | ||
can_sysinterval_t | timeout | ||
) |
performance optimization specific to TS over CAN tunnelling TODO: refactor into child class if we ever choose to revive this logic #if defined(TS_CAN_DEVICE_SHORT_PACKETS_IN_ONE_FRAME) if (frameType == ISO_TP_FRAME_SINGLE) { restore the CRC on the whole packet uint32_t crc = crc32((void *) srcBuf, numBytesAvailable); we need a separate buffer for crc because srcBuf may not be word-aligned for direct copy uint8_t crcBuffer[sizeof(uint32_t)]; (uint32_t *) (crcBuffer) = SWAP_UINT32(crc);
now set the packet size (uint16_t *) shortCrcPacketStagingArea = SWAP_UINT16(numBytesAvailable); copy the data if (numBytesAvailable > 0) memcpy(shortCrcPacketStagingArea + sizeof(uint16_t), srcBuf, numBytesAvailable); copy the crc to the end memcpy(shortCrcPacketStagingArea + sizeof(uint16_t) + numBytesAvailable, crcBuffer, sizeof(crcBuffer));
use the reconstructed tmp buffer as a source buffer srcBuf = shortCrcPacketStagingArea; we added the 16-bit size & 32-bit crc bytes numBytesAvailable += sizeof(uint16_t) + sizeof(crcBuffer); } #endif
Definition at line 63 of file isotp.cpp.
Referenced by sendDataTimeout(), and streamReceiveTimeout().
int CanStreamerState::sendDataTimeout | ( | const uint8_t * | txbuf, |
int | numBytes, | ||
can_sysinterval_t | timeout | ||
) |
Definition at line 150 of file isotp.cpp.
Referenced by streamAddToTxTimeout(), and streamFlushTx().
int CanStreamerState::sendFrame | ( | const IsoTpFrameHeader & | header, |
const uint8_t * | data, | ||
int | num, | ||
can_sysinterval_t | timeout | ||
) |
https://en.wikipedia.org/wiki/ISO_15765-2
Definition at line 11 of file isotp.cpp.
Referenced by receiveFrame(), and sendDataTimeout().
can_msg_t CanStreamerState::streamAddToTxTimeout | ( | size_t * | np, |
const uint8_t * | txbuf, | ||
can_sysinterval_t | timeout | ||
) |
Definition at line 248 of file isotp.cpp.
Referenced by canStreamAddToTxTimeout().
can_msg_t CanStreamerState::streamFlushTx | ( | can_sysinterval_t | timeout | ) |
Definition at line 288 of file isotp.cpp.
can_msg_t CanStreamerState::streamReceiveTimeout | ( | size_t * | np, |
uint8_t * | rxbuf, | ||
can_sysinterval_t | timeout | ||
) |
Definition at line 298 of file isotp.cpp.
int CanStreamerState::busIndex |
Definition at line 108 of file isotp.h.
Referenced by sendFrame().
int CanStreamerState::isoHeaderByteIndex = 0 |
Definition at line 100 of file isotp.h.
Referenced by receiveFrame(), and sendFrame().
fifo_buffer<uint8_t, CAN_FIFO_BUF_SIZE> CanStreamerState::rxFifoBuf |
Definition at line 90 of file isotp.h.
Referenced by getDataFromFifo(), and receiveFrame().
ICanTransport* CanStreamerState::transport |
Definition at line 106 of file isotp.h.
Referenced by sendDataTimeout(), sendFrame(), and streamReceiveTimeout().
fifo_buffer<uint8_t, CAN_FIFO_BUF_SIZE> CanStreamerState::txFifoBuf |
Definition at line 91 of file isotp.h.
Referenced by streamAddToTxTimeout(), and streamFlushTx().
int CanStreamerState::txFrameId |
Definition at line 109 of file isotp.h.
Referenced by sendFrame().
int CanStreamerState::waitingForFrameIndex = 0 |
Definition at line 104 of file isotp.h.
Referenced by receiveFrame().
int CanStreamerState::waitingForNumBytes = 0 |
Definition at line 103 of file isotp.h.
Referenced by receiveFrame().