⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 atarikbd.txt

📁 linux 内核源代码
💻 TXT
📖 第 1 页 / 共 2 页
字号:
Intelligent Keyboard (ikbd) Protocol1. IntroductionThe Atari Corp. Intelligent Keyboard (ikbd) is a general purpose keyboardcontroller that is flexible enough that it can be used in a variety ofproducts without modification. The keyboard, with its microcontroller,provides a convenient connection point for a mouse and switch-type joysticks.The ikbd processor also maintains a time-of-day clock with one secondresolution.The ikbd has been designed to be general enough that it can be used with avariety of new computer products. Product variations in a number ofkeyswitches, mouse resolution, etc. can be accommodated.The ikbd communicates with the main processor over a high speed bi-directionalserial interface. It can function in a variety of modes to facilitatedifferent applications of the keyboard,  joysticks, or mouse. Limited use ofthe controller is possible in applications in which only a unidirectionalcommunications medium is available by carefully designing the default modes.3. KeyboardThe keyboard always returns key make/break scan codes. The ikbd generateskeyboard scan codes for each key press and release. The key scan make (keyclosure) codes start at 1, and are defined in Appendix A. For example, theISO key position in the scan code table should exist even if no keyswitchexists in that position on a particular keyboard. The break code for each keyis obtained by ORing 0x80 with the make code.The special codes 0xF6 through 0xFF are reserved for use as follows:    0xF6            status report    0xF7            absolute mouse position record    0xF8-0xFB       relative mouse position records (lsbs determined by                     mouse button states)    0xFC            time-of-day    0xFD            joystick report (both sticks)    0xFE            joystick 0 event    0xFF            joystick 1 eventThe two shift keys return different scan codes in this mode. The ENTER keyand the RETurn key are also distinct.4. MouseThe mouse port should be capable of supporting a mouse with resolution ofapproximately 200 counts (phase changes or 'clicks') per inch of travel. Themouse should be scanned at a rate that will permit accurate tracking atvelocities up to 10 inches per second.The ikbd can report mouse motion in three distinctly different ways. It canreport relative motion, absolute motion in a coordinate system maintainedwithin the ikbd, or by converting mouse motion into keyboard cursor controlkey equivalents.The mouse buttons can be treated as part of the mouse or as additionalkeyboard keys.4.1 Relative Position ReportingIn relative position mode, the ikbd will return relative mouse positionrecords whenever a mouse event occurs. A mouse event consists of a mousebutton being pressed or released, or motion in either axis exceeding asettable threshold of motion. Regardless of the threshold, all bits ofresolution are returned to the host computer.Note that the ikbd may return mouse relative position reports withsignificantly more than the threshold delta x or y. This may happen since norelative mouse motion events will be generated: (a) while the keyboard hasbeen 'paused' ( the event will be stored until keyboard communications isresumed) (b) while any event is being transmitted.The relative mouse position record is a three byte record of the form(regardless of keyboard mode):    %111110xy           ; mouse position record flag                        ; where y is the right button state                        ; and x is the left button state    X                   ; delta x as twos complement integer    Y                   ; delta y as twos complement integerNote that the value of the button state bits should be valid even if theMOUSE BUTTON ACTION has set the buttons to act like part of the keyboard.If the accumulated motion before the report packet is generated exceeds the+127...-128 range, the motion is broken into multiple packets.Note that the sign of the delta y reported is a function of the Y originselected.4.2 Absolute Position reportingThe ikbd can also maintain absolute mouse position. Commands exist forresetting the mouse position, setting X/Y scaling, and interrogating thecurrent mouse position.4.3 Mouse Cursor Key ModeThe ikbd can translate mouse motion into the equivalent cursor keystrokes.The number of mouse clicks per keystroke is independently programmable ineach axis. The ikbd internally maintains mouse motion information to thehighest resolution available, and merely generates a pair of cursor key eventsfor each multiple of the scale factor.Mouse motion produces the cursor key make code immediately followed by thebreak code for the appropriate cursor key. The mouse buttons produce scancodes above those normally assigned for the largest envisioned keyboard (i.e.LEFT=0x74 & RIGHT=0x75).5. Joystick5.1 Joystick Event ReportingIn this mode, the ikbd generates a record whenever the joystick position ischanged (i.e. for each opening or closing of a joystick switch or trigger).The joystick event record is two bytes of the form:    %1111111x           ; Joystick event marker                        ; where x is Joystick 0 or 1    %x000yyyy           ; where yyyy is the stick position                        ; and x is the trigger5.2 Joystick InterrogationThe current state of the joystick ports may be interrogated at any time inthis mode by sending an 'Interrogate Joystick' command to the ikbd.The ikbd response to joystick interrogation is a three byte report of the form    0xFD                ; joystick report header    %x000yyyy           ; Joystick 0    %x000yyyy           ; Joystick 1                        ; where x is the trigger                        ; and yyy is the stick position5.3 Joystick MonitoringA mode is available that devotes nearly all of the keyboard communicationstime to reporting the state of the joystick ports at a user specifiable rate.It remains in this mode until reset or commanded into another mode. The PAUSEcommand in this mode not only stop the output but also temporarily stopsscanning the joysticks (samples are not queued).5.4 Fire Button MonitoringA mode is provided to permit monitoring a single input bit at a high rate. Inthis mode the ikbd monitors the state of the Joystick 1 fire button at themaximum rate permitted by the serial communication channel. The data is packed8 bits per byte for transmission to the host. The ikbd remains in this modeuntil reset or commanded into another mode. The PAUSE command in this mode notonly stops the output but also temporarily stops scanning the button (samplesare not queued).5.5 Joystick Key Code ModeThe ikbd may be commanded to translate the use of either joystick into theequivalent cursor control keystroke(s). The ikbd provides a single breakpointvelocity joystick cursor.Joystick events produce the make code, immediately followed by the break codefor the appropriate cursor motion keys. The trigger or fire buttons of thejoysticks produce pseudo key scan codes above those used by the largest keymatrix envisioned (i.e. JOYSTICK0=0x74, JOYSTICK1=0x75).6. Time-of-Day ClockThe ikbd also maintains a time-of-day clock for the system. Commands areavailable to set and interrogate the timer-of-day clock. Time-keeping ismaintained down to a resolution of one second.7. Status InquiriesThe current state of ikbd modes and parameters may be found by sending statusinquiry commands that correspond to the ikbd set commands.8. Power-Up ModeThe keyboard controller will perform a simple self-test on power-up to detectmajor controller faults (ROM checksum and RAM test) and such things as stuckkeys. Any keys down at power-up are presumed to be stuck, and their BREAK(sic) code is returned (which without the preceding MAKE code is a flag for akeyboard error). If the controller self-test completes without error, the code0xF0 is returned. (This code will be used to indicate the version/release ofthe ikbd controller. The first release of the ikbd is version 0xF0, shouldthere be a second release it will be 0xF1, and so on.)The ikbd defaults to a mouse position reporting with threshold of 1 unit ineither axis and the Y=0 origin at the top of the screen, and joystick eventreporting mode for joystick 1, with both buttons being logically assigned tothe mouse. After any joystick command, the ikbd assumes that joysticks areconnected to both Joystick0 and Joystick1. Any mouse command (except MOUSEDISABLE) then causes port 0 to again be scanned as if it were a mouse, andboth buttons are logically connected to it. If a mouse disable command isreceived while port 0 is presumed to be a mouse, the button is logicallyassigned to Joystick1 (until the mouse is reenabled by another mouse command).9. ikbd Command SetThis section contains a list of commands that can be sent to the ikbd. Commandcodes (such as 0x00) which are not specified should perform no operation(NOPs).9.1 RESET    0x80    0x01N.B. The RESET command is the only two byte command understood by the ikbd.Any byte following an 0x80 command byte other than 0x01 is ignored (and causesthe 0x80 to be ignored).A reset may also be caused by sending a break lasting at least 200mS to theikbd.Executing the RESET command returns the keyboard to its default (power-up)mode and parameter settings. It does not affect the time-of-day clock.The RESET command or function causes the ikbd to perform a simple self-test.If the test is successful, the ikbd will send the code of 0xF0 within 300mSof receipt of the RESET command (or the end of the break, or power-up). Theikbd will then scan the key matrix for any stuck (closed) keys. Any keys foundclosed will cause the break scan code to be generated (the break code arrivingwithout being preceded by the make code is a flag for a key matrix error).9.2. SET MOUSE BUTTON ACTION    0x07    %00000mss           ; mouse button action                        ;       (m is presumed = 1 when in MOUSE KEYCODE mode)                        ; mss=0xy, mouse button press or release causes mouse                        ;  position report                        ;  where y=1, mouse key press causes absolute report                        ;  and x=1, mouse key release causes absolute report                        ; mss=100, mouse buttons act like keys This command sets how the ikbd should treat the buttons on the mouse. Thedefault mouse button action mode is %00000000, the buttons are treated as partof the mouse logically.When buttons act like keys, LEFT=0x74 & RIGHT=0x75.9.3 SET RELATIVE MOUSE POSITION REPORTING    0x08Set relative mouse position reporting. (DEFAULT) Mouse position packets aregenerated asynchronously by the ikbd whenever motion exceeds the setablethreshold in either axis (see SET MOUSE THRESHOLD). Depending upon the mousekey mode, mouse position reports may also be generated when either mousebutton is pressed or released. Otherwise the mouse buttons behave as if theywere keyboard keys.9.4 SET ABSOLUTE MOUSE POSITIONING    0x09    XMSB                ; X maximum (in scaled mouse clicks)    XLSB    YMSB                ; Y maximum (in scaled mouse clicks)    YLSB	Set absolute mouse position maintenance. Resets the ikbd maintained X and Ycoordinates.In this mode, the value of the internally maintained coordinates does NOT wrapbetween 0 and large positive numbers. Excess motion below 0 is ignored. Thecommand sets the maximum positive value that can be attained in the scaledcoordinate system. Motion beyond that value is also ignored.9.5 SET MOUSE KEYCODE MOSE    0x0A    deltax              ; distance in X clicks to return (LEFT) or (RIGHT)    deltay              ; distance in Y clicks to return (UP) or (DOWN)Set mouse monitoring routines to return cursor motion keycodes instead ofeither RELATIVE or ABSOLUTE motion records. The ikbd returns the appropriatecursor keycode after mouse travel exceeding the user specified deltas ineither axis. When the keyboard is in key scan code mode, mouse motion willcause the make code immediately followed by the break code. Note that thiscommand is not affected by the mouse motion origin.9..6 SET MOUSE THRESHOLD    0x0B    X                   ; x threshold in mouse ticks (positive integers)    Y                   ; y threshold in mouse ticks (positive integers)This command sets the threshold before a mouse event is generated. Note thatit does NOT affect the resolution of the data returned to the host. Thiscommand is valid only in RELATIVE MOUSE POSITIONING mode. The thresholdsdefault to 1 at RESET (or power-up).9.7 SET MOUSE SCALE    0x0C    X                   ; horizontal mouse ticks per internal X    Y                   ; vertical mouse ticks per internal YThis command sets the scale factor for the ABSOLUTE MOUSE POSITIONING mode.In this mode, the specified number of mouse phase changes ('clicks') mustoccur before the internally maintained coordinate is changed by one(independently scaled for each axis). Remember that the mouse positioninformation is available only by interrogating the ikbd in the ABSOLUTE MOUSEPOSITIONING mode unless the ikbd has been commanded to report on button pressor release (see SET MOSE BUTTON ACTION).9.8 INTERROGATE MOUSE POSITION    0x0D    Returns:            0xF7       ; absolute mouse position header    BUTTONS            0000dcba   ; where a is right button down since last interrogation                       ; b is right button up since last                       ; c is left button down since last                       ; d is left button up since last            XMSB       ; X coordinate            XLSB            YMSB       ; Y coordinate            YLSBThe INTERROGATE MOUSE POSITION command is valid when in the ABSOLUTE MOUSEPOSITIONING mode, regardless of the setting of the MOUSE BUTTON ACTION.9.9 LOAD MOUSE POSITION    0x0E    0x00                ; filler    XMSB                ; X coordinate    XLSB                ; (in scaled coordinate system)    YMSB                ; Y coordinate    YLSBThis command allows the user to preset the internally maintained absolutemouse position.9.10 SET Y=0 AT BOTTOM    0x0FThis command makes the origin of the Y axis to be at the bottom of thelogical coordinate system internal to the ikbd for all relative or absolutemouse motion. This causes mouse motion toward the user to be negative in signand away from the user to be positive.9.11 SET Y=0 AT TOP    0x10Makes the origin of the Y axis to be at the top of the logical coordinatesystem within the ikbd for all relative or absolute mouse motion. (DEFAULT)This causes mouse motion toward the user to be positive in sign and away fromthe user to be negative.9.12 RESUME    0x11Resume sending data to the host. Since any command received by the ikbd afterits output has been paused also causes an implicit RESUME this command can bethought of as a NO OPERATION command. If this command is received by the ikbdand it is not PAUSED, it is simply ignored.9.13 DISABLE MOUSE    0x12All mouse event reporting is disabled (and scanning may be internallydisabled). Any valid mouse mode command resumes mouse motion monitoring. (Thevalid mouse mode commands are SET RELATIVE MOUSE POSITION REPORTING, SETABSOLUTE MOUSE POSITIONING, and SET MOUSE KEYCODE MODE. )

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -