syscons.c (c6d1bed11282e7cbff810e2db0da6d5921873b3c) syscons.c (a3bd3dac2575b690c4fa408b5156b15d8593a916)
1/*-
2 * Copyright (c) 1992-1997 S�ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
1/*-
2 * Copyright (c) 1992-1997 S�ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * $Id: syscons.c,v 1.241 1997/12/06 13:23:26 bde Exp $
28 * $Id: syscons.c,v 1.242 1997/12/07 08:09:19 yokota Exp $
29 */
30
31#include "sc.h"
32#include "apm.h"
33#include "opt_ddb.h"
34#include "opt_syscons.h"
35
36#if NSC > 0

--- 85 unchanged lines hidden (view full) ---

122static char switch_in_progress = FALSE;
123static char write_in_progress = FALSE;
124static char blink_in_progress = FALSE;
125static int blinkrate = 0;
126 u_int crtc_addr = MONO_BASE;
127 char crtc_type = KD_MONO;
128 char crtc_vga = FALSE;
129static u_char shfts = 0, ctls = 0, alts = 0, agrs = 0, metas = 0;
29 */
30
31#include "sc.h"
32#include "apm.h"
33#include "opt_ddb.h"
34#include "opt_syscons.h"
35
36#if NSC > 0

--- 85 unchanged lines hidden (view full) ---

122static char switch_in_progress = FALSE;
123static char write_in_progress = FALSE;
124static char blink_in_progress = FALSE;
125static int blinkrate = 0;
126 u_int crtc_addr = MONO_BASE;
127 char crtc_type = KD_MONO;
128 char crtc_vga = FALSE;
129static u_char shfts = 0, ctls = 0, alts = 0, agrs = 0, metas = 0;
130static u_char accents = 0;
130static u_char nlkcnt = 0, clkcnt = 0, slkcnt = 0, alkcnt = 0;
131static const u_int n_fkey_tab = sizeof(fkey_tab) / sizeof(*fkey_tab);
132static int delayed_next_scr = FALSE;
133static long scrn_blank_time = 0; /* screen saver timeout value */
134 int scrn_blanked = 0; /* screen saver active flag */
135static long scrn_time_stamp;
136 u_char scr_map[256];
137 u_char scr_rmap[256];

--- 492 unchanged lines hidden (view full) ---

630 kbdc_lock(sc_kbdc, FALSE);
631 return FALSE;
632}
633
634#if NAPM > 0
635static int
636scresume(void *dummy)
637{
131static u_char nlkcnt = 0, clkcnt = 0, slkcnt = 0, alkcnt = 0;
132static const u_int n_fkey_tab = sizeof(fkey_tab) / sizeof(*fkey_tab);
133static int delayed_next_scr = FALSE;
134static long scrn_blank_time = 0; /* screen saver timeout value */
135 int scrn_blanked = 0; /* screen saver active flag */
136static long scrn_time_stamp;
137 u_char scr_map[256];
138 u_char scr_rmap[256];

--- 492 unchanged lines hidden (view full) ---

631 kbdc_lock(sc_kbdc, FALSE);
632 return FALSE;
633}
634
635#if NAPM > 0
636static int
637scresume(void *dummy)
638{
638 shfts = ctls = alts = agrs = metas = 0;
639 shfts = ctls = alts = agrs = metas = accents = 0;
639 return 0;
640}
641#endif
642
643static int
644scattach(struct isa_device *dev)
645{
646 scr_stat *scp;

--- 1115 unchanged lines hidden (view full) ---

1762
1763 case K_CODE: /* switch to CODE mode */
1764 scp->status &= ~KBD_RAW_MODE;
1765 scp->status |= KBD_CODE_MODE;
1766 return 0;
1767
1768 case K_XLATE: /* switch to XLT ascii mode */
1769 if (scp == cur_console && scp->status & KBD_RAW_MODE)
640 return 0;
641}
642#endif
643
644static int
645scattach(struct isa_device *dev)
646{
647 scr_stat *scp;

--- 1115 unchanged lines hidden (view full) ---

1763
1764 case K_CODE: /* switch to CODE mode */
1765 scp->status &= ~KBD_RAW_MODE;
1766 scp->status |= KBD_CODE_MODE;
1767 return 0;
1768
1769 case K_XLATE: /* switch to XLT ascii mode */
1770 if (scp == cur_console && scp->status & KBD_RAW_MODE)
1770 shfts = ctls = alts = agrs = metas = 0;
1771 shfts = ctls = alts = agrs = metas = accents = 0;
1771 scp->status &= ~(KBD_RAW_MODE | KBD_CODE_MODE);
1772 return 0;
1773 default:
1774 return EINVAL;
1775 }
1776 /* NOT REACHED */
1777
1778 case KDGKBMODE: /* get keyboard mode */

--- 83 unchanged lines hidden (view full) ---

1862 scr_rmap[scr_map[i]] = i;
1863 return 0;
1864
1865 case GIO_KEYMAP: /* get keyboard translation table */
1866 bcopy(&key_map, data, sizeof(key_map));
1867 return 0;
1868
1869 case PIO_KEYMAP: /* set keyboard translation table */
1772 scp->status &= ~(KBD_RAW_MODE | KBD_CODE_MODE);
1773 return 0;
1774 default:
1775 return EINVAL;
1776 }
1777 /* NOT REACHED */
1778
1779 case KDGKBMODE: /* get keyboard mode */

--- 83 unchanged lines hidden (view full) ---

1863 scr_rmap[scr_map[i]] = i;
1864 return 0;
1865
1866 case GIO_KEYMAP: /* get keyboard translation table */
1867 bcopy(&key_map, data, sizeof(key_map));
1868 return 0;
1869
1870 case PIO_KEYMAP: /* set keyboard translation table */
1871 accents = 0;
1872 bzero(&accent_map, sizeof(accent_map));
1870 bcopy(data, &key_map, sizeof(key_map));
1871 return 0;
1872
1873 bcopy(data, &key_map, sizeof(key_map));
1874 return 0;
1875
1876 case GIO_DEADKEYMAP: /* get accent key translation table */
1877 bcopy(&accent_map, data, sizeof(accent_map));
1878 return 0;
1879
1880 case PIO_DEADKEYMAP: /* set accent key translation table */
1881 accents = 0;
1882 bcopy(data, &accent_map, sizeof(accent_map));
1883 return 0;
1884
1873 case PIO_FONT8x8: /* set 8x8 dot font */
1874 if (!crtc_vga)
1875 return ENXIO;
1876 bcopy(data, font_8, 8*256);
1877 fonts_loaded |= FONT_8;
1878 if (!(cur_console->status & UNKNOWN_MODE)) {
1879 copy_font(LOAD, FONT_8, font_8);
1880 if (flags & CHAR_CURSOR)

--- 463 unchanged lines hidden (view full) ---

2344 }
2345 move_crsr(new_scp, new_scp->xpos, new_scp->ypos);
2346 if (!(new_scp->status & UNKNOWN_MODE) && (flags & CHAR_CURSOR))
2347 set_destructive_cursor(new_scp);
2348 if ((old_scp->status & UNKNOWN_MODE) && crtc_vga)
2349 load_palette(palette);
2350 if (old_scp->status & KBD_RAW_MODE || new_scp->status & KBD_RAW_MODE ||
2351 old_scp->status & KBD_CODE_MODE || new_scp->status & KBD_CODE_MODE)
1885 case PIO_FONT8x8: /* set 8x8 dot font */
1886 if (!crtc_vga)
1887 return ENXIO;
1888 bcopy(data, font_8, 8*256);
1889 fonts_loaded |= FONT_8;
1890 if (!(cur_console->status & UNKNOWN_MODE)) {
1891 copy_font(LOAD, FONT_8, font_8);
1892 if (flags & CHAR_CURSOR)

--- 463 unchanged lines hidden (view full) ---

2356 }
2357 move_crsr(new_scp, new_scp->xpos, new_scp->ypos);
2358 if (!(new_scp->status & UNKNOWN_MODE) && (flags & CHAR_CURSOR))
2359 set_destructive_cursor(new_scp);
2360 if ((old_scp->status & UNKNOWN_MODE) && crtc_vga)
2361 load_palette(palette);
2362 if (old_scp->status & KBD_RAW_MODE || new_scp->status & KBD_RAW_MODE ||
2363 old_scp->status & KBD_CODE_MODE || new_scp->status & KBD_CODE_MODE)
2352 shfts = ctls = alts = agrs = metas = 0;
2364 shfts = ctls = alts = agrs = metas = accents = 0;
2353 set_border(new_scp->border);
2354 update_leds(new_scp->status);
2355 delayed_next_scr = FALSE;
2356 mark_all(new_scp);
2357}
2358
2359static void
2360scan_esc(scr_stat *scp, u_char c)

--- 1329 unchanged lines hidden (view full) ---

3690 }
3691 break;
3692
3693 /* NON-LOCKING KEYS */
3694 case NOP:
3695 break;
3696 case SPSC:
3697#ifdef SC_SPLASH_SCREEN
2365 set_border(new_scp->border);
2366 update_leds(new_scp->status);
2367 delayed_next_scr = FALSE;
2368 mark_all(new_scp);
2369}
2370
2371static void
2372scan_esc(scr_stat *scp, u_char c)

--- 1329 unchanged lines hidden (view full) ---

3702 }
3703 break;
3704
3705 /* NON-LOCKING KEYS */
3706 case NOP:
3707 break;
3708 case SPSC:
3709#ifdef SC_SPLASH_SCREEN
3710 accents = 0;
3698 toggle_splash_screen(cur_console);
3699#endif
3700 break;
3701 case RBT:
3711 toggle_splash_screen(cur_console);
3712#endif
3713 break;
3714 case RBT:
3715 accents = 0;
3702 shutdown_nice();
3703 break;
3704 case SUSP:
3705#if NAPM > 0
3716 shutdown_nice();
3717 break;
3718 case SUSP:
3719#if NAPM > 0
3720 accents = 0;
3706 apm_suspend();
3707#endif
3708 break;
3709
3710 case DBG:
3711#ifdef DDB /* try to switch to console 0 */
3721 apm_suspend();
3722#endif
3723 break;
3724
3725 case DBG:
3726#ifdef DDB /* try to switch to console 0 */
3727 accents = 0;
3712 if (cur_console->smode.mode == VT_AUTO &&
3713 console[0]->smode.mode == VT_AUTO)
3714 switch_scr(cur_console, 0);
3715 Debugger("manual escape to debugger");
3716#else
3717 printf("No debugger in kernel\n");
3718#endif
3719 break;

--- 29 unchanged lines hidden (view full) ---

3749 if (tp->t_state & TS_ISOPEN) {
3750 switch_scr(cur_console, next);
3751 break;
3752 }
3753 }
3754 }
3755 break;
3756 case BTAB:
3728 if (cur_console->smode.mode == VT_AUTO &&
3729 console[0]->smode.mode == VT_AUTO)
3730 switch_scr(cur_console, 0);
3731 Debugger("manual escape to debugger");
3732#else
3733 printf("No debugger in kernel\n");
3734#endif
3735 break;

--- 29 unchanged lines hidden (view full) ---

3765 if (tp->t_state & TS_ISOPEN) {
3766 switch_scr(cur_console, next);
3767 break;
3768 }
3769 }
3770 }
3771 break;
3772 case BTAB:
3773 accents = 0;
3757 return(BKEY);
3758 default:
3774 return(BKEY);
3775 default:
3776 if (action >= F_ACC && action <= L_ACC) {
3777 accents = action - F_ACC + 1;
3778 if (accent_map.acc[accents - 1].accchar == 0) {
3779 accents = 0;
3780 do_bell(cur_console, BELL_PITCH, BELL_DURATION);
3781 }
3782 break;
3783 }
3784 if (accents > 0) {
3785 accents = 0;
3786 do_bell(cur_console, BELL_PITCH, BELL_DURATION);
3787 }
3759 if (action >= F_SCR && action <= L_SCR) {
3760 switch_scr(cur_console, action - F_SCR);
3761 break;
3762 }
3763 if (action >= F_FN && action <= L_FN)
3764 action |= FKEY;
3765 return(action);
3766 }
3767 }
3768 else {
3788 if (action >= F_SCR && action <= L_SCR) {
3789 switch_scr(cur_console, action - F_SCR);
3790 break;
3791 }
3792 if (action >= F_FN && action <= L_FN)
3793 action |= FKEY;
3794 return(action);
3795 }
3796 }
3797 else {
3798 if (accents) {
3799 struct acc_t *acc;
3800 int i;
3801
3802 acc = &accent_map.acc[accents - 1];
3803 accents = 0;
3804 if (action == ' ') {
3805 action = acc->accchar;
3806 if (metas)
3807 action |= MKEY;
3808 return (action);
3809 }
3810 for (i = 0; i < NUM_ACCENTCHARS; ++i) {
3811 if (acc->map[i][0] == 0)
3812 break;
3813 if (acc->map[i][0] == action) {
3814 action = acc->map[i][1];
3815 if (metas)
3816 action |= MKEY;
3817 return (action);
3818 }
3819 }
3820 do_bell(cur_console, BELL_PITCH, BELL_DURATION);
3821 goto next_code;
3822 }
3769 if (metas)
3770 action |= MKEY;
3771 return(action);
3772 }
3773 }
3774 goto next_code;
3775}
3776

--- 1010 unchanged lines hidden ---
3823 if (metas)
3824 action |= MKEY;
3825 return(action);
3826 }
3827 }
3828 goto next_code;
3829}
3830

--- 1010 unchanged lines hidden ---