⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 croutine.s43

📁 MSP430 IAR project with FreeRTOS port.
💻 S43
📖 第 1 页 / 共 3 页
字号:
//////////////////////////////////////////////////////////////////////////////
//                                                                           /
// 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\Deb /
//                     ug\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\Incl /
//                     ude\ -I C:\MSP430F169_Eval_Port\FreeRTOSv401\Source\I /
//                     nclude\ -I C:\MSP430F169_Eval_Port\FreeRTOSv401\Demo\ /
//                     MSP430_IAR\ -I C:\MSP430F169_Eval_Port\FreeRTOSv401\S /
//                     ource\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\crout /
//                     ine.s43                                               /
//                                                                           /
//                                                                           /
//////////////////////////////////////////////////////////////////////////////

        NAME croutine

        RTMODEL "__core", "64kb"
        RTMODEL "__double_size", "32"
        RTMODEL "__pic", "no"
        RTMODEL "__reg_r4", "free"
        RTMODEL "__reg_r5", "free"
        RTMODEL "__rt_version", "2"

        RSEG CSTACK:DATA:SORT:NOROOT(1)

        EXTERN ?Epilogue3
        EXTERN ?Epilogue5
        EXTERN ?cstart_init_zero
        EXTERN ?longjmp_r4
        EXTERN ?longjmp_r5
        EXTERN ?setjmp_r4
        EXTERN ?setjmp_r5

        PUBWEAK ?setjmp_save_r4
        PUBWEAK ?setjmp_save_r5
        FUNCTION prvCheckDelayedList,021203H
        LOCFRAME CSTACK, 4, STACK
        FUNCTION prvCheckPendingReadyList,021203H
        LOCFRAME CSTACK, 4, STACK
        FUNCTION prvInitialiseCoRoutineLists,021203H
        LOCFRAME CSTACK, 4, STACK
        PUBLIC pxCurrentCoRoutine
        PUBLIC vCoRoutineAddToDelayedList
        FUNCTION vCoRoutineAddToDelayedList,021203H
        LOCFRAME CSTACK, 8, STACK
        PUBLIC vCoRoutineSchedule
        FUNCTION vCoRoutineSchedule,061203H
        LOCFRAME CSTACK, 2, STACK
        PUBLIC xCoRoutineCreate
        FUNCTION xCoRoutineCreate,021203H
        LOCFRAME CSTACK, 12, STACK
        PUBLIC xCoRoutineRemoveFromEventList
        FUNCTION xCoRoutineRemoveFromEventList,021203H
        LOCFRAME CSTACK, 8, STACK
        
        CFI Names cfiNames0
        CFI StackFrame CFA SP DATA
        CFI Resource PC:16, SP:16, SR:16, R4:16, R5:16, R6:16, R7:16, R8:16
        CFI Resource R9:16, R10:16, R11:16, R12:16, R13:16, R14:16, R15:16
        CFI EndNames cfiNames0
        
        CFI Common cfiCommon0 Using cfiNames0
        CFI CodeAlign 2
        CFI DataAlign 2
        CFI ReturnAddress PC CODE
        CFI CFA SP+2
        CFI PC Frame(CFA, -2)
        CFI SR Undefined
        CFI R4 SameValue
        CFI R5 SameValue
        CFI R6 SameValue
        CFI R7 SameValue
        CFI R8 SameValue
        CFI R9 SameValue
        CFI R10 SameValue
        CFI R11 SameValue
        CFI R12 Undefined
        CFI R13 Undefined
        CFI R14 Undefined
        CFI R15 Undefined
        CFI EndCommon cfiCommon0
        
        EXTERN vListRemove
        FUNCTION vListRemove,0202H
        EXTERN vListInsertEnd
        FUNCTION vListInsertEnd,0202H
        EXTERN vListInitialise
        FUNCTION vListInitialise,0202H
        EXTERN xTaskGetTickCount
        FUNCTION xTaskGetTickCount,0202H
        EXTERN vListInsert
        FUNCTION vListInsert,0202H
        EXTERN pvPortMalloc
        FUNCTION pvPortMalloc,0202H
        EXTERN vListInitialiseItem
        FUNCTION vListInitialiseItem,0202H

// 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. --------------------*/

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        REQUIRE ?cstart_init_zero
//   38 static xList pxReadyCoRoutineLists[ configMAX_CO_ROUTINE_PRIORITIES ];	/*< Prioritised ready co-routines. */
pxReadyCoRoutineLists:
        DS8 20

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        REQUIRE ?cstart_init_zero
//   39 static xList xDelayedCoRoutineList1;									/*< Delayed co-routines. */
xDelayedCoRoutineList1:
        DS8 10

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        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:
        DS8 10

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        REQUIRE ?cstart_init_zero
//   41 static xList * pxDelayedCoRoutineList;									/*< Points to the delayed co-routine list currently being used. */
pxDelayedCoRoutineList:
        DS8 2

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        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:
        DS8 2

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        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:
        DS8 10
//   44 
//   45 /* Other file private variables. --------------------------------*/

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        REQUIRE ?cstart_init_zero
//   46 corCRCB * pxCurrentCoRoutine = NULL;
pxCurrentCoRoutine:
        DS8 2

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        REQUIRE ?cstart_init_zero
//   47 static unsigned portBASE_TYPE uxTopCoRoutineReadyPriority = 0;
uxTopCoRoutineReadyPriority:
        DS8 2

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        REQUIRE ?cstart_init_zero
//   48 static portTickType xCoRoutineTickCount = 0;
xCoRoutineTickCount:
        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 

        RSEG CODE:CODE:REORDER:NOROOT(1)
//   95 portBASE_TYPE xCoRoutineCreate( crCOROUTINE_CODE pxCoRoutineCode, unsigned portBASE_TYPE uxPriority, unsigned portBASE_TYPE uxIndex )
xCoRoutineCreate:
        CFI Block cfiBlock0 Using cfiCommon0
        CFI Function xCoRoutineCreate
//   96 {
        FUNCALL xCoRoutineCreate, pvPortMalloc
        LOCFRAME CSTACK, 12, STACK
        FUNCALL xCoRoutineCreate, prvInitialiseCoRoutineLists
        LOCFRAME CSTACK, 12, STACK
        FUNCALL xCoRoutineCreate, vListInitialiseItem
        LOCFRAME CSTACK, 12, STACK
        FUNCALL xCoRoutineCreate, vListInitialiseItem
        LOCFRAME CSTACK, 12, STACK
        FUNCALL xCoRoutineCreate, vListInsertEnd
        LOCFRAME CSTACK, 12, STACK
        PUSH.W  R10
        CFI R10 Frame(CFA, -4)
        CFI CFA SP+4
        PUSH.W  R11
        CFI R11 Frame(CFA, -6)
        CFI CFA SP+6
        PUSH.W  R8
        CFI R8 Frame(CFA, -8)
        CFI CFA SP+8
        PUSH.W  R9
        CFI R9 Frame(CFA, -10)
        CFI CFA SP+10
        PUSH.W  R6
        CFI R6 Frame(CFA, -12)
        CFI CFA SP+12
        MOV.W   R12, R10
        MOV.W   R14, R11
        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 ) );
        MOV.W   #0x1c, R12
        CALL    #pvPortMalloc
        MOV.W   R12, R6
//  102 	if( pxCoRoutine )
        CMP.W   #0x0, R6
        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 )
        CMP.W   #0x0, &pxCurrentCoRoutine
        JNE     ??xCoRoutineCreate_1
//  107 		{
//  108 			pxCurrentCoRoutine = pxCoRoutine;
        MOV.W   R6, &pxCurrentCoRoutine
//  109 			prvInitialiseCoRoutineLists();
        CALL    #prvInitialiseCoRoutineLists
//  110 		}
//  111 
//  112 		/* Check the priority is within limits. */
//  113 		if( uxPriority >= configMAX_CO_ROUTINE_PRIORITIES )
??xCoRoutineCreate_1:
        CMP.W   #0x2, R11
        JNC     ??xCoRoutineCreate_2
//  114 		{
//  115 			uxPriority = configMAX_CO_ROUTINE_PRIORITIES - 1;
        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:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -