usbIsaLib.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:4k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* usbIsaLib.h - System-specific ISA Functions */
  2. /* Copyright 2000-2001 Wind River Systems, Inc. */
  3. /*
  4. Modification history
  5. --------------------
  6. 01c,21aug01,hdn  added PENTIUM2/3/4 support
  7. 01b,17mar00,rcb  Change name of #include from "i8237dma.h" to
  8.  "i8237Dma.h" to reflect case-sensitive nature of
  9.  filenames on unix build platforms.
  10. 01a,11aug99,rcb  First.
  11. */
  12. /*
  13. DESCRIPTION
  14. This file defines platform-independent functions accessing ISA bus 
  15. capabilities.  These functions allow ISA device drivers to be written 
  16. independent of the underlying O/S's ISA access mechanisms.
  17. */
  18. #ifndef __INCusbIsaLibh
  19. #define __INCusbIsaLibh
  20. /* Includes */
  21. #include "ioLib.h"     /* defines O_RDONLY/O_WRONLY */
  22. #include "usb/usbPciLib.h"
  23. /* defines */
  24. /* Define USE_PCI_INT_FUNCS to map USB_ISA_INT_CONNECT() and 
  25.  * USB_ISA_INT_RESTORE() to the corresponding functions in usbPciLib.c.
  26.  * The PCI functions have the advantage that they define both an
  27.  * "intConnect()" as well as an "intDisconnect()" function, allowing
  28.  * interrupts to be unhooked effectively.
  29.  */
  30. #define USE_PCI_INT_FUNCS
  31. /* platform-dependent definitions */
  32. #if (CPU_FAMILY==I80X86)
  33. /* Pentium (e.g, PC Pentium) */
  34. /* The 8237 DMA controller is enabled using a function called dmaSetup().
  35.  * A prototype for this function exists in the vxWorks header file below.
  36.  */
  37. #include "drv/dma/i8237Dma.h"
  38. #define DMA_SETUP(direction, pAddr, nBytes, chan) 
  39.     dmaSetup (direction, pAddr, nBytes, chan)
  40. /* Unknown platform */
  41. #else
  42. #warning    "Unknown platform. Must create platform mapping in usbIsaLib.h."
  43. #define DMA_SETUP(direction, pAddr, nBytes, chan)   (OK)
  44. #endif /* #if CPU == xxxx */
  45. #ifdef __cplusplus
  46. extern "C" {
  47. #endif
  48. /* typedefs */
  49. /* I/O functions */
  50. #define USB_ISA_BYTE_IN(address)     USB_PCI_BYTE_IN(address)
  51. #define USB_ISA_BYTE_OUT(address, value)    USB_PCI_BYTE_OUT(address, value)
  52. /* memory mapping functions */
  53. #define USB_MEM_TO_ISA(pMem)     USB_MEM_TO_PCI(pMem)
  54. #define USB_ISA_TO_MEM(isaAdrs)      USB_PCI_TO_MEM(isaAdrs)
  55. /* cache functions */
  56. #define USB_ISA_MEM_FLUSH(pMem, size)     USB_PCI_MEM_FLUSH(pMem, size)
  57. #define USB_ISA_MEM_INVALIDATE(pMem, size)  USB_PCI_MEM_INVALIDATE(pMem, size)
  58. /* interrupt functions */
  59. #ifdef USE_PCI_INT_FUNCS
  60. #define USB_ISA_INT_CONNECT(func, param, intNo) 
  61.     usbPciIntConnect (func, param, intNo)
  62. #define USB_ISA_INT_RESTORE(func, param, intNo)     
  63.     usbPciIntRestore (func, param, intNo)
  64. #else
  65. #define USB_ISA_INT_CONNECT(func, param, intNo) 
  66.     usbIsaIntConnect (func, param, intNo)
  67. #define USB_ISA_INT_RESTORE(func, param, intNo)     
  68.     usbIsaIntRestore (func, param, intNo)
  69. #endif /* #ifdef USE_PCI_INT_FUNCS */
  70. /* DMA functions 
  71.  *
  72.  * NOTE: WRS convention for DMA transfer is that a "read from memory"
  73.  * by the DMAC (what we call DMA_MEM_READ) is actually the direction
  74.  * O_WRONLY. 
  75.  */
  76. #define DMA_MEM_READ 0
  77. #define DMA_MEM_WRITE 1
  78. #define USB_ISA_DMA_SETUP(direction, isaAdrs, bfrLen, channel) 
  79.     DMA_SETUP ((direction == DMA_MEM_READ) ? O_WRONLY : O_RDONLY, 
  80. (void *) isaAdrs, bfrLen, channel)
  81. #ifndef USE_PCI_INT_FUNCS
  82. /* function prototypes */
  83. STATUS usbIsaIntConnect
  84.     (
  85.     INT_HANDLER_PROTOTYPE func,     /* new interrupt handler */
  86.     pVOID param,     /* parameter for int handler */
  87.     UINT16 intNo     /* interrupt vector number */
  88.     );
  89. VOID usbIsaIntRestore
  90.     (
  91.     INT_HANDLER_PROTOTYPE func,     /* int handler to be removed */
  92.     pVOID param,     /* parameter for int handler */
  93.     UINT16 intNo     /* interrupt vector number */
  94.     );
  95. #endif /* #ifndef USE_PCI_INT_FUNCS */
  96. #ifdef __cplusplus
  97. }
  98. #endif
  99. #endif /* __INCusbIsaLibh */
  100. /* End of file. */