summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c2d3b5a)
raw | patch | inline | side by side (parent: c2d3b5a)
author | Justin Sobota <jsobota@ti.com> | |
Wed, 27 Mar 2013 22:05:53 +0000 (18:05 -0400) | ||
committer | Justin Sobota <jsobota@ti.com> | |
Wed, 27 Mar 2013 22:05:53 +0000 (18:05 -0400) |
src/rm_policy.c | patch | blob | history | |
test/rm_mem_test.c | patch | blob | history |
diff --git a/src/rm_policy.c b/src/rm_policy.c
index 11c10f0ab8a1f3f39439091c99773581e573db35..97fbd285aa8d85fe802d04d349a8f473cae29277 100644 (file)
--- a/src/rm_policy.c
+++ b/src/rm_policy.c
@@ -163,9 +163,8 @@ static Rm_PolicyPermission *policyParseSubPermission(char *permStrStart, char *p
* c) Subgroup start and end are out of order
* d) There is more than one instance subgroup specified in the string. There
* should only be one subgroup per sub-permission string */
- Rm_osalFree((void *)permStrStart, permStrLen);
*result = RM_ERROR_PERM_STR_TOO_MANY_INST_GROUPS;
- return(NULL);
+ goto parseError;
}
/* Create a permission entry for each instance specified in the instance group.
@@ -216,14 +215,8 @@ static Rm_PolicyPermission *policyParseSubPermission(char *permStrStart, char *p
}
else if (instNameIndex == RM_NAME_MAX_CHARS) {
/* Instance name is longer than max length */
- while (startPerm) {
- nextPerm = startPerm->nextPermission;
- Rm_osalFree((void *)startPerm, sizeof(Rm_PolicyPermission));
- startPerm = nextPerm;
- }
- Rm_osalFree((void *)permStrStart, sizeof(permStrLen));
*result = RM_ERROR_INST_NAME_IN_ASSIGNMENT_TOO_LONG;
- return(NULL);
+ goto parseError;
}
permStrPtr++;
@@ -241,14 +234,8 @@ static Rm_PolicyPermission *policyParseSubPermission(char *permStrStart, char *p
/* Assignment character has been found more than once. This is a
* syntax error. Free the permission list and the temporary string
* and return. */
- while (startPerm) {
- nextPerm = startPerm->nextPermission;
- Rm_osalFree((void *)startPerm, sizeof(Rm_PolicyPermission));
- startPerm = nextPerm;
- }
- Rm_osalFree((void *)permStrStart, sizeof(permStrLen));
*result = RM_ERROR_PERM_STR_TOO_MANY_ASSIGN_CHARS;
- return(NULL);
+ goto parseError;
}
else {
assignmentLeft = RM_TRUE;
@@ -292,28 +279,16 @@ static Rm_PolicyPermission *policyParseSubPermission(char *permStrStart, char *p
/* Invalid permission character. This is a
* syntax error. Free the permission list and the temporary string
* and return. */
- while (startPerm) {
- nextPerm = startPerm->nextPermission;
- Rm_osalFree((void *)startPerm, sizeof(Rm_PolicyPermission));
- startPerm = nextPerm;
- }
- Rm_osalFree((void *)permStrStart, sizeof(permStrLen));
*result = RM_ERROR_PERM_STR_INVALID_CHAR;
- return(NULL);
+ goto parseError;
}
}
else {
/* Character found without the assignment character being found. This is a
* syntax error. Free the permission list and the temporary string
* and return. */
- while (startPerm) {
- nextPerm = startPerm->nextPermission;
- Rm_osalFree((void *)startPerm, sizeof(Rm_PolicyPermission));
- startPerm = nextPerm;
- }
- Rm_osalFree((void *)permStrStart, sizeof(permStrLen));
*result = RM_ERROR_PERM_CHAR_WITHOUT_ASSIGN_CHAR;
- return(NULL);
+ goto parseError;
}
}
permStrPtr--;
@@ -325,14 +300,8 @@ static Rm_PolicyPermission *policyParseSubPermission(char *permStrStart, char *p
while (permStrPtr < permStrEnd) {
if (assignmentLeft && (!isspace(*permStrPtr))) {
/* There should be nothing but spaces on right if assignment was already found on left */
- while (startPerm) {
- nextPerm = startPerm->nextPermission;
- Rm_osalFree((void *)startPerm, sizeof(Rm_PolicyPermission));
- startPerm = nextPerm;
- }
- Rm_osalFree((void *)permStrStart, sizeof(permStrLen));
*result = RM_ERROR_INVALID_PERMS_CHAR_ON_RIGHT;
- return(NULL);
+ goto parseError;
}
if (*permStrPtr == RM_POLICY_PERM_ASSIGNMENT) {
@@ -340,14 +309,8 @@ static Rm_PolicyPermission *policyParseSubPermission(char *permStrStart, char *p
/* Assignment character has been found more than once. This is a
* syntax error. Free the permission list and the temporary string
* and return. */
- while (startPerm) {
- nextPerm = startPerm->nextPermission;
- Rm_osalFree((void *)startPerm, sizeof(Rm_PolicyPermission));
- startPerm = nextPerm;
- }
- Rm_osalFree((void *)permStrStart, sizeof(permStrLen));
*result = RM_ERROR_PERM_STR_TOO_MANY_ASSIGN_CHARS;
- return(NULL);
+ goto parseError;
}
else {
assignmentRight = RM_TRUE;
@@ -391,35 +354,33 @@ static Rm_PolicyPermission *policyParseSubPermission(char *permStrStart, char *p
/* Invalid permission character. This is a
* syntax error. Free the permission list and the temporary string
* and return. */
- while (startPerm) {
- nextPerm = startPerm->nextPermission;
- Rm_osalFree((void *)startPerm, sizeof(Rm_PolicyPermission));
- startPerm = nextPerm;
- }
- Rm_osalFree((void *)permStrStart, sizeof(permStrLen));
*result = RM_ERROR_PERM_STR_INVALID_CHAR;
- return(NULL);
+ goto parseError;
}
}
else {
/* Character found without the assignment character being found. This is a
* syntax error. Free the permission list and the temporary string
* and return. */
- while (startPerm) {
- nextPerm = startPerm->nextPermission;
- Rm_osalFree((void *)startPerm, sizeof(Rm_PolicyPermission));
- startPerm = nextPerm;
- }
- Rm_osalFree((void *)permStrStart, sizeof(permStrLen));
*result = RM_ERROR_PERM_STR_TOO_MANY_ASSIGN_CHARS;
- return(NULL);
+ goto parseError;
}
}
permStrPtr++;
}
Rm_osalFree((void *)permStrStart, sizeof(permStrLen));
+ *result = RM_OK;
return (startPerm);
+
+parseError:
+ while (startPerm) {
+ nextPerm = startPerm->nextPermission;
+ Rm_osalFree((void *)startPerm, sizeof(Rm_PolicyPermission));
+ startPerm = nextPerm;
+ }
+ Rm_osalFree((void *)permStrStart, sizeof(permStrLen));
+ return(NULL);
}
/* FUNCTION PURPOSE: Frees a linked list of assignment permissions
@@ -468,7 +429,7 @@ static Rm_PolicyPermission *policyGetAssignmentPermissions(Rm_PolicyAssignment *
newPerm = policyParseSubPermission(permStrStart, permStrEnd, result);
- if (*result != RM_SERVICE_PROCESSING) {
+ if (*result != RM_OK) {
/* Delete the permission list that's been created thus far, return
* the error and NULL for the permission list */
policyFreeAssignmentPermissions(startPerm);
@@ -931,6 +892,7 @@ Rm_PolicyValidInstTree *rmPolicyCreateValidInstTree(Rm_Handle rmHandle, int addL
int32_t validInstLen;
const void *validInstData = NULL;
Rm_PolicyPropType propertyType;
+ Rm_PolicyValidInst *vInstListStart = NULL;
Rm_PolicyValidInst *validInstList = NULL;
Rm_PolicyValidInstTree *rootEntry = NULL;
Rm_PolicyValidInstNode *newNode = NULL;
@@ -962,12 +924,14 @@ Rm_PolicyValidInstTree *rmPolicyCreateValidInstTree(Rm_Handle rmHandle, int addL
rootEntry = Rm_osalMalloc(sizeof(Rm_PolicyValidInstTree));
RB_INIT(rootEntry);
+ vInstListStart = validInstList;
while (validInstList) {
newNode = rmPolicyValidInstNodeNew(validInstList->instName);
RB_INSERT(_Rm_PolicyValidInstTree, rootEntry, newNode);
validInstList = validInstList->nextValidInst;
}
+ rmDtbUtilPolicyFreeValidInstances(vInstListStart);
/* Add the Linux kernel node */
if (addLinux) {
diff --git a/test/rm_mem_test.c b/test/rm_mem_test.c
index 868842be735072d93314b569f98d2c79f64c01ca..bb107801f698d0a123965d17693948ff81e88d2d 100644 (file)
--- a/test/rm_mem_test.c
+++ b/test/rm_mem_test.c
/* Test TRUE */
#define RM_TEST_TRUE 1
-/* Name of GateMP used to synchronize the RM test tasks */
-#define RM_TASK_GATE_NAME "rmGateMP"
+/* GateMP names used to synchronize instance tasks */
+#define RM_SERVER_GATE_NAME "serverGate"
+#define RM_CLIENT_GATE_NAME "clientGate"
/* Size of RM service response queue */
#define MAX_QUEUED_SERVICE_RESPONSES 10
/* RM client delegate and client test task */
Task_Handle rmClientTskHandle;
-/* GateMP used to synchronize tests between the two RM test tasks */
-GateMP_Handle gateHandle = NULL;
-/* GateMP key */
-IArg gateKey;
+/* GateMP handles used to synchronize instance tasks */
+GateMP_Handle serverGateHandle = NULL;
+GateMP_Handle clientGateHandle = NULL;
+/* GateMP keys */
+IArg serverKey;
+IArg clientKey;
/* RM instance variables */
Rm_Handle rmHandle = NULL;
System_abort("Test Failure\n"); \
}
-#define MEM_PRE_PRINT(title, apiOrFunc) \
- do { \
- char titleMsg[] = title; \
- char apiOrFuncMsg[] = apiOrFunc; \
- \
- sMalloc = rmMallocCounter; \
- sFree = rmFreeCounter; \
- System_printf ("---------------------------------------------------------\n"); \
- System_printf ("%s\n", titleMsg); \
- System_printf ("- API/Functionality : malloc count | free count -\n"); \
- System_printf ("- %s : %6d | %6d -\n", apiOrFuncMsg, sMalloc, sFree); \
+#define MEM_PRE_PRINT(title, apiOrFunc) \
+ do { \
+ char titleMsg[] = title; \
+ char apiOrFuncMsg[] = apiOrFunc; \
+ \
+ sMalloc = rmMallocCounter; \
+ sFree = rmFreeCounter; \
+ System_printf ("Core %d : ---------------------------------------------------------\n", \
+ coreNum); \
+ System_printf ("Core %d : %s\n", coreNum, titleMsg); \
+ System_printf ("Core %d : - API/Functionality : malloc count | free count -\n", \
+ coreNum); \
+ System_printf ("Core %d : - %s : %6d | %6d -\n", coreNum, apiOrFuncMsg, \
+ sMalloc, sFree); \
} while(0)
-#define MEM_MID_PRINT(apiOrFunc) \
- do { \
- char apiOrFuncMsg[] = apiOrFunc; \
- \
- mMalloc = rmMallocCounter; \
- mFree = rmFreeCounter; \
- System_printf ("- %s : %6d | %6d -\n", apiOrFuncMsg, mMalloc, mFree); \
+#define MEM_MID_PRINT(apiOrFunc) \
+ do { \
+ char apiOrFuncMsg[] = apiOrFunc; \
+ \
+ mMalloc = rmMallocCounter; \
+ mFree = rmFreeCounter; \
+ System_printf ("Core %d : - %s : %6d | %6d -\n", coreNum, apiOrFuncMsg, \
+ mMalloc, mFree); \
} while(0)
-#define MEM_END_PRINT(apiOrFunc) \
- do { \
- char apiOrFuncMsg[] = apiOrFunc; \
- int32_t mallocFreeBalance = (rmMallocCounter - sMalloc) - (rmFreeCounter - sFree); \
- \
- System_printf ("- %s : %6d | %6d -\n", \
- apiOrFuncMsg, rmMallocCounter, rmFreeCounter); \
- if (mallocFreeBalance > 0) { \
- System_printf ("- FAILED - %6d unfreed mallocs -\n", \
- mallocFreeBalance); \
- } \
- else if (mallocFreeBalance < 0) { \
- System_printf ("- FAILED - %6d more frees than mallocs -\n", \
- -mallocFreeBalance); \
- } \
- else { \
- System_printf ("- PASSED -\n"); \
- } \
- System_printf ("---------------------------------------------------------\n"); \
- System_printf ("\n"); \
+#define MEM_END_PRINT(apiOrFunc) \
+ do { \
+ char apiOrFuncMsg[] = apiOrFunc; \
+ int32_t mallocFreeBalance = (rmMallocCounter - sMalloc) - (rmFreeCounter - sFree); \
+ \
+ System_printf ("Core %d : - %s : %6d | %6d -\n", coreNum, \
+ apiOrFuncMsg, rmMallocCounter, rmFreeCounter); \
+ if (mallocFreeBalance > 0) { \
+ System_printf ("Core %d : - FAILED - %6d unfreed mallocs -\n", \
+ coreNum, mallocFreeBalance); \
+ } \
+ else if (mallocFreeBalance < 0) { \
+ System_printf ("Core %d : - FAILED - %6d more frees than mallocs -\n", \
+ coreNum, -mallocFreeBalance); \
+ } \
+ else { \
+ System_printf ("Core %d : - PASSED -\n", \
+ coreNum); \
+ } \
+ System_printf ("Core %d : ---------------------------------------------------------\n", \
+ coreNum); \
+ System_printf ("\n"); \
} while(0)
/**********************************************************************
@@ -259,6 +268,7 @@ void setRmRequest(Rm_ServiceReqInfo *reqInfo, Rm_ServiceType type, const char *r
void rmCleanupTsk(UArg arg0, UArg arg1)
{
int32_t rmResult;
+ int32_t finalMallocFree;
/* Delete the RM test tasks */
System_printf("Core %d: Deleting RM startup task...\n", coreNum);
}
}
- deleteRmTrans();
-
+ /* Cleanup RM instances and check final malloc/free numbers */
+ rmResult = deleteRmTrans();
+ ERROR_CHECK(RM_OK, rmResult, rmInstName, "Transport cleanup failed");
rmResult = Rm_delete(rmHandle, RM_TEST_TRUE);
ERROR_CHECK(RM_OK, rmResult, rmInstName, "Delete failed");
+ System_printf ("Core %d : ---------------------------------------------------------\n", coreNum);
+ System_printf ("Core %d : ------------------ Example Completion--------------------\n", coreNum); \
+ System_printf ("Core %d : - API/Functionality : malloc count | free count -\n", coreNum); \
+ System_printf ("Core %d : - Example Completion : %6d | %6d -\n", coreNum,
+ rmMallocCounter, rmFreeCounter);
+ finalMallocFree = rmMallocCounter - rmFreeCounter;
+ if (finalMallocFree > 0) {
+ System_printf ("Core %d : - FAILED - %6d unfreed mallocs -\n",
+ coreNum, finalMallocFree);
+ }
+ else if (finalMallocFree < 0) {
+ System_printf ("Core %d : - FAILED - %6d more frees than mallocs -\n",
+ coreNum, -finalMallocFree);
+ }
+ else {
+ System_printf ("Core %d : - PASSED -\n",
+ coreNum);
+ }
+ System_printf ("Core %d : ---------------------------------------------------------\n", coreNum);
+ System_printf ("\n");
+
BIOS_exit(0);
}
void rmServerTsk(UArg arg0, UArg arg1)
{
Rm_ServiceHandle *serviceHandle;
- Rm_ServiceReqInfo requestInfo;
- Rm_ServiceRespInfo responseInfo;
+ Rm_ServiceReqInfo requesto;
+ Rm_ServiceRespInfo response;
Task_Params taskParams;
int32_t rmResult;
serviceHandle = Rm_serviceOpenHandle(rmHandle, &rmResult);
ERROR_CHECK(RM_OK, rmResult, rmInstName, "Service handle open failed");
- Rm_instanceStatus(rmHandle);
-
-#if 0
- /* BEGIN testing UNSPECIFIED base and alignment requests on Server */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ,
- RM_RESOURCE_BASE_UNSPECIFIED, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s use allocation of %s UNSPECIFIED base %d length %d alignment : ", coreNum,
- rmInstName,
- resourceNameGpQ,
- requestInfo.resourceLength,
- requestInfo.resourceAlignment);
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ,
- RM_RESOURCE_BASE_UNSPECIFIED, 1, RM_RESOURCE_ALIGNMENT_UNSPECIFIED, NULL, RM_TEST_TRUE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s use allocation of %s UNSPECIFIED base %d length UNSPECIFIED alignment : ", coreNum,
- rmInstName,
- resourceNameGpQ,
- requestInfo.resourceLength);
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ,
- RM_RESOURCE_BASE_UNSPECIFIED, 1, 200, NULL, RM_TEST_TRUE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s use allocation of %s UNSPECIFIED base %d length %d alignment : ", coreNum,
- rmInstName,
- resourceNameGpQ,
- requestInfo.resourceLength,
- requestInfo.resourceAlignment);
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
- /* END testing UNSPECIFIED base and alignment requests on Server */
-
- /* Create new NameServer object */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_MAP_TO_NAME, resourceNameGpQ,
- 1002, 1, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s create name %s tied to %s %d - %d : ", coreNum,
- rmInstName,
- nameServerNameFavQ,
- responseInfo.resourceName,
- requestInfo.resourceBase,
- (requestInfo.resourceBase + requestInfo.resourceLength - 1));
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
-
- /* Wait for CD and Client retrieve resource via name, allocate the resource, free resource via name, and
- * delete the NameServer object. */
- gateKey = GateMP_enter(gateHandle);
- GateMP_leave(gateHandle, gateKey);
-
- /* Try to allocate the memory region taken by the Linux Kernel and not specified as shared */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameMemRegion,
- 12, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s use allocation of %s %d - %d : ", coreNum,
- rmInstName,
- resourceNameMemRegion,
- requestInfo.resourceBase,
- (requestInfo.resourceBase + requestInfo.resourceLength - 1));
- if (responseInfo.serviceState != RM_SERVICE_APPROVED) {
- System_printf("PASSED : denial or error : %d\n", responseInfo.serviceState);
- }
- else {
- System_printf("FAILED : expected denial or error\n");
- }
-
- /* BEGIN testing expansion/contraction of resource nodes with the AIF RX CH resource */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAifRxCh,
- 14, 5, 0, NULL, RM_TEST_TRUE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s use allocation of %s %d - %d : ", coreNum,
- rmInstName,
- resourceNameAifRxCh,
- requestInfo.resourceBase,
- (requestInfo.resourceBase + requestInfo.resourceLength - 1));
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAifRxCh,
- 19, 31, 0, NULL, RM_TEST_TRUE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s use allocation of %s %d - %d : ", coreNum,
- rmInstName,
- resourceNameAifRxCh,
- requestInfo.resourceBase,
- (requestInfo.resourceBase + requestInfo.resourceLength - 1));
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
-
- /* Wait for Client and Client Delegate to do their allocations */
- gateKey = GateMP_enter(gateHandle);
- GateMP_leave(gateHandle, gateKey);
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifRxCh,
- 25, 3, 0, NULL, RM_TEST_TRUE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s free of %s %d - %d : ", coreNum,
- rmInstName,
- resourceNameAifRxCh,
- requestInfo.resourceBase,
- (requestInfo.resourceBase + requestInfo.resourceLength - 1));
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifRxCh,
- 34, 3, 0, NULL, RM_TEST_TRUE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s free of %s %d - %d : ", coreNum,
- rmInstName,
- resourceNameAifRxCh,
- requestInfo.resourceBase,
- (requestInfo.resourceBase + requestInfo.resourceLength - 1));
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifRxCh,
- 28, 6, 0, NULL, RM_TEST_TRUE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s free of %s %d - %d : ", coreNum,
- rmInstName,
- resourceNameAifRxCh,
- requestInfo.resourceBase,
- (requestInfo.resourceBase + requestInfo.resourceLength - 1));
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAifRxCh,
- 53, 2, 0, NULL, RM_TEST_TRUE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s use allocation of %s %d - %d : ", coreNum,
- rmInstName,
- resourceNameAifRxCh,
- requestInfo.resourceBase,
- (requestInfo.resourceBase + requestInfo.resourceLength - 1));
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
- /* END testing expansion/contraction of resource nodes with the AIF RX CH resource */
-
- /* Test exclusive rights to an allocated resource */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAifRxCh,
- 2, 2, 0, NULL, RM_TEST_TRUE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s use allocation of %s %d - %d : ", coreNum,
- rmInstName,
- resourceNameAifRxCh,
- requestInfo.resourceBase,
- (requestInfo.resourceBase + requestInfo.resourceLength - 1));
- if (responseInfo.serviceState != RM_SERVICE_APPROVED) {
- System_printf("PASSED : denial or error : %d\n", responseInfo.serviceState);
- }
- else {
- System_printf("FAILED : expected denial or error\n");
- }
-
- /* Wait for Client and Client Delegate to do their UNSPECIFIED allocates */
- gateKey = GateMP_enter(gateHandle);
- GateMP_leave(gateHandle, gateKey);
-
- /* Test allocation of a resource twice from the same instance with init and use privileges. Both
- * should be approved but the instance should only be mentioned once in the resource's owner list */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ,
- 6543, 10, 0, NULL, RM_TEST_TRUE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s init allocation of %s %d - %d : ", coreNum,
- rmInstName,
- resourceNameGpQ,
- requestInfo.resourceBase,
- (requestInfo.resourceBase + requestInfo.resourceLength - 1));
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ,
- 6543, 10, 0, NULL, RM_TEST_TRUE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s use allocation of %s %d - %d : ", coreNum,
- rmInstName,
- resourceNameGpQ,
- requestInfo.resourceBase,
- (requestInfo.resourceBase + requestInfo.resourceLength - 1));
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
-
- /* Allocate infrastructure queue taken by Linux kernel and shared with Rm_Client. Expect error or denial. */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameInfraQ,
- 805, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s init allocation of %s %d - %d : ", coreNum,
- rmInstName,
- resourceNameInfraQ,
- requestInfo.resourceBase,
- (requestInfo.resourceBase + requestInfo.resourceLength - 1));
- if (responseInfo.serviceState != RM_SERVICE_APPROVED) {
- System_printf("PASSED : denial or error : %d\n", responseInfo.serviceState);
- }
- else {
- System_printf("FAILED : expected denial or error\n");
- }
-#endif
-
- System_printf("Core %d: Testing is complete\n", coreNum);
-
- Rm_instanceStatus(rmHandle);
- Rm_resourceStatus(rmHandle, RM_TEST_TRUE);
+ MEM_PRE_PRINT("------------- Remote Alloc/Free From Client -------------", "Pre Client Alloc ");
+ /* Leave the server gate to let client task request resource */
+ GateMP_leave(serverGateHandle, serverKey);
+ /* Block until Client finishes allocating the resource */
+ clientKey = GateMP_enter(clientGateHandle);
+ MEM_MID_PRINT("Post Client Alloc Req");
+ GateMP_leave(clientGateHandle, clientKey);
+ /* Block until Client finishes freeing the resource */
+ clientKey = GateMP_enter(clientGateHandle);
+ MEM_END_PRINT("Post Client Free ");
+
+ /* Reset sync mechanism */
+ GateMP_leave(clientGateHandle, clientKey);
+ serverKey = GateMP_enter(serverGateHandle);
Rm_serviceCloseHandle(serviceHandle);
void rmClientTsk(UArg arg0, UArg arg1)
{
Rm_ServiceHandle *serviceHandle;
- Rm_ServiceReqInfo requestInfo;
- Rm_ServiceRespInfo responseInfo;
+ Rm_ServiceReqInfo request;
+ Rm_ServiceRespInfo response;
int32_t rmResult;
Task_Params taskParams;
serviceHandle = Rm_serviceOpenHandle(rmHandle, &rmResult);
ERROR_CHECK(RM_OK, rmResult, rmInstName, "Service handle open failed");
- Rm_instanceStatus(rmHandle);
+ /* Block until server is ready to receive request */
+ serverKey = GateMP_enter(serverGateHandle);
+ MEM_PRE_PRINT("------------ Client Alloc/Free (Non-Blocking) -----------", "Pre Alloc ");
+ /* Allocate a resource to add a node to a resource tree */
+ setRmRequest(&request, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ,
+ 896, 1, 0, NULL, RM_TEST_FALSE, &response);
+ serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &request, &response);
+ ERROR_CHECK(RM_SERVICE_APPROVED, response.serviceState, rmInstName, "Allocate failed");
+ MEM_MID_PRINT("Post Alloc Request ");
+ /* Let server print memory usage for alloc */
+ GateMP_leave(clientGateHandle, clientKey);
+ /* Block until Server prints malloc/free info */
+ clientKey = GateMP_enter(clientGateHandle);
+ setRmRequest(&request, Rm_service_RESOURCE_FREE, resourceNameGpQ,
+ 896, 1, 0, NULL, RM_TEST_FALSE, &response);
+ serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &request, &response);
+ ERROR_CHECK(RM_SERVICE_APPROVED, response.serviceState, rmInstName, "Free failed");
+ MEM_END_PRINT("Post Free ");
+ /* Let server print memory usage for free */
+ GateMP_leave(clientGateHandle, clientKey);
+
+ /* Reset sync mechanism */
+ GateMP_leave(serverGateHandle, serverKey);
+ clientKey = GateMP_enter(clientGateHandle);
#if 0
/* Retrieve a resource via a NameServer name */
System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
}
- /* Allocate the resource returned from the NameServer request */
- memset((void *)&requestInfo, 0, sizeof(requestInfo));
- requestInfo.type = Rm_service_RESOURCE_ALLOCATE_INIT;
- requestInfo.resourceName = responseInfo.resourceName;
- requestInfo.resourceBase = responseInfo.resourceBase;
- requestInfo.resourceLength = responseInfo.resourceLength;
- requestInfo.resourceNsName = NULL;
- requestInfo.callback.serviceCallback = serviceCallback;
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s init allocation of %s %d - %d : ", coreNum,
- rmInstName,
- responseInfo.resourceName,
- requestInfo.resourceBase,
- (requestInfo.resourceBase + requestInfo.resourceLength - 1));
- if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
- waitForResponse(&responseInfo);
- }
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
-
- /* Free resource via a NameServer name */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, NULL,
- 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s free resource with name %s : ", coreNum,
- rmInstName,
- nameServerNameFavQ);
- if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
- waitForResponse(&responseInfo);
- }
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
-
- /* Delete the NameServer name */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_UNMAP_NAME, NULL,
- 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s delete name %s : ", coreNum,
- rmInstName,
- nameServerNameFavQ);
- if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
- waitForResponse(&responseInfo);
- }
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
-
- GateMP_leave(gateHandle, gateKey);
- gateKey = GateMP_enter(gateHandle);
-
- /* BEGIN testing expansion/contraction of resource nodes with the AIF RX CH resource */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAifRxCh,
- 0, 6, 0, NULL, RM_TEST_TRUE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s use allocation of %s %d - %d : ", coreNum,
- rmInstName,
- resourceNameAifRxCh,
- requestInfo.resourceBase,
- (requestInfo.resourceBase + requestInfo.resourceLength - 1));
- if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
- waitForResponse(&responseInfo);
- }
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameAifRxCh,
- 50, 7, 0, NULL, RM_TEST_TRUE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s init allocation of %s %d - %d : ", coreNum,
- rmInstName,
- resourceNameAifRxCh,
- requestInfo.resourceBase,
- (requestInfo.resourceBase + requestInfo.resourceLength - 1));
- if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
- waitForResponse(&responseInfo);
- }
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
- /* END testing expansion/contraction of resource nodes with the AIF RX CH resource */
-
- GateMP_leave(gateHandle, gateKey);
- gateKey = GateMP_enter(gateHandle);
-
- /* BEGIN testing allocations with UNSPECIFIED base and alignment values */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh,
- RM_RESOURCE_BASE_UNSPECIFIED, 5, 4, NULL, RM_TEST_TRUE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s use allocation of %s UNSPECIFIED base %d length %d alignment : ", coreNum,
- rmInstName,
- resourceNameAccumCh,
- requestInfo.resourceLength,
- requestInfo.resourceAlignment);
- if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
- waitForResponse(&responseInfo);
- }
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh,
- RM_RESOURCE_BASE_UNSPECIFIED, 2, 1, NULL, RM_TEST_TRUE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s use allocation of %s UNSPECIFIED base %d length %d alignment : ", coreNum,
- rmInstName,
- resourceNameAccumCh,
- requestInfo.resourceLength,
- requestInfo.resourceAlignment);
- if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
- waitForResponse(&responseInfo);
- }
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh,
- RM_RESOURCE_BASE_UNSPECIFIED, 2, RM_RESOURCE_ALIGNMENT_UNSPECIFIED, NULL, RM_TEST_TRUE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s use allocation of %s UNSPECIFIED base %d length UNSPECIFIED alignment : ", coreNum,
- rmInstName,
- resourceNameAccumCh,
- requestInfo.resourceLength);
- if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
- waitForResponse(&responseInfo);
- }
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
- /* END testing allocations with UNSPECIFIED base and alignment values */
-
- /* Allocate infrastructure queue shared between Linux kernel and Client */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameInfraQ,
- 800, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s init allocation of %s %d - %d : ", coreNum,
- rmInstName,
- resourceNameInfraQ,
- requestInfo.resourceBase,
- (requestInfo.resourceBase + requestInfo.resourceLength - 1));
- if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
- waitForResponse(&responseInfo);
- }
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
-
- /* BEGIN Allocating some resources without providing a callback function. RM should block and not return until the result
- * is returned by the server. */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ,
- 7000, 1, 0, NULL, FALSE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s init allocation (without callback specified) of %s %d - %d : ", coreNum,
- rmInstName,
- resourceNameGpQ,
- requestInfo.resourceBase,
- (requestInfo.resourceBase + requestInfo.resourceLength - 1));
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ,
- 7005, 25, 0, NULL, FALSE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s use allocation (without callback specified) of %s %d - %d : ", coreNum,
- rmInstName,
- resourceNameGpQ,
- requestInfo.resourceBase,
- (requestInfo.resourceBase + requestInfo.resourceLength - 1));
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
-
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ,
- 7010, 5, 0, NULL, FALSE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s use allocation (without callback specified) of %s %d - %d : ", coreNum,
- rmInstName,
- resourceNameGpQ,
- requestInfo.resourceBase,
- (requestInfo.resourceBase + requestInfo.resourceLength - 1));
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
-
- /* Init allocation of resource already owned by Client should return approved and the resource should
- * only be shown as allocated once to the instance in the resource print out */
- setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ,
- 7011, 1, 0, NULL, FALSE, &responseInfo);
- serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &requestInfo, &responseInfo);
- System_printf("Core %d : %s use allocation (without callback specified) of %s %d - %d : ", coreNum,
- rmInstName,
- resourceNameGpQ,
- requestInfo.resourceBase,
- (requestInfo.resourceBase + requestInfo.resourceLength - 1));
- if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
- System_printf("PASSED\n");
- }
- else {
- System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
- }
- /* END Allocating some resources without providing a callback function. RM should block and not return until the result
- * is returned by the server. */
#endif
-
- GateMP_leave(gateHandle, gateKey);
-
- System_printf("Core %d: Testing is complete\n", coreNum);
-
Rm_serviceCloseHandle(serviceHandle);
- Rm_instanceStatus(rmHandle);
-
/* Create the RM cleanup task. */
System_printf("Core %d: Creating RM cleanup task...\n", coreNum);
Task_Params_init (&taskParams);
if (coreNum == SYSINIT) {
GateMP_Params_init(&gateParams);
- gateParams.name = RM_TASK_GATE_NAME;
- gateHandle = GateMP_create(&gateParams);
+ gateParams.name = RM_SERVER_GATE_NAME;
+ /* Disable local protection since only concerned with sync'ing cores */
+ gateParams.localProtect = GateMP_LocalProtect_NONE;
+ serverGateHandle = GateMP_create(&gateParams);
+
+ serverKey = GateMP_enter(serverGateHandle);
+
+ do {
+ status = GateMP_open(RM_CLIENT_GATE_NAME, &clientGateHandle);
+ /*
+ * Sleep for 1 clock tick to avoid inundating remote processor
+ * with interrupts if open failed
+ */
+ if (status < 0) {
+ Task_sleep(1);
+ }
+ } while (status < 0);
}
else {
+ GateMP_Params_init(&gateParams);
+ gateParams.name = RM_CLIENT_GATE_NAME;
+ /* Disable local protection since only concerned with sync'ing cores */
+ gateParams.localProtect = GateMP_LocalProtect_NONE;
+ clientGateHandle = GateMP_create(&gateParams);
+
+ clientKey = GateMP_enter(clientGateHandle);
+
do {
- status = GateMP_open(RM_TASK_GATE_NAME, &gateHandle);
+ status = GateMP_open(RM_SERVER_GATE_NAME, &serverGateHandle);
/*
* Sleep for 1 clock tick to avoid inundating remote processor
* with interrupts if open failed
Task_sleep(1);
}
} while (status < 0);
- /* Take the gate right away to prepare for RM testing */
- gateKey = GateMP_enter(gateHandle);
}
/* Create the RM test tasks. */
ERROR_CHECK(RM_OK, rmResult, rmInstName, "Delete failed");
MEM_END_PRINT("Post Rm_Delete ");
+ rmHandle = Rm_init(&rmInitCfg, &rmResult);
+ ERROR_CHECK(RM_OK, rmResult, rmInstName, "Initialization failed");
+ MEM_PRE_PRINT("--------------- Open/Close Service Handle ---------------", "Pre Service Hnd Open ");
+ /* Open service handle */
+ serviceHandle = Rm_serviceOpenHandle(rmHandle, &rmResult);
+ ERROR_CHECK(RM_OK, rmResult, rmInstName, "Service handle open failed");
+ MEM_MID_PRINT("Service Hnd Opened ");
+ rmResult = Rm_serviceCloseHandle(serviceHandle);
+ ERROR_CHECK(RM_OK, rmResult, rmInstName, "Service handle close failed");
+ MEM_END_PRINT("Service Hnd Closed ");
+ rmResult = Rm_delete(rmHandle, RM_TEST_TRUE);
+ ERROR_CHECK(RM_OK, rmResult, rmInstName, "Delete failed");
+
+ MEM_PRE_PRINT("-------------- Server Inst Init/Del w/ Alloc ------------", "Pre Rm_Init (Server) ");
+ rmHandle = Rm_init(&rmInitCfg, &rmResult);
+ ERROR_CHECK(RM_OK, rmResult, rmInstName, "Initialization failed");
+ /* Open service handle */
+ serviceHandle = Rm_serviceOpenHandle(rmHandle, &rmResult);
+ ERROR_CHECK(RM_OK, rmResult, rmInstName, "Service handle open failed");
+ /* Allocate a resource to add a node to a resource tree */
+ setRmRequest(&request, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ,
+ 896, 1, 0, NULL, RM_TEST_TRUE, &response);
+ serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &request, &response);
+ MEM_MID_PRINT("Post Alloc Req ");
+ /* Delete instance making sure allocation cleaned up properly from resource tree */
+ rmResult = Rm_serviceCloseHandle(serviceHandle);
+ ERROR_CHECK(RM_OK, rmResult, rmInstName, "Service handle close failed");
+ rmResult = Rm_delete(rmHandle, RM_TEST_TRUE);
+ ERROR_CHECK(RM_OK, rmResult, rmInstName, "Delete failed");
+ MEM_END_PRINT("Post Rm_Delete ");
+
+ /* Service request memory tests */
+ rmHandle = Rm_init(&rmInitCfg, &rmResult);
+ ERROR_CHECK(RM_OK, rmResult, rmInstName, "Initialization failed");
+ /* Open service handle */
+ serviceHandle = Rm_serviceOpenHandle(rmHandle, &rmResult);
+ ERROR_CHECK(RM_OK, rmResult, rmInstName, "Service handle open failed");
+
+ MEM_PRE_PRINT("-------------------- Server Alloc/Free ------------------", "Pre Alloc ");
+ /* Allocate a resource to add a node to a resource tree */
+ setRmRequest(&request, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ,
+ 896, 1, 0, NULL, RM_TEST_TRUE, &response);
+ serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &request, &response);
+ ERROR_CHECK(RM_SERVICE_APPROVED, response.serviceState, rmInstName, "Allocate failed");
+ MEM_MID_PRINT("Post Alloc Request ");
+ setRmRequest(&request, Rm_service_RESOURCE_FREE, resourceNameGpQ,
+ 896, 1, 0, NULL, RM_TEST_TRUE, &response);
+ serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &request, &response);
+ ERROR_CHECK(RM_SERVICE_APPROVED, response.serviceState, rmInstName, "Free failed");
+ MEM_END_PRINT("Post Free ");
+
+ MEM_PRE_PRINT("--------------- Server Multiple Alloc/Free --------------", "Pre Alloc ");
+ /* Perform multiple allocs to force the tree to combine nodes */
+ setRmRequest(&request, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ,
+ 900, 50, 0, NULL, RM_TEST_TRUE, &response);
+ serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &request, &response);
+ ERROR_CHECK(RM_SERVICE_APPROVED, response.serviceState, rmInstName, "Allocate failed");
+ setRmRequest(&request, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ,
+ 2000, 50, 0, NULL, RM_TEST_TRUE, &response);
+ serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &request, &response);
+ ERROR_CHECK(RM_SERVICE_APPROVED, response.serviceState, rmInstName, "Allocate failed");
+ setRmRequest(&request, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ,
+ 1000, 1000, 0, NULL, RM_TEST_TRUE, &response);
+ serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &request, &response);
+ ERROR_CHECK(RM_SERVICE_APPROVED, response.serviceState, rmInstName, "Allocate failed");
+ setRmRequest(&request, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ,
+ 950, 50, 0, NULL, RM_TEST_TRUE, &response);
+ serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &request, &response);
+ ERROR_CHECK(RM_SERVICE_APPROVED, response.serviceState, rmInstName, "Allocate failed");
+ MEM_MID_PRINT("Post Alloc Requests ");
+ setRmRequest(&request, Rm_service_RESOURCE_FREE, resourceNameGpQ,
+ 1000, 500, 0, NULL, RM_TEST_TRUE, &response);
+ serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &request, &response);
+ ERROR_CHECK(RM_SERVICE_APPROVED, response.serviceState, rmInstName, "Free failed");
+ setRmRequest(&request, Rm_service_RESOURCE_FREE, resourceNameGpQ,
+ 1500, 550, 0, NULL, RM_TEST_TRUE, &response);
+ serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &request, &response);
+ ERROR_CHECK(RM_SERVICE_APPROVED, response.serviceState, rmInstName, "Free failed");
+ setRmRequest(&request, Rm_service_RESOURCE_FREE, resourceNameGpQ,
+ 900, 100, 0, NULL, RM_TEST_TRUE, &response);
+ serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &request, &response);
+ ERROR_CHECK(RM_SERVICE_APPROVED, response.serviceState, rmInstName, "Free failed");
+ MEM_END_PRINT("Post Free ");
+
+ MEM_PRE_PRINT("-------------- Server NameServer Map/Unmap --------------", "Pre NS Map ");
+ /* Map a resource in the NameServer */
+ setRmRequest(&request, Rm_service_RESOURCE_MAP_TO_NAME, resourceNameGpQ,
+ 5000, 1, 0, nameServerNameFavQ, RM_TEST_TRUE, &response);
+ serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &request, &response);
+ ERROR_CHECK(RM_SERVICE_APPROVED, response.serviceState, rmInstName, "NameServer map failed");
+ MEM_MID_PRINT("Name Mapped to NS ");
+ setRmRequest(&request, Rm_service_RESOURCE_UNMAP_NAME, NULL,
+ 0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &response);
+ serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &request, &response);
+ ERROR_CHECK(RM_SERVICE_APPROVED, response.serviceState, rmInstName, "NameServer unmap failed");
+ MEM_END_PRINT("Name Unmapped from NS");
+
/* Signal to remote cores that Server instance has passed all initialization
* memory tests and is ready */
isRmInitialized[0] = 1;
ERROR_CHECK(RM_OK, rmResult, rmInstName, "Delete failed");
MEM_END_PRINT("Post Rm_Delete ");
- MEM_PRE_PRINT("--------- Client Inst Init/Del (Static Policy) ----------", "Pre Rm_Init (Client) ");
- memset((void *)&rmInitCfg, 0, sizeof(rmInitCfg));
- System_sprintf (rmInstName, "RM_Client%d", coreNum);
- rmInitCfg.instName = rmInstName;
- rmInitCfg.instType = Rm_instType_CLIENT;
+ MEM_PRE_PRINT("--------- Client Inst Init/Del (Static Policy) ----------", "Pre Rm_Init (Client) ");
rmInitCfg.instCfg.clientCfg.staticPolicy = (void *)rmDspPlusArmPolicy;
rmHandle = Rm_init(&rmInitCfg, &rmResult);
ERROR_CHECK(RM_OK, rmResult, rmInstName, "Initialization failed");
ERROR_CHECK(RM_OK, rmResult, rmInstName, "Delete failed");
MEM_END_PRINT("Post Rm_Delete ");
-
- /* Open CD service handle */
- // serviceHandle = Rm_serviceOpenHandle(rmHandle, &rmResult);
- // ERROR_CHECK(RM_OK, rmResult, rmInstName, "Service handle open failed");
-
- /* Static allocation tests */
- // setRmRequest(&request, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameQosCluster,
- // 0, 1, 0, NULL, RM_TEST_TRUE, &response);
- // serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &request, &response);
+ MEM_PRE_PRINT("- Client Inst Init/Del (Static Policy w/ Static Alloc) --", "Pre Rm_Init (Client) ");
+ rmHandle = Rm_init(&rmInitCfg, &rmResult);
+ ERROR_CHECK(RM_OK, rmResult, rmInstName, "Initialization failed");
+ /* Open service handle */
+ serviceHandle = Rm_serviceOpenHandle(rmHandle, &rmResult);
+ ERROR_CHECK(RM_OK, rmResult, rmInstName, "Service handle open failed");
+ /* Static allocation */
+ setRmRequest(&request, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ,
+ 897, 1, 0, NULL, RM_TEST_TRUE, &response);
+ serviceHandle->Rm_serviceHandler(serviceHandle->rmHandle, &request, &response);
+ MEM_MID_PRINT("Post Static Alloc Req");
+ /* Delete instance with deletion of pending transactions */
+ rmResult = Rm_serviceCloseHandle(serviceHandle);
+ ERROR_CHECK(RM_OK, rmResult, rmInstName, "Service handle close failed");
+ rmResult = Rm_delete(rmHandle, RM_TEST_TRUE);
+ ERROR_CHECK(RM_OK, rmResult, rmInstName, "Delete failed");
+ MEM_END_PRINT("Post Rm_Delete ");
+
+ rmHandle = Rm_init(&rmInitCfg, &rmResult);
+ ERROR_CHECK(RM_OK, rmResult, rmInstName, "Initialization failed");
do{
Osal_rmBeginMemAccess((void *)isRmInitialized, sizeof(isRmInitialized));