📄 ms_rbc.lst
字号:
386 _expected = request->buffer_size - request->transferred_size;
\ 00000006 C069 LDR R0,[R0, #+28]
\ 00000008 616A LDR R1,[R4, #+36]
\ 0000000A 401A SUB R0,R0,R1
\ 0000000C 0090 STR R0,[SP, #+0]
387
388 if(_expected > request->data_buff.NbOctetsLibres)
\ 0000000E 6069 LDR R0,[R4, #+20]
\ 00000010 0099 LDR R1,[SP, #+0]
\ 00000012 8842 CMP R0,R1
\ 00000014 00D2 BCS ??rbc_commun_write_0
389 {
390 _expected = request->data_buff.NbOctetsLibres;
\ 00000016 0090 STR R0,[SP, #+0]
391 }
392
393 /* Try to retreive data if already received */
394 _buff = po_malloc(_expected);
\ ??rbc_commun_write_0:
\ 00000018 0098 LDR R0,[SP, #+0]
\ 0000001A ........ _BLF po_malloc,??po_malloc??rT
\ 0000001E 061C MOV R6,R0
\ 00000020 4B4D LDR R5,??rbc_commun_write_1 ;; usbms_context + 185
\ 00000022 0BD1 BNE ??rbc_commun_write_2
395 if(_buff == NULL)
396 {
397 /* Not enough memory */
398 TRACE_ERROR( "Allocfaild: %i \n\r", (int)_expected);
399 ms_stallPipe(FW_EP_BULK_OUT);
\ ??rbc_commun_write_3:
\ 00000024 0220 MOV R0,#+2
\ 00000026 ........ _BLF ms_stallPipe,??ms_stallPipe??rT
400 ms_computeCSW(COMMAND_FAILED,_expected);
\ 0000002A 0099 LDR R1,[SP, #+0]
\ 0000002C 0120 MOV R0,#+1
\ 0000002E ........ _BLF ms_computeCSW,??ms_computeCSW??rT
401 usbms_context.state = RESET_IN_PROGRESS;
\ 00000032 0420 MOV R0,#+4
\ 00000034 A876 STRB R0,[R5, #+26]
402 return USBMS_ERROR;
\ 00000036 0020 MOV R0,#+0
\ 00000038 C043 MVN R0,R0 ;; #-1
\ 0000003A 85E0 B ??rbc_commun_write_4
403 }
404 _recLength = ms_retreiveTb((char*)_buff , _expected);
\ ??rbc_commun_write_2:
\ 0000003C 0099 LDR R1,[SP, #+0]
\ 0000003E ........ _BLF ms_retreiveTb,??ms_retreiveTb??rT
\ 00000042 0704 LSL R7,R0,#+16
\ 00000044 3F0C LSR R7,R7,#+16
\ 00000046 10D1 BNE ??rbc_commun_write_5
405 if(_recLength == 0)
406 {
407 /* don't received anything yet */
408 /* end of request ? */
409 if(request->buffer_size == request->transferred_size)
\ 00000048 E069 LDR R0,[R4, #+28]
\ 0000004A 616A LDR R1,[R4, #+36]
\ 0000004C 8842 CMP R0,R1
\ 0000004E 05D1 BNE ??rbc_commun_write_6
410 {
411 /* compute CSW and send it */
412 ms_send_bot_status(GOOD_STATUS,0);
\ 00000050 0021 MOV R1,#+0
\ 00000052 0020 MOV R0,#+0
\ 00000054 ........ _BLF ms_send_bot_status,??ms_send_bot_status??rT
413 /* STATE = PROCESS CSW */
414 usbms_context.state = PROCESS_CSW;
\ 00000058 0520 MOV R0,#+5
\ 0000005A 00E0 B ??rbc_commun_write_7
415 }
416 else
417 {
418 /* the processing is in progress */
419 usbms_context.state = GET_FROM_USB;
\ ??rbc_commun_write_6:
\ 0000005C 0120 MOV R0,#+1
\ ??rbc_commun_write_7:
\ 0000005E A876 STRB R0,[R5, #+26]
420 }
421 po_free(_buff);
\ 00000060 301C MOV R0,R6
\ 00000062 ........ _BLF po_free,??po_free??rT
422 return USBMS_OK;
\ ??rbc_commun_write_8:
\ 00000066 0020 MOV R0,#+0
\ 00000068 6EE0 B ??rbc_commun_write_4
423 }
424 po_rngBufPut(&request->data_buff, (char*)_buff, _recLength);
\ ??rbc_commun_write_5:
\ 0000006A 3A1C MOV R2,R7
\ 0000006C 311C MOV R1,R6
\ 0000006E 201D ADD R0,R4,#+4
\ 00000070 ........ _BLF po_rngBufPut,??po_rngBufPut??rT
425 po_free(_buff);
\ 00000074 301C MOV R0,R6
\ 00000076 ........ _BLF po_free,??po_free??rT
426
427 /* How much can we write to Flash ? */
428 _recLength = MAX_TRANSFER_SIZE - request->data_buff.NbOctetsLibres;
\ 0000007A 8020 MOV R0,#+128
\ 0000007C 8000 LSL R0,R0,#+2 ;; #+512
\ 0000007E 6169 LDR R1,[R4, #+20]
\ 00000080 471A SUB R7,R0,R1
\ 00000082 3F04 LSL R7,R7,#+16
\ 00000084 3F0C LSR R7,R7,#+16
429 /* Reinit expected length */
430 _expected = request->buffer_size - request->transferred_size;
\ 00000086 E069 LDR R0,[R4, #+28]
\ 00000088 616A LDR R1,[R4, #+36]
\ 0000008A 401A SUB R0,R0,R1
\ 0000008C 0090 STR R0,[SP, #+0]
431 if( _expected < lun->BlockSize )
\ 0000008E 0398 LDR R0,[SP, #+12]
\ 00000090 0268 LDR R2,[R0, #+0]
\ 00000092 0098 LDR R0,[SP, #+0]
\ 00000094 9042 CMP R0,R2
\ 00000096 06D2 BCS ??rbc_commun_write_9
432 {
433 /* remainig data size of the command is less than a BLOCK */
434 if( _expected > _recLength )
\ 00000098 8742 CMP R7,R0
\ 0000009A 01D3 BCC ??rbc_commun_write_10
435 {
436 _length = _recLength;
437 }
438 else
439 {
440 _length = _expected;
\ 0000009C 0704 LSL R7,R0,#+16
\ 0000009E 3F0C LSR R7,R7,#+16
441 }
442 /* current block index will not update */
443 _nbBlock = 0;
\ ??rbc_commun_write_10:
\ 000000A0 0020 MOV R0,#+0
\ 000000A2 0290 STR R0,[SP, #+8]
\ 000000A4 08E0 B ??rbc_commun_write_11
444 }
445 else
446 {
447 /* we are not at the end of the SCSI command */
448 /* only send full blocks */
449 _length = (_recLength / lun->BlockSize)*lun->BlockSize ; /* Size in blocks */
\ ??rbc_commun_write_9:
\ 000000A6 381C MOV R0,R7
\ 000000A8 111C MOV R1,R2
\ 000000AA ........ _BLF ??divu32_t,??rT??divu32_t
\ 000000AE 0F1C MOV R7,R1
\ 000000B0 5743 MUL R7,R2
\ 000000B2 3F04 LSL R7,R7,#+16
\ 000000B4 3F0C LSR R7,R7,#+16
450 _nbBlock = (_recLength / lun->BlockSize);
\ 000000B6 0291 STR R1,[SP, #+8]
451 }
452
453 if(_length == 0)
\ ??rbc_commun_write_11:
\ 000000B8 381C MOV R0,R7
\ 000000BA 02D1 BNE ??rbc_commun_write_12
454 {
455 /* Not a full block received yet, return */
456 usbms_context.state = GET_FROM_USB;
\ 000000BC 0120 MOV R0,#+1
\ 000000BE A876 STRB R0,[R5, #+26]
457 return USBMS_OK;
\ 000000C0 D1E7 B ??rbc_commun_write_8
458 }
459
460 /* Retreive a temp buffer */
461 _buff = po_malloc(_length);
\ ??rbc_commun_write_12:
\ 000000C2 ........ _BLF po_malloc,??po_malloc??rT
\ 000000C6 061C MOV R6,R0
462 if(_buff == NULL)
\ 000000C8 ACD0 BEQ ??rbc_commun_write_3
463 {
464 /* Not enough memory */
465 TRACE_ERROR( "Allocfail2: %d \n\r", _length);
466 ms_stallPipe(FW_EP_BULK_OUT);
467 ms_computeCSW(COMMAND_FAILED,_expected);
468 usbms_context.state = RESET_IN_PROGRESS;
469 return USBMS_ERROR;
470 }
471
472 _recLength = po_rngBufGet(&request->data_buff, (char*)_buff, _length);
\ 000000CA 3A1C MOV R2,R7
\ 000000CC 311C MOV R1,R6
\ 000000CE 201D ADD R0,R4,#+4
\ 000000D0 ........ _BLF po_rngBufGet,??po_rngBufGet??rT
\ 000000D4 0704 LSL R7,R0,#+16
\ 000000D6 3F0C LSR R7,R7,#+16
473
474 if( true == AT91F_Flash_Write_Address( (unsigned int)(BASE_mmc_Add + (request->current_block*usbms_context.usb_lun[usbms_context.current_lun].BlockSize)),
475 _recLength,
476 (unsigned char*)_buff, FALSE) )
\ 000000D8 0023 MOV R3,#+0
\ 000000DA 391C MOV R1,R7
\ 000000DC 02B4 PUSH {R1}
\ 000000DE B446 MOV R12,R6
\ 000000E0 2188 LDRH R1,[R4, #+0]
\ 000000E2 2878 LDRB R0,[R5, #+0]
\ 000000E4 3822 MOV R2,#+56
\ 000000E6 5043 MUL R0,R2
\ 000000E8 .... LDR R2,??DataTable5 ;; usbms_context
\ 000000EA 1058 LDR R0,[R2, R0]
\ 000000EC 4843 MUL R0,R1
\ 000000EE 6246 MOV R2,R12
\ 000000F0 02BC POP {R1}
\ 000000F2 ........ _BLF AT91F_Flash_Write_Address,??AT91F_Flash_Write_Address??rT
\ 000000F6 0128 CMP R0,#+1
\ 000000F8 6846 MOV R0,SP
\ 000000FA 13D1 BNE ??rbc_commun_write_13
477 {
478 _status = USBMS_OK;
\ 000000FC 0021 MOV R1,#+0
\ 000000FE 0171 STRB R1,[R0, #+4]
479 /* buffer (index) */
480 request->current_block += _nbBlock;
\ 00000100 2088 LDRH R0,[R4, #+0]
\ 00000102 0299 LDR R1,[SP, #+8]
\ 00000104 4018 ADD R0,R0,R1
\ 00000106 2080 STRH R0,[R4, #+0]
481 /* size to be send */
482 request->transferred_size += _recLength;
\ 00000108 606A LDR R0,[R4, #+36]
\ 0000010A C019 ADD R0,R0,R7
\ 0000010C 6062 STR R0,[R4, #+36]
483
484 /* end of request ? */
485 if(request->buffer_size == request->transferred_size)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -