FreeCalypso > hg > leo2moko-debug
comparison gpf/INC/ipcapi.h @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
1 /* | |
2 +----------------------------------------------------------------------------- | |
3 | Project : PCO | |
4 | Modul : inc\ipcapi.h | |
5 +----------------------------------------------------------------------------- | |
6 | Copyright 2002 Texas Instruments Berlin, AG | |
7 | All rights reserved. | |
8 | | |
9 | This file is confidential and a trade secret of Texas | |
10 | Instruments Berlin, AG | |
11 | The receipt of or possession of this file does not convey | |
12 | any rights to reproduce or disclose its contents or to | |
13 | manufacture, use, or sell anything it may describe, in | |
14 | whole, or in part, without the specific written consent of | |
15 | Texas Instruments Berlin, AG. | |
16 +----------------------------------------------------------------------------- | |
17 | Purpose : API definition for IPC | |
18 +----------------------------------------------------------------------------- | |
19 */ | |
20 #ifndef IPCAPI_H | |
21 #define IPCAPI_H | |
22 | |
23 #include "cms.h" | |
24 | |
25 #undef EXPORT | |
26 #include <typedefs.h> | |
27 | |
28 /* define extra function codes for driver ipc */ | |
29 #define IPC_SELF 10 | |
30 #define IPC_INITCH 11 | |
31 #define IPC_EXITCH 12 | |
32 #define IPC_OPENCH 13 | |
33 #define IPC_CLOSECH 14 | |
34 #define IPC_READCH 15 | |
35 #define IPC_WRITECH 16 | |
36 #define IPC_CREATEMSG 17 | |
37 #define IPC_PARSEMSG 18 | |
38 #define IPC_ISMYADDR 19 | |
39 #define IPC_GETHANDLE 20 | |
40 #define IPC_SETTIME 21 | |
41 | |
42 | |
43 /********************************************************************** | |
44 * macros | |
45 *********************************************************************/ | |
46 | |
47 #define MSG_ID( Group, Code ) (((Group) << 8) + ((Code) & 0xFF)) | |
48 | |
49 | |
50 /********************************************************************** | |
51 * defines | |
52 *********************************************************************/ | |
53 | |
54 /* return codes */ | |
55 #define IPC_OK CMS_OK | |
56 #define IPC_ERROR CMS_ERROR | |
57 #define IPC_EXIST CMS_EXIST | |
58 #define IPC_FULL CMS_FULL | |
59 #define IPC_BADHANDLE CMS_BADHANDLE | |
60 #define IPC_EMPTY CMS_EMPTY | |
61 #define IPC_SIZE CMS_SIZE | |
62 #define IPC_TIMEOUT CMS_TIMEOUT | |
63 #define IPC_NOMEM CMS_NOMEM | |
64 #define IPC_INVALID (-20) | |
65 #define IPC_MISALIGNED (-21) | |
66 | |
67 | |
68 | |
69 #define IPC_MAX_PATH_SIZE 120 | |
70 | |
71 /* msg IDs: */ | |
72 #define IPC_GENERATED MSG_ID(IPC,1) | |
73 | |
74 #define ALIGNMENT 1 | |
75 #define MSG_MAX_SIZE 512 | |
76 | |
77 /********************************************************************** | |
78 * types | |
79 *********************************************************************/ | |
80 | |
81 | |
82 typedef int IPC_HANDLE; | |
83 | |
84 typedef struct | |
85 { | |
86 char *pcSender; | |
87 char *pcReceiver; | |
88 void *pvBuffer; | |
89 U32 ulTime; | |
90 U16 uwTenthOfMS; | |
91 U16 uwSize; | |
92 U16 uwID; | |
93 } MSG_HEADER; | |
94 | |
95 | |
96 | |
97 #if ALIGNMENT == 1 | |
98 typedef U8 MSG_BUFFER [MSG_MAX_SIZE]; | |
99 #elif ALIGNMENT == 2 | |
100 typedef U16 MSG_BUFFER [(MSG_MAX_SIZE + 1) / 2]; | |
101 #elif ALIGNMENT == 4 | |
102 typedef U32 MSG_BUFFER [(MSG_MAX_SIZE + 3) / 4]; | |
103 #else | |
104 #error "invalid alignment" | |
105 #endif | |
106 | |
107 | |
108 /* standard funtions: */ | |
109 | |
110 | |
111 /*********************************************************************/ | |
112 U16 ipc_createMsg ( /* @func Create a message. */ | |
113 void *pvBuffer,/* @parm Buffer for the message to store. */ | |
114 U16 uwSize, /* @parm Size of the buffer. */ | |
115 MSG_HEADER Msg /* @parm Settings for the message to create. */ | |
116 ); /* @returnvalue One of the values below. */ | |
117 /*--------------------------------------------------------------------- | |
118 * @description The function creates a message out of the settings | |
119 * that are stored in the structure. The resulting | |
120 * message will be written to the buffer. | |
121 * | |
122 * Attention: The address of the buffer MUST be | |
123 * aligned (multiple of ALIGNMENT) | |
124 * | |
125 * Sender and Receiver will be inserted in normalized | |
126 * form (= absolute address) ! | |
127 * | |
128 * @tablex Return values: | | |
129 * Value Description | |
130 * -------------------------------------------------- | |
131 * > 0 Size of the message. | |
132 * = 0 Buffer too small, invalid settings. | |
133 * | |
134 * @tablex Content of pHdr: | | |
135 * Setting Description | |
136 * -------------- ----------------------------------- | |
137 * pcSender NULL means that the calling process | |
138 * is the sender. Otherwise the string | |
139 * will be inserted into the message. | |
140 * pcReceiver Name of the receiver (string) | |
141 * or IPC_HANDLE of the receiver. | |
142 * pvBuffer Pointer to the data to append to | |
143 * the message. | |
144 * uwSize Size of the data to append to the | |
145 * message. | |
146 * uwID Message group and code. Use the | |
147 * macro MSG_ID(Group,Code) to set the | |
148 * value. | |
149 * ulTime Automatically set. | |
150 * uwTenthOfMS Automatically set. | |
151 *********************************************************************/ | |
152 | |
153 | |
154 /*********************************************************************/ | |
155 S16 ipc_parseMsg ( /* @func Parse a message. */ | |
156 MSG_HEADER *pMsg, /* @parm Structure to store the settings. */ | |
157 void *pvBuffer,/* @parm Buffer containing the message. */ | |
158 U16 uwSize /* @parm Size of pvBuffer. */ | |
159 ); /* @returnvalue One of the values below. */ | |
160 /*--------------------------------------------------------------------- | |
161 * @description The function parses a buffer that contains a | |
162 * a message and writes all settings to the | |
163 * structure. | |
164 * | |
165 * Attention: The address of the buffer MUST be | |
166 * aligned (multiple of ALIGNMENT) | |
167 * | |
168 * @tablex Return values: | | |
169 * Value Description | |
170 * -------------------------------------------------- | |
171 * IPC_INVALID Invalid arguments or message. | |
172 * IPC_OK Success. | |
173 * | |
174 * @tablex Content of pHdr: | | |
175 * Setting Description | |
176 * -------------- ----------------------------------- | |
177 * pcSender Address of the sender. | |
178 * pcReceiver Address of the receiver (normally | |
179 * the process receiving the message). | |
180 * pvBuffer Pointer to the data of the message. | |
181 * uwSize Size of the data. | |
182 * uwID Message group and code. Use the | |
183 * macro MSG_ID(Group,Code) to compare | |
184 * the value with other IDs. | |
185 * ulTime Time [ms from 01.01.1970 GMT] of | |
186 * message's creation. | |
187 * uwTenthOfMS The tenth of [ms] of the message's | |
188 * creation. | |
189 *********************************************************************/ | |
190 | |
191 #endif /* IPCAPI_H */ | |
192 |