From 11c77cb6541deb967873add8d0064f3a01437c90 Mon Sep 17 00:00:00 2001 From: plutoo Date: Sat, 10 Mar 2018 12:13:57 +0100 Subject: [PATCH] Clean up --- nx/include/switch/ipc.h | 52 ++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/nx/include/switch/ipc.h b/nx/include/switch/ipc.h index 074e89b5..d69ef52a 100644 --- a/nx/include/switch/ipc.h +++ b/nx/include/switch/ipc.h @@ -25,17 +25,17 @@ #define IPC_MAX_OBJECTS 8 typedef enum { - BufferFlag_Normal=0, ///< Regular buffer. - BufferFlag_Type1=1, ///< Allows ProcessMemory and shared TransferMemory. - BufferFlag_Invalid=2, - BufferFlag_Type3=3 ///< Same as Type1 except remote process is not allowed to use device-mapping. -} BufferFlag; + BufferType_Normal=0, ///< Regular buffer. + BufferType_Type1=1, ///< Allows ProcessMemory and shared TransferMemory. + BufferType_Invalid=2, + BufferType_Type3=3 ///< Same as Type1 except remote process is not allowed to use device-mapping. +} BufferType; typedef enum { - BufferType_Send=0, - BufferType_Recv=1, - BufferType_Exch=2, -} BufferType; + BufferDirection_Send=0, + BufferDirection_Recv=1, + BufferDirection_Exch=2, +} BufferDirection; typedef struct { size_t NumSend; // A @@ -43,7 +43,7 @@ typedef struct { size_t NumExch; // W const void* Buffers[IPC_MAX_BUFFERS]; size_t BufferSizes[IPC_MAX_BUFFERS]; - BufferFlag BufferFlags[IPC_MAX_BUFFERS]; + BufferType BufferTypes[IPC_MAX_BUFFERS]; size_t NumStaticIn; // X size_t NumStaticOut; // C @@ -92,13 +92,13 @@ typedef struct { * @param cmd IPC command structure. * @param buffer Address of the buffer. * @param size Size of the buffer. - * @param flag Buffer flag. + * @param type Buffer type. */ -static inline void ipcAddSendBuffer(IpcCommand* cmd, const void* buffer, size_t size, BufferFlag flag) { +static inline void ipcAddSendBuffer(IpcCommand* cmd, const void* buffer, size_t size, BufferType type) { size_t off = cmd->NumSend; cmd->Buffers[off] = buffer; cmd->BufferSizes[off] = size; - cmd->BufferFlags[off] = flag; + cmd->BufferTypes[off] = type; cmd->NumSend++; } @@ -107,13 +107,13 @@ static inline void ipcAddSendBuffer(IpcCommand* cmd, const void* buffer, size_t * @param cmd IPC command structure. * @param buffer Address of the buffer. * @param size Size of the buffer. - * @param flag Buffer flag. + * @param type Buffer type. */ -static inline void ipcAddRecvBuffer(IpcCommand* cmd, void* buffer, size_t size, BufferFlag flag) { +static inline void ipcAddRecvBuffer(IpcCommand* cmd, void* buffer, size_t size, BufferType type) { size_t off = cmd->NumSend + cmd->NumRecv; cmd->Buffers[off] = buffer; cmd->BufferSizes[off] = size; - cmd->BufferFlags[off] = flag; + cmd->BufferTypes[off] = type; cmd->NumRecv++; } @@ -122,13 +122,13 @@ static inline void ipcAddRecvBuffer(IpcCommand* cmd, void* buffer, size_t size, * @param cmd IPC command structure. * @param buffer Address of the buffer. * @param size Size of the buffer. - * @param flag Buffer flag. + * @param type Buffer type. */ -static inline void ipcAddExchangeBuffer(IpcCommand* cmd, void* buffer, size_t size, BufferFlag flag) { +static inline void ipcAddExchBuffer(IpcCommand* cmd, void* buffer, size_t size, BufferType type) { size_t off = cmd->NumSend + cmd->NumRecv + cmd->NumExch; cmd->Buffers[off] = buffer; cmd->BufferSizes[off] = size; - cmd->BufferFlags[off] = flag; + cmd->BufferTypes[off] = type; cmd->NumExch++; } @@ -239,7 +239,7 @@ static inline void* ipcPrepareHeader(IpcCommand* cmd, size_t sizeof_raw) { uintptr_t ptr = (uintptr_t) cmd->Buffers[i]; desc->Addr = ptr; - desc->Packed = cmd->BufferFlags[i] | + desc->Packed = cmd->BufferTypes[i] | (((ptr >> 32) & 15) << 28) | ((ptr >> 36) << 2); } @@ -297,7 +297,7 @@ typedef struct { size_t NumHandles; ///< Number of handles copied. Handle Handles[IPC_MAX_OBJECTS]; ///< Handles. - bool WasHandleCopied[IPC_MAX_OBJECTS]; ///< True if the handle was moved from + bool WasHandleCopied[IPC_MAX_OBJECTS]; ///< true if the handle was moved, false if it was copied. u32 ThisObjectId; ///< Object ID to call the command on (for domain messages). size_t NumObjectIds; ///< Number of object IDs (for domain messages). @@ -306,8 +306,8 @@ typedef struct { size_t NumBuffers; ///< Number of buffers in the response. void* Buffers[IPC_MAX_BUFFERS]; ///< Pointers to the buffers. size_t BufferSizes[IPC_MAX_BUFFERS]; ///< Sizes of the buffers. - BufferFlag BufferFlags[IPC_MAX_BUFFERS]; ///< Flags of the buffers. BufferType BufferTypes[IPC_MAX_BUFFERS]; ///< Types of the buffers. + BufferDirection BufferDirections[IPC_MAX_BUFFERS]; ///< Direction of each buffer. size_t NumStatics; ///< Number of statics in the response. void* Statics[IPC_MAX_BUFFERS]; ///< Pointers to the statics. @@ -393,14 +393,14 @@ static inline Result ipcParse(IpcParsedCommand* r) { r->Buffers[i] = (void*) (desc->Addr | ((packed >> 28) << 32) | (((packed >> 2) & 15) << 36)); r->BufferSizes[i] = desc->Size; - r->BufferFlags[i] = packed & 3; + r->BufferTypes[i] = packed & 3; if (i < num_bufs_send) - r->BufferTypes[i] = BufferType_Send; + r->BufferDirections[i] = BufferDirection_Send; else if (i < (num_bufs_send + num_bufs_recv)) - r->BufferTypes[i] = BufferType_Recv; + r->BufferDirections[i] = BufferDirection_Recv; else - r->BufferTypes[i] = BufferType_Exch; + r->BufferDirections[i] = BufferDirection_Exch; } r->NumBuffers = num_bufs;