summaryrefslogtreecommitdiff
path: root/kernel/ipc.h
blob: ae67f71434ca47bcd61c3adeaddd98700875473d (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 0x2000
#define IPC_NUM_DATA 400

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