cpu_def.h
上传用户:yj_qqy
上传日期:2017-01-28
资源大小:2911k
文件大小:8k
源码类别:

uCOS

开发平台:

C/C++

  1. /*
  2. *********************************************************************************************************
  3. *                                               uC/CPU
  4. *                                    CPU CONFIGURATION & PORT LAYER
  5. *
  6. *                          (c) Copyright 2004-2008; Micrium, Inc.; Weston, FL
  7. *
  8. *               All rights reserved.  Protected by international copyright laws.
  9. *
  10. *               uC/CPU is provided in source form for FREE evaluation, for educational
  11. *               use or peaceful research.  If you plan on using uC/CPU in a commercial
  12. *               product you need to contact Micrium to properly license its use in your
  13. *               product.  We provide ALL the source code for your convenience and to
  14. *               help you experience uC/CPU.  The fact that the source code is provided
  15. *               does NOT mean that you can use it without paying a licensing fee.
  16. *
  17. *               Knowledge of the source code may NOT be used to develop a similar product.
  18. *
  19. *               Please help us continue to provide the Embedded community with the finest
  20. *               software available.  Your honesty is greatly appreciated.
  21. *********************************************************************************************************
  22. */
  23. /*
  24. *********************************************************************************************************
  25. *
  26. *                                      CPU CONFIGURATION DEFINES
  27. *
  28. * Filename      : cpu_def.h
  29. * Version       : V1.19
  30. * Programmer(s) : ITJ
  31. *********************************************************************************************************
  32. */
  33. /*
  34. *********************************************************************************************************
  35. *                                       CPU WORD CONFIGURATION
  36. *
  37. * Note(s) : (1) Configure CPU_CFG_ADDR_SIZE & CPU_CFG_DATA_SIZE in 'cpu.h' with CPU's word sizes :
  38. *
  39. *                   CPU_WORD_SIZE_08             8-bit word size
  40. *                   CPU_WORD_SIZE_16            16-bit word size
  41. *                   CPU_WORD_SIZE_32            32-bit word size
  42. *                   CPU_WORD_SIZE_64            64-bit word size            See Note #1a
  43. *
  44. *               (a) 64-bit word size NOT currently supported.
  45. *
  46. *               (b) Ideally, CPU_WORD_SIZE #define's would be calculated at compile-time through use of
  47. *                   the sizeof() operator.  However, some compilers do NOT allow pre-processor directives
  48. *                   to include run-time macro's -- e.g. 'sizeof()'.
  49. *
  50. *           (2) Configure CPU_CFG_ENDIAN_TYPE in 'cpu.h' with CPU's data-word-memory order :
  51. *
  52. *                   CPU_ENDIAN_TYPE_BIG         Big-   endian word order (CPU words' most  significant
  53. *                                                                         octet @ lowest memory address)
  54. *                   CPU_ENDIAN_TYPE_LITTLE      Little-endian word order (CPU words' least significant
  55. *                                                                         octet @ lowest memory address)
  56. *********************************************************************************************************
  57. */
  58.                                                         /* ----------------------- CPU WORD SIZE ---------------------- */
  59. #define  CPU_WORD_SIZE_08                          1    /*  8-bit word size = sizeof(CPU_INT08x).                       */
  60. #define  CPU_WORD_SIZE_16                          2    /* 16-bit word size = sizeof(CPU_INT16x).                       */
  61. #define  CPU_WORD_SIZE_32                          4    /* 32-bit word size = sizeof(CPU_INT32x).                       */
  62. #define  CPU_WORD_SIZE_64                          8    /* 64-bit word size = sizeof(CPU_INT64x) [see Note #1a].        */
  63.                                                         /* ------------------- CPU WORD-ENDIAN ORDER ------------------ */
  64. #define  CPU_ENDIAN_TYPE_NONE                      0    /*                                                              */
  65. #define  CPU_ENDIAN_TYPE_BIG                       1    /* Big-   endian word order (CPU words' most  significant ...   */
  66.                                                         /*                           ... octet @ lowest mem addr).      */
  67. #define  CPU_ENDIAN_TYPE_LITTLE                    2    /* Little-endian word order (CPU words' least significant ...   */
  68.                                                         /*                           ... octet @ lowest mem addr).      */
  69. /*$PAGE*/
  70. /*
  71. *********************************************************************************************************
  72. *                                   CRITICAL SECTION CONFIGURATION
  73. *
  74. * Note(s) : (1) Configure CPU_CFG_CRITICAL_METHOD with CPU's/compiler's critical section method :
  75. *
  76. *                                                       Enter/Exit critical sections by ...
  77. *
  78. *                   CPU_CRITICAL_METHOD_INT_DIS_EN      Disable/Enable interrupts
  79. *                   CPU_CRITICAL_METHOD_STATUS_STK      Push/Pop       interrupt status onto stack
  80. *                   CPU_CRITICAL_METHOD_STATUS_LOCAL    Save/Restore   interrupt status to local variable
  81. *
  82. *               (a) CPU_CRITICAL_METHOD_INT_DIS_EN  is NOT a preferred method since it does NOT support
  83. *                   multiple levels of interrupts.  However, with some CPUs/compilers, this is the only
  84. *                   available method.
  85. *
  86. *               (b) CPU_CRITICAL_METHOD_STATUS_STK    is one preferred method since it DOES support multiple
  87. *                   levels of interrupts.  However, this method assumes that the compiler allows in-line
  88. *                   assembly AND will correctly modify the local stack pointer when interrupt status is
  89. *                   pushed/popped onto the stack.
  90. *
  91. *               (c) CPU_CRITICAL_METHOD_STATUS_LOCAL  is one preferred method since it DOES support multiple
  92. *                   levels of interrupts.  However, this method assumes that the compiler provides C-level
  93. *                   &/or assembly-level functionality for the following :
  94. *
  95. *                     ENTER CRITICAL SECTION :
  96. *                       (a) Save    interrupt status into a local variable
  97. *                       (b) Disable interrupts
  98. *
  99. *                     EXIT  CRITICAL SECTION :
  100. *                       (c) Restore interrupt status from a local variable
  101. *
  102. *           (2) Critical section macro's most likely require inline assembly.  If the compiler does NOT
  103. *               allow inline assembly in C source files, critical section macro's MUST call an assembly
  104. *               subroutine defined in a 'cpu_a.asm' file located in the following software directory :
  105. *
  106. *                   <CPU-Compiler Directory><cpu><compiler>
  107. *
  108. *                       where
  109. *                               <CPU-Compiler Directory>    directory path for common   CPU-compiler software
  110. *                               <cpu>                       directory name for specific CPU
  111. *                               <compiler>                  directory name for specific compiler
  112. *
  113. *           (3) To save/restore interrupt status, a local variable 'cpu_sr' of type 'CPU_SR' MAY need to
  114. *               be declared (e.g. if 'CPU_CRITICAL_METHOD_STATUS_LOCAL' method is configured).  Configure
  115. *               'CPU_SR' data type in 'cpu.h' with the appropriate-sized CPU data type large enough to
  116. *               completely store the CPU's/compiler's status word.
  117. *********************************************************************************************************
  118. */
  119.                                                         /* --------------- CPU CRITICAL SECTION METHODS --------------- */
  120. #define  CPU_CRITICAL_METHOD_NONE                  0    /*                                                              */
  121. #define  CPU_CRITICAL_METHOD_INT_DIS_EN            1    /* DIS/EN       ints.                                           */
  122. #define  CPU_CRITICAL_METHOD_STATUS_STK            2    /* Push/Pop     int status onto stk.                            */
  123. #define  CPU_CRITICAL_METHOD_STATUS_LOCAL          3    /* Save/Restore int status to local var.                        */