IPC API  3.40.00.06
RcmServer.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2013, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 
34 /*
35  * ======== RcmServer.h ========
36  *
37  */
38 
65 #ifndef ti_grcm_RcmServer__include
66 #define ti_grcm_RcmServer__include
67 
68 #include <xdc/runtime/knl/GateThread.h>
69 #include <xdc/runtime/knl/Thread.h>
70 
71 /* For USE_RPMESSAGE setting */
72 #include <ti/grcm/RcmTypes.h>
73 
74 
77 
78 #if defined (__cplusplus)
79 extern "C" {
80 #endif
81 
86 #define RcmServer_S_SUCCESS (0)
87 
91 #define RcmServer_E_FAIL (-1)
92 
96 #define RcmServer_E_NOMEMORY (-2)
97 
104 #define RcmServer_E_SYMBOLNOTFOUND (-3)
105 
113 #define RcmServer_E_SYMBOLSTATIC (-4)
114 
121 #define RcmServer_E_SYMBOLTABLEFULL (-5)
122 
123 
124 /* -------- constants and types --------*/
125 
142 typedef Int32 (*RcmServer_MsgFxn)(UInt32, UInt32 *);
143 
144 #if USE_RPMESSAGE
145 /* This is a special function which gets the RcmServer handle as first parameter
146  * so that OMX_GetHandle() or other creation functions can store the RcmServer
147  * handle in their own context. This is needed to allow functions to send
148  * asynchrounous callbacks back to the RcmServer client.
149  */
150 typedef Int32 (*RcmServer_MsgCreateFxn)(Void *, UInt32, UInt32 *);
151 #endif
152 
164 typedef struct {
172  String name;
173 
179 #if USE_RPMESSAGE
180  union {
181  RcmServer_MsgFxn fxn;
182  RcmServer_MsgCreateFxn createFxn;
183  }addr;
184 #else
185  RcmServer_MsgFxn addr;
186 #endif
187 
189 
193 typedef struct {
197  Int length;
198 
203 
205 
212 typedef struct {
216  String name;
217 
221  UInt count;
222 
229  Thread_Priority priority;
230 
239 
243  SizeT stackSize;
244 
248  String stackSeg;
249 
251 
255 typedef struct {
259  Int length;
260 
265 
267 
268 
274 typedef struct RcmServer_Object_tag *RcmServer_Handle;
275 
281 typedef struct {
291  Thread_Priority priority;
292 
305 
309  SizeT stackSize;
310 
314  String stackSeg;
315 
320 
331 
365 
367 
377 typedef struct {
378  GateThread_Struct _f1;
379  Ptr _f2;
380 #if USE_RPMESSAGE
381  Ptr _f3a;
382  UInt32 _f3b;
383  UInt32 _f3c;
384  UInt32 _f3d;
385 #else
386  Ptr _f3;
387 #endif
388  Ptr _f4;
389  struct {
390  Int _f1;
391  Ptr _f2;
392  } _f5;
393  Ptr _f6[9];
394  UInt16 _f7;
395  UInt16 _f8;
396  Bool _f9;
397  Int _f10;
398  Ptr _f11[4];
399  Ptr _f12;
400 } RcmServer_Struct;
401 
402 
403 /* -------- functions --------*/
404 
405 /*
406  * ======== RcmServer_addSymbol ========
407  */
427 Int RcmServer_addSymbol(
428  RcmServer_Handle handle,
429  String name,
430  RcmServer_MsgFxn addr,
431  UInt32 * index
432  );
433 
434 /*
435  * ======== RcmServer_construct ========
436  */
459 Int RcmServer_construct(
460  RcmServer_Struct * structPtr,
461  String name,
462  const RcmServer_Params *params
463  );
464 
465 /*
466  * ======== RcmServer_create ========
467  */
488 Int RcmServer_create(
489  String name,
490  RcmServer_Params * params,
491  RcmServer_Handle * handle
492  );
493 
494 /*
495  * ======== RcmServer_delete ========
496  */
502 Int RcmServer_delete(
503  RcmServer_Handle * handlePtr
504  );
505 
506 /*
507  * ======== RcmServer_destruct ========
508  */
515 Int RcmServer_destruct(
516  RcmServer_Struct * structPtr
517  );
518 
519 /*
520  * ======== RcmServer_exit ========
521  */
531 Void RcmServer_exit(Void);
532 
533 /*
534  * ======== RcmServer_init ========
535  */
544 Void RcmServer_init(Void);
545 
546 /*
547  * ======== RcmServer_Params_init ========
548  */
552 Void RcmServer_Params_init(
553  RcmServer_Params * params
554  );
555 
556 /*
557  * ======== RcmServer_removeSymbol ========
558  */
572 Int RcmServer_removeSymbol(
573  RcmServer_Handle handle,
574  String name
575  );
576 
577 /*
578  * ======== RcmServer_start ========
579  */
591 Int RcmServer_start(
592  RcmServer_Handle handle
593  );
594 
595 
596 #if USE_RPMESSAGE
597 /*
598  * ======== RcmServer_getLocalAddress ========
599  */
607 UInt32 RcmServer_getLocalAddress(
608  RcmServer_Handle handle
609  );
610 
611 /*
612  * ======== RcmServer_getRemoteAddress ========
613  */
621 UInt32 RcmServer_getRemoteAddress(
622  RcmServer_Handle handle
623  );
624 
625 /*
626  * ======== RcmServer_getRemoteProc ========
627  */
635 UInt16 RcmServer_getRemoteProc(
636  RcmServer_Handle handle
637  );
638 
639 
640 #endif
641 
645 #if defined (__cplusplus)
646 }
647 #endif /* defined (__cplusplus) */
648 
650 #endif /* ti_grcm_RcmServer__include */
RcmServer_ThreadPoolDescAry workerPools
Array of thread pool descriptors.
Definition: RcmServer.h:330
Worker pool descriptor.
Definition: RcmServer.h:212
Worker pool descriptor array.
Definition: RcmServer.h:255
Function descriptor array.
Definition: RcmServer.h:193
Int osPriority
Server thread priority (OS-specific).
Definition: RcmServer.h:304
Int length
The length of the array.
Definition: RcmServer.h:197
Thread_Priority priority
Server thread priority.
Definition: RcmServer.h:291
Remote Command Message Types.
String name
The name of the worker pool.
Definition: RcmServer.h:216
RcmServer_ThreadPoolDesc * elem
Pointer to the array.
Definition: RcmServer.h:264
RcmServer_FxnDesc * elem
Pointer to the array.
Definition: RcmServer.h:202
UInt count
The number of worker threads in the pool.
Definition: RcmServer.h:221
RcmServer_MsgFxn addr
The function address in the server's address space.
Definition: RcmServer.h:185
SizeT stackSize
The stack size in bytes of a worker thread.
Definition: RcmServer.h:243
SizeT stackSize
The stack size in bytes of the server thread.
Definition: RcmServer.h:309
String stackSeg
The server thread stack placement.
Definition: RcmServer.h:314
Thread_Priority priority
The priority of all threads in the worker pool.
Definition: RcmServer.h:229
Int length
The length of the array.
Definition: RcmServer.h:259
RcmServer_FxnDescAry fxns
Array of function names to install into the server.
Definition: RcmServer.h:364
Function descriptor.
Definition: RcmServer.h:164
String name
The name of the function.
Definition: RcmServer.h:172
RcmServer Instance create parameters.
Definition: RcmServer.h:281
Int osPriority
The priority (OS-specific) of all threads in the worker pool.
Definition: RcmServer.h:238
String stackSeg
The worker thread stack placement.
Definition: RcmServer.h:248
RcmServer_ThreadPoolDesc defaultPool
The default thread pool used for anonymous messages.
Definition: RcmServer.h:319
Copyright 2015, Texas Instruments Incorporated