Changes between Version 8 and Version 9 of 802.11/wlan_exp/app_notes/tutorial_token_mac/CPU_LOW
- Timestamp:
- Jul 10, 2015, 11:23:30 AM (9 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
802.11/wlan_exp/app_notes/tutorial_token_mac/CPU_LOW
v8 v9 358 358 * If it matches the address programmed in the EEPROM of this board, we can conclude that this reservation period is for us (the AP). As such, we can simply call {{{wlan_mac_low_enable_new_mpdu_tx}}} to enable our own MPDU transmissions. We can additionally set the {{{reservation_ts_end}}} global variable with the timestamp of when this reservation period is to be terminated. 359 359 * If the address does not match our address in the EEPROM, we know this reservation period is for some other STA on the network. We need to communicate with them and inform them that they now have the token and need to transmit. Specifically, we want to send a "token offer" message and wait for a "token response" from the STA confirming that it now has the token. If we do not hear a response, we can time out and immediately terminate this reservation period. To implement this behavior, we can use the [wiki:802.11/MAC/Support_HW#MACTxControllerA MAC Tx Controller A] HW peripheral as it has built in support for post-transmission timeouts. 360 * In either case, we should update the {{{reservation_ts_end}}} global variable to contain the timestamp of when this token reservation period is over. 360 361 361 362 Here is an implementation of that behavior as a function that can be added to NoMAC: … … 465 466 in_reservation = 0; 466 467 ipc_payload_end.reason = TOKEN_TIMEOUT; 467 //ipc_payload.low_tx_details; //TODO468 468 ipc_mailbox_write_msg(&ipc_msg_to_high_end); 469 469 } … … 472 472 in_reservation = 0; 473 473 ipc_payload_end.reason = TOKEN_TIMEOUT; 474 //ipc_payload.low_tx_details; //TODO475 474 ipc_mailbox_write_msg(&ipc_msg_to_high_end); 476 475 break; … … 489 488 490 489 ---- 490 491 In the previous change, {{{reservation_ts_end}}} was updated with a timestamp designating the end of the current token reservation period. Now we need to check this variable against the current timestamp and 492 493 {{{ 494 #!c 495 496 void poll_reservation_time(){ 497 wlan_ipc_msg ipc_msg_to_high; 498 ipc_token_end_reservation ipc_payload; 499 500 ipc_msg_to_high.msg_id = IPC_MBOX_MSG_ID(IPC_MBOX_TOKEN_END_RESERVATION); 501 502 if( (sizeof(u32)*(sizeof(ipc_token_end_reservation)/sizeof(u32))) == sizeof(ipc_token_end_reservation) ){ 503 ipc_msg_to_high.num_payload_words = (sizeof(ipc_token_end_reservation)/sizeof(u32)); 504 } else { 505 ipc_msg_to_high.num_payload_words = (sizeof(ipc_token_end_reservation)/sizeof(u32)) + 1; 506 } 507 508 ipc_msg_to_high.payload_ptr = (u32*)(&ipc_payload); 509 510 if(in_reservation && (get_usec_timestamp() >= reservation_ts_end)){ 511 in_reservation = 0; 512 wlan_mac_low_disable_new_mpdu_tx(); 513 ipc_payload.reason = TOKEN_DURATION_COMPLETE; 514 //ipc_payload.low_tx_details; //TODO 515 ipc_mailbox_write_msg(&ipc_msg_to_high); 516 } 517 } 518 }}}