blob: 0def9018ef656797832e0b7528482136c09f5fbf [file] [log] [blame]
Thomas Heijligen62268ee2023-11-27 15:10:41 +00001#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 */
9int devopen(const char *name, int *reopen);
10
11/** devclose
12 */
13void 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 */
22int devread(unsigned long sector, unsigned long byte_offset,
23 unsigned long byte_len, void *buf);
24
Thomas Heijligendc1a84b2023-12-04 13:39:42 +000025/** dev_set_partition
26 * Set partition offset and size. if start + size > blockdevice, do nothing
27 * @param start
28 * @param size
29 */
30void dev_set_partition(unsigned long start, unsigned long size);
Thomas Heijligen62268ee2023-11-27 15:10:41 +000031
Thomas Heijligendc1a84b2023-12-04 13:39:42 +000032/** dev_get_partition
33 * @param *start will be filled with the partition offset
34 * @param *size will be filled with the partition length
35 */
36void dev_get_partition(unsigned long *start, unsigned long *size);
Thomas Heijligen62268ee2023-11-27 15:10:41 +000037
38#endif /* BLOCKDEV_H */