Changes between Version 9 and Version 10 of 802.11/wlan_exp/Extending


Ignore:
Timestamp:
Dec 14, 2015, 10:16:54 PM (8 years ago)
Author:
murphpo
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • 802.11/wlan_exp/Extending

    v9 v10  
    8888=== Example Command: Reading Tx Queue Status ===
    8989
    90 {{{my_node}}} is an instance of a wlan_exp node object that has already been initialized.
     90This example shows how to implement a custom wlan_exp command, including the required Python and C code. The example command retrieves the status of the Tx queues from the WARP node. The upper-level MAC responds to the command with the number of packets currently enqueued in each Tx queue. Because each upper-level MAC (AP, STA, IBSS) handles Tx queues differently the command handler is implemented in the {{{wlan_exp_user_ap_process_cmd()}}} function of the top-level MAC.
     91
     92'''Python Code'''[[BR]]
     93
     94The first step is to implement a Python method to send the command and process the results. This method is shown below.
    9195
    9296{{{#!python
     
    124128This method takes one node object as its argument, sends the {{{USER_CMDID_TX_QUEUE_STATUS}}} command to the node, then parses the response. If the response is valid it returns the list of queue id/occupancy values.
    125129
     130You can implement this method wherever it is callable from your Python script. The easiest place is to include the method at the top of your script, then call it directly during the experiment.
     131
     132'''C Code'''[[BR]]
     133
    126134Each upper-level MAC application implements its own callback function for handling application-specific user commands. By default these functions are empty. You must modify the C code to implement the behaviors required for your custom command.
    127135
    128 In this example the custom command will query the lengths of Tx queues.
    129 Modify the {{{wlan_exp_user_ap_process_cmd()}}} function in {{{wlan_mac_ap.c}}}.
     136Modify the {{{wlan_exp_user_ap_process_cmd()}}} function in {{{wlan_mac_ap.c}}}. Start by defining some local variables at the top of the function:
     137
    130138{{{#!c
    131139
     
    138146}}}
    139147
    140 Add a new case for the new command ID to the {{{switch(cmd_id)}}} statement:
    141 
    142 {{{#!C
     148
     149Next, add a new case for the your command ID to the {{{switch(cmd_id)}}} statement:
     150
     151{{{#!c
    143152    case USER_CMDID_TX_QUEUE_STATUS:
    144153        xil_printf("Got Tx queue status cmd\n");
     
    210219
    211220        break;
    212 
    213221}}}
    214222