fixes
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include <zinnia/channel.h>
|
||||
#include <zinnia/handle.h>
|
||||
#include <common/utils.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define ZN_IPC_NUM(group, num) ((uint32_t)(group) << 24u) | ((uint32_t)(num) & 0xffffffu)
|
||||
|
||||
#define ZN_IPC(name, group, num, num_handles) \
|
||||
name##_inner; \
|
||||
constexpr uint32_t name##_num = ZN_IPC_NUM(group, num); \
|
||||
typedef struct { \
|
||||
uint32_t id; \
|
||||
zn_handle_t handles[num_handles]; \
|
||||
name##_inner inner; \
|
||||
} name
|
||||
|
||||
#define zn_ipc_write(channel, obj) \
|
||||
zn_channel_write(channel, (obj)->handles, &(obj)->inner, ARRAY_SIZE((obj)->handles), sizeof((obj)->inner))
|
||||
|
||||
#define zn_ipc_read(channel, obj) \
|
||||
zn_channel_read( \
|
||||
channel, \
|
||||
(obj)->handles, \
|
||||
&(obj)->inner, \
|
||||
ARRAY_SIZE((obj)->handles), \
|
||||
sizeof((obj)->inner), \
|
||||
nullptr, \
|
||||
nullptr \
|
||||
)
|
||||
|
||||
#define zn_ipc_new(name) \
|
||||
(zn_ipc_fw_rsdp) { \
|
||||
.id = name##_num \
|
||||
}
|
||||
@@ -13,6 +13,7 @@ extern "C" {
|
||||
|
||||
enum zn_channel_flags {
|
||||
ZN_CHANNEL_NONE = 0,
|
||||
ZN_CHANNEL_NONBLOCK = 1 << 0,
|
||||
};
|
||||
|
||||
// Creates a new channel.
|
||||
|
||||
Reference in New Issue
Block a user