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

📄 comtest.s43

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

        NAME comtest

        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 ?Epilogue4
        EXTERN ?Epilogue3
        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
        PUBLIC vAltStartComTestTasks
        FUNCTION vAltStartComTestTasks,021203H
        LOCFRAME CSTACK, 26, STACK
        FUNCTION vComRxTask,021603H
        LOCFRAME CSTACK, 14, STACK
        FUNCTION vComTxTask,021603H
        LOCFRAME CSTACK, 10, STACK
        PUBLIC xAreComTestTasksStillRunning
        FUNCTION xAreComTestTasksStillRunning,0203H
        LOCFRAME CSTACK, 2, 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 xSerialGetChar
        FUNCTION xSerialGetChar,0202H
        EXTERN xSerialPutChar
        FUNCTION xSerialPutChar,0202H
        EXTERN xTaskGetTickCount
        FUNCTION xTaskGetTickCount,0202H
        EXTERN vTaskDelay
        FUNCTION vTaskDelay,0202H
        EXTERN xSerialPortInitMinimal
        FUNCTION xSerialPortInitMinimal,0202H
        EXTERN xTaskCreate
        FUNCTION xTaskCreate,0202H

// C:\MSP430F169_Eval_Port\FreeRTOSv401\Demo\Common\Minimal\comtest.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 /*
//   35  * This version of comtest. c is for use on systems that have limited stack
//   36  * space and no display facilities.  The complete version can be found in
//   37  * the Demo/Common/Full directory.
//   38  *
//   39  * Creates two tasks that operate on an interrupt driven serial port.  A
//   40  * loopback connector should be used so that everything that is transmitted is
//   41  * also received.  The serial port does not use any flow control.  On a
//   42  * standard 9way 'D' connector pins two and three should be connected together.
//   43  *
//   44  * The first task posts a sequence of characters to the Tx queue, toggling an
//   45  * LED on each successful post.  At the end of the sequence it sleeps for a
//   46  * pseudo-random period before resending the same sequence.
//   47  *
//   48  * The UART Tx end interrupt is enabled whenever data is available in the Tx
//   49  * queue.  The Tx end ISR removes a single character from the Tx queue and
//   50  * passes it to the UART for transmission.
//   51  *
//   52  * The second task blocks on the Rx queue waiting for a character to become
//   53  * available.  When the UART Rx end interrupt receives a character it places
//   54  * it in the Rx queue, waking the second task.  The second task checks that the
//   55  * characters removed from the Rx queue form the same sequence as those posted
//   56  * to the Tx queue, and toggles an LED for each correct character.
//   57  *
//   58  * The receiving task is spawned with a higher priority than the transmitting
//   59  * task.  The receiver will therefore wake every time a character is
//   60  * transmitted so neither the Tx or Rx queue should ever hold more than a few
//   61  * characters.
//   62  *
//   63  */
//   64 
//   65 /*
//   66 Changes from V1.2.0:
//   67 
//   68 	+ Reduced the maximum time between successive transmissions.  This provides
//   69 	  for a more rigorous test.
//   70 
//   71 Changes from V2.0.0
//   72 
//   73 	+ Delay periods are now specified using variables and constants of
//   74 	  portTickType rather than unsigned portLONG.
//   75 
//   76 Changes from V2.5.1
//   77 
//   78 	+ The constant comOFFSET_TIME added to the delay period to ensure a more
//   79 	  random delay period is used.
//   80 */
//   81 
//   82 /* Scheduler include files. */
//   83 #include <stdlib.h>
//   84 #include "FreeRTOS.h"
//   85 #include "task.h"
//   86 
//   87 /* Demo program include files. */
//   88 #include "serial.h"
//   89 #include "comtest.h"
//   90 #include "partest.h"
//   91 
//   92 #define comSTACK_SIZE				configMINIMAL_STACK_SIZE
//   93 #define comTX_LED_OFFSET			( 0 )
//   94 #define comRX_LED_OFFSET			( 1 )
//   95 #define comTOTAL_PERMISSIBLE_ERRORS ( 2 )
//   96 
//   97 /* The Tx task will transmit the sequence of characters at a pseudo random
//   98 interval.  This is the maximum and minimum block time between sends. */
//   99 #define comTX_MAX_BLOCK_TIME		( ( portTickType ) 0x96 )
//  100 #define comTX_MIN_BLOCK_TIME		( ( portTickType ) 0x32 )
//  101 #define comOFFSET_TIME				( ( portTickType ) 3 )
//  102 
//  103 /* We should find that each character can be queued for Tx immediately and we
//  104 don't have to block to send. */
//  105 #define comNO_BLOCK					( ( portTickType ) 0 )
//  106 
//  107 /* The Rx task will block on the Rx queue for a long period. */
//  108 #define comRX_BLOCK_TIME			( ( portTickType ) 0xffff )
//  109 
//  110 /* The sequence transmitted is from comFIRST_BYTE to and including comLAST_BYTE. */
//  111 #define comFIRST_BYTE				( 'A' )
//  112 #define comLAST_BYTE				( 'z' )
//  113 
//  114 #define comBUFFER_LEN				( ( unsigned portBASE_TYPE ) ( comLAST_BYTE - comFIRST_BYTE ) + ( unsigned portBASE_TYPE ) 1 )
//  115 #define comINITIAL_RX_COUNT_VALUE	( 0 )
//  116 
//  117 /* Handle to the com port used by both tasks. */

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        REQUIRE ?cstart_init_zero
//  118 static xComPortHandle xPort = NULL;
xPort:
        DS8 2
//  119 
//  120 /* The transmit task as described at the top of the file. */
//  121 static portTASK_FUNCTION_PROTO( vComTxTask, pvParameters );
//  122 
//  123 /* The receive task as described at the top of the file. */
//  124 static portTASK_FUNCTION_PROTO( vComRxTask, pvParameters );
//  125 
//  126 /* The LED that should be toggled by the Rx and Tx tasks.  The Rx task will
//  127 toggle LED ( uxBaseLED + comRX_LED_OFFSET).  The Tx task will toggle LED
//  128 ( uxBaseLED + comTX_LED_OFFSET ). */

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        REQUIRE ?cstart_init_zero
//  129 static unsigned portBASE_TYPE uxBaseLED = 0;
uxBaseLED:
        DS8 2
//  130 
//  131 /* Check variable used to ensure no error have occurred.  The Rx task will
//  132 increment this variable after every successfully received sequence.  If at any
//  133 time the sequence is incorrect the the variable will stop being incremented. */

        RSEG DATA16_Z:DATA:SORT:NOROOT(1)
        REQUIRE ?cstart_init_zero
//  134 static volatile unsigned portBASE_TYPE uxRxLoops = comINITIAL_RX_COUNT_VALUE;
uxRxLoops:
        DS8 2
//  135 
//  136 /*-----------------------------------------------------------*/
//  137 

        RSEG CODE:CODE:REORDER:NOROOT(1)
//  138 void vAltStartComTestTasks( unsigned portBASE_TYPE uxPriority, unsigned portLONG ulBaudRate, unsigned portBASE_TYPE uxLED )
vAltStartComTestTasks:
        CFI Block cfiBlock0 Using cfiCommon0
        CFI Function vAltStartComTestTasks
//  139 {
        FUNCALL vAltStartComTestTasks, xSerialPortInitMinimal
        LOCFRAME CSTACK, 10, STACK
        FUNCALL vAltStartComTestTasks, xTaskCreate
        LOCFRAME CSTACK, 18, STACK
        FUNCALL vAltStartComTestTasks, xTaskCreate
        LOCFRAME CSTACK, 26, 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
        MOV.W   R12, R8
        MOV.W   R14, R10
        MOV.W   R15, R11
        MOV.W   0xa(SP), R9
//  140 	/* Initialise the com port then spawn the Rx and Tx tasks. */
//  141 	uxBaseLED = uxLED;
        MOV.W   R9, &uxBaseLED
//  142 	xSerialPortInitMinimal( ulBaudRate, comBUFFER_LEN );
        MOV.W   #0x3a, R14
        MOV.W   R10, R12
        MOV.W   R11, R13
        CALL    #xSerialPortInitMinimal
//  143 
//  144 	/* The Tx task is spawned with a lower priority than the Rx task. */
//  145 	xTaskCreate( vComTxTask, ( const signed portCHAR * const ) "COMTx", comSTACK_SIZE, NULL, uxPriority - 1, ( xTaskHandle * ) NULL );
        PUSH.W  #0x0
        CFI CFA SP+12
        MOV.W   R8, R15
        ADD.W   #0xffff, R15
        PUSH.W  R15
        CFI CFA SP+14
        PUSH.W  #0x0
        CFI CFA SP+16
        PUSH.W  #0x40
        CFI CFA SP+18
        MOV.W   #`?<Constant "COMTx">`, R14
        MOV.W   #vComTxTask, R12
        CALL    #xTaskCreate
//  146 	xTaskCreate( vComRxTask, ( const signed portCHAR * const ) "COMRx", comSTACK_SIZE, NULL, uxPriority, ( xTaskHandle * ) NULL );
        PUSH.W  #0x0
        CFI CFA SP+20
        PUSH.W  R8
        CFI CFA SP+22
        PUSH.W  #0x0
        CFI CFA SP+24

⌨️ 快捷键说明

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