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

📄 smckxl.asm

📁 SMSC KBC1100键盘控制器原代码
💻 ASM
📖 第 1 页 / 共 5 页
字号:
;***************************************************************************
;    SMCKXL.ASM -  SMC KBC1100 Keyboard & Auxiliary
;                  Device Controller along with ScanCode Controller.
;***************************************************************************
;    Revision Information  $Revision:   1.05    $
;                          $Date:       16-DEC-2004 18:15:58   $
;***************************************************************************

$ALLPUBLIC
       %INCLUDE "SMCKXL.INC"   ; standard or platform specific option file
       %INCLUDE "SMCKXD.INC"   ; constants, addresses and macro definitions

;-------------------- BEGIN TABLE OF CONTENTS -------------------------------
;
; Section  0.0
;
;    CodeBegin:           - Begin of Code Space
;    NWayJump:            - N-Way Jump
;    SMCINT0:             - Interrupt 0 / IBF=1
;    SMCINT1:             - Interrupt 1 / OBF=0
;    SIOINT:              - Serial I/O 1 Tx/Rx  Interrupt
;    Timer0INT:           - Timer 0 Interrupt
;    Timer1INT:           - Timer 1 Interrupt
;    Timer2INT:           - Timer 2 Interrupt
;    MtxTbl               - Matrix Table
; Section  1.0
;
;    ColdBoot:            - Power-on Initialize and Autosensing code
;    InitSysCLK           - Initialize system clock
;    ClearRAM             - Clear All RAM
;    ClrIntrFlg           - clear interrupt pending flag
;    InitHost             - Init KBC and EC Host Interfaces and IRQs
;    InitGPIO             - Init GPIO
;    InitPS2              - Init PS/2
;    InitADC              - Init ADC & DAC
;    InitTimers           - Initialize system timer
;    InitSMBus            - Init SMBus Host (master only, disabled)
;    InitVariables        - Setup Variables and configure the 80C51SL
;    InitShareMem         - Init Share memory interface
;    InitSIOCnfg          - Init SIO logical devices
;    OutpBuf:             - Wait for the Output Buffer to be read
;    Main:                - Interface active, waiting for the interrupt
;    InitConfig:          - Initialize configuration
;    InitVariables:       - Initialize Variables
;    InitDirRAM:          - Initialize Direct Memory Variables
;    InitExtRAM:          - Initialize Extend Memory Variables
;
; Section  2.0
;
;    Delay_XmtTime:       - Delay for 1.2ms by polling timer0 overflow
;    Delay_RspTime:       - Delay for 2.4ms by polling timer0 overflow
;    Delay_RstTime:       - Delay for 12.0ms by polling timer0 overflow
;    IniKBCTimr:          - Initialize T0 to Host interface timeout
;    IniSMBTimr           - Initialize T0 to SMBus interface timeout
;
; Section  3.0
;
;    AbortRcvXmt:         - Err occured. Interfaces=Inact. Goto OutpBuf
;    Delay_Inact:         - Delay for Kbd/Aux interfaces inactive
;
; Section  4.0
;
;    Send_n_Wait:         - Send to system, wait until OBF=0
;    Send2System:         - Send to the system from 8051
;    Wait2SendKbd:        - Wait until OBF=0 => send to system
;    SendFromKbd:         - Send data to system as from Keyboard
;    SystemData:          - Get system data in R1 (& A)
;    SendFromAux:         - Send data to system as from AUX
;    ChkKbdResp:          - chk & update expected Kbd resp variables
;    SaveExtBtn:          - A = updated buttons mask, R1 = new state
;    UpdateStatus:        - chk Keylock and Security
;
; Section  5.0
;
;    SystemCmd:           - Dispatch the 8051 and Keyboard commands
;    Cmd00_1F:            - Read 8051 RAM (20h-3Fh)
;    Cmd20_3F:            - read 8051 RAM (20h-3Fh)
;    Cmd40_5F:            - Write 8051 RAM (20h-3Fh)
;    Cmd60_7F:            - Write 8051 RAM (20h-3Fh)
;    Command8X:           - 80h-8Fh Process 9Xh Commands
;    Cmd80_RdKbcSMB:      - Read Kbc SMB RAM
;    Cmd81_WrKbcSMB:      - Write Kbc SMB RAM
;    KCSMBCmd:            - Execute EC SMBus Command
;    Command9X:           - 90h-9Fh Process 9Xh Commands
;
; Section  6.0
;
;    CommandAX:           - A0h-AFh Process AXh Cmds
;    CmdA4_TPswd:         - Test Password
;    CmdA5_LPswd:         - Load Password
;    CmdA6_EPswd:         - Enable Password
;    CmdA7_DAux:          - Disable Aux Device
;    CmdA8_EAux:          - Enable Aux Device
;    CmdA9_TAux:          - Test Aux Device
;    CmdAA_T8051:         - 8051 Self Test (8051 Reset)
;    ResetKCCB:           - set defaults for KCCB and KCSTATE
;    CmdAB_TKbd:          - Test Keyboard
;    CmdAC_Dump:          - Diagnostic Dump is not implemented.
;    CmdAD_DKbd:          - Disable Keyboard
;    CmdAE_EKbd:          - Enable Keyboard
;
; Section  7.0
;
;    CommandBX:           - B0h-BFh Process BXh Cmds
;    CmdB0_RdExtI:        - Read Extended Version Information
;    CmdB1_IdxROM:        - Phoenix Extended command, Write RAM Index
;    CmdB2_noCmd:         - B2 is not a supported command
;    CmdB3_noCmd:         - B3 is not a supported command
;    CmdB4_Flash:         - Flash Support Command
;    CmdB5_UsTask:        - Exexute User Task
;    CmdB6_noCmd:         - B6 is not a supported command
;    CmdB7_noCmd:         - B7 is not a supported command
;    CmdB8_WrIDX:         - Phoenix Extended command, Write RAM Index
;    CmdB9_RdIDX:         - Phoenix Extended command, Read RAM Index
;    AccessRAM:           - Read/Write RAM
;    CmdBA_RdRAM:         - Phoenix Extended Cmd, Read RAM with Index
;    CmdBB_WrRAM:         - Phoenix Extended Cmd, Write RAM with Index
;    CmdBC_RdRAM:         - Phoenix Extended Cmd, Read virtual RAM
;    CmdBD_WrRAM:         - Phoenix Extended Cmd, Write virtual RAM
;    CmdBE_noCmd:         - BE is not a supported command
;    CmdBF_WrBit:         - Phoenix Extended Cmd, Write Bit in RAM
;    GRWSetBank:          - set bank number for general read write RAM
;    Chk_WrKCCB:          - Checks if the KCCB is being updated
;    XlatAddrs:           - Translate 8042 RAM locations to 8051
;
; Section  8.0
;
;    CommandCX:           - Dispatch the CXh commands
;    CmdC0_ReadP1:        - Read Port 1 command (emulated)
;    CmdC1_LowP1:         - Keep polling low nibble of Port 1
;    CmdC2_HighP1:        - Keep polling high nibble of Port 1
;    CmdC4_RdAD0_3:       - Read Port 0-3 Cmd. (Read 256 RAM (8051))
;    CmdC3_P0_3:          - Read Port 0 thur Port 3
;    WigglePin:           - Wiggle GPIO or OUT physical Pin
;    SCI8X:               - SCI 8X Task
;    SCI9X:               - SCI 9X Task
;    CmdC5_Pins:          - Phoenix Extended Cmd, Wiggle Port Pins
;    CmdC5a:              - Command C5h with A=Data Byte
;    ReadPort:            - Read Port Bit (C5)
;    SetPort:             - Set Port Bit (C5)
;    ClearPort:           - Clear Port Bit (C5)
;    ChkPulsePort:        - Pulse Port Bit (C5)
;    TogglePort:          - Toggle Port Bit (C5)
;    GetMask:             - Input R1: 0-7, Output R1: Bit Mask Byte
;    GetBitSet:           - Input R1: 0-7, Output R1: Bit Set Byte
;    CmdC6_LdMTX:         - Phoenix Extended Cmd, load key MATRIX
;    CmdC7_SetP1:         - Phoenix Extended Cmd, Set bits of Port 1
;    CmdC8_SoftSCI:       - Phoenix Extended Cmd, Software SCI
;    CmdC9_RESMID:        - Phoenix Extended Cmd, Get Resume ID
;    CmdCA_ClrP2:         - Just take data from system and do nothing
;    CmdCB_PwrDn:         - Phoenix Extended Cmd, Power Down command
;    PwrUpRst:            - Reset stuff from power down mode
;    CmdCC_FlashLED:      - Phoenix Extended command, Flash LEDs
;    CmdCD_Function:      - Get Interrupt Function Request
;    CmdCE_EventDly:      - Set Event Timer Delay (0=disabled)
;    CmdCF_KeyRes:        - Phoenix Extended Cmd, Enable Any Key Resume
;
; Section  9.0
;
;    CommandDX:           - Dispatch the DXh commands
;    CmdD0_RdP2:          - Read Port2 (emulate)
;    CmdD1_WrtP2:         - Write Port2 (emulate)
;    CmdD2_KOut:          - Send data back to system as from KBD
;    CmdD3_AOut:          - Send data back to system as from AUX
;    CmdD4_2Aux:          - send next data byte from system to aux
;    CmdD5_RdVer:         - Read Phoenix Revision Number (2 Bytes)
;    CmdD6_RdInfo:        - Read Version Information Bytes
;    CmdD7_Model:         - Read Phoenix Model Number (3 Bytes)
;    CmdD8_SetA20:        - set GA20
;    CmdD9_ClrA20:        - clear GA20
;    CmdDA_RdBat:         - Read from Smart Battery
;    CmdDB_RdSMB:         - Read from SMB Slave
;    CmdDC_WrSMB:         - Write to SMB Slave
;    CmdDD_SBSPoll:       - Battery polling command
;    CmdDE_RdMsg:         - Battery Alarm control
;    CmdDF_Test:          - Testing usage
;
; Section 10.0
;
;    CommandEX:           - Phoenix Extended Cmd, Set/Clr lower bits P2
;    CmdE1_RdFnStick      - Read Fn Sticky Key flags.
;    CmdE2_CfgFnStick     - Configure Fn Sticky Key support.
;    CmdE4_WrSts          - Write to KBC status register.
;    CmdE8_WrSEL          - Write KBC RAM Bank Selector.
;    CmdE9_RdSEL          - Read  KBC RAM Bank Selector.
;    CmdEF_UpdLEDs        - Update LEDs mask and state.
;    CommandFX:           - Pulse system reset line
;
; Section 11.0
;    DispatchINT1         - Interrupt 1 dispatch table
;
; Section 12.0
;
;    KeyStroke:           - Key Matrix depression detection interrupt
;    IBFInt:              - Input Buffer full interrupt
;    IntExit:             - Delay and IntrReturn
;    IntrReturn:          - Set KCSTATE.6 then RETI
;    ExtKbdInt:           - External Keyboard Interrupt
;    ExtAuxInt:           - External Aux device Interrupt
;    IntAuxInt:           - Internal Aux device Interrupt
;    IBF1Int:             - 2nd Input Buffer full interrupt.
;    ECSystCmd:           - process cmd/data from system to EC
;    ECDispCmd:           - EC Dispatch Commands
;    ECNoCmd:             - ACPI None EC Command
;    ECReadCmd:           - ACPI EC Read Command
;    ECWriteCmd:          - ACPI EC Write Command
;    ECBurstEnableCmd:    - ACPI EC Burst Enable Command
;    ECBurstDisableCmd:   - ACPI EC Burst Disable Command
;    ECQueryCmd:          - ACPI EC Query Command
;    ECSend2System:       - Send A to system via EC interface
;    ECChkBurst:          - Check if in burst mode
;    ECGenSCI:            - EC Generate SCI
;    IniECTimr:           - Initialize EC Timer
;    ECCtrlCmd:           - Execute EC ControlMethod Command
;    ECSMBCmd:            - Execute EC SMBus Command
;
; Section 13.0
;
;    Timer5msIntr:        - Chk Make/Break/Typematic Repeats per 5.0ms
;    PollMatrix:          - Poll the Internal Keyboard Matrix
;    SetChkFlags:         - Set all 'Checked' flags in MAKEBUF
;    SetupKSO:            - Set KSO one line low by A=000h..00Fh
;    ScanKeyboard:        - Scan internal keyboard, store in MAKEBUF
;    ChkMakes:            - Check MAKEBUF for Makes and debounce them
;    ChkTypematic:        - Clear DELAY0 if NOT a Typematic Key
;    ChkBreaks:           - Check MAKEBUF for Breaks and debounce them
;    ChkGhost:            - Check for ghost key
;    ChkRepeat:           - Chk Typematic Repeat & put them in KEYBUF
;    ChkIdle:             - Check to see if there is still Kbd activity
;    HKeyTimer:           - Decide if it's time to be PowerDown Mode
;    MatrixIndex:         - Pack Scanned Row and return Column together
;    StoreMAKEBUF:        - Stores flags and Matrix Index into MAKEBUF
;

⌨️ 快捷键说明

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