]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blobdiff - processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/aspMsg_master.c
Remove processor_audio_sdk_1_00_00_00 subfolder
[processor-sdk/performance-audio-sr.git] / processor_audio_sdk_1_00_00_00 / pasdk / test_dsp / framework / aspMsg_master.c
diff --git a/processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/aspMsg_master.c b/processor_audio_sdk_1_00_00_00/pasdk/test_dsp/framework/aspMsg_master.c
deleted file mode 100644 (file)
index 8cd8703..0000000
+++ /dev/null
@@ -1,168 +0,0 @@
-
-/*
-Copyright (c) 2016, Texas Instruments Incorporated - http://www.ti.com/
-All rights reserved.
-
-* Redistribution and use in source and binary forms, with or without 
-* modification, are permitted provided that the following conditions
-* are met:
-*
-* Redistributions of source code must retain the above copyright
-* notice, this list of conditions and the following disclaimer.
-*
-* Redistributions in binary form must reproduce the above copyright
-* notice, this list of conditions and the following disclaimer in the
-* documentation and/or other materials provided with the
-* distribution.
-*
-* Neither the name of Texas Instruments Incorporated nor the names of
-* its contributors may be used to endorse or promote products derived
-* from this software without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*
-*/
-
-#include <xdc/std.h>
-#include <xdc/runtime/Diags.h>
-#include <xdc/runtime/Error.h>
-#include <xdc/runtime/IHeap.h>
-#include <xdc/runtime/Log.h>
-#include <xdc/runtime/Memory.h>
-#include <xdc/runtime/System.h>
-
-#include <ti/sysbios/heaps/HeapBuf.h>
-
-#include <ti/ipc/MessageQ.h>
-#include <ti/ipc/MultiProc.h>
-#include <ti/ipc/SharedRegion.h>
-
-#include "aspMsg_common.h"
-#include "aspMsg_master.h"
-
-#define AspMsg_MasterToSlaveMsgHeapId ( 0 )
-
-AspMsgMaster_Module gAspMsgMaster;
-AspMsgMaster_Handle hAspMsgMaster=&gAspMsgMaster;
-
-Uint32 gMessageId;
-
-/* Initialize ASP master messaging */
-Int AspMsgMaster_init(
-    AspMsgMaster_Handle hAspMsgMaster, 
-    UInt16 remoteProcId, 
-    UInt16 numMsgs
-)
-{
-    Int             status = ASP_MSG_MASTER_SOK;
-    Int             align;
-    Error_Block     eb;
-    IHeap_Handle    srHeap;
-    HeapBuf_Params  heapParams;
-    MessageQ_Params msgqParams;
-    char            msgqName[32];
-    UInt16          regionId;
-
-
-    Log_print0(Diags_ENTRY, "AspMsgMaster_init(): -->");
-    Log_info0("AspMsgMaster_init(): -->");
-    
-    // set default values
-    hAspMsgMaster->masterQue = NULL;
-    hAspMsgMaster->slaveQue = MessageQ_INVALIDMESSAGEQ;
-    hAspMsgMaster->heapId = AspMsg_MasterToSlaveMsgHeapId;
-    hAspMsgMaster->msgSize = 0;
-    hAspMsgMaster->messageId = 0;
-    
-    // set processor Ids
-    hAspMsgMaster->masterProcId = MultiProc_self();
-    hAspMsgMaster->slaveProcId = remoteProcId;
-    
-    regionId = SharedRegion_getIdByName("SR_0"); // get IPC shared region Id
-
-    // compute message size to fill entire cache lines
-    align = SharedRegion_getCacheLineSize(regionId);
-    hAspMsgMaster->msgSize = ROUNDUP(sizeof(ASP_Msg), align);
-    
-    // compute message pool size
-    hAspMsgMaster->poolSize = hAspMsgMaster->msgSize * numMsgs;
-    
-    // acquire message pool memory
-    srHeap = (IHeap_Handle)SharedRegion_getHeap(regionId);
-    hAspMsgMaster->store = Memory_alloc(srHeap, hAspMsgMaster->poolSize, align, NULL);
-
-    // create a heap in shared memory for message pool
-    HeapBuf_Params_init(&heapParams);
-    heapParams.blockSize = hAspMsgMaster->msgSize;
-    heapParams.numBlocks = numMsgs;
-    heapParams.bufSize = hAspMsgMaster->poolSize;
-    heapParams.align = align;
-    heapParams.buf = hAspMsgMaster->store;
-    Error_init(&eb);
-
-    hAspMsgMaster->heap = HeapBuf_create(&heapParams, &eb);
-    if (hAspMsgMaster->heap == NULL) 
-    {
-        Log_error0("AspMsgMaster_init(): failed creating message pool");
-        status = ASP_MSG_MASTER_HEAPBUF_CREATE_FAIL;
-        Log_print1(Diags_INFO, "AspMsgMaster_init(): <-- status=%d", (IArg)status);
-        return status;
-    }
-
-    // bind message pool to heapId
-    status = MessageQ_registerHeap((Ptr)(hAspMsgMaster->heap), hAspMsgMaster->heapId);
-    if (status != MessageQ_S_SUCCESS)
-    {
-        Log_error0("AspMsgMaster_init(): failed registering heap");
-        status = ASP_MSG_MASTER_MSGQ_REGHEAP_FAIL;
-        Log_print1(Diags_INFO, "AspMsgMaster_init(): <-- status=%d", (IArg)status);
-        return status;        
-    }
-
-    // create local message queue (inbound messages)
-    MessageQ_Params_init(&msgqParams);
-
-    hAspMsgMaster->masterQue = MessageQ_create(NULL, &msgqParams);
-    if (hAspMsgMaster->masterQue == NULL) 
-    {
-        Log_error0("AspMsgMaster_init(): failed creating MessageQ");
-        status = ASP_MSG_MASTER_MASTER_MSGQ_CREATE_FAIL;
-        Log_print1(Diags_INFO, "AspMsgMaster_init(): <-- status=%d", (IArg)status);
-        return status;
-    }
-
-    // open the remote message queue
-    System_sprintf(msgqName, AspMsg_SlaveMsgQueName, MultiProc_getName(remoteProcId));
-
-    Log_info0("AspMsgMaster_init(): MessageQ_open() start");
-    do {
-        status = MessageQ_open(msgqName, &hAspMsgMaster->slaveQue);
-        Log_info1("MessageQ_open() status=%d", status);
-        //Task_sleep(1);
-    } while (status == MessageQ_E_NOTFOUND);
-    Log_info0("AspMsgMaster_init(): MessageQ_open() finish");
-
-    if (status < 0) 
-    {
-        Log_error0("AspMsgMaster_init(): failed opening MessageQ");
-        status = ASP_MSG_MASTER_SLAVE_MSGQ_OPEN_FAIL;
-        Log_print1(Diags_INFO, "AspMsgMaster_init(): <-- status=%d", (IArg)status);
-        return status;
-    }
-
-    Log_print0(Diags_INFO, "AspMsgMaster_init(): ASP Master messaging ready");
-    Log_info0("AspMsgMaster_init(): ASP Master messaging ready");
-    
-    Log_print1(Diags_EXIT, "<-- AspMsgMaster_init(): %d", (IArg)status);    
-    return 0;
-}