Rtos API example

Embed: (wiki syntax)

« Back to documentation index

ethernet_mac_api.h File Reference

ethernet_mac_api.h File Reference

Ethernet MAC API. More...

Go to the source code of this file.

Data Structures

struct  eth_data_conf_s
 Struct eth_data_conf_s defines arguments for data confirm message. More...
struct  eth_data_req_s
 Struct eth_data_req_s defines arguments for data request message. More...
struct  eth_data_ind_s
 Struct eth_data_ind_s defines arguments for data indication message. More...
struct  eth_mac_api_s
 Struct eth_mac_api_s defines functions for two-way communications between ethernet MAC and Upper layer. More...

Typedefs

typedef struct eth_data_conf_s eth_data_conf_t
 Struct eth_data_conf_s defines arguments for data confirm message.
typedef struct eth_data_req_s eth_data_req_t
 Struct eth_data_req_s defines arguments for data request message.
typedef struct eth_data_ind_s eth_data_ind_t
 Struct eth_data_ind_s defines arguments for data indication message.
typedef void eth_mac_data_request (const eth_mac_api_t *api, const eth_data_req_t *data)
 data_request data request call
typedef void eth_mac_data_confirm (const eth_mac_api_t *api, const eth_data_conf_t *data)
 data_confirm confirm is called as a response to data_request
typedef void eth_mac_data_indication (const eth_mac_api_t *api, const eth_data_ind_t *data)
 data_indication Data indication is called when MAC layer has received data
typedef int8_t eth_mac_mac48_address_set (const eth_mac_api_t *api, const uint8_t *mac48)
 Set 48 bit address from MAC.
typedef int8_t eth_mac_mac48_address_get (const eth_mac_api_t *api, uint8_t *mac48_buf)
 Read 48 bit address from MAC.
typedef int8_t eth_mac_api_initialize (eth_mac_api_t *api, eth_mac_data_confirm *conf_cb, eth_mac_data_indication *ind_cb, uint8_t parent_id)
 Upper layer will call this function, when MAC is taken into use.

Functions

eth_mac_api_tethernet_mac_create (int8_t driver_id)
 Creates ethernet MAC API instance which will use driver given.
int8_t ethernet_mac_destroy (eth_mac_api_t *mac_api)
 Destroy ethernet MAC API instance Call this only for freeing all allocated memory and when mac is total unused.

Detailed Description

Ethernet MAC API.

Definition in file ethernet_mac_api.h.


Typedef Documentation

Struct eth_data_conf_s defines arguments for data confirm message.

Struct eth_data_ind_s defines arguments for data indication message.

Struct eth_data_req_s defines arguments for data request message.

typedef int8_t eth_mac_api_initialize(eth_mac_api_t *api, eth_mac_data_confirm *conf_cb, eth_mac_data_indication *ind_cb, uint8_t parent_id)

Upper layer will call this function, when MAC is taken into use.

Parameters:
apiAPI to initialize
conf_cbCallback for confirm type of messages
ind_cbCallback for indication type of messages
parent_idUpper layer identifier
Returns:
0 if success; -1 if api is NULL or not found

Definition at line 131 of file ethernet_mac_api.h.

typedef void eth_mac_data_confirm(const eth_mac_api_t *api, const eth_data_conf_t *data)

data_confirm confirm is called as a response to data_request

Parameters:
apiThe API which handled the request
dataData containing confirm parameters

Definition at line 98 of file ethernet_mac_api.h.

typedef void eth_mac_data_indication(const eth_mac_api_t *api, const eth_data_ind_t *data)

data_indication Data indication is called when MAC layer has received data

Parameters:
apiThe API which handled the response
dataData containing indication parameters

Definition at line 105 of file ethernet_mac_api.h.

typedef void eth_mac_data_request(const eth_mac_api_t *api, const eth_data_req_t *data)

data_request data request call

Parameters:
apiAPI to handle the request
dataData containing request parameters

Definition at line 91 of file ethernet_mac_api.h.

typedef int8_t eth_mac_mac48_address_get(const eth_mac_api_t *api, uint8_t *mac48_buf)

Read 48 bit address from MAC.

Parameters:
apiAPI to handle the request
mac48_bufPointer where mac address can be written
Returns:
0 if successful, -1 otherwise

Definition at line 121 of file ethernet_mac_api.h.

typedef int8_t eth_mac_mac48_address_set(const eth_mac_api_t *api, const uint8_t *mac48)

Set 48 bit address from MAC.

Parameters:
apiAPI to handle the request
mac48Pointer having mac address to be set
Returns:
0 if successful, -1 otherwise

Definition at line 113 of file ethernet_mac_api.h.


Function Documentation

eth_mac_api_t* ethernet_mac_create ( int8_t  driver_id )

Creates ethernet MAC API instance which will use driver given.

Parameters:
driver_idEthernet driver id. Must be valid
Returns:
New MAC instance if successful, NULL otherwise
int8_t ethernet_mac_destroy ( eth_mac_api_t mac_api )

Destroy ethernet MAC API instance Call this only for freeing all allocated memory and when mac is total unused.

Parameters:
mac_apiRemoved mac class pointer
Returns:
-1 Unknow MAC
0 Mac class is removed