nRF5 SDK v17.1.0
Modules | Data Structures | Macros | Typedefs | Functions
Radio Abstraction Layer common API

Radio abstraction layer common interface. More...

Modules

 RAL Special API
 
 RAL FSM API
 
 RAL FSM private API
 
 RAL auxiliary functions
 
 RAL RF initialization API
 

Data Structures

struct  ral_mem_t
 

Macros

#define PHR_POS   0
 
#define PHR_SIZE   1
 
#define CRC_SIZE   2
 
#define MAC_FRAME_CTRL_POS   0
 
#define MAC_FRAME_CTRL_SIZE   2
 
#define ACK_REQUEST_MASK   0x20
 
#define SEQ_NUM_POS   (MAC_FRAME_CTRL_POS + MAC_FRAME_CTRL_SIZE)
 
#define ACK_PD_BIT_MASK   0x0010
 
#define FRAME_TYPE_MASK   0x0007
 
#define FRAME_TYPE_BEACON   0x0000
 
#define FRAME_TYPE_DATA   0x0001
 
#define FRAME_TYPE_ACK   0x0002
 
#define FRAME_TYPE_COMMAND   0x0003
 
#define FRAME_PENDING_MASK   0x0010
 

Typedefs

typedef volatile uint8_t ral_atomic_t
 RAL atomic section.
 

Functions

void ral_init (void)
 Initializes radio abstraction layer.
 
void ral_reset (void)
 Resets radio abstraction layer.
 
uint8_t ral_ed_perform (void)
 Performs synchronous ED measurement.
 
phy_enum_t ral_state_set (const phy_enum_t state)
 Sends request to change radio state. More...
 
phy_enum_t ral_state_get (void)
 Returns current state of radio.
 
void ral_sleep (void)
 Puts radio into sleep mode.
 
void ral_wakeup (void)
 Awakes a radio.
 
phy_status_t ral_cca_perform (void)
 Performs synchronous cca.
 
void ral_data_req (pd_data_req_t *pd_data)
 Sends PHY frame. More...
 
pd_data_ind_tral_data_ind_read (void)
 Reads indication frame from radio. More...
 
void ral_data_flow_enable (void)
 Enable data flow from radio hardware after it was disabled by ral_data_flow_disable().
 
void ral_data_flow_disable (void)
 Disable data flow from radio hardware.
 
void ral_attribute_set (uint8_t id, const void *p_value)
 This function is used to set attribute from MAC or PHY layer without checking of its boundaries. More...
 
void ral_attribute_get (uint8_t id, void *p_attr_value)
 This function is used to get a copy of attribute value stored inside radio module. More...
 
mac_timestamp_t ral_rx_start_time (mac_timestamp_t irq_time, uint8_t frame_size)
 This function is used to define frame start time by it's size and the timestamp, when RX IRQ has been received. More...
 
uint8_t ral_rssi_get (void)
 This function performs RSSI. More...
 
uint8_t ral_rssi_corrected_get (uint8_t rssi, int8_t temp)
 This function calculates the adjusted RSSI value using a temperature correction factor. More...
 

Detailed Description

Radio abstraction layer common interface.

These are requirements for the implementation code:

     - no frames must be received between new frame indication and
       a call to ral_data_ind_read.

Function Documentation

void ral_attribute_get ( uint8_t  id,
void *  p_attr_value 
)

This function is used to get a copy of attribute value stored inside radio module.

Parameters
[in]id- one of PHY_CURRENT_CHANNEL_ID, PHY_TRANSMIT_POWER_ID or PHY_CCA_MODE_ID. Other attributes are not supported.
[out]p_attr_value- pointer to value to get.
void ral_attribute_set ( uint8_t  id,
const void *  p_value 
)

This function is used to set attribute from MAC or PHY layer without checking of its boundaries.

Parameters
id- one of MAC_SHORT_ADDRESS, MAC_EXTENDED_ADDRESS, MAC_PAN_ID and some other values.
p_value- pointer to new value.
pd_data_ind_t* ral_data_ind_read ( void  )

Reads indication frame from radio.

Return values
Pointeron the structure of a PHY data indication with received frame.
void ral_data_req ( pd_data_req_t pd_data)

Sends PHY frame.

Parameters
[in]pd_data- full data frame to be send.

RAL automatically adds header and FCS control bytes to pd_data. Caller must reserve 1 byte before psdu pointer and may leave last two bytes of payload (i.e. FCS control field) uninitialized.

RF chip or RAL code is responsible to receive an ACK frame. After ACK is handled, device should be restored to the TX state.

uint8_t ral_rssi_corrected_get ( uint8_t  rssi,
int8_t  temp 
)

This function calculates the adjusted RSSI value using a temperature correction factor.

Parameters
[in]rssi- RSSI sample value (as returned by ral_rssi_get).
[in]temp- Temperature value in °C.
Returns
Temperature-corrected RSSI value.
uint8_t ral_rssi_get ( void  )

This function performs RSSI.

Returns
RSSI sample value.
mac_timestamp_t ral_rx_start_time ( mac_timestamp_t  irq_time,
uint8_t  frame_size 
)

This function is used to define frame start time by it's size and the timestamp, when RX IRQ has been received.

Parameters
irq_time- moment when IRQ has been received.
frame_size- size of received frame in bytes.
Return values
MACtimestamp when PHY header has been started to receive.
phy_enum_t ral_state_set ( const phy_enum_t  state)

Sends request to change radio state.

Parameters
state- New radio state. One of...
Returns
PHY_SUCCESS, if state has been successfully achieved; current state, if state cannot be reached.

Documentation feedback | Developer Zone | Subscribe | Updated