Changes between Version 5 and Version 6 of 802.11/wlan_exp/app_notes/tutorial_hop_mac/fast_hopping


Ignore:
Timestamp:
Aug 3, 2015, 11:18:11 AM (9 years ago)
Author:
chunter
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • 802.11/wlan_exp/app_notes/tutorial_hop_mac/fast_hopping

    v5 v6  
    1616To implement the frequency hopping schedule, the majority of our changes will take place in CPU_LOW. We will leave the high-level AP and STA applications generally unaware of the underlying frequency hopping behavior. The singular exception to this is that we will build in hooks to enable and disable the frequency hopping so the high-level applications can control whether or not the hopping behavior is active. For example, the STA will only enable the low-level frequency hopping once it has completed an active scan and has fully associated with the AP.
    1717
    18 === CPU_HIGH and CPU_LOW ===
     18=== Code Common to CPU_HIGH and CPU_LOW ===
    1919
    2020Changes should be made to {{{wlan_mac_ipc_util.h}}} in the project SDK workspace zip.
     
    3333The value of {{{50}}} is arbitrary. The only real requirement is that it is distinct from the other IPC definitions. You can find the other {{{IPC_MBOX_}}} definitions in the same file.
    3434
     35=== MAC High Framework ===
     36
     37Changes should be made to {{{wlan_mac_high.c}}} in the project SDK workspace zip.
     38
     39----
     40
     41We should create two functions to enable and disable the frequency hopping behavior for our AP and STA applications to call. These function will use the new IPC message we just created. Add the following functions to the MAC High Framework:
     42
     43{{{
     44#!c
     45
     46void wlan_mac_high_enable_hopping(){
     47
     48        wlan_ipc_msg       ipc_msg_to_low;
     49        u32                ipc_msg_to_low_payload = 1;
     50
     51        // Send message to CPU Low
     52        ipc_msg_to_low.msg_id            = IPC_MBOX_MSG_ID(IPC_MBOX_CONFIG_HOPPING);
     53        ipc_msg_to_low.num_payload_words = 1;
     54        ipc_msg_to_low.payload_ptr       = &(ipc_msg_to_low_payload);
     55
     56        ipc_mailbox_write_msg(&ipc_msg_to_low);
     57
     58}
     59
     60void wlan_mac_high_disable_hopping(){
     61
     62        wlan_ipc_msg       ipc_msg_to_low;
     63        u32                ipc_msg_to_low_payload = 0;
     64
     65        // Send message to CPU Low
     66        ipc_msg_to_low.msg_id            = IPC_MBOX_MSG_ID(IPC_MBOX_CONFIG_HOPPING);
     67        ipc_msg_to_low.num_payload_words = 1;
     68        ipc_msg_to_low.payload_ptr       = &(ipc_msg_to_low_payload);
     69
     70        ipc_mailbox_write_msg(&ipc_msg_to_low);
     71
     72}
     73
     74}}}
     75
     76=== Access Point (AP) ===
     77
     78Changes should be made to {{{wlan_mac_ap.c}}} in the project SDK workspace zip.
     79
     80----
     81
     82We can make our changes such that it is easy to toggle between the slow Wi-Fi-compliant approach to frequency hopping or our custom fast hopping approach by defining a new value for the {{{HOP_MODE}}} variable we already created. For clarity, add the following comment above the {{{HOP_MODE}}} global variable definition.
     83
     84{{{
     85#!c
     86
     87// 0 - No hop
     88// 1 - Slow hop
     89// 2 - Fast hop
     90u8 HOP_MODE;
     91
     92}}}
     93
     94----
     95
     96In the {{{main()}}} function of the AP, we had previously set {{{HOP_MODE}}} to a value of {{{0}}} and then let the push button callback set the variable to {{{1}}} after the Wi-Fi stations had associated. For the fast approach, we can boot the AP directly into a configuration where fast frequency hopping is enabled. Change the assignment of {{{HOP_MODE}}} in {{{main()}}} to the following:
     97
     98{{{
     99#!c
     100
     101HOP_MODE = 2;
     102
     103}}}
     104
     105Finally, just before the primary {{{while(1)}}} loop, add the following code snippet:
     106
     107{{{
     108#!c
     109
     110        if(HOP_MODE == 2){
     111                wlan_mac_high_enable_hopping();
     112        } else {
     113                wlan_mac_high_disable_hopping();
     114        }
     115
     116}}}
     117
     118
     119
    35120
    36121