⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 transmit enter execs

📁 opnet无线网络编程
💻
字号:
// TMAC

#ifndef OPD_NO_DEBUG
printf("\n\n*************************************************\n");
printf("Entering Transmit ENTER EXEC state for node <%d> \n", my_address);
printf("*****************************************************\n\n");
#endif

/** In this state following intrpts can occur:     				**/
/** 1. Data arrival from application layer.			        	**/
/** 2. Frame (DATA,ACK,RTS,CTS) rcvd from PHY layer.			**/
/** 3. Busy intrpt stating that frame is being rcvd.			**/
/** 4. Collision intrpt means more than one frame is rcvd.  	**/
/** 5. Transmission completed intrpt from physical layer		**/
/** Queue the packet for Data Arrival from the higher layer,	**/
/** and do not change state.									**/
/** After Transmission is completed change state to FRM_END		**/
/** No response is generated for any lower layer packet arrival	**/

//WSN
// assigns the unique state number and writes the sleep staus to the sleep statistic handeler for graphing purposes
state = WSN_TRANSMIT;

if (op_ev_valid(wsn_ta_evh))
	op_ev_cancel(wsn_ta_evh);

/* Prepare transmission frame by setting appropriate	*/
/* fields in the control/data frame.					*/ 
/* Skip this routine if any frame is received from the	*/
/* higher or lower layer(s)			
*/

if (wlan_flags->immediate_xmt == OPC_TRUE)
	{
	/* Initialize the contention window size for the 	*/
	/* packets that are sent without backoff for the 	*/
	/* first time, if in case they are retransmitted.	*/
	max_backoff = cw_min;
	
	/* Start the transmission.							*/
	wlan_frame_transmit ();
	#ifndef OPD_NO_DEBUG
	printf("\n\n*************************************************\n");
	printf("Immediate Send\n");
	printf("*************************************************\n\n");
	#endif
	
	/* Reset the immediate transmission flag.			*/
	wlan_flags->immediate_xmt = OPC_FALSE;
	}

else if (wlan_flags->rcvd_bad_packet == OPC_FALSE && intrpt_type == OPC_INTRPT_SELF)  
	{

	/* If it is a PCF enabled MAC then make sure that	*/
	/* the interrupt was not PCF related. Start the		*/
	/* transmission, if the delivered self interrupt is	*/
	/* an interrupt that was just brought us into this	*/
	/* state.											*/
	if ((pcf_flag == OPC_BOOLINT_DISABLED || intrpt_code == WlanC_Deference_Off || 
		intrpt_code == WlanC_Backoff_Elapsed || intrpt_code == WlanC_CW_Elapsed) && 
		!(intrpt_code == WlanC_Beacon_Tx_Time || intrpt_code == WlanC_AP_Check_Timeout || intrpt_code == WlanC_NAV_Reset_Time ||
			intrpt_code == WlanC_Update_Period))
		{
		
		wlan_frame_transmit ();
		#ifndef OPD_NO_DEBUG
			printf("\n\n*************************************************\n");
			printf("PCF Send\n");
			printf("*************************************************\n\n");
		#endif		
		
			
					
		/* Check whether the forced transmission (end	*/
		/* of backoff) flag is set.						*/
		if (wlan_flags->forced_bk_end == OPC_TRUE)
			{
			/* Reset the flag.							*/
			wlan_flags->forced_bk_end = OPC_FALSE;
			
			/* This flag indicates a rare case: at the	*/
			/* exact time when we completed our backoff	*/
			/* and started our transmission, we also	*/
			/* started receiving a packet. Hence, mark	*/
			/* the currently being received packet as a	*/
			/* bad packet.								*/
			wlan_flags->rcvd_bad_packet = OPC_TRUE;
			
			/* If we are transmitting a CTS-to-self,	*/
			/* then mark it as bad, too.				*/
			if (last_frametx_type == WlanC_Cts && expected_frame_type == WlanC_Cts)
				wlan_flags->rcvd_bad_cts = OPC_TRUE;
			}
		}
	}

if (wlan_trace_active)
	{
	/* Determine the current state name.				*/
	strcpy (current_state_name, "transmit");
	}

/* Unlock the mutex that serializes accessing the		*/
/* roaming related information of this MAC. 			*/
op_prg_mt_mutex_unlock (roam_state_ptr->roam_info_mutex);

//printf("*************************************************\n");
//printf("Leaving Transmit ENTER EXEC state for node <%d> \n", my_address);
//printf("*****************************************************\n\n");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -