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

VxWorks

开发平台:

C/C++

  1. /* ambaSio.h - ARM AMBA UART header file */
  2. /* Copyright 1997-2000 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01c,12apr00,jpd  added include of sioLib.h to work with project builds.
  7. 01b,19nov97,jpd  updated comments/documentation in line with latest standards.
  8. 01a,04sep97,jpd  written from st16552Sio.h, version 01c.
  9. */
  10. #ifndef __INCambaSioh 
  11. #define __INCambaSioh 
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. /* Register description OF ARM AMBA UART */
  16. #ifndef _ASMLANGUAGE
  17. #include "vxWorks.h"
  18. #include "sioLib.h"
  19. /* Register offsets from base address */
  20. #define UARTDR 0x00 /* UART data register (R/W) */
  21. #define RXSTAT 0x04 /* Rx data status register (R/O) */
  22. #define UMSEOI 0x04 /* Clr modem status changed int (W/O) */
  23. #define H_UBRLCR 0x08 /* } High middle and low bytes (R/W) */
  24. #define M_UBRLCR 0x0C /* } of bit rate and line (W/O) */
  25. #define L_UBRLCR 0x10 /* } register (W/O) */
  26. #define UARTCON 0x14 /* control register (R/W) */
  27. #define UARTFLG 0x18 /* FIFO status register (R/O) */
  28. /* bit definitions within H_UBRLCR register */
  29. #define PARITY_NONE 0x00 /* set no parity */
  30. #define ONE_STOP 0x00 /* set one stop bit */
  31. #define FIFO_ENABLE 0x10 /* Enable both FIFOs */
  32. #define WORD_LEN_5 (0x00 << 5) /* Set UART word lengths */
  33. #define WORD_LEN_6 (0x01 << 5)
  34. #define WORD_LEN_7 (0x02 << 5)
  35. #define WORD_LEN_8 (0x03 << 5)
  36. /* bit definitions within UARTCON register */
  37. #define UART_ENABLE 0x01 /* Enable the UART */
  38. /* bit definitions within UARTFLG register */
  39. #define FLG_UTXFF (0x01 << 5) /* UART Tx FIFO Full */
  40. #define FLG_URXFE (0x01 << 4) /* UART Rx FIFO Empty */
  41. typedef struct AMBA_CHAN
  42.     {
  43.     /* must be first */
  44.     SIO_CHAN sio; /* standard SIO_CHAN element */
  45.     /* callbacks */
  46.     STATUS (*getTxChar) ();  /* installed Tx callback routine */
  47.     STATUS (*putRcvChar) (); /* installed Rx callback routine */
  48.     void * getTxArg; /* argument to Tx callback routine */
  49.     void * putRcvArg; /* argument to Rx callback routine */
  50.     UINT32 * regs; /* AMBA registers */
  51.     UINT8  levelRx; /* Rx Interrupt level for this device */
  52.     UINT8  levelTx; /* Tx Interrupt level for this device */
  53.     UINT32 channelMode; /* such as INT, POLL modes */
  54.     int baudRate; /* the current baud rate */
  55.     UINT32 xtal; /* UART clock frequency */     
  56.     } AMBA_CHAN;
  57. /* function declarations */
  58. extern void ambaIntTx (AMBA_CHAN *pChan);
  59. extern void ambaIntRx (AMBA_CHAN *pChan);
  60. extern void ambaDevInit (AMBA_CHAN *pChan);
  61. #endif /* _ASMLANGUAGE */
  62. #ifdef __cplusplus
  63. }
  64. #endif
  65.  
  66. #endif /* __INCambaSioh */