Thomas Heijligen | 62268ee | 2023-11-27 15:10:41 +0000 | [diff] [blame] | 1 | #ifndef BLOCKDEV_H |
| 2 | #define BLOCKDEV_H |
| 3 | |
| 4 | /** devopen |
| 5 | * @param name Filename to be used as blockdevice |
| 6 | * @param reopen Unused, set NULL |
| 7 | * @return 1 on success, 0 on failure !CAUTION |
| 8 | */ |
| 9 | int devopen(const char *name, int *reopen); |
| 10 | |
| 11 | /** devclose |
| 12 | */ |
| 13 | void devclose(void); |
| 14 | |
| 15 | /** devread |
| 16 | * @param sector 512 byte sector of the block device |
| 17 | * @param byte_offset Offset in the block |
| 18 | * @param byte_len Buffer length |
| 19 | * @param buf Buffer |
| 20 | * @return 1 on sucess, 0 on failure !CAUTION |
| 21 | */ |
| 22 | int devread(unsigned long sector, unsigned long byte_offset, |
| 23 | unsigned long byte_len, void *buf); |
| 24 | |
Thomas Heijligen | dc1a84b | 2023-12-04 13:39:42 +0000 | [diff] [blame^] | 25 | /** dev_set_partition |
| 26 | * Set partition offset and size. if start + size > blockdevice, do nothing |
| 27 | * @param start |
| 28 | * @param size |
| 29 | */ |
| 30 | void dev_set_partition(unsigned long start, unsigned long size); |
Thomas Heijligen | 62268ee | 2023-11-27 15:10:41 +0000 | [diff] [blame] | 31 | |
Thomas Heijligen | dc1a84b | 2023-12-04 13:39:42 +0000 | [diff] [blame^] | 32 | /** dev_get_partition |
| 33 | * @param *start will be filled with the partition offset |
| 34 | * @param *size will be filled with the partition length |
| 35 | */ |
| 36 | void dev_get_partition(unsigned long *start, unsigned long *size); |
Thomas Heijligen | 62268ee | 2023-11-27 15:10:41 +0000 | [diff] [blame] | 37 | |
| 38 | #endif /* BLOCKDEV_H */ |