Changes between Version 13 and Version 14 of 802.11/app_notes/FDD-NoMAC
- Timestamp:
- Feb 15, 2017, 11:41:54 AM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
802.11/app_notes/FDD-NoMAC
v13 v14 150 150 151 151 === 3. NoMAC Application Changes === 152 Finally the NoMAC application must be modified to support simultaneous Tx and Rx operations. In the reference code NoMAC implements two callback functions, {{{frame_transmit()}}} and {{{frame_receive()}}}. The lower MAC framework calls these functions to handle new Tx and Rx events. By default these callbacks block during a Tx/Rx event until the corresponding PHY event is complete. In order to support FDD operation these functions must be generalized to not block during PHY events. Instead the callbacks are responsible for starting the Tx/Rx processing and new functions are implemented to finish Tx/Rx processing. 153 154 Fundamentally, FDD changes NoMAC so that Tx and Rx events no longer occur in complete atomic contexts. The NoMAC code still has to operate serially while the Tx and Rx operations operate in parallels. We will need a few new global variables to help us track whether we are currently transmitting and/or receiving and, if so, which packet buffers are currently being used. Add the following to the top of {{{wlan_mac_nomac.c}}}: 152 Finally the NoMAC application must be modified to support simultaneous Tx and Rx operations. 153 154 In the reference code NoMAC implements two callback functions, {{{frame_transmit()}}} and {{{frame_receive()}}}. The lower MAC framework calls these functions to handle new Tx and Rx events. By default these callbacks block during a Tx/Rx event until the corresponding PHY event is complete. In order to support FDD operation these functions must be generalized to not block during PHY events. In this extension the normal callbacks are modified to start the Tx/Rx processing, then new functions are implemented to finish Tx/Rx processing. 155 156 The first step is to add two global variables to track whether Tx/Rx events have already been started. Add the following to the top of {{{wlan_mac_nomac.c}}}: 155 157 156 158 {{{#!c … … 164 166 }}} 165 167 166 Next , we will update the {{{frame_transmit()}}} function such that it immediately returns after submitting the packet to the MAC Tx Controller rather than wait for the PHY to finish. Replace {{{frame_transmit()}}} with the following:168 Next the {{{frame_transmit()}}} function must be modified to immediately return (instead of blocking) after submitting the packet to the MAC Tx Controller. Replace {{{frame_transmit()}}} with the following: 167 169 168 170 {{{#!c … … 224 226 }}} 225 227 226 Now we need a function that will "finish" the transmission with everything that used to take place after {{{wlan_mac_tx_ctrl_A_start()}}} from NoMAC's original {{{frame_transmit()}}}. This function should poll the status of the transmission and immediately quit if the transmission is still ongoing. Add the following function to {{{wlan_mac_nomac.c}}} and be sure to add a new declaration for it in the header file:228 The "finish Tx" processing that normally occurs in {{{frame_transmit()}}} must be moved to a new function. This function polls the status of the Tx PHY and immediately returns if the transmission is not yet complete. Add the following function to {{{wlan_mac_nomac.c}}}, then add the functions declaration to {{{include/wlan_mac_nomac.h}}}: 227 229 228 230 {{{#!c … … 263 265 }}} 264 266 265 Next, we need to perform a similar dissection of the {{{frame_receive()}}} context to quit early before the reception has finished. Note: it is important to return the value {{{FRAME_RX_RET_SKIP_RX_STARTED_RESET}}} from this context to prevent the MAC Low Framework from resetting the PHY while the reception is still ongoing. Replace {{{frame_receive()}}} with the following: 267 Next the Rx processing must be similarly divided into separate "start" and "finish" functions. First modify {{{frame_receive()}}} to immediately return instead of blocking: 268 269 we need to perform a similar dissection of the {{{frame_receive()}}} context to quit early before the reception has finished. Note: it is important to return the value {{{FRAME_RX_RET_SKIP_RX_STARTED_RESET}}} from this context to prevent the MAC Low Framework from resetting the PHY while the reception is still ongoing. Replace {{{frame_receive()}}} with the following: 266 270 267 271 {{{#!c … … 287 291 }}} 288 292 289 Next, we need to finish the frame reception in another function. Like {{{finish_frame_transmit()}}} from above, this function should immediately quit if the PHY is still receiving a frame. Add the following function to {{{wlan_mac_nomac.c}}} and declare it in NoMAC's header: 293 Note that this function returns {{{FRAME_RX_RET_SKIP_RX_STARTED_RESET}}}. This flag informs the MAC framework that the application is not finishes processing the current Rx event and that the framework should not reset the Rx state. 294 295 Next add a new function to handle the "finish" step for Rx processing. Add the following function to {{{wlan_mac_nomac.c}}} and add the function's declaration to {{{include/wlan_mac_nomac.h}}}: 290 296 291 297 {{{ … … 345 351 }}} 346 352 347 Finally, we will call our new functions for finishing Tx or Rx events from the primary while loop in {{{main()}}}. Replace the existing whileloop with the following:353 The final step is to update the {{{main()}}} function to call the new Tx/Rx start/finish functions, depending on the global Tx/Rx state. Replace the {{{while(1)}}} loop with the following: 348 354 349 355 {{{#!c … … 372 378 }}} 373 379 380 With this change the NoMAC application will interleave the Tx/Rx start and finish events, realizing simultaneous use of the Tx and Rx PHY cores. 381 374 382 ---- 375 383