1 /*
2 * ======== main.c ========
3 */
6 /* System header files */
7 #include <xdc/std.h>
9 #include <xdc/runtime/Error.h>
10 #include <xdc/runtime/System.h>
12 /*----------------------------------------
13 * BIOS header files
14 *----------------------------------------*/
16 #include <ti/sysbios/BIOS.h> /* mandatory - if you call APIs like BIOS_start() */
18 /* Portable data types */
19 #include <ti/mas/types/types.h>
20 #include <ti/mas/util/ecomem.h>
22 #include "components/fil.h"
23 #include "components/sys.h"
25 /* Global System Configuration Structure */
26 sysConfig_t sysConfig = {
27 SYS_MICS_MAX, /* #microphones */
28 SYS_VMICS_MAX, /* #virtual microphones */
29 FALSE, /* Do not use file I/O to load files (must use GEL to load into memory) */
30 TRUE /* Use default angles for microphone configurations */
31 };
33 /* Global FILE I/O Configuration Structure (must be configured even when file I/O not used */
34 filConfig_t filConfig = {
35 FIL_LENGTH_MAX, /* number of samples to load from a file */
36 SYS_MICS_MAX, /* number of files to use */
37 TRUE, /* big endian */
38 FALSE, /* do not wrap around */
39 40*SYS_FS_HZ /* Process 40s of the signal (current mic input file length */
40 };
42 /* Miocrophone input files names (in case we want to use FILE I/O to load into memory */
43 char *filNames[FIL_MAX] = {
44 "../t8/y16L8g3m7090_1.pcm",
45 "../t8/y16L8g3m7090_2.pcm",
46 "../t8/y16L8g3m7090_3.pcm",
47 "../t8/y16L8g3m7090_4.pcm",
48 "../t8/y16L8g3m7090_5.pcm",
49 "../t8/y16L8g3m7090_6.pcm",
50 "../t8/y16L8g3m7090_7.pcm",
51 "../t8/y16L8g3m7090_8.pcm"
52 };
54 /* Acoustic environment */
55 /* Room Size (X,Y,Z) in meters */
56 /* 5.2000 4.3000 2.7000 */
58 /* Table size (X,Y,Z) in meters */
59 /* 3.0000 2.4000 0.7600 */
61 /* "Echo" generating speaker position (X,Y,Z) in meters */
62 /* 0 2.1500 1.2172 180 -90 VM-9 */
64 /* People positions (X,Y,Z) in meters and angles relative to the table and array */
65 /* 1.8200 0.6452 1.2172 position#1 (person#1) -123.6056 -146.3944 VM-7
66 2.8200 0.6452 1.2172 -not used- -90.0000 180.0000 VM-6
67 3.8200 0.6452 1.2172 (person#2) -56.3944 146.3944 VM-5
68 1.8200 3.6548 1.2172 (person#3) 123.6056 -33.6056 VM-11
69 2.8200 3.6548 1.2172 -not used- 90.0000 0.0000 VM-0
70 3.8200 3.6548 1.2172 position#6 (person#4) 56.3944 33.6056 VM-1
71 */
73 /* Microphone array mic positions (X,Y,Z) in meters */
74 /* 2.7922 2.1500 0.7600 mic#1 ("left" most) 180
75 2.8004 2.1304 0.7600 -135
76 2.8200 2.1222 0.7600 ("lower" most) -90
77 2.8396 2.1304 0.7600 -45
78 2.8478 2.1500 0.7600 ("right" most) 0
79 2.8396 2.1696 0.7600 45
80 2.8200 2.1778 0.7600 ("upper" most) 90
81 2.8004 2.1696 0.7600 mic#8 135
82 */
83 /* Array Center = (2.82, 2.15, 0.76) (same as table center) */
85 /* Noise source position (X,Y,Z) in meters */
86 /* 2.6000 2.1500 2.3000 */
88 /* Initialize FILE I/O, system context */
89 static void system_init(void)
90 {
91 int k, err;
92 tlong n;
93 void *fid;
95 fid = (void*)0xBABA; /* Just to test if we're providing fid correctly */
96 err = filCreate(&fid, &filConfig); /* Create FILE I/O context */
97 SYS_CHECK_ERROR(err);
99 err = sysCreate(&sysConfig); /* Create system context */
100 SYS_CHECK_ERROR(err);
102 err = sysPrintConfig(SYSM_SCOPE_STATIC|SYSM_SCOPE_DYNAMIC);
103 SYS_CHECK_ERROR(err);
105 if (sysContext.use_fileio) { /* In case we want to read directly from file (slow) */
106 for (k = 0; k < filConfig.nfiles; k++) {
107 n = filLoad(filNames[k], filConfig.length, k);
108 System_printf("Read %ld samples from %s\n", n, filNames[k]);
109 }
110 }
111 System_flush();
112 /* If we are not using FILE I/O to load mic files, we need to use GEL to load into memory. */
114 } /* system_init */
116 /*
117 * =============== main ==============
118 */
119 int main(void)
120 {
121 system_init(); /* initialize system context, etc. */
123 sysBfCreate(); /* Create beamformers */
124 sysAsnrCreate(); /* Create ASNR's */
125 sysMssCreate(); /* Create MSS */
126 sysVauCreate(); /* Create VAU */
128 BIOS_start();
130 return(0); /* Never to return here */
131 } /* main */
133 /* nothing past this point */