Scheduler¶
The High MAC Framework provides a scheduler which enables periodic execution of arbitrary functions. The scheduler implements two sub-schedules:
- A coarse scheduler with intervals quantized to 200 ms
- A fine scheduler with intervals quantized to 64 µs
The coarse scheduler incurs less overhead and should be used for rare events where accuracy is not a critical concern.
The scheduler is only used for periodic execution of functions in CPU High. The scheduler is not responsible for the timing of wireless medium activity. All wireless Tx/Rx timing is controlled in CPU Low by the low-level MAC code.
Scheduler Utilization¶
By default the framework and high MAC applications use the scheduler for a number of purposes:
- Station info cleanup: removal of stale station information data for wireless devices with no recent activity
- Network info cleanup: removal of stale network information data for networks with no recent activity
- Association timeout: disassociation of clients with no recent activity
- Ethernet Rx burst handling: deferred processing of bursts of Ethernet receptions
- Network scanning: scheduled channel changes for wireless network scanning
Scheduler Functions¶
The scheduler subsystem provides the following utility functions:
Configuring a schedule¶
u32 wlan_mac_schedule_event_repeated(u8 scheduler_sel, u32 delay, u32 num_calls, void(*callback)());
The return value and function arguments are defined as follows:
Parameter | Description |
---|---|
Return value (u32 ) |
The ID for the schedule, or SCHEDULE_FAILURE if the schedule failed to be created. |
u8 scheduler_sel |
SCHEDULE_COARSE or SCHEDULE_FINE . |
u32 delay |
Number of microseconds before the first invocation of the callback should occur. |
u32 num_calls |
Number of invocations of the callback before the schedule is automatically removed. SCHEDULE_REPEAT_FOREVER if the schedule should never be automatically removed. |
void(*callback)() |
Pointer to a function that should be executed when the schedule conditions are met. |
Disabling/Removing a schedule¶
void wlan_mac_remove_schedule(u8 scheduler_sel, u32 id){
The return value and function arguments are defined as follows:
Parameter | Description |
---|---|
u8 scheduler_sel |
SCHEDULE_COARSE or SCHEDULE_FINE . |
u32 id |
ID of the schedule that should be removed. Function will do nothing if the ID is not found in the currently configured schedules. |