本文整理汇总了C++中HALASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ HALASSERT函数的具体用法?C++ HALASSERT怎么用?C++ HALASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HALASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ar5416GpioSet
/*
* Once configured for I/O - set output lines
*/
HAL_BOOL
ar5416GpioSet(struct ath_hal *ah, uint32_t gpio, uint32_t val)
{
uint32_t reg;
HALASSERT(gpio < AH_PRIVATE(ah)->ah_caps.halNumGpioPins);
HALDEBUG(ah, HAL_DEBUG_GPIO,
"%s: gpio=%d, val=%d\n", __func__, gpio, val);
reg = OS_REG_READ(ah, AR_GPIO_IN_OUT);
if (val & 1)
reg |= AR_GPIO_BIT(gpio);
else
reg &= ~AR_GPIO_BIT(gpio);
OS_REG_WRITE(ah, AR_GPIO_IN_OUT, reg);
return AH_TRUE;
}
示例2: ar5212SetupRxDesc
/*
* Initialize RX descriptor, by clearing the status and setting
* the size (and any other flags).
*/
HAL_BOOL
ar5212SetupRxDesc(struct ath_hal *ah, struct ath_desc *ds,
uint32_t size, u_int flags)
{
struct ar5212_desc *ads = AR5212DESC(ds);
HALASSERT((size &~ AR_BufLen) == 0);
ads->ds_ctl0 = 0;
ads->ds_ctl1 = size & AR_BufLen;
if (flags & HAL_RXDESC_INTREQ)
ads->ds_ctl1 |= AR_RxInterReq;
ads->ds_rxstatus0 = ads->ds_rxstatus1 = 0;
return AH_TRUE;
}
示例3: ar5416SetupRxDesc
/*
* Initialize RX descriptor, by clearing the status and setting
* the size (and any other flags).
*/
HAL_BOOL
ar5416SetupRxDesc(struct ath_hal *ah, struct ath_desc *ds,
uint32_t size, u_int flags)
{
struct ar5416_desc *ads = AR5416DESC(ds);
HALASSERT((size &~ AR_BufLen) == 0);
ads->ds_ctl1 = size & AR_BufLen;
if (flags & HAL_RXDESC_INTREQ)
ads->ds_ctl1 |= AR_RxIntrReq;
/* this should be enough */
ads->ds_rxstatus8 &= ~AR_RxDone;
return AH_TRUE;
}
示例4: ar2425GetRfBank
/*
* Return a reference to the requested RF Bank.
*/
static u_int32_t *
ar2425GetRfBank(struct ath_hal *ah, int bank)
{
struct ath_hal_5212 *ahp = AH5212(ah);
AR5212_RF_BANKS_2425 *pRfBank2425 = ahp->ah_analogBanks;
HALASSERT(ahp->ah_analogBanks != AH_NULL);
switch (bank) {
case 1: return pRfBank2425->Bank1Data;
case 2: return pRfBank2425->Bank2Data;
case 3: return pRfBank2425->Bank3Data;
case 6: return pRfBank2425->Bank6Data;
case 7: return pRfBank2425->Bank7Data;
}
HDPRINTF(ah, HAL_DBG_RF_PARAM, "%s: unknown RF Bank %d requested\n", __func__, bank);
return AH_NULL;
}
示例5: ar5212AniCckErrTrigger
static void
ar5212AniCckErrTrigger(struct ath_hal *ah)
{
struct ath_hal_5212 *ahp = AH5212(ah);
HAL_CHANNEL_INTERNAL *chan = AH_PRIVATE(ah)->ah_curchan;
struct ar5212AniState *aniState;
WIRELESS_MODE mode;
int32_t rssi;
HALASSERT(chan != AH_NULL);
if (!DO_ANI(ah))
return;
/* first, raise noise immunity level, up to max */
aniState = ahp->ah_curani;
if (aniState->noiseImmunityLevel < HAL_NOISE_IMMUNE_MAX) {
ar5212AniControl(ah, HAL_ANI_NOISE_IMMUNITY_LEVEL,
aniState->noiseImmunityLevel + 1);
return;
}
/* Do not play with OFDM and CCK weak detection in AP mode */
if( AH_PRIVATE(ah)->ah_opmode == HAL_M_HOSTAP) {
return;
}
rssi = BEACON_RSSI(aniState);
if (rssi > aniState->rssiThrLow) {
/*
* Beacon signal in mid and high range, raise firsteplevel.
*/
if (aniState->firstepLevel < HAL_FIRST_STEP_MAX)
ar5212AniControl(ah, HAL_ANI_FIRSTEP_LEVEL,
aniState->firstepLevel + 1);
} else {
/*
* Beacon rssi is low, zero firstepLevel to maximize
* CCK sensitivity.
*/
mode = ath_hal_chan2wmode(ah, (HAL_CHANNEL *) chan);
if (mode == WIRELESS_MODE_11g || mode == WIRELESS_MODE_11b) {
if (aniState->firstepLevel > 0)
ar5212AniControl(ah, HAL_ANI_FIRSTEP_LEVEL, 0);
}
}
}
示例6: ar5416GpioCfgOutput
/*
* Configure GPIO Output lines
*/
HAL_BOOL
ar5416GpioCfgOutput(struct ath_hal *ah, uint32_t gpio)
{
uint32_t gpio_shift, reg;
HALASSERT(gpio < AH_PRIVATE(ah)->ah_caps.halNumGpioPins);
/* NB: type maps directly to hardware */
//cfgOutputMux(ah, gpio, type);
gpio_shift = gpio << 1; /* 2 bits per output mode */
reg = OS_REG_READ(ah, AR_GPIO_OE_OUT);
reg &= ~(AR_GPIO_OE_OUT_DRV << gpio_shift);
reg |= AR_GPIO_OE_OUT_DRV_ALL << gpio_shift;
OS_REG_WRITE(ah, AR_GPIO_OE_OUT, reg);
return AH_TRUE;
}
示例7: ar5416GpioCfgInput
/*
* Configure GPIO Input lines
*/
HAL_BOOL
ar5416GpioCfgInput(struct ath_hal *ah, u_int32_t gpio)
{
u_int32_t gpio_shift;
HALASSERT(gpio < AH_PRIVATE(ah)->ah_caps.hal_num_gpio_pins);
/* TODO: configure input mux for AR5416 */
/* If configured as input, set output to tristate */
gpio_shift = 2*gpio;
OS_REG_RMW(ah,
AR_GPIO_OE_OUT,
(AR_GPIO_OE_OUT_DRV_NO << gpio_shift),
(AR_GPIO_OE_OUT_DRV << gpio_shift));
return AH_TRUE;
}
示例8: ar7010GpioCfgInput
/*
* Configure GPIO Input lines
*/
HAL_BOOL
ar7010GpioCfgInput(struct ath_hal *ah, u_int32_t gpio)
{
u_int32_t gpio_shift;
HALASSERT(gpio < AH_PRIVATE(ah)->ah_caps.hal_num_gpio_pins);
/* If configured as input, set output to tristate */
gpio_shift = gpio;
/* Per bit output enable. 1: enable the input driver */
OS_REG_RMW(ah,
AR7010_GPIO_OE,
(AR7010_GPIO_OE_AS_INPUT << gpio_shift),
(AR7010_GPIO_OE_MASK << gpio_shift));
return AH_TRUE;
}
示例9: ar5416GpioCfgInput
/*
* Configure GPIO Input lines
*/
HAL_BOOL
ar5416GpioCfgInput(struct ath_hal *ah, uint32_t gpio)
{
uint32_t gpio_shift, reg;
HALASSERT(gpio < AH_PRIVATE(ah)->ah_caps.halNumGpioPins);
/* TODO: configure input mux for AR5416 */
/* If configured as input, set output to tristate */
gpio_shift = gpio << 1;
reg = OS_REG_READ(ah, AR_GPIO_OE_OUT);
reg &= ~(AR_GPIO_OE_OUT_DRV << gpio_shift);
reg |= AR_GPIO_OE_OUT_DRV_ALL << gpio_shift;
OS_REG_WRITE(ah, AR_GPIO_OE_OUT, reg);
return AH_TRUE;
}
示例10: ar5416FillTxDesc
HAL_BOOL
ar5416FillTxDesc(struct ath_hal *ah, void *ds, dma_addr_t *bufAddr,
u_int32_t *seg_len, u_int desc_id, u_int qcu, HAL_KEY_TYPE keyType, HAL_BOOL first_seg,
HAL_BOOL last_seg, const void *ds0)
{
struct ar5416_desc *ads = AR5416DESC(ds);
HALASSERT((seg_len[0] &~ AR_BufLen) == 0);
OS_MEMZERO(&(ads->u.tx.tx_status), sizeof(ads->u.tx.tx_status));
/* Set the buffer addresses */
ads->ds_data = bufAddr[0];
if (first_seg) {
/*
* First descriptor, don't clobber xmit control data
* setup by ar5416SetupTxDesc.
*/
ads->ds_ctl1 |= seg_len[0] | (last_seg ? 0 : AR_TxMore);
} else if (last_seg) { /* !first_seg && last_seg */
/*
* Last descriptor in a multi-descriptor frame,
* copy the multi-rate transmit parameters from
* the first frame for processing on completion.
*/
ads->ds_ctl0 = 0;
ads->ds_ctl1 = seg_len[0];
#ifdef AH_NEED_DESC_SWAP
ads->ds_ctl2 = __bswap32(AR5416DESC_CONST(ds0)->ds_ctl2);
ads->ds_ctl3 = __bswap32(AR5416DESC_CONST(ds0)->ds_ctl3);
#else
ads->ds_ctl2 = AR5416DESC_CONST(ds0)->ds_ctl2;
ads->ds_ctl3 = AR5416DESC_CONST(ds0)->ds_ctl3;
#endif
} else { /* !first_seg && !last_seg */
/*
* Intermediate descriptor in a multi-descriptor frame.
*/
ads->ds_ctl0 = 0;
ads->ds_ctl1 = seg_len[0] | AR_TxMore;
ads->ds_ctl2 = 0;
ads->ds_ctl3 = 0;
}
return AH_TRUE;
}
示例11: ar5416CalcTxAirtime
/*
* Calculate air time of a transmit packet
*/
u_int32_t
ar5416CalcTxAirtime(struct ath_hal *ah, void *ds, struct ath_tx_status *ts,
HAL_BOOL comp_wastedt, u_int8_t nbad, u_int8_t nframes)
{
struct ar5416_desc *ads = AR5416DESC(ds);
int finalindex_tries;
int status9;
/*
* Number of attempts made on the final index
* Note: If no BA was recv, then the data_fail_cnt is the number of tries
* made on the final index. If BA was recv, then add 1 to account for the
* successful attempt.
*/
finalindex_tries = ts->ts_longretry + (ts->ts_flags & HAL_TX_BA)? 1 : 0;
/*
* Use a local copy of the ads in the cacheable memory to
* improve the d-cache efficiency.
*/
status9 = ads->ds_txstatus9;
status9 = MS(status9, AR_FinalTxIdx);
/*
* Calculate time of transmit on air for packet including retries
* at different rates.
*/
if (status9 == 0) {
return MS(ads->ds_ctl4, AR_PacketDur0) * finalindex_tries;
} else if (status9 == 1) {
return (MS(ads->ds_ctl4, AR_PacketDur1) * finalindex_tries) +
(MS(ads->ds_ctl2, AR_XmitDataTries0) * MS(ads->ds_ctl4, AR_PacketDur0));
} else if (status9 == 2) {
return (MS(ads->ds_ctl5, AR_PacketDur2) * finalindex_tries) +
(MS(ads->ds_ctl2, AR_XmitDataTries1) * MS(ads->ds_ctl4, AR_PacketDur1)) +
(MS(ads->ds_ctl2, AR_XmitDataTries0) * MS(ads->ds_ctl4, AR_PacketDur0));
} else if (status9 == 3) {
return (MS(ads->ds_ctl5, AR_PacketDur3) * finalindex_tries) +
(MS(ads->ds_ctl2, AR_XmitDataTries2) * MS(ads->ds_ctl5, AR_PacketDur2)) +
(MS(ads->ds_ctl2, AR_XmitDataTries1) * MS(ads->ds_ctl4, AR_PacketDur1)) +
(MS(ads->ds_ctl2, AR_XmitDataTries0) * MS(ads->ds_ctl4, AR_PacketDur0));
} else {
HALASSERT(0);
return 0;
}
}
示例12: ar5416GpioCfgOutputLEDoff
/*
* Configure GPIO Output lines - LED Off
*/
HAL_BOOL
ar5416GpioCfgOutputLEDoff(struct ath_hal *ah, u_int32_t gpio, HAL_GPIO_OUTPUT_MUX_TYPE halSignalType)
{
#define N(a) (sizeof(a)/sizeof(a[0]))
u_int32_t ah_signal_type;
u_int32_t gpio_shift;
static const u_int32_t MuxSignalConversionTable[] = {
/* HAL_GPIO_OUTPUT_MUX_AS_OUTPUT */ AR_GPIO_OUTPUT_MUX_AS_OUTPUT,
/* HAL_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED */ AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED,
/* HAL_GPIO_OUTPUT_MUX_AS_PCIE_POWER_LED */ AR_GPIO_OUTPUT_MUX_AS_PCIE_POWER_LED,
/* HAL_GPIO_OUTPUT_MUX_AS_MAC_NETWORK_LED */ AR_GPIO_OUTPUT_MUX_AS_MAC_NETWORK_LED,
/* HAL_GPIO_OUTPUT_MUX_AS_MAC_POWER_LED */ AR_GPIO_OUTPUT_MUX_AS_MAC_POWER_LED,
/* HAL_GPIO_OUTPUT_MUX_AS_WLAN_ACTIVE */ AR_GPIO_OUTPUT_MUX_AS_RX_CLEAR_EXTERNAL,
/* HAL_GPIO_OUTPUT_MUX_AS_TX_FRAME */ AR_GPIO_OUTPUT_MUX_AS_TX_FRAME,
};
HALASSERT(gpio < AH_PRIVATE(ah)->ah_caps.hal_num_gpio_pins);
// Convert HAL signal type definitions to hardware-specific values.
if ((halSignalType >= 0) && (halSignalType < N(MuxSignalConversionTable)))
{
ah_signal_type = MuxSignalConversionTable[halSignalType];
}
else
{
return AH_FALSE;
}
// Configure the MUX
ar5416GpioCfgOutputMux(ah, gpio, ah_signal_type);
// 2 bits per output mode
gpio_shift = 2*gpio;
OS_REG_RMW(ah,
AR_GPIO_OE_OUT,
(AR_GPIO_OE_OUT_DRV_NO << gpio_shift),
(AR_GPIO_OE_OUT_DRV << gpio_shift));
return AH_TRUE;
#undef N
}
示例13: GetLowerUpperIndex
/*
* Return indices surrounding the value in sorted integer lists.
*
* NB: the input list is assumed to be sorted in ascending order
*/
static void
GetLowerUpperIndex(int16_t v, const uint16_t *lp, uint16_t listSize,
uint32_t *vlo, uint32_t *vhi)
{
int16_t target = v;
const int16_t *ep = lp+listSize;
const int16_t *tp;
/*
* Check first and last elements for out-of-bounds conditions.
*/
if (target < lp[0]) {
*vlo = *vhi = 0;
return;
}
if (target >= ep[-1]) {
*vlo = *vhi = listSize - 1;
return;
}
/* look for value being near or between 2 values in list */
for (tp = lp; tp < ep; tp++) {
/*
* If value is close to the current value of the list
* then target is not between values, it is one of the values
*/
if (*tp == target) {
*vlo = *vhi = tp - (const int16_t *) lp;
return;
}
/*
* Look for value being between current value and next value
* if so return these 2 values
*/
if (target < tp[1]) {
*vlo = tp - (const int16_t *) lp;
*vhi = *vlo + 1;
return;
}
}
HALASSERT(AH_FALSE); /* should not reach here */
*vlo = *vhi = 0;
}
示例14: ar9300GpioCfgInput
/*
* Configure GPIO Input lines
*/
HAL_BOOL
ar9300GpioCfgInput(struct ath_hal *ah, u_int32_t gpio)
{
#ifndef AR9340_EMULATION
u_int32_t gpio_shift;
HALASSERT(gpio < AH_PRIVATE(ah)->ah_caps.halNumGpioPins);
/* TODO: configure input mux for AR9300 */
/* If configured as input, set output to tristate */
gpio_shift = 2*gpio;
OS_REG_RMW(ah,
AR_HOSTIF_REG(ah, AR_GPIO_OE_OUT),
(AR_GPIO_OE_OUT_DRV_NO << gpio_shift),
(AR_GPIO_OE_OUT_DRV << gpio_shift));
#endif
return AH_TRUE;
}
示例15: ar5416SetupRxDesc
HAL_BOOL
ar5416SetupRxDesc(struct ath_hal *ah, struct ath_desc *ds,
u_int32_t size, u_int flags)
{
struct ar5416_desc *ads = AR5416DESC(ds);
HAL_CAPABILITIES *pCap = &AH_PRIVATE(ah)->ah_caps;
HALASSERT((size &~ AR_BufLen) == 0);
ads->ds_ctl1 = size & AR_BufLen;
if (flags & HAL_RXDESC_INTREQ)
ads->ds_ctl1 |= AR_RxIntrReq;
/* this should be enough */
ads->ds_rxstatus8 &= ~AR_RxDone;
if (! pCap->halAutoSleepSupport) {
/* If AutoSleep not supported, clear all fields. */
OS_MEMZERO(&(ads->u), sizeof(ads->u));
}
return AH_TRUE;
}