/**shmem.h*/
#ifndef __SHMEM_H
#define __SHMEM_H

#include <unistd.h>
#include <stdint.h>

#include "shm_api.h"

struct shmem_fd
{
	int fd;
	int shmem_len;

	uint8_t *linux_write;
	uint8_t *linux_read;

	int linux_write_len, linux_read_len;
	int linux_write_data_len, linux_read_data_len;
};

#define max_shmem_wr_len(s) ((s) / 2)
#define max_shmem_rd_len(s) ((s) / 2)

int shm_write_data(uint32_t _ul_addr, uint8_t *_puc_data, uint32_t _ul_len);
int shm_packet_write_v2(uint32_t _ul_addr, uint8_t *_puc_data, uint32_t _ul_len);

int shm_read_data(uint32_t _ul_addr, uint32_t _ul_len, uint8_t *_puc_data_out, uint32_t _uc_data_out_size);
int shm_packet_read_v2(uint32_t _ul_addr, uint32_t _ul_len, uint8_t *_puc_data_out, uint32_t _uc_data_out_size);

int share_mem_init_v2(struct shmem_fd *shmem_fd);
void share_mem_exit_v2(struct shmem_fd *shmem_fd);

#endif // !__SHMEM_H
