资源简介
自己编写的基于edk2编写的读写pci的小程序,模仿AMI RU工具,适合初学bios开发的developer
代码片段和文件信息
#include
#include
#include
#include
#include
#include
#include
#define HEX_KEY_INPUT( x ) ( ( (x <= ‘9‘) && (x >= ‘0‘) ) || ( (x <= ‘F‘) && (x >= ‘A‘) ) || ( (x <= ‘f‘) && (x >= ‘a‘) ) )
#define CALC_EFI_PCI_ADDRESS( Bus Dev Fun Reg ) \
( (UINT64) ( ( ( (UINTN) Bus) << 24) + ( ( (UINTN) Dev) << 16) + \
( ( (UINTN) Fun) << 8) + ( (UINTN) Reg) ) )
#define SCAN_CODE_NULL 0x0000
#define SCAN_CODE_UP 0x0001
#define SCAN_CODE_DOWN 0x0002
#define SCAN_CODE_RIGHT 0x0003
#define SCAN_CODE_LEFT 0x0004
#define SCAN_CODE_PAGE_UP 0x0009
#define SCAN_CODE_PAGE_DOWN 0x000A
#define SCAN_CODE_ESC 0x0017
#define SCAN_CODE_F1 0x000B
#define CHAR_CR 0x000D
EFI_STATUS PCI_Reg( UINT8 UINT8 UINT8 );
UINTN
Xtoi(
IN CHAR16 *Str
)
{
return(StrHexToUintn( Str ) );
}
EFI_STATUS
EFIAPI
UefiMain
( IN EFI_HANDLE ImageHandle IN EFI_SYSTEM_TABLE *SystemTable )
{
EFI_INPUT_KEY Key;
EFI_STATUS Status;
UINT8 Addr;
UINT8 Bus;
UINT8 Dev;
UINT8 Fun;
UINTN Index3;
UINT8 InPutKeyFlag;
CHAR16 *InPutKey;
InPutKey = AllocatePool( 2 * 9 );
Status = EFI_SUCCESS;
InPutKeyFlag = 0;
Bus = 0;
Dev = 0;
Fun = 0;
Addr = 0;
gST->ConOut->ClearScreen( gST->ConOut );
Print( L“Bus:00“ );
for (;; )
{
gST->ConOut->EnableCursor( gST->ConOut TRUE );
gST->ConOut->SetCursorPosition( gST->ConOut 4 0 );
Status = gBS->WaitForEvent( 1 &gST->ConIn->WaitForKey &Index3 );
Status = gST->ConIn->ReadKeyStroke( gST->ConIn &Key );
if ( HEX_KEY_INPUT( Key.UnicodeChar ) )
{
if ( InPutKeyFlag >= 2 )
InPutKeyFlag = 0;
InPutKey[InPutKeyFlag] = Key.UnicodeChar;
InPutKey[InPutKeyFlag + 1] = L‘\0‘;
InPutKeyFlag++;
if ( InPutKeyFlag != 0 )
{
Addr = (UINT8) Xtoi( InPutKey );
if ( Addr < 0x10 )
{
Print( L“0%x“ Addr );
} else {
Print( L“%x“ Addr );
}
}
continue;
}
if ( Key.UnicodeChar == CHAR_CR )
{
Bus = Addr;
InPutKeyFlag = 0;
Addr = 0;
break;
}
if ( Key.ScanCode == SCAN_CODE_ESC )
{
break;
}
}
if ( Bus < 0x10 )
{
Print( L“0%x“ Bus );
} else { Print( L“%x“ Bus ); }
Print( L“ “ );
Print( L“Dev:00“ );
for (;; )
{
gST->ConOut->EnableCursor( gST->ConOut TRUE );
gST->ConOut->SetCursorPosition( gST->ConOut 11 0 );
Status = gBS->WaitForEvent( 1 &gST->ConIn->WaitForKey &Index3 );
Status = gST->ConIn->ReadKeyStroke( gST->ConIn &Key );
if ( HEX_KEY_INPUT( Key.UnicodeChar ) )
{
if ( InPutKeyFlag >= 2 )
InPutKeyFlag = 0;
InPutKey[InPutKeyFlag] = Key.UnicodeChar;
InPutKey[InPutKeyFlag + 1] = L‘\0‘;
InPutKeyFlag++;
if ( InPutKeyFlag != 0 )
{
Addr = (UINT8) Xtoi( InPutKey );
if ( Addr < 0x1
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-08-07 13:19 pciRW\
文件 10360 2016-08-07 11:50 pciRW\pci.c
文件 567 2016-08-07 12:03 pciRW\pci.info
- 上一篇:类似知乎的图文编辑器
- 下一篇:tex2word破解版).rar
相关资源
- 10.6 DOS系统功能调用及BIOS调用实验制
- 11011448 90KT23CUS 90KT23C.ROM.rar
- 联想 开天M6600 BIOS 20KT41AUS
- 迪兰恒进 RX570 8G X-Serial战将 原厂 bi
- X220 白名单及屏蔽lvds教程
- RU DOS版、EFI版32位/64位 BIOS常用工具
- WINCRIS亲测可用,附教程
- 联想B500一体机BIOS
- bootia32.efi
- Network Controller Sideband Interface (NC-SI)
-
NWli
nk IPX/SPX/NetBIOS Compatible Transport - 硬盘保护卡bios文件
- WIN10可用的MMTOOL版本
- 盈通588HY海力士挖矿bios30+
- xfx 580 8GB镁光 1366 bios
- WINCRIS+EXFILE_BIOS盲刷工具汇总.rar
- WinFlash华硕笔记本BIOS更新工具
-
TMS320F28335 DSP28xxx_Section
copy_nonBIOS.a - 讯景XFX580 8G BIOS
- A8N-VM 刷bios(含工程师版的AFUDOS-可刷
- vega64公版风冷BIOS
- 讯景xfx rx470P 原卡备份BIOS
- 各种主板BIOS 启动项 快速设置
- 联想扬天M2622N刷BIOS程序内附独家超级
- AMI BIOS修改工具+LOGO+8139 8163 8167 8168
- 讯景战狼4G美光显存可用BIOS合集.zip
- 联想G31主板BIOS
- ThinkPad笔记本刷BIOS免电池补丁
- 联想笔记本bios密码破解工具
- 联想G31T-LM 最新版BIOS 51KT57A直接上L5
评论
共有 条评论