ITE EC C Code Language
ITE EC C Code Language
C Code Language
What’s the EC ?
Embedded Controller comes form ACPI str
ucture
Host is communicated EC by LPC interfac
e. The I/O port are 60/64 and 62/66
EC integrated ps2 device, keyboard matrix
, battery charger, fan control, power seque
nce, hot key function, backlight, CPU ther
mal sensor, system power consumption,et
c.
System Structure
NB
LPC
SB EC
PS/2 KB/MS
MATRIX
FAN Control
Charger
Flash ROM
Power
Sequence….
Keyboard Controller Overview
Host System
LPC/Firmware Hub
HIF
18 Scan Out (Column)
PS/2
Scan Matrix Scan
Keyboard
ITE KBC 3 PS/2 Devices
8 Scan In (Row)
I2C
SMBus
3 SMBus Devices
EC Feature
PS/2 KB/MS
ITE EC MATRIX
ACPI
Power management
SMBus
UART / CIR
ADC/DAC
PWM
Share BIOS
KBS Monitor
EC Position
South
Bridge
LPC BUS
Power Management
64K
KBC ROM Zone KBC ROM Zone Max :16M-64K Byte
0
Host Interfaces
Primary Host Interface (0x60, 0x64)
HIF1 – 8042 Command Interface
Secondary Host Interface (0x62, 0x66)
HIF2 – Logical HIF – ACPI Command Interface
Third Host Interface (0x68,0x6C)
Is system
NO KBD Command
command?
YES
Is D4
YES Mouse Command
command?
NO
KBC Command
Keyboard Controller Status Register 64h
Bit Description
7 Parity Error
6 Timeout Error
5 Auxiliary Output Buffer Full
4 Inhibit Switch
3 Command/Data
2 System Flag
1 Input Buffer Full ( IBF )
0 Output Buffer Full (OBF)
Features – Standard KBC Commands
Standard 64 command list
Write / Read Keyboard Controller Command Byte
(60h / 20h)
The KCCB resides in 8042 RAM location 20h, Address 20h define
d in the IBM 8042 programming specification.
IBM standard command set, use command 20h to read the KCC
B and command 60h to write KCCB.
Default:
» 0x65 – PS/2 Mouse Not Present
» 0x47 – PS/2 Mouse Present
Controller Command Byte:
Bit[7] - Reserved
Bit[6] - Keyboard Translate
Bit[5] - Disable Auxiliary Device
Bit[4] - Disable Keyboard
Bit[3] - Reserved
Bit[2] - System Flag
Bit[1] - Enable Auxiliary Interrupt
Bit[0] - Enable Keyboard Interrupt
Features – Standard KBC Commands
Output Buffer Write Commands:
Write Keyboard Output Buffer (D2h)
Write Auxiliary Device Output Buffer (D3h)
Command Set
0x80-Read EC space
0x81-Write EC space
0x82-Burst Enable
0x83-Burst Disable
0x84-Query SCI event
Features – PS/2 Devices
Three PS/2 Ports
One internal ps2 mouse & two external ps2 device(one keyboard +one
mouse)
Port 1 & Port 2 – Keyboard & Pointing Devices
Port 3 – Touchpad Devices (Internal)
Hot-plug
if Ext.aux device is also attached, send command to it but do not pass
Ext. response to the system.
Features – Scan Matrix
All Standard Notebook PC Keys
Easy Customization
Download OEM Scan Table in RAM
Update Scan Table in ROM
Features – OEM Customization
OEM-Definable Hotkeys
-Hotkey, Quick button
Main Flowchart
KBC Structure
KBC Function Application
Firmware
Firmware –– ROM
ROM Image
Image
KBC.ROM---64K
0x0000
Crisis
Recovery
0x1000
Main
Core
Scan
Tables
OEM
Function
Flash function
0xFFFF
EC Flowchart
Top-Level Flow Diagram
Power Up
Initialization
Idle
Interrupt
Runtime Service
Firmware
Firmware--Initialization
Initialization
Power Up Power Up
No Initialization
Crisis?
Idle
Yes
Normal
Crisis Initialization
Initialization
Idle
Crisis
Recovery
Firmware
Firmware--Idle
Idle
Disable
Initialization
Interrupts
Idle
No
Standby
Yes
Standby
Setup
Enable Idle
Interrupts (SLEEP)
Firmware
Firmware––Runtime
RuntimeService
Service
Interrupt Idle
Runtime
Do Service Service
Yes
More Service
No
Idle
Upper Loop
KBC-centric:1 byte output buffer, Wait and
Check Host to read kbd/mouse.
Poll all interrupts example ps/2(KBC/EC H
ost commands, External pin, Smbus, etc)
Keyboard matrix scan
5ms Timer-periodic
Lower Loop
Wait for interrupt (sleep, Idle, wait……)
Ps2 devices active.
5ms Timer-periodic switch to Upper Loop
Each Interrupt switch to Upper Loop
Interrupts Sources
Internal:
1.Timer interrupt (for 5ms timer..)
External:
1.IRQ pin(WUxx)
2.SMBus interrupt(for receive data)
3.Peripheral interrupt(for PS2 device data in)
4.Data buffer interrupt (for IBF,IBF1 and IBF2)
5.Keyboard interrupt(for internal keypressed)
ITE8512 Memory Introduction
External External
There
are different commands for these
memory area.
Code Structure
Build Environment
Tools
Keil C51 Tools
Assembler - a51.exe (v7.5)
Compiler – c51.exe (v7.20)
Linker - Bl51.exe (v5.12)
Code Structure – Directories
Main Folder
..BBLOCK\ ….Boot-Block core folder.
..BIOS_ROM\ ….Platform System BIOS
ROM Folder
..CORE\ ….Kernel Core Folder
..OEM\ ….OEM Platform Feature
Implement
..TOOLS\ ….Complier Utility & Tools
Code Structure – Directories
*.abs
OHX51
.exe
call
*.hex
*.bin
output Hex2bin
output Combecb.exe call bios both *.bin .exe
bios
Q&A
Q&A
Thank you!