summaryrefslogtreecommitdiff
path: root/kernel/ipc.h
blob: cfa9e6d268d84c88aa0dabe817dd7f79a8124c82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef IPC_H
#define IPC_H
#include <stdbool.h>
#include <typedefs.h>

#define IPC_BUFFER_SIZE 4096
#define IPC_NUM_DATA 32

struct IpcMessage {
  u8 is_used;
  u32 sender_pid;
  u32 size;
  u8 buffer[IPC_BUFFER_SIZE];
};

struct IpcMailbox {
  u32 read_ptr;
  u32 write_ptr;
  struct IpcMessage data[IPC_NUM_DATA];
};

bool ipc_register_endpoint(u32 endpoint);
int ipc_write_to_process(int pid, u8 *buffer, u32 length);
int ipc_write(int ipc_id, u8 *buffer, u32 length);
int ipc_read(u8 *buffer, u32 length, u32 *sender_pid);
#endif