1/*- 2 * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp> 3 * All rights reserved. 4 * 5 * Copyright (c) 2008-2009 Ed Schouten <ed@FreeBSD.org> 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 14 unchanged lines hidden (view full) --- 23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/syscons/scterm-teken.c 188391 2009-02-09 15:55:21Z ed $"); |
32 33#include "opt_syscons.h" 34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/kernel.h> 38#include <sys/module.h> 39#include <sys/consio.h> --- 4 unchanged lines hidden (view full) --- 44#include <machine/pc/display.h> 45#endif 46 47#include <dev/syscons/syscons.h> 48 49#include <dev/syscons/teken/teken.h> 50 51static void scteken_revattr(unsigned char, teken_attr_t *); |
52static unsigned int scteken_attr(const teken_attr_t *); |
53 54static sc_term_init_t scteken_init; 55static sc_term_term_t scteken_term; 56static sc_term_puts_t scteken_puts; 57static sc_term_ioctl_t scteken_ioctl; 58static sc_term_default_attr_t scteken_default_attr; 59static sc_term_clear_t scteken_clear; 60static sc_term_input_t scteken_input; --- 100 unchanged lines hidden (view full) --- 161 teken_input(&ts->ts_teken, buf, len); 162 scp->sc->write_in_progress--; 163} 164 165static int 166scteken_ioctl(scr_stat *scp, struct tty *tp, u_long cmd, caddr_t data, 167 struct thread *td) 168{ |
169 teken_stat *ts = scp->ts; |
170 vid_info_t *vi; |
171 unsigned int attr; |
172 173 switch (cmd) { 174 case GIO_ATTR: /* get current attributes */ |
175 *(int*)data = 176 scteken_attr(teken_get_curattr(&ts->ts_teken)); |
177 return (0); 178 case CONS_GETINFO: /* get current (virtual) console info */ |
179 vi = (vid_info_t *)data; 180 if (vi->size != sizeof(struct vid_info)) 181 return EINVAL; |
182 183 attr = scteken_attr(teken_get_defattr(&ts->ts_teken)); 184 vi->mv_norm.fore = attr & 0x0f; 185 vi->mv_norm.back = (attr >> 4) & 0x0f; 186 vi->mv_rev.fore = vi->mv_norm.back; 187 vi->mv_rev.back = vi->mv_norm.fore; |
188 /* 189 * The other fields are filled by the upper routine. XXX 190 */ 191 return (ENOIOCTL); 192 } 193 194 return (ENOIOCTL); 195} --- 84 unchanged lines hidden (view full) --- 280 a->ta_bgcolor = bg; 281 a->ta_format |= TF_BOLD; 282 return; 283 } 284 } 285 } 286} 287 |
288static unsigned int |
289scteken_attr(const teken_attr_t *a) 290{ 291 unsigned int attr = 0; 292 293 if (a->ta_format & TF_BOLD) 294 attr |= fgcolors_bold[a->ta_fgcolor]; 295 else 296 attr |= fgcolors_normal[a->ta_fgcolor]; 297 attr |= bgcolors[a->ta_bgcolor]; 298 299#ifdef FG_UNDERLINE 300 if (a->ta_format & TF_UNDERLINE) 301 attr |= FG_UNDERLINE; 302#endif /* FG_UNDERLINE */ 303#ifdef FG_BLINK 304 if (a->ta_format & TF_BLINK) 305 attr |= FG_BLINK; 306#endif /* FG_BLINK */ 307 |
308 return (attr); |
309} 310 311static void 312scteken_bell(void *arg) 313{ 314 scr_stat *scp = arg; 315 316 sc_bell(scp, scp->bell_pitch, scp->bell_duration); --- 20 unchanged lines hidden (view full) --- 337#ifdef TEKEN_UTF8 338 if (c >= 0x80) { 339 /* XXX: Don't display UTF-8 yet. */ 340 attr = (FG_YELLOW|BG_RED) << 8; 341 ch = '?'; 342 } else 343#endif /* TEKEN_UTF8 */ 344 { |
345 attr = scteken_attr(a) << 8; |
346 ch = c; 347 } 348 349 map = scp->sc->scr_map; 350 351 cursor = tp->tp_row * scp->xsize + tp->tp_col; 352 p = sc_vtb_pointer(&scp->vtb, cursor); 353 sc_vtb_putchar(&scp->vtb, p, map[ch], attr); --- 19 unchanged lines hidden (view full) --- 373#ifdef TEKEN_UTF8 374 if (c >= 0x80) { 375 /* XXX: Don't display UTF-8 yet. */ 376 attr = (FG_YELLOW|BG_RED) << 8; 377 ch = '?'; 378 } else 379#endif /* TEKEN_UTF8 */ 380 { |
381 attr = scteken_attr(a) << 8; |
382 ch = c; 383 } 384 385 map = scp->sc->scr_map; 386 387 if (r->tr_begin.tp_col == 0 && r->tr_end.tp_col == scp->xsize) { 388 /* Single contiguous region to fill. */ 389 sc_vtb_erase(&scp->vtb, r->tr_begin.tp_row * scp->xsize, --- 120 unchanged lines hidden --- |