summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 364781d)
raw | patch | inline | side by side (parent: 364781d)
author | Angela Stegmaier <angelabaker@ti.com> | |
Wed, 20 Mar 2013 22:49:14 +0000 (17:49 -0500) | ||
committer | Angela Stegmaier <angelabaker@ti.com> | |
Wed, 20 Mar 2013 22:59:44 +0000 (17:59 -0500) |
Added new functions to the rpc_task test to test the passing
of pointer param types and embedded pointer translations.
Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
of pointer param types and embedded pointer translations.
Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
packages/ti/ipc/tests/rpc_task.c | patch | blob | history |
index 8cfdc1a76eaf10e65f991055874e5dd7f8509d99..a137a3852f3a68d1c1b3eb234a50729cb2c845d3 100644 (file)
#include <ti/srvmgr/rpmsg_omx.h>
#include <ti/srvmgr/omx_packet.h>
+#include <ti/sysbios/hal/Cache.h>
+
/* Turn on/off printf's */
#define CHATTER 1
* ======== fxnTriple used by omx_benchmark test app ========
*/
typedef struct {
- Int size_a;
Int a;
} FxnTripleArgs;
typedef struct {
- Int size_a;
Int a;
- Int size_b;
Int b;
} FxnAddArgs;
+typedef struct {
+ Int a;
+ Int b;
+ Int c;
+} FxnAdd3Args;
+
+typedef struct {
+ Int num;
+ Int *array;
+} FxnAddXArgs;
+
#define H264_DECODER_NAME "H264_decoder"
#define OMX_VIDEO_THREAD_PRIORITY 5
static Int32 RPC_SKEL_GetParameter(UInt32 size, UInt32 *data);
static Int32 fxnTriple(UInt32 size, UInt32 *data);
static Int32 fxnAdd(UInt32 size, UInt32 *data);
+static Int32 fxnAdd3(UInt32 size, UInt32 *data);
+static Int32 fxnAddX(UInt32 size, UInt32 *data);
#if 0
/* RcmServer static function table */
};
#endif
-#define RPC_SVR_NUM_FXNS 3
+#define RPC_SVR_NUM_FXNS 5
OmapRpc_FuncDeclaration RPCServerFxns[RPC_SVR_NUM_FXNS] =
{
{ RPC_SKEL_Init2,
{OmapRpc_Direction_In, OmapRpc_Param_S32, 1}
}
}
+ },
+ { fxnAdd3,
+ { "fxnAdd3", 2,
+ {
+ {OmapRpc_Direction_Out, OmapRpc_Param_S32, 1}, // return
+ {OmapRpc_Direction_In, OmapRpc_PtrType(OmapRpc_Param_U32), 1}
+ }
+ }
+ },
+ { fxnAddX,
+ { "fxnAddX", 2,
+ {
+ {OmapRpc_Direction_Out, OmapRpc_Param_S32, 1}, // return
+ {OmapRpc_Direction_In, OmapRpc_PtrType(OmapRpc_Param_U32), 1}
+ }
+ }
}
};
*/
Int32 fxnTriple(UInt32 size, UInt32 *data)
{
- FxnTripleArgs *args;
+ struct OmapRpc_Parameter *payload = (struct OmapRpc_Parameter *)data;
Int a;
-// args = (FxnTripleArgs *)((UInt32)data + sizeof(map_info_type));
- args = (FxnTripleArgs *)data;
- a = args->a;
+ a = (Int)payload[0].data;
#if CHATTER
System_printf("fxnTriple: a=%d\n", a);
*/
Int32 fxnAdd(UInt32 size, UInt32 *data)
{
- FxnAddArgs *args;
+ struct OmapRpc_Parameter *payload = (struct OmapRpc_Parameter *)data;
Int a, b;
- args = (FxnAddArgs *)data;
- a = args->a;
- b = args->b;
+ a = (Int)payload[0].data;
+ b = (Int)payload[1].data;
#if CHATTER
System_printf("fxnAdd: a=%d, b=%d\n", a, b);
return(a + b);
}
+/*
+ * ======== fxnAdd3 ========
+ */
+Int32 fxnAdd3(UInt32 size, UInt32 *data)
+{
+ struct OmapRpc_Parameter *payload = (struct OmapRpc_Parameter *)data;
+ FxnAdd3Args *args;
+ Int a, b, c;
+
+ args = (FxnAdd3Args *)payload[0].data;
+
+ Cache_inv (args, sizeof(FxnAdd3Args), Cache_Type_ALL, TRUE);
+
+ a = args->a;
+ b = args->b;
+ c = args->c;
+
+#if CHATTER
+ System_printf("fxnAdd3: a=%d, b=%d, c=%d\n", a, b, c);
+#endif
+
+ return(a + b + c);
+}
+
+/*
+ * ======== fxnAddX ========
+ */
+Int32 fxnAddX(UInt32 size, UInt32 *data)
+{
+ struct OmapRpc_Parameter *payload = (struct OmapRpc_Parameter *)data;
+ FxnAddXArgs *args;
+ Int num, i, sum = 0;
+ Int *array;
+
+ args = (FxnAddXArgs *)payload[0].data;
+
+ Cache_inv (args, sizeof(FxnAddXArgs), Cache_Type_ALL, TRUE);
+
+ num = args->num;
+ array = args->array;
+
+ Cache_inv (array, sizeof(Int) * num, Cache_Type_ALL, TRUE);
+
+#if CHATTER
+ System_printf("fxnAddX: ");
+#endif
+ for (i = 0; i < num; i++) {
+#if CHATTER
+ System_printf(" a[%d]=%d,", i, array[i]);
+#endif
+ sum += array[i];
+ }
+
+#if CHATTER
+ System_printf(" sum=%d\n", sum);
+#endif
+
+ return(sum);
+}
+
Void start_rpc_task()
{
/* Init service manager */