Exemplo n.º 1
0
int
cgfour_ioctl(void *v, u_long cmd, caddr_t data, int flags, struct proc *p)
{
	struct cgfour_softc *sc = v;
	struct wsdisplay_fbinfo *wdf;
	struct wsdisplay_cmap *cm;
	int error;

	switch (cmd) {
	case WSDISPLAYIO_GTYPE:
		*(u_int *)data = WSDISPLAY_TYPE_SUNCG4;
		break;
	case WSDISPLAYIO_GINFO:
		wdf = (struct wsdisplay_fbinfo *)data;
		wdf->height = sc->sc_sunfb.sf_height;
		wdf->width  = sc->sc_sunfb.sf_width;
		wdf->depth  = sc->sc_sunfb.sf_depth;
		wdf->cmsize = 256;
		break;
	case WSDISPLAYIO_LINEBYTES:
		*(u_int *)data = sc->sc_sunfb.sf_linebytes;
		break;

	case WSDISPLAYIO_GETCMAP:
		cm = (struct wsdisplay_cmap *)data;
		error = bt_getcmap(&sc->sc_cmap, cm);
		if (error)
			return (error);
		break;

	case WSDISPLAYIO_PUTCMAP:
		cm = (struct wsdisplay_cmap *)data;
		error = bt_putcmap(&sc->sc_cmap, cm);
		if (error)
			return (error);
		bt_loadcmap(&sc->sc_cmap, &sc->sc_fbc->fbc_dac,
		    cm->index, cm->count, 1);
		break;

	case WSDISPLAYIO_SVIDEO:
	case WSDISPLAYIO_GVIDEO:
		break;

	case WSDISPLAYIO_GCURPOS:
	case WSDISPLAYIO_SCURPOS:
	case WSDISPLAYIO_GCURMAX:
	case WSDISPLAYIO_GCURSOR:
	case WSDISPLAYIO_SCURSOR:
	default:
		return (-1);	/* not supported yet */
        }

	return (0);
}
Exemplo n.º 2
0
int
cgthree_intr(void *v)
{
	struct cgthree_softc *sc = v;

	if (!ISSET(sc->sc_fbc->fbc_ctrl, FBC_IENAB) ||
	    !ISSET(sc->sc_fbc->fbc_status, FBS_INTR)) {
		/* Not expecting an interrupt, it's not for us. */
		return (0);
	}

	/* Acknowledge the interrupt and disable it. */
	sc->sc_fbc->fbc_ctrl &= ~FBC_IENAB;

	bt_loadcmap(&sc->sc_cmap, &sc->sc_fbc->fbc_dac, 0, 256, 0);
	return (1);
}
Exemplo n.º 3
0
int
tcx_intr(void *v)
{
	struct tcx_softc *sc = v;
	u_int32_t thcm;

	thcm = sc->sc_thc->thc_hcmisc;
	if (thcm & THC_MISC_INTEN) {
		thcm &= ~(THC_MISC_INTR | THC_MISC_INTEN);

		/* Acknowledge the interrupt */
		sc->sc_thc->thc_hcmisc = thcm | THC_MISC_INTR;

		bt_loadcmap(&sc->sc_cmap, sc->sc_bt, 0, 256, 1);

		/* Disable further interrupts now */
		sc->sc_thc->thc_hcmisc = thcm;

		return (1);
	}

	return (0);
}
Exemplo n.º 4
0
void
cgeight_reset(struct cgeight_softc *sc, int mode)
{
	volatile struct bt_regs *bt;
	union bt_cmap cm;
	u_int c;

	bt = &sc->sc_fbc->fbc_dac;

	/*
	 * Depending on the mode requested, disable or enable
	 * the overlay plane.
	 */
	if (mode == WSDISPLAYIO_MODE_EMUL) {
		memset((void *)sc->sc_enable, 0xff,
		    round_page(sc->sc_sunfb.sf_fbsize));

		/* Setup a strict mono colormap */
		cm.cm_map[0][0] = cm.cm_map[0][1] = cm.cm_map[0][2] = 0x00;
		for (c = 1; c < 256; c++) {
			cm.cm_map[c][0] = cm.cm_map[c][1] = cm.cm_map[c][2] =
			    0xff;
		}
	} else {
		memset((void *)sc->sc_enable, 0x00,
		    round_page(sc->sc_sunfb.sf_fbsize));

		/* Setup a ramp colormap (direct color) */
		for (c = 0; c < 256; c++) {
			cm.cm_map[c][0] = cm.cm_map[c][1] = cm.cm_map[c][2] = c;
		}
	}

	/* Upload the colormap into the DAC */
	bt_loadcmap(&cm, bt, 0, 256, 0);
}