]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/rm-lld.git/blob - test/rm_test.c
Converted boolean variables to ints
[keystone-rtos/rm-lld.git] / test / 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/MultiProc.h>
53 #include <ti/ipc/GateMP.h>
55 /* BIOS Includes */
56 #include <ti/sysbios/BIOS.h>
57 #include <ti/sysbios/knl/Task.h>
58 #include <ti/sysbios/family/c64p/Hwi.h>
60 /* CSL Includes */
61 #include <ti/csl/csl_semAux.h>
62 #include <ti/csl/csl_cacheAux.h>
63 #include <ti/csl/csl_xmcAux.h>
65 /* RM Includes */
66 #include <ti/drv/rm/rm.h>
67 #include <ti/drv/rm/rm_transport.h>
68 #include <ti/drv/rm/rm_services.h>
70 /**********************************************************************
71  ************************** RM Test Symbols ***************************
72  **********************************************************************/
74 /* Test FALSE */
75 #define RM_TEST_FALSE 0
76 /* Test TRUE */
77 #define RM_TEST_TRUE  1
79 /* IPC MessageQ heap name */
80 #define MSGQ_HEAP_NAME               "msgQHeapBuf"
81 /* IPC MessageQ heap ID */
82 #define MSGQ_HEAP_ID                 0
84 /* RM packet heap name */
85 #define RM_PKT_HEAP_NAME             "rmHeapBuf"
86 /* Name of GateMP used to synchronize the RM test tasks */
87 #define RM_TASK_GATE_NAME            "rmGateMP"
89 /* Application's core 0 registered RM transport indices */
90 #define SERVER_TO_CD_MAP_ENTRY       0
91 /* Application's core 1 registered RM transport indices */
92 #define CD_TO_SERVER_MAP_ENTRY       0
93 #define CD_TO_CLIENT_MAP_ENTRY       1
94 #define CLIENT_TO_CD_MAP_ENTRY       2
95 /* Maximum number of registered RM transports */
96 #define MAX_MAPPING_ENTRIES          3
98 /* Size of RM static allocation response queue.  Must be greater than number of APPROVED
99  * static allocations */
100 #define MAX_STATIC_ALLOCATION_RESPS  5 
102 /* Size of RM service response queue */
103 #define MAX_QUEUED_SERVICE_RESPONSES 10
105 /* Error checking macro */
106 #define ERROR_CHECK(checkVal, resultVal, rmInstName, printMsg)                   \
107     if (resultVal != checkVal) {                                                 \
108         char errorMsgToPrint[] = printMsg;                                       \
109         System_printf("Error Core %d : %s : ", coreNum, rmInstName);    \
110         System_printf("%s with error code : %d\n", errorMsgToPrint, resultVal);  \
111         System_abort("Test Failure\n");                                          \
112     }
114 /**********************************************************************
115  ********************** RM Test Data Structures ***********************
116  **********************************************************************/
118 /* IPC MessageQ RM packet encapsulation structure */
119 typedef struct {
120     /* IPC MessageQ header (must be first element in structure) */
121     MessageQ_MsgHeader  msgQHeader;
122     /* Pointer to RM packet */
123     Rm_Packet          *rmPkt;
124 } MsgQ_RmPacket;
126 /* RM registered transport mapping structure */
127 typedef struct {
128     /* Registered RM transport handle */
129     Rm_TransportHandle transportHandle;
130     /* MessageQ receive queue tied to the transport handle */
131     MessageQ_Handle    receiveMsgQ;
132 } Transport_MapEntry;
134 /**********************************************************************
135  ********************** Extern Variables ******************************
136  **********************************************************************/
138 /* RM test Global Resource List (GRL) */
139 extern const char rmGrl[];
140 /* Example Linux DTB file provided to RM Server for automatic Linux Kernel resource extraction */
141 extern const char rmLinuxDtb[];
142 /* RM test Global Policy provided to RM Server */
143 extern const char rmGlobalPolicy[];
144 /* RM test Static Policy provided to RM Client Delegate and Client */
145 extern const char rmStaticPolicy[];
147 /* OSAL RM Local Gate Initialization. */
148 extern void Osal_rmLocalGateInit (void);
150 /**********************************************************************
151  ********************** Global Variables ******************************
152  **********************************************************************/
154 /* DSP core number according to IPC */
155 uint16_t            coreNum;
157 /* Task to configure application transport code for RM */
158 Task_Handle         rmStartupTskHandle;
159 /* High priority task for receiving RM packets */
160 Task_Handle         rmReceiveTskHandle;
161 /* RM server test task */
162 Task_Handle         rmServerTskHandle;
163 /* RM client delegate and client test task */
164 Task_Handle         rmClientTskHandle;
166 /* GateMP used to synchronize tests between the two RM test tasks */
167 GateMP_Handle       gateHandle = NULL;
168 /* GateMP key */
169 IArg                gateKey;
171 /* Handle for heap that RM packets will be allocated from */
172 HeapBufMP_Handle    rmPktHeapHandle = NULL;
174 /* MessageQ used by RM CD to send packets to RM Server */
175 char                serverFromCdQueueName[30] = "RM_Server_From_CD_Queue";
176 /* MessageQ used by RM Server to send packets to RM CD */
177 char                cdFromServerQueueName[30] = "RM_CD_From_Server_Queue";
178 /* MessageQ used by RM Client to send packets to RM CD */
179 char                cdFromClientQueueName[30] = "RM_CD_From_Client_Queue";
180 /* MessageQ used by RM CD to send packets to RM Client */
181 char                clientFromCdQueueName[30] = "RM_Client_From_CD_Queue";
183 /* RM Server instance name (must match with RM Global Resource List (GRL) and policies */
184 char                rmServerName[RM_NAME_MAX_CHARS] = "RM_Server";
185 /* RM CD instance name (must match with RM Global Resource List (GRL) and policies */
186 char                rmCdName[RM_NAME_MAX_CHARS]     = "RM_Client_Delegate";
187 /* RM Client instance name (must match with RM Global Resource List (GRL) and policies */
188 char                rmClientName[RM_NAME_MAX_CHARS] = "RM_Client";
190 /* RM instance handles */
191 Rm_Handle           rmServerHandle = NULL;
192 Rm_Handle           rmCdHandle     = NULL;
193 Rm_Handle           rmClientHandle = NULL;
195 /* RM instance service handles */
196 Rm_ServiceHandle   *rmServerServiceHandle = NULL;
197 Rm_ServiceHandle   *rmCdServiceHandle     = NULL;
198 Rm_ServiceHandle   *rmClientServiceHandle = NULL;
200 /* Transport map stores the RM transport handle to IPC MessageQ queue mapping */
201 Transport_MapEntry  rmTransportMap[MAX_MAPPING_ENTRIES];
203 /* Static allocation response queue */
204 Rm_ServiceRespInfo  staticResponseQueue[MAX_STATIC_ALLOCATION_RESPS];
205 /* Static allocation response queue index */
206 uint32_t            numStaticResponses;
209 /* RM response info queue used to store service responses received via the callback function */
210 Rm_ServiceRespInfo  responseInfoQueue[MAX_QUEUED_SERVICE_RESPONSES];
212 /* RM resource names (must match resource node names in GRL and policies */
213 char                resourceNameMemRegion[RM_NAME_MAX_CHARS]  = "memory-regions";
214 char                resourceNameAccumCh[RM_NAME_MAX_CHARS]    = "accumulator-ch";
215 char                resourceNameGpQ[RM_NAME_MAX_CHARS]        = "gp-queue";
216 char                resourceNameAifQ[RM_NAME_MAX_CHARS]       = "aif-queue";
217 char                resourceNameQosCluster[RM_NAME_MAX_CHARS] = "qos-cluster";
218 char                resourceNameAifRxCh[RM_NAME_MAX_CHARS]    = "aif-rx-ch";
219 char                resourceNameInfraQ[RM_NAME_MAX_CHARS]     = "infra-queue";
221 /* Test RM NameServer name */
222 char                nameServerNameFavQ[RM_NAME_MAX_CHARS]     = "My_Favorite_Queue";
224 /**********************************************************************
225  *************************** Test Functions ***************************
226  **********************************************************************/
228 void beginMemAccess (void *ptr, uint32_t size)
230     uint32_t key;
232     key = Hwi_disable();
234     /* Cleanup the prefetch buffer also. */
235     CSL_XMC_invalidatePrefetchBuffer();
236     /* Invalidate L1D cache and wait until operation is complete.
237      * Use this approach if L2 cache is not enabled */
238     CACHE_invL1d (ptr, size, CACHE_FENCE_WAIT);
239     asm   (" nop      4");
240     asm   (" nop      4");
241     asm   (" nop      4");
242     asm   (" nop      4");
243     Hwi_restore(key);
246 void endMemAccess (void *ptr, uint32_t size)
248     uint32_t key;
250     key = Hwi_disable();
252     /* Writeback L1D cache and wait until operation is complete.
253      * Use this approach if L2 cache is not enabled */
254     CACHE_wbL1d (ptr, size, CACHE_FENCE_WAIT);
255     asm   (" nop      4");
256     asm   (" nop      4");
257     asm   (" nop      4");
258     asm   (" nop      4");
259     Hwi_restore(key);
262 Rm_Packet *transportAlloc(Rm_AppTransportHandle appTransport, uint32_t pktSize, Rm_PacketHandle *pktHandle)
264     Rm_Packet     *rmPkt = NULL;
265     MsgQ_RmPacket *rmMsg = NULL;
267     /* Allocate a messageQ message for containing the RM packet */
268     rmMsg = (MsgQ_RmPacket *)MessageQ_alloc(MSGQ_HEAP_ID, sizeof(MsgQ_RmPacket));
269     if (rmMsg == NULL) {
270         System_printf("Core %d: MessageQ_alloc failed in TransportSend\n", coreNum);
271         *pktHandle = NULL;
272         return(NULL);
273     }
274     else {
275         /* Create and attach RM packet to MessageQ message.  All transports will allocate from the same heap */
276         rmPkt = HeapBufMP_alloc(rmPktHeapHandle, pktSize, 0);
277         rmPkt->pktLenBytes = pktSize;
278         endMemAccess((void *)rmPkt, rmPkt->pktLenBytes);
279         rmMsg->rmPkt = rmPkt;
280         *pktHandle = (Rm_PacketHandle)rmMsg;
281     }
282     return (rmPkt);
285 void transportFree (MessageQ_Msg rmMsgQMsg, Rm_Packet *pkt)
287     uint32_t pktSize = pkt->pktLenBytes;
288     int32_t  status;
290     /* All transports will free rmPkts to the same heap */
291     HeapBufMP_free(rmPktHeapHandle, pkt, pktSize);
293     status = MessageQ_free(rmMsgQMsg);
294     if (status < 0) { 
295         System_printf("Core %d: MessageQ_free had a failure/error in transportFree\n", coreNum);
296     }     
299 int32_t transportSend (Rm_AppTransportHandle appTransport, Rm_PacketHandle pktHandle)
301     MessageQ_QueueId  remoteQueueId = (MessageQ_QueueId)appTransport;
302     MsgQ_RmPacket    *rmMsg = pktHandle;
303     int32_t           status;    
305     /* Write back data that was written by RM after alloc */
306     endMemAccess((void *)rmMsg->rmPkt, rmMsg->rmPkt->pktLenBytes);
308     /* Send the message to the remote side */
309     status = MessageQ_put(remoteQueueId, (MessageQ_Msg)rmMsg);
310     if (status < 0) {
311         transportFree((MessageQ_Msg)rmMsg, rmMsg->rmPkt);
312         System_printf("Core %d: MessageQ_put had a failure/error in TransportSend: error: %d\n", coreNum,
313                                                                                                  status);
314     }
315     return (status);
318 void transportReceive (uint32_t transportMapEntry)
320     MessageQ_Handle  receiveQ;
321     int32_t          numPkts;
322     MessageQ_Msg     rmMsg = NULL;
323     Rm_Packet       *rmPkt = NULL;
324     int32_t          status;
325     uint32_t         i;  
327     /* Check if any packets available */
328     receiveQ = rmTransportMap[transportMapEntry].receiveMsgQ;
329     numPkts = (int32_t) MessageQ_count(receiveQ);
331     /* Process all available packets */
332     for (i = 0; i < numPkts; i++) {
333         status = (int32_t) MessageQ_get(receiveQ, &rmMsg, MessageQ_FOREVER);
334         if (status < 0) {
335             System_abort("This should not happen since timeout is forever\n");
336         }
337         if (rmMsg == NULL) {
338             System_printf("Core %d: MessageQ_get failed returning a null packet in TransportReceive\n", coreNum);
339         }
341         /* Extract the Rm_Packet from the RM msg */
342         rmPkt = ((MsgQ_RmPacket *)rmMsg)->rmPkt;
343         beginMemAccess((void *) rmPkt, rmPkt->pktLenBytes);
345         /* Provide packet to RM for processing */
346         if (status = Rm_receivePacket(rmTransportMap[transportMapEntry].transportHandle, rmPkt)) {
347             System_printf("Core %d: RM encountered error processing received packet: %d\n", coreNum, status);
348         }
350         /* Free RM packet buffer and messageQ message */
351         transportFree(rmMsg, rmPkt);
352     }
355 void serviceCallback(Rm_ServiceRespInfo *serviceResponse)
357     uint32_t qIndex = 0;
358     
359     /* Populate next free entry in the responseInfoQueue */
360     while (responseInfoQueue[qIndex].serviceId != 0) {
361         qIndex++;
362         if (qIndex == MAX_QUEUED_SERVICE_RESPONSES) {
363             qIndex = 0;
364         }
365     }
367     /* Save the response in the response queue for the test task to pick up */
368     memcpy((void *)&responseInfoQueue[qIndex], (void *)serviceResponse, sizeof(Rm_ServiceRespInfo));
371 void waitForResponse(Rm_ServiceRespInfo *respInfo)
373     uint32_t qIndex = 0;
375     if (respInfo->serviceState == RM_SERVICE_PROCESSING) {
376         /* Scan responseInfoQueue for the response received via the callback function */
377         while((responseInfoQueue[qIndex].serviceId != respInfo->serviceId) ||
378               (responseInfoQueue[qIndex].rmHandle != respInfo->rmHandle)) {
379             qIndex++;
380             if (qIndex == MAX_QUEUED_SERVICE_RESPONSES) {
381                 qIndex = 0;
382             }
383             
384             /* Higher priority receive task will retrieve response */
385         }  
387         memcpy((void *)respInfo, (void *)&responseInfoQueue[qIndex], sizeof(Rm_ServiceRespInfo));
388         memset((void *)&responseInfoQueue[qIndex], 0, sizeof(Rm_ServiceRespInfo));
389     }
392 void setRmRequest(Rm_ServiceReqInfo *reqInfo, Rm_ServiceType type, const char *resName, int32_t resBase,
393                   uint32_t resLen, int32_t resAlign, const char *nsName, int setCallback, Rm_ServiceRespInfo *respInfo)
394 {                                                                                
395     memset((void *)reqInfo, 0, sizeof(Rm_ServiceReqInfo));                                        
396     reqInfo->type = type;                                                                           
397     reqInfo->resourceName = resName;                                                                
398     reqInfo->resourceBase = resBase;                                                                
399     reqInfo->resourceLength = resLen;                                                               
400     reqInfo->resourceAlignment = resAlign;                                                          
401     reqInfo->resourceNsName = nsName;
402     if (setCallback) {
403         reqInfo->callback.serviceCallback = serviceCallback;  
404     }
405     memset((void *)respInfo, 0, sizeof(Rm_ServiceRespInfo));                                     
408 void rmCleanupTsk(UArg arg0, UArg arg1)
410     int32_t result;
411     
412     /* Delete the RM test tasks */
413     System_printf("Core %d: Deleting RM startup task...\n", coreNum);
414     if (rmStartupTskHandle) {
415        Task_delete(&rmStartupTskHandle);
416        /* Set the task handle to be NULL so that the delete only occurs once */
417        rmStartupTskHandle = NULL;
418     }  
419     
420     if (coreNum == 0) {
421         if (rmServerTskHandle) {
422             System_printf("Core %d: Deleting RM server task...\n", coreNum);
423             Task_delete(&rmServerTskHandle);
424             /* Set the task handle to be NULL so that the delete only occurs once */
425             rmServerTskHandle = NULL;
426         }
427     }
428     else if (coreNum == 1) {
429         if (rmClientTskHandle) {
430             System_printf("Core %d: Deleting RM client task...\n", coreNum);        
431             Task_delete(&rmClientTskHandle);
432             /* Set the task handle to be NULL so that the delete only occurs once */
433             rmClientTskHandle = NULL;
434         }
435     }
436     
437     /* Delete the RM receive task */
438     System_printf("Core %d: Deleting RM receive task...\n", coreNum);
439     if (rmReceiveTskHandle) {
440         Task_delete(&rmReceiveTskHandle);
441         /* Set the task handle to be NULL so that the delete only occurs once */
442         rmReceiveTskHandle = NULL;
443     }
445     /* Cleanup all service ports, transport handles, RM instances, and IPC constructs */
446     if (coreNum == 0) {
447         Rm_serviceCloseHandle(rmServerServiceHandle);
449         Rm_transportUnregister(rmTransportMap[SERVER_TO_CD_MAP_ENTRY].transportHandle);
451         result = Rm_delete(rmServerHandle, RM_TEST_TRUE);
452         if (result != RM_OK) {
453             System_printf("Core %d: RM server instance delete failed with error %d\n", coreNum, result);
454         }        
455     }
456     else if (coreNum == 1) {
457         Rm_serviceCloseHandle(rmCdServiceHandle);
458         Rm_serviceCloseHandle(rmClientServiceHandle);
460         Rm_transportUnregister(rmTransportMap[CD_TO_SERVER_MAP_ENTRY].transportHandle);
461         Rm_transportUnregister(rmTransportMap[CD_TO_CLIENT_MAP_ENTRY].transportHandle);
462         Rm_transportUnregister(rmTransportMap[CLIENT_TO_CD_MAP_ENTRY].transportHandle);
464         result = Rm_delete(rmCdHandle, RM_TEST_TRUE);
465         if (result != RM_OK) {
466             System_printf("Core %d: RM cd instance delete failed with error %d\n", coreNum, result);
467         }  
468         result = Rm_delete(rmClientHandle, RM_TEST_TRUE);
469         if (result != RM_OK) {
470             System_printf("Core %d: RM client instance delete failed with error %d\n", coreNum, result);
471         }          
472     }
474     BIOS_exit(0);
477 /* Receive task has priority of 2 so that it pre-empts the RM instance test tasks */
478 void rmReceiveTsk(UArg arg0, UArg arg1)
480     while(1) {
481         if (coreNum == 0) {
482             transportReceive(SERVER_TO_CD_MAP_ENTRY);
483         }
484         else if (coreNum == 1) {
485             transportReceive(CD_TO_SERVER_MAP_ENTRY);
486             transportReceive(CD_TO_CLIENT_MAP_ENTRY);
487             transportReceive(CLIENT_TO_CD_MAP_ENTRY);
488         }
489         /* Sleep for 1ms so that the main test tasks can run */
490         Task_sleep(1);
491     }
494 void rmServerTsk(UArg arg0, UArg arg1)
496     Rm_ServiceReqInfo  requestInfo;
497     Rm_ServiceRespInfo responseInfo;
498     Task_Params        taskParams;
500     Rm_instanceStatus(rmServerHandle);
502     /* BEGIN testing UNSPECIFIED base and alignment requests on Server */               
503     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
504                  RM_RESOURCE_BASE_UNSPECIFIED, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);       
505     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
506     System_printf("Core %d : %s use allocation of %s UNSPECIFIED base %d length %d alignment : ", coreNum,
507                                                                                                   rmServerName,
508                                                                                                   resourceNameGpQ,
509                                                                                                   requestInfo.resourceLength, 
510                                                                                                   requestInfo.resourceAlignment);
511     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
512         System_printf("PASSED\n");
513     }
514     else {
515         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
516     }    
517                
518     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
519                  RM_RESOURCE_BASE_UNSPECIFIED, 1, RM_RESOURCE_ALIGNMENT_UNSPECIFIED, NULL, RM_TEST_TRUE, &responseInfo);     
520     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);  
521     System_printf("Core %d : %s use allocation of %s UNSPECIFIED base %d length UNSPECIFIED alignment : ", coreNum,
522                                                                                                            rmServerName,
523                                                                                                            resourceNameGpQ,
524                                                                                                            requestInfo.resourceLength);
525     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
526         System_printf("PASSED\n");
527     }
528     else {
529         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
530     }     
532     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
533                  RM_RESOURCE_BASE_UNSPECIFIED, 1, 200, NULL, RM_TEST_TRUE, &responseInfo);     
534     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
535     System_printf("Core %d : %s use allocation of %s UNSPECIFIED base %d length %d alignment : ", coreNum,
536                                                                                                   rmServerName,
537                                                                                                   resourceNameGpQ,
538                                                                                                   requestInfo.resourceLength,
539                                                                                                   requestInfo.resourceAlignment);
540     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
541         System_printf("PASSED\n");
542     }
543     else {
544         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
545     }      
546     /* END testing UNSPECIFIED base and alignment requests on Server */      
548     /* Create new NameServer object */                
549     setRmRequest(&requestInfo, Rm_service_RESOURCE_MAP_TO_NAME, resourceNameGpQ, 
550                  1002, 1, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
551     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo); 
552     System_printf("Core %d : %s create name %s tied to %s %d - %d : ", coreNum,
553                                                                        rmServerName,
554                                                                        nameServerNameFavQ,
555                                                                        responseInfo.resourceName,
556                                                                        requestInfo.resourceBase, 
557                                                                        (requestInfo.resourceBase + requestInfo.resourceLength - 1));                                                                       
558     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
559         System_printf("PASSED\n");
560     }
561     else {
562         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
563     }     
565     /* Wait for CD and Client retrieve resource via name, allocate the resource, free resource via name, and 
566      * delete the NameServer object. */
567     gateKey = GateMP_enter(gateHandle);
568     GateMP_leave(gateHandle, gateKey);
570     /* Try to allocate the memory region taken by the Linux Kernel and not specified as shared */
571     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameMemRegion, 
572                  12, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
573     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo); 
574     System_printf("Core %d : %s use allocation of %s %d - %d : ", coreNum,
575                                                                   rmServerName,
576                                                                   resourceNameMemRegion,
577                                                                   requestInfo.resourceBase, 
578                                                                   (requestInfo.resourceBase + requestInfo.resourceLength - 1));
579     if (responseInfo.serviceState != RM_SERVICE_APPROVED) {        
580         System_printf("PASSED : denial or error : %d\n", responseInfo.serviceState);
581     }
582     else {
583         System_printf("FAILED\n");
584     }    
586     /* BEGIN testing expansion/contraction of resource nodes with the AIF RX CH resource */
587     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAifRxCh, 
588                  14, 5, 0, NULL, RM_TEST_TRUE, &responseInfo);       
589     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
590     System_printf("Core %d : %s use allocation of %s %d - %d : ", coreNum,
591                                                                   rmServerName,
592                                                                   resourceNameAifRxCh,
593                                                                   requestInfo.resourceBase, 
594                                                                   (requestInfo.resourceBase + requestInfo.resourceLength - 1));
595     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
596         System_printf("PASSED\n");
597     }
598     else {
599         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
600     } 
601     
602     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAifRxCh, 
603                  19, 31, 0, NULL, RM_TEST_TRUE, &responseInfo);      
604     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
605     System_printf("Core %d : %s use allocation of %s %d - %d : ", coreNum,
606                                                                   rmServerName,
607                                                                   resourceNameAifRxCh,
608                                                                   requestInfo.resourceBase, 
609                                                                   (requestInfo.resourceBase + requestInfo.resourceLength - 1));
610     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
611         System_printf("PASSED\n");
612     }
613     else {
614         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
615     }        
616     
617     /* Wait for Client and Client Delegate to do their allocations */
618     gateKey = GateMP_enter(gateHandle);
619     GateMP_leave(gateHandle, gateKey);       
621     setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifRxCh, 
622                  25, 3, 0, NULL, RM_TEST_TRUE, &responseInfo);      
623     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);  
624     System_printf("Core %d : %s free of %s %d - %d : ", coreNum,
625                                                         rmServerName,
626                                                         resourceNameAifRxCh,
627                                                         requestInfo.resourceBase, 
628                                                         (requestInfo.resourceBase + requestInfo.resourceLength - 1));
629     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
630         System_printf("PASSED\n");
631     }
632     else {
633         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
634     }      
635     
636     setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifRxCh, 
637                  34, 3, 0, NULL, RM_TEST_TRUE, &responseInfo);      
638     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
639     System_printf("Core %d : %s free of %s %d - %d : ", coreNum,
640                                                         rmServerName,
641                                                         resourceNameAifRxCh,
642                                                         requestInfo.resourceBase, 
643                                                         (requestInfo.resourceBase + requestInfo.resourceLength - 1));
644     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
645         System_printf("PASSED\n");
646     }
647     else {
648         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
649     }      
650  
651     setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, resourceNameAifRxCh, 
652                  28, 6, 0, NULL, RM_TEST_TRUE, &responseInfo);      
653     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);   
654     System_printf("Core %d : %s free of %s %d - %d : ", coreNum,
655                                                         rmServerName,
656                                                         resourceNameAifRxCh,
657                                                         requestInfo.resourceBase, 
658                                                         (requestInfo.resourceBase + requestInfo.resourceLength - 1));
659     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
660         System_printf("PASSED\n");
661     }
662     else {
663         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
664     }      
666     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAifRxCh, 
667                  53, 2, 0, NULL, RM_TEST_TRUE, &responseInfo);      
668     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);  
669     System_printf("Core %d : %s use allocation of %s %d - %d : ", coreNum,
670                                                                   rmServerName,
671                                                                   resourceNameAifRxCh,
672                                                                   requestInfo.resourceBase, 
673                                                                   (requestInfo.resourceBase + requestInfo.resourceLength - 1));
674     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
675         System_printf("PASSED\n");
676     }
677     else {
678         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
679     }  
680     /* END testing expansion/contraction of resource nodes with the AIF RX CH resource */  
681     
682     /* Test execlusive rights to an allocated resource */
683     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAifRxCh, 
684                  2, 2, 0, NULL, RM_TEST_TRUE, &responseInfo);      
685     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
686     System_printf("Core %d : %s use allocation of %s %d - %d : ", coreNum,
687                                                                   rmServerName,
688                                                                   resourceNameAifRxCh,
689                                                                   requestInfo.resourceBase, 
690                                                                   (requestInfo.resourceBase + requestInfo.resourceLength - 1));
691     if (responseInfo.serviceState != RM_SERVICE_APPROVED) {
692         System_printf("PASSED : denial or error : %d\n", responseInfo.serviceState);
693     }
694     else {
695         System_printf("FAILED\n");
696     }      
698     /* Wait for Client and Client Delegate to do their UNSPECIFIED allocates */
699     gateKey = GateMP_enter(gateHandle);
700     GateMP_leave(gateHandle, gateKey);
702     /* Test allocation of a resource twice from the same instance with init and use privileges.  Both
703      * should be approved but the instance should only be mentioned once in the resource's owner list */
704     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ, 
705                  6543, 10, 0, NULL, RM_TEST_TRUE, &responseInfo);      
706     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);  
707     System_printf("Core %d : %s init allocation of %s %d - %d : ", coreNum,
708                                                                    rmServerName,
709                                                                    resourceNameGpQ,
710                                                                    requestInfo.resourceBase, 
711                                                                    (requestInfo.resourceBase + requestInfo.resourceLength - 1));
712     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
713         System_printf("PASSED\n");
714     }
715     else {
716         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
717     }     
719     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
720                  6543, 10, 0, NULL, RM_TEST_TRUE, &responseInfo);      
721     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
722     System_printf("Core %d : %s use allocation of %s %d - %d : ", coreNum,
723                                                                   rmServerName,
724                                                                   resourceNameGpQ,
725                                                                   requestInfo.resourceBase, 
726                                                                   (requestInfo.resourceBase + requestInfo.resourceLength - 1));
727     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
728         System_printf("PASSED\n");
729     }
730     else {
731         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
732     }        
734     /* Allocate infrastructure queue taken by Linux kernel and shared with Rm_Client.  Expect error or denial. */
735     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameInfraQ, 
736                  805, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
737     rmServerServiceHandle->Rm_serviceHandler(rmServerServiceHandle->rmHandle, &requestInfo, &responseInfo);
738     System_printf("Core %d : %s init allocation of %s %d - %d : ", coreNum,
739                                                                    rmServerName,
740                                                                    resourceNameInfraQ,
741                                                                    requestInfo.resourceBase, 
742                                                                    (requestInfo.resourceBase + requestInfo.resourceLength - 1));
743     if (responseInfo.serviceState != RM_SERVICE_APPROVED) {        
744         System_printf("PASSED : denial or error : %d\n", responseInfo.serviceState);
745     }
746     else {
747         System_printf("FAILED\n");
748     }              
750     System_printf("Core %d: Testing is complete\n", coreNum);
752     Rm_instanceStatus(rmServerHandle);
753     Rm_resourceStatus(rmServerHandle, RM_TEST_TRUE);   
754     
755     /* Create the RM cleanup task. */
756     System_printf("Core %d: Creating RM cleanup task...\n", coreNum);
757     Task_Params_init (&taskParams);
758     Task_create (rmCleanupTsk, &taskParams, NULL);
761 void rmClientTsk(UArg arg0, UArg arg1)
763     Rm_ServiceReqInfo  requestInfo;
764     Rm_ServiceRespInfo responseInfo;    
765     Task_Params        taskParams;
766     uint32_t           i, j;
768     Rm_instanceStatus(rmCdHandle);
769     Rm_instanceStatus(rmClientHandle);
771     /* Retrieve a resource via a NameServer name */
772     setRmRequest(&requestInfo, Rm_service_RESOURCE_GET_BY_NAME, NULL, 
773                  0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
774     rmCdServiceHandle->Rm_serviceHandler(rmCdServiceHandle->rmHandle, &requestInfo, &responseInfo);
775     System_printf("Core %d : %s get resource with name %s : ", coreNum,
776                                                                rmCdName,
777                                                                nameServerNameFavQ);
778     if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
779         waitForResponse(&responseInfo);
780     }
781     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
782         System_printf("PASSED\n");
783     }
784     else {
785         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
786     } 
788     /* Allocate the resource returned from the NameServer request */
789     memset((void *)&requestInfo, 0, sizeof(Rm_ServiceReqInfo)); 
790     requestInfo.type = Rm_service_RESOURCE_ALLOCATE_INIT;
791     requestInfo.resourceName = responseInfo.resourceName;
792     requestInfo.resourceBase = responseInfo.resourceBase;
793     requestInfo.resourceLength = responseInfo.resourceLength;
794     requestInfo.resourceNsName = NULL;
795     requestInfo.callback.serviceCallback = serviceCallback;     
796     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
797     System_printf("Core %d : %s init allocation of %s %d - %d : ", coreNum,
798                                                                    rmClientName,
799                                                                    responseInfo.resourceName,
800                                                                    requestInfo.resourceBase, 
801                                                                    (requestInfo.resourceBase + requestInfo.resourceLength - 1));
802     if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
803         waitForResponse(&responseInfo);
804     }
805     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
806         System_printf("PASSED\n");
807     }
808     else {
809         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
810     }    
812     /* Free resource via a NameServer name */
813     setRmRequest(&requestInfo, Rm_service_RESOURCE_FREE, NULL, 
814                  0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
815     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
816     System_printf("Core %d : %s free resource with name %s : ", coreNum,
817                                                                 rmClientName,
818                                                                 nameServerNameFavQ);
819     if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
820         waitForResponse(&responseInfo);
821     }
822     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
823         System_printf("PASSED\n");
824     }
825     else {
826         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
827     }      
829     /* Delete the NameServer name */
830     setRmRequest(&requestInfo, Rm_service_RESOURCE_UNMAP_NAME, NULL, 
831                  0, 0, 0, nameServerNameFavQ, RM_TEST_TRUE, &responseInfo);     
832     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);     
833     System_printf("Core %d : %s delete name %s : ", coreNum,
834                                                     rmClientName,
835                                                     nameServerNameFavQ);
836     if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
837         waitForResponse(&responseInfo);
838     }
839     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
840         System_printf("PASSED\n");
841     }
842     else {
843         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
844     }     
846     GateMP_leave(gateHandle, gateKey);
847     gateKey = GateMP_enter(gateHandle);
849     /* BEGIN testing expansion/contraction of resource nodes with the AIF RX CH resource */
850     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAifRxCh, 
851                  0, 6, 0, NULL, RM_TEST_TRUE, &responseInfo);     
852     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
853     System_printf("Core %d : %s use allocation of %s %d - %d : ", coreNum,
854                                                                   rmClientName,
855                                                                   resourceNameAifRxCh,
856                                                                   requestInfo.resourceBase, 
857                                                                   (requestInfo.resourceBase + requestInfo.resourceLength - 1));
858     if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
859         waitForResponse(&responseInfo);
860     }
861     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
862         System_printf("PASSED\n");
863     }
864     else {
865         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
866     }     
867     
868     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameAifRxCh, 
869                  50, 7, 0, NULL, RM_TEST_TRUE, &responseInfo);        
870     rmCdServiceHandle->Rm_serviceHandler(rmCdServiceHandle->rmHandle, &requestInfo, &responseInfo);
871     System_printf("Core %d : %s init allocation of %s %d - %d : ", coreNum,
872                                                                    rmCdName,
873                                                                    resourceNameAifRxCh,
874                                                                    requestInfo.resourceBase, 
875                                                                    (requestInfo.resourceBase + requestInfo.resourceLength - 1));
876     if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
877         waitForResponse(&responseInfo);
878     }
879     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
880         System_printf("PASSED\n");
881     }
882     else {
883         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
884     }       
885     /* END testing expansion/contraction of resource nodes with the AIF RX CH resource */
887     GateMP_leave(gateHandle, gateKey);    
888     gateKey = GateMP_enter(gateHandle);
890     /* BEGIN testing allocations with UNSPECIFIED base and alignment values */
891     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh, 
892                  RM_RESOURCE_BASE_UNSPECIFIED, 5, 4, NULL, RM_TEST_TRUE, &responseInfo);        
893     rmCdServiceHandle->Rm_serviceHandler(rmCdServiceHandle->rmHandle, &requestInfo, &responseInfo);
894     System_printf("Core %d : %s use allocation of %s UNSPECIFIED base %d length %d alignment : ", coreNum,
895                                                                                                   rmCdName,
896                                                                                                   resourceNameAccumCh,
897                                                                                                   requestInfo.resourceLength, 
898                                                                                                   requestInfo.resourceAlignment);
899     if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
900         waitForResponse(&responseInfo);
901     }
902     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
903         System_printf("PASSED\n");
904     }
905     else {
906         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
907     }        
909     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh, 
910                  RM_RESOURCE_BASE_UNSPECIFIED, 2, 1, NULL, RM_TEST_TRUE, &responseInfo);      
911     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo); 
912     System_printf("Core %d : %s use allocation of %s UNSPECIFIED base %d length %d alignment : ", coreNum,
913                                                                                                   rmClientName,
914                                                                                                   resourceNameAccumCh,
915                                                                                                   requestInfo.resourceLength, 
916                                                                                                   requestInfo.resourceAlignment);
917     if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
918         waitForResponse(&responseInfo);
919     }
920     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
921         System_printf("PASSED\n");
922     }
923     else {
924         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
925     }     
927     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameAccumCh, 
928                  RM_RESOURCE_BASE_UNSPECIFIED, 2, RM_RESOURCE_ALIGNMENT_UNSPECIFIED, NULL, RM_TEST_TRUE, &responseInfo);     
929     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
930     System_printf("Core %d : %s use allocation of %s UNSPECIFIED base %d length UNSPECIFIED alignment : ", coreNum,
931                                                                                                            rmClientName,
932                                                                                                            resourceNameAccumCh,
933                                                                                                            requestInfo.resourceLength);
934     if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
935         waitForResponse(&responseInfo);
936     }
937     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
938         System_printf("PASSED\n");
939     }
940     else {
941         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
942     }     
943     /* END testing allocations with UNSPECIFIED base and alignment values */    
945     /* Allocate infrastructure queue shared between Linux kernel and Client */
946     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameInfraQ, 
947                  800, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);     
948     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
949     System_printf("Core %d : %s init allocation of %s %d - %d : ", coreNum,
950                                                                    rmClientName,
951                                                                    resourceNameInfraQ,
952                                                                    requestInfo.resourceBase, 
953                                                                    (requestInfo.resourceBase + requestInfo.resourceLength - 1));
954     if (responseInfo.serviceState == RM_SERVICE_PROCESSING) {
955         waitForResponse(&responseInfo);
956     }
957     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
958         System_printf("PASSED\n");
959     }
960     else {
961         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
962     }     
964     /* BEGIN Allocating some resources without providing a callback function.  RM should block and not return until the result
965      * is returned by the server. */
966     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ, 
967                  7000, 1, 0, NULL, FALSE, &responseInfo);     
968     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);   
969     System_printf("Core %d : %s init allocation (without callback specified) of %s %d - %d : ", coreNum,
970                                                                                                 rmClientName,
971                                                                                                 resourceNameGpQ,
972                                                                                                 requestInfo.resourceBase, 
973                                                                                                 (requestInfo.resourceBase + requestInfo.resourceLength - 1));
974     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
975         System_printf("PASSED\n");
976     }
977     else {
978         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
979     }   
981     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
982                  7005, 25, 0, NULL, FALSE, &responseInfo);     
983     rmCdServiceHandle->Rm_serviceHandler(rmCdServiceHandle->rmHandle, &requestInfo, &responseInfo);   
984     System_printf("Core %d : %s use allocation (without callback specified) of %s %d - %d : ", coreNum,
985                                                                                                rmCdName,
986                                                                                                resourceNameGpQ,
987                                                                                                requestInfo.resourceBase, 
988                                                                                                (requestInfo.resourceBase + requestInfo.resourceLength - 1));
989     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
990         System_printf("PASSED\n");
991     }
992     else {
993         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
994     }
995     
996     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_USE, resourceNameGpQ, 
997                  7010, 5, 0, NULL, FALSE, &responseInfo);     
998     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);   
999     System_printf("Core %d : %s use allocation (without callback specified) of %s %d - %d : ", coreNum,
1000                                                                                                rmClientName,
1001                                                                                                resourceNameGpQ,
1002                                                                                                requestInfo.resourceBase, 
1003                                                                                                (requestInfo.resourceBase + requestInfo.resourceLength - 1));
1004     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
1005         System_printf("PASSED\n");
1006     }
1007     else {
1008         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
1009     }
1011     /* Init allocation of resource already owned by Client should return approved and the resource should
1012      * only be shown as allocated once to the instance in the resource print out */
1013     setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameGpQ, 
1014                  7011, 1, 0, NULL, FALSE, &responseInfo);     
1015     rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);   
1016     System_printf("Core %d : %s use allocation (without callback specified) of %s %d - %d : ", coreNum,
1017                                                                                                rmClientName,
1018                                                                                                resourceNameGpQ,
1019                                                                                                requestInfo.resourceBase, 
1020                                                                                                (requestInfo.resourceBase + requestInfo.resourceLength - 1));
1021     if (responseInfo.serviceState == RM_SERVICE_APPROVED) {
1022         System_printf("PASSED\n");
1023     }
1024     else {
1025         System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
1026     }
1027     /* END Allocating some resources without providing a callback function.  RM should block and not return until the result
1028      * is returned by the server. */    
1030     GateMP_leave(gateHandle, gateKey);           
1032     /* Verify static allocations were validated.  Validation responses should have been received after the
1033      * first service requests were made on the Client and CD post transport path registration. */
1034     while (numStaticResponses > 0) {
1035         /* Loop until all static request validations have been received */
1036         for (i = 0; i < MAX_STATIC_ALLOCATION_RESPS; i++) {
1037             if (staticResponseQueue[i].serviceId != 0) {            
1038                 for (j = 0; j < MAX_QUEUED_SERVICE_RESPONSES; j++) {
1039                     if ((staticResponseQueue[i].serviceId == responseInfoQueue[j].serviceId) &&
1040                         (staticResponseQueue[i].rmHandle == responseInfoQueue[j].rmHandle)) {
1041                         System_printf("Core %d : static allocation validation of %s %d - %d : ", coreNum,
1042                                                                                                  responseInfoQueue[j].resourceName,
1043                                                                                                  responseInfoQueue[j].resourceBase, 
1044                                                                                                  (responseInfoQueue[j].resourceBase + responseInfoQueue[j].resourceLength - 1));        
1045                         if (responseInfoQueue[j].serviceState == RM_SERVICE_APPROVED) {
1046                             System_printf("PASSED\n");
1047                         }
1048                         else {
1049                             System_printf("FAILED : denial or error : %d\n", responseInfoQueue[j].serviceState);
1050                         }  
1051                         memset((void *)&staticResponseQueue[i], 0, sizeof(Rm_ServiceRespInfo));
1052                         memset((void *)&responseInfoQueue[j], 0, sizeof(Rm_ServiceRespInfo));
1053                         numStaticResponses--;                        
1054                         break;
1055                     }
1056                 }
1057             }
1058         }    
1059     }   
1062     System_printf("Core %d: Testing is complete\n", coreNum);
1064     Rm_instanceStatus(rmCdHandle);
1065     Rm_instanceStatus(rmClientHandle);
1066     
1067     /* Create the RM cleanup task. */
1068     System_printf("Core %d: Creating RM cleanup task...\n", coreNum);
1069     Task_Params_init (&taskParams);
1070     Task_create (rmCleanupTsk, &taskParams, NULL);
1073 void rmStartupTsk(UArg arg0, UArg arg1)
1075     MessageQ_Handle    serverFromCdMsgQ, cdFromServerMsgQ, cdFromClientMsgQ, clientFromCdMsgQ;
1076     MessageQ_QueueId   serverToCdQId, cdToServerQId, cdToClientQId, clientToCdQId;    
1077     Int                status, i;
1078     GateMP_Params      gateParams;    
1079     HeapBufMP_Handle   msgQHeapHandle;
1080     HeapBufMP_Params   heapBufParams;
1081     Rm_TransportCfg    rmTransportCfg;
1082     int32_t            result = 0;
1083     Rm_TransportHandle serverCdHandle, cdServerHandle, cdClientHandle, clientCdHandle;
1084     Task_Params        taskParams;
1086     /* Initialize the transport map */
1087     for (i = 0; i < MAX_MAPPING_ENTRIES; i++) {
1088         rmTransportMap[i].transportHandle = NULL;
1089     } 
1091     if (coreNum == 0) {
1092         GateMP_Params_init(&gateParams);
1093         gateParams.name = RM_TASK_GATE_NAME;
1094         gateHandle = GateMP_create(&gateParams);
1095         
1096         /* Create the heap that will be used to allocate RM messages. This
1097          * heap is a multi-processor heap.  It will be shared amongst
1098          * all RM instances. */     
1099         HeapBufMP_Params_init(&heapBufParams);
1100         heapBufParams.regionId       = 0;
1101         heapBufParams.name           = RM_PKT_HEAP_NAME;
1102         heapBufParams.numBlocks      = 64;
1103         heapBufParams.blockSize      = sizeof(Rm_Packet);
1104         rmPktHeapHandle = HeapBufMP_create(&heapBufParams);
1105         if (rmPktHeapHandle == NULL) {
1106             System_abort("HeapBufMP_create failed for RM packet heap\n" );
1107         }
1108         System_printf("Core %d: RM packet heap created\n", coreNum);
1110         /* Create the heap that will be used to allocate messageQ messages. */     
1111         HeapBufMP_Params_init(&heapBufParams);
1112         heapBufParams.regionId       = 0;
1113         heapBufParams.name           = MSGQ_HEAP_NAME;
1114         heapBufParams.numBlocks      = 64;
1115         heapBufParams.blockSize      = sizeof(MsgQ_RmPacket);
1116         msgQHeapHandle = HeapBufMP_create(&heapBufParams);
1117         if (msgQHeapHandle == NULL) {
1118             System_abort("HeapBufMP_create failed MessageQ message heap\n" );
1119         } 
1120         System_printf("Core %d: IPC MessageQ message heap created\n", coreNum);
1121     }
1122     else {
1123         do {
1124             status = GateMP_open(RM_TASK_GATE_NAME, &gateHandle);
1125             /* 
1126              *  Sleep for 1 clock tick to avoid inundating remote processor
1127              *  with interrupts if open failed
1128              */
1129             if (status < 0) { 
1130                 Task_sleep(1);
1131             }
1132         } while (status < 0);
1133         /* Take the gate right away to prepare for RM testing */
1134         gateKey = GateMP_enter(gateHandle);
1135         
1136         /* Open the heaps created by the other processor. Loop until opened. */
1137         do {
1138             status = HeapBufMP_open(RM_PKT_HEAP_NAME, &rmPktHeapHandle);
1139             /* 
1140              *  Sleep for 1 clock tick to avoid inundating remote processor
1141              *  with interrupts if open failed
1142              */
1143             if (status < 0) { 
1144                 Task_sleep(1);
1145             }
1146         } while (status < 0);
1147         System_printf("Core %d: RM packet heap opened\n", coreNum);
1148         
1149         do {
1150             status = HeapBufMP_open(MSGQ_HEAP_NAME, &msgQHeapHandle);
1151             /* 
1152              *  Sleep for 1 clock tick to avoid inundating remote processor
1153              *  with interrupts if open failed
1154              */
1155             if (status < 0) { 
1156                 Task_sleep(1);
1157             }
1158         } while (status < 0);
1159         System_printf("Core %d: IPC MessageQ message heap opened\n", coreNum);
1160     }
1161     
1162     /* Register the MessageQ heap with MessageQ */
1163     MessageQ_registerHeap(msgQHeapHandle, MSGQ_HEAP_ID);
1165     /* Create the messageQ's for each RM instance connection
1166      * Need four queues.  Topology will be:
1167      * RM Server <---> RM Client Delegate <---> RM Client 
1168      * 1 queues on RM Server
1169      * 2 queues on RM Client Delegate
1170      * 1 queues on RM Client */
1171     if (coreNum == 0) {
1172         serverFromCdMsgQ = MessageQ_create(serverFromCdQueueName, NULL);
1173         if (serverFromCdMsgQ == NULL) {
1174             System_abort("MessageQ_create failed for RM Server - Client Delegate queue\n" );
1175         }
1176         System_printf("Core %d: RM Server MessageQ created for receiving packets from RM CD\n", coreNum);
1177     }
1178     else if (coreNum == 1) {
1179         cdFromServerMsgQ = MessageQ_create(cdFromServerQueueName, NULL);
1180         if (cdFromServerMsgQ == NULL) {
1181             System_abort("MessageQ_create failed for RM Client Delegate - Server queue\n" );
1182         }
1183         System_printf("Core %d: RM CD MessageQ created for receiving packets from RM Server\n", coreNum);
1184         
1185         cdFromClientMsgQ = MessageQ_create(cdFromClientQueueName, NULL);
1186         if (cdFromClientMsgQ == NULL) {
1187             System_abort("MessageQ_create failed for RM Client Delegate - Client queue\n" );
1188         } 
1189         System_printf("Core %d: RM CD MessageQ created for receiving packets from RM Client\n", coreNum);
1190         
1191         clientFromCdMsgQ = MessageQ_create(clientFromCdQueueName, NULL);
1192         if (clientFromCdMsgQ == NULL) 
1193         {
1194             System_abort("MessageQ_create failed for RM Client - Client Delegate queue\n" );
1195         }
1196         System_printf("Core %d: RM Client MessageQ created for receiving packets from RM CD\n", coreNum);
1197     }
1198     
1199     /* Open the remote message queues. Also register the RM transports with each RM instance */
1200     if (coreNum == 0) {
1201         /* Open the Client Delegate messageQ from the Server */
1202         do {
1203             status = MessageQ_open(cdFromServerQueueName, &serverToCdQId); 
1204             /* 
1205              *  Sleep for 1 clock tick to avoid inundating remote processor
1206              *  with interrupts if open failed
1207              */
1208             if (status < 0) { 
1209                 Task_sleep(1);
1210             }
1211         } while (status < 0);
1212         System_printf("Core %d: RM CD MessageQ opened from RM Server\n", coreNum);
1214         /* Register the Client Delegate with the RM Server Instance */
1215         rmTransportCfg.rmHandle = rmServerHandle;
1216         rmTransportCfg.appTransportHandle = (Rm_AppTransportHandle) serverToCdQId;
1217         rmTransportCfg.remoteInstType = Rm_instType_CLIENT_DELEGATE;
1218         rmTransportCfg.remoteInstName = &rmCdName[0];
1219         rmTransportCfg.transportCallouts.rmAllocPkt = transportAlloc;
1220         rmTransportCfg.transportCallouts.rmSendPkt = transportSend;
1221         serverCdHandle = Rm_transportRegister(&rmTransportCfg, &result);
1223         /* Store the mapping information in the transport map */
1224         rmTransportMap[SERVER_TO_CD_MAP_ENTRY].transportHandle = serverCdHandle;
1225         rmTransportMap[SERVER_TO_CD_MAP_ENTRY].receiveMsgQ = serverFromCdMsgQ;
1226         System_printf("Core %d: Registered RM Server <=> RM CD transport with RM Server instance\n", coreNum);
1227     }
1228     else if (coreNum == 1) {
1229         /* Open the Server messageQ from the Client Delegate */
1230         do {
1231             status = MessageQ_open(serverFromCdQueueName, &cdToServerQId); 
1232             /* 
1233              *  Sleep for 1 clock tick to avoid inundating remote processor
1234              *  with interrupts if open failed
1235              */
1236             if (status < 0) { 
1237                 Task_sleep(1);
1238             }
1239         } while (status < 0);
1240         System_printf("Core %d: RM Server MessageQ opened from RM CD\n", coreNum);
1242         /* Register the Server with the RM Client Delegate Instance */
1243         rmTransportCfg.rmHandle = rmCdHandle;
1244         rmTransportCfg.appTransportHandle = (Rm_AppTransportHandle) cdToServerQId;
1245         rmTransportCfg.remoteInstType = Rm_instType_SERVER;
1246         rmTransportCfg.remoteInstName = &rmServerName[0];
1247         rmTransportCfg.transportCallouts.rmAllocPkt = transportAlloc;
1248         rmTransportCfg.transportCallouts.rmSendPkt = transportSend;
1249         cdServerHandle = Rm_transportRegister(&rmTransportCfg, &result);
1251         /* Store the mapping information in the transport map */
1252         rmTransportMap[CD_TO_SERVER_MAP_ENTRY].transportHandle = cdServerHandle;
1253         rmTransportMap[CD_TO_SERVER_MAP_ENTRY].receiveMsgQ = cdFromServerMsgQ;
1254         System_printf("Core %d: Registered RM CD <=> RM Server transport with RM CD instance\n", coreNum);
1255         
1256         /* Open the Client messageQ from the Client Delegate */
1257         do {
1258             status = MessageQ_open(clientFromCdQueueName, &cdToClientQId); 
1259             /* 
1260              *  Sleep for 1 clock tick to avoid inundating remote processor
1261              *  with interrupts if open failed
1262              */
1263             if (status < 0) { 
1264                 Task_sleep(1);
1265             }
1266         } while (status < 0);
1267         System_printf("Core %d: RM Client MessageQ opened from RM CD\n", coreNum);
1269         /* Register the Client with the RM Client Delegate Instance */
1270         rmTransportCfg.appTransportHandle = (Rm_AppTransportHandle) cdToClientQId;
1271         rmTransportCfg.remoteInstType = Rm_instType_CLIENT;
1272         rmTransportCfg.remoteInstName = &rmClientName[0];
1273         rmTransportCfg.transportCallouts.rmAllocPkt = transportAlloc;
1274         rmTransportCfg.transportCallouts.rmSendPkt = transportSend;
1275         cdClientHandle = Rm_transportRegister(&rmTransportCfg, &result);
1277         /* Store the mapping information in the transport map */
1278         rmTransportMap[CD_TO_CLIENT_MAP_ENTRY].transportHandle = cdClientHandle;
1279         rmTransportMap[CD_TO_CLIENT_MAP_ENTRY].receiveMsgQ = cdFromClientMsgQ;
1280         System_printf("Core %d: Registered RM CD <=> RM Client transport with RM CD instance\n", coreNum);
1282         /* Open the Client Delegate messageQ from the Client */        
1283         do {
1284             status = MessageQ_open(cdFromClientQueueName, &clientToCdQId); 
1285             /* 
1286              *  Sleep for 1 clock tick to avoid inundating remote processor
1287              *  with interrupts if open failed
1288              */
1289             if (status < 0) { 
1290                 Task_sleep(1);
1291             }
1292         } while (status < 0);
1293         System_printf("Core %d: RM CD MessageQ opened from RM Client\n", coreNum);
1295         /* Register the Client Delegate with the RM Client Instance */
1296         rmTransportCfg.rmHandle = rmClientHandle;
1297         rmTransportCfg.appTransportHandle = (Rm_AppTransportHandle) clientToCdQId;
1298         rmTransportCfg.remoteInstType = Rm_instType_CLIENT_DELEGATE;
1299         rmTransportCfg.remoteInstName = &rmCdName[0];
1300         rmTransportCfg.transportCallouts.rmAllocPkt = transportAlloc;
1301         rmTransportCfg.transportCallouts.rmSendPkt = transportSend;
1302         clientCdHandle = Rm_transportRegister(&rmTransportCfg, &result);
1304         /* Store the mapping information in the transport map */
1305         rmTransportMap[CLIENT_TO_CD_MAP_ENTRY].transportHandle = clientCdHandle;
1306         rmTransportMap[CLIENT_TO_CD_MAP_ENTRY].receiveMsgQ = clientFromCdMsgQ;
1307         System_printf("Core %d: Registered RM Client <=> RM CD transport with RM Client instance\n", coreNum);
1308     }
1310     /* Create the RM receive task.  Assign higher priority than the test tasks so that
1311      * when they spin waiting for messages from other RM instances the receive task is
1312      * executed. */
1313     System_printf("Core %d: Creating RM receive task...\n", coreNum);
1314     Task_Params_init (&taskParams);
1315     taskParams.priority = 2;
1316     rmReceiveTskHandle = Task_create (rmReceiveTsk, &taskParams, NULL);
1317     
1318     /* Create the RM test tasks. */
1319     if (coreNum == 0) {
1320         System_printf("Core %d: Creating RM server task...\n", coreNum);
1321         Task_Params_init (&taskParams);
1322         taskParams.priority = 1;
1323         rmServerTskHandle = Task_create (rmServerTsk, &taskParams, NULL);
1324     }
1325     else if (coreNum) {
1326         System_printf("Core %d: Creating RM client task...\n", coreNum);
1327         Task_Params_init (&taskParams);
1328         taskParams.priority = 1;
1329         rmClientTskHandle = Task_create (rmClientTsk, &taskParams, NULL);
1330     }
1333 int main(Int argc, Char* argv[])
1335     Rm_InitCfg         rmInitCfg;
1336     Task_Params        taskParams; 
1337     int                status;
1338     Rm_ServiceReqInfo  requestInfo;
1339     Rm_ServiceRespInfo responseInfo;
1340     int32_t            result;
1342     System_printf ("*********************************************************\n");
1343     System_printf ("********************** RM Testing ***********************\n");
1344     System_printf ("*********************************************************\n");
1346     System_printf ("RM Version : 0x%08x\nVersion String: %s\n", Rm_getVersion(), Rm_getVersionStr());
1348     coreNum = MultiProc_self();
1350     /* Initialize the RM instances - RM must be initialized before anything else in the system
1351      * Core 0: 1 RM Instance  - RM Server
1352      * Core 1: 2 RM Instances - RM Client Delegate
1353      *                          RM Client
1354      */
1355     if (coreNum == 0) {
1356         /* Create the Server instance */
1357         rmInitCfg.instName = rmServerName;
1358         rmInitCfg.instType = Rm_instType_SERVER;
1359         rmInitCfg.instCfg.serverCfg.globalResourceList = (void *)rmGrl;
1360         rmInitCfg.instCfg.serverCfg.linuxDtb = (void *)rmLinuxDtb;
1361         rmInitCfg.instCfg.serverCfg.globalPolicy = (void *)rmGlobalPolicy;
1362         rmServerHandle = Rm_init(&rmInitCfg, &result);
1363         ERROR_CHECK(RM_OK, result, rmServerName, "Initialization failed");
1365         /* Open Server service handle */
1366         rmServerServiceHandle = Rm_serviceOpenHandle(rmServerHandle, &result);
1367         ERROR_CHECK(RM_OK, result, rmServerName, "Service handle open failed");
1368     }
1369     else if (coreNum == 1) {
1370         /* Create the RM Client Delegate instance */
1371         rmInitCfg.instName = rmCdName;
1372         rmInitCfg.instType = Rm_instType_CLIENT_DELEGATE;
1373         rmInitCfg.instCfg.cdCfg.staticPolicy = (void *)rmStaticPolicy;
1374         rmCdHandle = Rm_init(&rmInitCfg, &result);
1375         ERROR_CHECK(RM_OK, result, rmCdName, "Initialization failed");
1377         /* Open CD service handle */
1378         rmCdServiceHandle = Rm_serviceOpenHandle(rmCdHandle, &result);
1379         ERROR_CHECK(RM_OK, result, rmCdName, "Service handle open failed");
1381         /* Create the RM Client instance */
1382         rmInitCfg.instName = &rmClientName[0];
1383         rmInitCfg.instType = Rm_instType_CLIENT;      
1384         rmInitCfg.instCfg.clientCfg.staticPolicy = (void *)rmStaticPolicy;
1385         rmClientHandle = Rm_init(&rmInitCfg, &result);
1386         ERROR_CHECK(RM_OK, result, rmClientName, "Initialization failed");
1388         /* Open Client service handle */
1389         rmClientServiceHandle = Rm_serviceOpenHandle(rmClientHandle, &result);
1390         ERROR_CHECK(RM_OK, result, rmClientName, "Service handle open failed");
1392         /* Initialize the static allocation response queue */
1393         for (numStaticResponses = 0; numStaticResponses < MAX_STATIC_ALLOCATION_RESPS; numStaticResponses++) {
1394             memset((void *)&staticResponseQueue[numStaticResponses], 0, sizeof(Rm_ServiceRespInfo));
1395         }
1396         numStaticResponses = 0;
1398         /* Static allocation tests */
1399         setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameQosCluster, 
1400                      0, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);
1401         rmCdServiceHandle->Rm_serviceHandler(rmCdServiceHandle->rmHandle, &requestInfo, &responseInfo);
1402         System_printf("Core %d : %s static init allocation of %s %d - %d : ", coreNum,
1403                                                                               rmCdName,
1404                                                                               resourceNameQosCluster,
1405                                                                               requestInfo.resourceBase, 
1406                                                                               (requestInfo.resourceBase + requestInfo.resourceLength - 1));
1407         if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {        
1408             System_printf("PASSED\n");
1409             memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(Rm_ServiceRespInfo));
1410         }
1411         else {
1412             System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
1413         }        
1414         
1415         setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameQosCluster, 
1416                      2, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);        
1417         rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
1418         System_printf("Core %d : %s static init allocation of %s %d - %d : ", coreNum,
1419                                                                               rmClientName,
1420                                                                               resourceNameQosCluster,
1421                                                                               requestInfo.resourceBase, 
1422                                                                               (requestInfo.resourceBase + requestInfo.resourceLength - 1));
1423         if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {        
1424             System_printf("PASSED\n");
1425             memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(Rm_ServiceRespInfo));
1426         }
1427         else {
1428             System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
1429         }
1431         /* Request resource from Client that can only be allocated to CD according to static policy */
1432         setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameQosCluster, 
1433                      1, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);        
1434         rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
1435         System_printf("Core %d : %s static init allocation of %s %d - %d : ", coreNum,
1436                                                                               rmClientName,
1437                                                                               resourceNameQosCluster,
1438                                                                               requestInfo.resourceBase, 
1439                                                                               (requestInfo.resourceBase + requestInfo.resourceLength - 1));
1440         if (responseInfo.serviceState != RM_SERVICE_APPROVED_STATIC) {        
1441             System_printf("PASSED : denial or error : %d\n", responseInfo.serviceState);
1442         }
1443         else {
1444             System_printf("FAILED\n");
1445         }
1447         /* Request resource from both Client and CD that is shared according to static policy */
1448         setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameAifQ, 
1449                      525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);        
1450         rmCdServiceHandle->Rm_serviceHandler(rmCdServiceHandle->rmHandle, &requestInfo, &responseInfo);
1451         System_printf("Core %d : %s static init allocation of %s %d - %d : ", coreNum,
1452                                                                               rmCdName,
1453                                                                               resourceNameAifQ,
1454                                                                               requestInfo.resourceBase, 
1455                                                                               (requestInfo.resourceBase + requestInfo.resourceLength - 1));
1456         if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {        
1457             System_printf("PASSED\n");
1458             memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(Rm_ServiceRespInfo));
1459         }
1460         else {
1461             System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
1462         }
1464         setRmRequest(&requestInfo, Rm_service_RESOURCE_ALLOCATE_INIT, resourceNameAifQ, 
1465                      525, 1, 0, NULL, RM_TEST_TRUE, &responseInfo);        
1466         rmClientServiceHandle->Rm_serviceHandler(rmClientServiceHandle->rmHandle, &requestInfo, &responseInfo);
1467         System_printf("Core %d : %s static init allocation of %s %d - %d : ", coreNum,
1468                                                                               rmClientName,
1469                                                                               resourceNameAifQ,
1470                                                                               requestInfo.resourceBase, 
1471                                                                               (requestInfo.resourceBase + requestInfo.resourceLength - 1));
1472         if (responseInfo.serviceState == RM_SERVICE_APPROVED_STATIC) {        
1473             System_printf("PASSED\n");
1474             memcpy((void *)&staticResponseQueue[numStaticResponses++], (void *)&responseInfo, sizeof(Rm_ServiceRespInfo));
1475         }
1476         else {
1477             System_printf("FAILED : denial or error : %d\n", responseInfo.serviceState);
1478         }    
1479     }
1481     System_printf("Core %d: Starting IPC...\n", coreNum);
1482     status = Ipc_start();
1483     if (status < 0) {
1484         System_abort("Ipc_start failed\n");
1485     }
1487     /* Create the RM startup task */
1488     System_printf("Core %d: Creating RM startup task...\n", coreNum);
1489     Task_Params_init (&taskParams);
1490     rmStartupTskHandle = Task_create (rmStartupTsk, &taskParams, NULL);
1492     System_printf("Core %d: Starting BIOS...\n", coreNum);
1493     BIOS_start();
1495     return (0);