![](http://datasheet.mmic.net.cn/370000/UPD70F3107AA_datasheet_16740728/UPD70F3107AA_76.png)
CHAPTER 5 APPLICATION EXAMPLES
Application Note U17121EJ1V1AN
76
5.5.4 PCI configuration space access sample program list
/////////////////////////////////////////////////////////////////////////
// PCI configuration space access sample //
// Overview: Configuration space is accessed using procedure //
// shown below. //
// 1) Write 32-bit value indicating PCI device, function //
// number, and register number to be accessed to //
// PCI_CONFIG_ADD register of PCI Host Bridge Macro. //
// 2) When reading configuration space register, read //
// (word access) 32-bit value in PCI_CONFIG_DATA //
// register of PCI Host Bridge Macro. //
// When writing to configuration space register, write //
// (word access) 32-bit value to PCI_CONFIG_DATA register //
// of PCI Host Bridge Macro. //
// //
// This procedure is combined in functions PCI_ConfigRead //
// and PCI_ConfigWrite shown below. //
// Function PCI_Config_BaseAddressInit uses function //
// PCI_ConfigWrite to set base address register in //
// configuration space. //
// //
/////////////////////////////////////////////////////////////////////////
//////////////////////
// Type declaration //
//////////////////////
typedef char
typedef short int
typedef int
typedef unsigned char
typedef unsigned short int
typedef unsigned int
typedef volatile unsigned char
typedef volatile unsigned short int
typedef volatile unsigned int
/////////////////////////////////////////////////////////////////
// Function name: PCI_ConfigRead //
// Function: Reads 32-bit value in PCI configuration space. //
// Argument: ConfigAdd: Register address of configuration space//
// Return value: Read configuration space register data //
/////////////////////////////////////////////////////////////////
UWORD PCI_ConfigRead(UWORD ConfigAdd)
{
V850EME2_REGW(PHBMR_PCI_CONFIG_ADD) = ConfigAdd;
return V850EME2_REGW(PHBMR_PCI_CONFIG_DATA);
}
BYTE;
HWORD;
WORD;
UBYTE;
UHWORD;
UWORD;
VUBYTE;
VUHWORD;
VUWORD;