📄 croutine.lst
字号:
##############################################################################
# #
# IAR MSP430 C/C++ Compiler V3.41A/W32 22/Apr/2006 00:25:13 #
# 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\Source\croutine.c #
# Command line = C:\MSP430F169_Eval_Port\FreeRTOSv401\Source\croutine.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\crouti #
# ne.lst #
# Object file = C:\MSP430F169_Eval_Port\FreeRTOSv401\Debug\Obj\croutin #
# e.r43 #
# #
# #
##############################################################################
C:\MSP430F169_Eval_Port\FreeRTOSv401\Source\croutine.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 #include "FreeRTOS.h"
34 #include "task.h"
35 #include "croutine.h"
36
37 /* Lists for ready and blocked co-routines. --------------------*/
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
38 static xList pxReadyCoRoutineLists[ configMAX_CO_ROUTINE_PRIORITIES ]; /*< Prioritised ready co-routines. */
\ pxReadyCoRoutineLists:
\ 000000 DS8 20
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
39 static xList xDelayedCoRoutineList1; /*< Delayed co-routines. */
\ xDelayedCoRoutineList1:
\ 000000 DS8 10
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
40 static xList xDelayedCoRoutineList2; /*< Delayed co-routines (two lists are used - one for delays that have overflowed the current tick count. */
\ xDelayedCoRoutineList2:
\ 000000 DS8 10
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
41 static xList * pxDelayedCoRoutineList; /*< Points to the delayed co-routine list currently being used. */
\ pxDelayedCoRoutineList:
\ 000000 DS8 2
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
42 static xList * pxOverflowDelayedCoRoutineList; /*< Points to the delayed co-routine list currently being used to hold co-routines that have overflowed the current tick count. */
\ pxOverflowDelayedCoRoutineList:
\ 000000 DS8 2
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
43 static xList xPendingReadyList; /*< Holds co-routines that have been readied by an external event. They cannot be added directly to the ready lists as the ready lists cannot be accessed by interrupts. */
\ xPendingReadyList:
\ 000000 DS8 10
44
45 /* Other file private variables. --------------------------------*/
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
46 corCRCB * pxCurrentCoRoutine = NULL;
\ pxCurrentCoRoutine:
\ 000000 DS8 2
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
47 static unsigned portBASE_TYPE uxTopCoRoutineReadyPriority = 0;
\ uxTopCoRoutineReadyPriority:
\ 000000 DS8 2
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
48 static portTickType xCoRoutineTickCount = 0;
\ xCoRoutineTickCount:
\ 000000 DS8 2
49
50 /* The initial state of the co-routine when it is created. */
51 #define corINITIAL_STATE ( 0 )
52
53 /*
54 * Place the co-routine represented by pxCRCB into the appropriate ready queue
55 * for the priority. It is inserted at the end of the list.
56 *
57 * This macro accesses the co-routine ready lists and therefore must not be
58 * used from within an ISR.
59 */
60 #define prvAddCoRoutineToReadyQueue( pxCRCB ) \
61 { \
62 if( pxCRCB->uxPriority > uxTopCoRoutineReadyPriority ) \
63 { \
64 uxTopCoRoutineReadyPriority = pxCRCB->uxPriority; \
65 } \
66 vListInsertEnd( ( xList * ) &( pxReadyCoRoutineLists[ pxCRCB->uxPriority ] ), &( pxCRCB->xGenericListItem ) ); \
67 }
68
69 /*
70 * Utility to ready all the lists used by the scheduler. This is called
71 * automatically upon the creation of the first co-routine.
72 */
73 static void prvInitialiseCoRoutineLists( void );
74
75 /*
76 * Co-routines that are readied by an interrupt cannot be placed directly into
77 * the ready lists (there is no mutual exclusion). Instead they are placed in
78 * in the pending ready list in order that they can later be moved to the ready
79 * list by the co-routine scheduler.
80 */
81 static inline void prvCheckPendingReadyList( void );
82
83 /*
84 * Macro that looks at the list of co-routines that are currently delayed to
85 * see if any require waking.
86 *
87 * Co-routines are stored in the queue in the order of their wake time -
88 * meaning once one co-routine has been found whose timer has not expired
89 * we need not look any further down the list.
90 */
91 static inline void prvCheckDelayedList( void );
92
93 /*-----------------------------------------------------------*/
94
\ In segment CODE, align 2
95 portBASE_TYPE xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode, unsigned portBASE_TYPE uxPriority, unsigned portBASE_TYPE uxIndex )
\ xCoRoutineCreate:
96 {
\ 000000 0A12 PUSH.W R10
\ 000002 0B12 PUSH.W R11
\ 000004 0812 PUSH.W R8
\ 000006 0912 PUSH.W R9
\ 000008 0612 PUSH.W R6
\ 00000A 0A4C MOV.W R12, R10
\ 00000C 0B4E MOV.W R14, R11
\ 00000E 18410C00 MOV.W 0xc(SP), R8
97 portBASE_TYPE xReturn;
98 corCRCB *pxCoRoutine;
99
100 /* Allocate the memory that will store the co-routine control block. */
101 pxCoRoutine = ( corCRCB * ) pvPortMalloc( sizeof( corCRCB ) );
\ 000012 3C401C00 MOV.W #0x1c, R12
\ 000016 B012.... CALL #pvPortMalloc
\ 00001A 064C MOV.W R12, R6
102 if( pxCoRoutine )
\ 00001C 0693 CMP.W #0x0, R6
\ 00001E 3A24 JEQ ??xCoRoutineCreate_0
103 {
104 /* If pxCurrentCoRoutine is NULL then this is the first co-routine to
105 be created and the co-routine data structures need initialising. */
106 if( pxCurrentCoRoutine == NULL )
\ 000020 8293.... CMP.W #0x0, &pxCurrentCoRoutine
\ 000024 0420 JNE ??xCoRoutineCreate_1
107 {
108 pxCurrentCoRoutine = pxCoRoutine;
\ 000026 8246.... MOV.W R6, &pxCurrentCoRoutine
109 prvInitialiseCoRoutineLists();
\ 00002A B012.... CALL #prvInitialiseCoRoutineLists
110 }
111
112 /* Check the priority is within limits. */
113 if( uxPriority >= configMAX_CO_ROUTINE_PRIORITIES )
\ ??xCoRoutineCreate_1:
\ 00002E 2B93 CMP.W #0x2, R11
\ 000030 0128 JNC ??xCoRoutineCreate_2
114 {
115 uxPriority = configMAX_CO_ROUTINE_PRIORITIES - 1;
\ 000032 1B43 MOV.W #0x1, R11
116 }
117
118 /* Fill out the co-routine control block from the function parameters. */
119 pxCoRoutine->uxState = corINITIAL_STATE;
\ ??xCoRoutineCreate_2:
\ 000034 86431A00 MOV.W #0x0, 0x1a(R6)
120 pxCoRoutine->uxPriority = uxPriority;
\ 000038 864B1600 MOV.W R11, 0x16(R6)
121 pxCoRoutine->uxIndex = uxIndex;
\ 00003C 86481800 MOV.W R8, 0x18(R6)
122 pxCoRoutine->pxCoRoutineFunction = pxCoRoutineCode;
\ 000040 864A0000 MOV.W R10, 0(R6)
123
124 /* Initialise all the other co-routine control block parameters. */
125 vListInitialiseItem( &( pxCoRoutine->xGenericListItem ) );
\ 000044 0C46 MOV.W R6, R12
\ 000046 2C53 ADD.W #0x2, R12
\ 000048 B012.... CALL #vListInitialiseItem
126 vListInitialiseItem( &( pxCoRoutine->xEventListItem ) );
\ 00004C 0C46 MOV.W R6, R12
\ 00004E 3C500C00 ADD.W #0xc, R12
\ 000052 B012.... CALL #vListInitialiseItem
127
128 /* Set the co-routine control block as a link back from the xListItem.
129 This is so we can get back to the containing CRCB from a generic item
130 in a list. */
131 listSET_LIST_ITEM_OWNER( &( pxCoRoutine->xGenericListItem ), pxCoRoutine );
\ 000056 86460800 MOV.W R6, 0x8(R6)
132 listSET_LIST_ITEM_OWNER( &( pxCoRoutine->xEventListItem ), pxCoRoutine );
\ 00005A 86461200 MOV.W R6, 0x12(R6)
133
134 /* Event lists are always in priority order. */
135 listSET_LIST_ITEM_VALUE( &( pxCoRoutine->xEventListItem ), configMAX_PRIORITIES - ( portTickType ) uxPriority );
\ 00005E 2F42 MOV.W #0x4, R15
\ 000060 0F8B SUB.W R11, R15
\ 000062 864F0C00 MOV.W R15, 0xc(R6)
136
137 /* Now the co-routine has been initialised it can be added to the ready
138 list at the correct priority. */
139 prvAddCoRoutineToReadyQueue( pxCoRoutine );
\ 000066 92961600.... CMP.W 0x16(R6), &uxTopCoRoutineReadyPriority
\ 00006C 032C JC ??xCoRoutineCreate_3
\ 00006E 92461600.... MOV.W 0x16(R6), &uxTopCoRoutineReadyPriority
\ ??xCoRoutineCreate_3:
\ 000074 0E46 MOV.W R6, R14
\ 000076 2E53 ADD.W #0x2, R14
\ 000078 3C40.... MOV.W #pxReadyCoRoutineLists, R12
\ 00007C 1F461600 MOV.W 0x16(R6), R15
\ 000080 0F5F RLA.W R15
\ 000082 0D4F MOV.W R15, R13
\ 000084 0F5F RLA.W R15
\ 000086 0F5F RLA.W R15
\ 000088 0F5D ADD.W R13, R15
\ 00008A 0C5F ADD.W R15, R12
\ 00008C B012.... CALL #vListInsertEnd
140
141 xReturn = pdPASS;
\ 000090 1943 MOV.W #0x1, R9
\ 000092 013C JMP ??xCoRoutineCreate_4
142 }
143 else
144 {
145 xReturn = errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY;
\ ??xCoRoutineCreate_0:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -