1.4.1 How the PRIME PAL module works

Description

The PRIME Platform Abstraction Layer (PAL) is the access point to the PHY drivers: PLC PHY Driver, RF PHY Driver and Serial PHY Driver.

The PAL is based on the PHY primitives for data and control planes described in the PRIME specification, although the current implementation offers enhanced versions of some of them to take a full advantage of the features available in the PHY layer. These features improve the operation of the MAC layer.

The PRIME PAL module offers the following functions:
  • Module initialization
  • State machine maintenance
  • Transmitting and receiving frames
  • Accessing Parameter Information Base (PIB) to get/set configuration parameters

The MAC layer in the PRIME Library accesses the PRIME PAL module through the HAL API. The functions in the HAL API are based on the definitions of the PAL primitives.

Module Initialization

The PAL module is not initialized at System level (PRIME_Initialize).

The first step that the PRIME Library has to take when using the PAL is to initialize it by calling PAL_Initialize with the configured PAL index. This will return a SYS_MODULE_OBJ, which is used in other maintenance functions of the PAL module.

Next, the PRIME Library has to enable the required submodules of the PAL according to the running PRIME version by calling PAL_Enable. Submodules will be enabled in the PAL if available.

Finally, the PRIME Library has to check the status of the PAL, by calling PAL_Status. The status is checked in each call to PRIME_Tasks until SYS_STATUS_READY is returned.

A PAL status of SYS_STATUS_READY means that at least one configured PAL submodule has been successfully initialized, while others might have finished their initialization with errors.

Once the PAL is ready (i.e. has finished its initialization duties), the client can set the callback functions to received events from the PAL. This is done be means of the function PAL_CallbackRegister.

State Machine Maintenance

The PAL module State Machine is called periodically though the PRIME_Tasks function, using function PAL_Tasks.

Transmitting And Receiving Frames

Frames are sent to the PRIME Network using the PAL_DataRequest function. The input data must include a channel (in the pch format defined in the PRIME specification) so that the request is passed to the corresponding submodule. The result of the requested transmission is provided by invoking the dataConfirm callback.

Received frames are reported by the PAL by invoking the dataIndication 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 two purposes: PHY layer configuration through PIB writing, and information retrieval through PIB reading.

The reading and writing of parameters are made by means of PAL_GetConfiguration and PAL_SetConfiguration functions, respectively.

A list of available parameters is provided in file mac_pib.h. For description of proprietary PIBs see Proprietary PIB Attributes.