The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/i386/isa/kbdio.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 1996 Kazutaka YOKOTA (yokota@zodiac.mech.utsunomiya-u.ac.jp)
    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
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  * 3. The name of the author may not be used to endorse or promote 
   14  *    products derived from this software without specific prior written 
   15  *    permission.
   16  *
   17  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   27  * SUCH DAMAGE.
   28  *
   29  * $FreeBSD: src/sys/i386/isa/kbdio.h,v 1.1.2.6 1999/09/05 08:13:08 peter Exp $
   30  */
   31 
   32 #ifndef _I386_ISA_KBDIO_H_
   33 #define _I386_ISA_KBDIO_H_
   34 
   35 /* constants */
   36 
   37 /* I/O ports */
   38 #ifdef PC98
   39 #define KBD_STATUS_PORT         2       /* status port, read */
   40 #define KBD_COMMAND_PORT        2       /* controller command port, write */
   41 #define KBD_DATA_PORT           0       /* data port, read/write 
   42                                          * also used as keyboard command
   43                                          * and mouse command port 
   44                                          */
   45 #else
   46 #define KBD_STATUS_PORT         4       /* status port, read */
   47 #define KBD_COMMAND_PORT        4       /* controller command port, write */
   48 #define KBD_DATA_PORT           0       /* data port, read/write 
   49                                          * also used as keyboard command
   50                                          * and mouse command port 
   51                                          */
   52 #endif  /* PC98 */
   53 
   54 /* FIXME: `IO_PSMSIZE' should really be in `isa.h'. */
   55 #define IO_PSMSIZE              (KBD_COMMAND_PORT - KBD_DATA_PORT + 1) /* 5 */
   56 
   57 /* controller commands (sent to KBD_COMMAND_PORT) */
   58 #define KBDC_SET_COMMAND_BYTE   0x0060
   59 #define KBDC_GET_COMMAND_BYTE   0x0020
   60 #define KBDC_WRITE_TO_AUX       0x00d4
   61 #define KBDC_DISABLE_AUX_PORT   0x00a7
   62 #define KBDC_ENABLE_AUX_PORT    0x00a8
   63 #define KBDC_TEST_AUX_PORT      0x00a9
   64 #define KBDC_DIAGNOSE           0x00aa
   65 #define KBDC_TEST_KBD_PORT      0x00ab
   66 #define KBDC_DISABLE_KBD_PORT   0x00ad
   67 #define KBDC_ENABLE_KBD_PORT    0x00ae
   68 
   69 /* controller command byte (set by KBDC_SET_COMMAND_BYTE) */
   70 #define KBD_TRANSLATION         0x0040
   71 #define KBD_RESERVED_BITS       0x0004
   72 #define KBD_OVERRIDE_KBD_LOCK   0x0008
   73 #define KBD_ENABLE_KBD_PORT     0x0000
   74 #define KBD_DISABLE_KBD_PORT    0x0010
   75 #define KBD_ENABLE_AUX_PORT     0x0000
   76 #define KBD_DISABLE_AUX_PORT    0x0020
   77 #define KBD_ENABLE_AUX_INT      0x0002
   78 #define KBD_DISABLE_AUX_INT     0x0000
   79 #define KBD_ENABLE_KBD_INT      0x0001
   80 #define KBD_DISABLE_KBD_INT     0x0000
   81 #define KBD_KBD_CONTROL_BITS    (KBD_DISABLE_KBD_PORT | KBD_ENABLE_KBD_INT)
   82 #define KBD_AUX_CONTROL_BITS    (KBD_DISABLE_AUX_PORT | KBD_ENABLE_AUX_INT)
   83 
   84 /* keyboard device commands (sent to KBD_DATA_PORT) */
   85 #define KBDC_RESET_KBD          0x00ff
   86 #define KBDC_ENABLE_KBD         0x00f4
   87 #define KBDC_DISABLE_KBD        0x00f5
   88 #define KBDC_SET_DEFAULTS       0x00f6
   89 #define KBDC_SEND_DEV_ID        0x00f2
   90 #define KBDC_SET_LEDS           0x00ed
   91 #define KBDC_ECHO               0x00ee
   92 #define KBDC_SET_SCANCODE_SET   0x00f0
   93 #define KBDC_SET_TYPEMATIC      0x00f3
   94 
   95 /* aux device commands (sent to KBD_DATA_PORT) */
   96 #define PSMC_RESET_DEV          0x00ff
   97 #define PSMC_ENABLE_DEV         0x00f4
   98 #define PSMC_DISABLE_DEV        0x00f5
   99 #define PSMC_SET_DEFAULTS       0x00f6
  100 #define PSMC_SEND_DEV_ID        0x00f2
  101 #define PSMC_SEND_DEV_STATUS    0x00e9
  102 #define PSMC_SEND_DEV_DATA      0x00eb
  103 #define PSMC_SET_SCALING11      0x00e6
  104 #define PSMC_SET_SCALING21      0x00e7
  105 #define PSMC_SET_RESOLUTION     0x00e8
  106 #define PSMC_SET_STREAM_MODE    0x00ea
  107 #define PSMC_SET_REMOTE_MODE    0x00f0
  108 #define PSMC_SET_SAMPLING_RATE  0x00f3
  109 
  110 /* PSMC_SET_RESOLUTION argument */
  111 #define PSMD_RES_LOW            0       /* typically 25ppi */
  112 #define PSMD_RES_MEDIUM_LOW     1       /* typically 50ppi */
  113 #define PSMD_RES_MEDIUM_HIGH    2       /* typically 100ppi (default) */
  114 #define PSMD_RES_HIGH           3       /* typically 200ppi */
  115 #define PSMD_MAX_RESOLUTION     PSMD_RES_HIGH
  116 
  117 /* PSMC_SET_SAMPLING_RATE */
  118 #define PSMD_MAX_RATE           255     /* FIXME: not sure if it's possible */
  119 
  120 /* status bits (KBD_STATUS_PORT) */
  121 #ifdef PC98
  122 #define KBDS_BUFFER_FULL        0x0002
  123 #define KBDS_ANY_BUFFER_FULL    0x0002
  124 #define KBDS_KBD_BUFFER_FULL    0x0002
  125 #define KBDS_AUX_BUFFER_FULL    0x0002
  126 #else
  127 #define KBDS_BUFFER_FULL        0x0021
  128 #define KBDS_ANY_BUFFER_FULL    0x0001
  129 #define KBDS_KBD_BUFFER_FULL    0x0001
  130 #define KBDS_AUX_BUFFER_FULL    0x0021
  131 #endif
  132 #define KBDS_INPUT_BUFFER_FULL  0x0002
  133 
  134 /* return code */
  135 #define KBD_ACK                 0x00fa
  136 #define KBD_RESEND              0x00fe
  137 #define KBD_RESET_DONE          0x00aa
  138 #define KBD_RESET_FAIL          0x00fc
  139 #define KBD_DIAG_DONE           0x0055
  140 #define KBD_DIAG_FAIL           0x00fd
  141 #define KBD_ECHO                0x00ee
  142 
  143 #define PSM_ACK                 0x00fa
  144 #define PSM_RESEND              0x00fe
  145 #define PSM_RESET_DONE          0x00aa
  146 #define PSM_RESET_FAIL          0x00fc
  147 
  148 /* aux device ID */
  149 #define PSM_MOUSE_ID            0
  150 #define PSM_BALLPOINT_ID        2
  151 #define PSM_INTELLI_ID          3
  152 
  153 #ifdef KERNEL
  154 
  155 #ifndef TRUE
  156 #define TRUE                    1
  157 #endif
  158 #ifndef FALSE
  159 #define FALSE                   0
  160 #endif
  161 
  162 /* types/structures */
  163 
  164 typedef caddr_t KBDC;
  165 
  166 /* function prototypes */
  167 
  168 KBDC kbdc_open __P((int port));
  169 
  170 int kbdc_lock __P((KBDC kbdc, int lock));
  171 
  172 int kbdc_data_ready __P((KBDC kbdc));
  173 
  174 int write_controller_command __P((KBDC kbdc,int c));
  175 int write_controller_data __P((KBDC kbdc,int c));
  176 
  177 int write_kbd_command __P((KBDC kbdc,int c));
  178 int write_aux_command __P((KBDC kbdc,int c));
  179 int send_kbd_command __P((KBDC kbdc,int c));
  180 int send_aux_command __P((KBDC kbdc,int c));
  181 int send_kbd_command_and_data __P((KBDC kbdc,int c,int d));
  182 int send_aux_command_and_data __P((KBDC kbdc,int c,int d));
  183 
  184 int read_controller_data __P((KBDC kbdc));
  185 int read_kbd_data __P((KBDC kbdc));
  186 int read_kbd_data_no_wait __P((KBDC kbdc));
  187 int read_aux_data __P((KBDC kbdc));
  188 int read_aux_data_no_wait __P((KBDC kbdc));
  189 
  190 void empty_kbd_buffer __P((KBDC kbdc, int t));
  191 void empty_aux_buffer __P((KBDC kbdc, int t));
  192 void empty_both_buffers __P((KBDC kbdc, int t));
  193 
  194 int reset_kbd __P((KBDC kbdc));
  195 int reset_aux_dev __P((KBDC kbdc));
  196 
  197 int test_controller __P((KBDC kbdc));
  198 int test_kbd_port __P((KBDC kbdc));
  199 int test_aux_port __P((KBDC kbdc));
  200 
  201 int kbdc_get_device_mask __P((KBDC kbdc));
  202 void kbdc_set_device_mask __P((KBDC kbdc, int mask));
  203 
  204 int get_controller_command_byte __P((KBDC kbdc));
  205 int set_controller_command_byte __P((KBDC kbdc, int command, int flag));
  206 
  207 #endif /* KERNEL */
  208 
  209 #endif /* !_I386_ISA_KBDIO_H_ */

Cache object: 78558cfb79932b1ba8526daba130d45b


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.