📄 eeinfo.cod
字号:
00054 e59f1024 ldr r1, [pc, #0x24]
00058 e5820000 str r0, [r2]
0005c e3a00002 mov r0, #2
00060 e5810000 str r0, [r1]
; 194 :
; 195 : //
; 196 : // Program the CR1 register.
; 197 : //
; 198 : *SPI_CR1 = 0;
00064 e3a00000 mov r0, #0
00068 e59f200c ldr r2, [pc, #0xC]
; 199 :
; 200 : //
; 201 : // Hit the enable bit
; 202 : //
; 203 : *SPI_CR1 = SPICR1_SSE;
0006c e3a01010 mov r1, #0x10
00070 e5820000 str r0, [r2]
00074 e5821000 str r1, [r2]
; 204 : }
00078 e12fff1e bx lr
0007c |$L14005|
0007c b08a0004 DCD 0xb08a0004
00080 b08a0010 DCD 0xb08a0010
00084 b0840010 DCD 0xb0840010
00088 b0840004 DCD 0xb0840004
0008c b0840014 DCD 0xb0840014
00090 |$M14002|
ENDP ; |InitializeSPI|
00000 AREA |.text| { |TestSPI| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$TestSPI|, PDATA, SELECTION=5, ASSOC=|.text| { |TestSPI| } ; comdat associative
|$T14014| DCD |TestSPI|
DCD 0x40001101
; Function compile flags: /Ogsy
00000 AREA |.text| { |TestSPI| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |TestSPI| PROC
; 218 : {
00000 e92d4030 stmdb sp!, {r4, r5, lr}
00004 |$M14012|
; 219 : ULONG ulManufacturer, ulDevice, ulTemp;
; 220 : // ULONGLONG ullStart, ullMax, ullCurrent;
; 221 :
; 222 : //
; 223 : // Issue the command for reading the SPI Product ID register.
; 224 : //
; 225 : *SPI_DR = SPIEE_RDID;
00004 e59f5034 ldr r5, [pc, #0x34]
00008 e3a00015 mov r0, #0x15
; 226 : *SPI_DR = 0;
0000c e3a04000 mov r4, #0
00010 e5850000 str r0, [r5]
00014 e5854000 str r4, [r5]
; 227 : *SPI_DR = 0;
00018 e5854000 str r4, [r5]
; 228 :
; 229 : //
; 230 : // Wait until the transmit fifo is flushed.
; 231 : //
; 232 : WaitTillTransmitFifoEmpty();
0001c eb000000 bl WaitTillTransmitFifoEmpty
; 233 :
; 234 : //
; 235 : // Read one byte and throw it away.
; 236 : //
; 237 : ulTemp = *SPI_DR;
00020 e5953000 ldr r3, [r5]
; 238 :
; 239 : //
; 240 : // Read the Manufacturers code.
; 241 : //
; 242 : ulManufacturer = *SPI_DR;
00024 e5951000 ldr r1, [r5]
; 243 :
; 244 : //
; 245 : // Read the device code.
; 246 : //
; 247 : ulDevice = *SPI_DR;
00028 e5950000 ldr r0, [r5]
; 248 :
; 249 : //
; 250 : // Check to see if the Manufacturer is atmel if so return 1.
; 251 : //
; 252 : return (ulManufacturer ==0x1F);
0002c e351001f cmp r1, #0x1F
00030 03a04001 moveq r4, #1
00034 e1a00004 mov r0, r4
; 253 : }
00038 e8bd4030 ldmia sp!, {r4, r5, lr}
0003c e12fff1e bx lr
00040 |$L14016|
00040 b08a0008 DCD 0xb08a0008
00044 |$M14013|
ENDP ; |TestSPI|
EXPORT |??_C@_0CE@CGIN@EEINFO?3?5ClearReceiveFifo?5Timeout@| [ DATA ] ; `string'
EXPORT |??_C@_0CD@JPLD@EEINFO?3?5ReadEEWord?51rst?5Timeout?4@| [ DATA ] ; `string'
EXPORT |??_C@_0CC@IDBP@EEINFO?3?5ReadEEWord?52nd?5Timeout?4?$AN@| [ DATA ] ; `string'
EXPORT |??_C@_0CL@DKJP@EEINFO?3?5Receive?5?$DN?50x?$CFx?0?5Transmit@| [ DATA ] ; `string'
IMPORT |GetSystemTimeInUSec|
00000 AREA |.text| { |ReadEEWord| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 AREA |.pdata$$ReadEEWord|, PDATA, SELECTION=5, ASSOC=|.text| { |ReadEEWord| } ; comdat associative
|$T14043| DCD |ReadEEWord|
DCD 0x40006602
00000 AREA |.rdata| { |??_C@_0CE@CGIN@EEINFO?3?5ClearReceiveFifo?5Timeout@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0CE@CGIN@EEINFO?3?5ClearReceiveFifo?5Timeout@| DCB "EEINFO: ClearR"
DCB "eceiveFifo Timeout.", 0xd, 0xa, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0CD@JPLD@EEINFO?3?5ReadEEWord?51rst?5Timeout?4@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0CD@JPLD@EEINFO?3?5ReadEEWord?51rst?5Timeout?4@| DCB "EEINFO: Read"
DCB "EEWord 1rst Timeout.", 0xd, 0xa, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0CC@IDBP@EEINFO?3?5ReadEEWord?52nd?5Timeout?4?$AN@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0CC@IDBP@EEINFO?3?5ReadEEWord?52nd?5Timeout?4?$AN@| DCB "EEINFO: R"
DCB "eadEEWord 2nd Timeout.", 0xd, 0xa, 0x0 ; `string'
00000 AREA |.rdata| { |??_C@_0CL@DKJP@EEINFO?3?5Receive?5?$DN?50x?$CFx?0?5Transmit@| }, DATA, READONLY, SELECTION=2 ; comdat any
|??_C@_0CL@DKJP@EEINFO?3?5Receive?5?$DN?50x?$CFx?0?5Transmit@| DCB "EEINF"
DCB "O: Receive = 0x%x, Transmit = 0x%x.", 0xd, 0xa, 0x0 ; `string'
; Function compile flags: /Ogsy
00000 AREA |.text| { |ReadEEWord| }, CODE, ARM, SELECTION=1 ; comdat noduplicate
00000 |ReadEEWord| PROC
; 265 : {
00000 e92d4ff0 stmdb sp!, {r4 - r11, lr}
00004 e24dd004 sub sp, sp, #4
00008 |$M14041|
00008 e1a04000 mov r4, r0
0000c e1a08001 mov r8, r1
00010 e1a07002 mov r7, r2
; 266 : ULONG ulCount, ulTransmitCount = 0;
00014 e3a02000 mov r2, #0
00018 e1a09002 mov r9, r2
; 267 : ULONG ulReceiveCount = 0;
; 268 : volatile ULONG ulTemp;
; 269 : ULONGLONG ullStart, ullMax, ullCurrent;
; 270 : BOOL bRet;
; 271 :
; 272 :
; 273 : //
; 274 : // Make sure that the receive fifo is clear.
; 275 : //
; 276 : bRet = ClearReceiveFifo();
0001c eb000000 bl ClearReceiveFifo
00020 e3500000 cmp r0, #0
; 277 : if(!bRet)
00024 1a000002 bne |$L13882|
; 278 : {
; 279 : EdbgOutputDebugString("EEINFO: ClearReceiveFifo Timeout.\r\n");
00028 e59f0164 ldr r0, [pc, #0x164]
0002c eb000000 bl EdbgOutputDebugString
; 280 : return bRet;
00030 ea00004b b |$L14039|
00034 |$L13882|
; 281 : }
; 282 :
; 283 :
; 284 :
; 285 : //
; 286 : // Send the Chip Read command.
; 287 : //
; 288 : *SPI_DR = SPIEE_READ_LOW;
00034 e59fb154 ldr r11, [pc, #0x154]
00038 e3a00003 mov r0, #3
0003c e58b0000 str r0, [r11]
; 289 :
; 290 : //
; 291 : // Send the three byte address.
; 292 : //
; 293 : *SPI_DR = (ulAddress >> 16) & 0xFF;
00040 e1a00404 mov r0, r4, lsl #8
00044 e1a01c20 mov r1, r0, lsr #24
; 294 : *SPI_DR = (ulAddress >> 8) & 0xFF;
00048 e1a00804 mov r0, r4, lsl #16
0004c e58b1000 str r1, [r11]
00050 e1a01c20 mov r1, r0, lsr #24
; 295 : *SPI_DR = ulAddress & 0xFF;
00054 e20400ff and r0, r4, #0xFF
00058 e58b1000 str r1, [r11]
0005c e58b0000 str r0, [r11]
; 296 :
; 297 : //
; 298 : // Wait until we send 3 bytes.
; 299 : //
; 300 : ulCount = 0;
00060 e3a00000 mov r0, #0
00064 e1a06000 mov r6, r0
; 301 : ullStart = GetSystemTimeInUSec();
00068 eb000000 bl GetSystemTimeInUSec
; 302 : ullMax = ullStart + SPI_MINTIME + 3 * SPI_BYTETIME;
0006c e59fa118 ldr r10, [pc, #0x118]
00070 e29050e6 adds r5, r0, #0xE6
00074 e2a14000 adc r4, r1, #0
00078 |$L13888|
; 303 :
; 304 : do
; 305 : {
; 306 : //
; 307 : // Check to see if there are bytes to receive.
; 308 : //
; 309 : if(*SPI_SR & SPISR_RNE)
00078 e59a0000 ldr r0, [r10]
0007c e3100004 tst r0, #4
; 310 : {
; 311 : ulTemp = *SPI_DR;
00080 159b0000 ldrne r0, [r11]
; 312 : ulCount++;
00084 12866001 addne r6, r6, #1
00088 158d0000 strne r0, [sp]
; 313 : }
; 314 :
; 315 : //
; 316 : // Check to see if we can transmit data so that we can receive.
; 317 : //
; 318 : if(ulTransmitCount <ulLength && (*SPI_SR & SPISR_TNF))
0008c e1590008 cmp r9, r8
00090 2a000004 bcs |$L13895|
00094 e59a0000 ldr r0, [r10]
00098 e3100002 tst r0, #2
; 319 : {
; 320 : *SPI_DR = 0;
0009c 13a00000 movne r0, #0
000a0 158b0000 strne r0, [r11]
; 321 : ulTransmitCount++;
000a4 12899001 addne r9, r9, #1
000a8 |$L13895|
; 322 : }
; 323 :
; 324 : //
; 325 : // Have a timeout so the system does not get stuck.
; 326 : //
; 327 : ullCurrent = GetSystemTimeInUSec();
000a8 eb000000 bl GetSystemTimeInUSec
; 328 : if(ullMax < ullCurrent)
000ac e1540001 cmp r4, r1
000b0 3a000022 bcc |$L14021|
000b4 8a000001 bhi |$L14025|
000b8 e1550000 cmp r5, r0
000bc 3a00001f bcc |$L14021|
000c0 |$L14025|
; 331 : return(0);
; 332 : }
; 333 :
; 334 : } while(ulCount < 4);
000c0 e3560004 cmp r6, #4
000c4 3affffeb bcc |$L13888|
; 335 :
; 336 : //
; 337 : // Read in the rest of the data.
; 338 : //
; 339 : ullStart = GetSystemTimeInUSec();
000c8 eb000000 bl GetSystemTimeInUSec
; 340 : ullMax = ullStart + SPI_MINTIME + ulLength * SPI_BYTETIME;
000cc e0882108 add r2, r8, r8, lsl #2
; 372 : return (1);
000d0 e0903082 adds r3, r0, r2, lsl #1
000d4 e2a10000 adc r0, r1, #0
000d8 e29350c8 adds r5, r3, #0xC8
000dc e3a02000 mov r2, #0
000e0 e2a04000 adc r4, r0, #0
000e4 e1a06002 mov r6, r2
000e8 |$L13899|
000e8 e59a0000 ldr r0, [r10]
000ec e3100004 tst r0, #4
000f0 159b0000 ldrne r0, [r11]
000f4 17c60007 strneb r0, [r6, +r7]
000f8 120010ff andne r1, r0, #0xFF
000fc 12866001 addne r6, r6, #1
00100 e1590008 cmp r9, r8
00104 2a000003 bcs |$L13907|
00108 e59a0000 ldr r0, [r10]
0010c e3100002 tst r0, #2
00110 158b2000 strne r2, [r11]
00114 12899001 addne r9, r9, #1
00118 |$L13907|
00118 eb000000 bl GetSystemTimeInUSec
0011c e1540001 cmp r4, r1
00120 3a000009 bcc |$L14023|
; 341 : ulCount = 0;
; 342 : do
; 343 : {
; 344 : //
; 345 : // Check to see if there are bytes to receive.
; 346 : //
; 347 : if(*SPI_SR & SPISR_RNE)
; 348 : {
; 349 : pucData[ulCount++] = (UCHAR)(*SPI_DR & 0xFF);
; 350 : }
; 351 :
; 352 : //
; 353 : // Check to see if we can transmit data so that we can receive.
; 354 : //
; 355 : if(ulTransmitCount <ulLength && (*SPI_SR & SPISR_TNF))
; 356 : {
; 357 : *SPI_DR = 0;
; 358 : ulTransmitCount++;
; 359 : }
; 360 :
; 361 : //
; 362 : // Have a timeout so the system does not get stuck.
; 363 : //
; 364 : ullCurrent = GetSystemTimeInUSec();
; 365 : if(ullMax < ullCurrent)
00124 8a000001 bhi |$L14026|
00128 e1550000 cmp r5, r0
0012c 3a000006 bcc |$L14023|
00130 |$L14026|
; 370 : }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -