Amit Pundir | d477f82 | 2020-02-07 22:26:08 +0530 | [diff] [blame] | 1 | #ifndef __RMTFS_H__ |
| 2 | #define __RMTFS_H__ |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | #include "qmi_rmtfs.h" |
| 6 | |
| 7 | #define SECTOR_SIZE 512 |
| 8 | |
| 9 | struct qmi_packet { |
| 10 | uint8_t flags; |
| 11 | uint16_t txn_id; |
| 12 | uint16_t msg_id; |
| 13 | uint16_t msg_len; |
| 14 | uint8_t data[]; |
| 15 | } __attribute__((__packed__)); |
| 16 | |
| 17 | struct rmtfs_mem; |
| 18 | |
| 19 | struct rmtfs_mem *rmtfs_mem_open(void); |
| 20 | void rmtfs_mem_close(struct rmtfs_mem *rmem); |
| 21 | int64_t rmtfs_mem_alloc(struct rmtfs_mem *rmem, size_t size); |
| 22 | void rmtfs_mem_free(struct rmtfs_mem *rmem); |
| 23 | ssize_t rmtfs_mem_read(struct rmtfs_mem *rmem, unsigned long phys_address, void *buf, ssize_t len); |
| 24 | ssize_t rmtfs_mem_write(struct rmtfs_mem *rmem, unsigned long phys_address, const void *buf, ssize_t len); |
| 25 | |
| 26 | struct rmtfd; |
| 27 | |
| 28 | int storage_init(const char *storage_root, bool read_only, bool use_partitions); |
| 29 | struct rmtfd *storage_open(unsigned node, const char *path); |
| 30 | struct rmtfd *storage_get(unsigned node, int caller_id); |
| 31 | void storage_close(struct rmtfd *rmtfd); |
| 32 | int storage_get_caller_id(const struct rmtfd *rmtfd); |
| 33 | int storage_get_error(const struct rmtfd *rmtfd); |
| 34 | void storage_exit(void); |
| 35 | ssize_t storage_pread(const struct rmtfd *rmtfd, void *buf, size_t nbyte, off_t offset); |
| 36 | ssize_t storage_pwrite(struct rmtfd *rmtfd, const void *buf, size_t nbyte, off_t offset); |
Amit Pundir | 53c1287 | 2022-10-27 21:55:51 +0530 | [diff] [blame^] | 37 | int storage_sync(struct rmtfd *rmtfd); |
Amit Pundir | d477f82 | 2020-02-07 22:26:08 +0530 | [diff] [blame] | 38 | |
| 39 | int rproc_init(void); |
| 40 | int rproc_start(void); |
| 41 | int rproc_stop(void); |
| 42 | |
| 43 | #endif |