Changes between Version 7 and Version 8 of 802.11/wlan_exp/Extending


Ignore:
Timestamp:
Dec 14, 2015, 9:47:24 PM (8 years ago)
Author:
murphpo
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • 802.11/wlan_exp/Extending

    v7 v8  
    4747The 802.11 MAC code running on the WARP node handles user commands at two levels.
    4848
    49 If the command behavior is common to all MAC applications, the command is handled in the {{{process_user_cmd()}}} function in {{{wlan_exp_user.c}}}. You should modify {{{process_user_cmd()}}} to handle any new framework-level commands required for your application. Any command IDs not hanlded in {{{process_user_cmd()}}} will be passed through to the MAC application.
     49If the command behavior is common to all MAC applications, the command is handled in the {{{process_user_cmd()}}} function in {{{wlan_exp_user.c}}}. You should modify {{{process_user_cmd()}}} to handle any new framework-level commands required for your application. Any command IDs not handled in {{{process_user_cmd()}}} will be passed through to the MAC application.
    5050
    5151If a command behavior depends on the upper-level MAC application, the command is handled in the {{{wlan_exp_process_user_cmd()}}} callback function in the top-level MAC. You should modify the {{{wlan_exp_process_user_cmd()}}} function in the {{{wlan_mac_ap.c}}}, {{{wlan_mac_sta.c}}} and {{{wlan_mac_ibss.c}}} files to implement any MAC-specific command behaviors.
     
    5858
    5959The wlan_exp framework will encapsulate the command response payload in an Ethernet fame and return it to the calling Python script for processing.
     60
     61'''Interrupt Safety'''[[BR]]
     62The {{{process_user_cmd()}}} and {{{wlan_exp_process_user_cmd()}}} functions executed outside the context of an interrupt service routine. As a result these functions may be interrupted at any time. Almost all processing in CPU High occurs in ISR contexts, including all processing of wireless and Ethernet Tx/Rx. If your command handler accesses or modifies data structures that might be modified in one of the upper-level MAC's interrupt service routines, you must take precautions to avoid bad states.
     63
     64The easiest way to protect a command handler from bad states due to unexpected interrupts is to disable interrupts during execution of the handler.
     65
     66{{{#!c
     67interrupt_state_t curr_interrupt_state;
     68
     69//Record the current interrupt enable state, then disable all interrupts
     70curr_interrupt_state = wlan_mac_high_interrupt_stop();
     71
     72/*
     73* Do any interrupt-sensitive processing here
     74*/
     75
     76//Restore the interrupt enable state
     77wlan_mac_high_interrupt_restore_state(curr_interrupt_state);
     78}}}
     79
     80
    6081
    6182'''TODO:'''