Changes between Version 14 and Version 15 of 802.11/wlan_exp/Extending


Ignore:
Timestamp:
Dec 15, 2015, 3:32:17 PM (8 years ago)
Author:
murphpo
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • 802.11/wlan_exp/Extending

    v14 v15  
    77= Extending the Experiments Framework =
    88
    9 The 802.11 Reference Design Experiments Framework provides a variety of commands to control and observe WARP v3 nodes in real time. However many experiments will require additional commands, especially when users extend the reference code with new behaviors. Starting in 802.11 Reference Design v1.4 we have greatly simplified the process of implementing extensions to the experiments framework.
     9The 802.11 Reference Design Experiments Framework provides a variety of commands to control and observe WARP v3 nodes in real time. However many experiments will require additional commands, especially when users extend the reference code with new behaviors.
     10
     11Starting in 802.11 Reference Design v1.4 we have greatly simplified the process of implementing extensions to the experiments framework. Adding wlan_exp commands was more complicated in previous versions; refer to the archived [wiki:../HowToAddCommand HowToAddCommand] page for details on adding commands to versions before v1.4.
    1012
    1113There are two kinds of framework extensions:
     
    2224 * Command arguments: an optional list of {{{u32}}} arguments supplied by the Python code that is passed to the C code handler
    2325
    24 The command ID is used by the C code to select which code block should process the command payload. The Python and C code must use matching lists of command IDs. All user command IDs must be 24-bit integers (i.e. in ~[0, 2^24 -1]). The framework does not reserve any command ID values.
     26The command ID is used by the C code to select which code block should process the command payload. The Python and C code must use matching lists of command IDs. All user command IDs must be 24-bit integers (i.e. in [0, 2^24^ -1]). The framework does not reserve any command ID values in this range.
    2527
    2628The command arguments are an optional payload supplied by the Python script. The wlan_exp framework sends this payload to the node with no modifications. The arguments must be constructed as a list of unsigned 32-bit integers ({{{u32}}} values). The Python and C code must implement complementary argument construction/parsing functions. The argument list may be omitted if a command requires no payload.
     
    3234{{{#!python
    3335#No command arguments, no response payload
    34 my_node.send_user_command(CMDID_USR_MYCMD, args=None)
     36my_node.send_user_command(CMDID_USER_MYCMD, args=None)
    3537
    3638#3 arguments, no response payload
    37 my_node.send_user_command(CMDID_USR_MYCMD, args=[ARG0 ARG1 ARG2])
     39my_node.send_user_command(CMDID_USER_MYCMD, args=[ARG0 ARG1 ARG2])
    3840
    3941#2 arguments, with response payload
    40 cmd_resp = my_node.send_user_command(CMDID_USR_MYCMD, args=[ARG0 ARG1])
     42cmd_resp = my_node.send_user_command(CMDID_USER_MYCMD, args=[ARG0 ARG1])
    4143}}}
    4244
     
    5254
    5355Command handlers in these functions share a common structure:
    54  * Examine the command ID and determine which code block ({{{case}}}) shoudl handle the command
     56 * Examine the command ID and determine which code block ({{{case}}}) should handle the command
    5557 * Implement the required command behavior
    5658 * If a response payload is required, populate the response values into the {{{response->args}}} array
     
    98100#Define a command ID (must be 24-bit integer)
    99101CMDID_USER_TX_QUEUE_STATUS = 100
    100 
    101 #Define a user command ID
    102 USER_CMDID_TX_QUEUE_STATUS = 100
    103102
    104103#Define method for sending command and processing the response
     
    111110        args = None
    112111
    113     resp = node.send_user_command(USER_CMDID_TX_QUEUE_STATUS, args)
     112    resp = node.send_user_command(CMDID_USER_TX_QUEUE_STATUS, args)
    114113
    115114    #Response should be list of ints with 2 values per queue
     
    126125}}}
    127126
    128 This 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.
     127This method takes one node object as its argument, sends the {{{CMDID_USER_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.
    129128
    130129You 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.
     
    138137{{{#!c
    139138
    140 #define USER_CMDID_TX_QUEUE_STATUS 100
     139#define CMDID_USER_TX_QUEUE_STATUS 100
    141140int i;
    142141u32 req_queue_id;
     
    150149
    151150{{{#!c
    152     case USER_CMDID_TX_QUEUE_STATUS:
     151    case CMDID_USER_TX_QUEUE_STATUS:
    153152        xil_printf("Got Tx queue status cmd\n");
    154153