]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/rm-lld.git/commitdiff
Coded basic test project started removing receipt construct
authorJustin Sobota <jsobota@ti.com>
Mon, 19 Nov 2012 14:41:50 +0000 (09:41 -0500)
committerJustin Sobota <jsobota@ti.com>
Mon, 19 Nov 2012 14:41:50 +0000 (09:41 -0500)
build/buildlib.xs
include/rm_loc.h
include/rm_servicesloc.h
rm_services.h
setupenv.bat
src/rm.c
src/rm_services.c
test/rm_osal.c
test/rm_osal.h
test/rm_test.c
test/rm_testproject.txt [new file with mode: 0644]

index 53c5956e893eb7cf2aad9c8a983682c980e0aacd..555360e8e1f855853fa20c4814b2feedd1d0713f 100644 (file)
@@ -505,7 +505,6 @@ function createMiniPkg(pkgName)
     Pkg.makeEpilogue += "\t tar -C " + "\"" + newPkgRep + "\"" + " -cf packages/" + pkgName + "_mini.tar " + \r
                         packageName + "simpleC66LE.mak " + packageName + "simpleC66BE.mak\n";\r
                         \r
-\r
     /* Step2: Add the exported header files to the package */\r
     var includeFiles = libUtility.listAllFiles (".h", ".", false);\r
     for (var k = 0 ; k < includeFiles.length; k++)\r
@@ -518,12 +517,6 @@ function createMiniPkg(pkgName)
         Pkg.makeEpilogue += "\t tar -C " + "\"" + newPkgRep + "\"" + " -rf packages/" + pkgName + "_mini.tar " + \r
                         packageName + includeFiles[k] + "\n";\r
 \r
-    /* Step4: Add the resource table files to the package */\r
-    includeFiles = libUtility.listAllFiles (".c", "resource_table", true);\r
-    for (var k = 0 ; k < includeFiles.length; k++)\r
-        Pkg.makeEpilogue += "\t tar -C " + "\"" + newPkgRep + "\"" + " -rf packages/" + pkgName + "_mini.tar " + \r
-                        packageName + includeFiles[k] + "\n";\r
-\r
     /* Step4: Add the driver source files to the package; the filter should have generated a source listing */\r
     Pkg.makeEpilogue += "\t tar -C " + "\"" + newPkgRep + "\"" + " -T src.lst -rf packages/" + pkgName + "_mini.tar " + "\n";\r
 \r
index 2dff7571588bafdf5e27c754a8a94692afc0db3a..ea6828f0ef9517da3ffbcbb07022b773b366b584 100644 (file)
@@ -131,12 +131,10 @@ typedef void *Rm_TransactionQueue;
 typedef enum {
     /** Transaction is being processed */
     Rm_transactionState_PROCESSING = 0,
-    /** Transaction is waiting for response from higher level agent */
-    Rm_transactionState_AWAITING_RESPONSE = 1,
     /** Transaction has been approved */
-    Rm_transactionState_RESOURCE_APPROVED = 2,
+    Rm_transactionState_TRANSACTION_APPROVED = 1,
     /** Transaction has been denied */
-    Rm_transactionState_RESOURCE_DENIED = 3  
+    Rm_transactionState_TRANSACTION_DENIED = 2  
 } Rm_TransactionState;
 
 /**
@@ -161,64 +159,38 @@ typedef struct {
  * @brief RM transactions are the internalized version of service requests received 
  *        from components and RM commands received from other RM instances.
  *        Transactions that cannot immediately be serviced are placed in the RM
- *        instance's transaction queue.
+ *        instance's transaction queue.  The transactions track all service
+ *        requests within the RM infrastructure.
  */
 typedef struct {
     /** Transaction service type */
     Rm_ServiceType type;
-    /** ID of transaction.  Maps to the RM protocol packet ID when forwarding
-     *  RM requests or received RM responses. */
-    uint32_t id;
+    /** Local ID of the transaction. */
+    uint32_t localId;
+    /** ID of transaction on lower level RM instance that generated the
+     *  packet that resulted in the creation of the transaction.  The
+     *  originating ID will be placed in the transaction's response packet
+     *  to the lower level RM instance.  The lower level RM instance will 
+     *  match the response packet with the originating request using the ID */
+    uint32_t remoteOriginatingId;
     /** Name of the RM instance the transaction originated from */
     char sourceInstName[RM_INSTANCE_NAME_MAX_CHARS];
     /** Transaction's associated callback function */
     Rm_ServiceCallback callback;
     /** Transaction state */
     Rm_TransactionState state;
-    /** Transaction details.  Provides detailed request/response codes such as
-     *  resource denial reasons.  The codes are externally visible and tracked
+    /** Transaction result.  The codes are externally visible and tracked
      *  in rmservices.h */
-    int32_t details;
+    int32_t result;
     /** Resource information */
     Rm_ResourceInfo resourceInfo;
     /** Link to the next transaction in the queue */
     void *nextTransaction;    
 } Rm_Transaction;
 
-/**
- * @brief Transaction receipt contains transaction result information that is passed
- *        back to the entity that was the source of the transaction.  The source can be
- *        a component that requested a service or a RM instance that sent a command.
- */
-typedef struct {
-    /** Result of the requested service.  Service result types are explained in the 
-     *  Rm_services.h header */
-    int32_t serviceResult;
-    /** If RM cannot provide a result to the service immediately a service ID will
-     *  be provided to the service requester.  The service ID should be used by the
-     *  requester to map RM service responses received via the callback function
-     *  provided to RM at the time of requesting the service */
-    uint32_t serviceId;
-    /** Base value of resource affected by the service request if RM immediately handles
-     *  the request */
-    uint32_t resourceBase;
-    /** Range of resource starting at resourceBase affected by the service request if RM
-     *  immediately handles the request */
-    uint32_t resourceRange;
-} Rm_TransactionReceipt;
-
-typedef enum {
-    /** running */
-    RM_state_IDLE = 0,
-    /** handling request */
-    RM_state_HANDLING_REQUEST = 1
-    /** etc...flesh all these out later will need states for the different alloc, free, request/response handlers */
-} Rm_State;
-
 typedef struct {
     char name[RM_INSTANCE_NAME_MAX_CHARS];
     Rm_InstType instType;
-    Rm_State instState;  // IS THIS NEEDED???
     bool registeredWithDelegateOrServer;
     Rm_PolicyHandle instPolicy;  /* Client Delegate only? */
     /* RM instance transport parameters */
index 122ffcb7c532fa923c2fece6a88572107aba3dec..1241420f062a0d11d6b2a8ac682256ca578dbb00 100644 (file)
@@ -54,7 +54,7 @@ extern "C" {
 /* This function is executed when a RM instance receives a response to one of its requests
  * and the information in the request must be provided to the original requesting component */
 void Rm_serviceResponder (Rm_Inst *rmInst, Rm_Transaction *responseTransaction,
-                          Rm_Transaction *requestTransaction, Rm_TransactionReceipt *receipt);
+                          Rm_Transaction *requestTransaction);
 
 
 #ifdef __cplusplus
index 9561425fd3870b66c7cdf0fbde8792f97a7f1b65..f4b5e2493fdadeda15f3cb2e8d27d5ecd0cd0189 100644 (file)
@@ -124,7 +124,7 @@ extern "C" {
 /**
  * @brief Maximum number of characters in the resource names
  */
-#define RM_RESOURCE_NAME_MAX_CHARS (24) 
+#define RM_RESOURCE_NAME_MAX_CHARS (24)
 
 /** 
  * @brief RM service types
@@ -260,7 +260,7 @@ typedef struct {
      */
     void (*rmService)(void *rmHandle, Rm_ServiceReqInfo *serviceRequest,
                       Rm_ServiceRespInfo *serviceResponse);
-} Rm_ServicesPort;
+} Rm_ServicePort;
 
 /**
  *  @b Description
@@ -298,7 +298,7 @@ void Rm_preMainAllocService (Rm_PreMainAllocInfo *preMainAllocInfo,
  *      for resource management.
  *
  *  @param[in]  rmHandle
- *      RM instance handle.  Used to return a Rm_ServicesPort from an RM
+ *      RM instance handle.  Used to return a Rm_ServicePort from an RM
  *      instance.
  *
  *  @retval
@@ -307,7 +307,7 @@ void Rm_preMainAllocService (Rm_PreMainAllocInfo *preMainAllocInfo,
  *  @retval
  *      Failure - NULL
  */
-Rm_ServicesPort *Rm_getServicePort(Rm_Handle rmHandle);
+Rm_ServicePort *Rm_getServicePort(Rm_Handle rmHandle);
 
 /** 
 @} 
index 5840ad2835a376b58b7a22968a6cc1310c9b94e9..1fe3d6b3fec0b419d46a653a33e44145e59ed6b9 100644 (file)
@@ -19,7 +19,7 @@ set PARTNO=TCI6614
 :partno_Defined\r
 \r
 IF DEFINED PDK_INSTALL_PATH GOTO pdk_defined\r
-set PDK_INSTALL_PATH=C:/ti/pdk_tci6614_1_00_00_10/packages\r
+set PDK_INSTALL_PATH=C:/ti/pdk_tci6614_1_00_00_11/packages\r
 :pdk_defined\r
 \r
 @REM ---------------------------------\r
@@ -29,8 +29,8 @@ set MINI_PACKAGE=ON
 @echo MINI PACKAGE is set to %MINI_PACKAGE%\r
 \r
 @REM This is the base location for the various tools. \r
-set XDCCGROOT=C:/ti/ccsv5/tools/compiler/c6000_7.3.4\r
-set C6X_GEN_INSTALL_PATH=C:/ti/ccsv5/tools/compiler/c6000_7.3.4\r
+set XDCCGROOT=C:/ti/ccsv5/tools/compiler/c6000\r
+set C6X_GEN_INSTALL_PATH=C:/ti/ccsv5/tools/compiler/c6000\r
 \r
 REM *******************************************************************************\r
 REM *************************** XDC PATH Configuration ****************************\r
index 28e58fcb1349c6b32a95f2c18fa2e44e5f98ac6a..a6dd50165de91d782c5a222f4898bb2ff08f961c 100644 (file)
--- a/src/rm.c
+++ b/src/rm.c
@@ -97,8 +97,8 @@ Rm_Transaction *Rm_transactionQueueAdd(Rm_Inst *rmInst, uint32_t transactionId)
     /* Clear the transaction */\r
     memset((void *)newTransaction, 0, sizeof(Rm_Transaction));\r
 \r
-    /* Populate transaction with the provided ID */\r
-    newTransaction->id = transactionId;\r
+    /* Set the transaction's local ID */\r
+    newTransaction->localId = transactionId;\r
     /* New transaction's nextTransaction pointer will always be NULL */\r
     newTransaction->nextTransaction = NULL;  \r
 \r
@@ -139,7 +139,7 @@ Rm_Transaction *Rm_transactionQueueFind(Rm_Inst *rmInst, uint32_t transactionId)
          * transaction pointer will be NULL */\r
         while (transaction != NULL)\r
         {\r
-            if (transaction->id == transactionId)\r
+            if (transaction->localId == transactionId)\r
             {\r
                 /* Match: break out of loop and return the transaction */\r
                 break;             \r
@@ -170,7 +170,7 @@ int32_t Rm_transactionQueueDelete(Rm_Inst *rmInst, uint32_t transactionId)
     /* Find the transaction ID within the specified RM instance's transaction queue. */\r
     while (transaction != NULL)\r
     {\r
-        if (transaction->id == transactionId)\r
+        if (transaction->localId == transactionId)\r
         {\r
             /* Match: break out of loop and delete the transaction */\r
             break;             \r
@@ -212,6 +212,13 @@ int32_t Rm_transactionQueueDelete(Rm_Inst *rmInst, uint32_t transactionId)
     return (RM_SERVICE_ACTION_OKAY);\r
 }\r
 \r
+uint32_t Rm_transactionInitSequenceNum(void)\r
+{\r
+    /* Sequence number can never have a value of 0 so that there are no conflicts\r
+     * when searching for transactions that received a response of a higher level RM agent */\r
+    return (1);\r
+}\r
+\r
 uint32_t Rm_transactionGetSequenceNum(Rm_Inst *rmInst)\r
 {\r
     uint32_t sequenceNum = 0;\r
@@ -220,9 +227,18 @@ uint32_t Rm_transactionGetSequenceNum(Rm_Inst *rmInst)
     /* Lock access to the RM instance */\r
     key = Rm_osalCsEnter();\r
 \r
-    /* Get the next sequence number and then incement.  Overflow is okay since\r
-     * it just restarts the sequence number count. */\r
-    sequenceNum = rmInst->transactionSeqNum++;\r
+    /* Get the next sequence number and then increment.  If there's an overflow\r
+     * assign the initial value instead of incrementing. */\r
+    if (rmInst->transactionSeqNum + 1 < rmInst->transactionSeqNum)\r
+    {\r
+        /* Overflow */\r
+        sequenceNum = rmInst->transactionSeqNum;\r
+        rmInst->transactionSeqNum = Rm_transactionInitSequenceNum();\r
+    }\r
+    else\r
+    {\r
+        sequenceNum = rmInst->transactionSeqNum++;\r
+    }    \r
 \r
     Rm_osalCsExit(key);\r
     return (sequenceNum);\r
@@ -805,16 +821,14 @@ Rm_Handle Rm_init(Rm_InitCfg *initCfg)
     /* Populate instance based on input parameters */\r
     strcpy (&rmInst->name[0], initCfg->instName);\r
     rmInst->instType = initCfg->instType;\r
-    rmInst->instState = RM_state_IDLE;\r
     rmInst->registeredWithDelegateOrServer = false;\r
 \r
     /* Initialize the transport routing map linked list pointer to NULL.  The linked list\r
      * nodes will be created when the application registers transports */\r
     rmInst->routeMap = NULL;\r
 \r
-    /* Initialize the transaction queue elements.  The linked list pointer is set to NULL\r
-     * and the transaction sequence number is initialized to 0. */\r
-    rmInst->transactionSeqNum = 0;\r
+    /* Initialize the transaction queue elements. */\r
+    rmInst->transactionSeqNum = Rm_transactionInitSequenceNum();\r
     rmInst->transactionQueue= NULL;\r
 \r
     /* RM Server specific actions */\r
index 117d52ec340cf20f14e12b3cb03a5c6aedc261b3..d42769cc9eb9c7e686a7ee9d811cdbdbfd8e53f8 100644 (file)
@@ -61,7 +61,6 @@ void Rm_serviceHandler (void *rmHandle, Rm_ServiceReqInfo *serviceRequest,
     Rm_Inst *rmInst = (Rm_Inst *)rmHandle;
     uint32_t transactionId = 0;
     Rm_Transaction *transaction;
-    Rm_TransactionReceipt receipt;
     void *key;
 
     /* Prevent another component using the same instance from wiping out the current
@@ -103,15 +102,11 @@ void Rm_serviceHandler (void *rmHandle, Rm_ServiceReqInfo *serviceRequest,
     }
     else
     {
-        /* Clear the receipt */
-        memset((void *) &receipt, 0, sizeof(Rm_TransactionReceipt));
-
         /* Transfer request information into the transaction */
         transaction->type = serviceRequest->type;
         strcpy(transaction->sourceInstName, rmInst->name);
         transaction->callback.serviceCallback = serviceRequest->callback.serviceCallback;
         transaction->state = Rm_transactionState_PROCESSING;
-        transaction->details = RM_SERVICE_PROCESSING;
         strcpy(&(transaction->resourceInfo.name)[0], serviceRequest->resourceName);
         transaction->resourceInfo.base = serviceRequest->resourceBase;
         transaction->resourceInfo.range = serviceRequest->resourceRange;
@@ -119,36 +114,39 @@ void Rm_serviceHandler (void *rmHandle, Rm_ServiceReqInfo *serviceRequest,
         strcpy(&(transaction->resourceInfo.nsName)[0], serviceRequest->resourceNsName);
 
         /* Pass the new transaction to the transaction processor */
-        Rm_transactionProcessor (rmInst, transaction, &receipt);
-
-        /* Copy transaction receipt information into the response info fields for the 
-         * component based on the result of the transaction.  Denied service requests
-         * will have only a valid serviceResult field */
-        serviceResponse->serviceResult = receipt.serviceResult;
-
-        /* Service was approved and service was an allocate request the resource
-         * data is passed back to the component */
-        if ((serviceResponse->serviceResult == RM_SERVICE_APPROVED) &&
-            ((transaction->type == Rm_service_RESOURCE_ALLOCATE) ||
-             (transaction->type == Rm_service_RESOURCE_BLOCK_ALLOCATE) ||
-             (transaction->type == Rm_service_RESOURCE_ALLOCATE_BY_NAME)))
-        {
-            serviceResponse->resourceBase = receipt.resourceBase;
-            serviceResponse->resourceRange = receipt.resourceRange;
+        Rm_transactionProcessor (rmInst, transaction);
 
-            /* Delete the transaction since a response was received immediately */
-            Rm_transactionQueueDelete(rmInst, transaction->id);
-        }
-        else if (serviceResponse->serviceResult == RM_SERVICE_PROCESSING)
+        /* Provide response to the component that requested the service */
+        if (transaction->state == Rm_transactionState_PROCESSING)
         {
             /* The service is still being processed.  Provide the transaction ID
              * back to the component so that it can sort service responses received
              * via the provided callback function */
-            serviceResponse->requestId = receipt.serviceId;
+            serviceResponse->serviceResult == RM_SERVICE_PROCESSING;
+            serviceResponse->requestId = transaction->localId;
         }
-        else if (serviceResponse->serviceResult <= RM_SERVICE_ERROR_BASE)
+        else if (transaction->state == Rm_transactionState_TRANSACTION_APPROVED)
         {
-            /* Delete the transaction since there was an error processing it. */
+            serviceResponse->serviceResult = RM_SERVICE_APPROVED;
+            /* Service was approved and service was an allocate request the resource
+             * data is passed back to the component */
+            if ((transaction->type == Rm_service_RESOURCE_ALLOCATE) ||
+                (transaction->type == Rm_service_RESOURCE_BLOCK_ALLOCATE) ||
+                (transaction->type == Rm_service_RESOURCE_ALLOCATE_BY_NAME))
+            {
+                serviceResponse->resourceBase = transaction->resourceInfo.base;
+                serviceResponse->resourceRange = transaction->resourceInfo.range;
+            }
+
+            /* Delete the transaction since a response was received immediately */
+            Rm_transactionQueueDelete(rmInst, transaction->id);
+        }
+        else if (transaction->state == Rm_transactionState_TRANSACTION_DENIED)
+        {
+            /* Transaction result field will contain a vlaue specifying why resource was
+             * denied */
+            serviceResponse->serviceResult = transaction->result;
+            /* Delete the transaction since a response was received immediately */
             Rm_transactionQueueDelete(rmInst, transaction->id);
         }
     }
@@ -160,13 +158,16 @@ void Rm_serviceHandler (void *rmHandle, Rm_ServiceReqInfo *serviceRequest,
 /* This function is executed when a RM instance receives a response to one of its requests
  * and the information in the request must be provided to the original requesting component */
 void Rm_serviceResponder (Rm_Inst *rmInst, Rm_Transaction *responseTransaction,
-                          Rm_Transaction *requestTransaction, Rm_TransactionReceipt *receipt)
+                          Rm_Transaction *requestTransaction)
 {
     Rm_ServiceRespInfo serviceResponse;
 
+
+   /* CODING HERE */
+
     /* Populate the service response with the transaction response details
      * for the component */
-    serviceResponse.serviceResult = responseTransaction->details;
+    serviceResponse.serviceResult = responseTransaction->result;
     /* Pass back the ID that was provided to the component when it requested
      * the service */
     serviceResponse.requestId = responseTransaction->id;
@@ -178,8 +179,8 @@ void Rm_serviceResponder (Rm_Inst *rmInst, Rm_Transaction *responseTransaction,
          (responseTransaction->type == Rm_service_RESOURCE_BLOCK_ALLOCATE) ||
          (responseTransaction->type == Rm_service_RESOURCE_ALLOCATE_BY_NAME)))
     {
-        serviceResponse.resourceBase = receipt->resourceBase;
-        serviceResponse.resourceRange = receipt->resourceRange;
+        serviceResponse.resourceBase = responseTransaction->resourceInfo.base;
+        serviceResponse.resourceRange = responseTransaction->resourceInfo.range;
     }
 
     /* Issue the callback to the requesting component with the response information */
@@ -219,14 +220,14 @@ void Rm_preMainAllocService(Rm_PreMainAllocInfo *preMainAllocInfo,
 
 }
 
-Rm_ServicesPort *Rm_getServicePort(Rm_Handle rmHandle)
+Rm_ServicePort *Rm_getServicePort(Rm_Handle rmHandle)
 {
-    Rm_ServicesPort *newServicePort = NULL;
+    Rm_ServicePort *newServicePort = NULL;
     
     /* Create a new service handle for the specified RM instance */
     
     /* Get memory for a new service port from local memory */
-    newServicePort = Rm_osalMalloc (sizeof(Rm_ServicesPort), false);
+    newServicePort = Rm_osalMalloc (sizeof(Rm_ServicePort), false);
 
     /* Return NULL immediately if malloc returned NULL */
     if (newServicePort == NULL)
index 0563140c49693aed758b9a80bd82ddbf5faab155..a67d0d441c5aa5a2def26034ef61357db092dc4a 100644 (file)
@@ -78,7 +78,7 @@ uint32_t rmFreeCounter   = 0;
  *  @retval
  *      Allocated block address
  */
-void* Osal_biosMalloc (uint32_t num_bytes)
+void* Osal_rmMalloc (uint32_t num_bytes)
 {
        Error_Block     errorBlock;
 
@@ -103,7 +103,7 @@ void* Osal_biosMalloc (uint32_t num_bytes)
  *  @retval
  *      Not Applicable
  */
-void Osal_biosFree (void *ptr, uint32_t size)
+void Osal_rmFree (void *ptr, uint32_t size)
 {
     /* Increment the free counter. */
     rmFreeCounter++;
index d818dd27e924fe1728765ace99503f32980c7f08..1f765151f0bfc6c4f5b74a2e0c95ad844841ae6f 100644 (file)
@@ -43,8 +43,8 @@
 #ifndef __RM_OSAL_H__
 #define __RM_OSAL_H__
 
-extern void* Osal_biosMalloc (uint32_t num_bytes);
-extern void Osal_biosFree (void *ptr, uint32_t size);
+extern void* Osal_rmMalloc (uint32_t num_bytes);
+extern void Osal_rmFree (void *ptr, uint32_t size);
 extern void* Osal_rmCsEnter (void);
 extern void Osal_rmCsExit (void *CsHandle);
 extern void* Osal_rmMtCsEnter (void);
@@ -53,8 +53,8 @@ extern void Osal_rmBeginMemAccess (void *ptr, uint32_t size);
 extern void Osal_rmEndMemAccess (void *ptr, uint32_t size);
 
 /* RM LLD OSAL Memory Allocation API are redefined to TEST application API */
-#define Rm_osalMalloc             Osal_biosMalloc
-#define Rm_osalFree               Osal_biosFree
+#define Rm_osalMalloc             Osal_rmMalloc
+#define Rm_osalFree               Osal_rmFree
 
 /* RM LLD OSAL Critical section and cache coherency APIs are used without redefinition in TEST application API */
 #define Rm_osalCsEnter            Osal_rmCsEnter
index ec96813dae3eaeb047dc14703b552438cb01e181..a57dbfc06f3344a6033382686fb746e5a285149a 100644 (file)
@@ -92,6 +92,11 @@ Rm_Handle rmServerHandle = NULL;
 Rm_Handle rmClientDelegateHandle = NULL;
 Rm_Handle rmClientHandle = NULL;
 
+/* ======== RM Instance Service Ports ======== */
+Rm_ServicePort *rmServerServicePort = NULL;
+Rm_ServicePort *rmClientDelegateServicePort = NULL;
+Rm_ServicePort *rmClientServicePort = NULL;
+
 /* ======== RM Transport Packet Definition ======== */
 typedef struct {
   MessageQ_MsgHeader msgQHeader;
@@ -183,7 +188,7 @@ int32_t TransportSend (Rm_TransportHandle transportHandle, Rm_Packet *pkt)
         /* Attach the RM packet to the MessageQ message */
         rmMsg->rmPkt = pkt;
         /* Send the message to the remote side */
-        status = MessageQ_put(remoteQueueId, rmMsg);
+        status = MessageQ_put(remoteQueueId, (MessageQ_Msg)rmMsg);
         if (status < 0) 
         { 
             System_printf("Core %d: MessageQ_put had a failure/error in TransportSend\n", MultiProc_self());
@@ -236,7 +241,7 @@ void * TransportReceive (Rm_TransportHandle transportHandle)
         }
 
         /* Extract the Rm_Packet from the RM msg */
-        rmPkt = ((MsgQ_RmPacket)rmMsg).rmPkt;
+        rmPkt = ((MsgQ_RmPacket *)rmMsg)->rmPkt;
 
         /* Free the messageQ message now that RM packet pointer has been extracted */
         status = MessageQ_free(rmMsg);
@@ -292,22 +297,69 @@ int32_t TransportNumPktsReceived (Rm_TransportHandle transportHandle)
     return (numPkts);
 }
 
+/*
+ *  ======== testServiceCallback ========
+ *  Application's callback function given to RM on service requests
+ */
+Void testServiceCallback(Rm_ServiceRespInfo *serviceResponse)
+{
+
+}
+
 /*
  *  ======== testRmTsk ========
  *  RM test task
  */
 Void testRmTsk(UArg arg0, UArg arg1)
 {
+    Rm_ServiceReqInfo requestInfo;
+    Rm_ServiceRespInfo responseInfo;
+       
     /* Delete the RM startup task */
     System_printf("Core %d: Deleting RM startup task...\n", MultiProc_self());
     if (startupRmTskHandle)
     {
-        Task_delete(startupRmTskHandle);
+        Task_delete(&startupRmTskHandle);
         /* Set the task handle to be NULL so that the delete only occurs once */
         startupRmTskHandle = NULL;
     }
 
-    /* Start running Tests */
+    /* Open service ports on all the RM instances to test service requests from the different
+     * RM instances */
+    if (MultiProc_self() == 0)
+    {
+        rmServerServicePort = Rm_getServicePort(rmServerHandle);
+    }
+    else if (MultiProc_self() == 1)
+    {
+        rmClientDelegateServicePort = Rm_getServicePort(rmClientDelegateHandle);
+        rmClientServicePort = Rm_getServicePort(rmClientHandle);
+    }
+
+    memset((void *)&requestInfo, 0, sizeof(Rm_ServiceReqInfo));
+    memset((void *)&responseInfo, 0, sizeof(Rm_ServiceRespInfo));
+
+    /* Use the service ports to test the service requests */
+    if (MultiProc_self() == 0)
+    {
+        char resourceName[RM_RESOURCE_NAME_MAX_CHARS] = "hw_semaphore";
+        char resourceNsName[RM_RESOURCE_NAME_MAX_CHARS] = "dsp_core_lock";
+                
+        /* TEMP: Try mapping a resource in Name Server */
+        requestInfo.type = Rm_service_RESOURCE_MAP_TO_NAME;
+        requestInfo.resourceName = &resourceName[0];
+        requestInfo.resourceBase = 0;
+        requestInfo.resourceRange = 1;
+        requestInfo.resourceNsName = &resourceNsName[0];
+        requestInfo.callback.serviceCallback = testServiceCallback;
+        
+        /* Issue the service request via the service port */
+        rmServerServicePort->rmService(rmServerServicePort->rmHandle, &requestInfo, &responseInfo);
+    }
+    else if (MultiProc_self() == 1)
+    {
+
+    }
 
     System_printf("The test is complete\n");
     BIOS_exit(0);
@@ -319,7 +371,6 @@ Void testRmTsk(UArg arg0, UArg arg1)
  */
 Void startupRmTsk(UArg arg0, UArg arg1)
 {
-    MessageQ_Msg     msg;    
     MessageQ_Handle  serverCdMsgQ, cdServerMsgQ, cdClientMsgQ, clientCdMsgQ;
     MessageQ_QueueId serverCdQId, cdServerQId, cdClientQId, clientCdQId;    
     Int              status, i;
@@ -328,7 +379,6 @@ Void startupRmTsk(UArg arg0, UArg arg1)
     Rm_TransportCfg rmTransportCfg;
     Rm_TransportHandle serverCdHandle, cdServerHandle, cdClientHandle, clientCdHandle;
     Task_Params taskParams;
-       Task_Handle taskHandle;
 
     /* Initialize the transport map */
     for (i = 0; i < MAX_MAPPING_ENTRIES; i++)
@@ -434,7 +484,7 @@ Void startupRmTsk(UArg arg0, UArg arg1)
         } 
         System_printf("Core %d: RM CD MessageQ created for receiving packets from RM Client\n", MultiProc_self());
         /* Create the RM Client messageQ used by the RM Client Delegate */
-        clientCdMsgQ = MessageQ_create(clientCdQueueName, NULL;
+        clientCdMsgQ = MessageQ_create(clientCdQueueName, NULL);
         if (clientCdMsgQ == NULL) 
         {
             System_abort("MessageQ_create failed for RM Client - Client Delegate queue\n" );
@@ -470,7 +520,7 @@ Void startupRmTsk(UArg arg0, UArg arg1)
         rmTransportCfg.transportCallouts.rmReceive = TransportReceive;        
         rmTransportCfg.transportCallouts.rmNumPktsReceived = TransportNumPktsReceived; 
 
-        serverCdHandle = Rm_transportRegister(rmServerHandle, rmTransportCfg);
+        serverCdHandle = Rm_transportRegister(rmServerHandle, &rmTransportCfg);
 
         /* Store the mapping information in the transport map */
         rmTransportMap[SERVER_TO_CD_MAP_ENTRY].transportHandle = serverCdHandle;
@@ -507,7 +557,7 @@ Void startupRmTsk(UArg arg0, UArg arg1)
         rmTransportCfg.transportCallouts.rmReceive = TransportReceive;        
         rmTransportCfg.transportCallouts.rmNumPktsReceived = TransportNumPktsReceived; 
 
-        cdServerHandle = Rm_transportRegister(rmClientDelegateHandle, rmTransportCfg);
+        cdServerHandle = Rm_transportRegister(rmClientDelegateHandle, &rmTransportCfg);
 
         /* Store the mapping information in the transport map */
         rmTransportMap[CD_TO_SERVER_MAP_ENTRY].transportHandle = cdServerHandle;
@@ -536,7 +586,7 @@ Void startupRmTsk(UArg arg0, UArg arg1)
         /* Callouts already set so set them as invalid */
         rmTransportCfg.transportCalloutsValid = false;
 
-        cdClientHandle = Rm_transportRegister(rmClientDelegateHandle, rmTransportCfg);
+        cdClientHandle = Rm_transportRegister(rmClientDelegateHandle, &rmTransportCfg);
 
         /* Store the mapping information in the transport map */
         rmTransportMap[CD_TO_CLIENT_MAP_ENTRY].transportHandle = cdClientHandle;
@@ -565,7 +615,7 @@ Void startupRmTsk(UArg arg0, UArg arg1)
         /* Callouts already set so set them as invalid */
         rmTransportCfg.transportCalloutsValid = false;
 
-        clientCdHandle = Rm_transportRegister(rmClientHandle, rmTransportCfg);
+        clientCdHandle = Rm_transportRegister(rmClientHandle, &rmTransportCfg);
 
         /* Store the mapping information in the transport map */
         rmTransportMap[CLIENT_TO_CD_MAP_ENTRY].transportHandle = clientCdHandle;
@@ -587,7 +637,6 @@ Void startupRmTsk(UArg arg0, UArg arg1)
 Int main(Int argc, Char* argv[])
 {
     Rm_InitCfg rmInitCfg;
-    Rm_Handle rmHandle = NULL;
     Task_Params taskParams;
     Int status;
 
diff --git a/test/rm_testproject.txt b/test/rm_testproject.txt
new file mode 100644 (file)
index 0000000..6a183c1
--- /dev/null
@@ -0,0 +1,7 @@
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/rm_test.c"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/rm_osal.c"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/rm_osal.h"
+-ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/rm_test.cfg"
+-ccs.setCompilerOptions "-mv6600 -g --diag_warning=225 -I${PDK_INSTALL_PATH}/ti/drv/rm" 
+-rtsc.enableRtsc
+