📄 dynamic.lst
字号:
##############################################################################
# #
# IAR MSP430 C/C++ Compiler V3.41A/W32 22/Apr/2006 00:25:14 #
# Copyright 1996-2006 IAR Systems. All rights reserved. #
# #
# __rt_version = 2 #
# __double_size = 32 #
# __reg_r4 = free #
# __reg_r5 = free #
# __pic = no #
# __core = 64kb #
# Source file = C:\MSP430F169_Eval_Port\FreeRTOSv401\Demo\Common\Minim #
# al\dynamic.c #
# Command line = C:\MSP430F169_Eval_Port\FreeRTOSv401\Demo\Common\Minim #
# al\dynamic.c -D ROWLEY_MSP430 -D IAR_MSP430 -lC #
# C:\MSP430F169_Eval_Port\FreeRTOSv401\Debug\List\ -lA #
# C:\MSP430F169_Eval_Port\FreeRTOSv401\Debug\List\ #
# --remarks -o C:\MSP430F169_Eval_Port\FreeRTOSv401\Debu #
# g\Obj\ -s2 --no_cse --no_unroll --no_inline #
# --no_code_motion --no_tbaa --debug -e #
# --migration_preprocessor_extensions --double=32 -I #
# C:\MSP430F169_Eval_Port\FreeRTOSv401\Demo\Common\Inclu #
# de\ -I C:\MSP430F169_Eval_Port\FreeRTOSv401\Source\Inc #
# lude\ -I C:\MSP430F169_Eval_Port\FreeRTOSv401\Demo\MSP #
# 430_IAR\ -I C:\MSP430F169_Eval_Port\FreeRTOSv401\Sourc #
# e\portable\msp430f1611\ -I "C:\Program Files\IAR #
# Systems\Embedded Workbench 4.0\430\INC\" -I #
# "C:\Program Files\IAR Systems\Embedded Workbench #
# 4.0\430\INC\CLIB\" #
# List file = C:\MSP430F169_Eval_Port\FreeRTOSv401\Debug\List\dynami #
# c.lst #
# Object file = C:\MSP430F169_Eval_Port\FreeRTOSv401\Debug\Obj\dynamic #
# .r43 #
# #
# #
##############################################################################
C:\MSP430F169_Eval_Port\FreeRTOSv401\Demo\Common\Minimal\dynamic.c
1 /*
2 FreeRTOS V4.0.1 - Copyright (C) 2003-2006 Richard Barry.
3
4 This file is part of the FreeRTOS distribution.
5
6 FreeRTOS is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 FreeRTOS is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with FreeRTOS; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20 A special exception to the GPL can be applied should you wish to distribute
21 a combined work that includes FreeRTOS, without being obliged to provide
22 the source code for any proprietary components. See the licensing section
23 of http://www.FreeRTOS.org for full details of how and when the exception
24 can be applied.
25
26 ***************************************************************************
27 See http://www.FreeRTOS.org for documentation, latest information, license
28 and contact details. Please ensure to read the configuration and relevant
29 port sections of the online documentation.
30 ***************************************************************************
31 */
32
33 /*
34 * The first test creates three tasks - two counter tasks (one continuous count
35 * and one limited count) and one controller. A "count" variable is shared
36 * between all three tasks. The two counter tasks should never be in a "ready"
37 * state at the same time. The controller task runs at the same priority as
38 * the continuous count task, and at a lower priority than the limited count
39 * task.
40 *
41 * One counter task loops indefinitely, incrementing the shared count variable
42 * on each iteration. To ensure it has exclusive access to the variable it
43 * raises it's priority above that of the controller task before each
44 * increment, lowering it again to it's original priority before starting the
45 * next iteration.
46 *
47 * The other counter task increments the shared count variable on each
48 * iteration of it's loop until the count has reached a limit of 0xff - at
49 * which point it suspends itself. It will not start a new loop until the
50 * controller task has made it "ready" again by calling vTaskResume ().
51 * This second counter task operates at a higher priority than controller
52 * task so does not need to worry about mutual exclusion of the counter
53 * variable.
54 *
55 * The controller task is in two sections. The first section controls and
56 * monitors the continuous count task. When this section is operational the
57 * limited count task is suspended. Likewise, the second section controls
58 * and monitors the limited count task. When this section is operational the
59 * continuous count task is suspended.
60 *
61 * In the first section the controller task first takes a copy of the shared
62 * count variable. To ensure mutual exclusion on the count variable it
63 * suspends the continuous count task, resuming it again when the copy has been
64 * taken. The controller task then sleeps for a fixed period - during which
65 * the continuous count task will execute and increment the shared variable.
66 * When the controller task wakes it checks that the continuous count task
67 * has executed by comparing the copy of the shared variable with its current
68 * value. This time, to ensure mutual exclusion, the scheduler itself is
69 * suspended with a call to vTaskSuspendAll (). This is for demonstration
70 * purposes only and is not a recommended technique due to its inefficiency.
71 *
72 * After a fixed number of iterations the controller task suspends the
73 * continuous count task, and moves on to its second section.
74 *
75 * At the start of the second section the shared variable is cleared to zero.
76 * The limited count task is then woken from it's suspension by a call to
77 * vTaskResume (). As this counter task operates at a higher priority than
78 * the controller task the controller task should not run again until the
79 * shared variable has been counted up to the limited value causing the counter
80 * task to suspend itself. The next line after vTaskResume () is therefore
81 * a check on the shared variable to ensure everything is as expected.
82 *
83 *
84 * The second test consists of a couple of very simple tasks that post onto a
85 * queue while the scheduler is suspended. This test was added to test parts
86 * of the scheduler not exercised by the first test.
87 *
88 */
89
90 #include <stdlib.h>
91
92 /* Scheduler include files. */
93 #include "FreeRTOS.h"
94 #include "task.h"
95 #include "semphr.h"
96
97 /* Demo app include files. */
98 #include "dynamic.h"
99
100 /* Function that implements the "limited count" task as described above. */
101 static portTASK_FUNCTION_PROTO( vLimitedIncrementTask, pvParameters );
102
103 /* Function that implements the "continuous count" task as described above. */
104 static portTASK_FUNCTION_PROTO( vContinuousIncrementTask, pvParameters );
105
106 /* Function that implements the controller task as described above. */
107 static portTASK_FUNCTION_PROTO( vCounterControlTask, pvParameters );
108
109 static portTASK_FUNCTION_PROTO( vQueueReceiveWhenSuspendedTask, pvParameters );
110 static portTASK_FUNCTION_PROTO( vQueueSendWhenSuspendedTask, pvParameters );
111
112 /* Demo task specific constants. */
113 #define priSTACK_SIZE ( ( unsigned portSHORT ) 128 )
114 #define priSLEEP_TIME ( ( portTickType ) 50 )
115 #define priLOOPS ( 5 )
116 #define priMAX_COUNT ( ( unsigned portLONG ) 0xff )
117 #define priNO_BLOCK ( ( portTickType ) 0 )
118 #define priSUSPENDED_QUEUE_LENGTH ( 1 )
119
120 /*-----------------------------------------------------------*/
121
122 /* Handles to the two counter tasks. These could be passed in as parameters
123 to the controller task to prevent them having to be file scope. */
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
124 static xTaskHandle xContinousIncrementHandle, xLimitedIncrementHandle;
\ xContinousIncrementHandle:
\ 000000 DS8 2
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
\ xLimitedIncrementHandle:
\ 000000 DS8 2
125
126 /* The shared counter variable. This is passed in as a parameter to the two
127 counter variables for demonstration purposes. */
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
128 static unsigned portLONG ulCounter;
\ ulCounter:
\ 000000 DS8 4
129
130 /* Variables used to check that the tasks are still operating without error.
131 Each complete iteration of the controller task increments this variable
132 provided no errors have been found. The variable maintaining the same value
133 is therefore indication of an error. */
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
134 static unsigned portSHORT usCheckVariable = ( unsigned portSHORT ) 0;
\ usCheckVariable:
\ 000000 DS8 2
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
135 static portBASE_TYPE xSuspendedQueueSendError = pdFALSE;
\ xSuspendedQueueSendError:
\ 000000 DS8 2
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
136 static portBASE_TYPE xSuspendedQueueReceiveError = pdFALSE;
\ xSuspendedQueueReceiveError:
\ 000000 DS8 2
137
138 /* Queue used by the second test. */
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
139 xQueueHandle xSuspendedTestQueue;
\ xSuspendedTestQueue:
\ 000000 DS8 2
140
141 /*-----------------------------------------------------------*/
142 /*
143 * Start the three tasks as described at the top of the file.
144 * Note that the limited count task is given a higher priority.
145 */
\ In segment CODE, align 2
146 void vStartDynamicPriorityTasks( void )
\ vStartDynamicPriorityTasks:
147 {
148 xSuspendedTestQueue = xQueueCreate( priSUSPENDED_QUEUE_LENGTH, sizeof( unsigned portLONG ) );
\ 000000 2E42 MOV.W #0x4, R14
\ 000002 1C43 MOV.W #0x1, R12
\ 000004 B012.... CALL #xQueueCreate
\ 000008 824C.... MOV.W R12, &xSuspendedTestQueue
149 xTaskCreate( vContinuousIncrementTask, ( signed portCHAR * ) "CNT_INC", priSTACK_SIZE, ( void * ) &ulCounter, tskIDLE_PRIORITY, &xContinousIncrementHandle );
\ 00000C 3012.... PUSH.W #xContinousIncrementHandle
\ 000010 0312 PUSH.W #0x0
\ 000012 3012.... PUSH.W #ulCounter
\ 000016 30128000 PUSH.W #0x80
\ 00001A 3E40.... MOV.W #`?<Constant "CNT_INC">`, R14
\ 00001E 3C40.... MOV.W #vContinuousIncrementTask, R12
\ 000022 B012.... CALL #xTaskCreate
150 xTaskCreate( vLimitedIncrementTask, ( signed portCHAR * ) "LIM_INC", priSTACK_SIZE, ( void * ) &ulCounter, tskIDLE_PRIORITY + 1, &xLimitedIncrementHandle );
\ 000026 3012.... PUSH.W #xLimitedIncrementHandle
\ 00002A 1312 PUSH.W #0x1
\ 00002C 3012.... PUSH.W #ulCounter
\ 000030 30128000 PUSH.W #0x80
\ 000034 3E40.... MOV.W #`?<Constant "LIM_INC">`, R14
\ 000038 3C40.... MOV.W #vLimitedIncrementTask, R12
\ 00003C B012.... CALL #xTaskCreate
151 xTaskCreate( vCounterControlTask, ( signed portCHAR * ) "C_CTRL", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
\ 000040 0312 PUSH.W #0x0
\ 000042 0312 PUSH.W #0x0
\ 000044 0312 PUSH.W #0x0
\ 000046 30128000 PUSH.W #0x80
\ 00004A 3E40.... MOV.W #`?<Constant "C_CTRL">`, R14
\ 00004E 3C40.... MOV.W #vCounterControlTask, R12
\ 000052 B012.... CALL #xTaskCreate
152 xTaskCreate( vQueueSendWhenSuspendedTask, ( signed portCHAR * ) "SUSP_TX", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
\ 000056 0312 PUSH.W #0x0
\ 000058 0312 PUSH.W #0x0
\ 00005A 0312 PUSH.W #0x0
\ 00005C 30128000 PUSH.W #0x80
\ 000060 3E40.... MOV.W #`?<Constant "SUSP_TX">`, R14
\ 000064 3C40.... MOV.W #vQueueSendWhenSuspendedTask, R12
\ 000068 B012.... CALL #xTaskCreate
153 xTaskCreate( vQueueReceiveWhenSuspendedTask, ( signed portCHAR * ) "SUSP_RX", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
\ 00006C 0312 PUSH.W #0x0
\ 00006E 0312 PUSH.W #0x0
\ 000070 0312 PUSH.W #0x0
\ 000072 30128000 PUSH.W #0x80
\ 000076 3E40.... MOV.W #`?<Constant "SUSP_RX">`, R14
\ 00007A 3C40.... MOV.W #vQueueReceiveWhenSuspendedTask, R12
\ 00007E B012.... CALL #xTaskCreate
154 }
\ 000082 31502800 ADD.W #0x28, SP
\ 000086 3041 RET
155 /*-----------------------------------------------------------*/
156
157 /*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -