summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 59be1b4)
raw | patch | inline | side by side (parent: 59be1b4)
author | Justin Sobota <jsobota@ti.com> | |
Mon, 17 Dec 2012 00:57:57 +0000 (19:57 -0500) | ||
committer | Justin Sobota <jsobota@ti.com> | |
Mon, 17 Dec 2012 00:57:57 +0000 (19:57 -0500) |
index 4bc70c6098438e736cbe4b0030f3b51cc2969f60..dc537ccd8b76700b65364add6c81447867920b4d 100644 (file)
Binary files a/device/tci6614-global-resources.dtb and b/device/tci6614-global-resources.dtb differ
Binary files a/device/tci6614-global-resources.dtb and b/device/tci6614-global-resources.dtb differ
index 46a90a8c674b11207b9a44a67b875e6af78e2922..1b9a8aee224352abc1452b124a38cc005eebb09a 100644 (file)
*/
qmss {
+ ns-assignment = "Arm_Descriptors", <0 4096>;
+
pdsps {
resource-range = <0 2>;
};
index 8bb33905b0301b71029f79061e47f7d7cffd569c..b8fe7ddc7afbab6c21e70fe95aca93e98a1c07f8 100644 (file)
int32_t Rm_nsInit(Rm_Inst *rmInst);
int32_t Rm_nsAddObject(Rm_Inst *rmInst, Rm_ResourceInfo *resourceInfo);
+void Rm_nsPrintObjects(Rm_Inst *rmInst);
int32_t Rm_nsFindObject(Rm_Inst *rmInst, Rm_ResourceInfo *resourceInfo);
int32_t Rm_nsDeleteObject(Rm_Inst *rmInst, Rm_ResourceInfo *resourceInfo);
index 69775ea8c6eb7175c9ef4a04e7439a5e96a943a9..04f4b05b397a82481775711f7c51a9930ed1e588 100644 (file)
--- a/rm.h
+++ b/rm.h
/** RM Server */
Rm_instType_SERVER = 0,
/** RM Client Delegate */
- Rm_instType_CLIENT_DELEGATE,
+ Rm_instType_CLIENT_DELEGATE = 1,
/** RM Client */
- Rm_instType_CLIENT
+ Rm_instType_CLIENT = 2
} Rm_InstType;
/**
void *startupPolicy;
} Rm_InitCfg;
+/* TESTING PURPOSES: SERVER ONLY */
+void Rm_printResourceStatus(Rm_Handle *rmHandle);
+
/**
* @b Description
* @n
diff --git a/rm_services.h b/rm_services.h
index 5b2a2d9c0f048a28ce8099d048687327de8b6869..0f824598d316d679a937088fa667af32550dff56 100644 (file)
--- a/rm_services.h
+++ b/rm_services.h
/**
* @brief Maximum number of characters in the resource names
*/
-#define RM_RESOURCE_NAME_MAX_CHARS (24)
+#define RM_RESOURCE_NAME_MAX_CHARS (36)
/**
* @brief RM service types
*/
typedef enum {
- /** First service type. Used by RM for bounds checking. Should
- * not be used by component. */
- Rm_service_FIRST = 0,
/** RM resource allocate service */
Rm_service_RESOURCE_ALLOCATE = 0,
/** RM resource free service */
/** RM resource get by name service */
Rm_service_RESOURCE_GET_BY_NAME = 3,
/** RM resource name unmapping service */
- Rm_service_RESOURCE_UNMAP_NAME = 4,
- /** Last service type. Used by RM for bounds checking. Should
- * not be used by component. */
- Rm_service_LAST = 4
+ Rm_service_RESOURCE_UNMAP_NAME = 4
} Rm_ServiceType;
/**
diff --git a/src/rm.c b/src/rm.c
index 15f3d6dc533f4732ca6ef2a365e0d25f24c19426..d3ab4932ba66e2c1677bf1b3d2d905dae3133c12 100644 (file)
--- a/src/rm.c
+++ b/src/rm.c
newTransaction = Rm_osalMalloc(sizeof(Rm_Transaction));\r
\r
/* Return if the memory allocated for the transaction entry is NULL */\r
- if (newTransaction == NULL)\r
+ if (newTransaction != NULL)\r
{\r
/* Clear the transaction */\r
memset((void *)newTransaction, 0, sizeof(Rm_Transaction));\r
else\r
{\r
/* Delete the transaction */\r
- if ((prevTransaction == NULL) && transaction->nextTransaction)\r
+ if (prevTransaction == NULL)\r
{\r
/* Transaction to be deleted exists at start of transaction queue. Map second\r
* transaction to be start of transaction queue as long as there are more than\r
else\r
{\r
/* Delete the allocator */\r
- if ((prevAllocator == NULL) && allocator->nextAllocator)\r
+ if (prevAllocator == NULL)\r
{\r
/* Allocator to be deleted exists at start of allocator list. Map second\r
* allocator to be start of allocator list as long as there are more than\r
* - NameServer requests received on the Client Delegate are forwarded to the Server */\r
if ((rmInst->instType == Rm_instType_CLIENT) ||\r
((rmInst->instType == Rm_instType_CLIENT_DELEGATE) &&\r
- (transaction->type == Rm_service_RESOURCE_MAP_TO_NAME) ||\r
- (transaction->type == Rm_service_RESOURCE_GET_BY_NAME) ||\r
- (transaction->type == Rm_service_RESOURCE_UNMAP_NAME)))\r
- {\r
+ ((transaction->type == Rm_service_RESOURCE_MAP_TO_NAME) ||\r
+ (transaction->type == Rm_service_RESOURCE_GET_BY_NAME) ||\r
+ (transaction->type == Rm_service_RESOURCE_UNMAP_NAME))))\r
+ { \r
/* Check if the transaction is a transaction that received a response to its\r
* request. */\r
if (transaction->state != RM_SERVICE_PROCESSING)\r
@@ -1794,24 +1794,25 @@ int32_t Rm_createAndInitAllocator(Rm_Inst *rmInst, const char *resourceName,
Rm_ResourceInfo resourceInfo;\r
int32_t retVal = RM_DTB_UTIL_RESULT_OKAY;\r
\r
- /* TODO: NEED CHECKS FOR VALIDITY OF ALL THE resourceProperties FIELDS */\r
-\r
- /* Extract the resource properties from the DTB */\r
- range = rangeBasePtr = Rm_resourceExtractRange(resourceProperties->rangeData, \r
- resourceProperties->rangeLen);\r
+ if (resourceProperties->rangeData && (resourceProperties->rangeLen > 0))\r
+ {\r
+ /* Extract the resource properties from the DTB */\r
+ range = rangeBasePtr = Rm_resourceExtractRange(resourceProperties->rangeData, \r
+ resourceProperties->rangeLen);\r
\r
- /* Create a tree allocator using the resource properties */\r
- retVal = Rm_createTreeAllocator(rmInst, resourceName, range); \r
+ /* Create a tree allocator using the resource properties */\r
+ retVal = Rm_createTreeAllocator(rmInst, resourceName, range); \r
\r
- if (retVal >= RM_DTB_UTIL_RESULT_OKAY)\r
- {\r
- if (resourceProperties->linuxAliasData && resourceProperties->linuxAliasLen)\r
+ if (retVal >= RM_DTB_UTIL_RESULT_OKAY)\r
{\r
- /* Reserve the resources taken by the Linux kernel specified in the Linux DTB */\r
- linuxAlias = Rm_resourceExtractLinuxAlias(resourceProperties->linuxAliasData,\r
- resourceProperties->linuxAliasLen);\r
+ if (resourceProperties->linuxAliasData && resourceProperties->linuxAliasLen)\r
+ {\r
+ /* Reserve the resources taken by the Linux kernel specified in the Linux DTB */\r
+ linuxAlias = Rm_resourceExtractLinuxAlias(resourceProperties->linuxAliasData,\r
+ resourceProperties->linuxAliasLen);\r
\r
- retVal = Rm_findAndReserveLinuxResource(rmInst, resourceName, linuxDtb, linuxAlias); \r
+ retVal = Rm_findAndReserveLinuxResource(rmInst, resourceName, linuxDtb, linuxAlias); \r
+ }\r
}\r
}\r
\r
@@ -2005,9 +2006,15 @@ int32_t Rm_initializeAllocators(Rm_Inst *rmInst, void *globalResourceDtb, void *
\r
return(result);\r
}\r
+ \r
+/**********************************************************************\r
+ ********************** Application visible APIs **********************\r
+ **********************************************************************/\r
\r
-void Rm_printResourceStatus(Rm_Inst *rmInst)\r
+/* Server Only */\r
+void Rm_printResourceStatus(Rm_Handle *rmHandle)\r
{\r
+ Rm_Inst *rmInst = (Rm_Inst *) rmHandle;\r
Rm_Allocator *allocator = rmInst->allocators;\r
Rm_ResourceTree *treeRoot;\r
Rm_ResourceTreeNode *treeNode;\r
\r
allocator = allocator->nextAllocator;\r
}\r
+\r
+ Rm_nsPrintObjects(rmInst);\r
}\r
- \r
-/**********************************************************************\r
- ********************** Application visible APIs **********************\r
- **********************************************************************/\r
\r
Rm_Handle Rm_init(Rm_InitCfg *initCfg)\r
{\r
/* RM Server specific actions */\r
if (rmInst->instType == Rm_instType_SERVER)\r
{\r
+ /* Initialize the NameServer */\r
+ Rm_nsInit(rmInst);\r
+ \r
/* Open the ResourceList file and provide it to the resource initializer. The Linux\r
* DTB will be parsed simultaneously for resource's consumed by the kernel. The resources\r
* used by the kernel will be marked as used in the resource allocators. */\r
}\r
\r
Rm_initializeAllocators(rmInst, globalResourceDtb, linuxResourceDtb);\r
-\r
- Rm_printResourceStatus(rmInst);\r
}\r
-\r
- /* Initialize the NameServer */\r
- Rm_nsInit(rmInst);\r
}\r
\r
/* Instance startup policies are only used for Servers and Client Delegates */\r
diff --git a/src/rm_nameserver.c b/src/rm_nameserver.c
index 9d1f2b54d9be30e53bbba6a4f939408eed427f1c..84bb331a477d676c3db883d4cb28bce692560949 100644 (file)
--- a/src/rm_nameserver.c
+++ b/src/rm_nameserver.c
return(RM_NS_ACTION_APPROVED);
}
+void Rm_nsPrintObjects(Rm_Inst *rmInst)
+{
+ Rm_NameServerNode *node;
+
+ RB_FOREACH(node, _Rm_NameServerTree, rmInst->nameServer)
+ {
+ Rm_osalLog("Name: %s base: %d length: %d\n", node->name, node->base, node->length);
+ }
+}
+
int32_t Rm_nsFindObject(Rm_Inst *rmInst, Rm_ResourceInfo *resourceInfo)
{
Rm_NameServerNode findNode;
diff --git a/src/rm_services.c b/src/rm_services.c
index bbecd4dfc0c556087f2c2ad0f9c92e80131ca9cb..a85ab9b8a23a001466195ee9093078553f95b116 100644 (file)
--- a/src/rm_services.c
+++ b/src/rm_services.c
Rm_Inst *rmInst = (Rm_Inst *)rmHandle;
Rm_Transaction *transaction;
- /* Make sure serviceType is valid and that a callback function has been provided */
- if ((serviceRequest->type < Rm_service_FIRST) ||
- (serviceRequest->type > Rm_service_LAST))
- {
- serviceResponse->serviceState = RM_SERVICE_ERROR_INVALID_SERVICE_TYPE;
- return;
- }
- else if (serviceRequest->callback.serviceCallback == NULL)
+ /* Make sure that a callback function has been provided */
+ if (serviceRequest->callback.serviceCallback == NULL)
{
/* The RM Client and Client Delegate use blocking transports to consult with a
* high-level RM agent prior to providing a response to the component. It is
/* Delete the transaction since a response was received immediately */
Rm_transactionQueueDelete(rmInst, transaction->localId);
}
- else if ((serviceResponse->serviceState >= RM_SERVICE_DENIED_BEGIN) &&
- (serviceResponse->serviceState <= RM_SERVICE_DENIED_END))
+ else
{
/* The serviceState field will contain information regarding why the
- * service was denied. Just delete the transaction since a response was
- * received immediately */
+ * service was denied or what error the service encountered. Just delete
+ * the transaction since a response was received immediately */
Rm_transactionQueueDelete(rmInst, transaction->localId);
}
}
diff --git a/src/rm_transport.c b/src/rm_transport.c
index fca00691db4a5e418520b04f7c391ce8bfe6cefc..3ebd5a5511814871127e848cd164924de34dac4f 100644 (file)
--- a/src/rm_transport.c
+++ b/src/rm_transport.c
@@ -206,7 +206,7 @@ Rm_TransportResult Rm_transportNodeDelete(Rm_Inst *rmInst, Rm_TransportHandle tr
else\r
{\r
/* Delete the transport node */\r
- if ((prevNode == NULL) && transportNode->nextNode)\r
+ if (prevNode == NULL)\r
{\r
/* Node to be deleted exists at start of route map. Map second\r
* node to be start of route map as long as there are more than\r
int32_t retVal = RM_TRANSPORT_OK_BASE;\r
\r
/* Make sure the transport handle is registered with the provided RM instance */\r
- if (Rm_transportNodeFindTransportHandle(rmInst, transportHandle) == NULL)\r
+ if (Rm_transportNodeFindTransportHandle(rmInst, transportHandle) != NULL)\r
{\r
- /* Transport is not registered with the RM instance. Return an error.\r
- * The packet cannot be freed since the transport handle is not valid. */\r
- return (RM_TRANSPORT_ERROR_HANDLE_HAS_NOT_BEEN_REGISTERED);\r
- }\r
-\r
- /* Check to see if any RM packets are available. Process any available packets. */\r
- while (rmInst->transport.rmNumPktsReceived(transportHandle) > 0)\r
- {\r
- pkt = rmInst->transport.rmReceive(transportHandle);\r
-\r
- if (pkt == NULL)\r
+ /* Check to see if any RM packets are available. Process any available packets. */\r
+ while (rmInst->transport.rmNumPktsReceived(transportHandle) > 0)\r
{\r
- return (RM_TRANSPORT_ERROR_PACKET_RECEPTION_ERROR);\r
- }\r
+ pkt = rmInst->transport.rmReceive(transportHandle);\r
\r
- /* Pass the packet to RM. The packet will be freed within the PktIsr API */\r
- if (retVal = Rm_receivePktIsr(transportHandle, pkt) <= RM_SERVICE_ERROR_BASE)\r
- {\r
- /* Return if an error is encountered */\r
- return (retVal);\r
+ if (pkt == NULL)\r
+ {\r
+ retVal = RM_TRANSPORT_ERROR_PACKET_RECEPTION_ERROR;\r
+ break;\r
+ }\r
+\r
+ /* Pass the packet to RM. The packet will be freed within the PktIsr API */\r
+ if (retVal = Rm_receivePktIsr(transportHandle, pkt) <= RM_SERVICE_ERROR_BASE)\r
+ {\r
+ /* Return if an error is encountered */\r
+ break;\r
+ }\r
}\r
}\r
+ else\r
+ {\r
+ /* Transport is not registered with the RM instance. Return an error.\r
+ * The packet cannot be freed since the transport handle is not valid. */\r
+ retVal = RM_TRANSPORT_ERROR_HANDLE_HAS_NOT_BEEN_REGISTERED;\r
+ }\r
+\r
return (retVal); \r
}\r
\r
diff --git a/test/rm_test.c b/test/rm_test.c
index 9cc693696f0811d6daa0dbe134ae8555d3c88595..916408433543ee848c07e36edb8f14ec5e8398a2 100644 (file)
--- a/test/rm_test.c
+++ b/test/rm_test.c
/* ======== Task Handles ======== */
Task_Handle startupRmTskHandle;
+Task_Handle testReceiveTskHandle;
+Task_Handle testRmTskHandle;
/* ======== Application Heaps ======== */
#define RM_PKT_HEAP_NAME "rmHeapBuf"
* One map entry for the Client */
Transport_MapEntry rmTransportMap[MAX_MAPPING_ENTRIES];
+uint32_t waitForBlockingOperation = 0;
+Rm_ServiceRespInfo responseInfo;
+
+/* ======== RM Application Sync APIs ======== */
+
+typedef struct {
+ uint32_t sem;
+ uint32_t pad[31];
+} syncObj;
+
+#pragma DATA_SECTION (testSyncObj, ".syncObj");
+#pragma DATA_ALIGN (testSyncObj, 16)
+syncObj testSyncObj;
+
+void initSyncObj(void)
+{
+ Rm_osalBeginMemAccess((void *) &testSyncObj, sizeof(syncObj));
+ testSyncObj.sem = 0;
+ Rm_osalEndMemAccess((void *) &testSyncObj, sizeof(syncObj));
+}
+
+void takeSyncObj(void)
+{
+ Rm_osalBeginMemAccess((void *) &testSyncObj, sizeof(syncObj));
+ testSyncObj.sem = 1;
+ Rm_osalEndMemAccess((void *) &testSyncObj, sizeof(syncObj));
+}
+
+void waitOnSyncObj(void)
+{
+ do
+ {
+ /* Yield for other tasks */
+ Task_yield();
+ Rm_osalBeginMemAccess((void *) &testSyncObj, sizeof(syncObj));
+ } while (testSyncObj.sem == 1);
+}
+
+void releaseSyncObj(void)
+{
+ Rm_osalBeginMemAccess((void *) &testSyncObj, sizeof(syncObj));
+ testSyncObj.sem = 0;
+ Rm_osalEndMemAccess((void *) &testSyncObj, sizeof(syncObj));
+}
+
/* ======== RM Application Transport APIs ======== */
Rm_Packet *TransportAlloc (Rm_TransportHandle transportHandle, uint32_t pktSize)
@@ -136,7 +183,7 @@ Rm_Packet *TransportAlloc (Rm_TransportHandle transportHandle, uint32_t pktSize)
/* All transports will allocate from the same heap */
- HeapBufMP_alloc(rmPktHeapHandle, pktSize, 0);
+ pkt = HeapBufMP_alloc(rmPktHeapHandle, pktSize, 0);
if (pkt != NULL)
{
}
/* Attach the RM packet to the MessageQ message */
+ Rm_osalEndMemAccess((void *) pkt, pkt->pktLenBytes);
rmMsg->rmPkt = pkt;
/* Send the message to the remote side */
status = MessageQ_put(remoteQueueId, (MessageQ_Msg)rmMsg);
return (status);
}
-void * TransportReceive (Rm_TransportHandle transportHandle)
+void *TransportReceive (Rm_TransportHandle transportHandle)
{
MessageQ_Handle receiveQ;
MessageQ_Msg rmMsg = NULL;
/* Extract the Rm_Packet from the RM msg */
rmPkt = ((MsgQ_RmPacket *)rmMsg)->rmPkt;
+ Rm_osalBeginMemAccess((void *) rmPkt, rmPkt->pktLenBytes);
/* Free the messageQ message now that RM packet pointer has been extracted */
status = MessageQ_free(rmMsg);
* ======== testServiceCallback ========
* Application's callback function given to RM on service requests
*/
-Void testServiceCallback(Rm_ServiceRespInfo *serviceResponse)
+void testServiceCallback(Rm_ServiceRespInfo *serviceResponse)
+{
+ if (serviceResponse->serviceId == waitForBlockingOperation)
+ {
+ waitForBlockingOperation = 0;
+ responseInfo.resourceBase = serviceResponse->resourceBase;
+ responseInfo.resourceLength = serviceResponse->resourceLength;
+ responseInfo.serviceState = serviceResponse->serviceState;
+ }
+}
+
+bool blockForResponse(Rm_ServiceRespInfo *respInfo)
+{
+ waitForBlockingOperation = respInfo->serviceId;
+ /* Block and wait for the response if the RM needed to perform a blocking operation
+ * to complete the request */
+ while(waitForBlockingOperation)
+ {
+ /* Yield to receive task to see if there are any packets for RM instance */
+ Task_yield();
+ }
+
+ if ((respInfo->serviceState != RM_SERVICE_PROCESSING) &&
+ (respInfo->serviceState != RM_SERVICE_APPROVED_AND_COMPLETED))
+ {
+ System_printf("Core %d: Service request encountered error or denial: %d\n", MultiProc_self(),
+ respInfo->serviceState);
+ return(FALSE);
+ }
+
+ return(TRUE);
+}
+
+/*
+ * ======== testRmTsk ========
+ * RM cleanup task
+ */
+void cleanupRmTsk(UArg arg0, UArg arg1)
{
+ /* Delete the RM test task */
+ System_printf("Core %d: Deleting RM test task...\n", MultiProc_self());
+ if (testRmTskHandle)
+ {
+ Task_delete(&testRmTskHandle);
+ /* Set the task handle to be NULL so that the delete only occurs once */
+ testRmTskHandle = NULL;
+ }
+ /* Delete the RM receive task */
+ System_printf("Core %d: Deleting RM receive task...\n", MultiProc_self());
+ if (testReceiveTskHandle)
+ {
+ Task_delete(&testReceiveTskHandle);
+ /* Set the task handle to be NULL so that the delete only occurs once */
+ testReceiveTskHandle = NULL;
+ }
+
+
+
+ /* Cleanup all service ports, transport handles, RM instances, and IPC constructs */
+ BIOS_exit(0);
}
/*
* ======== testRmTsk ========
* RM test task
*/
-Void testRmTsk(UArg arg0, UArg arg1)
+void testReceiveTsk(UArg arg0, UArg arg1)
+{
+ int32_t retVal;
+
+ while(1)
+ {
+
+ /* Run the RM polling functions for each RM instance. */
+ if (MultiProc_self() == 0)
+ {
+ retVal = Rm_receivePktPolling(rmTransportMap[SERVER_TO_CD_MAP_ENTRY].transportHandle);
+ if (retVal != RM_TRANSPORT_SUCCESSFUL)
+ {
+ System_printf("Core %d: %s to %s transport receive error %d\n", MultiProc_self(),
+ rmServerName,
+ rmClientDelegateName,
+ retVal);
+ }
+ }
+ else if (MultiProc_self() == 1)
+ {
+ retVal = Rm_receivePktPolling(rmTransportMap[CD_TO_SERVER_MAP_ENTRY].transportHandle);
+ if (retVal != RM_TRANSPORT_SUCCESSFUL)
+ {
+ System_printf("Core %d: %s to %s transport receive error %d\n", MultiProc_self(),
+ rmClientDelegateName,
+ rmServerName,
+ retVal);
+ }
+
+ retVal = Rm_receivePktPolling(rmTransportMap[CD_TO_CLIENT_MAP_ENTRY].transportHandle);
+ if (retVal != RM_TRANSPORT_SUCCESSFUL)
+ {
+ System_printf("Core %d: %s to %s transport receive error %d\n", MultiProc_self(),
+ rmClientDelegateName,
+ rmClientName,
+ retVal);
+ }
+
+ retVal = Rm_receivePktPolling(rmTransportMap[CLIENT_TO_CD_MAP_ENTRY].transportHandle);
+ if (retVal != RM_TRANSPORT_SUCCESSFUL)
+ {
+ System_printf("Core %d: %s to %s transport receive error %d\n", MultiProc_self(),
+ rmClientName,
+ rmClientDelegateName,
+ retVal);
+ }
+ }
+
+ /* Yield for main test task */
+ Task_yield();
+ }
+}
+
+/*
+ * ======== testRmTsk ========
+ * RM test task
+ */
+void testRmTsk(UArg arg0, UArg arg1)
{
Rm_ServiceReqInfo requestInfo;
- Rm_ServiceRespInfo responseInfo;
+ Task_Params taskParams;
/* Delete the RM startup task */
System_printf("Core %d: Deleting RM startup task...\n", MultiProc_self());
memset((void *)&requestInfo, 0, sizeof(Rm_ServiceReqInfo));
memset((void *)&responseInfo, 0, sizeof(Rm_ServiceRespInfo));
+ System_printf("Core %d: Testing NameServer features...\n", MultiProc_self());
+
/* 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 */
+ char resourceName[RM_RESOURCE_NAME_MAX_CHARS] = "gp-queue";
+ char resourceNsName[RM_RESOURCE_NAME_MAX_CHARS] = "My_Favorite_Queue";
+
+ /* Issue the service request create a new NameServer object via the service port */
requestInfo.type = Rm_service_RESOURCE_MAP_TO_NAME;
- requestInfo.resourceName = &resourceName[0];
- requestInfo.resourceBase = 1;
- requestInfo.resourceLength = 2;
- requestInfo.resourceNsName = &resourceNsName[0];
+ requestInfo.resourceName = resourceName;
+ requestInfo.resourceBase = 1002;
+ requestInfo.resourceLength = 1;
+ requestInfo.resourceNsName = resourceNsName;
requestInfo.callback.serviceCallback = testServiceCallback;
- /* Issue the service request via the service port */
+ System_printf("Core %d: %s creating NameServer object...\n", MultiProc_self(), rmServerName);
rmServerServicePort->rmService(rmServerServicePort->rmHandle, &requestInfo, &responseInfo);
+ if (blockForResponse(&responseInfo))
+ {
+ System_printf("Core %d: %s created Name: %s base: %d length: %d\n", MultiProc_self(),
+ rmServerName,
+ resourceNsName,
+ requestInfo.resourceBase,
+ requestInfo.resourceLength);
+ }
+
+ /* Wait for Client Delegate and Client to retrieve resource via the name and allocate it */
+ waitOnSyncObj();
+
+ Rm_printResourceStatus(rmServerHandle);
+
}
else if (MultiProc_self() == 1)
- {
- char resourceName[RM_RESOURCE_NAME_MAX_CHARS] = "timer";
- char resourceNsName[RM_RESOURCE_NAME_MAX_CHARS] = "dsp_timer";
-
- /* TEMP: Try mapping a resource in Name Server from Client to test transports */
- requestInfo.type = Rm_service_RESOURCE_MAP_TO_NAME;
- requestInfo.resourceName = &resourceName[0];
- requestInfo.resourceBase = 2;
- requestInfo.resourceLength = 3;
+ {
+ char resourceName[RM_RESOURCE_NAME_MAX_CHARS] = "gp-queue";
+ char resourceNsName[RM_RESOURCE_NAME_MAX_CHARS] = "My_Favorite_Queue";
+
+ /* Take the sync obj preparing for NameServer testing */
+ takeSyncObj();
+
+ /* Issue the service request for the resources tied to the name via the service port */
+ requestInfo.type = Rm_service_RESOURCE_GET_BY_NAME;
requestInfo.resourceNsName = &resourceNsName[0];
requestInfo.callback.serviceCallback = testServiceCallback;
- /* Issue the service request via the service port */
+ System_printf("Core %d: %s getting NameServer object...\n", MultiProc_self(), rmClientDelegateName);
+ rmClientDelegateServicePort->rmService(rmClientDelegateServicePort->rmHandle, &requestInfo, &responseInfo);
+ if (blockForResponse(&responseInfo))
+ {
+ System_printf("Core %d: %s got Name: %s base: %d length: %d\n", MultiProc_self(),
+ rmClientDelegateName,
+ resourceNsName,
+ responseInfo.resourceBase,
+ responseInfo.resourceLength);
+ }
+
+ /* Allocate the resources via the service port from the Client */
+ requestInfo.type = Rm_service_RESOURCE_ALLOCATE;
+ requestInfo.resourceName = resourceName;
+ requestInfo.resourceBase = responseInfo.resourceBase;
+ requestInfo.resourceLength = responseInfo.resourceLength;
+ requestInfo.resourceNsName = NULL;
+ requestInfo.callback.serviceCallback = testServiceCallback;
+
+ System_printf("Core %d: %s allocating resources...\n", MultiProc_self(), rmClientName);
rmClientServicePort->rmService(rmClientServicePort->rmHandle, &requestInfo, &responseInfo);
+ if (blockForResponse(&responseInfo))
+ {
+ System_printf("Core %d: %s allocated resources: %s base: %d length: %d\n", MultiProc_self(),
+ rmClientName,
+ resourceNsName,
+ responseInfo.resourceBase,
+ responseInfo.resourceLength);
+ }
+
+ /* Release the syncObj so Server can move forward with NameServer object testing */
+ releaseSyncObj();
}
- System_printf("The test is complete\n");
- BIOS_exit(0);
+ System_printf("Core %d: Testing is complete\n", MultiProc_self());
+
+ /* Create the RM cleanup task. */
+ System_printf("Core %d: Creating RM cleanup task...\n", MultiProc_self());
+ Task_Params_init (&taskParams);
+ Task_create (cleanupRmTsk, &taskParams, NULL);
}
/*
/* Register the Client Delegate with the RM Server Instance */
rmTransportCfg.remoteInstType = Rm_instType_CLIENT_DELEGATE;
rmTransportCfg.remoteInstName = &rmClientDelegateName[0];
+ /* Set the callouts as valid for the first transport configuration on Server instance */
rmTransportCfg.transportCalloutsValid = true;
rmTransportCfg.transportCallouts.rmAllocPkt = TransportAlloc;
rmTransportCfg.transportCallouts.rmFreePkt = TransportFree;
/* Register the Server with the RM Client Delegate Instance */
rmTransportCfg.remoteInstType = Rm_instType_SERVER;
rmTransportCfg.remoteInstName = &rmServerName[0];
- /* Set the callouts as valid for the first transport configuration on this core */
+ /* Set the callouts as valid for the first transport configuration on Client Delegate instance */
rmTransportCfg.transportCalloutsValid = true;
rmTransportCfg.transportCallouts.rmAllocPkt = TransportAlloc;
rmTransportCfg.transportCallouts.rmFreePkt = TransportFree;
/* Register the Client with the RM Client Delegate Instance */
rmTransportCfg.remoteInstType = Rm_instType_CLIENT;
rmTransportCfg.remoteInstName = &rmClientName[0];
- /* Callouts already set so set them as invalid */
+ /* Callouts already set on the Client Delegate so set them as invalid */
rmTransportCfg.transportCalloutsValid = false;
cdClientHandle = Rm_transportRegister(rmClientDelegateHandle, &rmTransportCfg);
rmTransportMap[CD_TO_CLIENT_MAP_ENTRY].receiveMsgQ = cdClientMsgQ;
rmTransportMap[CD_TO_CLIENT_MAP_ENTRY].remoteMsgQId = cdClientQId;
System_printf("Core %d: Registered RM CD <=> RM Client transport with RM CD instance\n", MultiProc_self());
-
+
/* Open the Client Delegate messageQ from the Client */
do
{
/* Register the Client Delegate with the RM Client Instance */
rmTransportCfg.remoteInstType = Rm_instType_CLIENT_DELEGATE;
rmTransportCfg.remoteInstName = &rmClientDelegateName[0];
- /* Callouts already set so set them as invalid */
- rmTransportCfg.transportCalloutsValid = false;
+ /* Set the callouts as valid for the first transport configuration on Client instance */
+ rmTransportCfg.transportCalloutsValid = true;
+ rmTransportCfg.transportCallouts.rmAllocPkt = TransportAlloc;
+ rmTransportCfg.transportCallouts.rmFreePkt = TransportFree;
+ rmTransportCfg.transportCallouts.rmSend = TransportSend;
+ rmTransportCfg.transportCallouts.rmReceive = TransportReceive;
+ rmTransportCfg.transportCallouts.rmNumPktsReceived = TransportNumPktsReceived;
clientCdHandle = Rm_transportRegister(rmClientHandle, &rmTransportCfg);
rmTransportMap[CLIENT_TO_CD_MAP_ENTRY].remoteMsgQId = clientCdQId;
System_printf("Core %d: Registered RM Client <=> RM CD transport with RM Client instance\n", MultiProc_self());
}
+
+ /* Creat the RM receive task. */
+ System_printf("Core %d: Creating RM receive task...\n", MultiProc_self());
+ Task_Params_init (&taskParams);
+ testReceiveTskHandle = Task_create (testReceiveTsk, &taskParams, NULL);
+
/* Create the RM test task. */
System_printf("Core %d: Creating RM test task...\n", MultiProc_self());
Task_Params_init (&taskParams);
- Task_create (testRmTsk, &taskParams, NULL);
+ testRmTskHandle = Task_create (testRmTsk, &taskParams, NULL);
}
/*
*/
if (MultiProc_self()== 0)
{
+ initSyncObj();
+
/* Open the Global Resource and Policy DTB files */
globalResourceFp = fopen("C:\\ti\\pdk_tci6614_1_0_0_11\\packages\\ti\\drv\\rm\\device\\tci6614-global-resources.dtb", "rb");
linuxDtbFp = fopen("C:\\ti\\pdk_tci6614_1_0_0_11\\packages\\ti\\drv\\rm\\device\\tci6614-linux-evm.dtb", "rb");
/* Get the RM Server handle */
rmServerHandle = Rm_init(&rmInitCfg);
System_printf("Core %d: RM Server instance created\n", MultiProc_self());
+
+ // Rm_printResourceStatus(rmServerHandle);
}
else if (MultiProc_self()== 1)
{
diff --git a/test/rm_test.cfg b/test/rm_test.cfg
index d78ad4883ed1b9cff2472f2810761e25b49823eb..7dab9cc419091bd095808a390b2a8019fddc23a3 100644 (file)
--- a/test/rm_test.cfg
+++ b/test/rm_test.cfg
BIOS.heapSize = 0x10000;
var Task = xdc.useModule('ti.sysbios.knl.Task');
+Program.sectMap[".syncObj"] = new Program.SectionSpec();
+Program.sectMap[".syncObj"] = "MSMCSRAM";
+
/* Synchronize all processors (this will be done in Ipc_start) */
Ipc.procSync = Ipc.ProcSync_ALL;
/* Shared Memory base address and length */
var SHAREDMEM = 0x0C000000;
-var SHAREDMEMSIZE = 0x00200000;
+var SHAREDMEMSIZE = 0x00100000;
/*
* Need to define the shared region. The IPC modules use this