File: [local] / sys / dev / ic / pcdisplay_subr.c (download)
Revision 1.1.1.1 (vendor branch), Tue Mar 4 16:10:53 2008 UTC (16 years, 6 months ago) by nbrk
Branch: OPENBSD_4_2_BASE, MAIN
CVS Tags: jornada-partial-support-wip, HEAD Changes since 1.1: +0 -0 lines
Import of OpenBSD 4.2 release kernel tree with initial code to support
Jornada 720/728, StrongARM 1110-based handheld PC.
At this point kernel roots on NFS and boots into vfs_mountroot() and traps.
What is supported:
- glass console, Jornada framebuffer (jfb) works in 16bpp direct color mode
(needs some palette tweaks for non black/white/blue colors, i think)
- saic, SA11x0 interrupt controller (needs cleanup)
- sacom, SA11x0 UART (supported only as boot console for now)
- SA11x0 GPIO controller fully supported (but can't handle multiple interrupt
handlers on one gpio pin)
- sassp, SSP port on SA11x0 that attaches spibus
- Jornada microcontroller (jmcu) to control kbd, battery, etc throught
the SPI bus (wskbd attaches on jmcu, but not tested)
- tod functions seem work
- initial code for SA-1111 (chip companion) : this is TODO
Next important steps, i think:
- gpio and intc on sa1111
- pcmcia support for sa11x0 (and sa1111 help logic)
- REAL root on nfs when we have PCMCIA support (we may use any of supported pccard NICs)
- root on wd0! (using already supported PCMCIA-ATA)
|
/* $OpenBSD: pcdisplay_subr.c,v 1.7 2006/11/29 19:11:15 miod Exp $ */
/* $NetBSD: pcdisplay_subr.c,v 1.16 2000/06/08 07:01:19 cgd Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
* All rights reserved.
*
* Author: Chris G. Demetriou
*
* Permission to use, copy, modify and distribute this software and
* its documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/device.h>
#include <machine/bus.h>
#include <dev/ic/mc6845reg.h>
#include <dev/ic/pcdisplayvar.h>
#include <dev/wscons/wsconsio.h>
#include <dev/wscons/wsdisplayvar.h>
void
pcdisplay_cursor_reset(scr)
struct pcdisplayscreen *scr;
{
#ifdef PCDISPLAY_SOFTCURSOR
pcdisplay_6845_write(scr->hdl, curstart, 0x10);
pcdisplay_6845_write(scr->hdl, curend, 0x10);
#endif
}
void
pcdisplay_cursor_init(scr, existing)
struct pcdisplayscreen *scr;
int existing;
{
#ifdef PCDISPLAY_SOFTCURSOR
bus_space_tag_t memt;
bus_space_handle_t memh;
int off;
#endif
pcdisplay_cursor_reset(scr);
#ifdef PCDISPLAY_SOFTCURSOR
if (existing) {
/*
* This is the first screen. At this point, scr->active is
* false and scr->mem is NULL (no backing store), so we
* can't use pcdisplay_cursor() to do this.
*/
memt = scr->hdl->ph_memt;
memh = scr->hdl->ph_memh;
off = (scr->vc_crow * scr->type->ncols + scr->vc_ccol) * 2 +
scr->dispoffset;
scr->cursortmp = bus_space_read_2(memt, memh, off);
bus_space_write_2(memt, memh, off, scr->cursortmp ^ 0x7700);
} else
scr->cursortmp = 0;
#endif
scr->cursoron = 1;
}
void
pcdisplay_cursor(id, on, row, col)
void *id;
int on, row, col;
{
#ifdef PCDISPLAY_SOFTCURSOR
struct pcdisplayscreen *scr = id;
bus_space_tag_t memt = scr->hdl->ph_memt;
bus_space_handle_t memh = scr->hdl->ph_memh;
int off;
/* Remove old cursor image */
if (scr->cursoron) {
off = scr->vc_crow * scr->type->ncols + scr->vc_ccol;
if (scr->active)
bus_space_write_2(memt, memh, scr->dispoffset + off * 2,
scr->cursortmp);
else
scr->mem[off] = scr->cursortmp;
}
scr->vc_crow = row;
scr->vc_ccol = col;
if ((scr->cursoron = on) == 0)
return;
off = (scr->vc_crow * scr->type->ncols + scr->vc_ccol);
if (scr->active) {
off = off * 2 + scr->dispoffset;
scr->cursortmp = bus_space_read_2(memt, memh, off);
bus_space_write_2(memt, memh, off, scr->cursortmp ^ 0x7700);
} else {
scr->cursortmp = scr->mem[off];
scr->mem[off] = scr->cursortmp ^ 0x7700;
}
#else /* PCDISPLAY_SOFTCURSOR */
struct pcdisplayscreen *scr = id;
int pos;
scr->vc_crow = row;
scr->vc_ccol = col;
scr->cursoron = on;
if (scr->active) {
if (!on)
pos = 0x1010;
else
pos = scr->dispoffset / 2
+ row * scr->type->ncols + col;
pcdisplay_6845_write(scr->hdl, cursorh, pos >> 8);
pcdisplay_6845_write(scr->hdl, cursorl, pos);
}
#endif /* PCDISPLAY_SOFTCURSOR */
}
#if 0
unsigned int
pcdisplay_mapchar_simple(id, uni)
void *id;
int uni;
{
if (uni < 128)
return (uni);
return (1); /* XXX ??? smiley */
}
#endif
void
pcdisplay_putchar(id, row, col, c, attr)
void *id;
int row, col;
u_int c;
long attr;
{
struct pcdisplayscreen *scr = id;
bus_space_tag_t memt = scr->hdl->ph_memt;
bus_space_handle_t memh = scr->hdl->ph_memh;
int off;
off = row * scr->type->ncols + col;
if (scr->active)
bus_space_write_2(memt, memh, scr->dispoffset + off * 2,
c | (attr << 8));
else
scr->mem[off] = c | (attr << 8);
}
int
pcdisplay_getchar(id, row, col, cell)
void *id;
int row, col;
struct wsdisplay_charcell *cell;
{
struct pcdisplayscreen *scr = id;
bus_space_tag_t memt = scr->hdl->ph_memt;
bus_space_handle_t memh = scr->hdl->ph_memh;
int off;
u_int16_t data;
off = row * scr->type->ncols + col;
/* XXX bounds check? */
if (scr->active)
data = (bus_space_read_2(memt, memh,
scr->dispoffset + off * 2));
else
data = (scr->mem[off]);
cell->uc = data & 0xff;
cell->attr = data >> 8;
return (0);
}
void
pcdisplay_copycols(id, row, srccol, dstcol, ncols)
void *id;
int row, srccol, dstcol, ncols;
{
struct pcdisplayscreen *scr = id;
bus_space_tag_t memt = scr->hdl->ph_memt;
bus_space_handle_t memh = scr->hdl->ph_memh;
bus_size_t srcoff, dstoff;
srcoff = dstoff = row * scr->type->ncols;
srcoff += srccol;
dstoff += dstcol;
if (scr->active)
bus_space_copy_2(memt, memh,
scr->dispoffset + srcoff * 2,
memh, scr->dispoffset + dstoff * 2,
ncols);
else
bcopy(&scr->mem[srcoff], &scr->mem[dstoff], ncols * 2);
}
void
pcdisplay_erasecols(id, row, startcol, ncols, fillattr)
void *id;
int row, startcol, ncols;
long fillattr;
{
struct pcdisplayscreen *scr = id;
bus_space_tag_t memt = scr->hdl->ph_memt;
bus_space_handle_t memh = scr->hdl->ph_memh;
bus_size_t off;
u_int16_t val;
int i;
off = row * scr->type->ncols + startcol;
val = (fillattr << 8) | ' ';
if (scr->active)
bus_space_set_region_2(memt, memh, scr->dispoffset + off * 2,
val, ncols);
else
for (i = 0; i < ncols; i++)
scr->mem[off + i] = val;
}
void
pcdisplay_copyrows(id, srcrow, dstrow, nrows)
void *id;
int srcrow, dstrow, nrows;
{
struct pcdisplayscreen *scr = id;
bus_space_tag_t memt = scr->hdl->ph_memt;
bus_space_handle_t memh = scr->hdl->ph_memh;
int ncols = scr->type->ncols;
bus_size_t srcoff, dstoff;
srcoff = srcrow * ncols + 0;
dstoff = dstrow * ncols + 0;
if (scr->active)
bus_space_copy_2(memt, memh,
scr->dispoffset + srcoff * 2,
memh, scr->dispoffset + dstoff * 2,
nrows * ncols);
else
bcopy(&scr->mem[srcoff], &scr->mem[dstoff],
nrows * ncols * 2);
}
void
pcdisplay_eraserows(id, startrow, nrows, fillattr)
void *id;
int startrow, nrows;
long fillattr;
{
struct pcdisplayscreen *scr = id;
bus_space_tag_t memt = scr->hdl->ph_memt;
bus_space_handle_t memh = scr->hdl->ph_memh;
bus_size_t off, count, n;
u_int16_t val;
off = startrow * scr->type->ncols;
count = nrows * scr->type->ncols;
val = (fillattr << 8) | ' ';
if (scr->active)
bus_space_set_region_2(memt, memh, scr->dispoffset + off * 2,
val, count);
else
for (n = 0; n < count; n++)
scr->mem[off + n] = val;
}