Block diagram of message sending in HAL in relation to HLL was presented in the figure below.
Procedure of message sending is triggered from HLL level, because lower layers does not send any messages itself.
If HLL has any message to send after internal computations described in section "HLL aspects", it calls function hal_msg_take() which call function triggerSoftwareInterrupt() with an argument TRIGGER_SENDING. By changing one of the microcontroller pins mentioned function triggers external interrupt treated as software interrupt.
Afterwards, callback from hll_msg_get() function is made to return pointer to message structure from HLL, which should be sent. HLL checks priority of arbitration field of returned message and basing on transmitting CAN controller register priorities calls function sendCanMsg() with appropriate arguments. Within sendCanMsg() function structure is decoded into id, message length and data field and all these parameters are sent to CAN controller using smart function mcp2515TransmitData() which provides possibility of data transfer in reading, writing or bit set mode usind function transmitSPI(). After data transfer pointer to structure should be freed - this is executed by function hll_msg_free() with the pointer as the argument. Moreover hll_msg_free() checks, whether any message has been left in CAN controller because of HLL stack overflow.
Should be filled by AN.
!