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

📄 flash.s43

📁 MSP430 IAR project with FreeRTOS port.
💻 S43
字号:
//////////////////////////////////////////////////////////////////////////////
//                                                                           /
// 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\flash.c                                           /
//    Command line  =  C:\MSP430F169_Eval_Port\FreeRTOSv401\Demo\Common\Mini /
//                     mal\flash.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\flash /
//                     .s43                                                  /
//                                                                           /
//                                                                           /
//////////////////////////////////////////////////////////////////////////////

        NAME flash

        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 ?Mul16
        EXTERN ?DivMod16u
        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 vLEDFlashTask,021603H
        LOCFRAME CSTACK, 10, STACK
        PUBLIC vStartLEDFlashTasks
        FUNCTION vStartLEDFlashTasks,021203H
        LOCFRAME CSTACK, 14, 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 usCriticalNesting
        EXTERN xTaskGetTickCount
        FUNCTION xTaskGetTickCount,0202H
        EXTERN vTaskDelayUntil
        FUNCTION vTaskDelayUntil,0202H
        EXTERN vParTestToggleLED
        FUNCTION vParTestToggleLED,0202H
        EXTERN xTaskCreate
        FUNCTION xTaskCreate,0202H

// C:\MSP430F169_Eval_Port\FreeRTOSv401\Demo\Common\Minimal\flash.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  * This version of flash .c is for use on systems that have limited stack space
//   35  * and no display facilities.  The complete version can be found in the 
//   36  * Demo/Common/Full directory.
//   37  * 
//   38  * Three tasks are created, each of which flash an LED at a different rate.  The first 
//   39  * LED flashes every 200ms, the second every 400ms, the third every 600ms.
//   40  *
//   41  * The LED flash tasks provide instant visual feedback.  They show that the scheduler 
//   42  * is still operational.
//   43  *
//   44  * The PC port uses the standard parallel port for outputs, the Flashlite 186 port 
//   45  * uses IO port F and the AVR port port B.
//   46  *
//   47  */
//   48 
//   49 /*
//   50 Changes from V2.0.0
//   51 
//   52 	+ Delay periods are now specified using variables and constants of
//   53 	  portTickType rather than unsigned portLONG.
//   54 
//   55 Changes from V2.5.5
//   56 
//   57 	+ Calls to vTaskDelay() have been replaced with vTaskDelayUntil().
//   58 
//   59 */
//   60 
//   61 #include <stdlib.h>
//   62 
//   63 /* Scheduler include files. */
//   64 #include "FreeRTOS.h"
//   65 #include "task.h"
//   66 
//   67 /* Demo program include files. */
//   68 #include "partest.h"
//   69 #include "flash.h"
//   70 
//   71 #define ledSTACK_SIZE		configMINIMAL_STACK_SIZE
//   72 #define ledNUMBER_OF_LEDS	( 4 )
//   73 #define ledFLASH_RATE_BASE	( ( portTickType ) 333 )
//   74 
//   75 /* Variable used by the created tasks to calculate the LED number to use, and
//   76 the rate at which they should flash the LED. */

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        REQUIRE ?cstart_init_zero
//   77 static volatile unsigned portBASE_TYPE uxFlashTaskNumber = 0;
uxFlashTaskNumber:
        DS8 2
//   78 
//   79 /* The task that is created three times. */
//   80 static portTASK_FUNCTION_PROTO( vLEDFlashTask, pvParameters );
//   81 
//   82 /*-----------------------------------------------------------*/
//   83 

        RSEG CODE:CODE:REORDER:NOROOT(1)
//   84 void vStartLEDFlashTasks( unsigned portBASE_TYPE uxPriority )
vStartLEDFlashTasks:
        CFI Block cfiBlock0 Using cfiCommon0
        CFI Function vStartLEDFlashTasks
//   85 {
        FUNCALL vStartLEDFlashTasks, xTaskCreate
        LOCFRAME CSTACK, 14, 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
        MOV.W   R12, R10
//   86 signed portBASE_TYPE xLEDTask;
//   87 
//   88 	/* Create the three tasks. */
//   89 	for( xLEDTask = 0; xLEDTask < ledNUMBER_OF_LEDS; ++xLEDTask )
        MOV.W   #0x0, R11
??vStartLEDFlashTasks_0:
        CMP.W   #0x4, R11
        JGE     ??vStartLEDFlashTasks_1
//   90 	{
//   91 		/* Spawn the task. */
//   92 		xTaskCreate( vLEDFlashTask, ( const signed portCHAR * const ) "LEDx", ledSTACK_SIZE, NULL, uxPriority, ( xTaskHandle * ) NULL );
        PUSH.W  #0x0
        CFI CFA SP+8
        PUSH.W  R10
        CFI CFA SP+10
        PUSH.W  #0x0
        CFI CFA SP+12
        PUSH.W  #0x40
        CFI CFA SP+14
        MOV.W   #`?<Constant "LEDx">`, R14
        MOV.W   #vLEDFlashTask, R12
        CALL    #xTaskCreate
//   93 	}
        ADD.W   #0x1, R11
        ADD.W   #0x8, SP
        CFI CFA SP+6
        JMP     ??vStartLEDFlashTasks_0
//   94 }
??vStartLEDFlashTasks_1:
        POP.W   R11
        CFI R11 SameValue
        CFI CFA SP+4
        POP.W   R10
        CFI R10 SameValue
        CFI CFA SP+2
        RET
        CFI EndBlock cfiBlock0
//   95 /*-----------------------------------------------------------*/
//   96 

        RSEG CODE:CODE:REORDER:NOROOT(1)
//   97 static portTASK_FUNCTION( vLEDFlashTask, pvParameters )
vLEDFlashTask:
        CFI Block cfiBlock1 Using cfiCommon0
        CFI Function vLEDFlashTask
//   98 {
        FUNCALL vLEDFlashTask, xTaskGetTickCount
        LOCFRAME CSTACK, 10, STACK
        FUNCALL vLEDFlashTask, vTaskDelayUntil
        LOCFRAME CSTACK, 10, STACK
        FUNCALL vLEDFlashTask, vParTestToggleLED
        LOCFRAME CSTACK, 10, STACK
        FUNCALL vLEDFlashTask, vTaskDelayUntil
        LOCFRAME CSTACK, 10, STACK
        FUNCALL vLEDFlashTask, vParTestToggleLED
        LOCFRAME CSTACK, 10, 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
        SUB.W   #0x2, SP
        CFI CFA SP+10
        MOV.W   R12, R10
//   99 portTickType xFlashRate, xLastFlashTime;
//  100 unsigned portBASE_TYPE uxLED;
//  101 
//  102 	/* The parameters are not used. */
//  103 	( void ) pvParameters;
//  104 
//  105 	/* Calculate the LED and flash rate. */
//  106 	portENTER_CRITICAL();
        DINT
        NOP
        ADD.W   #0x1, &usCriticalNesting
//  107 	{
//  108 		/* See which of the eight LED's we should use. */
//  109 		uxLED = uxFlashTaskNumber;
        MOV.W   &uxFlashTaskNumber, R8
//  110 
//  111 		/* Update so the next task uses the next LED. */
//  112 		uxFlashTaskNumber++;
        ADD.W   #0x1, &uxFlashTaskNumber
//  113 	}
//  114 	portEXIT_CRITICAL();
        CMP.W   #0x0, &usCriticalNesting
        JEQ     ??vLEDFlashTask_1
        ADD.W   #0xffff, &usCriticalNesting
        CMP.W   #0x0, &usCriticalNesting
        JNE     ??vLEDFlashTask_1
        EINT
//  115 
//  116 	xFlashRate = ledFLASH_RATE_BASE + ( ledFLASH_RATE_BASE * ( portTickType ) uxLED );
??vLEDFlashTask_1:
        MOV.W   R8, R12
        MOV.W   #0x14d, R14
        CALL    #?Mul16
        ADD.W   #0x14d, R12
        MOV.W   R12, R11
//  117 	xFlashRate /= portTICK_RATE_MS;
        MOV.W   R11, R12
        MOV.W   #0x1, R14
        CALL    #?DivMod16u
        MOV.W   R12, R11
//  118 
//  119 	/* We will turn the LED on and off again in the delay period, so each
//  120 	delay is only half the total period. */
//  121 	xFlashRate /= ( portTickType ) 2;
        CLRC
        RRC.W   R11
//  122 
//  123 	/* We need to initialise xLastFlashTime prior to the first call to 
//  124 	vTaskDelayUntil(). */
//  125 	xLastFlashTime = xTaskGetTickCount();
        CALL    #xTaskGetTickCount
        MOV.W   R12, 0x0(SP)
//  126 
//  127 	for(;;)
//  128 	{
//  129 		/* Delay for half the flash period then turn the LED on. */
//  130 		vTaskDelayUntil( &xLastFlashTime, xFlashRate );
??vLEDFlashTask_0:
        MOV.W   R11, R14
        MOV.W   SP, R12
        CALL    #vTaskDelayUntil
//  131 		vParTestToggleLED( uxLED );
        MOV.W   R8, R12
        CALL    #vParTestToggleLED
//  132 
//  133 		/* Delay for half the flash period then turn the LED off. */
//  134 		vTaskDelayUntil( &xLastFlashTime, xFlashRate );
        MOV.W   R11, R14
        MOV.W   SP, R12
        CALL    #vTaskDelayUntil
//  135 		vParTestToggleLED( uxLED );
        MOV.W   R8, R12
        CALL    #vParTestToggleLED
        JMP     ??vLEDFlashTask_0
        CFI EndBlock cfiBlock1
//  136 	}
//  137 } /*lint !e715 !e818 !e830 Function definition must be standard for task creation. */

        RSEG CODE:CODE:REORDER:NOROOT(1)
?setjmp_save_r4:
        REQUIRE ?setjmp_r4
        REQUIRE ?longjmp_r4

        RSEG CODE:CODE:REORDER:NOROOT(1)
?setjmp_save_r5:
        REQUIRE ?setjmp_r5
        REQUIRE ?longjmp_r5

        RSEG DATA16_C:CONST:SORT:NOROOT(0)
`?<Constant "LEDx">`:
        DC8 "LEDx"

        END
//  138 
// 
// 158 bytes in segment CODE
//   5 bytes in segment DATA16_C
//   2 bytes in segment DATA16_Z
// 
// 158 bytes of CODE  memory
//   5 bytes of CONST memory
//   2 bytes of DATA  memory
//
//Errors: none
//Warnings: 1

⌨️ 快捷键说明

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