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

📄 art_if.c

📁 Atheros AP Test with Agilent N4010A source code
💻 C
📖 第 1 页 / 共 5 页
字号:

//version of art_rxDataBegin that works with Signal Generators
void art_rxDataBeginSG
(
	A_UINT32 devNum,
	A_UINT32 waitTime,
	A_UINT32 timeout,
	A_UINT32 remoteStats,
	A_UINT32 enableCompare,
	A_UCHAR *dataPattern,
	A_UINT32 dataPatternLength,
	A_UINT32 sgpacketnumber
)
{
	if(!configSetup.remote || !configSetup.remote_exec)
	{
			rxDataBeginSG(devNum, waitTime, timeout, remoteStats, enableCompare, dataPattern, dataPatternLength, sgpacketnumber);
	}
	else
	{
		// create cmd to send to client
		GlobalCmd.cmdID = M_RX_DATA_BEGIN_CMD_ID;
		GlobalCmd.devNum = (A_INT8) devNum;
		GlobalCmd.CMD_U.RX_DATA_BEGIN_CMD.waitTime = waitTime;
		GlobalCmd.CMD_U.RX_DATA_BEGIN_CMD.timeout = timeout;
		GlobalCmd.CMD_U.RX_DATA_BEGIN_CMD.remoteStats = remoteStats;
		GlobalCmd.CMD_U.RX_DATA_BEGIN_CMD.enableCompare = enableCompare;
		GlobalCmd.CMD_U.RX_DATA_BEGIN_CMD.dataPatternLength = dataPatternLength;
		memcpy(GlobalCmd.CMD_U.RX_DATA_BEGIN_CMD.dataPattern, dataPattern, dataPatternLength);

		if (!artSendCmd(&GlobalCmd,
						(sizeof(GlobalCmd.CMD_U.RX_DATA_BEGIN_CMD) +
						sizeof(GlobalCmd.cmdID) -
						MAX_BLOCK_BYTES +
						GlobalCmd.CMD_U.RX_DATA_BEGIN_CMD.dataPatternLength),
						NULL))
		{
			uiPrintf("Error: Unable to successfully send RX_DATA_BEGIN_CMD command to client!\n");
		}
	}
	checkLibError(devNum, 1);
}

void art_rxDataComplete
(
	A_UINT32 devNum,
	A_UINT32 waitTime,
	A_UINT32 timeout,
	A_UINT32 remoteStats,
	A_UINT32 enableCompare,
	A_UCHAR *dataPattern,
	A_UINT32 dataPatternLength
)
{
	if(!configSetup.remote || !configSetup.remote_exec)
	{
		rxDataComplete(devNum, waitTime, timeout, remoteStats, enableCompare, dataPattern, dataPatternLength);
	}
	else
	{
		// create cmd to send to client
		GlobalCmd.cmdID = M_RX_DATA_COMPLETE_CMD_ID;
		GlobalCmd.devNum = (A_INT8) devNum;
		GlobalCmd.CMD_U.RX_DATA_BEGIN_CMD.waitTime = waitTime;
		GlobalCmd.CMD_U.RX_DATA_BEGIN_CMD.timeout = timeout;
		GlobalCmd.CMD_U.RX_DATA_BEGIN_CMD.remoteStats = remoteStats;
		GlobalCmd.CMD_U.RX_DATA_BEGIN_CMD.enableCompare = enableCompare;
		GlobalCmd.CMD_U.RX_DATA_BEGIN_CMD.dataPatternLength = dataPatternLength;
		memcpy(GlobalCmd.CMD_U.RX_DATA_BEGIN_CMD.dataPattern, dataPattern, dataPatternLength);

		if (!artSendCmd(&GlobalCmd,
						(sizeof(GlobalCmd.CMD_U.RX_DATA_BEGIN_CMD) +
						sizeof(GlobalCmd.cmdID) -
						MAX_BLOCK_BYTES +
						GlobalCmd.CMD_U.RX_DATA_BEGIN_CMD.dataPatternLength),
						NULL))
		{
			uiPrintf("Error: Unable to successfully send RX_DATA_COMPLETE_CMD command to client!\n");
		}
	}
	checkLibError(devNum, 1);
}

void art_rxGetData
(
 A_UINT32 devNum,
 A_UINT32 bufferNum,
 A_UCHAR *pReturnBuffer,
 A_UINT32 sizeBuffer
)
{
	A_UCHAR  *pReadValues;		  /* pointer to the values that were read */

	if(!configSetup.remote || !configSetup.remote_exec)
	{
		rxGetData(devNum, bufferNum, pReturnBuffer, sizeBuffer);
	}
	else
	{
		// create cmd to send to client
		GlobalCmd.cmdID = M_RX_GET_DATA_CMD_ID;
		GlobalCmd.devNum = (A_INT8) devNum;
		GlobalCmd.CMD_U.RX_GET_DATA_CMD.bufferNum = bufferNum;
		GlobalCmd.CMD_U.RX_GET_DATA_CMD.sizeBuffer = sizeBuffer;

		if (!artSendCmd(&GlobalCmd,
						sizeof(GlobalCmd.CMD_U.RX_GET_DATA_CMD)+sizeof(GlobalCmd.cmdID),
						(void **)&pReadValues))
		{
			uiPrintf("Error: Unable to successfully send RX_GET_DATA_CMD command to client!\n");
		}
		if(checkLibError(devNum, 1)) return;
		memcpy(pReturnBuffer, pReadValues, sizeBuffer);
	}
	checkLibError(devNum, 1);
}


A_BOOL art_rxLastDescStatsSnapshot
(
 A_UINT32 devNum,
 RX_STATS_SNAPSHOT *pRxStats
)
{
	A_BOOL returnFlag = TRUE;
	A_UCHAR *pReadValues;

	if(!configSetup.remote || !configSetup.remote_exec)
	{
		returnFlag = rxLastDescStatsSnapshot(devNum, pRxStats);
	}
	else
	{
		// create cmd to send to client
		GlobalCmd.cmdID = M_RX_STATS_SNAPSHOT_CMD_ID;
		GlobalCmd.devNum = (A_INT8) devNum;
		if (!artSendCmd(&GlobalCmd, sizeof(GlobalCmd.cmdID),
						(void **)&pReadValues))
		{
			uiPrintf("Error: Unable to successfully send M_RX_STATS_SNAPSHOT_CMD command to client!\n");
			return 0;

		}
		if(checkLibError(devNum, 1)) return 0;
		//get the returnFlag from the start of the return buffer
		returnFlag = *pReadValues;

		pReadValues+=4;
		/* copy the data from command receive buffer into buffer */
		memcpy(pRxStats, pReadValues, sizeof(RX_STATS_SNAPSHOT));
	}
	if(checkLibError(devNum, 1)) {
		return 0;
	}
	return(returnFlag);
}

void art_cleanupTxRxMemory
(
 A_UINT32 devNum,
 A_UINT32 flags
)
{
	if(!configSetup.remote || !configSetup.remote_exec)
	{
		cleanupTxRxMemory(devNum, flags);
	}
	else
	{
		// create cmd to send to client
		GlobalCmd.cmdID = M_CLEANUP_TXRX_MEMORY_CMD_ID;
		GlobalCmd.devNum = (A_INT8) devNum;
		GlobalCmd.CMD_U.SET_ONE_CMD.param = flags;

		if (!artSendCmd(&GlobalCmd,
						sizeof(GlobalCmd.CMD_U.SET_ONE_CMD)+sizeof(GlobalCmd.cmdID),
						NULL))
		{
			uiPrintf("Error: Unable to successfully send CLEANUP_TXRX_MEMORY command to client!\n");
		}
	}
	checkLibError(devNum, 1);
}

void art_txrxDataBegin
(
	A_UINT32 devNum,
	A_UINT32 waitTime,
	A_UINT32 timeout,
	A_UINT32 remoteStats,
	A_UINT32 enableCompare,
	A_UCHAR *dataPattern,
	A_UINT32 dataPatternLength
)
{
	if (!configSetup.remote || !configSetup.remote_exec)
	{
		txrxDataBegin(devNum, waitTime, timeout, remoteStats, enableCompare, dataPattern, dataPatternLength);
	}
	else
	{
		// create cmd to send to client
		GlobalCmd.cmdID = M_TXRX_DATA_BEGIN_CMD_ID;
		GlobalCmd.devNum = (A_INT8) devNum;
		GlobalCmd.CMD_U.RX_DATA_BEGIN_CMD.waitTime = waitTime;
		GlobalCmd.CMD_U.RX_DATA_BEGIN_CMD.timeout = timeout;
		GlobalCmd.CMD_U.RX_DATA_BEGIN_CMD.remoteStats = remoteStats;
		GlobalCmd.CMD_U.RX_DATA_BEGIN_CMD.enableCompare = enableCompare;
		GlobalCmd.CMD_U.RX_DATA_BEGIN_CMD.dataPatternLength = dataPatternLength;
		memcpy(GlobalCmd.CMD_U.RX_DATA_BEGIN_CMD.dataPattern, dataPattern, dataPatternLength);

		if (!artSendCmd(&GlobalCmd,
						sizeof(GlobalCmd.CMD_U.RX_DATA_BEGIN_CMD)+sizeof(GlobalCmd.cmdID),
						NULL))
		{
			uiPrintf("Error: Unable to successfully send TXRX_DATA_BEGIN_CMD command to client!\n");
		}
	}
	checkLibError(devNum, 1);
}

void art_setAntenna
(
	A_UINT32 devNum,
	A_UINT32 antenna
)
{
	if(!configSetup.remote || !configSetup.remote_exec)
	{
		setAntenna(devNum, antenna);
	}
	else
	{
		// create cmd to send to client
		GlobalCmd.cmdID = M_SET_ANTENNA_CMD_ID;
		GlobalCmd.devNum = (A_INT8) devNum;
		GlobalCmd.CMD_U.SET_ONE_CMD.param = antenna;

		if (!artSendCmd(&GlobalCmd,
						sizeof(GlobalCmd.CMD_U.SET_ONE_CMD)+sizeof(GlobalCmd.cmdID),
						NULL))
		{
			uiPrintf("Error: Unable to successfully send SET_ANTENNA_CMD command to client!\n");
		}
	}
	checkLibError(devNum, 1);
}


// Continuous Transmit Functions
void art_txContBegin
(
	A_UINT32 devNum,
	A_UINT32 type,
	A_UINT32 typeOption1,
	A_UINT32 typeOption2,
	A_UINT32 antenna
)
{
	if (!configSetup.remote || !configSetup.remote_exec)
	{
			txContBegin(devNum, type, typeOption1, typeOption2, antenna);
	}
	else
	{
		// create cmd to send to client
		GlobalCmd.cmdID = M_TX_CONT_BEGIN_CMD_ID;
		GlobalCmd.devNum = (A_INT8) devNum;
		GlobalCmd.CMD_U.TX_CONT_BEGIN_CMD.type = type;
		GlobalCmd.CMD_U.TX_CONT_BEGIN_CMD.typeOption1 = typeOption1;
		GlobalCmd.CMD_U.TX_CONT_BEGIN_CMD.typeOption2 = typeOption2;
		GlobalCmd.CMD_U.TX_CONT_BEGIN_CMD.antenna = antenna;

		if (!artSendCmd(&GlobalCmd,
						sizeof(GlobalCmd.CMD_U.TX_CONT_BEGIN_CMD)+sizeof(GlobalCmd.cmdID),
						NULL))
		{
			uiPrintf("Error: Unable to successfully send TX_CONT_BEGIN_CMD command to client!\n");
		}
	}
	checkLibError(devNum, 1);
}

// agehari
void art_txContFrameBegin
(
	A_UINT32 devNum,
	A_UINT32 length,
	A_UINT32 ifswait,
	A_UINT32 typeOption1,
	A_UINT32 typeOption2,
	A_UINT32 antenna,
	A_BOOL   performStabilizePower,
	A_UINT32 numDescriptors,
	A_UCHAR *dest
)
{
	if (!configSetup.remote || !configSetup.remote_exec)
	{
		txContFrameBegin(devNum, length, ifswait, typeOption1, typeOption2, antenna, performStabilizePower, numDescriptors, dest);
	}
	else
	{
		// create cmd to send to client
		GlobalCmd.cmdID = M_TX_CONT_FRAME_BEGIN_CMD_ID;
		GlobalCmd.devNum = (A_INT8) devNum;
		GlobalCmd.CMD_U.TX_CONT_FRAME_BEGIN_CMD.length = length;
		GlobalCmd.CMD_U.TX_CONT_FRAME_BEGIN_CMD.ifswait = ifswait;
		GlobalCmd.CMD_U.TX_CONT_FRAME_BEGIN_CMD.typeOption1 = typeOption1;
		GlobalCmd.CMD_U.TX_CONT_FRAME_BEGIN_CMD.typeOption2 = typeOption2;
		GlobalCmd.CMD_U.TX_CONT_FRAME_BEGIN_CMD.antenna = antenna;
		GlobalCmd.CMD_U.TX_CONT_FRAME_BEGIN_CMD.performStabilizePower = performStabilizePower;
		GlobalCmd.CMD_U.TX_CONT_FRAME_BEGIN_CMD.numDescriptors = numDescriptors;
		if(dest) {
			memcpy(GlobalCmd.CMD_U.TX_CONT_FRAME_BEGIN_CMD.dest, dest, 6);
		}
		else {
			memset(GlobalCmd.CMD_U.TX_CONT_FRAME_BEGIN_CMD.dest, 0, 6);
		}

		if (!artSendCmd(&GlobalCmd,
						sizeof(GlobalCmd.CMD_U.TX_CONT_FRAME_BEGIN_CMD)+sizeof(GlobalCmd.cmdID),
						NULL))
		{
			uiPrintf("Error: Unable to successfully send TX_CONT_FRAME_BEGIN_CMD command to client!\n");
		}
	}
	checkLibError(devNum, 1);
}

void art_txContEnd
(
	A_UINT32 devNum
)
{

	if (!configSetup.remote || !configSetup.remote_exec)
	{
			txContEnd(devNum);
	}
	else
	{
		// create cmd to send to client
		GlobalCmd.cmdID = M_TX_CONT_END_CMD_ID;
		GlobalCmd.devNum = (A_INT8) devNum;

		if (!artSendCmd(&GlobalCmd,
						sizeof(GlobalCmd.cmdID),
						NULL))
		{
			uiPrintf("Error: Unable to successfully send TX_CONT_END_CMD command to client!\n");
		}
	}
	checkLibError(devNum, 1);
}

void art_txGetStats
(
 A_UINT32 devNum,
 A_UINT32 rateInMb,
 A_UINT32 remote,
 TX_STATS_STRUCT *pReturnStats
)
{
	A_UCHAR  *pReadValues;		  /* pointer to the values that were read */
	if (!configSetup.remote || !configSetup.remote_exec)
	{
		txGetStats(devNum, rateInMb, remote, pReturnStats);
	}
	else
	{
		// create cmd to send to client
		GlobalCmd.cmdID = M_TX_GET_STATS_CMD_ID;
		GlobalCmd.devNum = (A_INT8) devNum;
		GlobalCmd.CMD_U.GET_STATS_CMD.rateInMb = rateInMb;
		GlobalCmd.CMD_U.GET_STATS_CMD.remote = remote;

		if (!artSendCmd(&GlobalCmd,
						sizeof(GlobalCmd.CMD_U.GET_STATS_CMD)+sizeof(GlobalCmd.cmdID),
						(void **)&pReadValues))
		{
			uiPrintf("Error: Unable to successfully send TX_GET_STATS_CMD command to client!\n");

		}
		if(checkLibError(devNum, 1)) return;
		/* copy the data from command receive buffer into buffer for perl */
		memcpy(pReturnStats, pReadValues, sizeof(TX_STATS_STRUCT));
	}
	checkLibError(devNum, 1);
	return;
}

void art_rxGetStats
(
	A_UINT32 devNum,
	A_UINT32 rateInMb,
	A_UINT32 remote,
	RX_STATS_STRUCT *pReturnStats
)
{
		A_UCHAR  *pReadValues;		  /* pointer to the values that were read */

		if (!configSetup.remote || !configSetup.remote_exec)
		{
				rxGetStats(devNum, rateInMb, remote, pReturnStats);
		}
		else
		{
			// create cmd to send to client
			GlobalCmd.cmdID = M_RX_GET_STATS_CMD_ID;
			GlobalCmd.devNum = (A_INT8) devNum;
			GlobalCmd.CMD_U.GET_STATS_CMD.rateInMb = rateInMb;
			GlobalCmd.CMD_U.GET_STATS_CMD.remote = remote;
			if (!artSendCmd(&GlobalCmd,
							sizeof(GlobalCmd.CMD_U.GET_STATS_CMD)+sizeof(GlobalCmd.cmdID),
							(void **)&pReadValues))
			{
				uiPrintf("Error: Unable to successfully send RX_GET_STATS_CMD command to client!\n");
			}

			memcpy(pReturnStats, pReadValues, sizeof(RX_STATS_STRUCT));
//			printf("pReturnStats->goodPackets is %d \n",pReturnStats->goodPackets);

#if 0
			if(checkLibError(devNum, 1)) return;
			/* copy the data from command receive buffer into buffer for perl */
			memcpy(pReturnStats, pReadValues, sizeof(RX_STATS_STRUCT));
#endif
		}
	checkLibError(devNum, 1);
}

void art_rxDataStart
(
 A_UINT32 devNum
)
{
	if (!configSetup.remote || !configSetup.remote_exec)
	{
		rxDataStart(devNum);
	}
	else
	{
		// create cmd to send to client
		GlobalCmd.cmdID = M_RX_DATA_START_CMD_ID;
		GlobalCmd.devNum = (A_INT8) devNum;

		if (!artSendCmd(&GlobalCmd, sizeof(GlobalCmd.cmdID), NULL))
		{
			uiPrintf("Error: Unable to successfully send RX_DATA_START command to client!\n");
		}
	}
	checkLibError(devNum, 1);

	return;
}

void art_setSingleTransmitPower
(
 A_UINT32 devNum,
 A_UCHAR pcdac
)
{
	if	(!configSetup.remote || !configSetup.remote_exec)
	{
			setSingleTransmitPower(devNum, pcdac);
	}
	else
	{
		// create cmd to send to client
		GlobalCmd.cmdID = M_SET_SINGLE_TRANSMIT_POWER_CMD_ID;
		GlobalCmd.devNum = (A_INT8) devNum;
		GlobalCmd.CMD_U.SET_ONE_CMD.param = pcdac;

		if ( !artSendCmd(&GlobalCmd,
						sizeof(GlobalCmd.CMD_U.SET_ONE_CMD)+sizeof(GlobalCmd.cmdID),
						NULL))
		{
			uiPrintf("Error: Unable to successfully send SET_SINGLE_TRANSMIT_POWER_CMD command to client!\n");
		}
	}
	checkLibError(devNum, 1);
}

void art_specifySubSystemID
(
 A_UINT32 devNum,
 A_INT16  subsystemID
)
{
	if	(!configSetup.remote || !configSetup.remote_exec)
	{
		specifySubSystemID(devNum, subsystemID);
	}
	else
	{
		// create cmd to send to client

⌨️ 快捷键说明

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