FreeBSD/sys/dev/wl/if_wl.c
/*
** wlsetpsa
**
** Writes the psa for wavelan (unit) from the softc back to the
** board.  Updates the CRC and sets the CRC OK flag.
**
** Do not call this when the board is operating, as it doesn't 
** preserve the hacr.
*/
wlsetpsa
Writes the psa for wavelan (unit) from the softc back to the
board.  Updates the CRC and sets the CRC OK flag.

Do not call this when the board is operating, as it doesn't
preserve the hacr.
wlsetpsa Writes the psa for wavelan ( unit ) from the softc back to the board . Updates the CRC and sets the CRC OK flag . Do not call this when the board is operating as it doesn ' t preserve the hacr .
static void
wlsetpsa(struct wl_softc *sc)
{
    int		i;
    u_short	crc;
    crc = wlpsacrc(sc->psa);	
    sc->psa[WLPSA_CRCLOW] = crc & 0xff;
    sc->psa[WLPSA_CRCHIGH] = (crc >> 8) & 0xff;
    sc->psa[WLPSA_CRCOK] = 0x55;	
    PCMD(sc, HACR_DEFAULT & ~HACR_16BITS);
    PCMD(sc, HACR_DEFAULT & ~HACR_16BITS);
    for (i = 0; i < 0x40; i++) {
	DELAY(DELAYCONST);
	WL_WRITE_2(sc, PIOR2, i);  
	DELAY(DELAYCONST);
	WL_WRITE_1(sc, PIOP2, sc->psa[i]);
    }
    DELAY(DELAYCONST);
    WL_WRITE_2(sc, PIOR2, WLPSA_CRCOK);  
    DELAY(DELAYCONST);
    sc->psa[WLPSA_CRCOK] = 0xaa;	
    WL_WRITE_1(sc, PIOP2, 0xaa);	
    DELAY(DELAYCONST);
    PCMD(sc, HACR_DEFAULT);
    PCMD(sc, HACR_DEFAULT);
}
static void wlsetpsa ( struct wl_softc * sc ) { int i ; u_short crc ; crc = wlpsacrc ( sc -> psa ) ; sc -> psa [ WLPSA_CRCLOW ] = crc & 0xff ; sc -> psa [ WLPSA_CRCHIGH ] = ( crc >> 8 ) & 0xff ; sc -> psa [ WLPSA_CRCOK ] = 0x55 ; PCMD ( sc , HACR_DEFAULT & ~ HACR_16BITS ) ; PCMD ( sc , HACR_DEFAULT & ~ HACR_16BITS ) ; for ( i = 0 ; i < 0x40 ; i ++ ) { DELAY ( DELAYCONST ) ; WL_WRITE_2 ( sc , PIOR2 , i ) ; DELAY ( DELAYCONST ) ; WL_WRITE_1 ( sc , PIOP2 , sc -> psa [ i ] ) ; } DELAY ( DELAYCONST ) ; WL_WRITE_2 ( sc , PIOR2 , WLPSA_CRCOK ) ; DELAY ( DELAYCONST ) ; sc -> psa [ WLPSA_CRCOK ] = 0xaa ; WL_WRITE_1 ( sc , PIOP2 , 0xaa ) ; DELAY ( DELAYCONST ) ; PCMD ( sc , HACR_DEFAULT ) ; PCMD ( sc , HACR_DEFAULT ) ; }
wlsetpsa
Writes the psa for wavelan (unit) from the softc back to the
board.
wlsetpsa Writes the psa for wavelan ( unit ) from the softc back to the board .
/* calculate CRC of PSA */ /* default to 'bad' until programming complete */ /* write param memory */ /* update CRC flag*/ /* OK now */ /* all OK */