CHAPTER 5 APPLICATION EXAMPLES
Application Note U17121EJ1V1AN
77
/////////////////////////////////////////////////////////////////
// Function name: PCI_ConfigWrite //
// Function: Writes 32-bit value to PCI configuration space. //
// Argument: ConfigAdd: Register address of configuration space//
// ConfigData: Register data of configuration space //
// Return value: None //
/////////////////////////////////////////////////////////////////
void PCI_ConfigWrite(UWORD ConfigAdd, UWORD ConfigData)
{
V850EME2_REGW(PHBMR_PCI_CONFIG_ADD) = ConfigAdd;
V850EME2_REGW(PHBMR_PCI_CONFIG_DATA) = ConfigData;
return;
}
/////////////////////////////////////////////////////////////////////////
// Function name: PCI_Config_BaseAddressInit //
// Function: Sets base address of configuration space. //
// Argument: None //
// Return value: None //
// Details: Sets base address register of offset 10H to 24H in //
// configuration space of PCI device connected to AD30 //
// signal by IDSEL as follows. //
// //
// ATA Command Register Base Address (10H) : 0C80_0000H //
// ATA Control Register Base Address (14H) : 0C80_0008H //
// Bus Master Control Register Base Address(18H) : 0C80_0010H //
// //
/////////////////////////////////////////////////////////////////////////
void PCI_Config_BaseAddressInit(void)
{
UWORD ConfigAddress;
UWORD ConfigData;
///////////////////////////////////////
// ATA Command Register Base Address //
///////////////////////////////////////
ConfigAddress = 0x40000010;
// bit 31-11 : IDSEL specification = 010000000000000000000b
// Select PCI device connected to AD30
// bit 10-08 : Function number = 00b
// bit 07-02 : Register number = 4 (000100b),
// -> ATA Command Register Base Address
// (In the case of PCI-IDE ASIC board used in this application)
// bit 01-00 : 00b (fixed)
PCI_ConfigWrite(ConfigAddress, 0x0C800000);