FreeBSD/sys/dev/wl/if_wl.c
/*
 * wlbldcu:
 *
 *	This function builds up the command unit structures.  It inits
 *	the scp, iscp, scb, cb, tbd, and tbuf.
 *
 */
This function builds up the command unit structures.  It inits
the scp, iscp, scb, cb, tbd, and tbuf.
This function builds up the command unit structures . It inits the scp iscp scb cb tbd and tbuf .
static void
wlbldcu(struct wl_softc *sc)
{
    scp_t		scp;
    iscp_t		iscp;
    scb_t		scb;
    ac_t		cb;
    tbd_t		tbd;
    int		i;
    bzero(&scp, sizeof(scp));
    scp.scp_sysbus = 0;
    scp.scp_iscp = OFFSET_ISCP;
    scp.scp_iscp_base = 0;
    WL_WRITE_2(sc, PIOR1, OFFSET_SCP);
    WL_WRITE_MULTI_2(sc, PIOP1, &scp, sizeof(scp_t)/2);
    bzero(&iscp, sizeof(iscp));
    iscp.iscp_busy = 1;
    iscp.iscp_scb_offset = OFFSET_SCB;
    iscp.iscp_scb = 0;
    iscp.iscp_scb_base = 0;
    WL_WRITE_2(sc, PIOR1, OFFSET_ISCP);
    WL_WRITE_MULTI_2(sc, PIOP1, &iscp, sizeof(iscp_t)/2);
    scb.scb_status = 0;
    scb.scb_command = SCB_RESET;
    scb.scb_cbl_offset = OFFSET_CU;
    scb.scb_rfa_offset = OFFSET_RU;
    scb.scb_crcerrs = 0;
    scb.scb_alnerrs = 0;
    scb.scb_rscerrs = 0;
    scb.scb_ovrnerrs = 0;
    WL_WRITE_2(sc, PIOR1, OFFSET_SCB);
    WL_WRITE_MULTI_2(sc, PIOP1, &scb, sizeof(scb_t)/2);
    SET_CHAN_ATTN(sc);
    WL_WRITE_2(sc, PIOR0, OFFSET_ISCP + 0);	
    for (i = 1000000; WL_READ_2(sc, PIOP0) && (i-- > 0); )
	continue;
    if (i <= 0)
	device_printf(sc->dev, "bldcu(): iscp_busy timeout.\n");
    WL_WRITE_2(sc, PIOR0, OFFSET_SCB + 0);	
    for (i = STATUS_TRIES; i-- > 0; ) {
	if (WL_READ_2(sc, PIOP0) == (SCB_SW_CX|SCB_SW_CNA)) 
	    break;
    }
    if (i <= 0)
	device_printf(sc->dev, "bldcu(): not ready after reset.\n");
    wlack(sc);
    cb.ac_status = 0;
    cb.ac_command = AC_CW_EL;		
    cb.ac_link_offset = OFFSET_CU;
    WL_WRITE_2(sc, PIOR1, OFFSET_CU);
    WL_WRITE_MULTI_2(sc, PIOP1, &cb, 6/2);
    tbd.act_count = 0;
    tbd.next_tbd_offset = I82586NULL;
    tbd.buffer_addr = 0;
    tbd.buffer_base = 0;
    WL_WRITE_2(sc, PIOR1, OFFSET_TBD);
    WL_WRITE_MULTI_2(sc, PIOP1, &tbd, sizeof(tbd_t)/2);
}
static void wlbldcu ( struct wl_softc * sc ) { scp_t scp ; iscp_t iscp ; scb_t scb ; ac_t cb ; tbd_t tbd ; int i ; bzero ( & scp , sizeof ( scp ) ) ; scp . scp_sysbus = 0 ; scp . scp_iscp = OFFSET_ISCP ; scp . scp_iscp_base = 0 ; WL_WRITE_2 ( sc , PIOR1 , OFFSET_SCP ) ; WL_WRITE_MULTI_2 ( sc , PIOP1 , & scp , sizeof ( scp_t ) / 2 ) ; bzero ( & iscp , sizeof ( iscp ) ) ; iscp . iscp_busy = 1 ; iscp . iscp_scb_offset = OFFSET_SCB ; iscp . iscp_scb = 0 ; iscp . iscp_scb_base = 0 ; WL_WRITE_2 ( sc , PIOR1 , OFFSET_ISCP ) ; WL_WRITE_MULTI_2 ( sc , PIOP1 , & iscp , sizeof ( iscp_t ) / 2 ) ; scb . scb_status = 0 ; scb . scb_command = SCB_RESET ; scb . scb_cbl_offset = OFFSET_CU ; scb . scb_rfa_offset = OFFSET_RU ; scb . scb_crcerrs = 0 ; scb . scb_alnerrs = 0 ; scb . scb_rscerrs = 0 ; scb . scb_ovrnerrs = 0 ; WL_WRITE_2 ( sc , PIOR1 , OFFSET_SCB ) ; WL_WRITE_MULTI_2 ( sc , PIOP1 , & scb , sizeof ( scb_t ) / 2 ) ; SET_CHAN_ATTN ( sc ) ; WL_WRITE_2 ( sc , PIOR0 , OFFSET_ISCP + 0 ) ; for ( i = 1000000 ; WL_READ_2 ( sc , PIOP0 ) && ( i -- > 0 ) ; ) continue ; if ( i <= 0 ) device_printf ( sc -> dev , " \n " ) ; WL_WRITE_2 ( sc , PIOR0 , OFFSET_SCB + 0 ) ; for ( i = STATUS_TRIES ; i -- > 0 ; ) { if ( WL_READ_2 ( sc , PIOP0 ) == ( SCB_SW_CX | SCB_SW_CNA ) ) break ; } if ( i <= 0 ) device_printf ( sc -> dev , " \n " ) ; wlack ( sc ) ; cb . ac_status = 0 ; cb . ac_command = AC_CW_EL ; cb . ac_link_offset = OFFSET_CU ; WL_WRITE_2 ( sc , PIOR1 , OFFSET_CU ) ; WL_WRITE_MULTI_2 ( sc , PIOP1 , & cb , 6 / 2 ) ; tbd . act_count = 0 ; tbd . next_tbd_offset = I82586NULL ; tbd . buffer_addr = 0 ; tbd . buffer_base = 0 ; WL_WRITE_2 ( sc , PIOR1 , OFFSET_TBD ) ; WL_WRITE_MULTI_2 ( sc , PIOP1 , & tbd , sizeof ( tbd_t ) / 2 ) ; }
wlbldcu:
      This function builds up the command unit structures.
wlbldcu : This function builds up the command unit structures .
/* address of iscp_busy */ /* address of scb_status */ /* NOP */