Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Physical Abstraction Layer

This module provides configuration and utils for the PAL layer, which is the interface between the PLC PHY layer and the PRIME MAC layer.

Data Structures

struct  xPalMsgRx_t
 
struct  xPalMsgTx_t
 

Macros

#define MODE_PRIME_PLUS   0x02
 
#define MODE_PRIME_V1_3   0x00
 
#define PAL_CFG_INVALID_INPUT   PHY_CFG_INVALID_INPUT
 
#define PAL_CFG_SUCCESS   PHY_CFG_SUCCESS
 
#define PAL_CMD_REG_AND   PHY_CMD_CFG_AND
 
#define PAL_CMD_REG_OR   PHY_CMD_CFG_OR
 
#define PAL_CMD_REG_XOR   PHY_CMD_CFG_XOR
 
#define PAL_HI_STATE   HI_STATE
 
#define PAL_LO_STATE   LO_STATE
 
#define PAL_LO_STATE_PK   LO_STATE_PK
 
#define PAL_PROTOCOL_D8PSK   PROTOCOL_D8PSK
 
#define PAL_PROTOCOL_D8PSK_VTB   PROTOCOL_D8PSK_VTB
 
#define PAL_PROTOCOL_DBPSK   PROTOCOL_DBPSK
 
#define PAL_PROTOCOL_DBPSK_ROBO   PROTOCOL_DBPSK_ROBO
 
#define PAL_PROTOCOL_DBPSK_VTB   PROTOCOL_DBPSK_VTB
 
#define PAL_PROTOCOL_DQPSK   PROTOCOL_DQPSK
 
#define PAL_PROTOCOL_DQPSK_ROBO   PROTOCOL_DQPSK_ROBO
 
#define PAL_PROTOCOL_DQPSK_VTB   PROTOCOL_DQPSK_VTB
 
#define PAL_QT_UNKNOW   0xFF
 
#define PAL_TIME_MODE_ABSOLUTE   PHY_TX_SCHEDULING_MODE_ABSOLUTE
 
#define PAL_TIME_MODE_RELATIVE   PHY_TX_SCHEDULING_MODE_RELATIVE
 
#define PAL_TX_RESULT_BUSY_CH   PHY_TX_RESULT_BUSY_CH
 
#define PAL_TX_RESULT_BUSY_RX   PHY_TX_RESULT_BUSY_RX
 
#define PAL_TX_RESULT_BUSY_TX   PHY_TX_RESULT_BUSY_TX
 
#define PAL_TX_RESULT_INV_BUFFER   PHY_TX_RESULT_INV_BUFFER
 
#define PAL_TX_RESULT_INV_LENGTH   PHY_TX_RESULT_INV_LENGTH
 
#define PAL_TX_RESULT_INV_PRIME_MODE   PHY_TX_RESULT_INV_PRIME_MODE
 
#define PAL_TX_RESULT_INV_SCHEME   PHY_TX_RESULT_INV_SCHEME
 
#define PAL_TX_RESULT_PROCESS   PHY_TX_RESULT_PROCESS
 
#define PAL_TX_RESULT_SUCCESS   PHY_TX_RESULT_SUCCESS
 
#define PAL_TX_RESULT_TIMEOUT   PHY_TX_RESULT_TIMEOUT
 
#define PAL_VALID_PHY_CFG_KEY   ATPL230_VALID_CFG_KEY
 
#define PAL_VLO_STATE   VLO_STATE
 
#define PHY_EVM_THRESHOLD_EX_0   0x5EC6B7
 
#define PHY_EVM_THRESHOLD_EX_1   0x5363F2
 
#define PHY_EVM_THRESHOLD_EX_10   0x1A5AEF
 
#define PHY_EVM_THRESHOLD_EX_11   0x173066
 
#define PHY_EVM_THRESHOLD_EX_12   0x14673D
 
#define PHY_EVM_THRESHOLD_EX_13   0x11F3C0
 
#define PHY_EVM_THRESHOLD_EX_14   0xFCBA5
 
#define PHY_EVM_THRESHOLD_EX_15   0xDE5DE
 
#define PHY_EVM_THRESHOLD_EX_16   0xC3A73
 
#define PHY_EVM_THRESHOLD_EX_17   0xAC260
 
#define PHY_EVM_THRESHOLD_EX_18   0x9777B
 
#define PHY_EVM_THRESHOLD_EX_19   0x85457
 
#define PHY_EVM_THRESHOLD_EX_2   0x495F57
 
#define PHY_EVM_THRESHOLD_EX_20   0x7542D
 
#define PHY_EVM_THRESHOLD_EX_21   0x672C8
 
#define PHY_EVM_THRESHOLD_EX_22   0x5AC78
 
#define PHY_EVM_THRESHOLD_EX_23   0x4FDFA
 
#define PHY_EVM_THRESHOLD_EX_24   0x46473
 
#define PHY_EVM_THRESHOLD_EX_25   0x3DD5D
 
#define PHY_EVM_THRESHOLD_EX_26   0x36682
 
#define PHY_EVM_THRESHOLD_EX_27   0x2FDEE
 
#define PHY_EVM_THRESHOLD_EX_28   0x2A1EB
 
#define PHY_EVM_THRESHOLD_EX_29   0x250F5
 
#define PHY_EVM_THRESHOLD_EX_3   0x408ED4
 
#define PHY_EVM_THRESHOLD_EX_30   0x209B9
 
#define PHY_EVM_THRESHOLD_EX_31   0x1CB0C
 
#define PHY_EVM_THRESHOLD_EX_32   0x193E6
 
#define PHY_EVM_THRESHOLD_EX_33   0x16360
 
#define PHY_EVM_THRESHOLD_EX_34   0x138AF
 
#define PHY_EVM_THRESHOLD_EX_35   0x1131F
 
#define PHY_EVM_THRESHOLD_EX_36   0xF211
 
#define PHY_EVM_THRESHOLD_EX_37   0xD4FD
 
#define PHY_EVM_THRESHOLD_EX_38   0xBB66
 
#define PHY_EVM_THRESHOLD_EX_39   0xA4E3
 
#define PHY_EVM_THRESHOLD_EX_4   0x38CD66
 
#define PHY_EVM_THRESHOLD_EX_40   0x9114
 
#define PHY_EVM_THRESHOLD_EX_41   0x7FA6
 
#define PHY_EVM_THRESHOLD_EX_42   0x7050
 
#define PHY_EVM_THRESHOLD_EX_43   0x62D2
 
#define PHY_EVM_THRESHOLD_EX_44   0x56F3
 
#define PHY_EVM_THRESHOLD_EX_45   0x4C81
 
#define PHY_EVM_THRESHOLD_EX_46   0x4350
 
#define PHY_EVM_THRESHOLD_EX_47   0x3B3A
 
#define PHY_EVM_THRESHOLD_EX_48   0x341C
 
#define PHY_EVM_THRESHOLD_EX_49   0x2DDA
 
#define PHY_EVM_THRESHOLD_EX_5   0x31FA7D
 
#define PHY_EVM_THRESHOLD_EX_50   0x2857
 
#define PHY_EVM_THRESHOLD_EX_51   0x237F
 
#define PHY_EVM_THRESHOLD_EX_52   0x1F3B
 
#define PHY_EVM_THRESHOLD_EX_53   0x1B7B
 
#define PHY_EVM_THRESHOLD_EX_54   0x182D
 
#define PHY_EVM_THRESHOLD_EX_55   0x1546
 
#define PHY_EVM_THRESHOLD_EX_56   0x12B7
 
#define PHY_EVM_THRESHOLD_EX_57   0x1078
 
#define PHY_EVM_THRESHOLD_EX_58   0xE7D
 
#define PHY_EVM_THRESHOLD_EX_59   0xCC0
 
#define PHY_EVM_THRESHOLD_EX_6   0x2BF970
 
#define PHY_EVM_THRESHOLD_EX_7   0x26B10B
 
#define PHY_EVM_THRESHOLD_EX_8   0x220B1D
 
#define PHY_EVM_THRESHOLD_EX_9   0x1DF422
 
#define PHY_EVM_TRESHOLD_EX_LEVELS   60
 

Enumerations

enum  pal_ids {
  PAL_ID_MAC_EN = 0,
  PAL_ID_STATS_RX_BAD_CRC = 1,
  PAL_ID_STATS_RX_FALSE_POSITIVE = 2,
  PAL_ID_TX_TEST_SEND = 3,
  PAL_ID_TX_TEST_SEND_BCN = 4,
  PAL_ID_QT = 5,
  PAL_ID_EX_SNR = 6,
  PAL_ID_CHECK_CFG = 7,
  PAL_ID_RESET_CFG = 8,
  PAL_ID_DISABLE_BCN_TX = 9,
  PAL_ID_ENABLE_CRC = 10,
  PAL_ID_INFO_VERSION = PHY_ID_INFO_VERSION,
  PAL_ID_IMPEDANCE = PHY_ID_CFG_IMPEDANCE,
  PAL_ID_AUTODETECT_LOAD = PHY_ID_CFG_AUTODETECT_BRANCH,
  PAL_ID_TX_LEVEL = PHY_ID_TX_INFO_LEVEL,
  PAL_ID_TX_SCHEME = PHY_ID_TX_INFO_SCHEME,
  PAL_ID_TXRX_CHANNEL = PHY_ID_CFG_TXRX_CHANNEL,
  PAL_ID_RX_BUFFER_ID = PHY_ID_RX_BUFFER_ID,
  PAL_ID_RX_SCHEME = PHY_ID_RX_INFO_SCHEME,
  PAL_ID_RX_RSSI_AVG_RX0 = REG_ATPL230_TXRXBUF_RSSIAVG_RX0,
  PAL_ID_RX_TIME_RX0 = REG_ATPL230_TXRXBUF_RECTIME1_RX0,
  PAL_ID_EVM_HEADER = REG_ATPL230_TXRXBUF_EVM_HEADER1_RX0,
  PAL_ID_EVM_PAYLOAD = REG_ATPL230_TXRXBUF_EVM_PAYLOAD1_RX0,
  PAL_ID_EVM_HEADER_ACUM = REG_ATPL230_TXRXBUF_EVM_HEADACUM1_RX0,
  PAL_ID_EVM_PAYLOAD_ACUM = REG_ATPL230_TXRXBUF_EVM_PAYLACUM1_RX0,
  PAL_ID_RX_PAYLOAD_LEN = PHY_ID_RX_PAYLOAD_LEN,
  PAL_ID_STATS_RX_TOTAL = PHY_ID_STATS_RX_TOTAL,
  PAL_ID_TX_BUFFER_ID = PHY_ID_TX_BUFFER_ID,
  PAL_ID_RMSCALC1_TX0 = REG_ATPL230_TXRXBUF_RMSCALC1_TX0,
  PAL_ID_EMITIME1_TX0 = REG_ATPL230_TXRXBUF_EMITIME1_TX0,
  PAL_ID_TIME_BEFORE_TX_HIGHZ = PHY_ID_CFG_TIME_BEFORE_TX_HIGHZ,
  PAL_ID_TIME_BEFORE_TX_LOWZ = PHY_ID_CFG_TIME_BEFORE_TX_LOWZ,
  PAL_ID_SNA = REG_ATPL230_SNA0
}
 

Functions

static uint8_t _pal_get_ex_snr (void)
 Get the extended signal noise ratio value. More...
 
static uint8_t _pal_get_qt (void)
 Calculates the QT value with the last message rx parameters. More...
 
static void pal_get_rx (void *pvParameters)
 Get result from reception. More...
 
static void pal_get_tx_result (void *pvParameters)
 Get result from transmission. More...
 
void pal_init (void)
 This function initiates PRIME PHY layer configuration and it must be implemented externally by the user. More...
 
void pal_process (void)
 This function runs the PAL layer process. More...
 

Variables

uint32_t l_tx_time
 
const uint32_t phyEvmThresholdEx []
 
static uint8_t uc_pal_crc_enable
 
static uint8_t uc_pal_data_buf_rx [PHY_MAX_PPDU_SIZE]
 
static uint8_t uc_rx_msg_flag
 
static uint8_t uc_tx_bcn_res_flag
 
uint8_t uc_tx_delay
 
uint8_t uc_tx_head_type
 
uint8_t uc_tx_level
 
static uint8_t uc_tx_res_flag
 
uint8_t uc_tx_scheme
 
static uint16_t ul_rx_bad_crc
 
static uint16_t ul_rx_false_positive
 
static xPhyMsgTxResult_t x_pal_bcn_tx_res
 
static xPhyMsgRx_t x_pal_rx_msg
 
static xPhyMsgTxResult_t x_pal_tx_res
 
void pal_data_indication (uint8_t *puc_psdu, uint16_t *pus_len, uint8_t *puc_level, uint8_t *puc_scheme, uint32_t *pul_time)
 Check if a message has been received from PHY layer. More...
 
uint8_t pal_data_request (uint8_t *puc_mpdu, uint16_t us_len, uint8_t uc_level, uint8_t uc_scheme, uint32_t ul_time)
 Send message using standard PHY layer. More...
 
uint8_t pal_timer_get (uint32_t *pul_timer)
 Get timer. More...
 
uint8_t pal_cd_get (uint8_t *puc_cd, uint8_t *puc_rssi, uint32_t *pul_time, uint8_t *puc_header)
 Get carrier detect. More...
 
uint8_t pal_zct_get (uint32_t *pul_zct)
 Get zero-cross time. More...
 
uint8_t pal_agc_get (uint8_t *puc_mode, uint8_t *puc_gain)
 Get Automatic Gain Mode (AGC) More...
 
uint8_t pal_agc_set (uint8_t uc_mode, uint8_t uc_gain)
 Set Automatic Gain Mode (AGC) More...
 
uint8_t pal_nl_get (uint8_t *puc_noise)
 Get Noise Level (NL) More...
 
uint8_t pal_snr_get (uint8_t *puc_snr, uint8_t uc_qt)
 Get Signal Noise Ratio (SNR) More...
 
void pal_data_indication_ex (xPalMsgRx_t *px_msg)
 Check if a message has been received from PHY layer. More...
 
uint8_t pal_data_request_ex (xPalMsgTx_t *px_msg)
 Send message using PHY layer. More...
 
uint8_t pal_get_cfg_ex (uint16_t us_id, void *p_val, uint16_t uc_len)
 Get extended PHY layer parameter. More...
 
uint8_t pal_set_cfg_ex (uint16_t us_id, void *p_val, uint16_t uc_len)
 Set extended PHY layer parameter. More...
 
uint8_t pal_cmd_cfg_ex (uint16_t us_id, uint8_t uc_cmd, uint8_t uc_mask)
 Binary Command extended PHY layer parameter. More...
 

#define MODE_PRIME_PLUS   0x02
#define MODE_PRIME_V1_3   0x00

Referenced by pal_data_request().

#define PAL_CFG_INVALID_INPUT   PHY_CFG_INVALID_INPUT
#define PAL_CFG_SUCCESS   PHY_CFG_SUCCESS
#define PAL_CMD_REG_AND   PHY_CMD_CFG_AND
#define PAL_CMD_REG_OR   PHY_CMD_CFG_OR
#define PAL_CMD_REG_XOR   PHY_CMD_CFG_XOR
#define PAL_HI_STATE   HI_STATE
#define PAL_LO_STATE   LO_STATE
#define PAL_LO_STATE_PK   LO_STATE_PK
#define PAL_PROTOCOL_D8PSK   PROTOCOL_D8PSK
#define PAL_PROTOCOL_D8PSK_VTB   PROTOCOL_D8PSK_VTB
#define PAL_PROTOCOL_DBPSK   PROTOCOL_DBPSK
#define PAL_PROTOCOL_DBPSK_ROBO   PROTOCOL_DBPSK_ROBO
#define PAL_PROTOCOL_DBPSK_VTB   PROTOCOL_DBPSK_VTB
#define PAL_PROTOCOL_DQPSK   PROTOCOL_DQPSK
#define PAL_PROTOCOL_DQPSK_ROBO   PROTOCOL_DQPSK_ROBO
#define PAL_PROTOCOL_DQPSK_VTB   PROTOCOL_DQPSK_VTB
#define PAL_QT_UNKNOW   0xFF
#define PAL_TIME_MODE_ABSOLUTE   PHY_TX_SCHEDULING_MODE_ABSOLUTE
#define PAL_TIME_MODE_RELATIVE   PHY_TX_SCHEDULING_MODE_RELATIVE
#define PAL_TX_RESULT_BUSY_CH   PHY_TX_RESULT_BUSY_CH
#define PAL_TX_RESULT_BUSY_RX   PHY_TX_RESULT_BUSY_RX
#define PAL_TX_RESULT_BUSY_TX   PHY_TX_RESULT_BUSY_TX
#define PAL_TX_RESULT_INV_BUFFER   PHY_TX_RESULT_INV_BUFFER
#define PAL_TX_RESULT_INV_LENGTH   PHY_TX_RESULT_INV_LENGTH
#define PAL_TX_RESULT_INV_PRIME_MODE   PHY_TX_RESULT_INV_PRIME_MODE
#define PAL_TX_RESULT_INV_SCHEME   PHY_TX_RESULT_INV_SCHEME
#define PAL_TX_RESULT_PROCESS   PHY_TX_RESULT_PROCESS
#define PAL_TX_RESULT_SUCCESS   PHY_TX_RESULT_SUCCESS
#define PAL_TX_RESULT_TIMEOUT   PHY_TX_RESULT_TIMEOUT
#define PAL_VALID_PHY_CFG_KEY   ATPL230_VALID_CFG_KEY
#define PAL_VLO_STATE   VLO_STATE
#define PHY_EVM_THRESHOLD_EX_0   0x5EC6B7
#define PHY_EVM_THRESHOLD_EX_1   0x5363F2
#define PHY_EVM_THRESHOLD_EX_10   0x1A5AEF
#define PHY_EVM_THRESHOLD_EX_11   0x173066
#define PHY_EVM_THRESHOLD_EX_12   0x14673D
#define PHY_EVM_THRESHOLD_EX_13   0x11F3C0
#define PHY_EVM_THRESHOLD_EX_14   0xFCBA5
#define PHY_EVM_THRESHOLD_EX_15   0xDE5DE
#define PHY_EVM_THRESHOLD_EX_16   0xC3A73
#define PHY_EVM_THRESHOLD_EX_17   0xAC260
#define PHY_EVM_THRESHOLD_EX_18   0x9777B
#define PHY_EVM_THRESHOLD_EX_19   0x85457
#define PHY_EVM_THRESHOLD_EX_2   0x495F57
#define PHY_EVM_THRESHOLD_EX_20   0x7542D
#define PHY_EVM_THRESHOLD_EX_21   0x672C8
#define PHY_EVM_THRESHOLD_EX_22   0x5AC78
#define PHY_EVM_THRESHOLD_EX_23   0x4FDFA
#define PHY_EVM_THRESHOLD_EX_24   0x46473
#define PHY_EVM_THRESHOLD_EX_25   0x3DD5D
#define PHY_EVM_THRESHOLD_EX_26   0x36682
#define PHY_EVM_THRESHOLD_EX_27   0x2FDEE
#define PHY_EVM_THRESHOLD_EX_28   0x2A1EB
#define PHY_EVM_THRESHOLD_EX_29   0x250F5
#define PHY_EVM_THRESHOLD_EX_3   0x408ED4
#define PHY_EVM_THRESHOLD_EX_30   0x209B9
#define PHY_EVM_THRESHOLD_EX_31   0x1CB0C
#define PHY_EVM_THRESHOLD_EX_32   0x193E6
#define PHY_EVM_THRESHOLD_EX_33   0x16360
#define PHY_EVM_THRESHOLD_EX_34   0x138AF
#define PHY_EVM_THRESHOLD_EX_35   0x1131F
#define PHY_EVM_THRESHOLD_EX_36   0xF211
#define PHY_EVM_THRESHOLD_EX_37   0xD4FD
#define PHY_EVM_THRESHOLD_EX_38   0xBB66
#define PHY_EVM_THRESHOLD_EX_39   0xA4E3
#define PHY_EVM_THRESHOLD_EX_4   0x38CD66
#define PHY_EVM_THRESHOLD_EX_40   0x9114
#define PHY_EVM_THRESHOLD_EX_41   0x7FA6
#define PHY_EVM_THRESHOLD_EX_42   0x7050
#define PHY_EVM_THRESHOLD_EX_43   0x62D2
#define PHY_EVM_THRESHOLD_EX_44   0x56F3
#define PHY_EVM_THRESHOLD_EX_45   0x4C81
#define PHY_EVM_THRESHOLD_EX_46   0x4350
#define PHY_EVM_THRESHOLD_EX_47   0x3B3A
#define PHY_EVM_THRESHOLD_EX_48   0x341C
#define PHY_EVM_THRESHOLD_EX_49   0x2DDA
#define PHY_EVM_THRESHOLD_EX_5   0x31FA7D
#define PHY_EVM_THRESHOLD_EX_50   0x2857
#define PHY_EVM_THRESHOLD_EX_51   0x237F
#define PHY_EVM_THRESHOLD_EX_52   0x1F3B
#define PHY_EVM_THRESHOLD_EX_53   0x1B7B
#define PHY_EVM_THRESHOLD_EX_54   0x182D
#define PHY_EVM_THRESHOLD_EX_55   0x1546
#define PHY_EVM_THRESHOLD_EX_56   0x12B7
#define PHY_EVM_THRESHOLD_EX_57   0x1078
#define PHY_EVM_THRESHOLD_EX_58   0xE7D
#define PHY_EVM_THRESHOLD_EX_59   0xCC0
#define PHY_EVM_THRESHOLD_EX_6   0x2BF970
#define PHY_EVM_THRESHOLD_EX_7   0x26B10B
#define PHY_EVM_THRESHOLD_EX_8   0x220B1D
#define PHY_EVM_THRESHOLD_EX_9   0x1DF422
#define PHY_EVM_TRESHOLD_EX_LEVELS   60

Referenced by _pal_get_ex_snr().

enum pal_ids
Enumerator
PAL_ID_MAC_EN 
PAL_ID_STATS_RX_BAD_CRC 
PAL_ID_STATS_RX_FALSE_POSITIVE 
PAL_ID_TX_TEST_SEND 
PAL_ID_TX_TEST_SEND_BCN 
PAL_ID_QT 
PAL_ID_EX_SNR 
PAL_ID_CHECK_CFG 
PAL_ID_RESET_CFG 
PAL_ID_DISABLE_BCN_TX 
PAL_ID_ENABLE_CRC 
PAL_ID_INFO_VERSION 
PAL_ID_IMPEDANCE 
PAL_ID_AUTODETECT_LOAD 
PAL_ID_TX_LEVEL 
PAL_ID_TX_SCHEME 
PAL_ID_TXRX_CHANNEL 
PAL_ID_RX_BUFFER_ID 
PAL_ID_RX_SCHEME 
PAL_ID_RX_RSSI_AVG_RX0 
PAL_ID_RX_TIME_RX0 
PAL_ID_EVM_HEADER 
PAL_ID_EVM_PAYLOAD 
PAL_ID_EVM_HEADER_ACUM 
PAL_ID_EVM_PAYLOAD_ACUM 
PAL_ID_RX_PAYLOAD_LEN 
PAL_ID_STATS_RX_TOTAL 
PAL_ID_TX_BUFFER_ID 
PAL_ID_RMSCALC1_TX0 
PAL_ID_EMITIME1_TX0 
PAL_ID_TIME_BEFORE_TX_HIGHZ 
PAL_ID_TIME_BEFORE_TX_LOWZ 
PAL_ID_SNA 

static uint8_t _pal_get_ex_snr ( void  )
static

Get the extended signal noise ratio value.

Return values
SNRin a 60-value table

References xPhyMsgRx_t::evm_payload_acum, and PHY_EVM_TRESHOLD_EX_LEVELS.

Referenced by pal_get_cfg_ex().

static uint8_t _pal_get_qt ( void  )
static

Calculates the QT value with the last message rx parameters.

Return values
QTvalue

References phy_get_cfg_param(), REG_ATPL230_TXRXBUF_CINRMIN_RX0, and xPhyMsgRx_t::uc_buff_id.

Referenced by pal_get_cfg_ex(), and pal_snr_get().

uint8_t pal_agc_get ( uint8_t *  puc_mode,
uint8_t *  puc_gain 
)

Get Automatic Gain Mode (AGC)

Parameters
puc_modePointer to Auto/Manual mode
puc_gainPointer to initial receiving gain in auto mode
Returns
PAL_CFG_SUCCESS if there is no error, otherwise returns PAL_CFG_INVALID_INPUT.

References PAL_CFG_INVALID_INPUT.

uint8_t pal_agc_set ( uint8_t  uc_mode,
uint8_t  uc_gain 
)

Set Automatic Gain Mode (AGC)

Parameters
uc_modeAuto/Manual mode
uc_gainInitial receiving gain in auto mode
Returns
PAL_CFG_SUCCESS if there is no error, otherwise returns PAL_CFG_INVALID_INPUT.

References PAL_CFG_INVALID_INPUT, and UNUSED.

uint8_t pal_cd_get ( uint8_t *  puc_cd,
uint8_t *  puc_rssi,
uint32_t *  pul_time,
uint8_t *  puc_header 
)

Get carrier detect.

Parameters
puc_cdPointer to carrier detect
puc_rssiPointer to RSSI
pul_timePointer to time
puc_headerPointer to header type
Returns
PAL_CFG_SUCCESS if there is no error, otherwise returns PAL_CFG_INVALID_INPUT.

References phy_get_cfg_param(), and REG_ATPL230_PHY_SFR.

uint8_t pal_cmd_cfg_ex ( uint16_t  us_id,
uint8_t  uc_cmd,
uint8_t  uc_mask 
)

Binary Command extended PHY layer parameter.

Parameters
us_idParameter Identification (see atpl230.h)
uc_cmdCommand [PAL_CMD_REG_AND, PAL_CMD_REG_OR, PAL_CMD_REG_XOR]
uc_maskBit mask
Returns
PAL_CFG_SUCCESS if there is no error, otherwise returns PAL_CFG_INVALID_INPUT.

References ATPL230_REG_PARAM, PAL_CFG_INVALID_INPUT, and phy_cmd_cfg_param().

void pal_data_indication ( uint8_t *  puc_psdu,
uint16_t *  pus_len,
uint8_t *  puc_level,
uint8_t *  puc_scheme,
uint32_t *  pul_time 
)

Check if a message has been received from PHY layer.

Parameters
puc_psduPointer to data buffer with the received message
pus_lenLength of data buffer
puc_levelLevel of received message
puc_schemeModulation scheme of received message
pul_timeReception instant

References xPhyMsgRx_t::data_buf, xPhyMsgRx_t::data_len, xPhyMsgRx_t::rssi_avg, xPhyMsgRx_t::rx_time, and xPhyMsgRx_t::scheme.

void pal_data_indication_ex ( xPalMsgRx_t px_msg)

Check if a message has been received from PHY layer.

Parameters
px_msgPointer to reception data

References xPalMsgRx_t::data_buf, xPalMsgRx_t::data_len, xPhyMsgRx_t::data_len, xPalMsgRx_t::header_type, PHY_HT_BEACON, PHY_HT_GENERIC, xPalMsgRx_t::rx_time, and xPalMsgRx_t::uc_buff_id.

uint8_t pal_data_request ( uint8_t *  puc_mpdu,
uint16_t  us_len,
uint8_t  uc_level,
uint8_t  uc_scheme,
uint32_t  ul_time 
)

Send message using standard PHY layer.

Parameters
puc_mpduPointer to transmission data
us_lenLength of transmission data
uc_levelTransmission level
uc_schemeModulation scheme
ul_timeAbsolut Time to transmit in 10us.
Return values
0if ok
otherwisetransmission error

References xPalMsgTx_t::att_level, xPalMsgTx_t::data_buf, xPalMsgTx_t::data_len, xPalMsgTx_t::disable_rx, xPalMsgTx_t::mode, MODE_PRIME_V1_3, pal_data_request_ex(), PHY_TX_SCHEDULING_MODE_ABSOLUTE, xPalMsgTx_t::scheme, xPalMsgTx_t::tdelay, xPalMsgTx_t::tmode, and xPalMsgTx_t::uc_buff_id.

uint8_t pal_data_request_ex ( xPalMsgTx_t px_msg)
uint8_t pal_get_cfg_ex ( uint16_t  us_id,
void *  p_val,
uint16_t  uc_len 
)
static void pal_get_rx ( void *  pvParameters)
static
static void pal_get_tx_result ( void *  pvParameters)
static

Get result from transmission.

Parameters
pvParametersParameters

References phy_get_cfg_param(), phy_tx_frame_result_cb(), REG_ATPL230_TXRXBUF_EMITIME1_TX0, xPhyMsgTxResult_t::uc_id_buffer, xPhyMsgTxResult_t::uc_result, and UNUSED.

Referenced by pal_process().

void pal_init ( void  )

This function initiates PRIME PHY layer configuration and it must be implemented externally by the user.

Initialization of PAL.

Note
Init PHY layer configuration with the rest of PHY layer functions. This function will be invoked by function phy_init() and it allows the user to configure PHY layer initialization. Users can adapt the PHY layer to every hardware platform. This is an example of usage, configuring analog front end and different thresholds for load detection. ATMEL strongly recommends to consult with technical support to change any parameter in this file.

Referenced by _prime_stack_process(), and tal_init().

uint8_t pal_nl_get ( uint8_t *  puc_noise)

Get Noise Level (NL)

Parameters
puc_noisePointer to Noise Level
Returns
PAL_CFG_SUCCESS if there is no error, otherwise returns PAL_CFG_INVALID_INPUT.

References PAL_CFG_SUCCESS, phy_get_cfg_param(), PHY_ID_TX_BUFFER_ID, REG_ATPL230_TXRXBUF_CINRMIN_RX0, and REG_ATPL230_TXRXBUF_RSSIAVG_RX0.

void pal_process ( void  )

This function runs the PAL layer process.

It must be called periodically.

References NULL, pal_get_rx(), and pal_get_tx_result().

Referenced by _prime_stack_process().

uint8_t pal_set_cfg_ex ( uint16_t  us_id,
void *  p_val,
uint16_t  uc_len 
)

Set extended PHY layer parameter.

Parameters
us_idParameter Identification (see atpl230.h)
*p_valPointer to parameter value
uc_lenLength of the parameter
Returns
PAL_CFG_SUCCESS if there is no error, otherwise returns PAL_CFG_INVALID_INPUT.

References PAL_CFG_SUCCESS, PAL_ID_DISABLE_BCN_TX, PAL_ID_ENABLE_CRC, PAL_ID_MAC_EN, PAL_ID_RESET_CFG, PAL_ID_SNA, PAL_ID_STATS_RX_FALSE_POSITIVE, pcrc_configure_sna(), phy_mac_crc_disable(), phy_mac_crc_enable(), phy_reset(), PHY_RESET_SOFT_TYPE, phy_set_cfg_param(), and phy_transmission_buff_disable().

uint8_t pal_snr_get ( uint8_t *  puc_snr,
uint8_t  uc_qt 
)

Get Signal Noise Ratio (SNR)

Parameters
puc_snrSNR parameter
uc_qtQT parameter to get SNR level. If uc_qt = 0xFF, the qt is calculated from last rx message
Returns
PAL_CFG_SUCCESS if there is no error, otherwise returns PAL_CFG_INVALID_INPUT.

References _pal_get_qt(), PAL_CFG_SUCCESS, and PAL_QT_UNKNOW.

Referenced by serial_if_sniffer_pack_pdu().

uint8_t pal_timer_get ( uint32_t *  pul_timer)

Get timer.

Parameters
pul_timerPointer to timer
Returns
PAL_CFG_SUCCESS if there is no error, otherwise returns PAL_CFG_INVALID_INPUT.

References PAL_CFG_INVALID_INPUT, PAL_CFG_SUCCESS, phy_get_cfg_param(), and REG_ATPL230_VHIGH_TIMER_BEACON_REF.

Referenced by serial_if_sniffer_pack_pdu().

uint8_t pal_zct_get ( uint32_t *  pul_zct)

Get zero-cross time.

Parameters
pul_zctPointer to zero-cross time
Returns
1 if there is no error, otherwise returns PAL_CFG_INVALID_INPUT.

References phy_get_cfg_param(), PHY_ID_RX_BUFFER_ID, and REG_ATPL230_TXRXBUF_ZCT1_RX0.

uint32_t l_tx_time
const uint32_t phyEvmThresholdEx[]
uint8_t uc_pal_crc_enable
static

Referenced by pal_get_cfg_ex().

uint8_t uc_pal_data_buf_rx[PHY_MAX_PPDU_SIZE]
static

Referenced by pal_get_rx().

uint8_t uc_rx_msg_flag
static
uint8_t uc_tx_bcn_res_flag
static
uint8_t uc_tx_delay
uint8_t uc_tx_head_type
uint8_t uc_tx_level
uint8_t uc_tx_res_flag
static
uint8_t uc_tx_scheme
uint16_t ul_rx_bad_crc
static

Referenced by pal_get_cfg_ex().

uint16_t ul_rx_false_positive
static

Referenced by pal_get_cfg_ex().

xPhyMsgTxResult_t x_pal_bcn_tx_res
static
xPhyMsgRx_t x_pal_rx_msg
static
xPhyMsgTxResult_t x_pal_tx_res
static