| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
os_cpu.h
Go to the documentation of this file.
1 /*
2 *********************************************************************************************************
3 * uC/OS-III
4 * The Real-Time Kernel
5 *
6 *
7 * (c) Copyright 2009-2010; Micrium, Inc.; Weston, FL
8 * All rights reserved. Protected by international copyright laws.
9 *
10 * ARM Cortex-M0 Port
11 *
12 * File : OS_CPU.H
13 * Version : V3.01.2
14 * By : JJL
15 *
16 * LICENSING TERMS:
17 * ---------------
18 * uC/OS-III is provided in source form to registered licensees ONLY. It is
19 * illegal to distribute this source code to any third party unless you receive
20 * written permission by an authorized Micrium representative. Knowledge of
21 * the source code may NOT be used to develop a similar product.
22 *
23 * Please help us continue to provide the Embedded community with the finest
24 * software available. Your honesty is greatly appreciated.
25 *
26 * You can contact us at www.micrium.com.
27 *
28 * For : ARMv6M Cortex-M0
29 * Mode : Thumb2
30 * Toolchain : IAR Tool chain
31 *********************************************************************************************************
32 */
33
34 #ifndef OS_CPU_H
35 #define OS_CPU_H
36
37 #ifdef OS_CPU_GLOBALS
38 #define OS_CPU_EXT
39 #else
40 #define OS_CPU_EXT extern
41 #endif
42
43 /*
44 *********************************************************************************************************
45 * MACROS
46 *********************************************************************************************************
47 */
48
49 #define OS_TASK_SW() OSCtxSw()
50
51 /*
52 *********************************************************************************************************
53 * TIMESTAMP CONFIGURATION
54 *
55 * Note(s) : (1) OS_TS_GET() is generally defined as CPU_TS_Get32() to allow CPU timestamp timer to be of
56 * any data type size.
57 *
58 * (2) For architectures that provide 32-bit or higher precision free running counters
59 * (i.e. cycle count registers):
60 *
61 * (a) OS_TS_GET() may be defined as CPU_TS_TmrRd() to improve performance when retrieving
62 * the timestamp.
63 *
64 * (b) CPU_TS_TmrRd() MUST be configured to be greater or equal to 32-bits to avoid
65 * truncation of TS.
66 *********************************************************************************************************
67 */
68
69 #if OS_CFG_TS_EN == 1u
70 #define OS_TS_GET() (CPU_TS)CPU_TS_TmrRd() /* See Note #2a. */
71 #else
72 #define OS_TS_GET() (CPU_TS)0u
73 #endif
74
75 #if (CPU_CFG_TS_32_EN == DEF_ENABLED) && \
76 (CPU_CFG_TS_TMR_SIZE < CPU_WORD_SIZE_32)
77 /* CPU_CFG_TS_TMR_SIZE MUST be >= 32-bit (see Note #2b). */
78 #error "cpu_cfg.h, CPU_CFG_TS_TMR_SIZE MUST be >= CPU_WORD_SIZE_32"
79 #endif
80
81
82 /*
83 *********************************************************************************************************
84 * OS TICK INTERRUPT PRIORITY CONFIGURATION
85 *
86 * Note(s) : (1) For systems that don't need any high, real-time priority interrupts; the tick interrupt
87 * should be configured as the highest priority interrupt but won't adversely affect system
88 * operations.
89 *
90 * (2) For systems that need one or more high, real-time interrupts; these should be configured
91 * higher than the tick interrupt which MAY delay execution of the tick interrupt.
92 *
93 * (a) If the higher priority interrupts do NOT continually consume CPU cycles but only
94 * occasionally delay tick interrupts, then the real-time interrupts can successfully
95 * handle their intermittent/periodic events with the system not losing tick interrupts
96 * but only increasing the jitter.
97 *
98 * (b) If the higher priority interrupts consume enough CPU cycles to continually delay the
99 * tick interrupt, then the CPU/system is most likely over-burdened & can't be expected
100 * to handle all its interrupts/tasks. The system time reference gets compromised as a
101 * result of losing tick interrupts.
102 *********************************************************************************************************
103 */
104
105 #define OS_CPU_CFG_SYSTICK_PRIO 0u
106
107 /*
108 *********************************************************************************************************
109 * GLOBAL VARIABLES
110 *********************************************************************************************************
111 */
112
113 OS_CPU_EXT CPU_STK *OS_CPU_ExceptStkBase;
114
115 /*
116 *********************************************************************************************************
117 * FUNCTION PROTOTYPES
118 *********************************************************************************************************
119 */
120
121 void OSCtxSw (void);
122 void OSIntCtxSw (void);
123 void OSStartHighRdy (void);
124
125 void OS_CPU_PendSVHandler (void);
126
127
128 void OS_CPU_SysTickHandler(void);
129 void OS_CPU_SysTickInit (CPU_INT32U cnts);
130
131 #endif