diff options
author | sam <sam@FreeBSD.org> | 2009-02-19 04:15:14 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2009-02-19 04:15:14 +0000 |
commit | 59775ab4197ad46e8880c18d461641d747349cf8 (patch) | |
tree | 0075fec3c72839874eb68cb5b46fab4f993f00af /sys/dev/ath | |
parent | 234c48a69e9af853d05d12617bb8c97e8c77f020 (diff) | |
download | FreeBSD-src-59775ab4197ad46e8880c18d461641d747349cf8.zip FreeBSD-src-59775ab4197ad46e8880c18d461641d747349cf8.tar.gz |
add HAL_DIAG_SETREGS to write registers via the diag api
Diffstat (limited to 'sys/dev/ath')
-rw-r--r-- | sys/dev/ath/ath_hal/ah.c | 13 | ||||
-rw-r--r-- | sys/dev/ath/ath_hal/ah_internal.h | 11 |
2 files changed, 20 insertions, 4 deletions
diff --git a/sys/dev/ath/ath_hal/ah.c b/sys/dev/ath/ath_hal/ah.c index c1eac72..115c5d1 100644 --- a/sys/dev/ath/ath_hal/ah.c +++ b/sys/dev/ath/ath_hal/ah.c @@ -539,6 +539,15 @@ ath_hal_getregdump(struct ath_hal *ah, const HAL_REGRANGE *regs, } return (char *) dp - (char *) dstbuf; } + +static void +ath_hal_setregs(struct ath_hal *ah, const HAL_REGWRITE *regs, int space) +{ + while (space >= sizeof(HAL_REGWRITE)) { + OS_REG_WRITE(ah, regs->addr, regs->value); + regs++, space -= sizeof(HAL_REGWRITE); + } +} HAL_BOOL ath_hal_getdiagstate(struct ath_hal *ah, int request, @@ -553,6 +562,10 @@ ath_hal_getdiagstate(struct ath_hal *ah, int request, case HAL_DIAG_REGS: *resultsize = ath_hal_getregdump(ah, args, *result,*resultsize); return AH_TRUE; + case HAL_DIAG_SETREGS: + ath_hal_setregs(ah, args, argsize); + *resultsize = 0; + return AH_TRUE; case HAL_DIAG_FATALERR: *result = &AH_PRIVATE(ah)->ah_fatalState[0]; *resultsize = sizeof(AH_PRIVATE(ah)->ah_fatalState); diff --git a/sys/dev/ath/ath_hal/ah_internal.h b/sys/dev/ath/ath_hal/ah_internal.h index 4b05e8a..0e5dd78 100644 --- a/sys/dev/ath/ath_hal/ah_internal.h +++ b/sys/dev/ath/ath_hal/ah_internal.h @@ -49,6 +49,11 @@ typedef struct { uint16_t end; /* ending register or zero */ } HAL_REGRANGE; +typedef struct { + uint32_t addr; /* regiser address/offset */ + uint32_t value; /* value to write */ +} HAL_REGWRITE; + /* * Transmit power scale factor. * @@ -609,16 +614,14 @@ enum { HAL_DIAG_RESETKEY = 16, /* Reset keycache backdoor */ HAL_DIAG_EEREAD = 17, /* Read EEPROM word */ HAL_DIAG_EEWRITE = 18, /* Write EEPROM word */ - /* 19 was HAL_DIAG_TXCONT, 20-23 were for radar */ - HAL_DIAG_REGREAD = 24, /* Reg reads */ - HAL_DIAG_REGWRITE = 25, /* Reg writes */ - HAL_DIAG_GET_REGBASE = 26, /* Get register base */ + /* 19-26 removed, do not reuse */ HAL_DIAG_RDWRITE = 27, /* Write regulatory domain */ HAL_DIAG_RDREAD = 28, /* Get regulatory domain */ HAL_DIAG_FATALERR = 29, /* Read cached interrupt state */ HAL_DIAG_11NCOMPAT = 30, /* 11n compatibility tweaks */ HAL_DIAG_ANI_PARAMS = 31, /* ANI noise immunity parameters */ HAL_DIAG_CHECK_HANGS = 32, /* check h/w hangs */ + HAL_DIAG_SETREGS = 33, /* write registers */ }; enum { |