February 18, 2008

Comments (1)

  • Module Name:

    ceddk.h

    Abstract:

    This module defines the NT types, constants, and functions that are
    exposed to device drivers.

    Revision History:

    –*/

    #ifndef _CEDDK_
    #define _CEDDK_

    #define NTKERNELAPI
    #define NTHALAPI

    #ifdef __cplusplus
    extern “C” {
    #endif

    #define PAGE_SIZE UserKInfo[KINX_PAGESIZE]
    #define PAGE_SHIFT ( (PAGE_SIZE == 0×1000) ? 12L : 10L)

    #include
    #ifdef _MAC
    #include
    #endif

    typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;

    typedef enum _INTERFACE_TYPE {
    InterfaceTypeUndefined = -1,
    Internal,
    Isa,
    Eisa,
    MicroChannel,
    TurboChannel,
    PCIBus,
    VMEBus,
    NuBus,
    PCMCIABus,
    CBus,
    MPIBus,
    MPSABus,
    ProcessorInternal,
    InternalPowerBus,
    PNPISABus,
    PNPBus,
    MaximumInterfaceType
    } INTERFACE_TYPE, *PINTERFACE_TYPE;

    //
    // Define types of bus information.
    //

    typedef enum _BUS_DATA_TYPE {
    ConfigurationSpaceUndefined = -1,
    Cmos,
    EisaConfiguration,
    Pos,
    CbusConfiguration,
    PCIConfiguration,
    VMEConfiguration,
    NuBusConfiguration,
    PCMCIAConfiguration,
    MPIConfiguration,
    MPSAConfiguration,
    PNPISAConfiguration,
    MaximumBusDataType
    } BUS_DATA_TYPE, *PBUS_DATA_TYPE;

    //
    // A PCI driver can read the complete 256 bytes of configuration
    // information for any PCI device by calling:
    //
    // ULONG
    // HalGetBusData (
    // __in BUS_DATA_TYPE PCIConfiguration,
    // __in ULONG PciBusNumber,
    // __in PCI_SLOT_NUMBER VirtualSlotNumber,
    // __in PPCI_COMMON_CONFIG &PCIDeviceConfig,
    // __in ULONG sizeof (PCIDeviceConfig)
    // );
    //
    // A return value of 0 means that the specified PCI bus does not exist.
    //
    // A return value of 2, with a VendorID of PCI_INVALID_VENDORID means
    // that the PCI bus does exist, but there is no device at the specified
    // VirtualSlotNumber (PCI Device/Function number).
    //
    //

    // begin_ntminiport begin_ntndis

    typedef struct _PCI_SLOT_NUMBER {
    union {
    struct {
    ULONG DeviceNumber:5;
    ULONG FunctionNumber:3;
    ULONG Reserved:24;
    } bits;
    ULONG AsULONG;
    } u;
    } PCI_SLOT_NUMBER, *PPCI_SLOT_NUMBER;

    #define PCI_TYPE0_ADDRESSES 6
    #define PCI_TYPE1_ADDRESSES 2
    #define PCI_TYPE2_ADDRESSES 1

    typedef struct _PCI_COMMON_CONFIG {
    USHORT VendorID; // (ro)
    USHORT DeviceID; // (ro)
    USHORT Command; // Device control
    USHORT Status;
    UCHAR RevisionID; // (ro)
    UCHAR ProgIf; // (ro)
    UCHAR SubClass; // (ro)
    UCHAR BaseClass; // (ro)
    UCHAR CacheLineSize; // (ro+)
    UCHAR LatencyTimer; // (ro+)
    UCHAR HeaderType; // (ro)
    UCHAR BIST; // Built in self test

    union {
    struct _PCI_HEADER_TYPE_0 {
    ULONG BaseAddresses[PCI_TYPE0_ADDRESSES];
    ULONG CIS;
    USHORT SubVendorID;
    USHORT SubSystemID;
    ULONG ROMBaseAddress;
    ULONG Reserved2[2];

    UCHAR InterruptLine; //
    UCHAR InterruptPin; // (ro)
    UCHAR MinimumGrant; // (ro)
    UCHAR MaximumLatency; // (ro)
    } type0;

    struct _PCI_HEADER_TYPE_1 {
    ULONG BaseAddresses[PCI_TYPE1_ADDRESSES];
    UCHAR PrimaryBusNumber;
    UCHAR SecondaryBusNumber;
    UCHAR SubordinateBusNumber;
    UCHAR SecondaryLatencyTimer;
    UCHAR IOBase;
    UCHAR IOLimit;
    USHORT SecondaryStatus;
    USHORT MemoryBase;
    USHORT MemoryLimit;
    USHORT PrefetchableMemoryBase;
    USHORT PrefetchableMemoryLimit;
    ULONG PrefetchableMemoryBaseUpper32;
    ULONG PrefetchableMemoryLimitUpper32;
    USHORT IOBaseUpper;
    USHORT IOLimitUpper;
    ULONG Reserved2;
    ULONG ExpansionROMBase;
    UCHAR InterruptLine;
    UCHAR InterruptPin;
    USHORT BridgeControl;
    } type1;

Post a Comment

Leave a Reply

Your email address will not be published. Required fields are marked *