]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blob - pasdk/common/aspOutInitSync_common.c
PASDK-376:Update headers to 2017
[processor-sdk/performance-audio-sr.git] / pasdk / common / aspOutInitSync_common.c
2 /*
3 Copyright (c) 2017, Texas Instruments Incorporated - http://www.ti.com/
4 All rights reserved.
6 * Redistribution and use in source and binary forms, with or without 
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the
16 * distribution.
17 *
18 * Neither the name of Texas Instruments Incorporated nor the names of
19 * its contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 */
36 #include <xdc/std.h>
37 #include <ti/ipc/GateMP.h>
39 #include "aspOutInitSync_common.h"
41 // Initialize Output Processing Init-Sync control
42 Int outIsCtlInit(
43     PAF_AST_OutInitSyncCtl *pOutIsCtl,          // output init-sync control to initialize
44     PAF_AST_OutInitSyncInfo **pXOutIsInfo       // pointer to base address of output init-sync info array
45 )
46 {
47 #ifdef _TMS320C6X
48     GateMP_Params gateParams;
49     GateMP_Handle gateHandle;
50     
51     GateMP_Params_init(&gateParams);
52     gateParams.localProtect = GateMP_LocalProtect_THREAD;
53     gateParams.remoteProtect = GateMP_RemoteProtect_SYSTEM;
54     gateParams.name = ASP_OUTIS_GATE_NAME;
55     gateParams.regionId = ASP_OUTIS_GATE_REGION_ID;
56     gateHandle = GateMP_create(&gateParams);
57     if (gateHandle != NULL)
58     {
59         pOutIsCtl->gateHandle = gateHandle;
60     }
61     else
62     {
63         pOutIsCtl->gateHandle = NULL;
64         return ASP_OUTIS_CTL_INIT_INV_GATE;
65     }
66     
67     pOutIsCtl->pXOutIsInfo = pXOutIsInfo;
68     
69     return ASP_OUTIS_SOK;
70     
71 #elif defined(ARMCOMPILE)
72     GateMP_Handle gateHandle;
73     Int status;
74     
75     do {
76         status = GateMP_open(ASP_OUTIS_GATE_NAME, &gateHandle);
77     } while (status == GateMP_E_NOTFOUND);
78     if (status == GateMP_S_SUCCESS)
79     {
80         pOutIsCtl->gateHandle = gateHandle;
81     }
82     else
83     {
84         pOutIsCtl->gateHandle = NULL;
85         return ASP_OUTIS_CTL_INIT_INV_GATE;
86     }
87     
88     pOutIsCtl->pXOutIsInfo = pXOutIsInfo;
89     
90     return ASP_OUTIS_SOK;
92 #else
93     #error "Unsupported platform"
95 #endif
96 }
98 // Copy audio frame
99 // See CPL_setAudioFrame_
100 // (***) FL: Note similar functionality present in CB, check usage there.
101 Void outIsCpyAf(
102     PAF_AudioFrame *pSrcAf,
103     PAF_AudioFrame *pDstAf
106     // Write AF members written by CPL_setAudioFrame_();
107     pDstAf->sampleDecode                       = pSrcAf->sampleDecode;
108     PAF_PROCESS_COPY(pDstAf->sampleProcess, pSrcAf->sampleProcess);
109     pDstAf->sampleRate                         = pSrcAf->sampleRate;
110     pDstAf->sampleCount                        = pSrcAf->sampleCount;
111     pDstAf->channelConfigurationRequest        = pSrcAf->channelConfigurationRequest;
112     pDstAf->channelConfigurationStream         = pSrcAf->channelConfigurationStream;