Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • abi/include/abi/ipc/ipc.h

    rca0e838 r6769005  
    3333 */
    3434
    35 #ifndef _ABI_IPC_IPC_H_
    36 #define _ABI_IPC_IPC_H_
     35#ifndef ABI_IPC_IPC_H_
     36#define ABI_IPC_IPC_H_
    3737
    38 #include <stdint.h>
    3938#include <abi/proc/task.h>
    4039#include <abi/cap.h>
    41 #include <_bits/errno.h>
    4240
    43 /* Miscellaneous constants */
    44 enum {
    45         /** Length of data being transferred with IPC call
    46          *
    47          * The uspace may not be able to utilize the full length
    48          *
    49          */
    50         IPC_CALL_LEN = 6,
     41/** Length of data being transferred with IPC call
     42 *
     43 * The uspace may not be able to utilize the full length
     44 *
     45 */
     46#define IPC_CALL_LEN  6
    5147
    52         /** Maximum active async calls per phone */
    53         IPC_MAX_ASYNC_CALLS = 64,
    54 
    55         /**
    56          * Maximum buffer size allowed for IPC_M_DATA_WRITE and
    57          * IPC_M_DATA_READ requests.
    58          */
    59         DATA_XFER_LIMIT = 64 * 1024,
    60 };
     48/** Maximum active async calls per phone */
     49#define IPC_MAX_ASYNC_CALLS  64
    6150
    6251/* Flags for calls */
    63 enum {
    64         /** This is answer to a call */
    65         IPC_CALL_ANSWERED       = 1 << 0,
    6652
    67         /** Answer will not be passed to userspace, will be discarded */
    68         IPC_CALL_DISCARD_ANSWER = 1 << 1,
     53/** This is answer to a call */
     54#define IPC_CALL_ANSWERED        (1 << 0)
    6955
    70         /** Call was forwarded */
    71         IPC_CALL_FORWARDED      = 1 << 2,
     56/** Answer will not be passed to userspace, will be discarded */
     57#define IPC_CALL_DISCARD_ANSWER  (1 << 1)
    7258
    73         /** Interrupt notification */
    74         IPC_CALL_NOTIF          = 1 << 3,
     59/** Call was forwarded */
     60#define IPC_CALL_FORWARDED       (1 << 2)
    7561
    76         /** The call was automatically answered by the kernel due to error */
    77         IPC_CALL_AUTO_REPLY     = 1 << 4,
    78 };
     62/** Interrupt notification */
     63#define IPC_CALL_NOTIF           (1 << 3)
     64
     65/** The call was automatically answered by the kernel due to error */
     66#define IPC_CALL_AUTO_REPLY      (1 << 4)
     67
     68/**
     69 * Maximum buffer size allowed for IPC_M_DATA_WRITE and
     70 * IPC_M_DATA_READ requests.
     71 */
     72#define DATA_XFER_LIMIT  (64 * 1024)
     73
     74/* Macros for manipulating calling data */
     75#define IPC_SET_RETVAL(data, retval)  ((data).args[0] = (sysarg_t) (retval))
     76#define IPC_SET_IMETHOD(data, val)    ((data).args[0] = (val))
     77#define IPC_SET_ARG1(data, val)       ((data).args[1] = (val))
     78#define IPC_SET_ARG2(data, val)       ((data).args[2] = (val))
     79#define IPC_SET_ARG3(data, val)       ((data).args[3] = (val))
     80#define IPC_SET_ARG4(data, val)       ((data).args[4] = (val))
     81#define IPC_SET_ARG5(data, val)       ((data).args[5] = (val))
     82
     83#define IPC_GET_IMETHOD(data)  ((data).args[0])
     84#define IPC_GET_RETVAL(data)   ((errno_t) (data).args[0])
     85
     86#define IPC_GET_ARG1(data)  ((data).args[1])
     87#define IPC_GET_ARG2(data)  ((data).args[2])
     88#define IPC_GET_ARG3(data)  ((data).args[3])
     89#define IPC_GET_ARG4(data)  ((data).args[4])
     90#define IPC_GET_ARG5(data)  ((data).args[5])
    7991
    8092/* Forwarding flags. */
    81 enum {
    82         IPC_FF_NONE = 0,
     93#define IPC_FF_NONE  0
    8394
    84         /**
    85          * The call will be routed as though it was initially sent via the phone
    86          * used to forward it. This feature is intended to support the situation
    87          * in which the forwarded call needs to be handled by the same
    88          * connection fibril as any other calls that were initially sent by
    89          * the forwarder to the same destination.
    90          * This flag has no imapct on routing replies.
    91          */
    92         IPC_FF_ROUTE_FROM_ME = 1 << 0,
    93 };
     95/**
     96 * The call will be routed as though it was initially sent via the phone used to
     97 * forward it. This feature is intended to support the situation in which the
     98 * forwarded call needs to be handled by the same connection fibril as any other
     99 * calls that were initially sent by the forwarder to the same destination. This
     100 * flag has no imapct on routing replies.
     101 */
     102#define IPC_FF_ROUTE_FROM_ME  (1 << 0)
    94103
    95104/* Data transfer flags. */
    96 enum {
    97         IPC_XF_NONE = 0,
     105#define IPC_XF_NONE  0
    98106
    99         /** Restrict the transfer size if necessary. */
    100         IPC_XF_RESTRICT = 1 << 0,
    101 };
     107/** Restrict the transfer size if necessary. */
     108#define IPC_XF_RESTRICT  (1 << 0)
    102109
    103110/** User-defined IPC methods */
    104 enum {
    105         IPC_FIRST_USER_METHOD = 1024,
    106 };
     111#define IPC_FIRST_USER_METHOD  1024
    107112
    108113typedef struct {
     
    123128} ipc_data_t;
    124129
    125 /* Functions for manipulating calling data */
    126 
    127 static inline void ipc_set_retval(ipc_data_t *data, errno_t retval)
    128 {
    129         data->args[0] = (sysarg_t) retval;
    130 }
    131 
    132 static inline void ipc_set_imethod(ipc_data_t *data, sysarg_t val)
    133 {
    134         data->args[0] = val;
    135 }
    136 
    137 static inline void ipc_set_arg1(ipc_data_t *data, sysarg_t val)
    138 {
    139         data->args[1] = val;
    140 }
    141 
    142 static inline void ipc_set_arg2(ipc_data_t *data, sysarg_t val)
    143 {
    144         data->args[2] = val;
    145 }
    146 
    147 static inline void ipc_set_arg3(ipc_data_t *data, sysarg_t val)
    148 {
    149         data->args[3] = val;
    150 }
    151 
    152 static inline void ipc_set_arg4(ipc_data_t *data, sysarg_t val)
    153 {
    154         data->args[4] = val;
    155 }
    156 
    157 static inline void ipc_set_arg5(ipc_data_t *data, sysarg_t val)
    158 {
    159         data->args[5] = val;
    160 }
    161 
    162 static inline sysarg_t ipc_get_imethod(ipc_data_t *data)
    163 {
    164         return data->args[0];
    165 }
    166 static inline errno_t ipc_get_retval(ipc_data_t *data)
    167 {
    168         return (errno_t) data->args[0];
    169 }
    170 
    171 static inline sysarg_t ipc_get_arg1(ipc_data_t *data)
    172 {
    173         return data->args[1];
    174 }
    175 
    176 static inline sysarg_t ipc_get_arg2(ipc_data_t *data)
    177 {
    178         return data->args[2];
    179 }
    180 
    181 static inline sysarg_t ipc_get_arg3(ipc_data_t *data)
    182 {
    183         return data->args[3];
    184 }
    185 
    186 static inline sysarg_t ipc_get_arg4(ipc_data_t *data)
    187 {
    188         return data->args[4];
    189 }
    190 
    191 static inline sysarg_t ipc_get_arg5(ipc_data_t *data)
    192 {
    193         return data->args[5];
    194 }
    195 
    196130#endif
    197131
Note: See TracChangeset for help on using the changeset viewer.