Transmission:
General Informations
We report in this page the block diagram of the part of code we developed concerning the transmission of frames: each box reppresents a label on the source, a check or a decision taken. Below we try to resume the firmware's behavior explaining the most important steps.
Firmware's behavior
Transmission begins when a frame has been queued by the driver into the firmware FIFO. If backoff time wasn't already computed, set_backoff_time will be called and a new backoff time will be calculated. The firmware will wait until the backoff time has elapsed and then it will call tx_frame_now. This function takes the frame from the FIFO and puts it into the serializer where it will be ready to be sent on the channel if all conditions will state that the channel is ready for transmission. If the frame needs to be acknowledge, then the SPR_TXE0_TIMEOUT register will be loaded with the timeout time for the reception of the ACK frame from the receiving station, then the corresponding timer will be enabled; if no ACK is required (e.g. with multicast frame) no operations will be carried out. When the frame has been sent, the MAC processor will setup conditions so that the tx_infos_update function will be called: this function updates the retries informations. From here on, two scenarios can be faced. The first deals with the possibility that the frame doesn't need acknowledgement: in this case report_tx_status_to_host will be called and the transmission process will end. The second possibility is that the just sent frame needs to be acked: in this case the firmware will wait until ACK timeout has been elapsed or an ACK frame has been received. If the ACK timeout expires, then function contention_params_update will be called. This functions sets the "current window" value correctly and checks if the short retry limit has been reached. If the short retry count is equal to the short retry limit, then the frame is suppressed and the firmware communicates to the driver that the transmission failed. If short retry count is less than short retry limit, the firmware will setup the state machine to perform a retransmission: a new backoff time is computed and the process starts from the beginning. If the acknowledgement has been received whithin the ACK timeout interval, then the firmware stops the countdown and communicates to the driver that transmission was successfully performed. The tx_end_wait_10us function is generally called on transmission completion and will setup the state machine to prevent noise measurement for about 10us: this last operation makes CSMA mechanism to work properly.