source: ReferenceDesigns/w3_802.11/c/wlan_mac_high_framework/include/wlan_mac_schedule.h

Last change on this file was 6319, checked in by chunter, 5 years ago

1.8.0 release wlan-mac-se

File size: 2.7 KB
Line 
1/** @file wlan_mac_schedule.h
2 *  @brief Scheduler
3 *
4 *  This set of functions allows upper-level MAC implementations
5 *  to schedule the execution of a provided callback for some point
6 *  in the future.
7 *
8 *  @copyright Copyright 2014-2019, Mango Communications. All rights reserved.
9 *          Distributed under the Mango Communications Reference Design License
10 *              See LICENSE.txt included in the design archive or
11 *              at http://mangocomm.com/802.11/license
12 *
13 *  This file is part of the Mango 802.11 Reference Design (https://mangocomm.com/802.11)
14 */
15
16
17/***************************** Include Files *********************************/
18
19#include "wlan_mac_high_sw_config.h"
20#include "xil_types.h"
21
22
23/*************************** Constant Definitions ****************************/
24#ifndef WLAN_MAC_SCHEDULE_H_
25#define WLAN_MAC_SCHEDULE_H_
26
27//-----------------------------------------------
28// Scheduler defines
29//
30#define SCHEDULE_ID_FINE                                      0
31#define SCHEDULE_ID_COARSE                                    1
32
33// Special value for num_calls parameter of wlan_sched
34#define SCHEDULE_REPEAT_FOREVER                            0xFFFFFFFF
35
36// Reserved Schedule ID range
37#define SCHEDULE_ID_RESERVED_MIN                           0xFFFFFF00
38#define SCHEDULE_ID_RESERVED_MAX                           0xFFFFFFFF
39
40// Defined Reserved Schedule IDs
41#define SCHEDULE_FAILURE                                   0xFFFFFFFF
42
43
44//-----------------------------------------------
45// Macros
46
47/*********************** Global Structure Definitions ************************/
48
49struct dl_entry;
50
51// Schedule structure for scheduled events
52typedef struct wlan_sched{
53    u32            id;
54    u8             enabled;
55    u32            interval_us;
56    u32            num_calls;
57    u64            target_us;
58    function_ptr_t callback;
59} wlan_sched_event_t;
60
61typedef struct wlan_schedule_t{
62    dl_list event_list;         /// List of events in this schedule
63    u32     exec_interval;      /// Number of timer interrupts between executions of this scedule
64    u32     polls_to_next_exec; /// Counter of polls between executions
65} wlan_schedule_t;
66
67/*************************** Function Prototypes *****************************/
68
69int             wlan_mac_schedule_init();
70
71int wlan_mac_schedule_poll();
72dl_entry* wlan_mac_schedule_find_event(u32 id, dl_list** sched_list_ret);
73u32 wlan_mac_schedule_add_event(u8 schedule_sel, u32 interval_us, u32 num_calls, void(*callback)());
74int wlan_mac_schedule_remove_event(u32 event_id);
75int wlan_mac_schedule_disable_event(u32 event_id);
76int wlan_mac_schedule_enable_event(u32 event_id);
77
78#endif /* WLAN_MAC_SCHEDULE_H_ */
Note: See TracBrowser for help on using the repository browser.