Lines Matching full:vc
3 * QEMU VC
419 static void vc_put_lf(VCChardev *vc) in vc_put_lf() argument
421 QemuTextConsole *s = vc->console; in vc_put_lf()
468 static void vc_handle_escape(VCChardev *vc) in vc_handle_escape() argument
472 for (i = 0; i < vc->nb_esc_params; i++) { in vc_handle_escape()
473 switch (vc->esc_params[i]) { in vc_handle_escape()
475 vc->t_attrib = TEXT_ATTRIBUTES_DEFAULT; in vc_handle_escape()
478 vc->t_attrib.bold = 1; in vc_handle_escape()
481 vc->t_attrib.uline = 1; in vc_handle_escape()
484 vc->t_attrib.blink = 1; in vc_handle_escape()
487 vc->t_attrib.invers = 1; in vc_handle_escape()
490 vc->t_attrib.unvisible = 1; in vc_handle_escape()
493 vc->t_attrib.bold = 0; in vc_handle_escape()
496 vc->t_attrib.uline = 0; in vc_handle_escape()
499 vc->t_attrib.blink = 0; in vc_handle_escape()
502 vc->t_attrib.invers = 0; in vc_handle_escape()
505 vc->t_attrib.unvisible = 0; in vc_handle_escape()
509 vc->t_attrib.fgcol = QEMU_COLOR_BLACK; in vc_handle_escape()
512 vc->t_attrib.fgcol = QEMU_COLOR_RED; in vc_handle_escape()
515 vc->t_attrib.fgcol = QEMU_COLOR_GREEN; in vc_handle_escape()
518 vc->t_attrib.fgcol = QEMU_COLOR_YELLOW; in vc_handle_escape()
521 vc->t_attrib.fgcol = QEMU_COLOR_BLUE; in vc_handle_escape()
524 vc->t_attrib.fgcol = QEMU_COLOR_MAGENTA; in vc_handle_escape()
527 vc->t_attrib.fgcol = QEMU_COLOR_CYAN; in vc_handle_escape()
530 vc->t_attrib.fgcol = QEMU_COLOR_WHITE; in vc_handle_escape()
534 vc->t_attrib.bgcol = QEMU_COLOR_BLACK; in vc_handle_escape()
537 vc->t_attrib.bgcol = QEMU_COLOR_RED; in vc_handle_escape()
540 vc->t_attrib.bgcol = QEMU_COLOR_GREEN; in vc_handle_escape()
543 vc->t_attrib.bgcol = QEMU_COLOR_YELLOW; in vc_handle_escape()
546 vc->t_attrib.bgcol = QEMU_COLOR_BLUE; in vc_handle_escape()
549 vc->t_attrib.bgcol = QEMU_COLOR_MAGENTA; in vc_handle_escape()
552 vc->t_attrib.bgcol = QEMU_COLOR_CYAN; in vc_handle_escape()
555 vc->t_attrib.bgcol = QEMU_COLOR_WHITE; in vc_handle_escape()
561 static void vc_update_xy(VCChardev *vc, int x, int y) in vc_update_xy() argument
563 QemuTextConsole *s = vc->console; in vc_update_xy()
588 static void vc_clear_xy(VCChardev *vc, int x, int y) in vc_clear_xy() argument
590 QemuTextConsole *s = vc->console; in vc_clear_xy()
598 vc_update_xy(vc, x, y); in vc_clear_xy()
601 static void vc_put_one(VCChardev *vc, int ch) in vc_put_one() argument
603 QemuTextConsole *s = vc->console; in vc_put_one()
609 vc_put_lf(vc); in vc_put_one()
614 c->t_attrib = vc->t_attrib; in vc_put_one()
615 vc_update_xy(vc, s->x, s->y); in vc_put_one()
619 static void vc_respond_str(VCChardev *vc, const char *buf) in vc_respond_str() argument
621 QemuTextConsole *s = vc->console; in vc_respond_str()
627 static void vc_set_cursor(VCChardev *vc, int x, int y) in vc_set_cursor() argument
629 QemuTextConsole *s = vc->console; in vc_set_cursor()
654 static void vc_csi_P(struct VCChardev *vc, unsigned int nr) in vc_csi_P() argument
656 QemuTextConsole *s = vc->console; in vc_csi_P()
680 vc_update_xy(vc, x1, s->y); in vc_csi_P()
685 vc_clear_xy(vc, x1, s->y); in vc_csi_P()
695 static void vc_csi_at(struct VCChardev *vc, unsigned int nr) in vc_csi_at() argument
697 QemuTextConsole *s = vc->console; in vc_csi_at()
721 vc_update_xy(vc, x1, s->y); in vc_csi_at()
726 vc_clear_xy(vc, x1, s->y); in vc_csi_at()
733 static void vc_save_cursor(VCChardev *vc) in vc_save_cursor() argument
735 QemuTextConsole *s = vc->console; in vc_save_cursor()
737 vc->x_saved = s->x; in vc_save_cursor()
738 vc->y_saved = s->y; in vc_save_cursor()
739 vc->t_attrib_saved = vc->t_attrib; in vc_save_cursor()
746 static void vc_restore_cursor(VCChardev *vc) in vc_restore_cursor() argument
748 QemuTextConsole *s = vc->console; in vc_restore_cursor()
750 s->x = vc->x_saved; in vc_restore_cursor()
751 s->y = vc->y_saved; in vc_restore_cursor()
752 vc->t_attrib = vc->t_attrib_saved; in vc_restore_cursor()
755 static void vc_putchar(VCChardev *vc, int ch) in vc_putchar() argument
757 QemuTextConsole *s = vc->console; in vc_putchar()
762 switch(vc->state) { in vc_putchar()
769 vc_put_lf(vc); in vc_putchar()
778 vc_put_lf(vc); in vc_putchar()
793 vc->state = TTY_STATE_ESC; in vc_putchar()
796 vc_put_one(vc, ch); in vc_putchar()
803 vc->esc_params[i] = 0; in vc_putchar()
804 vc->nb_esc_params = 0; in vc_putchar()
805 vc->state = TTY_STATE_CSI; in vc_putchar()
807 vc->state = TTY_STATE_G0; in vc_putchar()
809 vc->state = TTY_STATE_G1; in vc_putchar()
811 vc_save_cursor(vc); in vc_putchar()
812 vc->state = TTY_STATE_NORM; in vc_putchar()
814 vc_restore_cursor(vc); in vc_putchar()
815 vc->state = TTY_STATE_NORM; in vc_putchar()
817 vc->state = TTY_STATE_NORM; in vc_putchar()
822 if (vc->nb_esc_params < MAX_ESC_PARAMS) { in vc_putchar()
823 int *param = &vc->esc_params[vc->nb_esc_params]; in vc_putchar()
830 if (vc->nb_esc_params < MAX_ESC_PARAMS) in vc_putchar()
831 vc->nb_esc_params++; in vc_putchar()
835 trace_console_putchar_csi(vc->esc_params[0], vc->esc_params[1], in vc_putchar()
836 ch, vc->nb_esc_params); in vc_putchar()
837 vc->state = TTY_STATE_NORM; in vc_putchar()
841 if (vc->esc_params[0] == 0) { in vc_putchar()
842 vc->esc_params[0] = 1; in vc_putchar()
844 vc_set_cursor(vc, s->x, s->y - vc->esc_params[0]); in vc_putchar()
848 if (vc->esc_params[0] == 0) { in vc_putchar()
849 vc->esc_params[0] = 1; in vc_putchar()
851 vc_set_cursor(vc, s->x, s->y + vc->esc_params[0]); in vc_putchar()
855 if (vc->esc_params[0] == 0) { in vc_putchar()
856 vc->esc_params[0] = 1; in vc_putchar()
858 vc_set_cursor(vc, s->x + vc->esc_params[0], s->y); in vc_putchar()
862 if (vc->esc_params[0] == 0) { in vc_putchar()
863 vc->esc_params[0] = 1; in vc_putchar()
865 vc_set_cursor(vc, s->x - vc->esc_params[0], s->y); in vc_putchar()
869 vc_set_cursor(vc, vc->esc_params[0] - 1, s->y); in vc_putchar()
874 vc_set_cursor(vc, vc->esc_params[1] - 1, vc->esc_params[0] - 1); in vc_putchar()
877 switch (vc->esc_params[0]) { in vc_putchar()
885 vc_clear_xy(vc, x, y); in vc_putchar()
896 vc_clear_xy(vc, x, y); in vc_putchar()
904 vc_clear_xy(vc, x, y); in vc_putchar()
911 switch (vc->esc_params[0]) { in vc_putchar()
915 vc_clear_xy(vc, x, s->y); in vc_putchar()
921 vc_clear_xy(vc, x, s->y); in vc_putchar()
927 vc_clear_xy(vc, x, s->y); in vc_putchar()
933 vc_csi_P(vc, vc->esc_params[0]); in vc_putchar()
936 vc_handle_escape(vc); in vc_putchar()
939 switch (vc->esc_params[0]) { in vc_putchar()
942 vc_respond_str(vc, "\033[0n"); in vc_putchar()
948 vc_respond_str(vc, response); in vc_putchar()
953 vc_save_cursor(vc); in vc_putchar()
956 vc_restore_cursor(vc); in vc_putchar()
959 vc_csi_at(vc, vc->esc_params[0]); in vc_putchar()
975 vc->state = TTY_STATE_NORM; in vc_putchar()
980 #define TYPE_CHARDEV_VC "chardev-vc"
1101 ChardevVC *vc = backend->u.vc.data; in vc_chr_open() local
1107 if (vc->has_width) { in vc_chr_open()
1108 width = vc->width; in vc_chr_open()
1109 } else if (vc->has_cols) { in vc_chr_open()
1110 width = vc->cols * FONT_WIDTH; in vc_chr_open()
1113 if (vc->has_height) { in vc_chr_open()
1114 height = vc->height; in vc_chr_open()
1115 } else if (vc->has_rows) { in vc_chr_open()
1116 height = vc->rows * FONT_HEIGHT; in vc_chr_open()
1153 ChardevVC *vc; in vc_chr_parse() local
1156 vc = backend->u.vc.data = g_new0(ChardevVC, 1); in vc_chr_parse()
1157 qemu_chr_parse_common(opts, qapi_ChardevVC_base(vc)); in vc_chr_parse()
1161 vc->has_width = true; in vc_chr_parse()
1162 vc->width = val; in vc_chr_parse()
1167 vc->has_height = true; in vc_chr_parse()
1168 vc->height = val; in vc_chr_parse()
1173 vc->has_cols = true; in vc_chr_parse()
1174 vc->cols = val; in vc_chr_parse()
1179 vc->has_rows = true; in vc_chr_parse()
1180 vc->rows = val; in vc_chr_parse()
1204 /* set the default vc driver */ in qemu_console_early_init()