wiki:802.11/MAC/Upper/MACHighFramework/Scheduler

Scheduler

The MAC High Framework provides a scheduler which enables future or periodic execution of arbitrary functions. The scheduler implements two sub-schedules: coarse, for occasional execution with timing accuracy of ±200.0ms and fine, for events requiring timing accuracy of ±64µs. Events should be added to the fine schedule only when absolutely necessary to avoid unnecessary overhead.

Reference Design Scheduler Use

Active Scan Timeout: the STA implementation uses the coarse scheduler to set a timeout when waiting for probe responses. This scheduler callback changes the node's center frequency to continue the search for the desired AP.

Local Traffic Generation: the LTG framework uses the scheduler to create arbitrary traffic according to the programmed inter-packet intervals

Scheduler API

User code interacts with the scheduler via the following functions:

u32 wlan_mac_schedule_event_repeated(u8 scheduler_sel, u32 delay, u32 num_calls, void(*callback)()):

  • scheduler_sel: select the coarse (±200.0ms accuracy) or fine (±64µs accuracy) scheduler; must be SCHEDULE_COARSE or SCHEDULE_FINE
  • delay: time in microseconds before callback is called
  • num_calls: number of times the framework should execute the callback or CALL_FOREVER if it should continue executing it until explicitly stopped
  • callback: function pointer to callback to execute after delay µs
  • Returns u32 id for new scheduler entry or SCHEDULE_FAILURE on failure

void wlan_mac_remove_schedule(u8 scheduler_sel, u32 id)

  • scheduler_sel: select the coarse (±200.0ms accuracy) or fine (±64µs accuracy) scheduler; must be SCHEDULE_COARSE or SCHEDULE_FINE
  • id: event ID previously returned by wlan_mac_schedule_event

Implementation

The scheduler is implemented in the wlan_mac_schedule.c file. The scheduler uses the axi_timer core attached to CPU High in interrupt mode.

Last modified 11 months ago Last modified on Aug 16, 2016, 2:06:15 PM