예제 #1
0
파일: hal_aux.c 프로젝트: perryhg/terkos
externC cyg_uint8 
_csb281_pci_cfg_read_uint8(int bus, int devfn, int offset)
{
    cyg_uint32 addr;
    cyg_uint8 cfg_val = (cyg_uint8)0xFF;

#ifdef CYGPKG_IO_PCI_DEBUG
    diag_printf("%s(bus=%x, devfn=%x, offset=%x) = ", __FUNCTION__, bus, devfn, offset);
#endif // CYGPKG_IO_PCI_DEBUG
    addr = _cfg_sel(bus, devfn, offset);
    HAL_READ_UINT8LE(addr, cfg_val);
#if 0
    HAL_READ_UINT16(_CSB281_PCI_STAT_CMD, status);
    if (status & _CSB281_PCI_STAT_ERROR_MASK) {
        // Cycle failed - clean up and get out
        cfg_val = (cyg_uint8)0xFF;
        HAL_WRITE_UINT16(_CSB281_PCI_STAT_CMD, status & _CSB281_PCI_STAT_ERROR_MASK);
    }
#endif
#ifdef CYGPKG_IO_PCI_DEBUG
    diag_printf("%x\n", cfg_val);
#endif // CYGPKG_IO_PCI_DEBUG
    HAL_WRITE_UINT32(_CSB281_PCI_CONFIG_ADDR, 0);
    return cfg_val;
}
예제 #2
0
externC cyg_uint8 
hal_ppc405_pci_cfg_read_uint8(int bus, int devfn, int offset)
{
    cyg_uint32 cfg_addr;
    cyg_uint8 cfg_val = (cyg_uint8) 0xFF;

#ifdef CYGPKG_IO_PCI_DEBUG
    diag_printf("%s(bus=%x, devfn=%x, offset=%x) = ", __FUNCTION__, bus, devfn, offset);
#endif // CYGPKG_IO_PCI_DEBUG
    cfg_addr = _cfg_addr(bus, devfn, offset);
    HAL_WRITE_UINT32LE(PCIC0_CFGADDR, cfg_addr);
    HAL_READ_UINT8LE(PCIC0_CFGDATA|(offset & 0x03), cfg_val);
#ifdef CYGPKG_IO_PCI_DEBUG
    diag_printf("%x\n", cfg_val);
#endif // CYGPKG_IO_PCI_DEBUG
    return cfg_val;
}