LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cpu_def.h
Go to the documentation of this file.
1 /*
2 *********************************************************************************************************
3 * uC/CPU
4 * CPU CONFIGURATION & PORT LAYER
5 *
6 * (c) Copyright 2004-2011; Micrium, Inc.; Weston, FL
7 *
8 * All rights reserved. Protected by international copyright laws.
9 *
10 * uC/CPU is provided in source form to registered licensees ONLY. It is
11 * illegal to distribute this source code to any third party unless you receive
12 * written permission by an authorized Micrium representative. Knowledge of
13 * the source code may NOT be used to develop a similar product.
14 *
15 * Please help us continue to provide the Embedded community with the finest
16 * software available. Your honesty is greatly appreciated.
17 *
18 * You can contact us at www.micrium.com.
19 *********************************************************************************************************
20 */
21 
22 /*
23 *********************************************************************************************************
24 *
25 * CPU CONFIGURATION DEFINES
26 *
27 * Filename : cpu_def.h
28 * Version : V1.28.00
29 * Programmer(s) : ITJ
30 *********************************************************************************************************
31 */
32 
33 
34 /*
35 *********************************************************************************************************
36 * MODULE
37 *********************************************************************************************************
38 */
39 
40 #ifndef CPU_DEF_MODULE_PRESENT
41 #define CPU_DEF_MODULE_PRESENT
42 
43 
44 /*
45 *********************************************************************************************************
46 * CPU WORD CONFIGURATION
47 *
48 * Note(s) : (1) Configure CPU_CFG_ADDR_SIZE & CPU_CFG_DATA_SIZE in 'cpu.h' with CPU's word sizes :
49 *
50 * CPU_WORD_SIZE_08 8-bit word size
51 * CPU_WORD_SIZE_16 16-bit word size
52 * CPU_WORD_SIZE_32 32-bit word size
53 * CPU_WORD_SIZE_64 64-bit word size
54 *
55 * (2) Configure CPU_CFG_ENDIAN_TYPE in 'cpu.h' with CPU's data-word-memory order :
56 *
57 * (a) CPU_ENDIAN_TYPE_BIG Big- endian word order (CPU words' most significant
58 * octet @ lowest memory address)
59 * (b) CPU_ENDIAN_TYPE_LITTLE Little-endian word order (CPU words' least significant
60 * octet @ lowest memory address)
61 *********************************************************************************************************
62 */
63 
64  /* ---------------------- CPU WORD SIZE ----------------------- */
65 #define CPU_WORD_SIZE_08 1u /* 8-bit word size (in octets). */
66 #define CPU_WORD_SIZE_16 2u /* 16-bit word size (in octets). */
67 #define CPU_WORD_SIZE_32 4u /* 32-bit word size (in octets). */
68 #define CPU_WORD_SIZE_64 8u /* 64-bit word size (in octets). */
69 
70 
71  /* ------------------ CPU WORD-ENDIAN ORDER ------------------- */
72 #define CPU_ENDIAN_TYPE_NONE 0u
73 #define CPU_ENDIAN_TYPE_BIG 1u /* Big- endian word order (see Note #1a). */
74 #define CPU_ENDIAN_TYPE_LITTLE 2u /* Little-endian word order (see Note #1b). */
75 
76 
77 /*
78 *********************************************************************************************************
79 * CPU STACK CONFIGURATION
80 *
81 * Note(s) : (1) Configure CPU_CFG_STK_GROWTH in 'cpu.h' with CPU's stack growth order :
82 *
83 * (a) CPU_STK_GROWTH_LO_TO_HI CPU stack pointer increments to the next higher stack
84 * memory address after data is pushed onto the stack
85 * (b) CPU_STK_GROWTH_HI_TO_LO CPU stack pointer decrements to the next lower stack
86 * memory address after data is pushed onto the stack
87 *********************************************************************************************************
88 */
89 
90  /* ------------------ CPU STACK GROWTH ORDER ------------------ */
91 #define CPU_STK_GROWTH_NONE 0u
92 #define CPU_STK_GROWTH_LO_TO_HI 1u /* CPU stk incs towards higher mem addrs (see Note #1a). */
93 #define CPU_STK_GROWTH_HI_TO_LO 2u /* CPU stk decs towards lower mem addrs (see Note #1b). */
94 
95 
96 /*$PAGE*/
97 /*
98 *********************************************************************************************************
99 * CRITICAL SECTION CONFIGURATION
100 *
101 * Note(s) : (1) Configure CPU_CFG_CRITICAL_METHOD with CPU's/compiler's critical section method :
102 *
103 * Enter/Exit critical sections by ...
104 *
105 * CPU_CRITICAL_METHOD_INT_DIS_EN Disable/Enable interrupts
106 * CPU_CRITICAL_METHOD_STATUS_STK Push/Pop interrupt status onto stack
107 * CPU_CRITICAL_METHOD_STATUS_LOCAL Save/Restore interrupt status to local variable
108 *
109 * (a) CPU_CRITICAL_METHOD_INT_DIS_EN is NOT a preferred method since it does NOT support
110 * multiple levels of interrupts. However, with some CPUs/compilers, this is the only
111 * available method.
112 *
113 * (b) CPU_CRITICAL_METHOD_STATUS_STK is one preferred method since it supports multiple
114 * levels of interrupts. However, this method assumes that the compiler provides C-level
115 * &/or assembly-level functionality for the following :
116 *
117 * ENTER CRITICAL SECTION :
118 * (1) Push/save interrupt status onto a local stack
119 * (2) Disable interrupts
120 *
121 * EXIT CRITICAL SECTION :
122 * (3) Pop/restore interrupt status from a local stack
123 *
124 * (c) CPU_CRITICAL_METHOD_STATUS_LOCAL is one preferred method since it supports multiple
125 * levels of interrupts. However, this method assumes that the compiler provides C-level
126 * &/or assembly-level functionality for the following :
127 *
128 * ENTER CRITICAL SECTION :
129 * (1) Save interrupt status into a local variable
130 * (2) Disable interrupts
131 *
132 * EXIT CRITICAL SECTION :
133 * (3) Restore interrupt status from a local variable
134 *
135 * (2) Critical section macro's most likely require inline assembly. If the compiler does NOT
136 * allow inline assembly in C source files, critical section macro's MUST call an assembly
137 * subroutine defined in a 'cpu_a.asm' file located in the following software directory :
138 *
139 * <CPU-Compiler Directory><cpu><compiler>\
140 *
141 * where
142 * <CPU-Compiler Directory> directory path for common CPU-compiler software
143 * <cpu> directory name for specific CPU
144 * <compiler> directory name for specific compiler
145 *
146 * (3) (a) To save/restore interrupt status, a local variable 'cpu_sr' of type 'CPU_SR' MAY need
147 * to be declared (e.g. if 'CPU_CRITICAL_METHOD_STATUS_LOCAL' method is configured).
148 *
149 * (1) 'cpu_sr' local variable SHOULD be declared via the CPU_SR_ALLOC() macro which,
150 * if used, MUST be declared following ALL other local variables (see any 'cpu.h
151 * CRITICAL SECTION CONFIGURATION Note #3a1').
152 *
153 * Example :
154 *
155 * void Fnct (void)
156 * {
157 * CPU_INT08U val_08;
158 * CPU_INT16U val_16;
159 * CPU_INT32U val_32;
160 * CPU_SR_ALLOC(); MUST be declared after ALL other local variables
161 * :
162 * :
163 * }
164 *
165 * (b) Configure 'CPU_SR' data type with the appropriate-sized CPU data type large enough to
166 * completely store the CPU's/compiler's status word.
167 *********************************************************************************************************
168 */
169 
170  /* --------------- CPU CRITICAL SECTION METHODS --------------- */
171 #define CPU_CRITICAL_METHOD_NONE 0u /* */
172 #define CPU_CRITICAL_METHOD_INT_DIS_EN 1u /* DIS/EN ints (see Note #1a). */
173 #define CPU_CRITICAL_METHOD_STATUS_STK 2u /* Push/Pop int status onto stk (see Note #1b). */
174 #define CPU_CRITICAL_METHOD_STATUS_LOCAL 3u /* Save/Restore int status to local var (see Note #1c). */
175 
176 
177 /*$PAGE*/
178 /*
179 *********************************************************************************************************
180 * MODULE END
181 *********************************************************************************************************
182 */
183 
184 #endif /* End of CPU definition module include. */
185