blob: 242baa59593ccdec1f07214462e493582a775208 [file] [log] [blame]
Amit Pundird477f822020-02-07 22:26:08 +05301#ifndef __RMTFS_H__
2#define __RMTFS_H__
3
4#include <stdint.h>
5#include "qmi_rmtfs.h"
6
7#define SECTOR_SIZE 512
8
9struct 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
17struct rmtfs_mem;
18
19struct rmtfs_mem *rmtfs_mem_open(void);
20void rmtfs_mem_close(struct rmtfs_mem *rmem);
21int64_t rmtfs_mem_alloc(struct rmtfs_mem *rmem, size_t size);
22void rmtfs_mem_free(struct rmtfs_mem *rmem);
23ssize_t rmtfs_mem_read(struct rmtfs_mem *rmem, unsigned long phys_address, void *buf, ssize_t len);
24ssize_t rmtfs_mem_write(struct rmtfs_mem *rmem, unsigned long phys_address, const void *buf, ssize_t len);
25
26struct rmtfd;
27
28int storage_init(const char *storage_root, bool read_only, bool use_partitions);
29struct rmtfd *storage_open(unsigned node, const char *path);
30struct rmtfd *storage_get(unsigned node, int caller_id);
31void storage_close(struct rmtfd *rmtfd);
32int storage_get_caller_id(const struct rmtfd *rmtfd);
33int storage_get_error(const struct rmtfd *rmtfd);
34void storage_exit(void);
35ssize_t storage_pread(const struct rmtfd *rmtfd, void *buf, size_t nbyte, off_t offset);
36ssize_t storage_pwrite(struct rmtfd *rmtfd, const void *buf, size_t nbyte, off_t offset);
37
38int rproc_init(void);
39int rproc_start(void);
40int rproc_stop(void);
41
42#endif