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

📄 ar5211_xmit.c

📁 Atheros wifi driver source code
💻 C
📖 第 1 页 / 共 2 页
字号:
			value |= AR5311_D_MISC_SEQ_NUM_CONTROL;		OS_REG_WRITE(ah, AR_QMISC(q), value);		break;	default:		/* NB: silence compiler */		break;	}#ifndef AH_DISABLE_WME	/*	 * Yes, this is a hack and not the right way to do it, but	 * it does get the lockout bits and backoff set for the	 * high-pri WME queues for testing.  We need to either extend	 * the meaning of queueInfo->mode, or create something like	 * queueInfo->dcumode.	 */	if (qi->tqi_intFlags & HAL_TXQ_USE_LOCKOUT_BKOFF_DIS) {		OS_REG_WRITE(ah, AR_DMISC(q),			 OS_REG_READ(ah, AR_DMISC(q)) |			 SM(AR_D_MISC_ARB_LOCKOUT_CNTRL_GLOBAL,			    AR_D_MISC_ARB_LOCKOUT_CNTRL)|			 AR_D_MISC_POST_FR_BKOFF_DIS);	}#endif	/*	 * Always update the secondary interrupt mask registers - this	 * could be a new queue getting enabled in a running system or	 * hw getting re-initialized during a reset!	 *	 * Since we don't differentiate between tx interrupts corresponding	 * to individual queues - secondary tx mask regs are always unmasked;	 * tx interrupts are enabled/disabled for all queues collectively	 * using the primary mask reg	 */	if (qi->tqi_qflags & TXQ_FLAG_TXOKINT_ENABLE)		ahp->ah_txOkInterruptMask |= 1 << q;	else		ahp->ah_txOkInterruptMask &= ~(1 << q);	if (qi->tqi_qflags & TXQ_FLAG_TXERRINT_ENABLE)		ahp->ah_txErrInterruptMask |= 1 << q;	else		ahp->ah_txErrInterruptMask &= ~(1 << q);	if (qi->tqi_qflags & TXQ_FLAG_TXDESCINT_ENABLE)		ahp->ah_txDescInterruptMask |= 1 << q;	else		ahp->ah_txDescInterruptMask &= ~(1 << q);	if (qi->tqi_qflags & TXQ_FLAG_TXEOLINT_ENABLE)		ahp->ah_txEolInterruptMask |= 1 << q;	else		ahp->ah_txEolInterruptMask &= ~(1 << q);	if (qi->tqi_qflags & TXQ_FLAG_TXURNINT_ENABLE)		ahp->ah_txUrnInterruptMask |= 1 << q;	else		ahp->ah_txUrnInterruptMask &= ~(1 << q);	setTxQInterrupts(ah, qi);	return AH_TRUE;}/* * Get the TXDP for the specified data queue. */u_int32_tar5211GetTxDP(struct ath_hal *ah, u_int q){	HALASSERT(q < HAL_NUM_TX_QUEUES);	return OS_REG_READ(ah, AR_QTXDP(q));}/* * Set the TxDP for the specified tx queue. */HAL_BOOLar5211SetTxDP(struct ath_hal *ah, u_int q, u_int32_t txdp){	HALASSERT(q < HAL_NUM_TX_QUEUES);	HALASSERT(AH5211(ah)->ah_txq[q].tqi_type != HAL_TX_QUEUE_INACTIVE);	/*	 * Make sure that TXE is deasserted before setting the TXDP.  If TXE	 * is still asserted, setting TXDP will have no effect.	 */	HALASSERT((OS_REG_READ(ah, AR_Q_TXE) & (1 << q)) == 0);	OS_REG_WRITE(ah, AR_QTXDP(q), txdp);	return AH_TRUE;}/* * Set Transmit Enable bits for the specified queues. */HAL_BOOLar5211StartTxDma(struct ath_hal *ah, u_int q){	HALASSERT(q < HAL_NUM_TX_QUEUES);	HALASSERT(AH5211(ah)->ah_txq[q].tqi_type != HAL_TX_QUEUE_INACTIVE);	/* Check that queue is not already active */	HALASSERT((OS_REG_READ(ah, AR_Q_TXD) & (1<<q)) == 0);	HALDEBUGn(ah, 2, "%s: queue %u\n", __func__, q);	/* Check to be sure we're not enabling a q that has its TXD bit set. */	HALASSERT((OS_REG_READ(ah, AR_Q_TXD) & (1 << q)) == 0);	OS_REG_WRITE(ah, AR_Q_TXE, 1 << q);	return AH_TRUE;}/* * Return the number of frames pending on the specified queue. */u_int32_tar5211NumTxPending(struct ath_hal *ah, u_int q){	u_int32_t n;	HALASSERT(q < HAL_NUM_TX_QUEUES);	HALASSERT(AH5211(ah)->ah_txq[q].tqi_type != HAL_TX_QUEUE_INACTIVE);	n = OS_REG_READ(ah, AR_QSTS(q)) & AR_Q_STS_PEND_FR_CNT_M;	/*	 * Pending frame count (PFC) can momentarily go to zero	 * while TXE remains asserted.  In other words a PFC of	 * zero is not sufficient to say that the queue has stopped.	 */	if (n == 0 && (OS_REG_READ(ah, AR_Q_TXE) & (1<<q)))		n = 1;			/* arbitrarily pick 1 */	return n;}/* * Stop transmit on the specified queue */HAL_BOOLar5211StopTxDma(struct ath_hal *ah, u_int q){	int i;	HALASSERT(q < HAL_NUM_TX_QUEUES);	HALASSERT(AH5211(ah)->ah_txq[q].tqi_type != HAL_TX_QUEUE_INACTIVE);	OS_REG_WRITE(ah, AR_Q_TXD, 1<<q);	for (i = 0; i < 10000; i++) {		if (ar5211NumTxPending(ah, q) == 0)			break;		OS_DELAY(10);	}	OS_REG_WRITE(ah, AR_Q_TXD, 0);	return (i < 10000);}HAL_BOOLar5211UpdateCTSForBursting(struct ath_hal *ah, struct ath_desc *ds,	struct ath_desc *prevds,	struct ath_desc *prevdsWithCTS,	struct ath_desc *gatingds,		u_int32_t txOpLimit,	u_int32_t ctsDuration){	return 1;}/* * Descriptor Access Functions */#define	VALID_PKT_TYPES \	((1<<HAL_PKT_TYPE_NORMAL)|(1<<HAL_PKT_TYPE_ATIM)|\	 (1<<HAL_PKT_TYPE_PSPOLL)|(1<<HAL_PKT_TYPE_PROBE_RESP)|\	 (1<<HAL_PKT_TYPE_BEACON))#define	isValidPktType(_t)	((1<<(_t)) & VALID_PKT_TYPES)#define	VALID_TX_RATES \	((1<<0x0b)|(1<<0x0f)|(1<<0x0a)|(1<<0x0e)|(1<<0x09)|(1<<0x0d)|\	 (1<<0x08)|(1<<0x0c)|(1<<0x1b)|(1<<0x1a)|(1<<0x1e)|(1<<0x19)|\	 (1<<0x1d)|(1<<0x18)|(1<<0x1c))#define	isValidTxRate(_r)	((1<<(_r)) & VALID_TX_RATES)HAL_BOOLar5211SetupTxDesc(struct ath_hal *ah, struct ath_desc *ds,	u_int pktLen,	u_int hdrLen,	HAL_PKT_TYPE type,	u_int txPower,	u_int txRate0, u_int txTries0,	u_int keyIx,	u_int antMode,	u_int flags,	u_int rtsctsRate,	u_int rtsctsDuration,	u_int compicvLen, 	u_int compivLen,	u_int comp){	struct ar5211_desc *ads = AR5211DESC(ds);	(void) hdrLen;	(void) txPower;	(void) rtsctsRate; (void) rtsctsDuration;	HALASSERT(txTries0 != 0);	HALASSERT(isValidPktType(type));	HALASSERT(isValidTxRate(txRate0));	/* XXX validate antMode */	ads->ds_ctl0 = (pktLen & AR_FrameLen)		     | (txRate0 << AR_XmitRate_S)		     | (antMode << AR_AntModeXmit_S)		     | (flags & HAL_TXDESC_CLRDMASK ? AR_ClearDestMask : 0)		     | (flags & HAL_TXDESC_INTREQ ? AR_TxInterReq : 0)		     | (flags & HAL_TXDESC_RTSENA ? AR_RTSCTSEnable : 0)		     | (flags & HAL_TXDESC_VEOL ? AR_VEOL : 0)		     ;	ads->ds_ctl1 = (type << 26)		     | (flags & HAL_TXDESC_NOACK ? AR_NoAck : 0)		     ;	if (keyIx != HAL_TXKEYIX_INVALID) {		ads->ds_ctl1 |=			(keyIx << AR_EncryptKeyIdx_S) & AR_EncryptKeyIdx;		ads->ds_ctl0 |= AR_EncryptKeyValid;	}	return AH_TRUE;#undef RATE}HAL_BOOLar5211SetupXTxDesc(struct ath_hal *ah, struct ath_desc *ds,	u_int txRate1, u_int txTries1,	u_int txRate2, u_int txTries2,	u_int txRate3, u_int txTries3){	(void) ah; (void) ds;	(void) txRate1; (void) txTries1;	(void) txRate2; (void) txTries2;	(void) txRate3; (void) txTries3;	return AH_FALSE;}voidar5211IntrReqTxDesc(struct ath_hal *ah, struct ath_desc *ds){	struct ar5211_desc *ads = AR5211DESC(ds);	ads->ds_ctl0 |= AR_TxInterReq;}HAL_BOOLar5211FillTxDesc(struct ath_hal *ah, struct ath_desc *ds,	u_int segLen, HAL_BOOL firstSeg, HAL_BOOL lastSeg,	const struct ath_desc *ds0){	struct ar5211_desc *ads = AR5211DESC(ds);	HALASSERT((segLen &~ AR_BufLen) == 0);	if (firstSeg) {		/*		 * First descriptor, don't clobber xmit control data		 * setup by ar5211SetupTxDesc.		 */		ads->ds_ctl1 |= segLen | (lastSeg ? 0 : AR_More);	} else if (lastSeg) {		/* !firstSeg && lastSeg */		/*		 * Last descriptor in a multi-descriptor frame,		 * copy the transmit parameters from the first		 * frame for processing on completion. 		 */		ads->ds_ctl0 = AR5211DESC_CONST(ds0)->ds_ctl0;		ads->ds_ctl1 = segLen;	} else {			/* !firstSeg && !lastSeg */		/*		 * Intermediate descriptor in a multi-descriptor frame.		 */		ads->ds_ctl0 = 0;		ads->ds_ctl1 = segLen | AR_More;	}	ads->ds_status0 = ads->ds_status1 = 0;	return AH_TRUE;}/* * Processing of HW TX descriptor. */HAL_STATUSar5211ProcTxDesc(struct ath_hal *ah, struct ath_desc *ds){	struct ar5211_desc *ads = AR5211DESC(ds);	if ((ads->ds_status1 & AR_Done) == 0)		return HAL_EINPROGRESS;	/* Update software copies of the HW status */	ds->ds_txstat->ts_seqnum = MS(ads->ds_status1, AR_SeqNum);	ds->ds_txstat->ts_tstamp = MS(ads->ds_status0, AR_SendTimestamp);	ds->ds_txstat->ts_status = 0;	if ((ads->ds_status0 & AR_FrmXmitOK) == 0) {		if (ads->ds_status0 & AR_ExcessiveRetries)			ds->ds_txstat->ts_status |= HAL_TXERR_XRETRY;		if (ads->ds_status0 & AR_Filtered)			ds->ds_txstat->ts_status |= HAL_TXERR_FILT;		if (ads->ds_status0 & AR_FIFOUnderrun)			ds->ds_txstat->ts_status |= HAL_TXERR_FIFO;	}	ds->ds_txstat->ts_rate = MS(ads->ds_ctl0, AR_XmitRate);	ds->ds_txstat->ts_rssi = MS(ads->ds_status1, AR_AckSigStrength);	ds->ds_txstat->ts_shortretry = MS(ads->ds_status0, AR_ShortRetryCnt);	ds->ds_txstat->ts_longretry = MS(ads->ds_status0, AR_LongRetryCnt);	ds->ds_txstat->ts_virtcol = MS(ads->ds_status0, AR_VirtCollCnt);	ds->ds_txstat->ts_antenna = 0;		/* NB: don't know */	/*	 * WAR for h/w bug where the number of retries is one	 * less than it should be.  Also, 0 retries and 1 retry	 * are both reported as 0 retries.	 */	if (ds->ds_txstat->ts_shortretry > 0)		ds->ds_txstat->ts_shortretry++;	if (ds->ds_txstat->ts_longretry > 0)		ds->ds_txstat->ts_longretry++;	return HAL_OK;}/* * Determine which tx queues need interrupt servicing. * STUB. */voidar5211GetTxIntrQueue(struct ath_hal *ah, u_int32_t *txqs){	return;}#endif /* AH_SUPPORT_AR5211 */

⌨️ 快捷键说明

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