]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/commitdiff
Add base field to MmRpc_Xlt structure. 3.10.00.06_eng
authorRamsey Harris <ramsey@ti.com>
Wed, 28 Aug 2013 22:06:36 +0000 (15:06 -0700)
committerChris Ring <cring@ti.com>
Wed, 28 Aug 2013 23:46:53 +0000 (16:46 -0700)
Fixed the offset calculation for embedded pointers by allowing
the caller to specify encoded base value. Enhanced some comments.
Code cleanup.

packages/ti/ipc/mm/MmRpc.c
packages/ti/ipc/mm/MmRpc.h
packages/ti/ipc/tests/Mx.c

index fab40675bf810f21df7f23b18376e70f0439d1c1..e6f0c119671eb9cf3b32b086e53bdb1b7a49071a 100644 (file)
@@ -184,9 +184,7 @@ int MmRpc_call(MmRpc_Handle handle, MmRpc_FxnCtx *ctx, int32_t *ret)
     int len;
     int i;
 
-    /* Combine function parameters and translation array into one contiguous
-     * message. TODO, modify driver to accept two separate buffers in order
-     * to eliminate this step. */
+    /* combine params and translation array into one contiguous message */
     len = sizeof(struct rppc_function) +
                 (ctx->num_xlts * sizeof(struct rppc_param_translation));
     msg = (void *)calloc(len, sizeof(char));
@@ -231,15 +229,6 @@ int MmRpc_call(MmRpc_Handle handle, MmRpc_FxnCtx *ctx, int32_t *ret)
                 rpfxn->params[i].reserved = param->param.offPtr.handle;
                 break;
 
-#if 0 /* TBD */
-            case MmRpc_ParamType_Elem:
-                rpfxn->params[i].type = RPPC_PARAM_TYPE_PTR;
-                rpfxn->params[i].size = param->param.elem.size;
-                rpfxn->params[i].data = param->param.elem.offset;
-                rpfxn->params[i].base = param->param.elem.base;
-                rpfxn->params[i].reserved = param->param.elem.handle;
-                break;
-#endif
             default:
                 printf("MmRpc_call: Error: invalid parameter type\n");
                 status = MmRpc_E_INVALIDPARAM;
@@ -252,17 +241,10 @@ int MmRpc_call(MmRpc_Handle handle, MmRpc_FxnCtx *ctx, int32_t *ret)
     rpfxn->num_translations = ctx->num_xlts;
 
     for (i = 0; i < ctx->num_xlts; i++) {
-        uint32_t index;
-        size_t ptr;
-
-        /* compute base value */
-        index = ctx->xltAry[i].index;
-        ptr = rpfxn->params[index].base + ctx->xltAry[i].offset;
-
         /* pack the pointer translation entry */
-        rpfxn->translations[i].index    = index;
+        rpfxn->translations[i].index    = ctx->xltAry[i].index;
         rpfxn->translations[i].offset   = ctx->xltAry[i].offset;
-        rpfxn->translations[i].base     = (size_t)(*(void **)ptr);
+        rpfxn->translations[i].base     = ctx->xltAry[i].base;
         rpfxn->translations[i].reserved = ctx->xltAry[i].handle;
     }
 
index ed8f000e50c699e7853d677142d1ee5b9707fd48..2ad16ac82b3bc0fdd8827f431e1fe31111edaecd 100644 (file)
@@ -127,26 +127,32 @@ typedef struct {
         } ptr;
 
         struct {
-            size_t      size;   /*!< size (bytes) of memory block */
-            size_t      base;   /*!< base address of memory block */
-            size_t      offset; /*!< offset (bytes) from base to data */
+            size_t      size;   /*!< size (bytes) of param structure */
+            size_t      base;   /*!< param address */
+            size_t      offset; /*!< offset within param */
             size_t      handle; /*!< memory allocator handle */
         } offPtr;
 
-#if 0 /* TBD */
-        struct {
-            size_t      size;   /*!< size of the array element */
-            size_t      offset; /*!< offset to current array element */
-            size_t      base;   /*!< base address of array */
-            size_t      handle; /*!< memory allocator handle */
-        } elem;
-#endif
     } param;
 } MmRpc_Param;
 
 typedef struct {
     uint32_t    index;  /*!< parameter index to base pointer */
-    ptrdiff_t   offset; /*!< offset from the base address to pointer */
+    ptrdiff_t   offset; /*!< offset to embedded pointer
+                         *
+                         *   If param type is MmRpc_ParamType_Ptr, offset
+                         *   to embedded pointer from addr. If param type
+                         *   is MmRpc_ParamType_OffPtr, offset to embedded
+                         *   pointer from base+offset.
+                         */
+    size_t      base;   /*!< addr or file descriptor [+ data offset]
+                         *
+                         *   If param type is MmRpc_ParamType_Ptr, the
+                         *   value of the embedded pointer. If param type
+                         *   is MmRpc_ParamType_OffPtr, the file descriptor
+                         *   of the block referenced by the embedded pointer
+                         *   plus an optional data offset.
+                         */
     size_t      handle; /*!< memory allocator handle */
 } MmRpc_Xlt;
 
index 17208a82252dc571980dae60d7fd02f249d04b6c..a0e8a6d603a495b5ee9b7cb61a3b45241c97d49e 100644 (file)
@@ -196,6 +196,7 @@ int32_t Mx_compute_Linux(Mx_Compute *compute, int fd, int fdIn, int fdOut)
 
     fxnCtx->xltAry[0].index = 0;
     fxnCtx->xltAry[0].offset = MmRpc_OFFSET(compute, &compute->inBuf);
+    fxnCtx->xltAry[0].base = (size_t)compute->inBuf;
 #if defined(SYSLINK_BUILDOS_QNX)
     fxnCtx->xltAry[0].handle = NULL;
 #else
@@ -204,6 +205,7 @@ int32_t Mx_compute_Linux(Mx_Compute *compute, int fd, int fdIn, int fdOut)
 
     fxnCtx->xltAry[1].index = 0;
     fxnCtx->xltAry[1].offset = MmRpc_OFFSET(compute, &compute->outBuf);
+    fxnCtx->xltAry[1].base = (size_t)compute->outBuf;
 #if defined(SYSLINK_BUILDOS_QNX)
     fxnCtx->xltAry[1].handle = NULL;
 #else