]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blob - pasrc/test_dsp/sio/dev2utils.c
Merge branch 'dev_pasdk1_3_integration' of ssh://bitbucket.itg.ti.com/pasdk/pasdk_sr...
[processor-sdk/performance-audio-sr.git] / pasrc / test_dsp / sio / dev2utils.c
2 /*
3 Copyright (c) 2018, 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 "fwkPort.h"
38 #include <xdc/std.h>
39 #include <xdc/cfg/global.h>
40 #include <xdc/runtime/Error.h>
41 #include <xdc/runtime/Log.h>
42 #include <xdc/runtime/Memory.h>
44 #include <ti/sysbios/BIOS.h>
45 #include <ti/sysbios/knl/Semaphore.h>
47 #include <math.h>
49 #include "sio.h"
51 //#include "inpbuf.h"
52 //#include "outbuf.h"
53 //#include "pafsio.h"
54 //#include "psdkaf_typ.h"
55 //#include "psdkaf_dec.h"
57 //Add because of table
58 #include <sap.h>
59 #include <mib.h>
60 #include <mob.h>
62 //Define Module table
63 #if 1
64 DEV2_TableElem DEV2_table[] = {
65     {
66         {NULL, NULL},
67         {"DIB", &DIB_FXNS, (Int)DIB_init, NULL, 0, 0}
68     },
69     {
70         {NULL, NULL},
71         {"DOB", &DOB_FXNS, (Int)DOB_init, NULL, 0, 0}
72     },
73     {
74         {NULL, NULL},
75         {"DAP", &SAP_FXNS, (Int)SAP_init, NULL, 0, 0}
76     },
77     /***
78     {
79         {NULL, NULL},
80         {"SAP", &SAP_FXNS, (Int)SAP_init, NULL, 0, 0}
81     },
82     ***/
83     {
84         {NULL, NULL},
85         {NULL, NULL, 0, NULL, 0, 0} /* End the table wit a NULL entry */
86     },
87 };
88 #else
89 DEV2_TableElem DEV2_table[4];
90 void setupDev2Table(void)
91 {
92     DEV2_createDevice("DIB", &DIB_FXNS, (Int)DIB_init, NULL);
93     DEV2_createDevice("DOB", &DOB_FXNS, (Int)DOB_init, NULL);
94     DEV2_createDevice("DAP", &SAP_FXNS, (Int)SAP_init, NULL);
95 }
96 #endif
98 void initDev2(void)
99 {
100   SAP_init();
101   DIB_init();
102   DOB_init();
106 // Define available heap regions
107 extern const ti_sysbios_heaps_HeapMem_Handle heapMemL2Sram;
108 extern const ti_sysbios_heaps_HeapMem_Handle heapMemDdr3;
109 //extern const ti_sysbios_heaps_HeapMem_Handle heapMemMsmc;
111 #define DEV2_L2HEAP0 ((IHeap_Handle)heapMemL2Sram)
112 #define DEV2_L2HEAP1 ((IHeap_Handle)heapMemL2Sram)
113 #define DEV2_L2HEAP2 ((IHeap_Handle)heapMemL2Sram)
114 #define DEV2_EHEAP ((IHeap_Handle)heapMemDdr3)
115 //#define DEV2_MHEAP ((IHeap_Handle)heapMemMsmc)
117 HeapMem_Handle DEV2_memSpaceToHeap (IALG_MemSpace space)
119     switch(space)
120     {
121         case IALG_SARAM:    /* IALG_SARAM0 = IALG_SARAM :  Normally used for IRAM.  */
122             Log_info2("DEV2_memSpaceToHeap: IALG_SARAM (0x%x) 0x%x", space, (IArg)DEV2_L2HEAP0);
123             return DEV2_L2HEAP0;
125         case IALG_EXTERNAL: // normally external SDRAM
126             Log_info2("DEV2_memSpaceToHeap: IALG_EXTERNAL (0x%x) 0x%x", space, (IArg)DEV2_EHEAP);
127             return DEV2_EHEAP;
129         case IALG_SARAM1:
130             Log_info2("DEV2_memSpaceToHeap: IALG_SARAM1 (0x%x) 0x%x", space, (IArg)DEV2_L2HEAP1);
131             return DEV2_L2HEAP1;
133         case IALG_SARAM2:
134             Log_info2("DEV2_memSpaceToHeap: IALG_SARAM2 (0x%x) 0x%x", space, (IArg)DEV2_L2HEAP2);
135             return DEV2_L2HEAP2;
137         case IALG_DARAM0:
138             Log_info2("DEV2_memSpaceToHeap: IALG_DARAM0 (0x%x) 0x%x", space, (IArg)DEV2_L2HEAP0);
139             return DEV2_L2HEAP0;
141         case IALG_DARAM1:   // not normally used.
142             Log_info2("DEV2_memSpaceToHeap: IALG_DARAM1 (0x%x) 0x%x", space, (IArg)DEV2_L2HEAP1);
143             return DEV2_L2HEAP1;
145         case IALG_DARAM2:   // not normally used.
146             Log_info2("DEV2_memSpaceToHeap: IALG_DARAM2 (0x%x) 0x%x", space, (IArg)DEV2_L2HEAP2);
147             return DEV2_L2HEAP2;    // not normally used.
149         case IALG_ESDATA:   // not normally used.
150             Log_info2("DEV2_memSpaceToHeap: IALG_ESDATA (0x%x) 0x%x", space, (IArg)DEV2_EHEAP);
151             return DEV2_EHEAP;
153         default:
154             Log_info2("DEV2_ALG_memSpaceToHeap: default (0x%x) 0x%x", space, (IArg)DEV2_EHEAP);
155             return DEV2_EHEAP;
156     }