Rtos API example

Embed: (wiki syntax)

« Back to documentation index

mac_api.h File Reference

mac_api.h File Reference

A API class to support different MACs from multiple vendors. More...

Go to the source code of this file.

Data Structures

struct  mac_api_s
 Struct mac_api_s defines functions for two-way communications between external MAC and Upper layer. More...

Typedefs

typedef void mlme_request (const mac_api_t *api, mlme_primitive id, const void *data)
 mlme_associate_response
typedef void mcps_data_request (const mac_api_t *api, const mcps_data_req_t *data)
 mcps_request MCPS_DATA request call
typedef void mcps_purge_request (const mac_api_t *api, const mcps_purge_t *data)
 mcps_purge_request MCPS_PURGE request call
typedef void mcps_data_confirm (const mac_api_t *api, const mcps_data_conf_t *data)
 mcps_data_confirm MCPS-DATA confirm is called as a response to MCPS-DATA request
typedef void mcps_data_indication (const mac_api_t *api, const mcps_data_ind_t *data)
 mcps_data_indication MCPS-DATA indication is called when MAC layer has received data
typedef void mcps_purge_confirm (const mac_api_t *api, mcps_purge_conf_t *data)
 mcps_purge_confirm MCPS-PURGE confirm is called as a response to MCPS-PURGE request
typedef void mlme_confirm (const mac_api_t *api, mlme_primitive id, const void *data)
 mlme_confirm One of the MLME primitive confirm callbacks
typedef void mlme_indication (const mac_api_t *api, mlme_primitive id, const void *data)
 mlme_indication One of the
typedef int8_t mac_ext_mac64_address_set (const mac_api_t *api, const uint8_t *mac64)
 Set extended address from MAC.
typedef int8_t mac_ext_mac64_address_get (const mac_api_t *api, mac_extended_address_type type, uint8_t *mac64_buf)
 Read extended address from MAC.
typedef int8_t mac_storage_decription_sizes_get (const mac_api_t *api, mac_description_storage_size_t *buffer)
 Read MAC security description storage sizes from MAC.
typedef int8_t mac_api_initialize (mac_api_t *api, mcps_data_confirm *data_conf_cb, mcps_data_indication *data_ind_cb, mcps_purge_confirm *purge_conf_cb, mlme_confirm *mlme_conf_cb, mlme_indication *mlme_ind_cb, int8_t parent_id)
 mac_api_initialize Initialises MAC layer into use, callbacks must be non-NULL.

Enumerations

enum  mlme_primitive
 

Every MAC adapting to Upper layer must implement a function which creates mac_api_t pointer, e.g 'mac_api_t* create_mac_api();' In the function external Mac needs to fill necessary function pointers so that Upper layer can use it.

More...
enum  mac_extended_address_type { , MAC_EXTENDED_DYNAMIC }
 

Enum for MAC extended address types.

More...

Detailed Description

A API class to support different MACs from multiple vendors.

Vendor must implement a function which fills supported callback functions which Upper layer will use.

Definition in file mac_api.h.


Typedef Documentation

typedef int8_t mac_api_initialize(mac_api_t *api, mcps_data_confirm *data_conf_cb, mcps_data_indication *data_ind_cb, mcps_purge_confirm *purge_conf_cb, mlme_confirm *mlme_conf_cb, mlme_indication *mlme_ind_cb, int8_t parent_id)

mac_api_initialize Initialises MAC layer into use, callbacks must be non-NULL.

Parameters:
apimac_api_t pointer, which is created by application.
data_conf_cbUpper layer function to handle MCPS confirmations
data_ind_cbUpper layer function to handle MCPS indications
mlme_conf_cbUpper layer function to handle MLME confirmations
mlme_ind_cbUpper layer function to handle MLME indications
parent_idUpper layer id, which is used in confirmation and indication callbacks
Returns:
-1 if error, -2 if OOM, 0 otherwise

Definition at line 197 of file mac_api.h.

typedef int8_t mac_ext_mac64_address_get(const mac_api_t *api, mac_extended_address_type type, uint8_t *mac64_buf)

Read extended address from MAC.

Parameters:
apiAPI to handle the request
mac64_bufPointer where mac extended address can be written

Definition at line 178 of file mac_api.h.

typedef int8_t mac_ext_mac64_address_set(const mac_api_t *api, const uint8_t *mac64)

Set extended address from MAC.

Parameters:
apiAPI to handle the request
mac64pointer

Definition at line 171 of file mac_api.h.

Read MAC security description storage sizes from MAC.

Parameters:
apiAPI to handle the request
bufferPointer where supported sizes can be written

Definition at line 185 of file mac_api.h.

typedef void mcps_data_confirm(const mac_api_t *api, const mcps_data_conf_t *data)

mcps_data_confirm MCPS-DATA confirm is called as a response to MCPS-DATA request

Parameters:
apiThe API which handled the response
dataMCPS-DATA.confirm specific values

Definition at line 134 of file mac_api.h.

typedef void mcps_data_indication(const mac_api_t *api, const mcps_data_ind_t *data)

mcps_data_indication MCPS-DATA indication is called when MAC layer has received data

Parameters:
apiThe API which handled the response
dataMCPS-DATA.indication specific values

Definition at line 141 of file mac_api.h.

typedef void mcps_data_request(const mac_api_t *api, const mcps_data_req_t *data)

mcps_request MCPS_DATA request call

Parameters:
apiAPI to handle the request
dataMCPS-DATA.request specific values

Definition at line 118 of file mac_api.h.

typedef void mcps_purge_confirm(const mac_api_t *api, mcps_purge_conf_t *data)

mcps_purge_confirm MCPS-PURGE confirm is called as a response to MCPS-PURGE request

Parameters:
apiThe API which handled the request
dataMCPS-PURGE.confirm specific values

Definition at line 148 of file mac_api.h.

typedef void mcps_purge_request(const mac_api_t *api, const mcps_purge_t *data)

mcps_purge_request MCPS_PURGE request call

Parameters:
apiAPI to handle the request
dataMCPS-PURGE.request specific values

Definition at line 125 of file mac_api.h.

typedef void mlme_confirm(const mac_api_t *api, mlme_primitive id, const void *data)

mlme_confirm One of the MLME primitive confirm callbacks

Parameters:
apiAPI which handled the response
idThe identifier of the MLME primitive
dataPrimitive specific data (
See also:
mlme.h)

Definition at line 156 of file mac_api.h.

typedef void mlme_indication(const mac_api_t *api, mlme_primitive id, const void *data)

mlme_indication One of the

Parameters:
apiAPI which handled the response
idThe identifier of the MLME primitive
dataPrimitive specific data (
See also:
mlme.h)

Definition at line 164 of file mac_api.h.

typedef void mlme_request(const mac_api_t *api, mlme_primitive id, const void *data)

mlme_associate_response

Parameters:
apiAPI to handle the request
dataMLME-ASSOCIATE.response specific values mlme_request
apiAPI to handle the request
idThe identifier of the MLME primitive
dataPrimitive specific data (
See also:
mlme.h)

Definition at line 111 of file mac_api.h.


Enumeration Type Documentation

Enum for MAC extended address types.

Enumerator:
MAC_EXTENDED_DYNAMIC 

EUID64 which is unique.

Configured MAC 64-bit address to RAM and Radio

Definition at line 90 of file mac_api.h.

Every MAC adapting to Upper layer must implement a function which creates mac_api_t pointer, e.g 'mac_api_t* create_mac_api();' In the function external Mac needs to fill necessary function pointers so that Upper layer can use it.

For Nanostack to work, following (mlme/mcps) request functions are mandatory:

  • mcps-data
  • scan
  • start
  • poll
  • get
  • set
  • reset
  • (purge) Also indication and confirm callbacks for above are needed plus
  • beacon notify
  • comm status
Returns:
mac_api_t Ownership of newly created object

Enum for MLME primitive types.

Definition at line 57 of file mac_api.h.