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

VxWorks

开发平台:

C/C++

  1. /* templateSio.h - header file for template serial driver */
  2. /* Copyright 1984-2002 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01f,26apr02,dat  Adding cplusplus protection, SPR 75017
  7. 01e,29sep01,dat  Rework for adaptor type struct, new API is just
  8.  create and destroy.
  9. 01d,01jul97,db added registers and defines for modem control. 
  10. 01c,24feb97,dat  used SIO_CHAN as first structure element,
  11. instead of SIO_DRV_FUNCS *.
  12. 01b,17dec96,dat added 'options' to chan structure.
  13. 01a,02aug95,ms  written.
  14. */
  15. #ifndef __INCtemplateSioh
  16. #define __INCtemplateSioh
  17. #include "sioLib.h"
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. /*
  22.  * This driver for a generic SIO device only uses 8 bit reads/writes.
  23.  * These are the register offsets for our fictitious device.
  24.  *
  25.  * Control Register   0x0 (write)
  26.  * Status Register   0x0 (read)
  27.  * Data register 0x1 (read/write)
  28.  * Modem Status Register 0x2 (read)
  29.  * Modem Control Register 0x2 (write)
  30.  * Baud Rate Control Reg.       0x3 (read/write)
  31.  *
  32.  * The template driver uses 3 interrupt vectors.
  33.  * Receive Interrupt 0x0
  34.  * Transmit Interrupt 0x1
  35.  * Error/Modem Interrupt 0x2
  36.  *
  37.  * Other adaptor functions used include:
  38.  * intConnect, intDisconnect.
  39.  */
  40. #define TEMPLATE_CSR_ID 0x0 /* register offsets */
  41. #define TEMPLATE_DATA_ID 0x1
  42. #define TEMPLATE_MSR_ID 0x2
  43. #define TEMPLATE_BAUD_ID 0x3
  44. #define TEMPLATE_RXINT_ID 0x0 /* vector offsets */
  45. #define TEMPLATE_TXINT_ID 0x1
  46. #define TEMPLATE_ERRINT_ID 0x2
  47. /*
  48.  * Here is the real API for creating and destroying an instance of a template
  49.  * SIO device.  Use the standard sioLib functions
  50.  * for manipulating the device.  The only really device specific
  51.  * functions are for creation and destruction.
  52.  */
  53. IMPORT SIO_CHAN * templateSioCreate /* create an instance */
  54. (
  55. UINT32 ioBase, /* device adaptor specific data */
  56. UINT32 vecBase, /* vector base number */
  57. UINT32 intLevel, /* interrupt level for vectors */
  58. UINT32 clkFreq /* device clock frequency */
  59. );
  60. IMPORT STATUS templateSioDestroy /* destroy an instance */
  61. (SIO_CHAN *); /* must be a template SIO type object */
  62. #ifdef __cplusplus
  63. }
  64. #endif
  65. #endif  /* __INCtemplateSioh */