1.4.1 How the G3 PLC PAL module works
Description
The G3 PLC Platform Abstraction Layer (PAL) module is the access point to the G3 MAC RT driver.

The G3 PLC PAL module offers the necessary functions to control the G3-PLC MAC-RT layer, which include:
Module initialization
Transmitting and receiving frames
Accessing Parameter Information Base (PIB) to get/set configuration parameters
Starting a new PAN assuming PAN-Coordinator role
Reseting the PLC transceiver
Module Initialization
The PLC PAL is not initialized at System level (SYS_Initialize).
The first step that a client (PLC MAC) has to take when using PLC PAL is to initialize it, by calling PAL_PLC_Initialize, which takes a pointer to initialization data as parameter (this initialization data includes all the callback functions to receive events from PLC PAL and the PLC working band; see PAL_PLC_INIT for details). This will return a SYS_MODULE_OBJ, which is used to check the status of PLC PAL, by calling PAL_PLC_Status. The status is checked in each call to MAC_PLC_Tasks until PAL_PLC_STATUS_READY is returned.
Once the PLC PAL is ready, the handle (PAL_PLC_HANDLE) is obtained by calling PAL_PLC_HandleGet and it will be used to call other functions of the PLC PAL module.
Transmitting and Receiving frames
Frames are sent to the G3 Network using the PAL_PLC_TxRequest primitive. The frame must have a valid IEEE 802.15.4 MAC format with its corresponding MAC header. The result of the requested transmission is provided by PLC PAL by invoking PAL_PLC_TxConfirm callback.
Received frames are reported by PLC PAL by invoking PAL_PLC_DataIndication callback. The reception parameters are provided first by invoking PAL_PLC_RxParamsIndication callback.
Accessing Parameter Information Base (PIB)
Parameter Information Base (PIB) is a set of parameters that can be accessed for reading and/or writing. They serve mainly 2 purposes: MAC-RT/PHY layer configuration through PIB writing and information retrieval through PIB reading.
The reading and writing of parameters are made by means of PAL_PLC_GetMacRtPib and PAL_PLC_SetMacRtPib primitives, respectively.
A list of available parameters is found on MAC_RT_PIB definition (see G3 MAC RT driver documentation in Smart Energy documentation).
Starting a Network
In case a Device is intended to act as PAN-Coordinator of the network, the first step is to auto-configure itself as Coordinator and set an own PAN Identifier which will be used throughout the network. The MAC_PLC_StartRequest function does it by calling the PAL_PLC_SetCoordinator primitive, and the PAN Identifier is configured through PIB MAC_RT_PIB_PAN_ID by calling the PAL_PLC_SetMacRtPib primitive.