Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
MCL General API's

This module describes all MCL General API's.

Functions

retval_t mac_init (void)
 Initializes the MAC sublayer. More...
 
uint32_t mac_ready_to_sleep (void)
 Checks if the mac stack is ready to sleep. More...
 
bool mac_task (void)
 Runs the MAC scheduler. More...
 

retval_t mac_init ( void  )

Initializes the MAC sublayer.

Returns
MAC_SUCCESS if TAL is intialized successfully else FAILURE

References port_config::direction, FAILURE, mac_sleep_trans(), mac_soft_reset(), MAC_SUCCESS, mac_timers_init(), nhle_mac_q, pal_calibrate_rc_osc(), PORT_PIN_DIR_OUTPUT, port_pin_set_config(), stb_init(), tal_init(), and tal_mac_q.

Referenced by wpan_init().

uint32_t mac_ready_to_sleep ( void  )

Checks if the mac stack is ready to sleep.

Checks if the mac stack is in inactive state for beacon support

or idle in case of no beacon support.

Returns
32bit time duration in microseconds for which the mac is ready to sleep

For No beacon support 1 if stack is idle,0 if it is busy

References if(), MAC_ASSOCIATED, mac_busy, MAC_COORDINATOR, MAC_GUARD_TIME_US, MAC_INACTIVE, mac_nhle_q, MAC_PAN_COORD_STARTED, mac_state, mac_superframe_state, MEGA_RF, nhle_mac_q, READY_TO_SLEEP, sw_timer_get_residual_time(), T_Beacon_Tracking_Period, tal_incoming_frame_queue, tal_mac_q, tal_trx_status, timer_trigger, TRX_OFF, and TRX_SLEEP.

bool mac_task ( void  )

Runs the MAC scheduler.

This function runs the MAC scheduler.

MLME and MCPS queues are removed alternately, starting with MLME queue.

Returns
true if event is dispatched, false if no event to dispatch.

References dispatch_event(), event, mac_busy, nhle_mac_q, NULL, and tal_mac_q.

Referenced by wpan_task().