?? syspccard.c
字號:
/* sysPccard.c - BSP specific PCCARD support */
/* Copyright 2004 Wind River Systems, Inc. */
#include "copyright_wrs.h"
/*
modification history
--------------------
01c,15dec04,dee fix SPR#102006 for pccard ata disk
01b,19aug03,j_b added dual PC Card interrupt, Intersil Prism END support and
ne2k interrupt support (dependent on SPR#90999 fix)
01a,14jun03,scm written.
*/
/*
DESCRIPTION
Support for PC Card libraries and drivers.
*/
/* includes */
#include "vxWorks.h"
#include "drv/pccard/csLib.h"
#include "drv/pccard/ssLib.h"
#include "drv/pccard/yentaSockServ.h"
#include "drv/pci/pciConfigLib.h"
#include "drv/pci/pciIntLib.h"
#ifndef PCI2DRAM_BASE_ADRS
#define PCI2DRAM_BASE_ADRS 0x00000000
#endif /* PCI2DRAM_BASE_ADRS */
STATUS sysCardbusIntConnect (VOIDFUNCPTR * vector, VOIDFUNCPTR routine, int parameter);
STATUS sysCardbusIntDisconnect (VOIDFUNCPTR * vector, VOIDFUNCPTR routine, int parameter);
/* include enablers */
#ifdef INCLUDE_PCCARD_ATA
#define SYS_ATA_IO_OFFSET (0)
#define SYS_ATA_IRQ_TO_INUM(irq) (irq)
#define SYS_ATA_INT_ENABLE pciDeviceIntEnable
#define SYS_ATA_INT_DISABLE pciDeviceIntDisable
#define SYS_ATA_INT_CONNECT sysCardbusIntConnect
#define SYS_ATA_INT_DISCONNECT sysCardbusIntDisconnect
IMPORT FUNCPTR _func_sysAtaIntConnect;
IMPORT FUNCPTR _func_sysAtaIntDisconnect;
IMPORT FUNCPTR _func_sysAtaIntEnable;
IMPORT FUNCPTR _func_sysAtaIntDisable;
#include "pccard/enablers/sysAta.c"
#endif /* INCLUDE_PCCARD_ATA */
#ifdef INCLUDE_PCCARD_SERIAL
#define SYS_SERIAL_BIND
#define SYS_SERIAL_IO_OFFSET (0)
#define SYS_SERIAL_IRQ_TO_INUM(irq) (irq)
#define SYS_SERIAL_INT_CONNECT sysCardbusIntConnect
#define SYS_SERIAL_INT_DISCONNECT sysCardbusIntDisconnect
#define SYS_SERIAL_INT_ENABLE pciDeviceIntEnable
#define SYS_SERIAL_INT_DISABLE pciDeviceIntDisable
#define SYS_SERIAL_INT_FREE(irq)
#include "pccard/enablers/sysSerial.c"
#endif /* INCLUDE_PCCARD_SERIAL */
#ifdef INCLUDE_PCCARD_ELT_3C589_END
#undef SYS_ELT_3C589_BIND
#define SYS_ELT_3C589_IO_OFFSET (0)
#define SYS_ELT_3C589_IRQ_TO_INUM(irq) (irq)
#define SYS_ELT_3C589_INT_CONNECT sysCardbusIntConnect
#define SYS_ELT_3C589_INT_DISCONNECT sysCardbusIntDisconnect
#define SYS_ELT_3C589_INT_ENABLE pciDeviceIntEnable
#define SYS_ELT_3C589_INT_DISABLE pciDeviceIntDisable
#include "pccard/enablers/sysElt3c589End.c"
#endif /* INCLUDE_PCCARD_ELT_3C589_END */
#ifdef INCLUDE_PCCARD_NE2K_END
#define SYS_NE2K_BYTE_ACCESS (FALSE)
#define SYS_NE2K_IO_OFFSET (0)
#define SYS_NE2K_IRQ_TO_INUM(irq) (irq)
#define SYS_NE2K_INT_CONNECT sysCardbusIntConnect
#define SYS_NE2K_INT_DISCONNECT sysCardbusIntDisconnect
#define SYS_NE2K_INT_ENABLE pciDeviceIntEnable
#define SYS_NE2K_INT_DISABLE pciDeviceIntDisable
/* END interrupt control routines */
IMPORT FUNCPTR ne2000EndIntConnect;
IMPORT FUNCPTR ne2000EndIntDisconnect;
IMPORT FUNCPTR ne2000EndIntEnable;
IMPORT FUNCPTR ne2000EndIntDisable;
#include "pccard/enablers/sysNe2kEnd.c"
#endif /* INCLUDE_PCCARD_NE2K_END */
#ifdef INCLUDE_PCCARD_EL_3C575_END
#define SYS_EL_3C575_BIND
#define SYS_EL_3C575_PCI_IO_OFFSET (0)
#define SYS_EL_3C575_IRQ_TO_INUM(irq) (irq)
#define SYS_EL_3C575_INT_CONNECT sysCardbusIntConnect
#define SYS_EL_3C575_INT_DISCONNECT sysCardbusIntDisconnect
#define SYS_EL_3C575_INT_ENABLE pciDeviceIntEnable
#define SYS_EL_3C575_INT_DISABLE pciDeviceIntDisable
#include "pccard/enablers/sysEl3c575End.c"
#endif /* INCLUDE_EL_3C575_END */
#ifdef INCLUDE_PCCARD_NETGEAR_END
#define SYS_NETGEAR_BIND
#define SYS_NETGEAR_PCI_IO_OFFSET (0)
#define SYS_NETGEAR_IRQ_TO_INUM(irq) (irq)
#define SYS_NETGEAR_INT_CONNECT sysCardbusIntConnect
#define SYS_NETGEAR_INT_DISCONNECT sysCardbusIntDisconnect
#define SYS_NETGEAR_INT_ENABLE pciDeviceIntEnable
#define SYS_NETGEAR_INT_DISABLE pciDeviceIntDisable
#include "pccard/enablers/sysNetgear.c"
#endif /* INCLUDE_PCCARD_NETGEAR_END */
#ifdef INCLUDE_PCCARD_INTPR_END
#define WLAN_DEFAULT_BYTE_ORDER _LITTLE_ENDIAN
#define SYS_INTPR_IO_OFFSET (0)
#define SYS_INTPR_IRQ_TO_INUM(irq) (irq)
#define SYS_INTPR_INT_CONNECT sysCardbusIntConnect
#define SYS_INTPR_INT_DISCONNECT sysCardbusIntDisconnect
#define SYS_INTPR_INT_ENABLE pciDeviceIntEnable
#define SYS_INTPR_INT_DISABLE pciDeviceIntDisable
#include "pccard/enablers/sysIntPrEnd.c"
#endif /* INCLUDE_PCCARD_INTPR_END */
#if (defined(INCLUDE_PCCARD_ATA) || defined (INCLUDE_PCCARD_ELT_3C589_END) || \
defined (INCLUDE_PCCARD_NE2K_END))
#include "sysUtil.c"
#endif
/* defines */
/* globals */
#ifdef INCLUDE_PCCARD_ATA
#include "drv/hdisk/ataDrv.h"
/*
* The first member in the ATA_TYPE struct has a dual purpose.
* 1) If cylinders == 0, the device location is not probed at startup.
* 2) If cylinders |= 0, the device location is probed, and if a device
* is found, the driver will fill in the first 3 member of the struct
* with number of cylinders, number of heads, and sectors per track.
*
* The last 2 members of the struct are static and should not be changed.
*
* The ATA_TYPE struct has the following layout:
* int cylinders;
* int heads;
* int sectorsTrack;
* int bytesSector;
* int precomp;
*
* NOTE: If configType == ATA_GEO_FORCE, the user needs to fill in
* values for cylinders, heads, and sectorsTrack.
*/
ATA_TYPE ataTypes [ATA_MAX_CTRLS][ATA_MAX_DRIVES] =
{
{
{1, 0, 0, 512, 0xFF}, /* controller 0, drive 0 */
},
{
{1, 0, 0, 512, 0xFF}, /* controller 1, drive 0 */
}
};
ATA_RESOURCE ataResources[ATA_MAX_CTRLS];
#endif /* INCLUDE_ATA */
LOCAL YENTA_DRIVER pci1420SSDriver;
LOCAL UINT32 pci142016BitIoResource[] =
{
PCI_IO_BASE, /* Base I/O */
0x00001000 /* 4K Bytes */
};
LOCAL UINT32 pci142016BitMemResource[] =
{
PCI_MEM_BASE, /* Base Mem */
0x00040000 /* 256 KB */
};
/***********************************************************************
*
* sysCardbusIntConnect - Socket interrupt connection
*
* This routine connects an interrupt handler to a Cardbus
* interrupt. Also used for the socket status change interrupt.
*
* RETURNS: OK or ERROR
*/
STATUS sysCardbusIntConnect
(
VOIDFUNCPTR * vector,
VOIDFUNCPTR routine,
int parameter
)
{
return pciDeviceIntConnect((int)vector, (VOIDFUNCPTR *)routine, parameter);
}
/***********************************************************************
*
* sysCardbusIntDisconnect - Disconnect socket interrupt
*
* This routine disconnects an interrupt handler from a Cardbus
* interrupt. Also used for the socket status change interrupt.
*
* RETURNS: OK or ERROR
*/
STATUS sysCardbusIntDisconnect
(
VOIDFUNCPTR * vector,
VOIDFUNCPTR routine,
int parameter
)
{
return pciDeviceIntDisconnect2((int)vector, (VOIDFUNCPTR *)routine, parameter);
}
/***********************************************************************
*
* sysCardbusIntEnable - Socket interrupt enable
*
* This routine enables the Cardbus interrupt. Also used for the socket
* status change interrupt.
*
* RETURNS: OK or ERROR
*/
STATUS sysCardbusIntEnable
(
int intNum
)
{
pciDeviceIntEnable (intNum);
return OK;
}
/***********************************************************************
*
* sysPccardMemOffset - Return PC Card memory space offset
*
* Returns the offset needed to access PC Card memory space. Card
* Services will add this offset before accessing PC Card attribute
* memory. When the socket controller is PCI based, this will normally
* return the offset of PCI non-prefetchable memory space.
*
* This returns 0 as there is a 1-to-1 mapping of PCI space on this
* platform.
*
* RETURNS: 0, always
*/
int sysPccardMemOffset ()
{
return 0;
}
/***********************************************************************
*
* sys16BitIoPoolAdd - Add 16-bit IO space to resource pool
*
* This is called by Card Services to add memory to the 16-bit IO space
* pool.
*
* RETURNS: N/A
*/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -