Skip to content
  • Łukasz Majewski's avatar
    dfu: usb: f_dfu: Set deferred call for dfu_flush() function · fc18f8d1
    Łukasz Majewski authored
    This patch fixes situation when one would like to write large file into
    medium with the file system (fat, ext4, etc).
    This change sets file size limitation to the DFU internal buffer size.
    
    Since u-boot is not supporting interrupts and seek on file systems, it
    becomes challenging to store large file appropriately.
    
    To reproduce this error - create large file (around 26 MiB) and sent it
    to the target board.
    
    Lets examine the flow of USB transactions:
    
    0. DFU uses EP0 with 64B MPS [Max Packet Size]
    
    1. Send file - OUT (PC->target) - dat_26MiB.img is sent with 4096 B transactions
    
    2. Get status - OUT (PC->target) - wait for DFU_STATE_dfuDNLOAD_IDLE (0x05) sent
    				   from target board - IN transaction
    				   (target->PC)
    
    3. The whole file content is sent to target - OUT (PC->target) with ZLP [Zero
    					      Length Packet]
    
    Now the interesting part starts:
    
    4. OUT (PC->target) Setup transaction (request to share DFU state)
    
    5. IN (target->PC) - rep...
    fc18f8d1