/* * configure the machine */ void machinit(void) { /* set direction of SA1110 io pins and select alternate functions for some */ gpioregs = mapspecial(GPIOREGS, sizeof(GPIOregs)); gpioregs->direction = GPIO_LDD8_o|GPIO_LDD9_o|GPIO_LDD10_o|GPIO_LDD11_o |GPIO_LDD12_o|GPIO_LDD13_o|GPIO_LDD14_o|GPIO_LDD15_o |GPIO_CLK_SET0_o|GPIO_CLK_SET1_o |GPIO_L3_SDA_io|GPIO_L3_MODE_o|GPIO_L3_SCLK_o |GPIO_COM_RTS_o; gpioregs->rising = 0; gpioregs->falling = 0; gpioregs->altfunc |= GPIO_LDD8_o|GPIO_LDD9_o|GPIO_LDD10_o|GPIO_LDD11_o |GPIO_LDD12_o|GPIO_LDD13_o|GPIO_LDD14_o|GPIO_LDD15_o |GPIO_SSP_CLK_i; /* map in special H3650 io pins */ egpioreg = mapspecial(EGPIOREGS, sizeof(ulong)); /* map in peripheral pin controller (ssp will need it) */ ppcregs = mapspecial(PPCREGS, sizeof(PPCregs)); /* SA1110 power management */ powerregs = mapspecial(POWERREGS, sizeof(PowerRegs)); /* memory configuraton */ memconfregs = mapspecial(MEMCONFREGS, sizeof(MemConfRegs)); /* reset controller */ resetregs = mapspecial(RESETREGS, sizeof(ResetRegs)); }
void screeninit(void) { int i; /* map the lcd regs into the kernel's virtual space */ lcd = (struct sa1110regs*)mapspecial(LCDREGS, sizeof(struct sa1110regs));; framebuf = xspanalloc(sizeof *framebuf, 0x100, 0); vscreen = xalloc(sizeof(ushort)*Wid*Ht); lcdpower(1); lcdinit(); gscreen = &xgscreen; xgdata.ref = 1; i = 0; if (landscape) { gscreen->r = Rect(0, 0, Ht, Wid); gscreen->clipr = gscreen->r; gscreen->width = Ht/2; xgdata.bdata = (uchar *)framebuf->pixel; while (i < Wid*Ht*1/3) framebuf->pixel[i++] = 0xf800; /* red */ while (i < Wid*Ht*2/3) framebuf->pixel[i++] = 0xffff; /* white */ while (i < Wid*Ht*3/3) framebuf->pixel[i++] = 0x001f; /* blue */ } else { gscreen->r = Rect(0, 0, Wid, Ht); gscreen->clipr = gscreen->r; gscreen->width = Wid/2; xgdata.bdata = (uchar *)vscreen; while (i < Wid*Ht*1/3) vscreen[i++] = 0xf800; /* red */ while (i < Wid*Ht*2/3) vscreen[i++] = 0xffff; /* white */ while (i < Wid*Ht*3/3) vscreen[i++] = 0x001f; /* blue */ flushmemscreen(gscreen->r); } memimageinit(); memdefont = getmemdefont(); out.pos.x = MINX; out.pos.y = 0; out.bwid = memdefont->info[' '].width; blanktime = 3; /* minutes */ screenwin(); // screenputs = bitsyscreenputs; screenputs = nil; }