349{
350
351 bool overflow = false;
352 bool isFirstFrame = true;
353 size_t availableAtBuffer = *
size;
354 uint8_t *buf = rxbuf;
355
356 do {
358
359
361
362 if (isFirstFrame) {
363 efiPrintf("IsoTp: rx timeout, nothing received");
364 } else {
366 }
367 return -1;
368 }
369
372 efiPrintf("receiveFrame frameType=%d", frameType);
373 #if EFI_PROD_CODE
375 #endif
376 }
377 size_t numBytesAvailable;
378 uint8_t frameIdx;
379 const uint8_t *srcBuf;
380 switch (frameType) {
382
386 break;
388
393
394 break;
398
399
400 return -2;
401 }
405 break;
407
408
409 break;
410 default:
411
412
413 return -3;
414 }
415
416 if (isFirstFrame) {
418 efiPrintf(
"receive buffer is not enough %d > %d",
waitingForNumBytes, availableAtBuffer);
419 }
420 isFirstFrame = false;
421 }
422
423 if (buf != nullptr) {
424 int numBytesToCopy = minI(availableAtBuffer, numBytesAvailable);
425
426 memcpy(buf, srcBuf, numBytesToCopy);
427 buf += numBytesToCopy;
428 availableAtBuffer -= numBytesToCopy;
429
430
431 if (numBytesAvailable > numBytesToCopy) {
432 overflow = true;
433 }
434 }
435
436
444 }
445
448
449
451
452 return overflow ? 1 : 0;
453}
void printCANRxFrame(const size_t busIndex, const CANRxFrame &rx)
int sendFrame(const IsoTpFrameHeader &header, const uint8_t *data, int num, can_sysinterval_t timeout)
uint8_t waitingForFrameIndex
static constexpr engine_configuration_s * engineConfiguration
@ ISO_TP_FRAME_CONSECUTIVE
@ ISO_TP_FRAME_FLOW_CONTROL