cf7de3a5b1db77f07aca8c9704b959908b16ab51
[keystone-rtos/rm-lld.git] / test / src / rm_test.c
1 /*
2  *   rm_test.c
3  *
4  *   Multicore Resource Manager test that uses IPC to an application
5  *   requesting RM services from a RM Server, Client Delegate, and Client.
6  *
7  *  ============================================================================
8  *
9  * Copyright (c) 2012-2013, Texas Instruments Incorporated
10  * All rights reserved.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  *
16  * *  Redistributions of source code must retain the above copyright
17  *    notice, this list of conditions and the following disclaimer.
18  *
19  * *  Redistributions in binary form must reproduce the above copyright
20  *    notice, this list of conditions and the following disclaimer in the
21  *    documentation and/or other materials provided with the distribution.
22  *
23  * *  Neither the name of Texas Instruments Incorporated nor the names of
24  *    its contributors may be used to endorse or promote products derived
25  *    from this software without specific prior written permission.
26  *
27  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
29  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
31  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
32  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
33  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
34  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
35  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
36  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
37  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38  *
39  */
40  
41 /* Standard Includes */
42 #include <string.h>
44 /* XDC Includes */
45 #include <xdc/std.h>
46 #include <xdc/runtime/System.h>
48 /* IPC Includes */
49 #include <ti/ipc/Ipc.h>
50 #include <ti/ipc/MessageQ.h>
51 #include <ti/ipc/HeapBufMP.h>
52 #include <ti/ipc/GateMP.h>
54 /* BIOS Includes */
55 #include <ti/sysbios/BIOS.h>
56 #include <ti/sysbios/knl/Task.h>
57 #include <ti/sysbios/family/c64p/Hwi.h>
59 /* CSL Includes */
60 #include <ti/csl/csl_chip.h>
61 #include <ti/csl/csl_cacheAux.h>
62 #include <ti/csl/csl_xmcAux.h>
64 /* RM Includes */
65 #include <ti/drv/rm/rm.h>
66 #include <ti/drv/rm/rm_transport.h>
67 #include <ti/drv/rm/rm_services.h>
68 #include <ti/drv/rm/rm_osal.h>
70 /**********************************************************************
71  ************************** RM Test Symbols ***************************
72  **********************************************************************/
74 #define PRINT_USED_RESOURCES         0  /* Make 1 and rebuild project to print resources allocated in example */
76 #define SYSINIT                      0
77 #define NUM_CORES                    2
79 /* Test FALSE */
80 #define RM_TEST_FALSE                0
81 /* Test TRUE */
82 #define RM_TEST_TRUE                 1
84 /* IPC MessageQ heap name */
85 #define MSGQ_HEAP_NAME               "msgQHeapBuf"
86 /* IPC MessageQ heap ID */
87 #define MSGQ_HEAP_ID                 0
89 /* RM packet heap name */
90 #define RM_PKT_HEAP_NAME             "rmHeapBuf"
91 /* GateMP names used to synchronize the RM test tasks */
92 #define RM_SERVER_GATE_NAME          "rmServerGate"
93 #define RM_CLIENT_GATE_NAME          "rmClientGate"
95 /* Application's core 0 registered RM transport indices */
96 #define SERVER_TO_CD_MAP_ENTRY       0
97 /* Application's core 1 registered RM transport indices */
98 #define CD_TO_SERVER_MAP_ENTRY       0
99 #define CD_TO_CLIENT_MAP_ENTRY       1
100 #define CLIENT_TO_CD_MAP_ENTRY       2
101 /* Maximum number of registered RM transports */
102 #define MAX_MAPPING_ENTRIES          3
104 /* Size of RM static allocation response queue.  Must be greater than number of APPROVED
105  * static allocations */
106 #define MAX_STATIC_ALLOCATION_RESPS  5 
108 /* Size of RM service response queue */
109 #define MAX_QUEUED_SERVICE_RESPONSES 10
111 /* Error checking macro */
112 #define ERROR_CHECK(checkVal, resultVal, rmInstName, printMsg)                   \
113     if (resultVal != checkVal) {                                                 \
114         char errorMsgToPrint[] = printMsg;                                       \
115         System_printf("Error Core %d : %s : ", coreNum, rmInstName);             \
116         System_printf("%s with error code : %d\n", errorMsgToPrint, resultVal);  \
117         testErrors++;                                                            \
118         System_abort("Test Failure\n");                                          \
119     }
121 #define POSITIVE_PASS_CHECK(title, core, instName, resName, resStart, resLen, align, state, check)  \
122     do {                                                                                            \
123         int32_t start = resStart;                                                                   \
124         int32_t alignment = align;                                                                  \
125         char    titleMsg[] = title;                                                                 \
126         System_printf ("Core %d : ---------------------------------------------------------\n",     \
127                        core);                                                                       \
128         System_printf ("Core %d : %s\n", core, titleMsg);                                           \
129         System_printf ("Core %d : - Instance Name: %-32s       -\n", core, instName);               \
130         System_printf ("Core %d : - Resource Name: %-32s       -\n", core, resName);                \
131         if (start == RM_RESOURCE_BASE_UNSPECIFIED) {                                                \
132             System_printf ("Core %d : - Start:         UNSPECIFIED                            -\n", \
133                            core);                                                                   \
134             System_printf ("Core %d : - Length:        %-16d                       -\n",            \
135                            core, resLen);                                                           \
136         }                                                                                           \
137         else {                                                                                      \
138             System_printf ("Core %d : - Start:         %-16d                       -\n",            \
139                            core, resStart);                                                         \
140             System_printf ("Core %d : - End:           %-16d                       -\n", core,      \
141                            (start + resLen - 1));                                                   \
142         }                                                                                           \
143         if (alignment == RM_RESOURCE_ALIGNMENT_UNSPECIFIED) {                                       \
144             System_printf ("Core %d : - Alignment:     UNSPECIFIED                            -\n", \
145                            core);                                                                   \
146         }                                                                                           \
147         else {                                                                                      \
148             System_printf ("Core %d : - Alignment:     %-16d                       -\n",            \
149                            core, alignment);                                                        \
150         }                                                                                           \
151         System_printf ("Core %d : -                                                       -\n",     \
152                        core);                                                                       \
153         if (state == check) {                                                                       \
154             System_printf ("Core %d : - PASSED                                                -\n", \
155                            core);                                                                   \
156         }                                                                                           \
157         else {                                                                                      \
158             System_printf ("Core %d : - FAILED - Denial: %-6d                               -\n",   \
159                            core, state);                                                            \
160             testErrors++;                                                                           \
161         }                                                                                           \
162         System_printf ("Core %d : ---------------------------------------------------------\n",     \
163                        core);                                                                       \
164         System_printf ("\n");                                                                       \
165     } while(0);
167 #define NEGATIVE_PASS_CHECK(title, core, instName, resName, resStart, resLen, align, state, check)  \
168     do {                                                                                            \
169         int32_t start = resStart;                                                                   \
170         int32_t alignment = align;                                                                  \
171         char    titleMsg[] = title;                                                                 \
172         System_printf ("Core %d : ---------------------------------------------------------\n",     \
173                        core);                                                                       \
174         System_printf ("Core %d : %s\n", core, titleMsg);                                           \
175         System_printf ("Core %d : - Instance Name: %-32s       -\n", core, instName);               \
176         System_printf ("Core %d : - Resource Name: %-32s       -\n", core, resName);                \
177         if (start == RM_RESOURCE_BASE_UNSPECIFIED) {                                                \
178             System_printf ("Core %d : - Start:         UNSPECIFIED                            -\n", \
179                            core);                                                                   \
180             System_printf ("Core %d : - Length:        %-16d                       -\n",            \
181                            core, resLen);                                                           \
182         }                                                                                           \
183         else {                                                                                      \
184             System_printf ("Core %d : - Start:         %-16d                       -\n",            \
185                            core, resStart);                                                         \
186             System_printf ("Core %d : - End:           %-16d                       -\n", core,      \
187                            (start + resLen - 1));                                                   \
188         }                                                                                           \
189         if (alignment == RM_RESOURCE_ALIGNMENT_UNSPECIFIED) {                                       \
190             System_printf ("Core %d : - Alignment:     UNSPECIFIED                            -\n", \
191                            core);                                                                   \
192         }                                                                                           \
193         else {                                                                                      \
194             System_printf ("Core %d : - Alignment:     %-16d                       -\n",            \
195                            core, alignment);                                                        \
196         }                                                                                           \
197         System_printf ("Core %d : -                                                       -\n",     \
198                        core);                                                                       \
199         if (state != check) {                                                                       \
200             System_printf ("Core %d : - PASSED - Denial: %-6d                               -\n",   \
201                            core, state);                                                            \
202         }                                                                                           \
203         else {                                                                                      \
204             System_printf ("Core %d : - FAILED - Expected Denial                              -\n", \
205                            core);                                                                   \
206             testErrors++;                                                                           \
207         }                                                                                           \
208         System_printf ("Core %d : ---------------------------------------------------------\n",     \
209                        core);                                                                       \
210         System_printf ("\n");                                                                       \
211     } while(0);    
213 #define STATUS_PASS_CHECK(title, core, instName, resName, resStart, resLen, refCnt, state, check, expectRefCnt) \
214     do {                                                                                                        \
215         int32_t start = resStart;                                                                               \
216         char    titleMsg[] = title;                                                                             \
217         System_printf ("Core %d : ---------------------------------------------------------\n",                 \
218                        core);                                                                                   \
219         System_printf ("Core %d : %s\n", core, titleMsg);                                                       \
220         System_printf ("Core %d : - Instance Name: %-32s       -\n", core, instName);                           \
221         System_printf ("Core %d : - Resource Name: %-32s       -\n", core, resName);                            \
222         System_printf ("Core %d : - Start:         %-16d                       -\n",                            \
223                            core, resStart);                                                                     \
224         System_printf ("Core %d : - End:           %-16d                       -\n", core,                      \
225                            (start + resLen - 1));                                                               \
226         System_printf ("Core %d : - Expected Owner Count: %-16d                -\n",                            \
227                        core, expectRefCnt);                                                                     \
228         System_printf ("Core %d : - Returned Owner Count: %-16d                -\n",                            \
229                        core, refCnt);                                                                           \
230         System_printf ("Core %d : -                                                       -\n", core);          \
231         if ((state == check) && (refCnt == expectRefCnt)) {                                                     \
232             System_printf ("Core %d : - PASSED                                                -\n", core);      \
233         }                                                                                                       \
234         else {                                                                                                  \
235             if (refCnt != expectRefCnt) {                                                                       \
236                 System_printf ("Core %d : - FAILED - Owner Count Mismatch                         -\n",         \
237                                core);                                                                           \
238             }                                                                                                   \
239             else {                                                                                              \
240                 System_printf ("Core %d : - FAILED - Denial: %-6d                               -\n",           \
241                                core, state);                                                                    \
242             }                                                                                                   \
243             testErrors++;                                                                                       \
244         }                                                                                                       \
245         System_printf ("Core %d : ---------------------------------------------------------\n",                 \
246                        core);                                                                                   \
247         System_printf ("\n");                                                                                   \
248     } while(0);
250 /**********************************************************************
251  ********************** RM Test Data Structures ***********************
252  **********************************************************************/
254 /* IPC MessageQ RM packet encapsulation structure */
255 typedef struct {
256     /* IPC MessageQ header (must be first element in structure) */
257     MessageQ_MsgHeader  msgQHeader;
258     /* Pointer to RM packet */
259     Rm_Packet          *rmPkt;
260 } MsgQ_RmPacket;
262 /* RM registered transport mapping structure */
263 typedef struct {
264     /* Registered RM transport handle */
265     Rm_TransportHandle transportHandle;
266     /* MessageQ receive queue tied to the transport handle */
267     MessageQ_Handle    receiveMsgQ;
268 } Transport_MapEntry;
270 /**********************************************************************
271  ********************** Extern Variables ******************************
272  **********************************************************************/
274 /* Alloc and free OSAL variables */
275 extern uint32_t rmMallocCounter;
276 extern uint32_t rmFreeCounter;
278 /* RM test Global Resource List (GRL) */
279 extern const char rmGRL[];
280 /* Example Linux DTB file provided to RM Server for automatic Linux Kernel resource extraction */
281 extern const char rmLinuxDtb[];
282 /* RM test Global Policy provided to RM Server */
283 extern const char rmGlobalPolicy[];
284 /* RM test Static Policy provided to RM Client Delegate and Client */
285 extern const char rmStaticPolicy[];
287 /**********************************************************************
288  ********************** Global Variables ******************************
289  **********************************************************************/
291 /* DSP core number according to DNUM */
292 uint16_t            coreNum;
293 /* Number of errors that occurred during the test */
294 uint16_t            testErrors;
296 /* Task to configure application transport code for RM */
297 Task_Handle         rmStartupTskHandle;
298 /* High priority task for receiving RM packets */
299 Task_Handle         rmReceiveTskHandle;
300 /* RM server test task */
301 Task_Handle         rmServerTskHandle;
302 /* RM client delegate and client test task */
303 Task_Handle         rmClientTskHandle;
305 /* GateMPs used to synchronize tests between the two RM test tasks */
306 GateMP_Handle       serverGate = NULL;
307 GateMP_Handle       clientGate = NULL;
308 /* GateMP keys */
309 IArg                serverKey;
310 IArg                clientKey;
312 /* Handle for heap that RM packets will be allocated from */
313 HeapBufMP_Handle    rmPktHeapHandle = NULL;
315 /* MessageQ used by RM CD to send packets to RM Server */
316 char                serverFromCdQueueName[30] = "RM_Server_From_CD_Queue";
317 /* MessageQ used by RM Server to send packets to RM CD */
318 char                cdFromServerQueueName[30] = "RM_CD_From_Server_Queue";
319 /* MessageQ used by RM Client to send packets to RM CD */
320 char                cdFromClientQueueName[30] = "RM_CD_From_Client_Queue";
321 /* MessageQ used by RM CD to send packets to RM Client */
322 char                clientFromCdQueueName[30] = "RM_Client_From_CD_Queue";
324 /* RM Server instance name (must match with RM Global Resource List (GRL) and policies */
325 char                rmServerName[RM_NAME_MAX_CHARS] = "RM_Server";
326 /* RM CD instance name (must match with RM Global Resource List (GRL) and policies */
327 char                rmCdName[RM_NAME_MAX_CHARS]     = "RM_Client_Delegate";
328 /* RM Client instance name (must match with RM Global Resource List (GRL) and policies */
329 char                rmClientName[RM_NAME_MAX_CHARS] = "RM_Client";
331 /* RM instance handles */
332 Rm_Handle           rmServerHandle = NULL;
333 Rm_Handle           rmCdHandle     = NULL;
334 Rm_Handle           rmClientHandle = NULL;
336 /* RM instance service handles */
337 Rm_ServiceHandle   *rmServerServiceHandle = NULL;
338 Rm_ServiceHandle   *rmCdServiceHandle     = NULL;
339 Rm_ServiceHandle   *rmClientServiceHandle = NULL;
341 /* Transport map stores the RM transport handle to IPC MessageQ queue mapping */
342 Transport_MapEntry  rmTransportMap[MAX_MAPPING_ENTRIES];
344 /* Static allocation response queue */
345 Rm_ServiceRespInfo  staticResponseQueue[MAX_STATIC_ALLOCATION_RESPS];
346 /* Static allocation response queue index */
347 uint32_t            numStaticResponses;
349 /* RM response info queue used to store service responses received via the callback function */
350 Rm_ServiceRespInfo  responseInfoQueue[MAX_QUEUED_SERVICE_RESPONSES];
352 /* RM resource names (must match resource node names in GRL and policies */
353 char                resourceNameMemRegion[RM_NAME_MAX_CHARS]  = "memory-regions";
354 char                resourceNameAccumCh[RM_NAME_MAX_CHARS]    = "accumulator-ch";
355 char                resourceNameGpQ[RM_NAME_MAX_CHARS]        = "gp-queue";
356 char                resourceNameAifQ[RM_NAME_MAX_CHARS]       = "aif-queue";
357 char                resourceNameQosCluster[RM_NAME_MAX_CHARS] = "qos-cluster";
358 char                resourceNameAifRxCh[RM_NAME_MAX_CHARS]    = "aif-rx-ch";
359 char                resourceNameInfraQ[RM_NAME_MAX_CHARS]     = "infra-queue";
360 char                resourceNameLowPrioQ[RM_NAME_MAX_CHARS]   = "low-prio-queue";
362 /* Test RM NameServer name */
363 char                nameServerNameFavQ[RM_NAME_MAX_CHARS]     = "My_Favorite_Queue";
365 /**********************************************************************
366  *************************** Test Functions ***************************
367  **********************************************************************/
369 Rm_Packet *transportAlloc(Rm_AppTransportHandle appTransport, uint32_t pktSize, Rm_PacketHandle *pktHandle)
371     Rm_Packet     *rmPkt = NULL;
372     MsgQ_RmPacket *rmMsg = NULL;
374     /* Allocate a messageQ message for containing the RM packet */
375     rmMsg = (MsgQ_RmPacket *)MessageQ_alloc(MSGQ_HEAP_ID, sizeof(MsgQ_RmPacket));
376     if (rmMsg == NULL) {
377         System_printf("Error Core %d : MessageQ_alloc failed to allocate message: %d\n", coreNum);
378         testErrors++;
379         *pktHandle = NULL;
380         return(NULL);
381     }
382     else {
383         /* Create and attach RM packet to MessageQ message.  All transports will allocate from the same heap */
384         rmPkt = HeapBufMP_alloc(rmPktHeapHandle, pktSize, 0);
385         rmPkt->pktLenBytes = pktSize;
386         Osal_rmEndMemAccess((void *)rmPkt, rmPkt->pktLenBytes);
387         rmMsg->rmPkt = rmPkt;
388         *pktHandle = (Rm_PacketHandle)rmMsg;
389     }
390     return (rmPkt);
393 void transportFree (MessageQ_Msg rmMsgQMsg, Rm_Packet *pkt)
395     uint32_t pktSize = pkt->pktLenBytes;
396     int32_t  status;
398     /* All transports will free rmPkts to the same heap */
399     HeapBufMP_free(rmPktHeapHandle, pkt, pktSize);
401     status = MessageQ_free(rmMsgQMsg);
402     if (status < 0) { 
403         System_printf("Error Core %d : MessageQ_free failed to free message: %d\n", coreNum, status);
404         testErrors++;
405     }     
408 int32_t transportSend (Rm_AppTransportHandle appTransport, Rm_PacketHandle pktHandle)
410     MessageQ_QueueId  remoteQueueId = (MessageQ_QueueId)appTransport;
411     MsgQ_RmPacket    *rmMsg = pktHandle;
412     int32_t           status;    
414     /* Write back data that was written by RM after alloc */
415     Osal_rmEndMemAccess((void *)rmMsg->rmPkt, rmMsg->rmPkt->pktLenBytes);
417     /* Send the message to the remote side */
418     status = MessageQ_put(remoteQueueId, (MessageQ_Msg)rmMsg);
419     if (status < 0) {
420         transportFree((MessageQ_Msg)rmMsg, rmMsg->rmPkt);
421         System_printf("Error Core %d : MessageQ_put failed to send message: %d\n", coreNum, status);
422         testErrors++;
423     }
424     return (status);
427 void transportReceive (uint32_t transportMapEntry)
429     MessageQ_Handle  receiveQ;
430     int32_t          numPkts;
431     MessageQ_Msg     rmMsg = NULL;
432     Rm_Packet       *rmPkt = NULL;
433     int32_t          status;
434     uint32_t         i;  
436     /* Check if any packets available */
437     receiveQ = rmTransportMap[transportMapEntry].receiveMsgQ;
438     numPkts = (int32_t) MessageQ_count(receiveQ);
440     /* Process all available packets */
441     for (i = 0; i < numPkts; i++) {
442         status = (int32_t) MessageQ_get(receiveQ, &rmMsg, MessageQ_FOREVER);
443         if (rmMsg == NULL) {
444             System_printf("Error Core %d : MessageQ_get failed, returning a NULL packet\n", coreNum);
445             testErrors++;
446         }
448         /* Extract the Rm_Packet from the RM msg */
449         rmPkt = ((MsgQ_RmPacket *)rmMsg)->rmPkt;
450         Osal_rmBeginMemAccess((void *) rmPkt, rmPkt->pktLenBytes);
452         /* Provide packet to RM for processing */
453         if (status = Rm_receivePacket(rmTransportMap[transportMapEntry].transportHandle, rmPkt)) {
454             System_printf("Error Core %d : RM failed to process received packet: %d\n", coreNum, status);
455             testErrors++;
456         }
458         /* Free RM packet buffer and messageQ message */
459         transportFree(rmMsg, rmPkt);
460     }
463 void serviceCallback(Rm_ServiceRespInfo *serviceResponse)
465     uint32_t qIndex = 0;
466     
467     /* Populate next free entry in the responseInfoQueue */
468     while (responseInfoQueue[qIndex].serviceId != 0) {
469         qIndex++;
470         if (qIndex == MAX_QUEUED_SERVICE_RESPONSES) {
471             qIndex = 0;
472         }
473     }
475     /* Save the response in the response queue for the test task to pick up */
476     memcpy((void *)&responseInfoQueue[qIndex], (void *)serviceResponse, sizeof(Rm_ServiceRespInfo));
479 void waitForResponse(Rm_ServiceRespInfo *respInfo)
481     uint32_t qIndex = 0;
483     if ((respInfo->serviceState == RM_SERVICE_PROCESSING) ||
484         (respInfo->serviceState == RM_SERVICE_PENDING_SERVER_RESPONSE)) {
485         /* Scan responseInfoQueue for the response received via the callback function */
486         while((responseInfoQueue[qIndex].serviceId != respInfo->serviceId) ||
487               (responseInfoQueue[qIndex].rmHandle != respInfo->rmHandle)) {
488             qIndex++;
489             if (qIndex == MAX_QUEUED_SERVICE_RESPONSES) {
490                 qIndex = 0;
491             }
492             
493             /* Higher priority receive task will retrieve response */
494         }  
496         memcpy((void *)respInfo, (void *)&responseInfoQueue[qIndex], sizeof(Rm_ServiceRespInfo));
497         memset((void *)&responseInfoQueue[qIndex], 0, sizeof(Rm_ServiceRespInfo));
498     }
501 void setRmRequest(Rm_ServiceReqInfo *reqInfo, Rm_ServiceType type, const char *resName, int32_t resBase,
502                   uint32_t resLen, int32_t resAlign, const char *nsName, int setCallback, Rm_ServiceRespInfo *respInfo)
503 {                                                                                
504     memset((void *)reqInfo, 0, sizeof(Rm_ServiceReqInfo));                                        
505     reqInfo->type = type;                                                                           
506     reqInfo->resourceName = resName;                                                                
507     reqInfo->resourceBase = resBase;                                                                
508     reqInfo->resourceLength = resLen;                                                               
509     reqInfo->resourceAlignment = resAlign;                                                          
510     reqInfo->resourceNsName = nsName;
511     if (setCallback) {
512         reqInfo->callback.serviceCallback = serviceCallback;  
513     }
514     memset((void *)respInfo, 0, sizeof(Rm_ServiceRespInfo));                                     
517 void rmCleanupTsk(UArg arg0, UArg arg1)
519     int32_t result;
520     int32_t finalMallocFree;    
521     
522     /* Delete the RM test tasks */
523     System_printf("Core %d : Deleting RM startup task...\n", coreNum);
524     if (rmStartupTskHandle) {
525        Task_delete(&rmStartupTskHandle);
526        /* Set the task handle to be NULL so that the delete only occurs once */
527        rmStartupTskHandle = NULL;
528     }  
529     
530     if (coreNum == SYSINIT) {
531         if (rmServerTskHandle) {
532             System_printf("Core %d : Deleting RM server task...\n", coreNum);
533             Task_delete(&rmServerTskHandle);
534             /* Set the task handle to be NULL so that the delete only occurs once */
535             rmServerTskHandle = NULL;
536         }
537     }
538     else {
539         if (rmClientTskHandle) {
540             System_printf("Core %d : Deleting RM client task...\n", coreNum);        
541             Task_delete(&rmClientTskHandle);
542             /* Set the task handle to be NULL so that the delete only occurs once */
543             rmClientTskHandle = NULL;
544         }
545     }
546     
547     /* Delete the RM receive task */
548     System_printf("Core %d : Deleting RM receive task...\n", coreNum);
549     if (rmReceiveTskHandle) {
550         Task_delete(&rmReceiveTskHandle);
551         /* Set the task handle to be NULL so that the delete only occurs once */
552         rmReceiveTskHandle = NULL;
553     }
555     /* Cleanup all service ports, transport handles, RM instances, and IPC constructs */
556     if (coreNum == SYSINIT) {
557         result = Rm_serviceCloseHandle(rmServerServiceHandle);
558         ERROR_CHECK(RM_OK, result, rmServerName, "Service handle close failed");
560         result = Rm_transportUnregister(rmTransportMap[SERVER_TO_CD_MAP_ENTRY].transportHandle);
561         ERROR_CHECK(RM_OK, result, rmServerName, "Unregister of CD transport failed");
563         result = Rm_delete(rmServerHandle, RM_TEST_TRUE);  
564         ERROR_CHECK(RM_OK, result, rmServerName, "Instance delete failed");
565     }
566     else {
567         result = Rm_serviceCloseHandle(rmCdServiceHandle);
568         ERROR_CHECK(RM_OK, result, rmCdName, "Service handle close failed");
569         result = Rm_serviceCloseHandle(rmClientServiceHandle);
570         ERROR_CHECK(RM_OK, result, rmClientName, "Service handle close failed");
572         result = Rm_transportUnregister(rmTransportMap[CD_TO_SERVER_MAP_ENTRY].transportHandle);
573         ERROR_CHECK(RM_OK, result, rmCdName, "Unregister of Server transport failed");
574         result = Rm_transportUnregister(rmTransportMap[CD_TO_CLIENT_MAP_ENTRY].transportHandle);
575         ERROR_CHECK(RM_OK, result, rmCdName, "Unregister of Client transport failed");
576         result = Rm_transportUnregister(rmTransportMap[CLIENT_TO_CD_MAP_ENTRY].transportHandle);
577         ERROR_CHECK(RM_OK, result, rmClientName, "Unregister of CD transport failed");
579         result = Rm_delete(rmCdHandle, RM_TEST_TRUE);
580         ERROR_CHECK(RM_OK, result, rmCdName, "Instance delete failed");  
581         result = Rm_delete(rmClientHandle, RM_TEST_TRUE);
582         ERROR_CHECK(RM_OK, result, rmClientName, "Instance delete failed");         
583     }
585     System_printf ("Core %d : ---------------------------------------------------------\n", coreNum);
586     System_printf ("Core %d : ------------------ Memory Leak Check --------------------\n", coreNum);
587     System_printf ("Core %d : -                       : malloc count   |   free count -\n", coreNum);
588     System_printf ("Core %d : - Example Completion    :  %6d        |  %6d      -\n", coreNum,
589                    rmMallocCounter, rmFreeCounter);
590     finalMallocFree = rmMallocCounter - rmFreeCounter; 
591     if (finalMallocFree > 0) {
592         System_printf ("Core %d : - FAILED - %6d unfreed mallocs                       -\n",
593                        coreNum, finalMallocFree);
594         testErrors++;
595     }
596     else if (finalMallocFree < 0) {
597         System_printf ("Core %d : - FAILED - %6d more frees than mallocs               -\n",
598                        coreNum, -finalMallocFree);
599         testErrors++;
600     }
601     else {
602         System_printf ("Core %d : - PASSED                                                -\n",
603                        coreNum);
604     }
605     System_printf ("Core %d : ---------------------------------------------------------\n", coreNum);
606     System_printf ("\n");  
608     System_printf ("Core %d : ---------------------------------------------------------\n", coreNum);
609     System_printf ("Core %d : ------------------ Example Completion -------------------\n", coreNum);
610     if (testErrors) {
611         System_printf ("Core %d : - Test Errors: %-32d         -\n", coreNum, testErrors);
612     }
613     System_printf ("Core %d : ---------------------------------------------------------\n", coreNum);
614     System_printf ("\n"); 
616     BIOS_exit(0);
619 /* Receive task has priority of 2 so that it pre-empts the RM instance test tasks */
620 void rmReceiveTsk(UArg arg0, UArg arg1)
622     while(1) {
623         if (coreNum == SYSINIT) {
624             transportReceive(SERVER_TO_CD_MAP_ENTRY);
625         }
626         else {
627             transportReceive(CD_TO_SERVER_MAP_ENTRY);
628             transportReceive(CD_TO_CLIENT_MAP_ENTRY);
629             transportReceive(CLIENT_TO_CD_MAP_ENTRY);
630         }
631         /* Sleep for 1ms so that the main test tasks can run */
632         Task_sleep(1);
633     }
636 void rmServerTsk(UArg arg0, UArg arg1)
638     Rm_ServiceReqInfo  requestInfo;
639     Rm_ServiceRespInfo responseInfo;
640     Task_Params        taskParams;
642     /* BEGIN testing UNSPECIFIED base and alignment requests on Server */               
643     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
644                  RM_RESOURCE_BASE_UNSPECIFIED, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);       
645     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);                 
646     POSITIVE_PASS_CHECK("---------- Use Allocation w/ UNSPECIFIED Base -----------", 
647                         coreNum, rmServerName, resourceNameGpQ,
648                         RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength, 
649                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);    
650                
651     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
652                  RM_RESOURCE_BASE_UNSPECIFIED, 1, RM_RESOURCE_ALIGNMENT_UNSPECIFIED, NULL, RM_TEST_TRUE, &responseInfo);     
653     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);  
654     POSITIVE_PASS_CHECK("---- Use Allocation w/ UNSPECIFIED Base & Alignment -----", 
655                         coreNum, rmServerName, resourceNameGpQ,
656                         RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength, 
657                         RM_RESOURCE_ALIGNMENT_UNSPECIFIED, responseInfo.serviceState, RM_SERVICE_APPROVED);      
659     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
660                  RM_RESOURCE_BASE_UNSPECIFIED, 1, 200, NULL, RM_TEST_TRUE, &responseInfo);     
661     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
662     POSITIVE_PASS_CHECK("---------- Use Allocation w/ UNSPECIFIED Base -----------", 
663                         coreNum, rmServerName, resourceNameGpQ,
664                         RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength, 
665                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);        
666     /* END testing UNSPECIFIED base and alignment requests on Server */      
668     /* Create new NameServer object */                
669     setRmRequest(&requestInfo, Rm_service_RESOURCE_MAP_TO_NAME, resourceNameGpQ, 
670                  1002, 1, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
671     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo); 
672     POSITIVE_PASS_CHECK("--------------- Create NameServer Object ----------------", 
673                         coreNum, rmServerName, resourceNameGpQ,
674                         requestInfo.resourceBase, responseInfo.resourceLength, 
675                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
677     /* Wait for CD and Client retrieve resource via name, allocate the resource, free resource via name, and 
678      * delete the NameServer object. */
679     GateMP_leave(serverGate, serverKey);
680     clientKey = GateMP_enter(clientGate);
681     GateMP_leave(clientGate, clientKey);
682     serverKey = GateMP_enter(serverGate);
684     /* Try to allocate the memory region taken by the Linux Kernel and not specified as shared */
685     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameMemRegion, 
686                  12, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
687     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo); 
688     NEGATIVE_PASS_CHECK("------- Use Allocation of Resource Owned by Linux -------", 
689                         coreNum, rmServerName, resourceNameMemRegion,
690                         requestInfo.resourceBase, requestInfo.resourceLength, 
691                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);       
693     /* BEGIN testing expansion/contraction of resource nodes with the AIF RX CH resource */
694     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAifRxCh, 
695                  14, 5, 0, NULL, RM_TEST_TRUE, &responseInfo);       
696     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
697     POSITIVE_PASS_CHECK("- Resource Node Expand/Contract Testing (Use Allocate) --", 
698                         coreNum, rmServerName, resourceNameAifRxCh,
699                         requestInfo.resourceBase, requestInfo.resourceLength, 
700                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);       
701     
702     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAifRxCh, 
703                  19, 31, 0, NULL, RM_TEST_TRUE, &responseInfo);      
704     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo); 
705     POSITIVE_PASS_CHECK("- Resource Node Expand/Contract Testing (Use Allocate) --", 
706                         coreNum, rmServerName, resourceNameAifRxCh,
707                         requestInfo.resourceBase, requestInfo.resourceLength, 
708                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
709     
710     /* Wait for Client and Client Delegate to do their allocations */
711     GateMP_leave(serverGate, serverKey);
712     clientKey = GateMP_enter(clientGate);
713     GateMP_leave(clientGate, clientKey);
714     serverKey = GateMP_enter(serverGate);      
716     setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifRxCh, 
717                  25, 3, 0, NULL, RM_TEST_TRUE, &responseInfo);      
718     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);  
719     POSITIVE_PASS_CHECK("----- Resource Node Expand/Contract Testing (Free) ------", 
720                         coreNum, rmServerName, resourceNameAifRxCh,
721                         requestInfo.resourceBase, requestInfo.resourceLength, 
722                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
723     
724     setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifRxCh, 
725                  34, 3, 0, NULL, RM_TEST_TRUE, &responseInfo);      
726     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
727     POSITIVE_PASS_CHECK("----- Resource Node Expand/Contract Testing (Free) ------", 
728                         coreNum, rmServerName, resourceNameAifRxCh,
729                         requestInfo.resourceBase, requestInfo.resourceLength, 
730                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);      
731  
732     setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifRxCh, 
733                  28, 6, 0, NULL, RM_TEST_TRUE, &responseInfo);      
734     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);   
735     POSITIVE_PASS_CHECK("----- Resource Node Expand/Contract Testing (Free) ------", 
736                         coreNum, rmServerName, resourceNameAifRxCh,
737                         requestInfo.resourceBase, requestInfo.resourceLength, 
738                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
740     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAifRxCh, 
741                  53, 2, 0, NULL, RM_TEST_TRUE, &responseInfo);      
742     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);  
743     POSITIVE_PASS_CHECK("----- Resource Node Expand/Contract Testing (Free) ------", 
744                         coreNum, rmServerName, resourceNameAifRxCh,
745                         requestInfo.resourceBase, requestInfo.resourceLength, 
746                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);  
747     /* END testing expansion/contraction of resource nodes with the AIF RX CH resource */  
748     
749     /* Test exclusive rights to an allocated resource */
750     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAifRxCh, 
751                  2, 2, 0, NULL, RM_TEST_TRUE, &responseInfo);      
752     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
753     NEGATIVE_PASS_CHECK("------ Use Allocation of Exclusively Owned Resource -----", 
754                         coreNum, rmServerName, resourceNameAifRxCh,
755                         requestInfo.resourceBase, requestInfo.resourceLength, 
756                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
758     /* Allocate small regions of general purpuse queues to prepare for CD local allocation testing */
759     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
760                  2100, 10, 0, NULL, RM_TEST_TRUE, &responseInfo);      
761     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);  
762     POSITIVE_PASS_CHECK("-- Use Allocation Preparing for CD Local Alloc Testing --", 
763                         coreNum, rmServerName, resourceNameGpQ,
764                         responseInfo.resourceBase, responseInfo.resourceLength, 
765                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);      
767     /* Wait for Client and Client Delegate to do their UNSPECIFIED allocates and CD testing */
768     GateMP_leave(serverGate, serverKey);
769     clientKey = GateMP_enter(clientGate);
770     GateMP_leave(clientGate, clientKey);
771     serverKey = GateMP_enter(serverGate);
773     /* Test allocation of a resource twice from the same instance with init and use privileges.  Both
774      * should be approved but the instance should have only one owner instance in resource's owner list */
775     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ, 
776                  6543, 10, 0, NULL, RM_TEST_TRUE, &responseInfo);      
777     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);  
778     POSITIVE_PASS_CHECK("-- Init/Use Allocate of Resource from Same Inst (Init) --", 
779                         coreNum, rmServerName, resourceNameGpQ,
780                         requestInfo.resourceBase, requestInfo.resourceLength, 
781                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
783     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
784                  6543, 10, 0, NULL, RM_TEST_TRUE, &responseInfo);      
785     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
786     POSITIVE_PASS_CHECK("--- Init/Use Allocate of Resource from Same Inst (Use) --", 
787                         coreNum, rmServerName, resourceNameGpQ,
788                         requestInfo.resourceBase, requestInfo.resourceLength, 
789                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
791     /* Allocate infrastructure queue taken by Linux kernel and shared with Rm_Client.  Expect error or denial. */
792     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameInfraQ, 
793                  805, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
794     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
795     NEGATIVE_PASS_CHECK("- Init Allocation of Shared Linux and Client Resource  --", 
796                         coreNum, rmServerName, resourceNameInfraQ,
797                         805, 1, 0, responseInfo.serviceState, RM_SERVICE_APPROVED);    
799     /* Get the status of a resource from Server */
800     setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameAifRxCh, 
801                  53, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
802     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
803     STATUS_PASS_CHECK("--------- Status Check of Resources from Server ---------", 
804                       coreNum, rmServerName, responseInfo.resourceName,
805                       responseInfo.resourceBase, responseInfo.resourceLength, 
806                       responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 2); 
808     /* Get the status of a resource from Server */
809     setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameQosCluster, 
810                  1, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
811     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
812     STATUS_PASS_CHECK("--------- Status Check of Resources from Server ---------", 
813                       coreNum, rmServerName, responseInfo.resourceName,
814                       responseInfo.resourceBase, responseInfo.resourceLength, 
815                       responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 0);
817     /* BEGIN Testing CD local allocation feature from Server */
818     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
819                  2051, 2, 0, NULL, RM_TEST_TRUE, &responseInfo);      
820     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
821     POSITIVE_PASS_CHECK("--------- CD Testing: Allocate Use From Server ----------", 
822                         coreNum, rmServerName, resourceNameGpQ,
823                         responseInfo.resourceBase, responseInfo.resourceLength, 
824                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
825     /* END Testing CD local allocation feature from Server */
828 #if PRINT_USED_RESOURCES
829     Rm_resourceStatus(rmServerHandle, RM_TEST_TRUE);
830 #endif
832     /* Signal to ClientTsk that Server is ready for cleanup */
833     GateMP_leave(serverGate, serverKey);
834     
835     /* Create the RM cleanup task. */
836     System_printf("Core %d : Creating RM cleanup task...\n", coreNum);
837     Task_Params_init (&taskParams);
838     Task_create (rmCleanupTsk, &taskParams, NULL);
841 void rmClientTsk(UArg arg0, UArg arg1)
843     Rm_ServiceReqInfo  requestInfo;
844     Rm_ServiceRespInfo responseInfo;    
845     Task_Params        taskParams;
846     uint32_t           i, j;
848     serverKey = GateMP_enter(serverGate);  
850     /* Retrieve a resource via a NameServer name */
851     setRmRequest(&requestInfo, Rm_service_RESOURCE_GET_BY_NAME, NULL, 
852                  0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
853     rmCdServiceHandle->Rm_serviceHandler(rmCdServiceHandle->rmHandle, &requestInfo, &responseInfo);
854     waitForResponse(&responseInfo); 
855     POSITIVE_PASS_CHECK("------- Retrieve Resource Via NameServer Object ---------", 
856                         coreNum, rmCdName, responseInfo.resourceName,
857                         responseInfo.resourceBase, responseInfo.resourceLength, 
858                         0, responseInfo.serviceState, RM_SERVICE_APPROVED);     
860     /* Allocate the resource returned from the NameServer request */
861     memset((void *)&requestInfo, 0, sizeof(Rm_ServiceReqInfo)); 
862     requestInfo.type = Rm_service_RESOURCE_ALLOCATE_INIT;
863     requestInfo.resourceName = responseInfo.resourceName;
864     requestInfo.resourceBase = responseInfo.resourceBase;
865     requestInfo.resourceLength = responseInfo.resourceLength;
866     requestInfo.resourceNsName = NULL;
867     requestInfo.callback.serviceCallback = serviceCallback;     
868     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
869     waitForResponse(&responseInfo); 
870     POSITIVE_PASS_CHECK("-------- Init Allocate Using Retrieved Resource ---------", 
871                         coreNum, rmClientName, responseInfo.resourceName,
872                         requestInfo.resourceBase, requestInfo.resourceLength, 
873                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
875     /* Retrieve the resource status via the NameServer name */
876     setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, NULL, 
877                  0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
878     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
879     waitForResponse(&responseInfo); 
880     STATUS_PASS_CHECK("---- Retrieve Resource Status Via NameServer Object -----", 
881                       coreNum, rmClientName, responseInfo.resourceName,
882                       responseInfo.resourceBase, responseInfo.resourceLength, 
883                       responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 1);  
885     /* Free resource via a NameServer name */
886     setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, NULL, 
887                  0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
888     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
889     waitForResponse(&responseInfo); 
890     POSITIVE_PASS_CHECK("--- Free of Retrieved Resource Using NameServer Name ----", 
891                         coreNum, rmClientName, nameServerNameFavQ,
892                         0, 1, 0, responseInfo.serviceState, RM_SERVICE_APPROVED);      
894     /* Delete the NameServer name */
895     setRmRequest(&requestInfo, Rm_service_RESOURCE_UNMAP_NAME, NULL, 
896                  0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
897     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
898     waitForResponse(&responseInfo); 
899     POSITIVE_PASS_CHECK("--------------- Delete NameServer Object ----------------", 
900                         coreNum, rmClientName, nameServerNameFavQ,
901                         0, 1, 0, responseInfo.serviceState, RM_SERVICE_APPROVED);      
903     GateMP_leave(clientGate, clientKey);
904     GateMP_leave(serverGate, serverKey);
905     clientKey = GateMP_enter(clientGate);
906     serverKey = GateMP_enter(serverGate);    
908     /* BEGIN testing expansion/contraction of resource nodes with the AIF RX CH resource */
909     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAifRxCh, 
910                  0, 6, 0, NULL, RM_TEST_TRUE, &responseInfo);     
911     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
912     waitForResponse(&responseInfo);    
913     POSITIVE_PASS_CHECK("- Resource Node Expand/Contract Testing (Use Allocate) --", 
914                         coreNum, rmClientName, resourceNameAifRxCh,
915                         requestInfo.resourceBase, requestInfo.resourceLength, 
916                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
917     
918     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameAifRxCh, 
919                  50, 7, 0, NULL, RM_TEST_TRUE, &responseInfo);        
920     rmCdServiceHandle->Rm_serviceHandler(rmCdServiceHandle->rmHandle, &requestInfo, &responseInfo);
921     waitForResponse(&responseInfo);    
922     POSITIVE_PASS_CHECK("- Resource Node Expand/Contract Testing (Init Allocate) -", 
923                         coreNum, rmCdName, resourceNameAifRxCh,
924                         requestInfo.resourceBase, requestInfo.resourceLength, 
925                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
926     /* END testing expansion/contraction of resource nodes with the AIF RX CH resource */
928     GateMP_leave(clientGate, clientKey);
929     GateMP_leave(serverGate, serverKey);
930     clientKey = GateMP_enter(clientGate);
931     serverKey = GateMP_enter(serverGate);  
934     /* BEGIN testing allocations with UNSPECIFIED base and alignment values */
935     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh, 
936                  RM_RESOURCE_BASE_UNSPECIFIED, 5, 4, NULL, RM_TEST_TRUE, &responseInfo);        
937     rmCdServiceHandle->Rm_serviceHandler(rmCdServiceHandle->rmHandle, &requestInfo, &responseInfo);
938     waitForResponse(&responseInfo); 
939     POSITIVE_PASS_CHECK("---------- Use Allocation w/ UNSPECIFIED Base -----------", 
940                         coreNum, rmCdName, resourceNameAccumCh,
941                         RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength, 
942                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);    
944     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh, 
945                  RM_RESOURCE_BASE_UNSPECIFIED, 2, 1, NULL, RM_TEST_TRUE, &responseInfo);      
946     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo); 
947     waitForResponse(&responseInfo); 
948     POSITIVE_PASS_CHECK("---------- Use Allocation w/ UNSPECIFIED Base -----------", 
949                         coreNum, rmClientName, resourceNameAccumCh,
950                         RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength, 
951                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
953     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh, 
954                  RM_RESOURCE_BASE_UNSPECIFIED, 2, RM_RESOURCE_ALIGNMENT_UNSPECIFIED, NULL, RM_TEST_TRUE, &responseInfo);     
955     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
956     waitForResponse(&responseInfo); 
957     POSITIVE_PASS_CHECK("---- Use Allocation w/ UNSPECIFIED Base & Alignment -----", 
958                         coreNum, rmClientName, resourceNameAccumCh,
959                         RM_RESOURCE_BASE_UNSPECIFIED, requestInfo.resourceLength, 
960                         RM_RESOURCE_ALIGNMENT_UNSPECIFIED, responseInfo.serviceState, RM_SERVICE_APPROVED);     
961     /* END testing allocations with UNSPECIFIED base and alignment values */    
963     /* Allocate infrastructure queue shared between Linux kernel and Client */
964     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameInfraQ, 
965                  800, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
966     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
967     waitForResponse(&responseInfo); 
968     POSITIVE_PASS_CHECK("-- Init Allocation of Shared Linux and Client Resource --", 
969                         coreNum, rmClientName, resourceNameInfraQ,
970                         requestInfo.resourceBase, requestInfo.resourceLength, 
971                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);      
973     /* BEGIN Allocating some resources without providing a callback function.  RM should block and not return until the result
974      * is returned by the server. */
975     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ, 
976                  7000, 1, 0, NULL, RM_TEST_FALSE, &responseInfo);     
977     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);   
978     POSITIVE_PASS_CHECK("- Init Allocation (RM Blocked Until Resource Returned) --", 
979                         coreNum, rmClientName, resourceNameGpQ,
980                         requestInfo.resourceBase, requestInfo.resourceLength, 
981                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);      
983     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
984                  7005, 25, 0, NULL, RM_TEST_FALSE, &responseInfo);     
985     rmCdServiceHandle->Rm_serviceHandler(rmCdServiceHandle->rmHandle, &requestInfo, &responseInfo);   
986     POSITIVE_PASS_CHECK("-- Use Allocation (RM Blocked Until Resource Returned) --", 
987                         coreNum, rmCdName, resourceNameGpQ,
988                         requestInfo.resourceBase, requestInfo.resourceLength, 
989                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
990     
991     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
992                  7010, 5, 0, NULL, RM_TEST_FALSE, &responseInfo);     
993     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);   
994     POSITIVE_PASS_CHECK("-- Use Allocation (RM Blocked Until Resource Returned) --", 
995                         coreNum, rmClientName, resourceNameGpQ,
996                         requestInfo.resourceBase, requestInfo.resourceLength, 
997                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
999     /* Init allocation of resource already owned by Client should return approved and there should only
1000      * be one instance of Client in resource's owner list. */
1001     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ, 
1002                  7011, 1, 0, NULL, RM_TEST_FALSE, &responseInfo);     
1003     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);   
1004     POSITIVE_PASS_CHECK("----- Use Allocation of Owned Resource (RM Blocked) -----", 
1005                         coreNum, rmClientName, resourceNameGpQ,
1006                         requestInfo.resourceBase, requestInfo.resourceLength, 
1007                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);     
1008     /* END Allocating some resources without providing a callback function.  RM should block and not return
1009      * until the result is returned by the Server. */   
1011     /* BEGIN Getting the status of resources from Client and CD */
1012     setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameGpQ, 
1013                  7012, 2, 0, NULL, RM_TEST_TRUE, &responseInfo);     
1014     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
1015     waitForResponse(&responseInfo);  
1016     STATUS_PASS_CHECK("-- Status Check of Resources from Client (Non-Blocking) -", 
1017                       coreNum, rmClientName, responseInfo.resourceName,
1018                       responseInfo.resourceBase, responseInfo.resourceLength, 
1019                       responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 2);   
1020     
1021     setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameGpQ, 
1022                  4025, 20, 0, NULL, RM_TEST_FALSE, &responseInfo);     
1023     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
1024     STATUS_PASS_CHECK("---- Status Check of Resources from Client (Blocking) ---", 
1025                       coreNum, rmClientName, responseInfo.resourceName,
1026                       responseInfo.resourceBase, responseInfo.resourceLength, 
1027                       responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 1);      
1029     setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameInfraQ, 
1030                  800, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
1031     rmCdServiceHandle->Rm_serviceHandler(rmCdServiceHandle->rmHandle, &requestInfo, &responseInfo);
1032     waitForResponse(&responseInfo);     
1033     STATUS_PASS_CHECK("---- Status Check of Resources from CD (Non-Blocking) ---", 
1034                       coreNum, rmCdName, responseInfo.resourceName,
1035                       responseInfo.resourceBase, responseInfo.resourceLength, 
1036                       responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 2); 
1038     setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameInfraQ, 
1039                  805, 6, 0, NULL, RM_TEST_FALSE, &responseInfo);     
1040     rmCdServiceHandle->Rm_serviceHandler(rmCdServiceHandle->rmHandle, &requestInfo, &responseInfo);
1041     STATUS_PASS_CHECK("------ Status Check of Resources from CD (Blocking) -----", 
1042                       coreNum, rmCdName, responseInfo.resourceName,
1043                       responseInfo.resourceBase, responseInfo.resourceLength, 
1044                       responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 1);   
1045     /* END Getting the status of resources from Client and CD */    
1047     /* BEGIN Testing CD local allocation feature */
1048     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ, 
1049                  RM_RESOURCE_BASE_UNSPECIFIED, 5, 0, NULL, RM_TEST_TRUE, &responseInfo);     
1050     rmCdServiceHandle->Rm_serviceHandler(rmCdServiceHandle->rmHandle, &requestInfo, &responseInfo);
1051     waitForResponse(&responseInfo);   
1052     POSITIVE_PASS_CHECK("---- CD Testing: Allocate From CD (Non-Blocking) ----", 
1053                         coreNum, rmCdName, responseInfo.resourceName,
1054                         responseInfo.resourceBase, responseInfo.resourceLength, 
1055                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
1056     
1057     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ, 
1058                  RM_RESOURCE_BASE_UNSPECIFIED, 5, 0, NULL, RM_TEST_FALSE, &responseInfo);     
1059     rmCdServiceHandle->Rm_serviceHandler(rmCdServiceHandle->rmHandle, &requestInfo, &responseInfo); 
1060     POSITIVE_PASS_CHECK("------ CD Testing: Allocate From CD (Blocking) ------", 
1061                         coreNum, rmCdName, responseInfo.resourceName,
1062                         responseInfo.resourceBase, responseInfo.resourceLength, 
1063                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);  
1064     
1065     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ, 
1066                  RM_RESOURCE_BASE_UNSPECIFIED, 50, 0, NULL, RM_TEST_TRUE, &responseInfo);     
1067     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
1068     waitForResponse(&responseInfo);    
1069     POSITIVE_PASS_CHECK("---- CD Testing: Allocate From Client (Non-Blocking) ----", 
1070                         coreNum, rmClientName, responseInfo.resourceName,
1071                         responseInfo.resourceBase, responseInfo.resourceLength, 
1072                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);   
1074     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ, 
1075                  RM_RESOURCE_BASE_UNSPECIFIED, 50, 0, NULL, RM_TEST_FALSE, &responseInfo);     
1076     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);  
1077     POSITIVE_PASS_CHECK("------ CD Testing: Allocate From Client (Blocking) ------", 
1078                         coreNum, rmClientName, responseInfo.resourceName,
1079                         responseInfo.resourceBase, responseInfo.resourceLength, 
1080                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
1082     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ, 
1083                  910, 2, 0, NULL, RM_TEST_FALSE, &responseInfo);     
1084     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);  
1085     POSITIVE_PASS_CHECK("-- CD Testing: Alloc Local Res Explicitly From Client ---", 
1086                         coreNum, rmClientName, responseInfo.resourceName,
1087                         responseInfo.resourceBase, responseInfo.resourceLength, 
1088                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
1090     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ, 
1091                  965, 2, 0, NULL, RM_TEST_FALSE, &responseInfo);     
1092     rmCdServiceHandle->Rm_serviceHandler(rmCdServiceHandle->rmHandle, &requestInfo, &responseInfo);  
1093     POSITIVE_PASS_CHECK("---- CD Testing: Alloc Local Res Explicitly From CD -----", 
1094                         coreNum, rmCdName, responseInfo.resourceName,
1095                         responseInfo.resourceBase, responseInfo.resourceLength, 
1096                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);   
1098     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ, 
1099                  RM_RESOURCE_BASE_UNSPECIFIED, 5, 0, NULL, RM_TEST_TRUE, &responseInfo);     
1100     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
1101     waitForResponse(&responseInfo); 
1102     POSITIVE_PASS_CHECK("-- CD Testing: Alloc Local Res Unspecified From Client --", 
1103                         coreNum, rmClientName, responseInfo.resourceName,
1104                         responseInfo.resourceBase, responseInfo.resourceLength, 
1105                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
1107     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ, 
1108                  RM_RESOURCE_BASE_UNSPECIFIED, 5, 0, NULL, RM_TEST_FALSE, &responseInfo);     
1109     rmCdServiceHandle->Rm_serviceHandler(rmCdServiceHandle->rmHandle, &requestInfo, &responseInfo);  
1110     POSITIVE_PASS_CHECK("---- CD Testing: Alloc Local Res Unspecified From CD ----", 
1111                         coreNum, rmCdName, responseInfo.resourceName,
1112                         responseInfo.resourceBase, responseInfo.resourceLength, 
1113                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);   
1115     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameLowPrioQ, 
1116                  RM_RESOURCE_BASE_UNSPECIFIED, 1, 7, NULL, RM_TEST_FALSE, &responseInfo);     
1117     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);  
1118     POSITIVE_PASS_CHECK("-- CD Testing: Alloc Local Res From Client For Sharing --", 
1119                         coreNum, rmClientName, responseInfo.resourceName,
1120                         RM_RESOURCE_BASE_UNSPECIFIED, responseInfo.resourceLength, 
1121                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);
1123     setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameLowPrioQ, 
1124                  responseInfo.resourceBase, responseInfo.resourceLength, 0, NULL, RM_TEST_TRUE, &responseInfo);     
1125     rmCdServiceHandle->Rm_serviceHandler(rmCdServiceHandle->rmHandle, &requestInfo, &responseInfo);
1126     waitForResponse(&responseInfo); 
1127     STATUS_PASS_CHECK("----- Status Check of Resource Alloc'd Locally to CD ----", 
1128                       coreNum, rmCdName, responseInfo.resourceName,
1129                       responseInfo.resourceBase, responseInfo.resourceLength, 
1130                       responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 1); 
1132     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameLowPrioQ, 
1133                  responseInfo.resourceBase, responseInfo.resourceLength, 0, NULL, RM_TEST_TRUE, &responseInfo);     
1134     rmCdServiceHandle->Rm_serviceHandler(rmCdServiceHandle->rmHandle, &requestInfo, &responseInfo);  
1135     waitForResponse(&responseInfo); 
1136     POSITIVE_PASS_CHECK("---- CD Testing: Alloc Shared Local Resource From CD ----", 
1137                         coreNum, rmCdName, responseInfo.resourceName,
1138                         responseInfo.resourceBase, responseInfo.resourceLength, 
1139                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);   
1141     setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameLowPrioQ, 
1142                  responseInfo.resourceBase, responseInfo.resourceLength, 0, NULL, RM_TEST_FALSE, &responseInfo);     
1143     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
1144     STATUS_PASS_CHECK("- Status Check of Res Alloc'd Locally to CD After Share -", 
1145                       coreNum, rmClientName, responseInfo.resourceName,
1146                       responseInfo.resourceBase, responseInfo.resourceLength, 
1147                       responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 2);
1149     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ, 
1150                  900, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
1151     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
1152     waitForResponse(&responseInfo); 
1153     NEGATIVE_PASS_CHECK("-- Attempt Shared Alloc of Unshared Local CD Resourcee --", 
1154                         coreNum, rmClientName, responseInfo.resourceName,
1155                         responseInfo.resourceBase, responseInfo.resourceLength, 
1156                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);  
1158     setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameLowPrioQ, 
1159                  133, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
1160     rmCdServiceHandle->Rm_serviceHandler(rmCdServiceHandle->rmHandle, &requestInfo, &responseInfo);  
1161     waitForResponse(&responseInfo); 
1162     POSITIVE_PASS_CHECK("---- CD Testing: Free Shared Local Resource From CD -----", 
1163                         coreNum, rmCdName, responseInfo.resourceName,
1164                         responseInfo.resourceBase, responseInfo.resourceLength, 
1165                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);   
1167     setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameLowPrioQ, 
1168                  133, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
1169     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);  
1170     waitForResponse(&responseInfo); 
1171     POSITIVE_PASS_CHECK("-- CD Testing: Free Shared Local Resource From Client ---", 
1172                         coreNum, rmClientName, responseInfo.resourceName,
1173                         responseInfo.resourceBase, responseInfo.resourceLength, 
1174                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);  
1176     setRmRequest(&requestInfo, Rm_service_RESOURCE_STATUS, resourceNameLowPrioQ, 
1177                  responseInfo.resourceBase, responseInfo.resourceLength, 0, NULL, RM_TEST_FALSE, &responseInfo);     
1178     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
1179     STATUS_PASS_CHECK("-- Status Check After Free of Locally Shared Resource ---", 
1180                       coreNum, rmClientName, responseInfo.resourceName,
1181                       responseInfo.resourceBase, responseInfo.resourceLength, 
1182                       responseInfo.resourceNumOwners, responseInfo.serviceState, RM_SERVICE_APPROVED, 0);   
1184     setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ, 
1185                  965, 2, 0, NULL, RM_TEST_FALSE, &responseInfo);     
1186     rmCdServiceHandle->Rm_serviceHandler(rmCdServiceHandle->rmHandle, &requestInfo, &responseInfo);  
1187     POSITIVE_PASS_CHECK("-------- CD Testing: Free Local Resource From CD --------", 
1188                         coreNum, rmCdName, responseInfo.resourceName,
1189                         responseInfo.resourceBase, responseInfo.resourceLength, 
1190                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED); 
1192     setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ, 
1193                  898, 10, 0, NULL, RM_TEST_FALSE, &responseInfo);     
1194     rmCdServiceHandle->Rm_serviceHandler(rmCdServiceHandle->rmHandle, &requestInfo, &responseInfo);  
1195     POSITIVE_PASS_CHECK("-------- CD Testing: Free Local Resource From CD --------", 
1196                         coreNum, rmCdName, responseInfo.resourceName,
1197                         responseInfo.resourceBase, responseInfo.resourceLength, 
1198                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);  
1200     setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ, 
1201                  972, 5, 0, NULL, RM_TEST_FALSE, &responseInfo);     
1202     rmCdServiceHandle->Rm_serviceHandler(rmCdServiceHandle->rmHandle, &requestInfo, &responseInfo);  
1203     POSITIVE_PASS_CHECK("-------- CD Testing: Free Local Resource From CD --------", 
1204                         coreNum, rmCdName, responseInfo.resourceName,
1205                         responseInfo.resourceBase, responseInfo.resourceLength, 
1206                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);      
1208     setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ, 
1209                  910, 2, 0, NULL, RM_TEST_TRUE, &responseInfo);     
1210     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);  
1211     waitForResponse(&responseInfo); 
1212     POSITIVE_PASS_CHECK("---- CD Testing: Free Local Resource From CD Client -----", 
1213                         coreNum, rmClientName, responseInfo.resourceName,
1214                         responseInfo.resourceBase, responseInfo.resourceLength, 
1215                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);  
1217     setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ, 
1218                  914, 50, 0, NULL, RM_TEST_TRUE, &responseInfo);     
1219     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);  
1220     waitForResponse(&responseInfo); 
1221     POSITIVE_PASS_CHECK("---- CD Testing: Free Local Resource From CD Client -----", 
1222                         coreNum, rmClientName, responseInfo.resourceName,
1223                         responseInfo.resourceBase, responseInfo.resourceLength, 
1224                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);  
1226     setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameGpQ, 
1227                  967, 5, 0, NULL, RM_TEST_TRUE, &responseInfo);     
1228     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);  
1229     waitForResponse(&responseInfo); 
1230     POSITIVE_PASS_CHECK("---- CD Testing: Free Local Resource From CD Client -----", 
1231                         coreNum, rmClientName, responseInfo.resourceName,
1232                         responseInfo.resourceBase, responseInfo.resourceLength, 
1233                         requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED);      
1234     /* END Testing CD local allocation feature */ 
1237     /* Verify static allocations were validated.  Validation responses should have been received after the
1238      * first service requests were made on the Client and CD post transport path registration. */
1239     while (numStaticResponses > 0) {
1240         /* Loop until all static request validations have been received */
1241         for (i = 0; i < MAX_STATIC_ALLOCATION_RESPS; i++) {
1242             if (staticResponseQueue[i].serviceId != 0) {            
1243                 for (j = 0; j < MAX_QUEUED_SERVICE_RESPONSES; j++) {
1244                     if ((staticResponseQueue[i].serviceId == responseInfoQueue[j].serviceId) &&
1245                         (staticResponseQueue[i].rmHandle == responseInfoQueue[j].rmHandle)) {                   
1246                         POSITIVE_PASS_CHECK("------------- Static Allocation Validation --------------", 
1247                                             coreNum, rmClientName, responseInfoQueue[j].resourceName,
1248                                             responseInfoQueue[j].resourceBase, responseInfoQueue[j].resourceLength, 
1249                                             0, responseInfoQueue[j].serviceState, 
1250                                             RM_SERVICE_APPROVED); 
1251                         memset((void *)&staticResponseQueue[i], 0, sizeof(Rm_ServiceRespInfo));
1252                         memset((void *)&responseInfoQueue[j], 0, sizeof(Rm_ServiceRespInfo));
1253                         numStaticResponses--;                        
1254                         break;
1255                     }
1256                 }
1257             }
1258         }    
1259     }  
1261 #if PRINT_USED_RESOURCES
1262     Rm_resourceStatus(rmCdHandle, RM_TEST_TRUE);
1263 #endif
1265     GateMP_leave(clientGate, clientKey);
1266     GateMP_leave(serverGate, serverKey);
1267     clientKey = GateMP_enter(clientGate);
1268     /* Enter Server gate one last time to wait for Server to complete testing prior to entering cleanup */
1269     serverKey = GateMP_enter(serverGate);  
1270     
1271     /* Create the RM cleanup task. */
1272     System_printf("Core %d : Creating RM cleanup task...\n", coreNum);
1273     Task_Params_init (&taskParams);
1274     Task_create (rmCleanupTsk, &taskParams, NULL);
1277 void rmStartupTsk(UArg arg0, UArg arg1)
1279     MessageQ_Handle    serverFromCdMsgQ, cdFromServerMsgQ, cdFromClientMsgQ, clientFromCdMsgQ;
1280     MessageQ_QueueId   serverToCdQId, cdToServerQId, cdToClientQId, clientToCdQId;    
1281     Int                status, i;
1282     GateMP_Params      gateParams;    
1283     HeapBufMP_Handle   msgQHeapHandle;
1284     HeapBufMP_Params   heapBufParams;
1285     Rm_TransportCfg    rmTransportCfg;
1286     int32_t            result = 0;
1287     Rm_TransportHandle serverCdHandle, cdServerHandle, cdClientHandle, clientCdHandle;
1288     Task_Params        taskParams;
1290     /* Initialize the transport map */
1291     for (i = 0; i < MAX_MAPPING_ENTRIES; i++) {
1292         rmTransportMap[i].transportHandle = NULL;
1293     } 
1295     if (coreNum == SYSINIT) {
1296         GateMP_Params_init(&gateParams);
1297         gateParams.name = RM_SERVER_GATE_NAME;
1298         /* Disable local protection since only concerned with sync'ing cores */
1299         gateParams.localProtect = GateMP_LocalProtect_NONE;
1300         serverGate = GateMP_create(&gateParams);
1302         serverKey = GateMP_enter(serverGate);  
1304         do {
1305             status = GateMP_open(RM_CLIENT_GATE_NAME, &clientGate);
1306             /* 
1307              *  Sleep for 1 clock tick to avoid inundating remote processor
1308              *  with interrupts if open failed
1309              */
1310             if (status < 0) { 
1311                 Task_sleep(1);
1312             }
1313         } while (status < 0);        
1314         
1315         /* Create the heap that will be used to allocate RM messages. This
1316          * heap is a multi-processor heap.  It will be shared amongst
1317          * all RM instances. */     
1318         HeapBufMP_Params_init(&heapBufParams);
1319         heapBufParams.regionId       = 0;
1320         heapBufParams.name           = RM_PKT_HEAP_NAME;
1321         heapBufParams.numBlocks      = 64;
1322         heapBufParams.blockSize      = sizeof(Rm_Packet);
1323         rmPktHeapHandle = HeapBufMP_create(&heapBufParams);
1324         if (rmPktHeapHandle == NULL) {
1325             System_printf("Error Core %d : Failed to create RM packet heap\n", coreNum);
1326             testErrors++;
1327         }
1328         System_printf("Core %d : RM packet heap created\n", coreNum);
1330         /* Create the heap that will be used to allocate messageQ messages. */     
1331         HeapBufMP_Params_init(&heapBufParams);
1332         heapBufParams.regionId       = 0;
1333         heapBufParams.name           = MSGQ_HEAP_NAME;
1334         heapBufParams.numBlocks      = 64;
1335         heapBufParams.blockSize      = sizeof(MsgQ_RmPacket);
1336         msgQHeapHandle = HeapBufMP_create(&heapBufParams);
1337         if (msgQHeapHandle == NULL) {
1338             System_printf("Error Core %d : Failed to create HeapBufMP MessageQ heap\n", coreNum);
1339             testErrors++;
1340         } 
1341         System_printf("Core %d : IPC MessageQ message heap created\n", coreNum);
1342     }
1343     else {
1344         GateMP_Params_init(&gateParams);
1345         gateParams.name = RM_CLIENT_GATE_NAME;
1346         /* Disable local protection since only concerned with sync'ing cores */
1347         gateParams.localProtect = GateMP_LocalProtect_NONE;
1348         clientGate = GateMP_create(&gateParams);
1350         clientKey = GateMP_enter(clientGate); 
1351         
1352         do {
1353             status = GateMP_open(RM_SERVER_GATE_NAME, &serverGate);
1354             /* 
1355              *  Sleep for 1 clock tick to avoid inundating remote processor
1356              *  with interrupts if open failed
1357              */
1358             if (status < 0) { 
1359                 Task_sleep(1);
1360             }
1361         } while (status < 0);
1362         
1363         /* Open the heaps created by the other processor. Loop until opened. */
1364         do {
1365             status = HeapBufMP_open(RM_PKT_HEAP_NAME, &rmPktHeapHandle);
1366             /* 
1367              *  Sleep for 1 clock tick to avoid inundating remote processor
1368              *  with interrupts if open failed
1369              */
1370             if (status < 0) { 
1371                 Task_sleep(1);
1372             }
1373         } while (status < 0);
1374         System_printf("Core %d : RM packet heap opened\n", coreNum);
1375         
1376         do {
1377             status = HeapBufMP_open(MSGQ_HEAP_NAME, &msgQHeapHandle);
1378             /* 
1379              *  Sleep for 1 clock tick to avoid inundating remote processor
1380              *  with interrupts if open failed
1381              */
1382             if (status < 0) { 
1383                 Task_sleep(1);
1384             }
1385         } while (status < 0);
1386         System_printf("Core %d : IPC MessageQ message heap opened\n", coreNum);
1387     }
1388     
1389     /* Register the MessageQ heap with MessageQ */
1390     MessageQ_registerHeap(msgQHeapHandle, MSGQ_HEAP_ID);
1392     /* Create the messageQ's for each RM instance connection
1393      * Need four queues.  Topology will be:
1394      * RM Server <---> RM Client Delegate <---> RM Client 
1395      * 1 queues on RM Server
1396      * 2 queues on RM Client Delegate
1397      * 1 queues on RM Client */
1398     if (coreNum == SYSINIT) {
1399         serverFromCdMsgQ = MessageQ_create(serverFromCdQueueName, NULL);
1400         if (serverFromCdMsgQ == NULL) {
1401             System_printf("Error Core %d : Failed to create Server's receive Q for CD\n", coreNum);
1402             testErrors++;
1403         }
1404         System_printf("Core %d : Created Server receive Q for CD\n", coreNum);
1405     }
1406     else {
1407         cdFromServerMsgQ = MessageQ_create(cdFromServerQueueName, NULL);
1408         if (cdFromServerMsgQ == NULL) {
1409             System_printf("Error Core %d : Failed to create CD's receive Q for Server\n", coreNum);
1410             testErrors++;
1411         }
1412         System_printf("Core %d : Created CD receive Q for Server\n", coreNum);
1413         
1414         cdFromClientMsgQ = MessageQ_create(cdFromClientQueueName, NULL);
1415         if (cdFromClientMsgQ == NULL) {
1416             System_printf("Error Core %d : Failed to create CD's receive Q for Client\n", coreNum);
1417             testErrors++;
1418         } 
1419         System_printf("Core %d : Created CD receive Q for Client\n", coreNum);        
1420         
1421         clientFromCdMsgQ = MessageQ_create(clientFromCdQueueName, NULL);
1422         if (clientFromCdMsgQ == NULL) {
1423             System_printf("Error Core %d : Failed to create Client's receive Q for CD\n", coreNum);
1424             testErrors++;
1425         }
1426         System_printf("Core %d : Created Client receive Q for CD\n", coreNum);
1427     }
1428     
1429     /* Open the remote message queues. Also register the RM transports with each RM instance */
1430     if (coreNum == SYSINIT) {
1431         /* Open the Client Delegate messageQ from the Server */
1432         do {
1433             status = MessageQ_open(cdFromServerQueueName, &serverToCdQId); 
1434             /* 
1435              *  Sleep for 1 clock tick to avoid inundating remote processor
1436              *  with interrupts if open failed
1437              */
1438             if (status < 0) { 
1439                 Task_sleep(1);
1440             }
1441         } while (status < 0);
1442         System_printf("Core %d : RM CD MessageQ opened from RM Server\n", coreNum);
1444         /* Register the Client Delegate with the RM Server Instance */
1445         rmTransportCfg.rmHandle = rmServerHandle;
1446         rmTransportCfg.appTransportHandle = (Rm_AppTransportHandle) serverToCdQId;
1447         rmTransportCfg.remoteInstType = Rm_instType_CLIENT_DELEGATE;
1448         rmTransportCfg.transportCallouts.rmAllocPkt = transportAlloc;
1449         rmTransportCfg.transportCallouts.rmSendPkt = transportSend;
1450         serverCdHandle = Rm_transportRegister(&rmTransportCfg, &result);
1452         /* Store the mapping information in the transport map */
1453         rmTransportMap[SERVER_TO_CD_MAP_ENTRY].transportHandle = serverCdHandle;
1454         rmTransportMap[SERVER_TO_CD_MAP_ENTRY].receiveMsgQ = serverFromCdMsgQ;
1455         System_printf("Core %d : Registered RM Server <=> RM CD transport with RM Server instance\n", coreNum);
1456     }
1457     else {
1458         /* Open the Server messageQ from the Client Delegate */
1459         do {
1460             status = MessageQ_open(serverFromCdQueueName, &cdToServerQId); 
1461             /* 
1462              *  Sleep for 1 clock tick to avoid inundating remote processor
1463              *  with interrupts if open failed
1464              */
1465             if (status < 0) { 
1466                 Task_sleep(1);
1467             }
1468         } while (status < 0);
1469         System_printf("Core %d : RM Server MessageQ opened from RM CD\n", coreNum);
1471         /* Register the Server with the RM Client Delegate Instance */
1472         rmTransportCfg.rmHandle = rmCdHandle;
1473         rmTransportCfg.appTransportHandle = (Rm_AppTransportHandle) cdToServerQId;
1474         rmTransportCfg.remoteInstType = Rm_instType_SERVER;
1475         rmTransportCfg.transportCallouts.rmAllocPkt = transportAlloc;
1476         rmTransportCfg.transportCallouts.rmSendPkt = transportSend;
1477         cdServerHandle = Rm_transportRegister(&rmTransportCfg, &result);
1479         /* Store the mapping information in the transport map */
1480         rmTransportMap[CD_TO_SERVER_MAP_ENTRY].transportHandle = cdServerHandle;
1481         rmTransportMap[CD_TO_SERVER_MAP_ENTRY].receiveMsgQ = cdFromServerMsgQ;
1482         System_printf("Core %d : Registered RM CD <=> RM Server transport with RM CD instance\n", coreNum);
1483         
1484         /* Open the Client messageQ from the Client Delegate */
1485         do {
1486             status = MessageQ_open(clientFromCdQueueName, &cdToClientQId); 
1487             /* 
1488              *  Sleep for 1 clock tick to avoid inundating remote processor
1489              *  with interrupts if open failed
1490              */
1491             if (status < 0) { 
1492                 Task_sleep(1);
1493             }
1494         } while (status < 0);
1495         System_printf("Core %d : RM Client MessageQ opened from RM CD\n", coreNum);
1497         /* Register the Client with the RM Client Delegate Instance */
1498         rmTransportCfg.appTransportHandle = (Rm_AppTransportHandle) cdToClientQId;
1499         rmTransportCfg.remoteInstType = Rm_instType_CLIENT;
1500         rmTransportCfg.transportCallouts.rmAllocPkt = transportAlloc;
1501         rmTransportCfg.transportCallouts.rmSendPkt = transportSend;
1502         cdClientHandle = Rm_transportRegister(&rmTransportCfg, &result);
1504         /* Store the mapping information in the transport map */
1505         rmTransportMap[CD_TO_CLIENT_MAP_ENTRY].transportHandle = cdClientHandle;
1506         rmTransportMap[CD_TO_CLIENT_MAP_ENTRY].receiveMsgQ = cdFromClientMsgQ;
1507         System_printf("Core %d : Registered RM CD <=> RM Client transport with RM CD instance\n", coreNum);
1509         /* Open the Client Delegate messageQ from the Client */        
1510         do {
1511             status = MessageQ_open(cdFromClientQueueName, &clientToCdQId); 
1512             /* 
1513              *  Sleep for 1 clock tick to avoid inundating remote processor
1514              *  with interrupts if open failed
1515              */
1516             if (status < 0) { 
1517                 Task_sleep(1);
1518             }
1519         } while (status < 0);
1520         System_printf("Core %d : RM CD MessageQ opened from RM Client\n", coreNum);
1522         /* Register the Client Delegate with the RM Client Instance */
1523         rmTransportCfg.rmHandle = rmClientHandle;
1524         rmTransportCfg.appTransportHandle = (Rm_AppTransportHandle) clientToCdQId;
1525         rmTransportCfg.remoteInstType = Rm_instType_CLIENT_DELEGATE;
1526         rmTransportCfg.transportCallouts.rmAllocPkt = transportAlloc;
1527         rmTransportCfg.transportCallouts.rmSendPkt = transportSend;
1528         clientCdHandle = Rm_transportRegister(&rmTransportCfg, &result);
1530         /* Store the mapping information in the transport map */
1531         rmTransportMap[CLIENT_TO_CD_MAP_ENTRY].transportHandle = clientCdHandle;
1532         rmTransportMap[CLIENT_TO_CD_MAP_ENTRY].receiveMsgQ = clientFromCdMsgQ;
1533         System_printf("Core %d : Registered RM Client <=> RM CD transport with RM Client instance\n", coreNum);
1534     }
1536     /* Create the RM receive task.  Assign higher priority than the test tasks so that
1537      * when they spin waiting for messages from other RM instances the receive task is
1538      * executed. */
1539     System_printf("Core %d : Creating RM receive task...\n", coreNum);
1540     Task_Params_init (&taskParams);
1541     taskParams.priority = 2;
1542     rmReceiveTskHandle = Task_create (rmReceiveTsk, &taskParams, NULL);
1543     
1544     /* Create the RM test tasks. */
1545     if (coreNum == SYSINIT) {
1546         System_printf("Core %d : Creating RM server task...\n", coreNum);
1547         Task_Params_init (&taskParams);
1548         taskParams.priority = 1;
1549         rmServerTskHandle = Task_create (rmServerTsk, &taskParams, NULL);
1550     }
1551     else if (coreNum) {
1552         System_printf("Core %d : Creating RM client task...\n", coreNum);
1553         Task_Params_init (&taskParams);
1554         taskParams.priority = 1;
1555         rmClientTskHandle = Task_create (rmClientTsk, &taskParams, NULL);
1556     }
1559 int main(Int argc, Char* argv[])
1561     Rm_InitCfg         rmInitCfg;
1562     Task_Params        taskParams; 
1563     int                status;
1564     Rm_ServiceReqInfo  requestInfo;
1565     Rm_ServiceRespInfo responseInfo;
1566     int32_t            result;
1568     System_printf ("*********************************************************\n");
1569     System_printf ("********************** RM Testing ***********************\n");
1570     System_printf ("*********************************************************\n");
1572     System_printf ("RM Version : 0x%08x\nVersion String: %s\n", Rm_getVersion(), Rm_getVersionStr());
1574     coreNum = CSL_chipReadReg(CSL_CHIP_DNUM);
1575     testErrors = 0;
1577     /* Initialize the RM instances - RM must be initialized before anything else in the system
1578      * Core 0: 1 RM Instance  - RM Server
1579      * Core 1: 2 RM Instances - RM Client Delegate
1580      *                          RM Client
1581      */
1582     if (coreNum == SYSINIT) {
1583         /* Create the Server instance */
1584         rmInitCfg.instName = rmServerName;
1585         rmInitCfg.instType = Rm_instType_SERVER;
1586         rmInitCfg.instCfg.serverCfg.globalResourceList = (void *)rmGRL;
1587         rmInitCfg.instCfg.serverCfg.linuxDtb = (void *)rmLinuxDtb;
1588         rmInitCfg.instCfg.serverCfg.globalPolicy = (void *)rmGlobalPolicy;
1589         rmServerHandle = Rm_init(&rmInitCfg, &result);
1590         ERROR_CHECK(RM_OK, result, rmServerName, "Initialization failed");
1592         /* Open Server service handle */
1593         rmServerServiceHandle = Rm_serviceOpenHandle(rmServerHandle, &result);
1594         ERROR_CHECK(RM_OK, result, rmServerName, "Service handle open failed");
1595     }
1596     else {
1597         /* Create the RM Client Delegate instance */
1598         rmInitCfg.instName = rmCdName;
1599         rmInitCfg.instType = Rm_instType_CLIENT_DELEGATE;
1600         rmInitCfg.instCfg.cdCfg.cdPolicy = (void *)rmGlobalPolicy;
1601         rmCdHandle = Rm_init(&rmInitCfg, &result);
1602         ERROR_CHECK(RM_OK, result, rmCdName, "Initialization failed");
1604         /* Open CD service handle */
1605         rmCdServiceHandle = Rm_serviceOpenHandle(rmCdHandle, &result);
1606         ERROR_CHECK(RM_OK, result, rmCdName, "Service handle open failed");
1608         /* Create the RM Client instance */
1609         rmInitCfg.instName = rmClientName;
1610         rmInitCfg.instType = Rm_instType_CLIENT;      
1611         rmInitCfg.instCfg.clientCfg.staticPolicy = (void *)rmStaticPolicy;
1612         rmClientHandle = Rm_init(&rmInitCfg, &result);
1613         ERROR_CHECK(RM_OK, result, rmClientName, "Initialization failed");
1615         /* Open Client service handle */
1616         rmClientServiceHandle = Rm_serviceOpenHandle(rmClientHandle, &result);
1617         ERROR_CHECK(RM_OK, result, rmClientName, "Service handle open failed");
1619         /* Initialize the static allocation response queue */
1620         for (numStaticResponses = 0; numStaticResponses < MAX_STATIC_ALLOCATION_RESPS; numStaticResponses++) {
1621             memset((void *)&staticResponseQueue[numStaticResponses], 0, sizeof(Rm_ServiceRespInfo));
1622         }
1623         numStaticResponses = 0;
1625         /* Static allocation tests */
1626         setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameQosCluster, 
1627                      0, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
1628         rmCdServiceHandle->Rm_serviceHandler(rmCdServiceHandle->rmHandle, &requestInfo, &responseInfo);               
1629         POSITIVE_PASS_CHECK("---------------- Static Init Allocation -----------------", 
1630                             coreNum, rmCdName, resourceNameQosCluster,
1631                             requestInfo.resourceBase, requestInfo.resourceLength, 
1632                             requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);     
1633         if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {        
1634             memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(responseInfo));
1635         }        
1636         
1637         setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameQosCluster, 
1638                      2, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);        
1639         rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
1640         POSITIVE_PASS_CHECK("---------------- Static Init Allocation -----------------", 
1641                             coreNum, rmClientName, resourceNameQosCluster,
1642                             requestInfo.resourceBase, requestInfo.resourceLength, 
1643                             requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);     
1644         if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {        
1645             memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(responseInfo));
1646         }           
1648         /* Request resource from Client that can only be allocated to CD according to static policy */
1649         setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameQosCluster, 
1650                      1, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);        
1651         rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
1652         NEGATIVE_PASS_CHECK("---------------- Static Init Allocation -----------------", 
1653                             coreNum, rmClientName, resourceNameQosCluster,
1654                             requestInfo.resourceBase, requestInfo.resourceLength, 
1655                             requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);          
1657         /* Request resource from both Client and CD that is shared according to static policy */
1658         setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameAifQ, 
1659                      525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);        
1660         rmCdServiceHandle->Rm_serviceHandler(rmCdServiceHandle->rmHandle, &requestInfo, &responseInfo);
1661         POSITIVE_PASS_CHECK("---------------- Static Init Allocation -----------------", 
1662                             coreNum, rmCdName, resourceNameAifQ,
1663                             requestInfo.resourceBase, requestInfo.resourceLength, 
1664                             requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);     
1665         if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {        
1666             memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(responseInfo));
1667         }           
1669         setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameAifQ, 
1670                      525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);        
1671         rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo); 
1672         POSITIVE_PASS_CHECK("---------------- Static Init Allocation -----------------", 
1673                             coreNum, rmClientName, resourceNameAifQ,
1674                             requestInfo.resourceBase, requestInfo.resourceLength, 
1675                             requestInfo.resourceAlignment, responseInfo.serviceState, RM_SERVICE_APPROVED_STATIC);     
1676         if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {        
1677             memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(responseInfo));
1678         }           
1679     }
1681     System_printf("Core %d : Starting IPC...\n", coreNum);
1682     status = Ipc_start();
1683     if (status < 0) {
1684         System_abort("Ipc_start failed\n");
1685     }
1687     /* Create the RM startup task */
1688     System_printf("Core %d : Creating RM startup task...\n", coreNum);
1689     Task_Params_init (&taskParams);
1690     rmStartupTskHandle = Task_create (rmStartupTsk, &taskParams, NULL);
1692     System_printf("Core %d : Starting BIOS...\n", coreNum);
1693     BIOS_start();
1695     return (0);