From 59775ab4197ad46e8880c18d461641d747349cf8 Mon Sep 17 00:00:00 2001 From: sam Date: Thu, 19 Feb 2009 04:15:14 +0000 Subject: add HAL_DIAG_SETREGS to write registers via the diag api --- sys/dev/ath/ath_hal/ah.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'sys/dev/ath/ath_hal/ah.c') 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); -- cgit v1.1