Пример #1
0
static int
ul_setvmode (struct grf_softc *gp, unsigned mode)
{
	int error;

	if (!mode || mode > ulowell_mon_max)
		return EINVAL;

	current_mon = ul_monitor_defs + mode - 1;

	error = ul_load_mon (gp, current_mon) ? 0 : EINVAL;

	return error;
}
Пример #2
0
static int
ul_setvmode (struct grf_softc *gp, unsigned mode)
{
	struct grf_ul_softc *gup;
	volatile struct gspregs *ba;
	int error;

	if (!mode || mode > ulowell_mon_max)
		return EINVAL;

	ba = (volatile struct gspregs *)gp->g_regkva;
	gup = (struct grf_ul_softc *)gp;
	current_mon = ul_monitor_defs + mode - 1;

	error = ul_load_mon (gp, current_mon) ? 0 : EINVAL;

	return error;
}
Пример #3
0
/*
 * attach to the grfbus (zbus)
 */
void
grfulattach(device_t parent, device_t self, void *aux)
{
	static struct grf_ul_softc congrf;
	struct device temp;
	struct zbus_args *zap;
	struct grf_softc *gp;
	struct grf_ul_softc *gup;

	zap = aux;

	if (self == NULL) {
		gup = &congrf;
		gp = &gup->gus_sc;
		gp->g_device = &temp;
		temp.dv_private = gp;
	} else {
		gup = device_private(self);
		gp = &gup->gus_sc;
		gp->g_device = self;
	}

	if (self != NULL && congrf.gus_sc.g_regkva != 0) {
		/*
		 * inited earlier, just copy (not device struct)
		 */
		memcpy(&gp->g_display, &congrf.gus_sc.g_display,
		    (char *)&gup->gus_isr - (char *)&gp->g_display);

		/* ...and transfer the isr */
		gup->gus_isr.isr_ipl = 2;
		gup->gus_isr.isr_intr = ulisr;
		gup->gus_isr.isr_arg = (void *)gp;
		/*
		 * To make sure ints are always catched, first add new isr
		 * then remove old:
		 */
		add_isr(&gup->gus_isr);
		remove_isr(&congrf.gus_isr);
	} else {
		gp->g_regkva = (void *)zap->va;
		gp->g_fbkva = NULL;
		gp->g_unit = GRF_ULOWELL_UNIT;
		gp->g_flags = GF_ALIVE;
		gp->g_mode = ul_mode;
#if NITE > 0
		gp->g_conpri = grful_cnprobe();
#endif
		gp->g_data = NULL;

		gup->gus_isr.isr_ipl = 2;
		gup->gus_isr.isr_intr = ulisr;
		gup->gus_isr.isr_arg = (void *)gp;
		add_isr(&gup->gus_isr);

		(void)ul_load_code(gp);
		(void)ul_load_mon(gp, current_mon);
#if NITE > 0
		grful_iteinit(gp);
#endif
	}
	if (self != NULL)
		printf("\n");
	/*
	 * attach grf
	 */
	amiga_config_found(cfdata, gp->g_device, gp, grfulprint);
}