Example #1
0
static int
bcm_bsc_rise_proc(SYSCTL_HANDLER_ARGS)
{
    struct bcm_bsc_softc *sc;
    uint32_t clk, reg;
    int error;

    sc = (struct bcm_bsc_softc *)arg1;

    BCM_BSC_LOCK(sc);
    reg = BCM_BSC_READ(sc, BCM_BSC_DELAY);
    BCM_BSC_UNLOCK(sc);
    reg &= 0xffff;
    error = sysctl_handle_int(oidp, &reg, sizeof(reg), req);
    if (error != 0 || req->newptr == NULL)
        return (error);

    BCM_BSC_LOCK(sc);
    clk = BCM_BSC_READ(sc, BCM_BSC_CLOCK);
    clk = BCM_BSC_CORE_CLK / clk;
    if (reg > clk / 2)
        reg = clk / 2 - 1;
    bcm_bsc_modifyreg(sc, BCM_BSC_DELAY, 0xffff, reg);
    BCM_BSC_UNLOCK(sc);

    return (0);
}
Example #2
0
static void
bcm_bsc_reset(struct bcm_bsc_softc *sc)
{

	/* Clear pending interrupts. */
	BCM_BSC_WRITE(sc, BCM_BSC_STATUS, BCM_BSC_STATUS_CLKT |
	    BCM_BSC_STATUS_ERR | BCM_BSC_STATUS_DONE);
	/* Clear the FIFO. */
	bcm_bsc_modifyreg(sc, BCM_BSC_CTRL, BCM_BSC_CTRL_CLEAR0,
	    BCM_BSC_CTRL_CLEAR0);
}