LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
os_csp.c
Go to the documentation of this file.
1 /*
2 ************************************************************************************************************************
3 * uC/OS-III
4 * The Real-Time Kernel
5 *
6 *
7 * (c) Copyright 2009, Micrium, Weston, FL
8 * All Rights Reserved
9 *
10 * ARM Cortex M3 OS Chip Support
11 * Generic
12 *
13 * File : OS_CPU.C
14 * Version : V3.01.1
15 * By : JJL
16 * FT
17 * For : ARMv7M Cortex-M3
18 * Mode : Thumb2
19 ************************************************************************************************************************
20 */
21 
22 #define OS_CSP_GLOBALS
23 #include <os.h>
24 #include <csp.h>
25 
26 
27 /*$PAGE*/
28 /*
29 *********************************************************************************************************
30 * LOCAL DEFINES
31 *********************************************************************************************************
32 */
33 
34 
35 /*
36 *********************************************************************************************************
37 * LOCAL CONSTANTS
38 *********************************************************************************************************
39 */
40 
41 
42 /*
43 *********************************************************************************************************
44 * LOCAL DATA TYPES
45 *********************************************************************************************************
46 */
47 
48 
49 /*
50 *********************************************************************************************************
51 * LOCAL TABLES
52 *********************************************************************************************************
53 */
54 
55 
56 /*
57 *********************************************************************************************************
58 * LOCAL GLOBAL VARIABLES
59 *********************************************************************************************************
60 */
61 
62 
63 /*
64 *********************************************************************************************************
65 * LOCAL FUNCTION PROTOTYPES
66 *********************************************************************************************************
67 */
68 
69 
70 /*
71 *********************************************************************************************************
72 * LOCAL CONFIGURATION ERRORS
73 *********************************************************************************************************
74 */
75 
76 
77 
78 /*$PAGE*/
79 /*
80 ************************************************************************************************************************
81 * INITIALIZE TICKER INTERRUPT
82 *
83 * Description: Initialize the the Tick Interrupt.
84 *
85 * Arguments : none.
86 *
87 * Note(s) : (1) This function MUST be called after OSStart() & after processor initialization.
88 ************************************************************************************************************************
89 */
90 
91 void OS_CSP_TickInit (void)
92 {
93  CPU_INT32U cnts;
94  CPU_INT32U cpu_freq;
95 
96 
97  cpu_freq = CSP_PM_CPU_ClkFreqGet(); /* Get the CPU clock */
98  cnts = (cpu_freq / OSCfg_TickRate_Hz); /* Calculate the number of SysTick counts */
99 
100  OS_CPU_SysTickInit(cnts); /* Call the Generic OS Systick initialization */
101 }
102 
103 
104 /*$PAGE*/
105 /*
106 ************************************************************************************************************************
107 * INTERRUPT CONTROLLER HANDLER
108 *
109 * Description: Handles all Cortex M3 NVIC's external sources interrupts
110 *
111 * Arguments : none.
112 *
113 * Note(s) : none.
114 ************************************************************************************************************************
115 */
116 
117 void OS_CPU_IntHandler (void)
118 {
119  CPU_SR_ALLOC();
120 
121 
122  CPU_CRITICAL_ENTER(); /* Tell the OS that we are starting an ISR */
123 
124  OSIntEnter();
125 
127 
128  CSP_IntHandler(); /* Call the generic CSP interrupt handler. */
129 
130  OSIntExit(); /* Tell the OS that we are leaving the ISR */
131 }
132