📄 fw_epmg.lst
字号:
347
348 fw_controlData.wCount += FW_EP0_MAXPACKET_SIZE;
\ 000000DA 6089 LDRH R0,[R4, #+10]
\ 000000DC 0830 ADD R0,#+8
\ 000000DE 6081 STRH R0,[R4, #+10]
\ 000000E0 0FE0 B ??fw_ep0RxTxDone_3
349 }
350 /* last read */
351 else
352 {
353 if( _i != 0)
\ ??fw_ep0RxTxDone_13:
\ 000000E2 002F CMP R7,#+0
\ 000000E4 0DD0 BEQ ??fw_ep0RxTxDone_3
354 {
355 _Read=fw_readEndpoint(FW_EP_CTRL, fw_controlData.pData + fw_controlData.wCount);
\ 000000E6 0020 MOV R0,#+0
\ 000000E8 ........ _BLF fw_readEndpoint,??fw_readEndpoint??rT
356 if (_Read == 0)
357 {
358 // End of SetupPhase
359 goto EOSP;
360 }
361 fw_controlData.wCount += _i;
362
363 EOSP: fw_controlData.wLength = 0;
\ ??fw_ep0RxTxDone_14:
\ 000000EC 0020 MOV R0,#+0
\ 000000EE A060 STR R0,[R4, #+8]
364 fw_controlData.wCount = 0;
365 fw_controlData.state = FW_STATE_END;
\ 000000F0 2073 STRB R0,[R4, #+12]
366 fw_controlData.pData = NULL;
\ 000000F2 2061 STR R0,[R4, #+16]
\ 000000F4 05E0 B ??fw_ep0RxTxDone_3
367 }
368 }
369 }
370 }
371 else // received a OUT status phase
372 {
373 if( AT91F_UDP_EpStatus( USBDEV_BASE_UDP, FW_EP_CTRL ) & USBDEV_UDP_RX_DATA_BK0 )
\ ??fw_ep0RxTxDone_7:
\ 000000F6 2842 TST R0,R5
\ 000000F8 03D0 BEQ ??fw_ep0RxTxDone_3
374 {
375 if (fw_readEndpoint(FW_EP_CTRL,_buff)==0)
\ 000000FA 6946 MOV R1,SP
\ 000000FC 0020 MOV R0,#+0
\ 000000FE ........ _BLF fw_readEndpoint,??fw_readEndpoint??rT
\ ??fw_ep0RxTxDone_3:
\ 00000102 FCBC POP {R2-R7}
\ 00000104 01BC POP {R0}
\ 00000106 0047 BX R0 ;; return
\ ??fw_ep0RxTxDone_6:
\ 00000108 3000FBFF DC32 0xfffb0030
376 {
377 // receive a NULL packet, Status Phase
378 }
379 }
380 }
381 }
382 }
383
384
385 /*****************************************************************
386 *
387 * ROUTINE fw_mainRxDone
388 *
389 *-----------------------------------------------------------------
390 *
391 * Purpose :
392 * when something is received on main EP, put the data in the TBs
393 *
394 * Input parameters : NONE
395 *
396 * Output parameters : NONE
397 *
398 * Global data : fw_TB : array of the buffer IDs
399 * fw_writeTB : TB currently used by the firmware
400 *
401 *****************************************************************/
\ In segment CODE, align 4, keep-with-next
402 void fw_mainRxDone(void)
403 {
\ fw_mainRxDone:
\ 00000000 F0B5 PUSH {R4-R7,LR}
404 ULONG _len = 0;
405 structTB *_TB,**_nextTB;
406
407 _nextTB = fw_writeTB + 1;
\ 00000002 .... LDR R4,??DataTable17 ;; fw_writeTB
\ 00000004 2068 LDR R0,[R4, #+0]
\ 00000006 051D ADD R5,R0,#+4
408 if(_nextTB > (fw_TB + (FW_TB_NUM - 1)))
\ 00000008 .... LDR R1,??DataTable16 ;; fw_TB
\ 0000000A 0A1C MOV R2,R1
\ 0000000C 1C32 ADD R2,#+28
\ 0000000E AA42 CMP R2,R5
\ 00000010 00D2 BCS ??fw_mainRxDone_0
409 {
410 _nextTB = fw_TB;
\ 00000012 0D1C MOV R5,R1
411 }
412
413 /* Check if two TB are marked not valid to overwrite data */
414 if(!(fw_writeTB[0][0].status & FW_VBIT) && !(_nextTB[0][0].status & FW_VBIT))
\ ??fw_mainRxDone_0:
\ 00000014 .... LDR R6,??DataTable8 ;; fw_deviceState
\ 00000016 8027 MOV R7,#+128
\ 00000018 0068 LDR R0,[R0, #+0]
\ 0000001A 0068 LDR R0,[R0, #+0]
\ 0000001C 3842 TST R0,R7
\ 0000001E 13D1 BNE ??fw_mainRxDone_1
\ 00000020 2868 LDR R0,[R5, #+0]
\ 00000022 0068 LDR R0,[R0, #+0]
\ 00000024 3842 TST R0,R7
\ 00000026 0FD1 BNE ??fw_mainRxDone_1
\ 00000028 1449 LDR R1,??fw_mainRxDone_2 ;; databuffer
\ 0000002A 0220 MOV R0,#+2
415 {
416 /* Read the bytes received */
417 _len = fw_readEndpoint(FW_EP_BULK_OUT, databuffer);
\ 0000002C ........ _BLF fw_readEndpoint,??fw_readEndpoint??rT
418 _TB = fw_writeTB[0];
419 /* Check if we effectively received data */
420 if(_len != 0)
\ 00000030 0028 CMP R0,#+0
\ 00000032 03D0 BEQ ??fw_mainRxDone_3
421 {
422 _len = fw_writeRxData(_len,databuffer);
\ 00000034 1149 LDR R1,??fw_mainRxDone_2 ;; databuffer
\ 00000036 ........ BL fw_writeRxData
\ 0000003A 09E0 B ??fw_mainRxDone_4
423 }
424 else
425 {
426 if(_TB->length == 0)
\ ??fw_mainRxDone_3:
\ 0000003C 2068 LDR R0,[R4, #+0]
\ 0000003E 0068 LDR R0,[R0, #+0]
\ 00000040 4068 LDR R0,[R0, #+4]
\ 00000042 0028 CMP R0,#+0
\ 00000044 04D1 BNE ??fw_mainRxDone_4
\ 00000046 17E0 B ??fw_mainRxDone_5
427 {
428 /* If the len received is 0 and the TB is empty get out of the function,
429 not to fill an empty TB */
430 return;
431 }
432 }
433 }
434 /* if we must use the TB pool and it's full */
435 else
436 {
437 /* Some data have been received and we can't write */
438 /* So set a flag to retry the reception later */
439 fw_deviceState |= FW_DS_TB_FULL | FW_DS_RX;
\ ??fw_mainRxDone_1:
\ 00000048 3078 LDRB R0,[R6, #+0]
\ 0000004A 1821 MOV R1,#+24
\ 0000004C 0143 ORR R1,R0
\ 0000004E 3170 STRB R1,[R6, #+0]
440
441 TRACE_ERROR( "TB FULL\n\r");
442 }
443
444 /* Check if two TB are marked valid */
445 if((fw_writeTB[0][0].status & FW_VBIT) || (_nextTB[0][0].status & FW_VBIT))
\ ??fw_mainRxDone_4:
\ 00000050 2068 LDR R0,[R4, #+0]
\ 00000052 0068 LDR R0,[R0, #+0]
\ 00000054 0068 LDR R0,[R0, #+0]
\ 00000056 3842 TST R0,R7
\ 00000058 03D1 BNE ??fw_mainRxDone_6
\ 0000005A 2868 LDR R0,[R5, #+0]
\ 0000005C 0068 LDR R0,[R0, #+0]
\ 0000005E 3842 TST R0,R7
\ 00000060 07D0 BEQ ??fw_mainRxDone_7
446 {
447 /* disable interrupt if we can't receive next time */
448 AT91F_UDP_DisableIt( USBDEV_BASE_UDP, AT91C_UDP_EPINT2 ); // EP_BULK_OUT
\ ??fw_mainRxDone_6:
\ 00000062 0748 LDR R0,??fw_mainRxDone_2+0x4 ;; 0xfffb0014
\ 00000064 0421 MOV R1,#+4
\ 00000066 0160 STR R1,[R0, #+0]
449 /* some data have been received and we can't write */
450 /* So set a flag to retry the reception later */
451 fw_deviceState |= FW_DS_RX;
\ 00000068 3078 LDRB R0,[R6, #+0]
\ 0000006A 0821 MOV R1,#+8
\ 0000006C 0143 ORR R1,R0
\ 0000006E 3170 STRB R1,[R6, #+0]
\ 00000070 02E0 B ??fw_mainRxDone_5
452 }
453 else
454 {
455 /* enable interrupt we can receive next time */
456 AT91F_UDP_EnableIt( USBDEV_BASE_UDP, AT91C_UDP_EPINT2 ); // EP_BULK_OUT
\ ??fw_mainRxDone_7:
\ 00000072 0448 LDR R0,??fw_mainRxDone_2+0x8 ;; 0xfffb0010
\ 00000074 0421 MOV R1,#+4
\ 00000076 0160 STR R1,[R0, #+0]
\ ??fw_mainRxDone_5:
\ 00000078 .... B ?Subroutine7
\ 0000007A C046 NOP
\ ??fw_mainRxDone_2:
\ 0000007C ........ DC32 databuffer
\ 00000080 1400FBFF DC32 0xfffb0014
\ 00000084 1000FBFF DC32 0xfffb0010
457 }
458 }
\ In segment CODE, align 4, keep-with-next
\ ?Subroutine7:
\ 00000000 F0BC POP {R4-R7}
\ 00000002 01BC POP {R0}
\ 00000004 0047 BX R0 ;; return
\ 00000006 C046 NOP
\ ??Subroutine7_0:
\ 00000008 ........ DC32 fw_fifoId
\ 0000000C ........ DC32 TxBuffer
\ 00000010 ........ DC32 fw_lastTxPacket
\ 00000014 ........ DC32 USB_TX
459
460
461 /*****************************************************************
462 *
463 * ROUTINE fw_mainTxDone
464 *
465 *-----------------------------------------------------------------
466 *
467 * Purpose :
468 * called when something is transmitted by main EP,
469 * pick data in the IN FIFO and transmit it
470 *
471 * Input parameters : NONE
472 *
473 * Output parameters : NONE
474 *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -