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

VxWorks

开发平台:

C/C++

  1. /* m8260Brg.h - Motorola MPC8260 Baud Rate Generators header file */
  2. /* Copyright 1984-1999 Wind River Systems, Inc. */
  3. /*
  4. modification history
  5. --------------------
  6. 01a,12sep99,ms_  created from m8260Cpm.h, 01d.
  7. */
  8. /*
  9.  * This file contains constants for the Baud Rate Generators (BRGs)
  10.  * in the Motorola MPC8260 PowerQUICC II integrated Communications
  11.  * Processor
  12.  */
  13. #ifndef __INCm8260Brgh
  14. #define __INCm8260Brgh
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #ifndef M8260ABBREVIATIONS
  19. #define M8260ABBREVIATIONS
  20. #ifdef  _ASMLANGUAGE
  21. #define CAST(x)
  22. #else /* _ASMLANGUAGE */
  23. typedef volatile UCHAR VCHAR;   /* shorthand for volatile UCHAR */
  24. typedef volatile INT32 VINT32; /* volatile unsigned word */
  25. typedef volatile INT16 VINT16; /* volatile unsigned halfword */
  26. typedef volatile INT8 VINT8;   /* volatile unsigned byte */
  27. typedef volatile UINT32 VUINT32; /* volatile unsigned word */
  28. typedef volatile UINT16 VUINT16; /* volatile unsigned halfword */
  29. typedef volatile UINT8 VUINT8;   /* volatile unsigned byte */
  30. #define CAST(x) (x)
  31. #endif  /* _ASMLANGUAGE */
  32. #endif /* M8260ABBREVIATIONS */
  33. #ifndef M8260_32_WR
  34. #define M8260_32_WR(addr, value) (* ((UINT32 *)(addr)) = ((UINT32) (value)))
  35. #endif
  36. #ifndef M8260_16_WR
  37. #define M8260_16_WR(addr, value) (* ((UINT16 *)(addr)) = ((UINT16) (value)))
  38. #endif
  39. #ifndef M8260_8_WR
  40. #define M8260_8_WR(addr, value) (* ((UINT8 *)(addr)) = ((UINT8) (value)))
  41. #endif
  42. #ifndef M8260_32_RD
  43. #define M8260_32_RD(addr, value) ((value) = (* (UINT32 *) ((UINT32 *)(addr))))
  44. #endif
  45. #ifndef M8260_16_RD
  46. #define M8260_16_RD(addr, value) ((value) = (* (UINT16 *) ((UINT16 *)(addr))))
  47. #endif
  48. #ifndef M8260_8_RD
  49. #define M8260_8_RD(addr, value) ((value) = (* (UINT8 *) ((UINT8 *)(addr))))
  50. #endif
  51. #ifndef M8260_NTH_REG_WR_32
  52. #define M8260_NTH_REG_WR_32(regVal, regBase, offsetNext, n)
  53.     {
  54.     VINT32 *pReg = (VINT32 *) 
  55.     (immrVal + 
  56.     regBase +                 
  57.     ((n-1) * offsetNext));                 
  58.     M8260_32_WR(pReg, regVal);         
  59.     }
  60. #endif
  61. #define M8260_BRGC_WR(value, brgc)                              
  62.    M8260_NTH_REG_WR_32(value,                                   
  63.        M8260_BRGC_BASE,                         
  64.        M8260_BRGC_OFFSET_NEXT_BRGC,             
  65.        brgc)
  66. /*
  67.  * MPC8260 internal register/memory map (section 17 of prelim. spec)
  68.  * note that these are offsets from the value stored in the IMMR
  69.  * register. Also note that in the MPC8260, the IMMR is not a special
  70.  * purpose register, but it is memory mapped.
  71.  */
  72.  
  73. /* Baud Rate Generators */
  74. #define M8260_BRGC_BASE   0x000119F0
  75. #define M8260_BRGC_OFFSET_NEXT_BRGC  0x00000004
  76. #define M8260_BRGC_RD(regVal, brg)                         
  77.     {                                                           
  78.     VINT32 *pReg = (VINT32 *)                                   
  79.             (immrVal +                                          
  80.             M8260_BRGC_BASE +                                   
  81.             ((brg - 1) * M8260_BRGC_OFFSET_NEXT_BRGC));         
  82.     M8260_32_RD(pReg, regVal);                                  
  83.     }
  84. #define M8260_BRGC_SET_BITS(bitmap)
  85.     {
  86.     UINT32 regVal;
  87.     VINT32 *pReg = (VINT32 *) 
  88.     (immrVal + 
  89.     M8260_BRGC_BASE +        
  90.     (scc * M8260_BRGC_OFFSET_NEXT_BRGC));
  91.     M8260_32_RD(pReg, regVal);         
  92.     M8260_32_WR(pReg, (regVal | bitmap));
  93.     }
  94. /* macros used in the configuration registers */
  95. #define M8260_BRGC_CD_MASK      0x00001FFE /* clock divider mask */
  96. #define M8260_BRGC_CD_SHIFT     0x1        /* to shift CD into position */
  97. #define M8260_BRGC_RST          0x00020000 /* Reset BRG */
  98. #define M8260_BRGC_EN           0x00010000 /* Enable BRG count */
  99. #define M8260_BRGC_EXTC_BRGCLK  0x0        /* clock comes from BRGCKL */
  100. #define M8260_BRGC_EXTC_CLK3_9  0x1        /* clock comes from pin 3 or 9 */
  101. #define M8260_BRGC_EXTC_CLK5_15 0x2        /* clock comes from pin 5 or 15 */
  102. #define M8260_BRGC_EXTC_MASK    0x0000C000 /* External Clock Source Mask */
  103. #define M8260_BRGC_EXTC_SHIFT   0xE        /* shift EXTC 14 bits to position */
  104. #define M8260_BRGC_ATB          0x00002000 /* 1 = Autobaud on Rx */
  105.    /* 0 = normal operation */
  106.    #define M8260_BRGC_DIV16        0x00000001 /* BRG Clock divide by 16 */
  107. #ifdef __cplusplus
  108. }
  109. #endif
  110. #endif /* __INCm8260Brgh */