Receive a frame
Informative
How upper-layer software receives a CAN L-PDU. Binding rules: CHI-CAN-MUST-13 to CHI-CAN-MUST-16 in Can — Requirements; callback signature: API Reference.
Goal
Get notified when a frame that passes your acceptance filter arrives on a STARTED channel.
Reception is push, not pull
You do not poll for frames from the application. When the driver receives a frame (in its ISR, or
via Can_PollFunction for polled channels), it calls your callback:
void CanIf_OnReception(const Can_MessageInfoType *messageInfo,
const Can_PduInfoType *pduInfoPtr)
{
/* messageInfo: channel, frame type (classic/FD), id type (standard/extended). */
/* pduInfoPtr : frameId, sduLength, sduDataPtr — byte 0 first (CHI-CAN-MUST-14). */
uint8 len = pduInfoPtr->sduLength;
/* Consume the data BEFORE returning — see the consistency note. */
}
Which frames arrive
Only frames accepted by the RX mailbox’s hardware filter (hw_filter_code / hw_filter_mask)
are delivered. An RX mailbox may be backed by a hardware FIFO or several hardware objects, so
bursts are handled without loss where the hardware allows (CHI-CAN-MUST-16).
Note
Data consistency. The data passed to CanIf_OnReception is valid only until the callback
returns (CHI-CAN-MUST-15). Copy anything you need to keep; do not stash the pointer.