| 122 | === MAC Low Framework === |
| 123 | |
| 124 | Changes should be made to {{{wlan_mac_low.c}}} in the project SDK workspace zip. |
| 125 | |
| 126 | ---- |
| 127 | |
| 128 | We need to process the new IPC message we created above and notify the DCF code that it should enable or disable the fast hopping mechanism. To begin, we create two new function callbacks as global variables at the top of the MAC low framework: |
| 129 | |
| 130 | {{{ |
| 131 | #!c |
| 132 | |
| 133 | static function_ptr_t enable_hopping_callback; |
| 134 | static function_ptr_t disable_hopping_callback; |
| 135 | |
| 136 | }}} |
| 137 | |
| 138 | These callback should be set to the {{{nullCallback}}} in {{{wlan_mac_low_init()}}}. This will prevent any CPU_LOW crashes if these callbacks are executed prior to being assigned as valid function pointers. |
| 139 | |
| 140 | {{{ |
| 141 | #!c |
| 142 | |
| 143 | enable_hopping_callback = (function_ptr_t)nullCallback; |
| 144 | disable_hopping_callback = (function_ptr_t)nullCallback; |
| 145 | }}} |
| 146 | |
| 147 | We need to provide the DCF with the ability to assign these callbacks. Add the following functions to the MAC low framework: |
| 148 | |
| 149 | {{{ |
| 150 | #!c |
| 151 | |
| 152 | inline void wlan_mac_low_set_enable_hopping_callback(function_ptr_t callback){ |
| 153 | enable_hopping_callback = callback; |
| 154 | } |
| 155 | |
| 156 | inline void wlan_mac_low_set_disable_hopping_callback(function_ptr_t callback){ |
| 157 | disable_hopping_callback = callback; |
| 158 | } |
| 159 | }}} |
| 160 | |
| 161 | Finally, we need to execute one of these callbacks when we receive the new IPC message. In the {{{process_ipc_msg_from_high()}}} function, add the following case to the large {{{switch}}} statement: |
| 162 | |
| 163 | {{{ |
| 164 | #!c |
| 165 | |
| 166 | case IPC_MBOX_CONFIG_HOPPING: |
| 167 | if(ipc_msg_from_high_payload[0]){ |
| 168 | enable_hopping_callback(); |
| 169 | } else { |
| 170 | disable_hopping_callback(); |
| 171 | } |
| 172 | break; |
| 173 | |
| 174 | }}} |
| 175 | |