Browse Source

usbstorage 1.5.1: lock system during block transfers

tags/1.5.1
mntmn 9 months ago
parent
commit
0cf0bfb37f
1 changed files with 7 additions and 1 deletions
  1. +7
    -1
      usb-storage/mntsd_cmd.c

+ 7
- 1
usb-storage/mntsd_cmd.c View File

@@ -35,7 +35,8 @@ uint16 sdcmd_read_blocks(void* registers, uint8* data, uint32 block, uint32 len)
uint32 offset=0;
uint32 num_blocks=1;
volatile struct MNTUSBSRegs* regs = (volatile struct MNTUSBSRegs*)registers;

Forbid();
while (i<len) {
offset = i<<SD_SECTOR_SHIFT;

@@ -60,6 +61,8 @@ uint16 sdcmd_read_blocks(void* registers, uint8* data, uint32 block, uint32 len)

i += num_blocks;
}
Permit();
return 0;
}

@@ -70,6 +73,7 @@ uint16 sdcmd_write_blocks(void* registers, uint8* data, uint32 block, uint32 len
uint32 num_blocks=1;
struct MNTUSBSRegs* regs = (struct MNTUSBSRegs*)registers;
Forbid();
while (i<len) {
offset = i<<SD_SECTOR_SHIFT;
@@ -94,6 +98,8 @@ uint16 sdcmd_write_blocks(void* registers, uint8* data, uint32 block, uint32 len
i += num_blocks;
}
Permit();
return 0;
}



Loading…
Cancel
Save