📄 os_cpu_c.lst
字号:
##############################################################################
# #
# IAR ARM ANSI C/C++ Compiler V4.42A/W32 EVALUATION 12/Dec/2008 17:14:25 #
# Copyright 1999-2005 IAR Systems. All rights reserved. #
# #
# Cpu mode = arm #
# Endian = little #
# Stack alignment = 4 #
# Source file = E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uCOS-II #
# \cpu\os_cpu_c.c #
# Command line = E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uCOS-II #
# \cpu\os_cpu_c.c -lCN E:\IAR_2478\IAR_2478\26uCOS\Src #
# \uCOS\RAM_Debug\List\ -o E:\IAR_2478\IAR_2478\26uCOS #
# \Src\uCOS\RAM_Debug\Obj\ -z2 --no_cse --no_unroll #
# --no_inline --no_code_motion --no_tbaa #
# --no_clustering --no_scheduling --debug --cpu_mode #
# arm --endian little --cpu ARM7TDMI-S --stack_align #
# 4 -e --fpu None --dlib_config "C:\Program Files\IAR #
# Systems\Embedded Workbench 4.0 #
# Evaluation\arm\LIB\dl4tpannl8n.h" -I #
# E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\include\ -I #
# E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\ucos-ii\include #
# \ -I "C:\Program Files\IAR Systems\Embedded #
# Workbench 4.0 Evaluation\arm\INC\" #
# List file = E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\RAM_Debug\List\ #
# os_cpu_c.lst #
# Object file = E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\RAM_Debug\Obj\o #
# s_cpu_c.r79 #
# #
# #
##############################################################################
E:\IAR_2478\IAR_2478\26uCOS\Src\uCOS\UCOS-II\uCOS-II\cpu\os_cpu_c.c
1 /*
2 *********************************************************************************************************
3 * uC/OS-II
4 * The Real-Time Kernel
5 *
6 *
7 * (c) Copyright 1992-2007, Micrium, Weston, FL
8 * All Rights Reserved
9 *
10 * Generic ARM Port
11 *
12 * File : OS_CPU_C.C
13 * Version : V1.82
14 * By : Jean J. Labrosse
15 * Jean-Denis Hatier
16 *
17 * For : ARM7 or ARM9
18 * Mode : ARM or Thumb
19 * Toolchain : IAR's EWARM V4.11a and higher
20 *********************************************************************************************************
21 */
22
23 #define OS_CPU_GLOBALS
24 #include <ucos_ii.h>
25
26 #if OS_VIEW_MODULE > 0
27 #include <OS_VIEWc.H>
28 #include <OS_VIEW.H>
29 #endif
30
31 /*$PAGE*/
32 /*
33 *********************************************************************************************************
34 * LOCAL CONSTANTS
35 *
36 * Note(s) : 1) ARM_MODE_ARM is the CPSR bit mask for ARM Mode
37 * 2) ARM_MODE_THUMB is the CPSR bit mask for THUMB Mode
38 * 3) ARM_SVC_MODE_THUMB is the CPSR bit mask for SVC MODE + THUMB Mode
39 * 4) ARM_SVC_MODE_ARM is the CPSR bit mask for SVC MODE + ARM Mode
40 5) OS_NTASKS_FP establishes the number of tasks capable of supporting floating-point. One
41 * task is removed for the idle task because it doesn't do floating-point at all.
42 * 6) OS_FP_STORAGE_SIZE currently allocates 1024 bytes of storage in order to accomodate
43 * thirty-two, single precision 32 bit, or sixteen double precision 64 bit VFP registers.
44 *********************************************************************************************************
45 */
46
47 #define ARM_MODE_ARM 0x00000000
48 #define ARM_MODE_THUMB 0x00000020
49
50 #define ARM_SVC_MODE_THUMB (0x00000013L + ARM_MODE_THUMB)
51 #define ARM_SVC_MODE_ARM (0x00000013L + ARM_MODE_ARM)
52
53 #define OS_NTASKS_FP (OS_MAX_TASKS + OS_N_SYS_TASKS - 1)
54 #define OS_FP_STORAGE_SIZE 128L
55
56 /*
57 *********************************************************************************************************
58 * LOCAL VARIABLES
59 *********************************************************************************************************
60 */
61
62 #if OS_TMR_EN > 0
\ In segment DATA_Z, align 2, align-sorted
63 static INT16U OSTmrCtr;
\ OSTmrCtr:
\ 00000000 DS8 2
64 #endif
65
66 #if OS_CPU_FPU_EN > 0
67 static OS_MEM *OSFPPartPtr; /* Pointer to memory partition for storing FPU registers */
68 static INT32U OSFPPart[OS_NTASKS_FP][OS_FP_STORAGE_SIZE / sizeof(INT32U)];
69 #endif
70
71 /*$PAGE*/
72 /*
73 *********************************************************************************************************
74 * INITIALIZE FP SUPPORT
75 *
76 * Description: This function initializes the memory partition used to save FPU registers
77 * during a context switch. This function MUST be called AFTER calling
78 * OSInit(). OS_CPU_FPU_EN must be defined > 0 in order to compile FPU support into the
79 * build.
80 *
81 * Arguments : none
82 *
83 * Returns : none
84 *
85 * Note(s) : 1) Tasks that are to use FP support MUST be created with OSTaskCreateExt().
86 * 2) For the ARM VFP, 1024 bytes are required to save the VFP context.
87 * The INT32U data type is used to ensure that storage is aligned on a 32-bit boundary.
88 * 3) If you need to perform floating point operations from within the OSStatTaskHook(),
89 * then you must change the 'Options' attribute for OSTaskCreatExt() when creating
90 * the statistics task. This only applies if OS_TaskStat() was created with OSTaskCreateExt().
91 *********************************************************************************************************
92 */
93
94 #if OS_CPU_FPU_EN > 0
95 void OS_CPU_FP_Init (void)
96 {
97 INT8U err;
98 #if OS_TASK_STAT_EN && OS_TASK_CREATE_EXT_EN
99 OS_TCB *ptcb;
100 void *pblk;
101 #endif
102
103
104 OSFPPartPtr = OSMemCreate(&OSFPPart[0][0], OS_NTASKS_FP, OS_FP_STORAGE_SIZE, &err);
105
106 #if OS_TASK_STAT_EN && OS_TASK_CREATE_EXT_EN /* CHANGE 'OPTIONS' for OS_TaskStat() */
107 ptcb = OSTCBPrioTbl[OS_TASK_STAT_PRIO];
108 ptcb->OSTCBOpt |= OS_TASK_OPT_SAVE_FP; /* Allow floating-point support for Statistic task */
109 pblk = OSMemGet(OSFPPartPtr, &err); /* Get storage for VFP registers */
110 if (pblk != (void *)0) { /* Did we get a memory block? */
111 ptcb->OSTCBExtPtr = pblk; /* Yes, Link to task's TCB */
112 OS_CPU_FP_Save(pblk); /* Save the VFP registers in block */
113 }
114 #endif
115 }
116 #endif
117
118 /*
119 *********************************************************************************************************
120 * OS INITIALIZATION HOOK
121 * (BEGINNING)
122 *
123 * Description: This function is called by OSInit() at the beginning of OSInit().
124 *
125 * Arguments : none
126 *
127 * Note(s) : 1) Interrupts should be disabled during this call.
128 *********************************************************************************************************
129 */
130 #if OS_CPU_HOOKS_EN > 0 && OS_VERSION > 203
\ In segment CODE, align 4, keep-with-next
131 void OSInitHookBegin (void)
132 {
133 #if OS_TMR_EN > 0
134 OSTmrCtr = 0;
\ OSInitHookBegin:
\ 00000000 ........ LDR R0,??DataTable4 ;; OSTmrCtr
\ 00000004 0010A0E3 MOV R1,#+0
\ 00000008 B010C0E1 STRH R1,[R0, #+0]
135 #endif
136 }
\ 0000000C 0EF0A0E1 MOV PC,LR ;; return
137 #endif
138
139 /*
140 *********************************************************************************************************
141 * OS INITIALIZATION HOOK
142 * (END)
143 *
144 * Description: This function is called by OSInit() at the end of OSInit().
145 *
146 * Arguments : none
147 *
148 * Note(s) : 1) Interrupts should be disabled during this call.
149 *********************************************************************************************************
150 */
151 #if OS_CPU_HOOKS_EN > 0 && OS_VERSION > 203
\ In segment CODE, align 4, keep-with-next
152 void OSInitHookEnd (void)
153 {
154 #if OS_CPU_INT_DIS_MEAS_EN > 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -