Пример #1
0
void
nextdma_attach(struct device *parent, struct device *self, void *aux)
{
	struct nextdma_softc *nsc = (struct nextdma_softc *)self;
	struct intio_attach_args *ia = (struct intio_attach_args *)aux;

	if (attached >= nnextdma_channels)
		return;

	nsc->sc_chan = &nextdma_channel[attached];

	nsc->sc_dmat = ia->ia_dmat;
	nsc->sc_bst = ia->ia_bst;

	if (bus_space_map(nsc->sc_bst, nsc->sc_chan->nd_base,
			  nsc->sc_chan->nd_size, 0, &nsc->sc_bsh)) {
		panic("%s: can't map DMA registers for channel %s",
		      nsc->sc_dev.dv_xname, nsc->sc_chan->nd_name);
	}

	nextdma_init (nsc);

	isrlink_autovec(nsc->sc_chan->nd_intrfunc, nsc,
			NEXT_I_IPL(nsc->sc_chan->nd_intr), 10, NULL);
	INTR_ENABLE(nsc->sc_chan->nd_intr);

	printf (": channel %d (%s)\n", attached, 
		nsc->sc_chan->nd_name);
	attached++;

	return;
}
void
nextdisplay_attach(device_t parent, device_t self, void *aux)
{
	struct nextdisplay_softc *sc = device_private(self);
	struct wsemuldisplaydev_attach_args waa;
	int isconsole;
	int iscolor;
	paddr_t addr;

	if (rom_machine_type == NeXT_WARP9C ||
	    rom_machine_type == NeXT_TURBO_COLOR) {
		iscolor = 1;
		addr = colorbase;
	} else {
		iscolor = 0;
		addr = monobase;
	}

	isconsole = nextdisplay_is_console(addr);
				
	if (isconsole) {
		sc->sc_dc = &nextdisplay_console_dc;
		sc->nscreens = 1;
	} else {
		sc->sc_dc = (struct nextdisplay_config *)
				malloc(sizeof(struct nextdisplay_config), M_DEVBUF, M_WAITOK);
		nextdisplay_init(sc->sc_dc, iscolor);
	}

	printf(": %d x %d, %dbpp\n", sc->sc_dc->dc_wid, sc->sc_dc->dc_ht,
	       sc->sc_dc->dc_depth);

	if (iscolor) {
#if 0
		uint8_t x;

		x = *(volatile uint8_t *)IIOV(NEXT_P_C16_CMD_REG);
		aprint_debug_dev(sc->sc_dev, "cmd=%02x\n", x);
#endif
		*(volatile uint8_t *)IIOV(NEXT_P_C16_CMD_REG) = 0x05;
		isrlink_autovec(nextdisplay_intr, sc, NEXT_I_IPL(NEXT_I_C16_VIDEO), 1, NULL);
		INTR_ENABLE(NEXT_I_C16_VIDEO);
	}

	/* initialize the raster */
	waa.console = isconsole;
	waa.scrdata = iscolor ? &nextdisplay_screenlist_color : &nextdisplay_screenlist_mono;
	waa.accessops = &nextdisplay_accessops;
	waa.accesscookie = sc;
#if 0
	printf("nextdisplay: access cookie is %p\n", sc);
#endif
	config_found(self, &waa, wsemuldisplaydevprint);
}
Пример #3
0
/*
 * Set up the real-time and statistics clocks.  Leave stathz 0 only
 * if no alternative timer is available.
 *
 * The frequencies of these clocks must be an even number of microseconds.
 */
void
cpu_initclocks(void)
{
	int s, cnt;
	volatile struct timer_reg *timer;

	rtc_init();
	hz = 100;
	s = splclock();
	timer = (volatile struct timer_reg *)IIOV(NEXT_P_TIMER);
	cnt = 1000000/hz;          /* usec timer */
	timer->csr = 0;
	timer->msb = (cnt >> 8);
	timer->lsb = cnt;
	timer->csr = TIMER_REG_ENABLE|TIMER_REG_UPDATE;
	isrlink_autovec(clock_intr, NULL, NEXT_I_IPL(NEXT_I_TIMER), 0, NULL);
	INTR_ENABLE(NEXT_I_TIMER);
	splx(s);
}
Пример #4
0
/*****************************************************************************
	DISCRIPTION	: コンソールコマンド処理
	ARGUMENT	: pConsReg	= コンソールバッファ
				  id		= 呼び出したスレッドのID
				  iIdx		= 使用するシリアルナンバ
				  iSize		= 送信文字数
				  pcCommand	= コマンド文字列
	RETURN		: 0
	NOTE		: -
	UPDATED		: 2014-06-22
*****************************************************************************/
static	int		consdrvCommand(
	CONS_DRV_REG*	pConsReg,
	KZ_ID_T			id,
	int				iIdx,
	int				iSize,
	char*			pcCommand
)
{
	switch(pcCommand[0]){
		case CONSDRV_CMD_USE: /* コンソールドライバの使用開始 */
			pConsReg->id		= id;
			pConsReg->iIdx		= pcCommand[1] - '0';
			pConsReg->pcSendBuf	= kzMalloc(CONS_BUF_SIZE);
			pConsReg->pcRecvBuf	= kzMalloc(CONS_BUF_SIZE);
			pConsReg->iSendLen	= 0;
			pConsReg->iRecvLen	= 0;
//			srlInit(pConsReg->iIdx);
			srlIntrSetRecvEnable(pConsReg->iIdx);
			break;
		
		case CONSDRV_CMD_WRITE: /* コンソールへの文字列出力 */
			/* T.B.D
				送信割込のハンドラでは送信処理は行わず、
				コンソールドライバスレッド(本処理)に送信完了の通知を
				メッセージで送信し、コンソールドライバスレッドで次の文字の
				送信をするようにすることで、割込禁止にする必要を
				なくすことが出来る。
				割込有効、無効の切り替えで排他するよりも、
				上記の処理のほうがスマートである。
			*/
			INTR_DISABLE();
			sendString(pConsReg, pcCommand + 1, iSize - 1);
			INTR_ENABLE();
			break;
		
		default:
			break;
	}

	return 0;
}