{{{#!comment [[Include(wiki:802.11/beta-note)]] }}} [[TracNav(802.11/TOC)]] = 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 ±100ms and fine, for events requiring timing accuracy of ±100µs. Events should be added to the fine schedule only when absolutely necessary to avoid unnecessary overhead. == Reference Design Scheduler Use == '''Beacons''': the AP implementation uses the scheduler to periodically transmit beacon frames. This scheduler callback creates a new beacon frame and adds it the broadcast transmit queue. '''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 [wiki:../LTG 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 (±100ms accuracy) or fine (±100µ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 (±100ms accuracy) or fine (±100µ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 [browser:ReferenceDesigns/w3_802.11/c/wlan_mac_high_framework/wlan_mac_schedule.c wlan_mac_schedule.c] file. The scheduler uses the axi_timer core attached to CPU High in interrupt mode.