2010-12-28 4 views
2

VxWorks 653을 사용하고 있으며 대상은 wrSbc7457 Power PC입니다.VxWorks 653에서 PCI 장치의 메모리 읽기/쓰기는 어떻게 하나입니까?

내 wrSbc7457에 메 자닌 카드가 있는데 그 메 자닌 카드에 메모리를 쓰거나 읽으려고합니다. VxWorks를 잘 알고 당신의 사람들을 위해

, 나는 내 ModuleOS의 usrAppInit() 기능에 다음과 같은 한 :

printf ("Entering ModuleOS, usrAppInit() ...\n") ; 
printf ("sysModel() returns %s\n", sysModel()) ; 
pciDeviceShow (0) ; 


{ 
int pciBus, pciDevice, pciFunc ; 
UINT32 BAR_0_contents, BAR_1_contents ; 

printf 
    ("\npciFindDevice returns STATUS %d\n", 
      pciFindDevice (my_VENDORID, my_PMC_DEVICEID, 0, &pciBus, &pciDevice, &pciFunc) 
    ) ; 
printf ("\tand pciBus = %d, pciDevice = %d, pciFunc = %d\n", pciBus, pciDevice, pciFunc) ; 

printf ("\npciConfigInLong returns STATUS %d\n", 
     pciConfigInLong (pciBus, pciDevice, pciFunc, PCI_CFG_BASE_ADDRESS_0, & BAR_0_contents)) ; 
printf ("\tand Base Address Register 0 contains 0x%X\n", BAR_0_contents) ; 
printf ("\npciConfigInLong returns STATUS %d\n", 
     pciConfigInLong (pciBus, pciDevice, pciFunc, PCI_CFG_BASE_ADDRESS_1, & BAR_1_contents)) ; 
printf ("\tand Base Address Register 1 contains 0x%X\n", BAR_1_contents) ; 

내 목표는 OS 부팅 이미지를로드 할 때 다음과 같은 출력 :

Entering ModuleOS, usrAppInit() ... 

sysModel() returns wrSbc7457 Power PC 

Scanning function 0 of each PCI device on bus 0 
Using configuration mechanism 0 
bus  device function vendorID deviceID class 
00000000 00000000 00000000 0000---- 0000---- 000----- 
00000000 00000001 00000000 0000---- 0000---- 00--0000 
00000000 00000002 00000000 0000---- 0000---- 000----- 

pciFindDevice returns STATUS 0 (OK) 
     and pciBus = 0, pciDevice = 1, pciFunc = 0 

pciConfigInLong returns STATUS 0 (OK) 
     and Base Address Register 0 contains 0x50000000 

pciConfigInLong returns STATUS 0 (OK) 
     and Base Address Register 1 contains 0x58000000 

제 질문은 : 어떻게 내 메 자닌 카드의 메모리를 호스트의 주소 공간에 매핑합니까? 그런 다음 메 자닌 카드에 메모리를 쓰거나 읽는 방법은 무엇입니까?

답변

1

불행히도, 보편적 인 대답은 없습니다. PCI 브리지를 프로그래밍해야합니다. 일부는 PCI 자동 구성을 사용하는지 여부에 따라 다릅니다.

pciConfig 및/또는 pciAutoConfig에 대한 라이브러리 참조를 확인하십시오.

장치에 0x50000000과 0x58000000에 두 개의 주소 공간이있는 것처럼 보이지만 호스트 브리지 매핑이 아닌 PCI 주소 공간이라고 생각됩니다.