📄 basic_rf_send_packet.lst
字号:
1 .file "basic_rf_send_packet.c"
2 .arch atmega128
3 __SREG__ = 0x3f
4 __SP_H__ = 0x3e
5 __SP_L__ = 0x3d
6 __tmp_reg__ = 0
7 __zero_reg__ = 1
8 .global __do_copy_data
9 .global __do_clear_bss
12 .text
13 .Ltext0:
91 .global basicRfSendPacket
93 basicRfSendPacket:
1:../../../lib/basic_rf/basic_rf_send_packet.c **** /**************************************************************************************************
2:../../../lib/basic_rf/basic_rf_send_packet.c **** *
3:../../../lib/basic_rf/basic_rf_send_packet.c **** * **********
4:../../../lib/basic_rf/basic_rf_send_packet.c **** * ************
5:../../../lib/basic_rf/basic_rf_send_packet.c **** * *** ***
6:../../../lib/basic_rf/basic_rf_send_packet.c **** * *** +++ ***
7:../../../lib/basic_rf/basic_rf_send_packet.c **** * *** + + ***
8:../../../lib/basic_rf/basic_rf_send_packet.c **** * *** + CHIPCON CC2420 BASIC RF LIBRARY
9:../../../lib/basic_rf/basic_rf_send_packet.c **** * *** + + *** Packet transmission
10:../../../lib/basic_rf/basic_rf_send_packet.c **** * *** +++ ***
11:../../../lib/basic_rf/basic_rf_send_packet.c **** * *** ***
12:../../../lib/basic_rf/basic_rf_send_packet.c **** * ************
13:../../../lib/basic_rf/basic_rf_send_packet.c **** * **********
14:../../../lib/basic_rf/basic_rf_send_packet.c **** *
15:../../../lib/basic_rf/basic_rf_send_packet.c **** **************************************************************************************************
16:../../../lib/basic_rf/basic_rf_send_packet.c **** * This file contains packet transmission function.
17:../../../lib/basic_rf/basic_rf_send_packet.c **** *
18:../../../lib/basic_rf/basic_rf_send_packet.c **** * More information can be found in basic_rf.h
19:../../../lib/basic_rf/basic_rf_send_packet.c **** **************************************************************************************************
20:../../../lib/basic_rf/basic_rf_send_packet.c **** * Compiler: AVR-GCC
21:../../../lib/basic_rf/basic_rf_send_packet.c **** * Target platform: CC2420DB, CC2420 + any MCU with very few modifications required
22:../../../lib/basic_rf/basic_rf_send_packet.c **** **************************************************************************************************
23:../../../lib/basic_rf/basic_rf_send_packet.c **** * Revision history:
24:../../../lib/basic_rf/basic_rf_send_packet.c **** * $Log: basic_rf_send_packet.c,v $
25:../../../lib/basic_rf/basic_rf_send_packet.c **** * Revision 1.4 2004/07/26 11:28:10 mbr
26:../../../lib/basic_rf/basic_rf_send_packet.c **** * Modified RXFIFO flushing by strobing CC2420_SFLUSHRX
27:../../../lib/basic_rf/basic_rf_send_packet.c **** *
28:../../../lib/basic_rf/basic_rf_send_packet.c **** * Revision 1.3 2004/03/30 14:59:22 mbr
29:../../../lib/basic_rf/basic_rf_send_packet.c **** * Release for web
30:../../../lib/basic_rf/basic_rf_send_packet.c **** *
31:../../../lib/basic_rf/basic_rf_send_packet.c **** *
32:../../../lib/basic_rf/basic_rf_send_packet.c **** *
33:../../../lib/basic_rf/basic_rf_send_packet.c **** **************************************************************************************************
34:../../../lib/basic_rf/basic_rf_send_packet.c **** #include <include.h>
35:../../../lib/basic_rf/basic_rf_send_packet.c ****
36:../../../lib/basic_rf/basic_rf_send_packet.c ****
37:../../../lib/basic_rf/basic_rf_send_packet.c ****
38:../../../lib/basic_rf/basic_rf_send_packet.c ****
39:../../../lib/basic_rf/basic_rf_send_packet.c **** //-------------------------------------------------------------------------------------------------
40:../../../lib/basic_rf/basic_rf_send_packet.c **** // BYTE basicRfSendPacket(BASIC_RF_TX_INFO *pRTI)
41:../../../lib/basic_rf/basic_rf_send_packet.c **** //
42:../../../lib/basic_rf/basic_rf_send_packet.c **** // DESCRIPTION:
43:../../../lib/basic_rf/basic_rf_send_packet.c **** // Transmits a packet using the IEEE 802.15.4 MAC data packet format with short addresses. CCA is
44:../../../lib/basic_rf/basic_rf_send_packet.c **** // measured only once before backet transmission (not compliant with 802.15.4 CSMA-CA).
45:../../../lib/basic_rf/basic_rf_send_packet.c **** // The function returns:
46:../../../lib/basic_rf/basic_rf_send_packet.c **** // - When pRTI->ackRequest is FALSE: After the transmission has begun (SFD gone high)
47:../../../lib/basic_rf/basic_rf_send_packet.c **** // - When pRTI->ackRequest is TRUE: After the acknowledgment has been received/declared missing.
48:../../../lib/basic_rf/basic_rf_send_packet.c **** // The acknowledgment is received through the FIFOP interrupt.
49:../../../lib/basic_rf/basic_rf_send_packet.c **** //
50:../../../lib/basic_rf/basic_rf_send_packet.c **** // ARGUMENTS:
51:../../../lib/basic_rf/basic_rf_send_packet.c **** // BASIC_RF_TX_INFO *pRTI
52:../../../lib/basic_rf/basic_rf_send_packet.c **** // The transmission structure, which contains all relevant info about the packet.
53:../../../lib/basic_rf/basic_rf_send_packet.c **** //
54:../../../lib/basic_rf/basic_rf_send_packet.c **** // RETURN VALUE:
55:../../../lib/basic_rf/basic_rf_send_packet.c **** // BOOL
56:../../../lib/basic_rf/basic_rf_send_packet.c **** // Successful transmission (acknowledgment received)
57:../../../lib/basic_rf/basic_rf_send_packet.c **** //-------------------------------------------------------------------------------------------------
58:../../../lib/basic_rf/basic_rf_send_packet.c **** BOOL basicRfSendPacket(BASIC_RF_TX_INFO *pRTI) {
95 .LM1:
96 /* prologue: frame size=3 */
97 0000 EF92 push r14
98 0002 FF92 push r15
99 0004 1F93 push r17
100 0006 CF93 push r28
101 0008 DF93 push r29
102 000a CDB7 in r28,__SP_L__
103 000c DEB7 in r29,__SP_H__
104 000e 2397 sbiw r28,3
105 0010 0FB6 in __tmp_reg__,__SREG__
106 0012 F894 cli
107 0014 DEBF out __SP_H__,r29
108 0016 0FBE out __SREG__,__tmp_reg__
109 0018 CDBF out __SP_L__,r28
110 /* prologue end (size=13) */
111 001a 7C01 movw r14,r24
112 .L185:
59:../../../lib/basic_rf/basic_rf_send_packet.c **** WORD frameControlField;
60:../../../lib/basic_rf/basic_rf_send_packet.c **** UINT8 packetLength;
61:../../../lib/basic_rf/basic_rf_send_packet.c **** BOOL success;
62:../../../lib/basic_rf/basic_rf_send_packet.c **** BYTE spiStatusByte;
63:../../../lib/basic_rf/basic_rf_send_packet.c ****
64:../../../lib/basic_rf/basic_rf_send_packet.c **** // Wait until the transceiver is idle
65:../../../lib/basic_rf/basic_rf_send_packet.c **** while (FIFOP_IS_1 || SFD_IS_1);
114 .LM2:
115 001c 8099 sbic 48-0x20,0
116 001e FECF rjmp .L185
117 0020 8499 sbic 48-0x20,4
118 0022 FCCF rjmp .L185
66:../../../lib/basic_rf/basic_rf_send_packet.c ****
67:../../../lib/basic_rf/basic_rf_send_packet.c **** // Turn off global interrupts to avoid interference on the SPI interface
68:../../../lib/basic_rf/basic_rf_send_packet.c **** DISABLE_GLOBAL_INT();
120 .LM3:
121 /* #APP */
122 0024 F894 cli
123
69:../../../lib/basic_rf/basic_rf_send_packet.c ****
70:../../../lib/basic_rf/basic_rf_send_packet.c **** // Flush the TX FIFO just in case...
71:../../../lib/basic_rf/basic_rf_send_packet.c **** FASTSPI_STROBE(CC2420_SFLUSHTX);
125 .LM4:
126 /* #NOAPP */
127 0026 C098 cbi 56-0x20,0
128 0028 89E0 ldi r24,lo8(9)
129 002a 8FB9 out 47-0x20,r24
130 .L10:
131 002c 779B sbis 46-0x20,7
132 002e FECF rjmp .L10
133 0030 C09A sbi 56-0x20,0
72:../../../lib/basic_rf/basic_rf_send_packet.c ****
73:../../../lib/basic_rf/basic_rf_send_packet.c **** // Turn on RX if necessary
74:../../../lib/basic_rf/basic_rf_send_packet.c **** if (!rfSettings.receiveOn) FASTSPI_STROBE(CC2420_SRXON);
135 .LM5:
136 0032 8091 0000 lds r24,rfSettings+8
137 0036 8823 tst r24
138 0038 31F4 brne .L20
139 003a C098 cbi 56-0x20,0
140 003c 83E0 ldi r24,lo8(3)
141 003e 8FB9 out 47-0x20,r24
142 .L17:
143 0040 779B sbis 46-0x20,7
144 0042 FECF rjmp .L17
145 0044 C09A sbi 56-0x20,0
146 .L20:
75:../../../lib/basic_rf/basic_rf_send_packet.c ****
76:../../../lib/basic_rf/basic_rf_send_packet.c **** // Wait for the RSSI value to become valid
77:../../../lib/basic_rf/basic_rf_send_packet.c **** do {
78:../../../lib/basic_rf/basic_rf_send_packet.c **** FASTSPI_UPD_STATUS(spiStatusByte);
148 .LM6:
149 0046 C098 cbi 56-0x20,0
150 0048 1FB8 out 47-0x20,__zero_reg__
151 .L26:
152 004a 779B sbis 46-0x20,7
153 004c FECF rjmp .L26
154 004e 1FB1 in r17,47-0x20
155 0050 C09A sbi 56-0x20,0
79:../../../lib/basic_rf/basic_rf_send_packet.c **** } while (!(spiStatusByte & BM(CC2420_RSSI_VALID)));
157 .LM7:
158 0052 11FF sbrs r17,1
159 0054 F8CF rjmp .L20
160 .L29:
80:../../../lib/basic_rf/basic_rf_send_packet.c ****
81:../../../lib/basic_rf/basic_rf_send_packet.c **** // TX begins after the CCA check has passed
82:../../../lib/basic_rf/basic_rf_send_packet.c **** do {
83:../../../lib/basic_rf/basic_rf_send_packet.c **** FASTSPI_STROBE(CC2420_STXONCCA);
162 .LM8:
163 0056 C098 cbi 56-0x20,0
164 0058 85E0 ldi r24,lo8(5)
165 005a 8FB9 out 47-0x20,r24
166 .L35:
167 005c 779B sbis 46-0x20,7
168 005e FECF rjmp .L35
169 0060 C09A sbi 56-0x20,0
84:../../../lib/basic_rf/basic_rf_send_packet.c **** FASTSPI_UPD_STATUS(spiStatusByte);
171 .LM9:
172 0062 C098 cbi 56-0x20,0
173 0064 1FB8 out 47-0x20,__zero_reg__
174 .L41:
175 0066 779B sbis 46-0x20,7
176 0068 FECF rjmp .L41
177 006a 1FB1 in r17,47-0x20
178 006c C09A sbi 56-0x20,0
85:../../../lib/basic_rf/basic_rf_send_packet.c **** halWait(100);
180 .LM10:
181 006e 84E6 ldi r24,lo8(100)
182 0070 90E0 ldi r25,hi8(100)
183 0072 0E94 0000 call halWait
86:../../../lib/basic_rf/basic_rf_send_packet.c **** } while (!(spiStatusByte & BM(CC2420_TX_ACTIVE)));
185 .LM11:
186 0076 13FF sbrs r17,3
187 0078 EECF rjmp .L29
87:../../../lib/basic_rf/basic_rf_send_packet.c ****
88:../../../lib/basic_rf/basic_rf_send_packet.c **** // Write the packet to the TX FIFO (the FCS is appended automatically when AUTOCRC is enabled)
89:../../../lib/basic_rf/basic_rf_send_packet.c **** packetLength = pRTI->length + BASIC_RF_PACKET_OVERHEAD_SIZE;
189 .LM12:
190 007a F701 movw r30,r14
191 007c 8481 ldd r24,Z+4
192 007e 855F subi r24,lo8(-(11))
193 0080 8983 std Y+1,r24
90:../../../lib/basic_rf/basic_rf_send_packet.c **** FASTSPI_WRITE_FIFO((BYTE*)&packetLength, 1); // Packet length
195 .LM13:
196 0082 C098 cbi 56-0x20,0
197 0084 8EE3 ldi r24,lo8(62)
198 0086 8FB9 out 47-0x20,r24
199 .L47:
200 0088 779B sbis 46-0x20,7
201 008a FECF rjmp .L47
202 .LBB2:
203 008c 90E0 ldi r25,lo8(0)
204 008e 9E01 movw r18,r28
205 0090 2F5F subi r18,lo8(-(1))
206 0092 3F4F sbci r19,hi8(-(1))
207 .L58:
208 0094 F901 movw r30,r18
209 0096 E90F add r30,r25
210 0098 F11D adc r31,__zero_reg__
211 009a 8081 ld r24,Z
212 009c 8FB9 out 47-0x20,r24
213 .L55:
214 009e 779B sbis 46-0x20,7
215 00a0 FECF rjmp .L55
216 00a2 9F5F subi r25,lo8(-(1))
217 00a4 B9F3 breq .L58
218 .LBE2:
219 00a6 C09A sbi 56-0x20,0
91:../../../lib/basic_rf/basic_rf_send_packet.c **** frameControlField = pRTI->ackRequest ? BASIC_RF_FCF_ACK : BASIC_RF_FCF_NOACK;
221 .LM14:
222 00a8 F701 movw r30,r14
223 00aa 8781 ldd r24,Z+7
224 00ac 8823 tst r24
225 00ae 19F0 breq .L59
226 00b0 81E6 ldi r24,lo8(-30623)
227 00b2 98E8 ldi r25,hi8(-30623)
228 00b4 02C0 rjmp .L60
229 .L59:
230 00b6 81E4 ldi r24,lo8(-30655)
231 00b8 98E8 ldi r25,hi8(-30655)
232 .L60:
233 00ba 8A83 std Y+2,r24
234 00bc 9B83 std Y+3,r25
92:../../../lib/basic_rf/basic_rf_send_packet.c **** FASTSPI_WRITE_FIFO((BYTE*) &frameControlField, 2); // Frame control field
236 .LM15:
237 00be C098 cbi 56-0x20,0
238 00c0 8EE3 ldi r24,lo8(62)
239 00c2 8FB9 out 47-0x20,r24
240 .L64:
241 00c4 779B sbis 46-0x20,7
242 00c6 FECF rjmp .L64
243 .LBB3:
244 00c8 90E0 ldi r25,lo8(0)
245 00ca 9E01 movw r18,r28
246 00cc 2E5F subi r18,lo8(-(2))
247 00ce 3F4F sbci r19,hi8(-(2))
248 .L75:
249 00d0 F901 movw r30,r18
250 00d2 E90F add r30,r25
251 00d4 F11D adc r31,__zero_reg__
252 00d6 8081 ld r24,Z
253 00d8 8FB9 out 47-0x20,r24
254 .L72:
255 00da 779B sbis 46-0x20,7
256 00dc FECF rjmp .L72
257 00de 9F5F subi r25,lo8(-(1))
258 00e0 9230 cpi r25,lo8(2)
259 00e2 B0F3 brlo .L75
260 .LBE3:
261 00e4 C09A sbi 56-0x20,0
93:../../../lib/basic_rf/basic_rf_send_packet.c **** FASTSPI_WRITE_FIFO((BYTE*) &rfSettings.txSeqNumber, 1); // Sequence number
263 .LM16:
264 00e6 C098 cbi 56-0x20,0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -