From 7921d769bc60d4ef8a3988505af0572810932017 Mon Sep 17 00:00:00 2001 From: Ming Wei Date: Tue, 27 Jan 2015 19:09:33 -0500 Subject: [PATCH] update copyright info, alignments, delete unused files and code clean up --- .../c66/bios/rmK2EC66DspMtBiosTestProject.txt | 2 - test/k2e/c66/bios/rm_osal.c | 2 +- test/k2e/c66/bios/rm_test_sc.cfg | 5 +- .../c66/bios/rmK2GC66DspMtBiosTestProject.txt | 2 - test/k2g/c66/bios/rm_osal.c | 2 +- test/k2g/c66/bios/rm_test_sc.cfg | 5 +- .../c66/bios/rmK2HC66DspMtBiosTestProject.txt | 2 - test/k2h/c66/bios/rm_osal.c | 2 +- test/k2h/c66/bios/rm_test_sc.cfg | 3 +- .../c66/bios/rmK2KC66DspMtBiosTestProject.txt | 2 - test/k2k/c66/bios/rm_osal.c | 2 +- test/k2k/c66/bios/rm_test_sc.cfg | 7 +- .../c66/bios/rmK2LC66DspMtBiosTestProject.txt | 2 - test/k2l/c66/bios/rm_osal.c | 2 +- test/k2l/c66/bios/rm_test_sc.cfg | 5 +- test/src/rm_dsp_mt_test.c | 476 +++++++++--------- 16 files changed, 239 insertions(+), 282 deletions(-) diff --git a/test/k2e/c66/bios/rmK2EC66DspMtBiosTestProject.txt b/test/k2e/c66/bios/rmK2EC66DspMtBiosTestProject.txt index 61aa02b..dfbf638 100644 --- a/test/k2e/c66/bios/rmK2EC66DspMtBiosTestProject.txt +++ b/test/k2e/c66/bios/rmK2EC66DspMtBiosTestProject.txt @@ -1,8 +1,6 @@ -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/src/rm_dsp_mt_test.c" -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/dts_files/global-resources.c" --ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/dts_files/linux-evm.c" -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/dts_files/server-policy.c" --ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/dts_files/static-policy.c" -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2e/c66/bios/rm_osal.c" -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2e/c66/bios/rm_test_sc.cfg" -ccs.setCompilerOptions "-mv6600 -g -DDEVICE_K2E --diag_warning=225 -I${PDK_INSTALL_PATH}/ti/drv/rm" diff --git a/test/k2e/c66/bios/rm_osal.c b/test/k2e/c66/bios/rm_osal.c index 6bf0d2d..af66f27 100644 --- a/test/k2e/c66/bios/rm_osal.c +++ b/test/k2e/c66/bios/rm_osal.c @@ -6,7 +6,7 @@ * * \par * ============================================================================ - * @n (C) Copyright 2012-2013, Texas Instruments, Inc. + * @n (C) Copyright 2012-2015, Texas Instruments, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/test/k2e/c66/bios/rm_test_sc.cfg b/test/k2e/c66/bios/rm_test_sc.cfg index 570cfd5..24907c5 100644 --- a/test/k2e/c66/bios/rm_test_sc.cfg +++ b/test/k2e/c66/bios/rm_test_sc.cfg @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2013, Texas Instruments Incorporated + * Copyright (c) 2015, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,7 +36,6 @@ var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc'); * Get the list of names that the build device supports. * I.e. ["CORE0", "CORE1", "CORE2" ... ] */ -///var nameList = ["CORE0", "CORE1"]; var nameList = ["CORE0"]; /* @@ -96,7 +95,7 @@ SharedRegion.setEntryMeta(0, }); /* PDK packages */ -var devType = "k2h" +var devType = "k2e" var Csl = xdc.useModule('ti.csl.Settings'); Csl.deviceType = devType; var Rm = xdc.loadPackage('ti.drv.rm'); diff --git a/test/k2g/c66/bios/rmK2GC66DspMtBiosTestProject.txt b/test/k2g/c66/bios/rmK2GC66DspMtBiosTestProject.txt index ab2ff2f..39f7df3 100644 --- a/test/k2g/c66/bios/rmK2GC66DspMtBiosTestProject.txt +++ b/test/k2g/c66/bios/rmK2GC66DspMtBiosTestProject.txt @@ -1,8 +1,6 @@ -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/src/rm_dsp_mt_test.c" -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/dts_files/global-resources.c" --ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/dts_files/linux-evm.c" -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/dts_files/server-policy.c" --ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/dts_files/static-policy.c" -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2g/c66/bios/rm_osal.c" -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2g/c66/bios/rm_test_sc.cfg" -ccs.setCompilerOptions "-mv6600 -g -DDEVICE_K2G --diag_warning=225 -I${PDK_INSTALL_PATH}/ti/drv/rm" diff --git a/test/k2g/c66/bios/rm_osal.c b/test/k2g/c66/bios/rm_osal.c index 6bf0d2d..af66f27 100644 --- a/test/k2g/c66/bios/rm_osal.c +++ b/test/k2g/c66/bios/rm_osal.c @@ -6,7 +6,7 @@ * * \par * ============================================================================ - * @n (C) Copyright 2012-2013, Texas Instruments, Inc. + * @n (C) Copyright 2012-2015, Texas Instruments, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/test/k2g/c66/bios/rm_test_sc.cfg b/test/k2g/c66/bios/rm_test_sc.cfg index 570cfd5..dc33652 100644 --- a/test/k2g/c66/bios/rm_test_sc.cfg +++ b/test/k2g/c66/bios/rm_test_sc.cfg @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2013, Texas Instruments Incorporated + * Copyright (c) 2015, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,7 +36,6 @@ var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc'); * Get the list of names that the build device supports. * I.e. ["CORE0", "CORE1", "CORE2" ... ] */ -///var nameList = ["CORE0", "CORE1"]; var nameList = ["CORE0"]; /* @@ -96,7 +95,7 @@ SharedRegion.setEntryMeta(0, }); /* PDK packages */ -var devType = "k2h" +var devType = "k2g" var Csl = xdc.useModule('ti.csl.Settings'); Csl.deviceType = devType; var Rm = xdc.loadPackage('ti.drv.rm'); diff --git a/test/k2h/c66/bios/rmK2HC66DspMtBiosTestProject.txt b/test/k2h/c66/bios/rmK2HC66DspMtBiosTestProject.txt index ddfd444..4000122 100644 --- a/test/k2h/c66/bios/rmK2HC66DspMtBiosTestProject.txt +++ b/test/k2h/c66/bios/rmK2HC66DspMtBiosTestProject.txt @@ -1,8 +1,6 @@ -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/src/rm_dsp_mt_test.c" -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/dts_files/global-resources.c" --ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/dts_files/linux-evm.c" -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/dts_files/server-policy.c" --ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/dts_files/static-policy.c" -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2h/c66/bios/rm_osal.c" -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2h/c66/bios/rm_test_sc.cfg" -ccs.setCompilerOptions "-mv6600 -g -DDEVICE_K2H --diag_warning=225 -I${PDK_INSTALL_PATH}/ti/drv/rm" diff --git a/test/k2h/c66/bios/rm_osal.c b/test/k2h/c66/bios/rm_osal.c index 6bf0d2d..af66f27 100644 --- a/test/k2h/c66/bios/rm_osal.c +++ b/test/k2h/c66/bios/rm_osal.c @@ -6,7 +6,7 @@ * * \par * ============================================================================ - * @n (C) Copyright 2012-2013, Texas Instruments, Inc. + * @n (C) Copyright 2012-2015, Texas Instruments, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/test/k2h/c66/bios/rm_test_sc.cfg b/test/k2h/c66/bios/rm_test_sc.cfg index 570cfd5..4693f75 100644 --- a/test/k2h/c66/bios/rm_test_sc.cfg +++ b/test/k2h/c66/bios/rm_test_sc.cfg @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2013, Texas Instruments Incorporated + * Copyright (c) 2015, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,7 +36,6 @@ var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc'); * Get the list of names that the build device supports. * I.e. ["CORE0", "CORE1", "CORE2" ... ] */ -///var nameList = ["CORE0", "CORE1"]; var nameList = ["CORE0"]; /* diff --git a/test/k2k/c66/bios/rmK2KC66DspMtBiosTestProject.txt b/test/k2k/c66/bios/rmK2KC66DspMtBiosTestProject.txt index b71fc98..be2bf9f 100644 --- a/test/k2k/c66/bios/rmK2KC66DspMtBiosTestProject.txt +++ b/test/k2k/c66/bios/rmK2KC66DspMtBiosTestProject.txt @@ -1,8 +1,6 @@ -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/src/rm_dsp_mt_test.c" -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/dts_files/global-resources.c" --ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/dts_files/linux-evm.c" -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/dts_files/server-policy.c" --ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/dts_files/static-policy.c" -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2k/c66/bios/rm_osal.c" -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2k/c66/bios/rm_test_sc.cfg" -ccs.setCompilerOptions "-mv6600 -g -DDEVICE_K2K --diag_warning=225 -I${PDK_INSTALL_PATH}/ti/drv/rm" diff --git a/test/k2k/c66/bios/rm_osal.c b/test/k2k/c66/bios/rm_osal.c index 6bf0d2d..af66f27 100644 --- a/test/k2k/c66/bios/rm_osal.c +++ b/test/k2k/c66/bios/rm_osal.c @@ -6,7 +6,7 @@ * * \par * ============================================================================ - * @n (C) Copyright 2012-2013, Texas Instruments, Inc. + * @n (C) Copyright 2012-2015, Texas Instruments, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/test/k2k/c66/bios/rm_test_sc.cfg b/test/k2k/c66/bios/rm_test_sc.cfg index 570cfd5..cb0e94d 100644 --- a/test/k2k/c66/bios/rm_test_sc.cfg +++ b/test/k2k/c66/bios/rm_test_sc.cfg @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2013, Texas Instruments Incorporated + * Copyright (c) 2015, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -35,8 +35,7 @@ var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc'); /* * Get the list of names that the build device supports. * I.e. ["CORE0", "CORE1", "CORE2" ... ] - */ -///var nameList = ["CORE0", "CORE1"]; + */; var nameList = ["CORE0"]; /* @@ -96,7 +95,7 @@ SharedRegion.setEntryMeta(0, }); /* PDK packages */ -var devType = "k2h" +var devType = "k2k" var Csl = xdc.useModule('ti.csl.Settings'); Csl.deviceType = devType; var Rm = xdc.loadPackage('ti.drv.rm'); diff --git a/test/k2l/c66/bios/rmK2LC66DspMtBiosTestProject.txt b/test/k2l/c66/bios/rmK2LC66DspMtBiosTestProject.txt index 5168c0b..6c13611 100644 --- a/test/k2l/c66/bios/rmK2LC66DspMtBiosTestProject.txt +++ b/test/k2l/c66/bios/rmK2LC66DspMtBiosTestProject.txt @@ -1,8 +1,6 @@ -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/src/rm_dsp_mt_test.c" -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/dts_files/global-resources.c" --ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/dts_files/linux-evm.c" -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/dts_files/server-policy.c" --ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/dts_files/static-policy.c" -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2l/c66/bios/rm_osal.c" -ccs.linkFile "PDK_INSTALL_PATH/ti/drv/rm/test/k2l/c66/bios/rm_test_sc.cfg" -ccs.setCompilerOptions "-mv6600 -g -DDEVICE_K2L --diag_warning=225 -I${PDK_INSTALL_PATH}/ti/drv/rm" diff --git a/test/k2l/c66/bios/rm_osal.c b/test/k2l/c66/bios/rm_osal.c index 6bf0d2d..af66f27 100644 --- a/test/k2l/c66/bios/rm_osal.c +++ b/test/k2l/c66/bios/rm_osal.c @@ -6,7 +6,7 @@ * * \par * ============================================================================ - * @n (C) Copyright 2012-2013, Texas Instruments, Inc. + * @n (C) Copyright 2012-2015, Texas Instruments, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/test/k2l/c66/bios/rm_test_sc.cfg b/test/k2l/c66/bios/rm_test_sc.cfg index 570cfd5..4eacf47 100644 --- a/test/k2l/c66/bios/rm_test_sc.cfg +++ b/test/k2l/c66/bios/rm_test_sc.cfg @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2013, Texas Instruments Incorporated + * Copyright (c) 2012-2015, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,7 +36,6 @@ var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc'); * Get the list of names that the build device supports. * I.e. ["CORE0", "CORE1", "CORE2" ... ] */ -///var nameList = ["CORE0", "CORE1"]; var nameList = ["CORE0"]; /* @@ -96,7 +95,7 @@ SharedRegion.setEntryMeta(0, }); /* PDK packages */ -var devType = "k2h" +var devType = "k2l" var Csl = xdc.useModule('ti.csl.Settings'); Csl.deviceType = devType; var Rm = xdc.loadPackage('ti.drv.rm'); diff --git a/test/src/rm_dsp_mt_test.c b/test/src/rm_dsp_mt_test.c index 57cab20..bb10a82 100644 --- a/test/src/rm_dsp_mt_test.c +++ b/test/src/rm_dsp_mt_test.c @@ -6,7 +6,7 @@ * * ============================================================================ * - * Copyright (c) 2012-2013, Texas Instruments Incorporated + * Copyright (c) 2015, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -91,17 +91,17 @@ #define RM_PKT_HEAP_NAME "rmHeapBuf" /* Application's core 0 registered RM transport indices */ -#define SERVER_TO_CLIENT_MAP_ENTRY 0 -#define CLIENT_TO_SERVER_MAP_ENTRY 1 +#define SERVER_TO_CLIENT_MAP_ENTRY 0 +#define CLIENT_TO_SERVER_MAP_ENTRY 1 /* Maximum number of registered RM transports */ -#define MAX_MAPPING_ENTRIES 2 +#define MAX_MAPPING_ENTRIES 2 /* Size of RM static allocation response queue. Must be greater than number of APPROVED * static allocations */ -#define MAX_STATIC_ALLOCATION_RESPS 5 +#define MAX_STATIC_ALLOCATION_RESPS 5 /* Size of RM service response queue */ -#define MAX_QUEUED_SERVICE_RESPONSES 10 +#define MAX_QUEUED_SERVICE_RESPONSES 10 /* Error checking macro */ #define ERROR_CHECK(checkVal, resultVal, rmInstName, printMsg) \ @@ -144,12 +144,8 @@ extern uint32_t rmFreeCounter; /* RM test Global Resource List (GRL) */ extern const char rmGRL[]; -/* Example Linux DTB file provided to RM Server for automatic Linux Kernel resource extraction */ -extern const char rmLinuxDtb[]; /* RM test Global Policy provided to RM Server */ extern const char rmGlobalPolicy[]; -/* RM test Static Policy provided to RM Client Delegate and Client */ -extern const char rmStaticPolicy[]; /********************************************************************** ********************** Global Variables ****************************** @@ -171,10 +167,10 @@ Task_Handle rmClientTskHandle1 = NULL; /* RM client test task 2 */ Task_Handle rmClientTskHandle2 = NULL; // task completion count -int taskCompleteCount = 0; +int taskCompleteCount = 0; // client task semaphore lock -uint32_t *client_semaphore_lock = NULL; +uint32_t *client_semaphore_lock = NULL; /* Handle for heap that RM packets will be allocated from */ HeapBufMP_Handle rmPktHeapHandle = NULL; @@ -197,42 +193,20 @@ Rm_Handle rmClientHandle = NULL; Rm_ServiceHandle *rmServerServiceHandle = NULL; Rm_ServiceHandle *rmClientServiceHandle = NULL; -MessageQ_Handle serverFromClientMsgQ, clientFromServerMsgQ; -MessageQ_QueueId serverToClientQId, clientToServerQId; -Rm_TransportHandle serverClientHandle, clientServerHandle; +MessageQ_Handle serverFromClientMsgQ, clientFromServerMsgQ; +MessageQ_QueueId serverToClientQId, clientToServerQId; +Rm_TransportHandle serverClientHandle, clientServerHandle; /* Transport map stores the RM transport handle to IPC MessageQ queue mapping */ Transport_MapEntry rmTransportMap[MAX_MAPPING_ENTRIES]; -/* Static allocation response queue */ -Rm_ServiceRespInfo staticResponseQueue[MAX_STATIC_ALLOCATION_RESPS]; -/* Static allocation response queue index */ -uint32_t numStaticResponses; - -/* RM response info queue used to store service responses received via the callback function */ -Rm_ServiceRespInfo responseInfoQueue[MAX_QUEUED_SERVICE_RESPONSES]; - -/* RM resource names (must match resource node names in GRL and policies */ -char resourceNameMemRegion[RM_NAME_MAX_CHARS] = "memory-regions"; -char resourceNameAccumCh[RM_NAME_MAX_CHARS] = "accumulator-ch"; -char resourceNameGpQ[RM_NAME_MAX_CHARS] = "gp-queue"; -char resourceNameAifQ[RM_NAME_MAX_CHARS] = "aif-queue"; -char resourceNameQosCluster[RM_NAME_MAX_CHARS] = "qos-cluster"; -char resourceNameAifRxCh[RM_NAME_MAX_CHARS] = "aif-rx-ch"; -char resourceNameInfraQ[RM_NAME_MAX_CHARS] = "infra-queue"; -char resourceNameLowPrioQ[RM_NAME_MAX_CHARS] = "low-prio-queue"; -char resourceNamePassQ[RM_NAME_MAX_CHARS] = "pass-queue"; - -/* Test RM NameServer name */ -char nameServerNameFavQ[RM_NAME_MAX_CHARS] = "My_Favorite_Queue"; - /* RM resource names (must match resource node names in GRL and policies */ -char res_name_link_ram[RM_NAME_MAX_CHARS] = "link-ram"; +char res_name_link_ram[RM_NAME_MAX_CHARS] = "link-ram"; /* Used to track allocations in each task */ #define REQUEST_ITERATIONS 16000 #define RESOURCE_PRINT_DIVISOR 1000 -uint32_t allocs[REQUEST_ITERATIONS]; +uint32_t allocs[REQUEST_ITERATIONS]; /********************************************************************** *************************** Test Functions *************************** @@ -345,7 +319,7 @@ void rmReceiveTskServer(UArg arg0, UArg arg1) void rmReceiveTskClient(UArg arg0, UArg arg1) { while(1) { - transportReceive(SERVER_TO_CLIENT_MAP_ENTRY); + transportReceive(SERVER_TO_CLIENT_MAP_ENTRY); /* Sleep for 1ms so that the main test tasks can run */ Task_sleep(1); } @@ -374,24 +348,24 @@ void rmClientTsk(UArg arg0, UArg arg1) if (response.serviceState == RM_SERVICE_APPROVED) { allocs[response.resourceBase]++; if (arg0==2) - Task_sleep(1); + Task_sleep(1); if ((i % RESOURCE_PRINT_DIVISOR) == 0) { - System_printf("Client Task %d : Requested %d resources...\n", (uint32_t)arg0, RESOURCE_PRINT_DIVISOR); + System_printf("Client Task %d : Requested %d resources...\n", (uint32_t)arg0, RESOURCE_PRINT_DIVISOR); } } else { - System_printf("Error Client Task %d : Allocate request was not approved for resource %d\n", - (uint32_t)arg0, request.resourceBase); - testErrors++; + System_printf("Error Client Task %d : Allocate request was not approved for resource %d\n", + (uint32_t)arg0, request.resourceBase); + testErrors++; goto error_exit; } } } error_exit: - taskCompleteCount++; - System_printf("Client Task %d : Exiting...\n", (uint32_t)arg0); + taskCompleteCount++; + System_printf("Client Task %d : Exiting...\n", (uint32_t)arg0); return; } @@ -409,47 +383,46 @@ void serverInit(void) /* Initialize the RM instances - RM must be initialized before anything else in the system * Core 0: 1 RM Instance - RM Server */ - /* Create the Server instance */ + /* Create the Server instance */ memset(&rmInitCfg, 0, sizeof(rmInitCfg)); - rmInitCfg.instName = rmServerName; - rmInitCfg.instType = Rm_instType_SERVER; - rmInitCfg.instCfg.serverCfg.globalResourceList = (void *)rmGRL; - rmInitCfg.instCfg.serverCfg.globalPolicy = (void *)rmGlobalPolicy; - rmServerHandle = Rm_init(&rmInitCfg, &result); - ERROR_CHECK(RM_OK, result, rmServerName, "Initialization failed"); - - /* Open Server service handle */ - rmServerServiceHandle = Rm_serviceOpenHandle(rmServerHandle, &result); - ERROR_CHECK(RM_OK, result, rmServerName, "Service handle open failed"); - - ///rmStartupTskServer(NULL, 0); - /* Create the heap that will be used to allocate RM messages. This - * heap is a multi-processor heap. It will be shared amongst - * all RM instances. */ - HeapBufMP_Params_init(&heapBufParams); - heapBufParams.regionId = 0; - heapBufParams.name = RM_PKT_HEAP_NAME; - heapBufParams.numBlocks = 64; - heapBufParams.blockSize = sizeof(Rm_Packet); - rmPktHeapHandle = HeapBufMP_create(&heapBufParams); - if (rmPktHeapHandle == NULL) { - System_printf("Error Core %d : Failed to create RM packet heap\n", coreNum); - testErrors++; - } - System_printf("Core %d : RM packet heap created\n", coreNum); - - /* Create the heap that will be used to allocate messageQ messages. */ - HeapBufMP_Params_init(&heapBufParams); - heapBufParams.regionId = 0; - heapBufParams.name = MSGQ_HEAP_NAME; - heapBufParams.numBlocks = 64; - heapBufParams.blockSize = sizeof(MsgQ_RmPacket); - msgQHeapHandle = HeapBufMP_create(&heapBufParams); - if (msgQHeapHandle == NULL) { - System_printf("Error Core %d : Failed to create HeapBufMP MessageQ heap\n", coreNum); - testErrors++; - } - System_printf("Core %d : IPC MessageQ message heap created\n", coreNum); + rmInitCfg.instName = rmServerName; + rmInitCfg.instType = Rm_instType_SERVER; + rmInitCfg.instCfg.serverCfg.globalResourceList = (void *)rmGRL; + rmInitCfg.instCfg.serverCfg.globalPolicy = (void *)rmGlobalPolicy; + rmServerHandle = Rm_init(&rmInitCfg, &result); + ERROR_CHECK(RM_OK, result, rmServerName, "Initialization failed"); + + /* Open Server service handle */ + rmServerServiceHandle = Rm_serviceOpenHandle(rmServerHandle, &result); + ERROR_CHECK(RM_OK, result, rmServerName, "Service handle open failed"); + + /* Create the heap that will be used to allocate RM messages. This + * heap is a multi-processor heap. It will be shared amongst + * all RM instances. */ + HeapBufMP_Params_init(&heapBufParams); + heapBufParams.regionId = 0; + heapBufParams.name = RM_PKT_HEAP_NAME; + heapBufParams.numBlocks = 64; + heapBufParams.blockSize = sizeof(Rm_Packet); + rmPktHeapHandle = HeapBufMP_create(&heapBufParams); + if (rmPktHeapHandle == NULL) { + System_printf("Error Core %d : Failed to create RM packet heap\n", coreNum); + testErrors++; + } + System_printf("Core %d : RM packet heap created\n", coreNum); + + /* Create the heap that will be used to allocate messageQ messages. */ + HeapBufMP_Params_init(&heapBufParams); + heapBufParams.regionId = 0; + heapBufParams.name = MSGQ_HEAP_NAME; + heapBufParams.numBlocks = 64; + heapBufParams.blockSize = sizeof(MsgQ_RmPacket); + msgQHeapHandle = HeapBufMP_create(&heapBufParams); + if (msgQHeapHandle == NULL) { + System_printf("Error Core %d : Failed to create HeapBufMP MessageQ heap\n", coreNum); + testErrors++; + } + System_printf("Core %d : IPC MessageQ message heap created\n", coreNum); /* Register the MessageQ heap with MessageQ */ MessageQ_registerHeap(msgQHeapHandle, MSGQ_HEAP_ID); @@ -459,12 +432,12 @@ void serverInit(void) * RM Server <---> RM Client * 1 queue on RM Server * 1 queue on RM Client */ - serverFromClientMsgQ = MessageQ_create(serverFromClientQueueName, NULL); - if (serverFromClientMsgQ == NULL) { - System_printf("Error Core %d : Failed to create Server's receive Q for Client\n", coreNum); - testErrors++; - } - System_printf("Core %d : Created Server receive Q for Client\n", coreNum); + serverFromClientMsgQ = MessageQ_create(serverFromClientQueueName, NULL); + if (serverFromClientMsgQ == NULL) { + System_printf("Error Core %d : Failed to create Server's receive Q for Client\n", coreNum); + testErrors++; + } + System_printf("Core %d : Created Server receive Q for Client\n", coreNum); } void clientInit(void) @@ -477,51 +450,51 @@ void clientInit(void) Rm_TransportCfg rmTransportCfg; // Client Instance Setup - /* Initialize the client semaphore lock */ + /* Initialize the client semaphore lock */ Semaphore_Params_init(&semParams); client_semaphore_lock = (uint32_t *)Semaphore_create(1, &semParams, NULL); if (client_semaphore_lock==NULL) { - System_printf("Error : Failed to init client semaphore lock with error code: \n", client_semaphore_lock); - testErrors++; + System_printf("Error : Failed to init client semaphore lock with error code: \n", client_semaphore_lock); + testErrors++; return; } - /* Create the RM Client instance */ + /* Create the RM Client instance */ memset(&rmInitCfg, 0, sizeof(rmInitCfg)); - rmInitCfg.instName = rmClientName; - rmInitCfg.instType = Rm_instType_CLIENT; + rmInitCfg.instName = rmClientName; + rmInitCfg.instType = Rm_instType_CLIENT; rmInitCfg.mtSemObj = (uint32_t *)client_semaphore_lock; - rmClientHandle = Rm_init(&rmInitCfg, &result); - ERROR_CHECK(RM_OK, result, rmClientName, "Initialization failed"); - - /* Open Client service handle */ - rmClientServiceHandle = Rm_serviceOpenHandle(rmClientHandle, &result); - ERROR_CHECK(RM_OK, result, rmClientName, "Service handle open failed"); - - /* Open the heaps created by the other processor. Loop until opened. */ - do { - status = HeapBufMP_open(RM_PKT_HEAP_NAME, &rmPktHeapHandle); - /* - * Sleep for 1 clock tick to avoid inundating remote processor - * with interrupts if open failed - */ - if (status < 0) { - Task_sleep(1); - } - } while (status < 0); - System_printf("Core %d : RM packet heap opened\n", coreNum); - - do { - status = HeapBufMP_open(MSGQ_HEAP_NAME, &msgQHeapHandle); - /* - * Sleep for 1 clock tick to avoid inundating remote processor - * with interrupts if open failed - */ - if (status < 0) { - Task_sleep(1); - } - } while (status < 0); - System_printf("Core %d : IPC MessageQ message heap opened\n", coreNum); + rmClientHandle = Rm_init(&rmInitCfg, &result); + ERROR_CHECK(RM_OK, result, rmClientName, "Initialization failed"); + + /* Open Client service handle */ + rmClientServiceHandle = Rm_serviceOpenHandle(rmClientHandle, &result); + ERROR_CHECK(RM_OK, result, rmClientName, "Service handle open failed"); + + /* Open the heaps created by the other processor. Loop until opened. */ + do { + status = HeapBufMP_open(RM_PKT_HEAP_NAME, &rmPktHeapHandle); + /* + * Sleep for 1 clock tick to avoid inundating remote processor + * with interrupts if open failed + */ + if (status < 0) { + Task_sleep(1); + } + } while (status < 0); + System_printf("Core %d : RM packet heap opened\n", coreNum); + + do { + status = HeapBufMP_open(MSGQ_HEAP_NAME, &msgQHeapHandle); + /* + * Sleep for 1 clock tick to avoid inundating remote processor + * with interrupts if open failed + */ + if (status < 0) { + Task_sleep(1); + } + } while (status < 0); + System_printf("Core %d : IPC MessageQ message heap opened\n", coreNum); /* Register the MessageQ heap with MessageQ */ MessageQ_registerHeap(msgQHeapHandle, MSGQ_HEAP_ID); @@ -531,39 +504,39 @@ void clientInit(void) * RM Server <---> RM Client * 1 queue on RM Server * 1 queue on RM Client */ - clientFromServerMsgQ = MessageQ_create(clientFromServerQueueName, NULL); - if (clientFromServerMsgQ == NULL) { - System_printf("Error Core %d : Failed to create client's receive Q for Server\n", coreNum); - testErrors++; - } - System_printf("Core %d : Created client receive Q for Server\n", coreNum); + clientFromServerMsgQ = MessageQ_create(clientFromServerQueueName, NULL); + if (clientFromServerMsgQ == NULL) { + System_printf("Error Core %d : Failed to create client's receive Q for Server\n", coreNum); + testErrors++; + } + System_printf("Core %d : Created client receive Q for Server\n", coreNum); /* Open the remote message queues. Also register the RM transports with each RM instance */ - /* Open the Server messageQ from the Client Delegate */ - do { - status = MessageQ_open(serverFromClientQueueName, &clientToServerQId); - /* - * Sleep for 1 clock tick to avoid inundating remote processor - * with interrupts if open failed - */ - if (status < 0) { - Task_sleep(1); - } - } while (status < 0); - System_printf("Core %d : RM Server MessageQ opened from RM Client\n", coreNum); - - /* Register the Server with the RM Client Instance */ - rmTransportCfg.rmHandle = rmClientHandle; - rmTransportCfg.appTransportHandle = (Rm_AppTransportHandle) clientToServerQId; - rmTransportCfg.remoteInstType = Rm_instType_SERVER; - rmTransportCfg.transportCallouts.rmAllocPkt = transportAlloc; - rmTransportCfg.transportCallouts.rmSendPkt = transportSend; - clientServerHandle = Rm_transportRegister(&rmTransportCfg, &result); - - /* Store the mapping information in the transport map */ - rmTransportMap[SERVER_TO_CLIENT_MAP_ENTRY].transportHandle = clientServerHandle; - rmTransportMap[SERVER_TO_CLIENT_MAP_ENTRY].receiveMsgQ = clientFromServerMsgQ; - System_printf("Core %d : Registered RM Client <=> RM Server transport with RM Client instance\n", coreNum); + /* Open the Server messageQ from the Client Delegate */ + do { + status = MessageQ_open(serverFromClientQueueName, &clientToServerQId); + /* + * Sleep for 1 clock tick to avoid inundating remote processor + * with interrupts if open failed + */ + if (status < 0) { + Task_sleep(1); + } + } while (status < 0); + System_printf("Core %d : RM Server MessageQ opened from RM Client\n", coreNum); + + /* Register the Server with the RM Client Instance */ + rmTransportCfg.rmHandle = rmClientHandle; + rmTransportCfg.appTransportHandle = (Rm_AppTransportHandle) clientToServerQId; + rmTransportCfg.remoteInstType = Rm_instType_SERVER; + rmTransportCfg.transportCallouts.rmAllocPkt = transportAlloc; + rmTransportCfg.transportCallouts.rmSendPkt = transportSend; + clientServerHandle = Rm_transportRegister(&rmTransportCfg, &result); + + /* Store the mapping information in the transport map */ + rmTransportMap[SERVER_TO_CLIENT_MAP_ENTRY].transportHandle = clientServerHandle; + rmTransportMap[SERVER_TO_CLIENT_MAP_ENTRY].receiveMsgQ = clientFromServerMsgQ; + System_printf("Core %d : Registered RM Client <=> RM Server transport with RM Client instance\n", coreNum); } void rmCleanup(void) @@ -604,56 +577,56 @@ void rmCleanup(void) } /* Cleanup all service ports, transport handles, RM instances, and IPC constructs */ - result = Rm_transportUnregister(rmTransportMap[CLIENT_TO_SERVER_MAP_ENTRY].transportHandle); - ERROR_CHECK(RM_OK, result, rmServerName, "Unregister of Server transport failed"); - result = Rm_serviceCloseHandle(rmServerServiceHandle); - ERROR_CHECK(RM_OK, result, rmServerName, "Service handle close failed"); - result = Rm_delete(rmServerHandle, RM_TEST_TRUE); - ERROR_CHECK(RM_OK, result, rmServerName, "Instance delete failed"); - - result = Rm_transportUnregister(rmTransportMap[SERVER_TO_CLIENT_MAP_ENTRY].transportHandle); - ERROR_CHECK(RM_OK, result, rmClientName, "Unregister of Client transport failed"); - result = Rm_serviceCloseHandle(rmClientServiceHandle); - ERROR_CHECK(RM_OK, result, rmClientName, "Service handle close failed"); - result = Rm_delete(rmClientHandle, RM_TEST_TRUE); - ERROR_CHECK(RM_OK, result, rmClientName, "Instance delete failed"); - - // delete the client_semaphore_lock - if (client_semaphore_lock) - { - Semaphore_delete((Semaphore_Handle *)client_semaphore_lock); - } - - System_printf ("Core %d : ---------------------------------------------------------\n", coreNum); - System_printf ("Core %d : ------------------ Memory Leak Check --------------------\n", coreNum); - System_printf ("Core %d : - : malloc count | free count -\n", coreNum); - System_printf ("Core %d : - Example Completion : %6d | %6d -\n", coreNum, + result = Rm_transportUnregister(rmTransportMap[CLIENT_TO_SERVER_MAP_ENTRY].transportHandle); + ERROR_CHECK(RM_OK, result, rmServerName, "Unregister of Server transport failed"); + result = Rm_serviceCloseHandle(rmServerServiceHandle); + ERROR_CHECK(RM_OK, result, rmServerName, "Service handle close failed"); + result = Rm_delete(rmServerHandle, RM_TEST_TRUE); + ERROR_CHECK(RM_OK, result, rmServerName, "Instance delete failed"); + + result = Rm_transportUnregister(rmTransportMap[SERVER_TO_CLIENT_MAP_ENTRY].transportHandle); + ERROR_CHECK(RM_OK, result, rmClientName, "Unregister of Client transport failed"); + result = Rm_serviceCloseHandle(rmClientServiceHandle); + ERROR_CHECK(RM_OK, result, rmClientName, "Service handle close failed"); + result = Rm_delete(rmClientHandle, RM_TEST_TRUE); + ERROR_CHECK(RM_OK, result, rmClientName, "Instance delete failed"); + + // delete the client_semaphore_lock + if (client_semaphore_lock) + { + Semaphore_delete((Semaphore_Handle *)client_semaphore_lock); + } + + System_printf("Core %d : ---------------------------------------------------------\n", coreNum); + System_printf("Core %d : ------------------ Memory Leak Check --------------------\n", coreNum); + System_printf("Core %d : - : malloc count | free count -\n", coreNum); + System_printf("Core %d : - Example Completion : %6d | %6d -\n", coreNum, rmMallocCounter, rmFreeCounter); finalMallocFree = rmMallocCounter - rmFreeCounter; if (finalMallocFree > 0) { - System_printf ("Core %d : - FAILED - %6d unfreed mallocs -\n", + System_printf("Core %d : - FAILED - %6d unfreed mallocs -\n", coreNum, finalMallocFree); testErrors++; } else if (finalMallocFree < 0) { - System_printf ("Core %d : - FAILED - %6d more frees than mallocs -\n", + System_printf("Core %d : - FAILED - %6d more frees than mallocs -\n", coreNum, -finalMallocFree); testErrors++; } else { - System_printf ("Core %d : - PASSED -\n", + System_printf("Core %d : - PASSED -\n", coreNum); } - System_printf ("Core %d : ---------------------------------------------------------\n", coreNum); - System_printf ("\n"); + System_printf("Core %d : ---------------------------------------------------------\n", coreNum); + System_printf("\n"); - System_printf ("Core %d : ---------------------------------------------------------\n", coreNum); - System_printf ("Core %d : ------------------ Example Completion -------------------\n", coreNum); + System_printf("Core %d : ---------------------------------------------------------\n", coreNum); + System_printf("Core %d : ------------------ Example Completion -------------------\n", coreNum); if (testErrors) { - System_printf ("Core %d : - Test Errors: %-32d -\n", coreNum, testErrors); + System_printf("Core %d : - Test Errors: %-32d -\n", coreNum, testErrors); } - System_printf ("Core %d : ---------------------------------------------------------\n", coreNum); - System_printf ("\n"); + System_printf("Core %d : ---------------------------------------------------------\n", coreNum); + System_printf("\n"); BIOS_exit(0); } @@ -665,11 +638,11 @@ void startupTsk(UArg arg0, UArg arg1) int32_t result = 0; Task_Params taskParams; - System_printf ("*********************************************************\n"); - System_printf ("***************** RM Startup Task ***********************\n"); - System_printf ("*********************************************************\n"); + System_printf("*********************************************************\n"); + System_printf("***************** RM Startup Task ***********************\n"); + System_printf("*********************************************************\n"); - System_printf ("RM Version : 0x%08x\nVersion String: %s\n", Rm_getVersion(), Rm_getVersionStr()); + System_printf("RM Version : 0x%08x\nVersion String: %s\n", Rm_getVersion(), Rm_getVersionStr()); // Server Instance Setup serverInit(); @@ -678,37 +651,37 @@ void startupTsk(UArg arg0, UArg arg1) clientInit(); /* Open the remote message queues. Also register the RM transports with each RM instance */ - /* Open the Client Delegate messageQ from the Server */ - do { - status = MessageQ_open(clientFromServerQueueName, &serverToClientQId); - /* - * Sleep for 1 clock tick to avoid inundating remote processor - * with interrupts if open failed - */ - if (status < 0) { - Task_sleep(1); - } - } while (status < 0); - System_printf("Core %d : RM Client MessageQ opened from RM Server\n", coreNum); - - /* Register the Client with the RM Server Instance */ - rmTransportCfg.rmHandle = rmServerHandle; - rmTransportCfg.appTransportHandle = (Rm_AppTransportHandle) serverToClientQId; - rmTransportCfg.remoteInstType = Rm_instType_CLIENT; - rmTransportCfg.transportCallouts.rmAllocPkt = transportAlloc; - rmTransportCfg.transportCallouts.rmSendPkt = transportSend; - serverClientHandle = Rm_transportRegister(&rmTransportCfg, &result); - - /* Store the mapping information in the transport map */ - rmTransportMap[CLIENT_TO_SERVER_MAP_ENTRY].transportHandle = serverClientHandle; - rmTransportMap[CLIENT_TO_SERVER_MAP_ENTRY].receiveMsgQ = serverFromClientMsgQ; - System_printf("Core %d : Registered RM Server <=> RM CLient transport with RM Server instance\n", coreNum); - - /* Create the RM server receive task */ - System_printf("Core %d : Creating RM receive task...\n", coreNum); - Task_Params_init (&taskParams); - taskParams.priority = 4; - rmReceiveTskHandleServer = Task_create (rmReceiveTskServer, &taskParams, NULL); + /* Open the Client Delegate messageQ from the Server */ + do { + status = MessageQ_open(clientFromServerQueueName, &serverToClientQId); + /* + * Sleep for 1 clock tick to avoid inundating remote processor + * with interrupts if open failed + */ + if (status < 0) { + Task_sleep(1); + } + } while (status < 0); + System_printf("Core %d : RM Client MessageQ opened from RM Server\n", coreNum); + + /* Register the Client with the RM Server Instance */ + rmTransportCfg.rmHandle = rmServerHandle; + rmTransportCfg.appTransportHandle = (Rm_AppTransportHandle) serverToClientQId; + rmTransportCfg.remoteInstType = Rm_instType_CLIENT; + rmTransportCfg.transportCallouts.rmAllocPkt = transportAlloc; + rmTransportCfg.transportCallouts.rmSendPkt = transportSend; + serverClientHandle = Rm_transportRegister(&rmTransportCfg, &result); + + /* Store the mapping information in the transport map */ + rmTransportMap[CLIENT_TO_SERVER_MAP_ENTRY].transportHandle = serverClientHandle; + rmTransportMap[CLIENT_TO_SERVER_MAP_ENTRY].receiveMsgQ = serverFromClientMsgQ; + System_printf("Core %d : Registered RM Server <=> RM CLient transport with RM Server instance\n", coreNum); + + /* Create the RM server receive task */ + System_printf("Core %d : Creating RM receive task...\n", coreNum); + Task_Params_init (&taskParams); + taskParams.priority = 4; + rmReceiveTskHandleServer = Task_create (rmReceiveTskServer, &taskParams, NULL); /* Create the RM client receive task. Assign higher priority than the test tasks so that * when they spin waiting for messages from other RM instances the receive task is @@ -718,56 +691,55 @@ void startupTsk(UArg arg0, UArg arg1) taskParams.priority = 4; rmReceiveTskHandleClient = Task_create (rmReceiveTskClient, &taskParams, NULL); - /* Create the RM client test task 1 */ - System_printf("Core %d : Creating RM client test task 1...\n", coreNum); - Task_Params_init (&taskParams); + /* Create the RM client test task 1 */ + System_printf("Core %d : Creating RM client test task 1...\n", coreNum); + Task_Params_init (&taskParams); taskParams.priority = 1; taskParams.arg0 = 1; rmClientTskHandle1 = Task_create (rmClientTsk, &taskParams, NULL); - /* Create the RM client test task 2 */ - System_printf("Core %d : Creating RM client test task 2...\n", coreNum); - Task_Params_init (&taskParams); + /* Create the RM client test task 2 */ + System_printf("Core %d : Creating RM client test task 2...\n", coreNum); + Task_Params_init (&taskParams); taskParams.priority = 2; taskParams.arg0 = 2; rmClientTskHandle2 = Task_create (rmClientTsk, &taskParams, NULL); - // wait for all the tasks to complete - while (taskCompleteCount!=2) - { - Task_sleep(100); - } + // wait for all the tasks to complete + while (taskCompleteCount!=2) + { + Task_sleep(100); + } - // resource allocation checking + // resource allocation checking if (!testErrors) { - System_printf("Tasks complete - Checking for allocation errors\n"); + System_printf("Tasks complete - Checking for allocation errors\n"); for (i = 0; i < REQUEST_ITERATIONS; i++) { if (allocs[i] != 1) { - System_printf ("FAILED : Resource %d not allocated exactly once\n", i); + System_printf ("FAILED : Resource %d not allocated exactly once\n", i); testErrors++; } } if (!testErrors) { - System_printf("PASSED : All Resources allocated once\n"); + System_printf("PASSED : All Resources allocated once\n"); } } // clean up rmCleanup(); - } int main(Int argc, Char* argv[]) { - Task_Params taskParams; - int status, i; + Task_Params taskParams; + int status, i; - System_printf ("*********************************************************\n"); - System_printf ("********************** RM Testing ***********************\n"); - System_printf ("*********************************************************\n"); + System_printf("*********************************************************\n"); + System_printf("********************** RM Testing ***********************\n"); + System_printf("*********************************************************\n"); - System_printf ("RM Version : 0x%08x\nVersion String: %s\n", Rm_getVersion(), Rm_getVersionStr()); + System_printf("RM Version : 0x%08x\nVersion String: %s\n", Rm_getVersion(), Rm_getVersionStr()); coreNum = CSL_chipReadReg(CSL_CHIP_DNUM); testErrors = 0; -- 2.39.2