Changeset fbcfd458 in mainline for generic/include/ipc/ipc.h
- Timestamp:
- 2006-03-18T23:02:08Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b4b45210
- Parents:
- ba81cab
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/include/ipc/ipc.h
rba81cab rfbcfd458 38 38 39 39 /* Flags for calls */ 40 #define IPC_CALL_ANSWERED 0x1 /**< This is answer to a call */ 41 #define IPC_CALL_STATIC_ALLOC 0x2 /**< This call will not be freed on error */ 42 #define IPC_CALL_DISPATCHED 0x4 /**< Call is in dispatch queue */ 40 #define IPC_CALL_ANSWERED (1<<0) /**< This is answer to a call */ 41 #define IPC_CALL_STATIC_ALLOC (1<<1) /**< This call will not be freed on error */ 42 #define IPC_CALL_DISPATCHED (1<<2) /**< Call is in dispatch queue */ 43 #define IPC_CALL_DISCARD_ANSWER (1<<3) /**< Answer will not be passed to 44 * userspace, will be discarded */ 43 45 44 46 /* Flags for ipc_wait_for_call */ 45 47 #define IPC_WAIT_NONBLOCKING 1 46 48 47 /* Flags of callid */ 48 #define IPC_CALLID_ANSWERED 1 49 /* Flags of callid (the addresses are aligned at least to 4, 50 * that is why we can use bottom 2 bits of the call address 51 */ 52 #define IPC_CALLID_ANSWERED 1 /**< Type of this msg is 'answer' */ 53 #define IPC_CALLID_NOTIFICATION 2 /**< Type of this msg is 'notification' */ 49 54 50 55 /* Return values from IPC_ASYNC */ … … 54 59 55 60 /* Macros for manipulating calling data */ 56 #define IPC_SET_RETVAL(data, retval) ((data) [0] = (retval))57 #define IPC_SET_METHOD(data, val) ((data) [0] = (val))58 #define IPC_SET_ARG1(data, val) ((data) [1] = (val))59 #define IPC_SET_ARG2(data, val) ((data) [2] = (val))60 #define IPC_SET_ARG3(data, val) ((data) [3] = (val))61 62 #define IPC_GET_METHOD(data) ((data) [0])63 #define IPC_GET_RETVAL(data) ((data) [0])64 65 #define IPC_GET_ARG1(data) ((data) [1])66 #define IPC_GET_ARG2(data) ((data) [2])67 #define IPC_GET_ARG3(data) ((data) [3])61 #define IPC_SET_RETVAL(data, retval) ((data).args[0] = (retval)) 62 #define IPC_SET_METHOD(data, val) ((data).args[0] = (val)) 63 #define IPC_SET_ARG1(data, val) ((data).args[1] = (val)) 64 #define IPC_SET_ARG2(data, val) ((data).args[2] = (val)) 65 #define IPC_SET_ARG3(data, val) ((data).args[3] = (val)) 66 67 #define IPC_GET_METHOD(data) ((data).args[0]) 68 #define IPC_GET_RETVAL(data) ((data).args[0]) 69 70 #define IPC_GET_ARG1(data) ((data).args[1]) 71 #define IPC_GET_ARG2(data) ((data).args[2]) 72 #define IPC_GET_ARG3(data) ((data).args[3]) 68 73 69 74 /* Well known phone descriptors */ … … 90 95 * - the caller obtains taskid of the called thread 91 96 */ 92 #define IPC_M_CONNECT TOME 197 #define IPC_M_CONNECT_TO_ME 1 93 98 /** Protocol for CONNECT - ME - TO 94 99 * … … 109 114 * 110 115 */ 111 #define IPC_M_CONNECTMETO 2 112 /* Control messages that the server sends to the processes 113 * about their connections. 114 */ 116 #define IPC_M_CONNECT_ME_TO 2 117 /** This message is sent to answerbox when the phone 118 * is hung up 119 */ 120 #define IPC_M_PHONE_HUNGUP 3 115 121 116 122 … … 129 135 #define IPC_MAX_PHONES 16 130 136 131 typedef struct answerbox answerbox_t; 132 typedef __native ipc_data_t[IPC_CALL_LEN]; 133 137 typedef struct answerbox_s answerbox_t; 138 typedef struct phone_s phone_t; 134 139 typedef struct { 135 link_t list; 136 answerbox_t *callerbox; 137 int flags; 138 task_t *sender; 139 ipc_data_t data; 140 } call_t; 141 142 struct answerbox { 140 __native args[IPC_CALL_LEN]; 141 phone_t *phone; 142 }ipc_data_t; 143 144 struct answerbox_s { 143 145 SPINLOCK_DECLARE(lock); 144 146 … … 154 156 }; 155 157 156 typedef struct{158 struct phone_s { 157 159 SPINLOCK_DECLARE(lock); 158 160 link_t list; 159 161 answerbox_t *callee; 160 162 int busy; 161 } phone_t; 163 atomic_t active_calls; 164 }; 165 166 typedef struct { 167 link_t list; 168 169 int flags; 170 171 /* Identification of the caller */ 172 task_t *sender; 173 /* The caller box is different from sender->answerbox 174 * for synchronous calls 175 */ 176 answerbox_t *callerbox; 177 178 ipc_data_t data; 179 }call_t; 162 180 163 181 extern void ipc_init(void); … … 166 184 extern void ipc_call(phone_t *phone, call_t *request); 167 185 extern void ipc_call_sync(phone_t *phone, call_t *request); 168 extern void ipc_phone_destroy(phone_t *phone);169 186 extern void ipc_phone_init(phone_t *phone); 170 187 extern void ipc_phone_connect(phone_t *phone, answerbox_t *box); … … 178 195 extern answerbox_t *ipc_phone_0; 179 196 extern void ipc_cleanup(task_t *task); 197 extern int ipc_phone_hangup(phone_t *phone); 180 198 181 199 #endif
Note:
See TracChangeset
for help on using the changeset viewer.