For interface between hardware and software HAL-HLL interface was designed. Below described functions are responsible for data transmission between layers.
Function prefixe determines in which layer function was implemented.
- hal_set_mask and hal_set_filter - set the mask and filter configuration of the CAN controller. Input parameters are:
id - Node Identifier Field, as defined by PDCP. mode - type of node (whether we are DEVICE or ABITRATOR)
- hal_msg_poll - retries fetching any incoming CAN messages left in the CAN controller;
- hll_msg_alloc - reserves unused memory in the high level layer for an incoming CAN message. This memory shall contain a can_msg structure, to which a pointer shall be returned to the caller. The caller must initialze the structure and send it back by calling hll_msg_commit;
- hll_msg_commit - invokes the high level layer's processing of the CAN message referenced by msg;
- hll_msg_get - looks for an outgoing CAN message, and if found, return the contained can_msg structure. Otherwise, it shall return NULL. The caller must signify when it is finished with the pointed-to memory by calling hll_msg_free;
- hll_msg_free - marks the memory in use by the CAN message containing msg as unused.
Procedure of data transmission was presented in the figure below. Sending and receiving mechanism was precisely described in pages: Msg Sending and Msg Receiving