211 | | |
| 211 | Next, we need to provide the ability for the CPU_LOW project to toggle the whether or not the framework is allowed to process new MPDU transmissions. Disallowing transmissions is easy. Add the following simple function to the MAC Low Framework: |
| 212 | |
| 213 | {{{ |
| 214 | #!c |
| 215 | |
| 216 | void wlan_mac_low_disable_new_mpdu_tx(){ |
| 217 | allow_new_mpdu_tx = 0; |
| 218 | } |
| 219 | }}} |
| 220 | |
| 221 | Allowing new MPDU transmissions is slightly more complex than setting {{{allow_new_mpdu_tx}}} to 1. If a {{{IPC_MBOX_TX_MPDU_READY}}} message was received from CPU_HIGH while new transmissions were disallowed, we stored the location of that MPDU in the {{{pkt_buf_pending_tx}}} global variable. When allowing new MPDU transmissions, we should see if this variable currently has anything for us to send and immediately do so if it does. Add the following function to the MAC Low Framework: |
| 222 | |
| 223 | {{{ |
| 224 | #!c |
| 225 | |
| 226 | void wlan_mac_low_enable_new_mpdu_tx(){ |
| 227 | if(allow_new_mpdu_tx == 0){ |
| 228 | allow_new_mpdu_tx = 1; |
| 229 | if(pkt_buf_pending_tx != -1){ |
| 230 | wlan_mac_low_proc_pkt_buf(pkt_buf_pending_tx); |
| 231 | pkt_buf_pending_tx = -1; |
| 232 | } |
| 233 | } |
| 234 | } |
| 235 | }}} |
| 236 | |
| 237 | Here, we are using -1 as a way of saying that there is no pending transmission. Any other value will be interpreted as an actual packet buffer. |
| 238 | |
| 239 | |
| 240 | |