📄 serial.lst
字号:
##############################################################################
# #
# IAR MSP430 C/C++ Compiler V3.41A/W32 22/Apr/2006 00:25:16 #
# 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\msp430_Cross #
# Works\serial\serial.c #
# Command line = C:\MSP430F169_Eval_Port\FreeRTOSv401\Demo\msp430_Cross #
# Works\serial\serial.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\serial #
# .lst #
# Object file = C:\MSP430F169_Eval_Port\FreeRTOSv401\Debug\Obj\serial. #
# r43 #
# #
# #
##############################################################################
C:\MSP430F169_Eval_Port\FreeRTOSv401\Demo\msp430_CrossWorks\serial\serial.c
1 // this file has been modified to work with the MSP430_IAR port...jcw
2 // you'll need to change this file to work with your target unless
3 // you're using similar clocking (6MHz XT2 MCLK) and using 115.2KB...
4 /*
5 FreeRTOS V3.2.2 - Copyright (C) 2003 - 2005 Richard Barry.
6
7 This file is part of the FreeRTOS distribution.
8
9 FreeRTOS is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 FreeRTOS is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with FreeRTOS; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
23 A special exception to the GPL can be applied should you wish to distribute
24 a combined work that includes FreeRTOS, without being obliged to provide
25 the source code for any proprietary components. See the licensing section
26 of http://www.FreeRTOS.org for full details of how and when the exception
27 can be applied.
28
29 ***************************************************************************
30 See http://www.FreeRTOS.org for documentation, latest information, license
31 and contact details. Please ensure to read the configuration and relevant
32 port sections of the online documentation.
33 ***************************************************************************
34 */
35
36
37 /* BASIC INTERRUPT DRIVEN SERIAL PORT DRIVER.
38 *
39 * This file only supports UART 1
40 */
41
42 /* Standard includes. */
43 #include <stdlib.h>
44
45 /* Scheduler includes. */
46 #include "FreeRTOS.h"
\ In segment DATA16_AN, at 0x1
\ union <unnamed> volatile __data16 _A_IE2
\ _A_IE2:
\ 000000 DS8 1
\ In segment DATA16_AN, at 0x5
\ union <unnamed> volatile __data16 _A_ME2
\ _A_ME2:
\ 000000 DS8 1
\ In segment DATA16_AN, at 0x1a
\ union <unnamed> volatile __data16 _A_P3DIR
\ _A_P3DIR:
\ 000000 DS8 1
\ In segment DATA16_AN, at 0x1b
\ union <unnamed> volatile __data16 _A_P3SEL
\ _A_P3SEL:
\ 000000 DS8 1
\ In segment DATA16_AN, at 0x78
\ union <unnamed> volatile __data16 _A_U1CTL
\ _A_U1CTL:
\ 000000 DS8 1
\ In segment DATA16_AN, at 0x79
\ union <unnamed> volatile __data16 _A_U1TCTL
\ _A_U1TCTL:
\ 000000 DS8 1
\ In segment DATA16_AN, at 0x7a
\ union <unnamed> volatile __data16 _A_U1RCTL
\ _A_U1RCTL:
\ 000000 DS8 1
\ In segment DATA16_AN, at 0x7b
\ unsigned char volatile __data16 U1MCTL
\ U1MCTL:
\ 000000 DS8 1
\ In segment DATA16_AN, at 0x7c
\ unsigned char volatile __data16 U1BR0
\ U1BR0:
\ 000000 DS8 1
\ In segment DATA16_AN, at 0x7d
\ unsigned char volatile __data16 U1BR1
\ U1BR1:
\ 000000 DS8 1
\ In segment DATA16_AN, at 0x7e
\ unsigned char const volatile __data16 U1RXBUF
\ U1RXBUF:
\ 000000 DS8 1
\ In segment DATA16_AN, at 0x7f
\ unsigned char volatile __data16 U1TXBUF
\ U1TXBUF:
\ 000000 DS8 1
47 #include "queue.h"
48 #include "task.h"
49
50 /* Demo application includes. */
51 #include "serial.h"
52
53 /* Constants required to setup the hardware. */
54 #define serTX_AND_RX ( ( unsigned portCHAR ) 0x03 )
55
56 // clock specific stuff - change as needed for your target...
57 #define XT2_FREQ (6000000L)
58 #define SMCLK_FREQ (XT2_FREQ/8)
59
60 // set host console baud rate here:
61 #define HOST_BAUD (115200UL)
62
63 #define UART_DIVISOR(baud_rate) (SMCLK_FREQ / (baud_rate))
64 #define UART_REMAINDER(baud_rate) (SMCLK_FREQ % (baud_rate))
65
66 #define HOST_REMAINDER UART_REMAINDER(HOST_BAUD)
67 #define HOST_DIVISOR UART_DIVISOR(HOST_BAUD)
68
69 /* Misc. constants. */
70 #define serNO_BLOCK ( ( portTickType ) 0 )
71
72 /* Enable the UART Tx interrupt. */
73 #define vInterruptOn() IFG2 |= UTXIFG1
74
75 /* The queue used to hold received characters. */
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
76 static xQueueHandle xRxedChars;
\ xRxedChars:
\ 000000 DS8 2
77
78 /* The queue used to hold characters waiting transmission. */
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
79 static xQueueHandle xCharsForTx;
\ xCharsForTx:
\ 000000 DS8 2
80
\ In segment DATA16_Z, align 2, align-sorted
\ 000000 REQUIRE ?cstart_init_zero
81 static volatile portSHORT sTHREEmpty;
\ sTHREEmpty:
\ 000000 DS8 2
82
83 /*-----------------------------------------------------------*/
84
\ In segment CODE, align 2
85 xComPortHandle xSerialPortInitMinimal( unsigned portLONG ulWantedBaud, unsigned portBASE_TYPE uxQueueLength )
\ xSerialPortInitMinimal:
86 {
\ 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 0712 PUSH.W R7
\ 00000C 0412 PUSH.W R4
\ 00000E 2182 SUB.W #0x4, SP
\ 000010 0A4C MOV.W R12, R10
\ 000012 0B4D MOV.W R13, R11
\ 000014 064E MOV.W R14, R6
87 unsigned portLONG ulBaudRateCount;
^
Warning[Pe177]: variable "ulBaudRateCount" was declared but never referenced
88
89 unsigned long err;
90 unsigned char modctl;
91 unsigned int i;
92
93 /* Initialise the hardware. */
94
95 /* Generate the baud rate constants for the wanted baud rate. */
96 // ulBaudRateCount = configCPU_CLOCK_HZ / ulWantedBaud;
97
98 portENTER_CRITICAL();
\ 000016 32C2 DINT
\ 000018 0343 NOP
\ 00001A 9253.... ADD.W #0x1, &usCriticalNesting
99 {
100 /* Create the queues used by the com test task. */
101 xRxedChars = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
\ 00001E 1E43 MOV.W #0x1, R14
\ 000020 0C46 MOV.W R6, R12
\ 000022 B012.... CALL #xQueueCreate
\ 000026 824C.... MOV.W R12, &xRxedChars
102 xCharsForTx = xQueueCreate( uxQueueLength, ( unsigned portBASE_TYPE ) sizeof( signed portCHAR ) );
\ 00002A 1E43 MOV.W #0x1, R14
\ 00002C 0C46 MOV.W R6, R12
\ 00002E B012.... CALL #xQueueCreate
\ 000032 824C.... MOV.W R12, &xCharsForTx
103 /* Reset UART. */
104 // UCTL1 |= SWRST;
105 U1CTL_bit.SWRST = 1;
\ 000036 D2D37800 BIS.B #0x1, &0x78
106
107 /* Set pin function. */
108 // P4SEL |= serTX_AND_RX;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -