21 | | User code interacts with the transmit queue via the following functions: |
22 | | |
23 | | * {{{void queue_checkout(dl_list* new_list, u16 num_packet_bd)}}} - attempts to check out an arbitrary number of packet descriptors from the free pool and delivers them to the calling function by tying those packet descriptors together in a doubly-linked list |
24 | | * {{{new_list}}}: a pointer to a doubly-linked list that will be populated by the queue framework. |
25 | | * {{{num_packet_bd}}}: number of packet buffer descriptors that should be checked out. The {{{new_list}}} pointed to by the first argument will be populated with {{{num_packet_bd}}} list entries |
26 | | * {{{void queue_checkin(dl_list* list)}}} - checks a doubly-linked list of packet descriptors back in to the free pool |
27 | | * {{{list}}}: the doubly-linked list of packet buffer descriptors that will be returned to the free pool |
28 | | * {{{wlan_mac_queue_poll(u16 queue_sel)}}} - checks a queue identified by the argument and sends a packet from it if one is there |
29 | | * {{{queue_sel}}}: identification of queue that should be polled |
30 | | * {{{void enqueue_after_end(u16 queue_sel, dl_list* list)}}} - appends the provided doubly-linked list of packet buffer descriptors to the end of the queue identified by the provided argument |
31 | | * {{{queue_sel}}}: identification of queue that should be appended to |
32 | | * {{{list}}}: doubly-linked list of packet descriptors that should be appended |
33 | | * {{{void purge_queue(u16 queue_sel)}}} - remove all packet buffer descriptors from the identified queue and return them to the free pool |
34 | | * {{{queue_sel}}}: identification of queue that should be purged |
35 | | |
36 | | === Example Snippets === |
37 | | |
38 | | ==== Adding a single packet to a queue ==== |
39 | | |
40 | | {{{#!c |
41 | | //Checkout 1 element from the queue; |
42 | | queue_checkout(&checkout,1); |
43 | | |
44 | | if(checkout.length == 1){ //There was at least 1 free queue element |
45 | | tx_queue_entry = checkout.first; |
46 | | |
47 | | tx_queue = (tx_queue_buffer*)(tx_queue_entry->data); |
48 | | |
49 | | //Here is where you can construct the packet in tx_queue_entry->data and its corresponding |
50 | | //tx_queue_entry->frame_info |
51 | | |
52 | | |
53 | | wlan_mac_high_setup_tx_header( &tx_header_common, (u8 *)bcast_addr, wlan_mac_addr ); |
54 | | tx_length = wlan_create_beacon_frame((void*)(tx_queue->frame),&tx_header_common, BEACON_INTERVAL_MS, strlen(access_point_ssid), (u8*)access_point_ssid, mac_param_chan,1,tim_control,tim_bitmap); |
55 | | |
56 | | enqueue_after_end(YOUR_QUEUE_ID, &checkout); |
57 | | } |
58 | | }}} |
59 | | |
60 | | Note: you could then call {{{wlan_mac_queue_poll(YOUR_QUEUE_ID)}}} to have that packet passed down to the low-level MAC and transmitted. |
61 | | |
62 | | |
63 | | |
64 | | == Implementation == |
65 | | The transmit queue is implemented in [browser:ReferenceDesigns/w3_802.11/c/wlan_mac_high_framework/wlan_mac_queue.c wlan_mac_queue.c]. |
| 21 | The queue framework is implemented in the [browser:/ReferenceDesigns/w3_802.11/c/wlan_mac_high_framework/wlan_mac_queue.c]wlan_mac_queue.c[/url] file. Refer to the per-function comments in this file for the API. |