Add another HAL function which waits for a register for a configurable amount.

This will be used by some future code.
This commit is contained in:
adrian 2011-01-20 07:03:20 +00:00
parent 155d93ad41
commit a6602e1600
2 changed files with 10 additions and 2 deletions

View File

@ -197,9 +197,16 @@ HAL_BOOL
ath_hal_wait(struct ath_hal *ah, u_int reg, uint32_t mask, uint32_t val)
{
#define AH_TIMEOUT 1000
return ath_hal_waitfor(ah, reg, mask, val, AH_TIMEOUT);
#undef AH_TIMEOUT
}
HAL_BOOL
ath_hal_waitfor(struct ath_hal *ah, u_int reg, uint32_t mask, uint32_t val, uint32_t timeout)
{
int i;
for (i = 0; i < AH_TIMEOUT; i++) {
for (i = 0; i < timeout; i++) {
if ((OS_REG_READ(ah, reg) & mask) == val)
return AH_TRUE;
OS_DELAY(10);
@ -208,7 +215,6 @@ ath_hal_wait(struct ath_hal *ah, u_int reg, uint32_t mask, uint32_t val)
"%s: timeout on reg 0x%x: 0x%08x & 0x%08x != 0x%08x\n",
__func__, reg, OS_REG_READ(ah, reg), mask, val);
return AH_FALSE;
#undef AH_TIMEOUT
}
/*

View File

@ -471,6 +471,8 @@ extern int ath_hal_additional_swba_backoff; /* in TU's */
/* wait for the register contents to have the specified value */
extern HAL_BOOL ath_hal_wait(struct ath_hal *, u_int reg,
uint32_t mask, uint32_t val);
extern HAL_BOOL ath_hal_waitfor(struct ath_hal *, u_int reg,
uint32_t mask, uint32_t val, uint32_t timeout);
/* return the first n bits in val reversed */
extern uint32_t ath_hal_reverseBits(uint32_t val, uint32_t n);