?? i2cm_io.lst
字號:
TMS320C2000 COFF Assembler PC Version 3.06 Fri Aug 01 12:16:20 2003
Tools Copyright (c) 1996-2002 Texas Instruments Incorporated
i2cm_io.asm PAGE 1
1 ;=====================================================================
2 ;
3 ; File Name : I2CM_IO.ASM
4 ;
5 ; Originator : Digital Control Systems Group
6 ; Texas Instruments
7 ;
8 ; Description : This file contains Virtual I2C Master implementation
9 ; in software.
10 ;
11 ; Routine Type : "CcA Only"
12 ;
13 ; Target : C28x
14 ;
15 ; Date : 30/01/2002 (DD/MM/YYYY)
16 ;=====================================================================
17 ;typedef struct {
18 ; unsigned int taskIndex; /* Index into the task pointers */
19 ; unsigned int I2CCSR; /* I2C Control & Status register (LSB-bit counter) */
20 ; unsigned int I2CDAT; /* I2C Shift Register */
21 ; unsigned int bitCntr; /* Bit Counter */
22 ; void (*init)(void *); /* Initialisation routine */
23 ; void (*tick)(void *); /* I2C tick function */
24 ; }VI2CM_IO;
25 ;=====================================================================
26 .include "..\include\i2cmpin.h"
27 ;=====================================================================
28 ; Module definition for external referance
29 .def _vi2cmInit
30 .def _vi2cmTick
31 ;=====================================================================
32
33 ;=====================================================================
34 ; i2cmTick : Initialization function
35 ;======================================================================
36 00000000 _vi2cmInit:
37 00000000 7622 EALLOW
38 00000001 7680 MOVL XAR6,#SCL_DIR ; XAR5->GPIO direction register for SCL
00000002 70D5
39 00000003 8F40 MOVL XAR5,#SDA_DIR ; XAR4->GPIO direction register for SDA
00000004 70D5
40
41 00000005 5609 TCLR *+XAR6[0],#(SCL_BIT) ; Set the SCL pin as input
00000006 02C6
42 00000007 5609 TCLR *+XAR5[0],#(SDA_BIT) ; Set the SDA pin as input
00000008 01C5
43
44 00000009 7680 MOVL XAR6,#SCL_MUX ; XAR5->GPIO MUX control register for SCL
0000000a 70D4
45 0000000b 8F40 MOVL XAR5,#SDA_MUX ; XAR4->GPIO MUX control register for SDA
0000000c 70D4
46
47
48 0000000d 5609 TCLR *XAR5,#(SDA_BIT) ; Configure SDA pin in GPIO mode
0000000e 01C5
TMS320C2000 COFF Assembler PC Version 3.06 Fri Aug 01 12:16:20 2003
Tools Copyright (c) 1996-2002 Texas Instruments Incorporated
i2cm_io.asm PAGE 2
49 0000000f 5609 TCLR *XAR6,#(SCL_BIT) ; Configure SCL pin in GPIO mode
00000010 02C6
50
51 00000011 2B84 MOV *XAR4++,#IDLE_INDEX
52 00000012 2B84 MOV *XAR4++,#0 ; I2CCSR=0
53 00000013 2B84 MOV *XAR4++,#0 ; I2CDAT=0
54 00000014 2B84 MOV *XAR4++,#0 ; bitCntr=0
55 00000015 761A EDIS
56 00000016 0006 LRETR
57
58 ;======================================================================
59 ; i2cmTick : Periodic tick function
60 ;======================================================================
61 ;======================================================================
62 ; Entry Condition
63 ; AR4=Module Handle
64 ;======================================================================
65 00000017 _vi2cmTick:
66 00000017 7622 EALLOW
67 00000018 58C4 MOVZ AR0,*+XAR4[0] ; AR0=taskIndex
68 00000019 8F40' MOVL XAR5,#TASK_PTR
0000001a 0104
69 0000001b C595 MOVL XAR7,*+XAR5[AR0] ; XAR7=task[taskIndex]
70 0000001c 7680 MOVL XAR6,#SCL_DIR ; XAR5->GPIO direction register for SCL
0000001d 70D5
71 0000001e 8F40 MOVL XAR5,#SDA_DIR ; XAR4->GPIO direction register for SDA
0000001f 70D5
72 00000020 56BF MOVB AR0,#31,UNC ; AR0->offset for data register
00000021 1FA0
73 00000022 7620 LB *XAR7
74
75 ;=========================================================================
76 ; Issue Start Condition
77 ; STATE 1: Check for SDA and SCL HIGH
78 ;=========================================================================
79 00000023 START_S1:
80 00000023 28C4 MOV *+XAR4[0],#START_S3_INDEX
00000024 0006
81 00000025 4296 TBIT *+XAR6[AR0],#SCL_BIT
82 00000026 56BC MOVB *+XAR4[0],#START_S2_INDEX,NTC
00000027 04C4
83 00000028 4195 TBIT *+XAR5[AR0],#SDA_BIT
84 00000029 56BC MOVB *+XAR4[0],#START_S2_INDEX,NTC
0000002a 04C4
85 0000002b 761A EDIS
86 0000002c 0006 LRETR
87
88 ;=========================================================================
89 ; Issue Start Condition
90 ; STATE 2: De-Assert SDA & SCL lines
91 ;=========================================================================
92 0000002d START_S2:
93 0000002d 5609 TCLR *+XAR6[0],#(SCL_BIT) ; Set the SCL pin as input
0000002e 02C6
94 0000002f 5609 TCLR *+XAR5[0],#(SDA_BIT) ; Set the SDA pin as input
TMS320C2000 COFF Assembler PC Version 3.06 Fri Aug 01 12:16:20 2003
Tools Copyright (c) 1996-2002 Texas Instruments Incorporated
i2cm_io.asm PAGE 3
00000030 01C5
95 00000031 28C4 MOV *+XAR4[0],#START_S1_INDEX ; Update the Task to next state
00000032 0002
96 00000033 761A EDIS
97 00000034 0006 LRETR
98
99 ;=========================================================================
100 ; Issue Start Condition
101 ; STATE 3: Drive SDA pin LOW
102 ;=========================================================================
103 00000035 START_S3:
104 00000035 560D TSET *+XAR5[0],#(SDA_BIT) ; Set the SDA pin as output
00000036 01C5
105 00000037 5609 TCLR *+XAR5[AR0],#SDA_BIT ; Drive the SDA pin LOW
00000038 0195
106 00000039 28C4 MOV *+XAR4[0],#START_S4_INDEX ; Update the Task to next state
0000003a 0008
107 0000003b 761A EDIS
108 0000003c 0006 LRETR
109
110 ;=========================================================================
111 ; Issue Start Condition
112 ; STATE 4: Drive SCL pin LOW
113 ;=========================================================================
114
115 0000003d START_S4:
116 0000003d 560D TSET *+XAR6[0],#(SCL_BIT) ; Set the SCL pin as output
0000003e 02C6
117 0000003f 5609 TCLR *+XAR6[AR0],#SCL_BIT ; Drive the SCL pin LOW
00000040 0296
118 00000041 2BC4 MOV *+XAR4[0],#IDLE_INDEX ; Update the Task to next state
119 00000042 761A EDIS
120 00000043 0006 LRETR
121
122 ;=========================================================================
123 ; Issue Stop Condition
124 ; STATE 1: Drive SDA pin LOW
125 ;=========================================================================
126 00000044 STOP_S1:
127 00000044 560D TSET *+XAR5[0],#(SDA_BIT) ; Set the SDA pin as output
00000045 01C5
128 00000046 5609 TCLR *+XAR5[AR0],#SDA_BIT ; Drive the SDA pin LOW
00000047 0195
129 00000048 28C4 MOV *+XAR4[0],#STOP_S2_INDEX ; Update the Task to next state
00000049 000C
130 0000004a 761A EDIS
131 0000004b 0006 LRETR
132
133 ;=========================================================================
134 ; Issue Stop Condition
135 ; STATE 2: De-assert SCL pin, move to next state if SCL is sampled HIGH
136 ;=========================================================================
137 0000004c STOP_S2:
138 0000004c 5609 TCLR *+XAR6[0],#(SCL_BIT) ; Set the SCL pin as input
0000004d 02C6
TMS320C2000 COFF Assembler PC Version 3.06 Fri Aug 01 12:16:20 2003
Tools Copyright (c) 1996-2002 Texas Instruments Incorporated
i2cm_io.asm PAGE 4
139 0000004e 4296 TBIT *+XAR6[AR0],#SCL_BIT
140 0000004f 56BD MOVB *+XAR4[0],#STOP_S3_INDEX,TC
00000050 0EC4
141 00000051 761A EDIS
142 00000052 0006 LRETR
143
144 ;=========================================================================
145 ; Issue Stop Condition
146 ; STATE 3: De-assert SDA pin, move to next state if SDA is sampled HIGH
147 ;=========================================================================
148 00000053 STOP_S3:
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -