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 FAILURE, mac_sleep_trans(), mac_soft_reset(), MAC_SUCCESS, mac_timers_init(), nhle_mac_q, pal_calibrate_rc_osc(), qmm_queue_init(), stb_init(), tal_init(), and tal_mac_q.

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, MEGA_RF, READY_TO_SLEEP, queue_tag::size, sw_timer_get_residual_time(), tal_incoming_frame_queue, 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(), mac_busy, qmm_queue_remove(), and queue_tag::size.