int newport_cnattach(struct gio_attach_args *ga) { struct rasops_info *ri = &newport_console_screen.scr_ri; long defattr = NEWPORT_ATTR_ENCODE(WSCOL_WHITE, WSCOL_BLACK); if (!newport_match(NULL, NULL, ga)) { return ENXIO; } newport_attach_common(&newport_console_dc, ga); newport_screen.ncols = newport_console_dc.dc_xres / 8; newport_screen.nrows = newport_console_dc.dc_yres / 16; ri->ri_hw = &newport_console_screen; ri->ri_depth = newport_console_dc.dc_depth; ri->ri_width = newport_console_dc.dc_xres; ri->ri_height = newport_console_dc.dc_yres; ri->ri_stride = newport_console_dc.dc_xres; /* XXX */ ri->ri_flg = RI_CENTER | RI_FULLCLEAR; ri->ri_ops.copyrows = newport_copyrows; ri->ri_ops.eraserows = newport_eraserows; ri->ri_ops.copycols = newport_copycols; ri->ri_ops.erasecols = newport_erasecols; ri->ri_ops.cursor = newport_cursor_dummy; ri->ri_ops.mapchar = newport_mapchar; ri->ri_ops.putchar = newport_putchar; ri->ri_ops.allocattr = newport_allocattr; ri->ri_font = newport_console_dc.dc_fontdata; newport_console_screen.scr_cookie = &newport_console_dc; wsdisplay_cnattach(&newport_screen, ri, 0, 0, defattr); newport_is_console = 1; return 0; }
static int newport_allocattr(void *c, int fg, int bg, int flags, long *attr) { if (flags & WSATTR_BLINK) return EINVAL; if ((flags & WSATTR_WSCOLORS) == 0) { fg = WSCOL_WHITE; bg = WSCOL_BLACK; } if (flags & WSATTR_HILIT) fg += 8; if (flags & WSATTR_REVERSE) { int tmp = fg; fg = bg; bg = tmp; } *attr = NEWPORT_ATTR_ENCODE(fg, bg); return 0; }
int newport_cnattach(struct gio_attach_args *ga) { long defattr = NEWPORT_ATTR_ENCODE(WSCOL_WHITE, WSCOL_BLACK); const struct wsscreen_descr *screen; if (!newport_match(NULL, NULL, ga)) { return ENXIO; } newport_attach_common(&newport_console_dc, ga); if (newport_console_dc.dc_xres >= 1280 && newport_console_dc.dc_yres >= 1024) screen = &newport_screen_1280x1024; else screen = &newport_screen_1024x768; wsdisplay_cnattach(screen, &newport_console_dc, 0, 0, defattr); newport_is_console = 1; return 0; }