368{
369
370 bool overflow = false;
371 bool isFirstFrame = true;
372 size_t availableAtBuffer = *
size;
373 uint8_t *buf = rxbuf;
374
375 do {
377
378
380
381 if (isFirstFrame) {
382
383
385 return 0;
386 }
387
390 return -1;
391 }
392
395 efiPrintf("receiveFrame frameType=%d", frameType);
396 #if EFI_PROD_CODE
398 #endif
399 }
400 size_t numBytesAvailable;
401 uint8_t frameIdx;
402 const uint8_t *srcBuf;
403 switch (frameType) {
405
409 break;
411
416
417 break;
421
422 return -4;
423 }
425
426
427 efiPrintf("received frame index %d is not what expected %d",
429 return -2;
430 }
434 break;
436
437
438 break;
439 default:
440
441
442 return -3;
443 }
444
445 if (isFirstFrame) {
447 efiPrintf(
"receive buffer is not enough %d > %d",
waitingForNumBytes, availableAtBuffer);
448 }
449 isFirstFrame = false;
450 }
451
452 if (buf != nullptr) {
453 int numBytesToCopy = minI(availableAtBuffer, numBytesAvailable);
454
455 memcpy(buf, srcBuf, numBytesToCopy);
456 buf += numBytesToCopy;
457 availableAtBuffer -= numBytesToCopy;
458
459
460 if (numBytesAvailable > numBytesToCopy) {
461 overflow = true;
462 }
463 }
464
465
468 }
469
472
473
475
476 return overflow ? 1 : 0;
477}
void printCANRxFrame(const size_t busIndex, const CANRxFrame &rx)
void sendFlowControl(can_sysinterval_t timeout)
uint8_t waitingForFrameIndex
static constexpr engine_configuration_s * engineConfiguration
@ ISO_TP_FRAME_CONSECUTIVE
@ ISO_TP_FRAME_FLOW_CONTROL