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

📄 dynamic.s43

📁 MSP430 IAR project with FreeRTOS port.
💻 S43
📖 第 1 页 / 共 3 页
字号:
//////////////////////////////////////////////////////////////////////////////
//                                                                           /
// 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\Mini /
//                     mal\dynamic.c                                         /
//    Command line  =  C:\MSP430F169_Eval_Port\FreeRTOSv401\Demo\Common\Mini /
//                     mal\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\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\dynam /
//                     ic.s43                                                /
//                                                                           /
//                                                                           /
//////////////////////////////////////////////////////////////////////////////

        NAME dynamic

        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 ?Epilogue5
        EXTERN ?Epilogue3
        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 vContinuousIncrementTask,021603H
        LOCFRAME CSTACK, 8, STACK
        FUNCTION vCounterControlTask,021603H
        LOCFRAME CSTACK, 12, STACK
        FUNCTION vLimitedIncrementTask,021603H
        LOCFRAME CSTACK, 6, STACK
        FUNCTION vQueueReceiveWhenSuspendedTask,021603H
        LOCFRAME CSTACK, 8, STACK
        FUNCTION vQueueSendWhenSuspendedTask,021603H
        LOCFRAME CSTACK, 6, STACK
        PUBLIC vStartDynamicPriorityTasks
        FUNCTION vStartDynamicPriorityTasks,021203H
        LOCFRAME CSTACK, 42, STACK
        PUBLIC xAreDynamicPriorityTasksStillRunning
        FUNCTION xAreDynamicPriorityTasksStillRunning,0203H
        LOCFRAME CSTACK, 2, STACK
        PUBLIC xSuspendedTestQueue
        
        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 vTaskSuspendAll
        FUNCTION vTaskSuspendAll,0202H
        EXTERN xQueueReceive
        FUNCTION xQueueReceive,0202H
        EXTERN xTaskResumeAll
        FUNCTION xTaskResumeAll,0202H
        EXTERN xQueueSend
        FUNCTION xQueueSend,0202H
        EXTERN vTaskDelay
        FUNCTION vTaskDelay,0202H
        EXTERN vTaskSuspend
        FUNCTION vTaskSuspend,0202H
        EXTERN vTaskResume
        FUNCTION vTaskResume,0202H
        EXTERN usCriticalNesting
        EXTERN uxTaskPriorityGet
        FUNCTION uxTaskPriorityGet,0202H
        EXTERN vTaskPrioritySet
        FUNCTION vTaskPrioritySet,0202H
        EXTERN xQueueCreate
        FUNCTION xQueueCreate,0202H
        EXTERN xTaskCreate
        FUNCTION xTaskCreate,0202H

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

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        REQUIRE ?cstart_init_zero
//  124 static xTaskHandle xContinousIncrementHandle, xLimitedIncrementHandle;
xContinousIncrementHandle:
        DS8 2

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        REQUIRE ?cstart_init_zero
xLimitedIncrementHandle:
        DS8 2
//  125 
//  126 /* The shared counter variable.  This is passed in as a parameter to the two 
//  127 counter variables for demonstration purposes. */

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        REQUIRE ?cstart_init_zero
//  128 static unsigned portLONG ulCounter;
ulCounter:
        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. */

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        REQUIRE ?cstart_init_zero
//  134 static unsigned portSHORT usCheckVariable = ( unsigned portSHORT ) 0;
usCheckVariable:
        DS8 2

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        REQUIRE ?cstart_init_zero
//  135 static portBASE_TYPE xSuspendedQueueSendError = pdFALSE;
xSuspendedQueueSendError:
        DS8 2

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        REQUIRE ?cstart_init_zero
//  136 static portBASE_TYPE xSuspendedQueueReceiveError = pdFALSE;
xSuspendedQueueReceiveError:
        DS8 2
//  137 
//  138 /* Queue used by the second test. */

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        REQUIRE ?cstart_init_zero
//  139 xQueueHandle xSuspendedTestQueue;
xSuspendedTestQueue:
        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  */

        RSEG CODE:CODE:REORDER:NOROOT(1)
//  146 void vStartDynamicPriorityTasks( void )
vStartDynamicPriorityTasks:
        CFI Block cfiBlock0 Using cfiCommon0
        CFI Function vStartDynamicPriorityTasks
//  147 {
//  148 	xSuspendedTestQueue = xQueueCreate( priSUSPENDED_QUEUE_LENGTH, sizeof( unsigned portLONG ) );
        FUNCALL vStartDynamicPriorityTasks, xQueueCreate
        LOCFRAME CSTACK, 2, STACK
        FUNCALL vStartDynamicPriorityTasks, xTaskCreate
        LOCFRAME CSTACK, 10, STACK
        FUNCALL vStartDynamicPriorityTasks, xTaskCreate
        LOCFRAME CSTACK, 18, STACK
        FUNCALL vStartDynamicPriorityTasks, xTaskCreate
        LOCFRAME CSTACK, 26, STACK
        FUNCALL vStartDynamicPriorityTasks, xTaskCreate
        LOCFRAME CSTACK, 34, STACK

⌨️ 快捷键说明

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