⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ipiix4pci.c

📁 IXP425的BSP代码
💻 C
📖 第 1 页 / 共 2 页
字号:
/* iPiix4Pci.c - low level initalization code for PCI ISA/IDE Xcelerator *//* Copyright 1984-2000 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01a,28mar00,ms  written.*//*DESCRIPTIONThe 82371AB PCI ISA IDE Xcelerator (PIIX4) is a multi-function PCI deviceimplementing a PCI-to-ISA bridge function, a PCI IDE function, a UniversalSerial Bus host/hub function, and an Enhanced Power Management function. Asa PCI-to-ISA bridge, PIIX4 integrates many common I/O functions found inISA-based PC systems-two 82C37 DMA Controllers, two 82C59 Interrupt Controllers,an 82C54 Timer/Counter, and a Real Time Clock. In addition to compatibletransfers, each DMA channel supports Type F transfers. PIIX4 also contains fullsupport for both PC/PCI and Distributed DMA protocols implementing PCI-basedDMA. The Interrupt Controller has Edge or Level sensitive programmable inputsand fully supports the use of an external I/O Advanced Programmable InterruptController (APIC) and Serial Interrupts. Chip select decoding is provided forBIOS, Real Time Clock, Keyboard Controller, second external microcontroller,as well as two Programmable Chip Selects.PIIX4 is a multi-function PCI device that integrates many system-levelfunctions. PIIX4 is compatible with the PCI Rev 2.1 specification, as well asthe IEEE 996 specification for the ISA (AT) bus..IP "PCI to ISA/EIO Bridge"PIIX4 can be configured for a full ISA bus or a subset of the ISA bus called theExtended IO (EIO) bus. The use of the EIO bus allows unused signals to beconfigured as general purpose inputs and outputs. PIIX4 can directly drive up tofive ISA slots without external data or address buffering. It also providesbyte-swap logic, I/O recovery support, wait-state generation, and SYSCLKgeneration. X-Bus chip selects are provided for Keyboard Controller, BIOS,Real Time Clock, a second microcontroller, as well as two programmable chipselects. PIIX4 can be configured as either a subtractive decode PCI to ISAbridge or as a positive decode bridge. This gives a system designer the optionof placing another subtractive decode bridge in the system (e.g., an Intel380FB Dock Set)..IP "IDE Interface (Bus Master capability and synchronous DMA Mode)"The fast IDE interface supports up to four IDE devices providing an interfacefor IDE hard disks and CD ROMs. Each IDE device can have independent timings.The IDE interface supports PIO IDE transfers up to 14 Mbytes/sec and Bus MasterIDE transfers up to 33 Mbytes/sec. It does not consume any ISA DMA resources.The IDE interface integrates 16x32-bit buffers for optimal transfers.PIIX4's IDE system contains two independent IDE signal channels. They can beconfigured to the standard primary and secondary channels (four devices) orprimary drive 0 and primary drive 1 channels (two devices).This allowsflexibility in system design and device power management..IP "Compatibility Modules"The DMA controller incorporates the logic of two 82C37 DMA controllers, withseven independently programmable channels. Channels [0:3] are hardwired to8-bit, count-by-byte transfers, and channels [5:7] are hardwired to 16-bit,count-by-word transfers. Any two of the seven DMA channels can be programmed to support fast Type-F transfers. The DMA controller also generates the ISA refreshcycles.The DMA controller supports two separate methods for handling legacy DMA via thePCI bus. The PC/PCI protocol allows PCI-based peripherals to initiate DMA cyclesby encoding requests and grants via three PC/PCI REQ#/GNT# pairs. The secondmethod, Distributed DMA, allows reads and writes to 82C37 registers to bedistributed to other PCI devices. The two methods can be enabled concurrently.The serial interrupt scheme typically associated with Distributed DMA is alsosupported.The timer/counter block contains three counters that are equivalent in functionto those found in one 82C54 programmable interval timer. These three countersare combined to provide the system timer function, refresh request, and speakertone. The 14.31818-MHz oscillator input provides the clock source for thesethree counters.PIIX4 provides an ISA-Compatible interrupt controller that incorporates thefunctionality of two 82C59 interrupt controllers. The two interruptcontrollers are cascaded so that 14 external and two internal interrupts arepossible. In addition, PIIX4 supports a serial interrupt scheme. PIIX4 providesfull support for the use of an external IO APIC..IP "Enhanced Universal Serial Bus (USB) Controller"The PIIX4 USB controller provides enhanced support for the Universal HostController Interface (UHCI). This includes support that allows legacy softwareto use a USB-based keyboard and mouse..IP "RTC"PIIX4 contains a Motorola MC146818A-compatible real-time clock with 256 bytesof battery-backed RAM. The real-time clock performs two key functions: keepingtrack of the time of day and storing system data, even when the system ispowered down. The RTC operates on a 32.768-kHz crystal and a separate 3V lithiumbattery that provides up to 7 years of protection.The RTC also supports two lockable memory ranges. By setting bits in theconfiguration space, two 8-byte ranges can be locked to read and write accesses.This prevents unauthorized reading of passwords or other system securityinformation. The RTC also supports a date alarm, that allows for scheduling awake up event up to 30 days in advance, rather than just 24 hours in advance..IP "GPIO and Chip Selects"Various general purpose inputs and outputs are provided for custom systemdesign. The number of inputs and outputs varies depending on PIIX4configuration. Two programmable chip selects are provided which allows thedesigner to place devices on the X-Bus without the need for external decode logic..IP "Pentium and Pentium II Processor Interface"The PIIX4 CPU interface allows connection to all Pentium and Pentium IIprocessors. The Sleep mode for the Pentium II processors is also supported..IP "Enhanced Power Management"PIIX4's power management functions include enhanced clock control, local andglobal monitoring support for 14 individual devices, and various low-power(suspend) states, such as Power-On Suspend, Suspend-to-DRAM, andSuspend-to-Disk. A hardware-based thermal management circuit permitssoftware-independent entrance to low-power states. PIIX4 has dedicated pins tomonitor various external events (e.g., interfaces to a notebook lid,suspend/resume button, battery low indicators, etc.). PIIX4 contains fullsupport for the Advanced Configuration and Power Interface (ACPI) Specification..IP "System Management Bus (SMBus)"PIIX4 contains an SMBus Host interface that allows the CPU to communicate withSMBus slaves and an SMBus Slave interface that allows external masters toactivate power management events..IP "Configurability"PIIX4 provides a wide range of system configuration options. This includes full16-bit I/O decode on internal modules, dynamic disable on all the internalmodules, various peripheral decode options, and many options on systemconfiguration..LP.I USAGEThis library provides low level routines for PCI - ISA bridge intialization,and PCI interrupts routing. There are many functions provided here forenabling different logical devices existing on ISA bus.The functions addressed here include:.IP "   -"Initialization of the library..IP "   -"Creating a logical device using an instance of physical deviceon PCI bus and initializing internal database accordingly..IP "   -"Initializing keyboard (logical device number 11) on PIIX4. .IP "   -"Initializing floppy disk drive (logical device number 5) on PIIX4..IP "   -"Initializing ATA device (IDE interface) on PIIX4..IP "   -"Route PIRQ[A:D] from PCI expansion slots on given PIIX4..IP "   -"Get interrupt level for a given device on PCI expansion slot..IP "   -"Get handle to an internal database using instance on PIIX4 deviceon PCI bus..LP.I INTERNAL DATABASESThis library uses an internal database hidden from it's user. The control toresize the internal database is given to user in the form of two mnemonics.These mnemonics can be overridden by defining in architecture related BSPheader file. If not redefined, they take their default values as defined iniPiix4Pci.h file..IP "IPIIX4_PCI_DEVMAX"Defines the maximum number of PIIX4 that can be found on user's board..IP "IPIIX4_PCI_XINT_MAX"Defines the maximum number of interrupt levels that a user would like to routeusing this facility..LP.I USER INTERFACE.CSSTATUS iPiix4PciLibInit    (    VOID    ).CEThe above mentioned routine should be the first routine that is called amongstmany routine illustrated here. This routine intializes many internal databasesrequired by this library to function properly. The size of internal databasescan be changed by overridding IPIIX4_PCI_DEVMAX and IPIIX4_PCI_XINT_MAX mnemonics..CSint iPiix4PciDevCreate    (    int instance    ).CEThe above mentioned routine should be called for a given instance of device onPCI bus before intializing ISA based devices or interrupt routing. This routinechecks for the existence of given instance of the bus and hands out a handle (an index into its internal data structures) to use for further call on givendevice. The user of this library should always use correct handle for properdevice intialization..CSSTATUS iPiix4PciKbdInit    (    int handle    ).CEThe above mentioned routine does keyboard specific intialization on PIIX4..CSSTATUS iPiix4PciFdInit    (    int handle    ).CEThe above mentioned routine does floppy disk specific intialization on PIIX4..CSSTATUS iPiix4PciAtaInit    (    int handle    ).CEThe above mentioned routine does ATA device specific intialization on PIIX4..CSSTATUS iPiix4PciIntrRoute    (    int handle    ).CEThe above mentioned routines routes PIRQ[A:D] to interrupt routing statemachine embedded in PIIX4 and makes them level triggered. This routineshould be called early in boot process..CSint iPiix4PciGetIntr    (    int handle    ).CEThis above mentioned routine gives out the interrupt level to driverto use..CSint iPiix4PciGetHandle    (    int vendId,    int devId,    int instance    ).CEThe above mentioned routine gives handle for already created device (usingiPiix4PciDevCreate () ). This routine checks for the existence of givendevice on PCI bus. If found, checks existing entries in internal databaseto get a match. If match found return handle to that entry in internaldatabases.INCLUDE FILES: iPiix4Pci.h*//* includes */#include "vxWorks.h"#include "sysLib.h"#include "string.h"#include "drv/pci/pciConfigLib.h"#include "drv/pci/iPiix4Pci.h"/* locals */LOCAL IPIIX4PCI_HANDLE iPiix4PciHandle [IPIIX4_PCI_DEVMAX];LOCAL IPIIX4PCI_HANDLE * iPiix4PciHdlPtr;LOCAL UCHAR iPiix4PciIntRoute [IPIIX4_PCI_DEVMAX][IPIIX4_PCI_XINT_MAX];LOCAL UCHAR iPiix4PciIntrIdx[IPIIX4_PCI_DEVMAX];/********************************************************************************* iPiix4PciLibInit - intializes PIIX4 device library** This routine will intializes (zero out) data structures used by this library.* This is a necessary step to guarantee proper functioning of this library.** RETURNS: OK/ERROR*/STATUS iPiix4PciLibInit    (    VOID    )    {    int i;    int j;    unsigned char intrCounter;        /* zero out array of handles before use */    memset (iPiix4PciHandle, '\0', IPIIX4_PCI_DEVMAX);    memset (iPiix4PciIntrIdx, '\0', IPIIX4_PCI_DEVMAX);    for (i = 0; i < IPIIX4_PCI_DEVMAX; i++)        {        for (j = 0, intrCounter = IPIIX4_PCI_XINT1_LVL;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -