posts - 116,  comments - 123,  trackbacks - 0
      时隔一个月,今日完成了小组给的第一个任务,作了EFI的presentation,感觉还不错,不是很紧张,据说讲的时间太长了,可我就做了大概18页啊,呵呵,怎么会讲这么多?!难道.....
      网上找了一大堆房子信息,总之很少,也很贵,似乎有便宜的,却有些不大相信,方才打印了20张求租信息,打算这周末去贴之,看怎么样。
      做完这个ppt,以为就这么着了,没想到,后面还挺紧张,2个礼拜要看另一个spec,然后还要作presentation,而且我对中断一直不太感兴趣,怎么办呢?慢慢看把,正所谓知难而进和知难而退两手准备,呵呵!
posted on 2006-06-21 19:02 yuhen 阅读(539) 评论(2)  编辑 收藏 引用 所属分类: 个人文档其他文档

FeedBack:
# re: 下午作完presentation了
2009-11-25 15:54 | 陳鴻昀
//**********************************************************************
//**********************************************************************
//** Demo code for PCI configuration space I/O access program **
//** By Lawrence 2009/11/20 **
//**********************************************************************
//**********************************************************************

#include "efi.h"
#include "efilib.h"

#define Not_Found_Me 0x00000000
#define Found_Me 0x00000001

static EFI_STATUS WaitForKeyOrReset(VOID)
{
EFI_STATUS Status;
EFI_INPUT_KEY key;
UINTN index;

for(;;) {
Status = ST->ConIn->ReadKeyStroke(ST->ConIn, &key);
if (Status == EFI_NOT_READY)
BS->WaitForEvent(1, &ST->ConIn->WaitForKey, &index);
else
break;
}
if (!EFI_ERROR(Status)) {
if (key.ScanCode == SCAN_ESC)
RT->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);
}

return Status;
}

UINTN
AccessPciConfig (
IN EFI_PCI_IO_PROTOCOL *PCI_DEVICE_TARGET
)
{
UINT8 i;
UINTN PCI_ATTR[4];
UINT8 PCI_REG[4], pci_offset=0;

//get device attr
PCI_DEVICE_TARGET->GetLocation(PCI_DEVICE_TARGET,PCI_ATTR,PCI_ATTR+1,PCI_ATTR+2,PCI_ATTR+3);
if ((PCI_ATTR[1] == 0x00) && (PCI_ATTR[2] == 0x1e) && (PCI_ATTR[3] == 0x00)){
Print (L"Device found at BUS = %02x DEV= %02x FUN= %02x \n",PCI_ATTR[1],PCI_ATTR[2],PCI_ATTR[3]);
ST->ConOut->SetAttribute (ST->ConOut, EFI_TEXT_ATTR (EFI_GREEN, EFI_BLACK));
//print register value
for (i = 0;i < 4;i++)
{
PCI_DEVICE_TARGET->Pci.Read (PCI_DEVICE_TARGET,0,pci_offset,4,PCI_REG);
Print(L"Register0x%d value = %02x \n",i, PCI_REG[i]);
}
Print(L"\n");
ST->ConOut->SetAttribute (ST->ConOut, EFI_TEXT_ATTR (EFI_WHITE, EFI_BLACK));
return Found_Me;
}

return Not_Found_Me;
}  回复  更多评论
  
# re: 下午作完presentation了
2009-11-25 15:55 | 陳鴻昀
//**********************************************************************
//**********************************************************************
//** Demo code for PCI configuration space I/O access program **
//** By Lawrence 2009/11/20 **
//**********************************************************************
//**********************************************************************

#include "efi.h"
#include "efilib.h"

#define Not_Found_Me 0x00000000
#define Found_Me 0x00000001

static EFI_STATUS WaitForKeyOrReset(VOID)
{
EFI_STATUS Status;
EFI_INPUT_KEY key;
UINTN index;

for(;;) {
Status = ST->ConIn->ReadKeyStroke(ST->ConIn, &key);
if (Status == EFI_NOT_READY)
BS->WaitForEvent(1, &ST->ConIn->WaitForKey, &index);
else
break;
}
if (!EFI_ERROR(Status)) {
if (key.ScanCode == SCAN_ESC)
RT->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL);
}

return Status;
}

UINTN
AccessPciConfig (
IN EFI_PCI_IO_PROTOCOL *PCI_DEVICE_TARGET
)
{
UINT8 i;
UINTN PCI_ATTR[4];
UINT8 PCI_REG[4], pci_offset=0;

//get device attr
PCI_DEVICE_TARGET->GetLocation(PCI_DEVICE_TARGET,PCI_ATTR,PCI_ATTR+1,PCI_ATTR+2,PCI_ATTR+3);
if ((PCI_ATTR[1] == 0x00) && (PCI_ATTR[2] == 0x1e) && (PCI_ATTR[3] == 0x00)){
Print (L"Device found at BUS = %02x DEV= %02x FUN= %02x \n",PCI_ATTR[1],PCI_ATTR[2],PCI_ATTR[3]);
ST->ConOut->SetAttribute (ST->ConOut, EFI_TEXT_ATTR (EFI_GREEN, EFI_BLACK));
//print register value
for (i = 0;i < 4;i++)
{
PCI_DEVICE_TARGET->Pci.Read (PCI_DEVICE_TARGET,0,pci_offset,4,PCI_REG);
Print(L"Register0x%d value = %02x \n",i, PCI_REG[i]);
}
Print(L"\n");
ST->ConOut->SetAttribute (ST->ConOut, EFI_TEXT_ATTR (EFI_WHITE, EFI_BLACK));
return Found_Me;
}

return Not_Found_Me;
}

EFI_STATUS
InitializePciApplication (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
EFI_HANDLE *Handle;
UINTN BufferSize, Result;
UINTN NoHandles, Index;
EFI_PCI_IO_PROTOCOL *PCI_DEVICE_TARGET;

//
// Initialize the Library.
//
InitializeLib (ImageHandle, SystemTable);
//
// Find the PCI driver
//
Handle = NULL;
BufferSize = 1;
do
{
if (Handle)
{
FreePool (Handle);
}

Handle = AllocatePool (BufferSize);
Status = BS->LocateHandle (ByProtocol, &PciIoProtocol, NULL, &BufferSize, Handle);

} while (Status == EFI_BUFFER_TOO_SMALL);
ASSERT (!EFI_ERROR(Status));

NoHandles = BufferSize / sizeof(EFI_HANDLE);
Index = 0;
ST->ConOut->ClearScreen (ST->ConOut);
Result = Not_Found_Me;
do
{
if(Index == NoHandles - 1)
Index=0;
else
Status = BS->HandleProtocol (Handle[Index], &PciIoProtocol, (VOID*)&PCI_DEVICE_TARGET);
Print(L"THIS IS DEVICE %d \n",Index);
if (!EFI_ERROR(Status))
{
Result = AccessPciConfig(PCI_DEVICE_TARGET);
//- Print(L"Again now Result is %x \n",Result);
}
Index++;
} while(Result == Not_Found_Me);

Print(L"Please hit any key to exit this image.");
WaitForSingleEvent (ST->ConIn->WaitForKey, 0);

return EFI_SUCCESS;
}  回复  更多评论
  
只有注册用户登录后才能发表评论。
<2007年3月>
25262728123
45678910
11121314151617
18192021222324
25262728293031
1234567

Believe in who you are,
you are a shinning star!

常用链接

留言簿(14)

随笔分类(122)

随笔档案(116)

文章分类(2)

文章档案(2)

相册

BLOG

Study

Testing

最新随笔

搜索

  •  

积分与排名

  • 积分 - 94805
  • 排名 - 63

最新随笔

最新评论

阅读排行榜

评论排行榜