📄 sci.lst
字号:
C:\DSP\2XX\DSPTOOLS\CGT\6.63B\dspa.exe -v2xx -s -s -l ..\source\sci.asm sci.obj
TMS320C1x/C2x/C2xx/C5x COFF Assembler Beta Version 6.63 Sat Jan 10 00:36:49 1998
Copyright (c) 1987-1996 Texas Instruments Incorporated
..\source\sci.asm PAGE 1
1 ;-----------------------------------------------------------------------------
2 ; Name: SCI.ASM
3 ; Project: C240HW.LIB
4 ; Originator: Simor Balazs
5 ; Description: Provides functions for initializing and serving
6 ; SCI Unit
7 ;
8 ; Function List: void SCI_Init(unsigned fdiv);
9 ; int kbhit(void);
10 ; int SCI_Getc(void);
11 ; int SCI_Sendc(int ch);
12 ; int SCI_Rdy_to_Send(void);
13 ;
14 ; Status:
15 ; Target: TMS320C240
16 ; History:
17 ;-----------------------------------------------------------------------------
18
19
20 ;Registers of the SCI Unit
21 7050 SCICCR .set 7050h
22 7051 SCICTL1 .set 7051h
23 7052 SCIHBAUD .set 7052h
24 7053 SCILBAUD .set 7053h
25 7054 SCICTL2 .set 7054h
26 7055 SCIRXST .set 7055h
27 7056 SCIRXEMU .set 7056h
28 7057 SCIRXBUF .set 7057h
29 7059 SCITXBUF .set 7059h
30 705e SCIPC2 .set 705Eh
31 705f SCIPRI .set 705Fh
32
33
34 0000 .text
35 ;-----------------------------------------------------------------------------
36 ; void SCI_Init(unsigned fdiv);
37 ;
38 ; Arguments: fdiv = 1e7/BaudRate/8 - 1
39 ; E.g: for 9600 Baud, fdiv=129. (ex.ly: 9615 Baud)
40 ;
41 ; Return Value: none
42 ;
43 ;-----------------------------------------------------------------------------
44 .globl _SCI_Init
45 0000 _SCI_Init:
46 0000 bce0 ldp #0e0h ;Point at the SCI Registers
47 0001 ae51 splk #00010011b,SCICTL1 ;Activating SW RESET
0002 0013
48
49 0003 ae50 splk #00010111b,SCICCR ;8bits, 1stop, no parity
0004 0017
50 0005 8b90 mar *-
51 0006 10a0 lacc *+ ; sending frequency divider (fdiv) to UART
52 0007 9053 sacl SCILBAUD
TMS320C1x/C2x/C2xx/C5x COFF Assembler Beta Version 6.63 Sat Jan 10 00:36:49 1998
Copyright (c) 1987-1996 Texas Instruments Incorporated
..\source\sci.asm PAGE 2
53 0008 be09 sfl
54 0009 9f52 sach SCIHBAUD,7 ;high side of ACC
55
56 000a ae54 splk #0, SCICTL2 ;TX and RX interrupts disabled
000b 0000
57 000c ae5e splk #00110010b, SCIPC2 ;Configuring the TX and RX pins
000d 0032
58 000e ae5f splk #0, SCIPRI
000f 0000
59
60 0010 ae51 splk #00110011b,SCICTL1 ;Deactivating SW RESET
0011 0033
61
62 0012 ef00 ret
63
64
65
66 ;-----------------------------------------------------------------------------
67 ; int kbhit(void);
68 ;
69 ; Arguments: none
70 ;
71 ; Return Value: 0 if no character
72 ; 1 if character available
73 ;
74 ;-----------------------------------------------------------------------------
75 .globl _kbhit
76 0013 _kbhit:
77 0013 bce0 ldp #0e0h ; Point at the SCI Registers
78 0014 4955 bit SCIRXST, 9 ; checking RXRDY (data ready bit)
79 0015 e100 bcnd avail, tc
0016 001a'
80 0017 bf80 lacc #0 ; status: no character
0018 0000
81 0019 ef00 ret
82 001a avail:
83 001a bf80 lacc #1 ; character available
001b 0001
84 001c ef00 ret
85
86
87
88 ;-----------------------------------------------------------------------------
89 ; int SCI_Getc(void);
90 ;
91 ; Arguments: none
92 ;
93 ; Return Value: received character
94 ; -1 if error
95 ;
96 ;-----------------------------------------------------------------------------
97 .globl _SCI_Getc
98 001d _SCI_Getc:
99 001d bce0 ldp #0e0h ;Point at the SCI Registers
TMS320C1x/C2x/C2xx/C5x COFF Assembler Beta Version 6.63 Sat Jan 10 00:36:49 1998
Copyright (c) 1987-1996 Texas Instruments Incorporated
..\source\sci.asm PAGE 3
100 001e be47 setc sxm
101 001f 4955 bit SCIRXST, 9 ; checking RXRDY (data ready bit)
102 0020 e100 bcnd ok, tc
0021 0025'
103 0022 bf80 lacc #0ffffh ; status: error
0023 ffff
104 0024 ef00 ret
105 0025 ok:
106 0025 1057 lacc SCIRXBUF
107 0026 bfb0 and #255
0027 00ff
108 0028 ef00 ret
109
110
111 ;-----------------------------------------------------------------------------
112 ; int SCI_Sendc(int ch);
113 ;
114 ; Arguments: character to be sent
115 ;
116 ; Return Value: 0 if successful
117 ; -1 if error
118 ;
119 ;-----------------------------------------------------------------------------
120 .globl _SCI_Sendc
121 0029 _SCI_Sendc:
122 0029 bce0 ldp #0e0h ;Point at the SCI Registers
123 002a be47 setc sxm
124 002b 4854 bit SCICTL2, 8
125 002c e100 bcnd ok2, tc
002d 0031'
126 002e bf80 lacc #0ffffh ;status: error (not ready)
002f ffff
127 0030 ef00 ret
128 0031 ok2:
129 0031 8b90 mar *-
130 0032 10a0 lacc *+
131 0033 9059 sacl SCITXBUF ;sending character to output
132 0034 bf80 lacc #0 ;status: OK
0035 0000
133 0036 ef00 ret
134
135
136
137 ;-----------------------------------------------------------------------------
138 ;int SCI_Rdy_to_Send(void);
139 ;
140 ; Arguments: none
141 ;
142 ; Return Value: 0 if not ready
143 ; 1 if ready
144 ;
145 ;-----------------------------------------------------------------------------
146 .globl _SCI_Rdy_to_Send
147 0037 _SCI_Rdy_to_Send:
TMS320C1x/C2x/C2xx/C5x COFF Assembler Beta Version 6.63 Sat Jan 10 00:36:49 1998
Copyright (c) 1987-1996 Texas Instruments Incorporated
..\source\sci.asm PAGE 4
148 0037 bce0 ldp #0e0h ;Point at the SCI Registers
149 0038 4854 bit SCICTL2, 8
150 0039 e100 bcnd ok3, tc
003a 003e'
151 003b bf80 lacc #0 ;status: error (not ready)
003c 0000
152 003d ef00 ret
153 003e ok3:
154 003e bf80 lacc #1 ;status: OK
003f 0001
155 0040 ef00 ret
156
157
158
159
160
No Errors, No Warnings
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -