diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2017-01-05 00:25:15 +0100 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2017-01-07 15:52:33 +0100 |
commit | 950f4bdc027cb8c83fd2145590549fdcf5522078 (patch) | |
tree | fb2d845b03c31c3aee674b5f227b74c8216e622e /utils/imxtools/scsitools/stmp_scsi.h | |
parent | 07781847826d6901e047c3c55d227aae487a9f4c (diff) | |
download | rockbox-950f4bdc027cb8c83fd2145590549fdcf5522078.tar.gz rockbox-950f4bdc027cb8c83fd2145590549fdcf5522078.zip |
imxtools: move firmware read/write to library
Split the ugly firmware read/write into a API function and a much simplified code.
Also the code can now report progress.
Change-Id: I3f998eaf0c067c6da42b1d2dd9c5a5bf43c6915d
Diffstat (limited to 'utils/imxtools/scsitools/stmp_scsi.h')
-rw-r--r-- | utils/imxtools/scsitools/stmp_scsi.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/utils/imxtools/scsitools/stmp_scsi.h b/utils/imxtools/scsitools/stmp_scsi.h index 68d77daeec..56068b5d4c 100644 --- a/utils/imxtools/scsitools/stmp_scsi.h +++ b/utils/imxtools/scsitools/stmp_scsi.h | |||
@@ -355,6 +355,14 @@ int stmp_read_logical_drive_sectors(stmp_device_t dev, uint8_t drive, uint64_t a | |||
355 | uint32_t count, void *buffer, int buffer_size); | 355 | uint32_t count, void *buffer, int buffer_size); |
356 | int stmp_write_logical_drive_sectors(stmp_device_t dev, uint8_t drive, uint64_t address, | 356 | int stmp_write_logical_drive_sectors(stmp_device_t dev, uint8_t drive, uint64_t address, |
357 | uint32_t count, void *buffer, int buffer_size); | 357 | uint32_t count, void *buffer, int buffer_size); |
358 | /* return <0 on error, or firmware size in bytes otherwise, | ||
359 | * if not NULL, the read/write function will be called as many times as needed to provide | ||
360 | * the entire firmware, it should return number of bytes read/written on success or -1 on error | ||
361 | * in all cases, the total size of the firmware is based on the header | ||
362 | * if NULL for read, return firmware size */ | ||
363 | typedef int (*stmp_fw_rw_fn_t)(void *user, void *buf, size_t size); | ||
364 | int stmp_read_firmware(stmp_device_t dev, void *user, stmp_fw_rw_fn_t fn); | ||
365 | int stmp_write_firmware(stmp_device_t dev, void *user, stmp_fw_rw_fn_t fn); | ||
358 | /* string helpers */ | 366 | /* string helpers */ |
359 | const char *stmp_get_logical_media_type_string(uint32_t type); | 367 | const char *stmp_get_logical_media_type_string(uint32_t type); |
360 | const char *stmp_get_logical_media_vendor_string(uint32_t type); | 368 | const char *stmp_get_logical_media_vendor_string(uint32_t type); |