40 lines
951 B
C
40 lines
951 B
C
#ifndef IPC_MBUS_MBUS_H_
|
|
#define IPC_MBUS_MBUS_H_
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include "proc/proc.h"
|
|
#include "rbuf/rbuf.h"
|
|
|
|
typedef struct IpcMBusCons {
|
|
struct IpcMBusCons *next;
|
|
uint64_t pid;
|
|
RBuf rbuf;
|
|
} IpcMBusCons;
|
|
|
|
typedef struct {
|
|
int _hshtbstate;
|
|
char ident[0x100];
|
|
SpinLock spinlock;
|
|
IpcMBusCons *consumers;
|
|
size_t objsize, objmax;
|
|
} IpcMBus;
|
|
|
|
typedef struct {
|
|
SpinLock spinlock;
|
|
IpcMBus mbuses[0x100];
|
|
} IpcMBuses;
|
|
|
|
extern IpcMBuses IPC_MBUSES;
|
|
|
|
void ipc_mbusinit(void);
|
|
IpcMBus *ipc_mbusmake(const char *name, size_t objsize, size_t objmax);
|
|
int32_t ipc_mbusdelete(const char *name);
|
|
int32_t ipc_mbuspublish(const char *name, const uint8_t *const buffer);
|
|
int32_t ipc_mbusconsume(const char *name, uint8_t *const buffer, uint64_t pid);
|
|
int32_t ipc_mbusattchcons(const char *name, uint64_t pid);
|
|
int32_t ipc_mbusdttchcons(const char *name, uint64_t pid);
|
|
void ipc_mbustick(void);
|
|
|
|
#endif // IPC_MBUS_MBUS_H_
|