コード例 #1
0
static void
icap_ebus_attach(device_t parent, device_t self, void *aux)
{
	struct icap_softc *sc = device_private(self);
	struct ebus_attach_args *ia =aux;

	DEBUG_PRINT(("icap_attach %p\n", sc), DEBUG_PROBE);

	sc->sc_dev = self;
	sc->sc_dp = (struct _Icap*)ia->ia_vaddr;
	bufq_alloc(&sc->sc_buflist, "fcfs", 0);
	sc->sc_bp = NULL;
	sc->sc_data = NULL;
	sc->sc_count = 0;

#if DEBUG
    printf(" virt=%p", (void*)sc->sc_dp);
#endif
	printf(": %s\n", "Internal Configuration Access Port");

	ebus_intr_establish(parent, (void*)ia->ia_cookie, IPL_BIO,
	    icap_ebus_intr, sc);

	icap_reset(sc);
}
コード例 #2
0
void
dz_ebus_attach(device_t parent, device_t self, void *aux)
{
	struct ebus_attach_args *iba;
	struct dz_softc *sc;

	sc = device_private(self);
	iba = aux;

	sc->sc_dev = self;
	sc->sc_dr = (struct _Usart *)iba->ia_vaddr;
#if DEBUG
	printf(" virt=%p ", (void *)sc->sc_dr);
#endif

	printf(": neilsart 1 line");
	ebus_intr_establish(parent, (void *)iba->ia_cookie, IPL_TTY,
	    dz_ebus_intr, sc);

	sc->sc_rxint = sc->sc_brk = 0;
	sc->sc_consline = 0;

	/* Initialize our softc structure. Should be done in open? */

	sc->sc_dz.dz_sc = sc;
	sc->sc_dz.dz_line = 0;
	sc->sc_dz.dz_tty = tty_alloc();

	evcnt_attach_dynamic(&sc->sc_rintrcnt, EVCNT_TYPE_INTR, NULL,
	    device_xname(self), "rintr");
	evcnt_attach_dynamic(&sc->sc_tintrcnt, EVCNT_TYPE_INTR, NULL,
	    device_xname(self), "tintr");

	/* Initialize hw regs */
#if 0
	DZ_WRITE_WORD(dr_csr, DZ_CSR_MSE | DZ_CSR_RXIE | DZ_CSR_TXIE);
	DZ_WRITE_BYTE(dr_dtr, 0);
	DZ_WRITE_BYTE(dr_break, 0);
#endif

	/* Switch the console to virtual mode */
	dzcn = sc->sc_dr;
	/* And test it */
	printf("\n");
}
コード例 #3
0
ファイル: clock_ebus.c プロジェクト: ryo/netbsd-src
static void
eclock_ebus_attach(device_t parent, device_t self, void *aux)
{
    struct eclock_softc *sc = device_private(self);
    struct ebus_attach_args *ia = aux;

    sc->sc_dev = self;
    sc->sc_dp = (struct _Tc *)ia->ia_vaddr;

    /* NB: We are chopping our 64bit free-running down to 32bits */
    sc->sc_tc.tc_get_timecount = eclock_counter;
    sc->sc_tc.tc_poll_pps = 0;
    sc->sc_tc.tc_counter_mask = 0xffffffff;
    sc->sc_tc.tc_frequency = 10 * 1000 * 1000; /* 10 MHz */
    sc->sc_tc.tc_name = "eclock"; /* BUGBUG is it unique per instance?? */
    sc->sc_tc.tc_quality = 2000; /* uhu? */
    sc->sc_tc.tc_priv = sc;
    sc->sc_tc.tc_next = NULL;

#if DEBUG
    printf(" virt=%p ", (void *)sc->sc_dp);
#endif
    printf(": eMIPS clock\n");

    /* Turn interrupts off, just in case. */
    sc->sc_dp->Control &= ~(TCCT_INT_ENABLE|TCCT_INTERRUPT);

    ebus_intr_establish(parent, (void *)ia->ia_cookie, IPL_CLOCK,
                        eclock_ebus_intr, sc);

#ifdef EVCNT_COUNTERS
    evcnt_attach_dynamic(&clock_intr_evcnt, EVCNT_TYPE_INTR, NULL,
                         device_xname(self), "intr");
#endif

    clockdev = self;
    memset(&sc->sc_todr, 0, sizeof sc->sc_todr);
    sc->sc_todr.cookie = sc;
    sc->sc_todr.todr_gettime = eclock_gettime;
    sc->sc_todr.todr_settime = eclock_settime;
    todr_attach(&sc->sc_todr);

    tc_init(&sc->sc_tc);
}