最近遇到一個在POST過程中,隨意按鍵,有機率性的PS2 internal keyboard不能動的問題,所以為了解決這個問題,在BIOS logo出來時,去發一個keyboard reset給KBC controller。
以下的程式碼就是發keyboard reset給KBC controller
VOID
KeyBoardReset(
VOID
)
{
UINT8 Data;
//
// Clear Output Buffer data
//
Data = IoInput8(0x64);
while (Data & 0x01) {
Data = IoInput8(0x60);
Data = IoInput8(0x64);
}
//
// Disalbe Aux Device
//
IoOutput8 (0x64, 0xA7);
while (Data & 0x02) {
Data = IoInput8(0x64);
}
//
// Disalbe Keyboard
//
IoOutput8 (0x64, 0xAD);
while (Data & 0x02) {
Data = IoInput8(0x64);
}
//
// Reset keyboard.
//
IoOutput8 (0x60, 0xFF);
Data = IoInput8(0x64);
while (!(Data & 0x01)) {
Data = IoInput8(0x64);
}
Data = IoInput8(0x60);
Data = IoInput8(0x64);
while (!(Data & 0x01)) {
Data = IoInput8(0x64);
}
Data = IoInput8(0x60);
}
Search This Blog
Wednesday, November 30, 2011
Monday, November 28, 2011
Kindle Touch 連不上Wi-Fi?
在剛開始使用Kindle Touch時,有遇到無法透過家中的無線分享器連上Wi-Fi,怎麼會這樣子呢?上網找各種solution,使用了以下的方式,讓Kindle Touch可以順利連上Wi-Fi。
需求:一台安裝有Windows 7的電腦加上有一張無線網卡(若是筆電就是內建配備;
桌上型電腦的話,可能要再買一張USB無線網卡)
軟體:額外安裝Connectify(用谷歌可以搜尋的到)
它的運作模式就是將你的電腦透過無線網卡,變成一個Hot Spot,讓你的Wi-Fi裝置可以透過它連上網路。簡單的方式就是,請記得密碼設定成10碼,編碼模式設成WEP。不然Kindle Touch可能會無法連上Wi-Fi。
需求:一台安裝有Windows 7的電腦加上有一張無線網卡(若是筆電就是內建配備;
桌上型電腦的話,可能要再買一張USB無線網卡)
軟體:額外安裝Connectify(用谷歌可以搜尋的到)
它的運作模式就是將你的電腦透過無線網卡,變成一個Hot Spot,讓你的Wi-Fi裝置可以透過它連上網路。簡單的方式就是,請記得密碼設定成10碼,編碼模式設成WEP。不然Kindle Touch可能會無法連上Wi-Fi。
Kindle Touch 開箱文
期待已久的Kindle Touch WiFi 廣告版總算是入手了! 接下來就讓我來開箱吧。
簡單又環保的設計採破壞式開箱方式,我想這樣才會願意把盒子拿去回收吧(笑)
主角登場了!!! 伴隨著淡淡的紙盒香味飄出~在Kindle Touch的螢幕上有讓人有看來像是擺上一張紙的感覺,但那其實就是電子紙的魔力啊!!!在Kindle Touch螢幕下方有四條線(好在不是設計成三條線冏rz),那就是Home鍵,在機身下方由左至右有micro USB孔、耳機孔、和開關鍵。
側身設計很薄
躺在Kindle Touch正下方的就是傳輸以及充電的micro USB線
準備插上USB線來大展身手囉。
可以看到插上USB線後,橘燈亮起,它就自動開機了...
接下來就會看到一連串的Kindle Touch的自我介紹。若迫不及待,可以按下方四條横線的Home鍵開始設定Kindle Touch吧。
最重要的就是設定Kindle Touch的Wi-Fi,讓它連上網路。
連上Wi-Fi後,就會看到有Wi-Fi字樣出現在右上角
設成完成後就註冊Amazon的帳號準備買書吧。
背面的設計也是很有質感的。
Kindle Touch優點:
1. 以觸控的電子書來說,紅外線觸控方式在Kindle Touch表現的很不錯
2. 即時英文長押螢幕單字來查詢,非常適合學習英文
3. 大小和重量適中,很適合帶出門喝咖啡邊看書,多愜意啊
4. 翻頁的反應速度似乎有比前一代進步
5. 由於是電子紙,電池續航力最長可以到兩個月
6. 最大優點是電子紙螢幕看再久,眼睛也不會痠
Kindle Touch缺點:
1. 資料夾管理系統不是很方便
2. 如果將機身横擺,也沒辦法將文件橫向顯示
3. 手指要乾淨,才不會把螢幕弄髒(笑)
Monday, November 21, 2011
Set PS2 KB LED Status (Num Lock/Cap Lock/Scroll Lock) in Code
1. Send keyboard command 0xED to KBC command port 0x64
2. Wait for the response 0xFA value from KBC data port 0x60
3. Send keyboard LED status command to KBC command port 0x64
EDh nn write LEDs. nn=
b2 Caps Lock
b1 Num Lock
b0 Scroll Lock
Ex. 0x05 means Caps Lock and Scroll Lock is enabled, Num Lock is disabled
4. Wait for the response 0xFA value from KBC data port 0x60
2. Wait for the response 0xFA value from KBC data port 0x60
3. Send keyboard LED status command to KBC command port 0x64
EDh nn write LEDs. nn=
b2 Caps Lock
b1 Num Lock
b0 Scroll Lock
Ex. 0x05 means Caps Lock and Scroll Lock is enabled, Num Lock is disabled
4. Wait for the response 0xFA value from KBC data port 0x60
Tuesday, November 1, 2011
Trigger SMI to Do CpuIo Cause System Hangs Up Under Windows
We would like to use CpuIo protocol and must locate it first.
Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, &CpuIo);
There is a question here, system is entered windows that has exited boot service.
Therefore, we locate this protocol will cause system hangs up.
To avoid this, we should create a global variable to save the CpuIo pointer when system during POST phase.
EFI_CPU_IO_PROTOCOL *mCpuIo = NULL;
EFI_DRIVER_ENTRY_POINT (SctCpuIoPointSave)
EFI_STATUS
SctCpuIoPointSave (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_HANDLE Handle;
DxeInitializeDriverLib (ImageHandle, SystemTable);
//
// Locate CpuIo protocol.
//
Status = gBS->LocateProtocol ( &gEfiCpuIoProtocolGuid, NULL, &mCpuIo ) ;
return Status;
} // EnteyPoint.
Just need to call your function in SMI code to use CpuIo.
For example,
VOID
ShowPort80 (VOID)
{
EFI_STATUS Status ;
UINT8 Data ;
Data = 0x99;
Status = mCpuIo->Io.Write (
mCpuIo,
EfiCpuIoWidthUint8,
0x80,
1,
&Data);
ASSERT_EFI_ERROR (Status);
}
Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, &CpuIo);
There is a question here, system is entered windows that has exited boot service.
Therefore, we locate this protocol will cause system hangs up.
To avoid this, we should create a global variable to save the CpuIo pointer when system during POST phase.
EFI_CPU_IO_PROTOCOL *mCpuIo = NULL;
EFI_DRIVER_ENTRY_POINT (SctCpuIoPointSave)
EFI_STATUS
SctCpuIoPointSave (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_HANDLE Handle;
DxeInitializeDriverLib (ImageHandle, SystemTable);
//
// Locate CpuIo protocol.
//
Status = gBS->LocateProtocol ( &gEfiCpuIoProtocolGuid, NULL, &mCpuIo ) ;
return Status;
} // EnteyPoint.
Just need to call your function in SMI code to use CpuIo.
For example,
VOID
ShowPort80 (VOID)
{
EFI_STATUS Status ;
UINT8 Data ;
Data = 0x99;
Status = mCpuIo->Io.Write (
mCpuIo,
EfiCpuIoWidthUint8,
0x80,
1,
&Data);
ASSERT_EFI_ERROR (Status);
}
Subscribe to:
Posts (Atom)