Rtos API example

Embed: (wiki syntax)

« Back to documentation index

arm_hal_phy.h File Reference

arm_hal_phy.h File Reference

PHY device driver API. More...

Go to the source code of this file.

Data Structures

struct  phy_signal_info_s
 Signal level info. More...
struct  phy_rf_channel_configuration_s
 Channel configuration. More...
struct  phy_device_channel_page_s
 Channel page configuration. More...
struct  virtual_data_req_s
 Virtual data request. More...
struct  phy_device_driver_s
 Device driver structure. More...

Typedefs

typedef enum phy_link_type_e phy_link_type_e
 PHY types.
typedef enum data_protocol_e data_protocol_e
 Data layers.
typedef enum driver_data_request_e driver_data_request_e
 Requested data layer.
typedef enum phy_signal_info_type_e phy_signal_info_type_e
 Signal info types.
typedef struct phy_signal_info_s phy_signal_info_s
 Signal level info.
typedef enum phy_modulation_e phy_modulation_e
 PHY modulation scheme.
typedef struct
phy_rf_channel_configuration_s 
phy_rf_channel_configuration_s
 Channel configuration.
typedef struct
phy_device_channel_page_s 
phy_device_channel_page_s
 Channel page configuration.
typedef struct virtual_data_req_s virtual_data_req_t
 Virtual data request.
typedef int8_t arm_net_phy_rx_fn (const uint8_t *data_ptr, uint16_t data_len, uint8_t link_quality, int8_t dbm, int8_t driver_id)
 arm_net_phy_rx RX callback set by upper layer.
typedef int8_t arm_net_phy_tx_done_fn (int8_t driver_id, uint8_t tx_handle, phy_link_tx_status_e status, uint8_t cca_retry, uint8_t tx_retry)
 arm_net_phy_tx_done TX done callback set by upper layer.
typedef int8_t arm_net_virtual_rx_fn (const uint8_t *data_ptr, uint16_t data_len, int8_t driver_id)
 arm_net_virtual_rx RX callback set by user of serial MAC.
typedef int8_t arm_net_virtual_tx_fn (const virtual_data_req_t *data_req, int8_t driver_id)
 arm_net_virtual_tx TX callback set by serial MAC.
typedef int8_t arm_net_virtual_config_rx_fn (int8_t driver_id, const uint8_t *data, uint16_t length)
 arm_net_virtual_config Configuration receive callback set by upper layer.
typedef int8_t arm_net_virtual_config_tx_fn (int8_t driver_id, const uint8_t *data, uint16_t length)
 arm_net_virtual_config Configuration send callback set by upper layer.
typedef int8_t arm_net_virtual_confirmation_rx_fn (int8_t driver_id, const uint8_t *data, uint16_t length)
 arm_net_virtual_confirmation Confirmation receive callback set by upper layer.
typedef struct phy_device_driver_s phy_device_driver_s
 Device driver structure.

Enumerations

enum  phy_interface_state_e {
  PHY_INTERFACE_RESET, PHY_INTERFACE_DOWN, PHY_INTERFACE_UP, PHY_INTERFACE_RX_ENERGY_STATE,
  PHY_INTERFACE_SNIFFER_STATE
}
 

Interface states.

More...
enum  phy_link_tx_status_e {
  PHY_LINK_TX_DONE, PHY_LINK_TX_DONE_PENDING, PHY_LINK_TX_SUCCESS, PHY_LINK_TX_FAIL,
  PHY_LINK_CCA_FAIL
}
 

TX process return codes.

More...
enum  phy_extension_type_e {
  PHY_EXTENSION_CTRL_PENDING_BIT, PHY_EXTENSION_READ_LAST_ACK_PENDING_STATUS, PHY_EXTENSION_SET_CHANNEL, PHY_EXTENSION_READ_CHANNEL_ENERGY,
  PHY_EXTENSION_READ_LINK_STATUS, PHY_EXTENSION_CONVERT_SIGNAL_INFO, PHY_EXTENSION_ACCEPT_ANY_BEACON
}
 

Extension types.

More...
enum  phy_address_type_e { PHY_MAC_48BIT, PHY_MAC_64BIT, PHY_MAC_16BIT, PHY_MAC_PANID }
 

Address types.

More...
enum  phy_link_type_e {
  PHY_LINK_ETHERNET_TYPE, PHY_LINK_15_4_2_4GHZ_TYPE, PHY_LINK_15_4_SUBGHZ_TYPE, PHY_LINK_TUN,
  PHY_LINK_SLIP
}
 

PHY types.

More...
enum  data_protocol_e {
  LOCAL_SOCKET_DATA = 0, INTERFACE_DATA = 1, PHY_LAYER_PAYLOAD = 2, IPV6_DATAGRAM = 3,
  UNKNOWN_PROTOCOL = 4
}
 

Data layers.

More...
enum  driver_data_request_e { PHY_LAYER_PAYLOAD_DATA_FLOW, IPV6_DATAGRAMS_DATA_FLOW }
 

Requested data layer.

More...
enum  phy_signal_info_type_e { PHY_SIGNAL_INFO_ETX, PHY_SIGNAL_INFO_IDR, PHY_SIGNAL_INFO_LINK_MARGIN }
 

Signal info types.

More...
enum  phy_modulation_e {
  M_OFDM, M_OQPSK, M_BPSK, M_GFSK,
  M_UNDEFINED
}
 

PHY modulation scheme.

More...
enum  channel_page_e {
  CHANNEL_PAGE_0 = 0, CHANNEL_PAGE_1 = 1, CHANNEL_PAGE_2 = 2, CHANNEL_PAGE_3 = 3,
  CHANNEL_PAGE_4 = 4, CHANNEL_PAGE_5 = 5, CHANNEL_PAGE_6 = 6, CHANNEL_PAGE_9 = 9,
  CHANNEL_PAGE_10 = 10
}
 

Channel page numbers.

More...

Functions

int8_t arm_net_phy_register (phy_device_driver_s *phy_driver)
 This function registers the device driver to stack.
int8_t arm_net_phy_mac64_set (uint8_t *MAC, int8_t id)
 Set driver mac64 address.
uint8_t * arm_net_phy_mac64_get (int8_t id)
 Get driver mac64 address.
int arm_net_phy_rf_type (int8_t id)
 Get driver link type.
uint16_t arm_net_phy_mtu_size (int8_t id)
 Get driver link type MTU size.
void arm_net_phy_unregister (int8_t driver_id)
 Unregister the driver from storage.

Detailed Description

PHY device driver API.

Definition in file arm_hal_phy.h.


Typedef Documentation

typedef int8_t arm_net_phy_rx_fn(const uint8_t *data_ptr, uint16_t data_len, uint8_t link_quality, int8_t dbm, int8_t driver_id)

arm_net_phy_rx RX callback set by upper layer.

Called when data is received

Parameters:
data_ptrData received
data_lenLength of the data received
link_qualityLink quality
dbmPower ratio in decibels
driver_idID of driver which received data
Returns:
0 if success, error otherwise

Definition at line 168 of file arm_hal_phy.h.

typedef int8_t arm_net_phy_tx_done_fn(int8_t driver_id, uint8_t tx_handle, phy_link_tx_status_e status, uint8_t cca_retry, uint8_t tx_retry)

arm_net_phy_tx_done TX done callback set by upper layer.

Called when tx sent by upper layer has been handled

Parameters:
driver_idId of the driver which handled TX request
tx_handleHandle of the TX
statusStatus code of the TX handling result
cca_retryNumber of CCA retries done during handling
tx_retryNumber of TX retries done during handling
Returns:
0 if success, error otherwise

Definition at line 179 of file arm_hal_phy.h.

typedef int8_t arm_net_virtual_config_rx_fn(int8_t driver_id, const uint8_t *data, uint16_t length)

arm_net_virtual_config Configuration receive callback set by upper layer.

Used to receive internal configuration parameters.

Parameters:
driver_idId of the driver to be used.
dataPointer to received configuration data.
lengthLength of the configuration data.
Returns:
0 if success, error otherwise

Definition at line 205 of file arm_hal_phy.h.

typedef int8_t arm_net_virtual_config_tx_fn(int8_t driver_id, const uint8_t *data, uint16_t length)

arm_net_virtual_config Configuration send callback set by upper layer.

Used to send internal configuration parameters.

Parameters:
driver_idId of the driver to be used.
dataPointer to sent configuration data.
lengthLength of the configuration data.
Returns:
0 if success, error otherwise

Definition at line 214 of file arm_hal_phy.h.

typedef int8_t arm_net_virtual_confirmation_rx_fn(int8_t driver_id, const uint8_t *data, uint16_t length)

arm_net_virtual_confirmation Confirmation receive callback set by upper layer.

Used to receive MLME confirmation data.

Parameters:
driver_idId of the driver to be used.
dataPointer to received confirmation data.
lengthLength of the confirmation data.
Returns:
0 if success, error otherwise

Definition at line 223 of file arm_hal_phy.h.

typedef int8_t arm_net_virtual_rx_fn(const uint8_t *data_ptr, uint16_t data_len, int8_t driver_id)

arm_net_virtual_rx RX callback set by user of serial MAC.

Called when virtual RF has received data.

Parameters:
data_ptrData received
data_lenLength of the data received
driver_idID of driver which received data
Returns:
0 if success, error otherwise

Definition at line 188 of file arm_hal_phy.h.

typedef int8_t arm_net_virtual_tx_fn(const virtual_data_req_t *data_req, int8_t driver_id)

arm_net_virtual_tx TX callback set by serial MAC.

Used to send data.

Parameters:
data_reqData to be sent
driver_idId of the driver to be used.
Returns:
0 if success, error otherwise

Definition at line 196 of file arm_hal_phy.h.

Data layers.

Requested data layer.

Channel page configuration.

Device driver structure.

PHY types.

PHY modulation scheme.

Channel configuration.

Signal level info.

Signal info types.

Types of signal quality indication desired by various link protocols. Some are really statistical, but a driver should ideally be able to create an estimate based on its LQI/DBM numbers, for example to bootstrap a statistic calculation.

Virtual data request.


Enumeration Type Documentation

Channel page numbers.

Enumerator:
CHANNEL_PAGE_0 

Page 0.

CHANNEL_PAGE_1 

Page 1.

CHANNEL_PAGE_2 

Page 2.

CHANNEL_PAGE_3 

Page 3.

CHANNEL_PAGE_4 

Page 4.

CHANNEL_PAGE_5 

Page 5.

CHANNEL_PAGE_6 

Page 6.

CHANNEL_PAGE_9 

Page 9.

CHANNEL_PAGE_10 

Page 10.

Definition at line 121 of file arm_hal_phy.h.

Data layers.

Enumerator:
LOCAL_SOCKET_DATA 

6LoWPAN library local socket data.

INTERFACE_DATA 

6LoWPAN library interface internal used protocol.

PHY_LAYER_PAYLOAD 

PHY layer data selection or handler.

IPV6_DATAGRAM 

IP layer data or TUN driver request data.

UNKNOWN_PROTOCOL 

Non-supported protocol ID.

Definition at line 76 of file arm_hal_phy.h.

Requested data layer.

Enumerator:
PHY_LAYER_PAYLOAD_DATA_FLOW 

PHY layer data.

IPV6_DATAGRAMS_DATA_FLOW 

IP layer data or TUN driver request data.

Definition at line 85 of file arm_hal_phy.h.

Address types.

Enumerator:
PHY_MAC_48BIT 

IPv4/IPv6/BLE link layer address for Ethernet.

This is optional.

PHY_MAC_64BIT 

RF/PLC link layer address.

PHY_MAC_16BIT 

RF interface short address.

PHY_MAC_PANID 

RF interface 16-Bit PAN-ID.

Definition at line 59 of file arm_hal_phy.h.

Extension types.

Enumerator:
PHY_EXTENSION_CTRL_PENDING_BIT 

Control MAC pending bit for indirect data.

PHY_EXTENSION_READ_LAST_ACK_PENDING_STATUS 

Read status if the last ACK is still pending.

PHY_EXTENSION_SET_CHANNEL 

Net library channel set.

PHY_EXTENSION_READ_CHANNEL_ENERGY 

RF interface ED scan energy read.

PHY_EXTENSION_READ_LINK_STATUS 

Net library could read link status.

PHY_EXTENSION_CONVERT_SIGNAL_INFO 

Convert signal info.

PHY_EXTENSION_ACCEPT_ANY_BEACON 

Set boolean true or false for accept beacon from other Pan-ID than configured.

Default value should be false

Definition at line 48 of file arm_hal_phy.h.

Interface states.

Enumerator:
PHY_INTERFACE_RESET 

Reset PHY driver and set to idle.

PHY_INTERFACE_DOWN 

Disable PHY interface driver (RF radio disable).

PHY_INTERFACE_UP 

Enable PHY interface driver (RF radio receiver ON).

PHY_INTERFACE_RX_ENERGY_STATE 

Enable wireless interface ED scan mode.

PHY_INTERFACE_SNIFFER_STATE 

Enable sniffer mode.

Definition at line 30 of file arm_hal_phy.h.

TX process return codes.

Enumerator:
PHY_LINK_TX_DONE 

TX process ready and ACK RX.

PHY_LINK_TX_DONE_PENDING 

TX process OK with ACK pending flag.

PHY_LINK_TX_SUCCESS 

MAC TX complete.

MAC will a make decision to enter wait ACK or TX done state.

PHY_LINK_TX_FAIL 

Link TX process fail.

PHY_LINK_CCA_FAIL 

RF link CCA process fail.

Definition at line 39 of file arm_hal_phy.h.

PHY types.

Enumerator:
PHY_LINK_ETHERNET_TYPE 

Standard IEEE 802 Ethernet.

PHY_LINK_15_4_2_4GHZ_TYPE 

Standard 802.15.4 2.4GHz radio.

PHY_LINK_15_4_SUBGHZ_TYPE 

Standard 802.15.4 subGHz radio 868 /915MHz.

PHY_LINK_TUN 

Tunnel interface for Linux TUN, RF network driver over serial bus or just basic application to application data flow.

PHY_LINK_SLIP 

Generic SLIP driver which just forward SLIP payload.

Definition at line 67 of file arm_hal_phy.h.

PHY modulation scheme.

Enumerator:
M_OFDM 

QFDM.

M_OQPSK 

OQPSK.

M_BPSK 

BPSK.

M_GFSK 

GFSK.

M_UNDEFINED 

UNDEFINED.

Definition at line 111 of file arm_hal_phy.h.

Signal info types.

Types of signal quality indication desired by various link protocols. Some are really statistical, but a driver should ideally be able to create an estimate based on its LQI/DBM numbers, for example to bootstrap a statistic calculation.

Enumerator:
PHY_SIGNAL_INFO_ETX 

Expected transmissions, unsigned 16-bit fixed-point ETX*128 [1..512], for example Zigbee IP + RFC 6719.

PHY_SIGNAL_INFO_IDR 

Inverse Delivery Ratio, unsigned 16-bit fixed-point IDR*32*256 [1..8], for example MLE draft 06.

PHY_SIGNAL_INFO_LINK_MARGIN 

Link margin, unsigned 16-bit fixed-point dB*256, [0..255], for example Thread routing draft.

Definition at line 96 of file arm_hal_phy.h.


Function Documentation

uint8_t* arm_net_phy_mac64_get ( int8_t  id )

Get driver mac64 address.

Parameters:
iddriver id
Returns:
> 0 Return pointer to MAC.
NULL.
int8_t arm_net_phy_mac64_set ( uint8_t *  MAC,
int8_t  id 
)

Set driver mac64 address.

Parameters:
MACA pointer to new mac64 address which is copied to old one.
iddriver id
Returns:
>= 0 SET OK.
< 0 Means register fail.
uint16_t arm_net_phy_mtu_size ( int8_t  id )

Get driver link type MTU size.

Parameters:
iddriver id
Returns:
size of MTU.
int8_t arm_net_phy_register ( phy_device_driver_s phy_driver )

This function registers the device driver to stack.

Parameters:
phy_driverA pointer to device driver structure.
Returns:
>= 0 Device driver ID.
< 0 Means register fail.
int arm_net_phy_rf_type ( int8_t  id )

Get driver link type.

Parameters:
iddriver id
Returns:
driver link type.
void arm_net_phy_unregister ( int8_t  driver_id )

Unregister the driver from storage.

Parameters:
driver_iddriver id