annotate chipsetsw/layer1/audio_cfile/l1audio_func.c @ 349:ed3e588600c1 default tip

README update for the successful completion of the L1 reconstruction project
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 30 Oct 2017 18:03:24 +0000
parents bb75ddc13696
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
262
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1 /************* Revision Controle System Header *************
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
2 * GSM Layer 1 software
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
3 * L1AUDIO_FUNC.C
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
4 *
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
5 * Filename l1audio_func.c
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
6 * Copyright 2003 (C) Texas Instruments
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
7 *
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
8 ************* Revision Controle System Header *************/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
9
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
10
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
11 /************************************/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
12 /* Include files... */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
13 /************************************/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
14 #include "nucleus.h" //omaps00090550
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
15 #include "l1_macro.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
16
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
17 #include "l1_macro.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
18 #include "l1_confg.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
19 //#include "l1audio_defty.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
20
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
21 #if (AUDIO_TASK == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
22
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
23 #include "l1_types.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
24 #include "sys_types.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
25 #if (CODE_VERSION == SIMULATION) && (AUDIO_SIMULATION)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
26
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
27
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
28 #include <stdlib.h>
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
29 #include <string.h>
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
30
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
31 #include "iq.h" // Debug / Init hardware ("eva3.lib")
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
32 #include "l1_ver.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
33 #include "l1_const.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
34 #include "l1_signa.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
35
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
36 #if TESTMODE
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
37 #include "l1tm_defty.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
38 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
39
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
40 #include "l1audio_const.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
41 #include "l1audio_cust.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
42 #include "l1audio_signa.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
43 #include "l1audio_defty.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
44 #include "l1audio_msgty.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
45 #include "l1audio_abb.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
46 #include "l1audio_btapi.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
47
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
48 #if (L1_GTT == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
49 #include "l1gtt_const.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
50 #include "l1gtt_defty.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
51 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
52 //added here from e-sample for AAC
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
53 #if (L1_DYN_DSP_DWNLD == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
54 #include "l1_dyn_dwl_const.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
55 #include "l1_dyn_dwl_defty.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
56 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
57 #if (L1_MP3 == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
58 #include "l1mp3_defty.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
59 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
60
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
61 #if (L1_MIDI == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
62 #include "l1midi_defty.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
63 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
64 //added here from e-sample for AAC
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
65 #if (L1_AAC == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
66 #include "l1aac_defty.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
67 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
68
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
69 #include "l1_defty.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
70 #include "cust_os.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
71 #include "l1_msgty.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
72 #include "l1_varex.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
73
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
74 #include "l1_mftab.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
75 #include "l1_tabs.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
76 #include "l1_ctl.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
77
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
78
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
79 #include "l1_time.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
80 #include "l1_scen.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
81
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
82 #if TESTMODE
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
83 #include "l1tm_msgty.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
84 #include "l1tm_signa.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
85 #include "l1tm_varex.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
86 #endif // TESTMODE
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
87
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
88 #if (L1_STEREOPATH == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
89 #include "sys_dma.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
90 #include "sys_inth.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
91 #include "abb.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
92 #include "l1audio_stereo.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
93 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
94
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
95 #else
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
96 // Layer1 and debug include files.
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
97
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
98 #include <ctype.h>
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
99 #include <math.h>
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
100 #include "l1_ver.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
101 #include "l1_const.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
102 #include "l1_signa.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
103
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
104 #if TESTMODE
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
105 #include "l1tm_defty.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
106 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
107
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
108 #include "l1audio_const.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
109 #include "l1audio_cust.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
110 #include "l1audio_signa.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
111 #include "l1audio_defty.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
112 #include "l1audio_msgty.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
113 #include "l1audio_abb.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
114
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
115 #if (L1_GTT == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
116 #include "l1gtt_const.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
117 #include "l1gtt_defty.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
118 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
119 //added here from e-sample for AAC
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
120 #if (L1_DYN_DSP_DWNLD == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
121 #include "l1_dyn_dwl_const.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
122 #include "l1_dyn_dwl_defty.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
123 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
124 #if (L1_MP3 == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
125 #include "l1mp3_defty.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
126 #include"l1mp3_const.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
127 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
128
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
129 #if (L1_MIDI == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
130 #include "l1midi_defty.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
131 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
132 //added here from e-sample for AAC
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
133 #if (L1_AAC == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
134 #include "l1aac_defty.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
135 #include"l1aac_const.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
136 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
137
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
138 #include "l1_defty.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
139 #include "cust_os.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
140 #include "l1_msgty.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
141 #include "tpudrv.h" // TPU drivers. ("eva3.lib")
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
142 #include "l1_varex.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
143
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
144 #include "l1_proto.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
145 #include "l1_mftab.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
146 #include "l1_tabs.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
147 #include "mem.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
148 #include "armio.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
149 #include "timer.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
150 #include "timer1.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
151 #include "dma.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
152 #include "inth.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
153 #include "ulpd.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
154 #include "rhea_arm.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
155 #include "clkm.h" // Clockm ("eva3.lib")
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
156 #include "l1_ctl.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
157
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
158 #if TESTMODE
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
159 #include "l1tm_msgty.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
160 #include "l1tm_signa.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
161 #include "l1tm_varex.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
162 #endif // TESTMODE
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
163
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
164 #if (L1_STEREOPATH == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
165 #include "sys_dma.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
166 #include "sys_inth.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
167 #include "abb.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
168 #include "l1audio_stereo.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
169 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
170
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
171 #include "l1_time.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
172 #if L2_L3_SIMUL
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
173 #include "l1_scen.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
174 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
175 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
176 #if (OP_RIV_AUDIO == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
177 #include "rv_general.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
178 #include "audio_api.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
179 #include "audio_structs_i.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
180 #include "audio_var_i.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
181 #include "audio_macro_i.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
182 #include "audio_const_i.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
183 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
184
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
185 #include "l1audio_macro.h"
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
186
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
187 /**************************************/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
188 /* Prototypes for L1S audio function */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
189 /**************************************/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
190 UWORD8 copy_data_from_buffer (UWORD8 session_id, UWORD16 *buffer_size, UWORD16 **ptr_buf, UWORD16 data_size, API *ptr_dst);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
191 UWORD8 copy_data_to_buffer (UWORD8 session_id, UWORD16 *buffer_size, UWORD16 **ptr_buf, UWORD16 data_size, API *ptr_src);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
192 #if (MELODY_E2)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
193 UWORD16 audio_twentyms_to_TDMA_convertion(UWORD16 twentyms_value);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
194 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
195 #if (MELODY_E2) || (L1_VOICE_MEMO_AMR)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
196 UWORD8 copy_byte_data_from_buffer (UWORD8 session_id, UWORD16 *buffer_size, UWORD8 **ptr_buf, UWORD16 data_size, UWORD8 *ptr_dst);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
197 UWORD8 copy_byte_data_to_buffer (UWORD8 session_id, UWORD16 *buffer_size, UWORD8 **ptr_buf, UWORD16 data_size, UWORD8 *ptr_src);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
198 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
199 #if (L1_VOICE_MEMO_AMR)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
200 UWORD8 copy_byte_data_le_from_buffer (UWORD8 session_id, UWORD16 *buffer_size, UWORD8 **ptr_buf, UWORD16 data_size, API *ptr_dst);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
201 UWORD8 copy_byte_data_le_to_buffer (UWORD8 session_id, UWORD16 *buffer_size, UWORD8 **ptr_buf, UWORD16 data_size, API *ptr_src);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
202 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
203 #if (L1_EXT_AUDIO_MGT == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
204 void l1_ext_audio_mgt_dma_handler(SYS_UWORD16 dma_status);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
205 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
206 #if (L1_IIR == 2)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
207 void l1_audio_iir4x_copy_params();
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
208 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
209
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
210 #if (L1_AGC_UL== 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
211 void l1_audio_agc_ul_copy_params();
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
212 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
213
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
214 #if (L1_AGC_DL== 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
215 void l1_audio_agc_dl_copy_params();
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
216 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
217
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
218 #if (L1_DRC == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
219 void l1_audio_drc1x_copy_params();
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
220 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
221
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
222 #if(L1_BT_AUDIO ==1)||(L1_WCM ==1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
223 void l1_audio_manager(UWORD8 *src, UWORD16 size);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
224 void l1_audio_bt_init(UINT16 media_buf_size);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
225 extern void l1mp3_dma_it_handler(SYS_UWORD16 d_dma_channel_it_status);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
226 extern void l1aac_dma_it_handler(SYS_UWORD16 d_dma_channel_it_status);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
227 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
228 #if(L1_BT_AUDIO ==1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
229 T_L1_BT_AUDIO bt_audio;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
230
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
231 extern T_MP3_DMA_PARAM *mp3_dma;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
232 extern T_AAC_DMA_PARAM *aac_dma;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
233 extern void l1a_bt_audio_noti_process();
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
234 extern UWORD16 pending_dec_req;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
235
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
236 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
237 /**************************************/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
238 /* External prototypes */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
239 /**************************************/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
240 extern UWORD8 Cust_get_pointer (UWORD16 **ptr, UWORD16 *buffer_size, UWORD8 session_id);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
241
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
242 #if ((L1_STEREOPATH == 1) && (OP_L1_STANDALONE == 1))
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
243 extern void l1tm_stereopath_DMA_handler(SYS_UWORD16 dma_status);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
244 #if TESTMODE
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
245 extern T_STP_DRV_MCU_DSP *stp_drv_ndb;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
246 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
247 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
248
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
249 #if (L1_EXT_AUDIO_MGT == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
250 extern NU_HISR EXT_AUDIO_MGT_hisr;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
251 extern T_MIDI_DMA_PARAM midi_buf;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
252 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
253
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
254 #if (L1_DRC == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
255 extern T_DRC_MCU_DSP *drc_ndb;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
256 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
257
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
258 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
259 /* copy_data_from_buffer() */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
260 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
261 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
262 /* Parameters : session_id */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
263 /* buffer_size */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
264 /* data_size */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
265 /* ptr_dst */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
266 /* ptr_src */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
267 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
268 /* Return : error_id */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
269 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
270 /* Description : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
271 /* This function copies the data from the buffer */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
272 /* (buffer size: buffer_size, start address: ptr_buf) to */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
273 /* the destination indicated by ptr_dst. The size of the */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
274 /* data to download is data_size. The session_id */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
275 /* indicates to the custom flash manager the type of */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
276 /* data. */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
277 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
278 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
279 UWORD8 copy_data_from_buffer (UWORD8 session_id, UWORD16 *buffer_size, UWORD16 **ptr_buf, UWORD16 data_size, API *ptr_dst)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
280 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
281 UWORD8 error_id = 0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
282
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
283 while (data_size != 0)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
284 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
285 while( (data_size !=0) && (*buffer_size != 0) )
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
286 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
287 *ptr_dst++ = *(*ptr_buf)++;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
288 data_size--;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
289 (*buffer_size)--;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
290 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
291 // A new buffer is requested in order to finish to copy the data
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
292 if ( data_size != 0)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
293 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
294 *buffer_size = data_size;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
295 error_id = Cust_get_pointer( ptr_buf, buffer_size, session_id);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
296
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
297 // An error is occured
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
298 if (error_id)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
299 return(error_id);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
300 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
301 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
302
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
303 return(error_id);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
304 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
305
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
306 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
307 /* copy_data_to_buffer() */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
308 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
309 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
310 /* Parameters : session_id */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
311 /* buffer_size */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
312 /* data_size */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
313 /* ptr_dst */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
314 /* ptr_src */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
315 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
316 /* Return : error_id */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
317 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
318 /* Description : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
319 /* This function copies the data to the buffer */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
320 /* (buffer size: buffer_size, start address: ptr_buf) */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
321 /* from the source indicated by ptr_src. The size of the */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
322 /* data to save is data_size. The session_id */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
323 /* indicates to the custom flash manager the type of */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
324 /* data. */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
325 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
326 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
327 UWORD8 copy_data_to_buffer (UWORD8 session_id, UWORD16 *buffer_size, UWORD16 **ptr_buf, UWORD16 data_size, API *ptr_src)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
328 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
329 UWORD8 error_id = 0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
330
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
331 while (data_size != 0)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
332 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
333 while( (data_size !=0) && (*buffer_size != 0) )
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
334 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
335 *(*ptr_buf)++ = *ptr_src++;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
336 data_size--;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
337 (*buffer_size)--;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
338 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
339 // A new buffer is requested in order to finish to copy the data
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
340 if (data_size != 0)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
341 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
342 *buffer_size = data_size;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
343 error_id = Cust_get_pointer(ptr_buf, buffer_size, session_id);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
344
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
345 // An error is occured
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
346 if (error_id)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
347 return(error_id);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
348 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
349 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
350
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
351 return(error_id);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
352 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
353
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
354 #if (MELODY_E2) || (L1_VOICE_MEMO_AMR)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
355 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
356 /* copy_byte_data_from_buffer() */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
357 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
358 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
359 /* Parameters : session_id */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
360 /* buffer_size */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
361 /* data_size */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
362 /* ptr_dst */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
363 /* ptr_src */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
364 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
365 /* Return : error_id */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
366 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
367 /* Description : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
368 /* This function copies byte per byte the data from */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
369 /* the buffer (buffer size (in byte): buffer_size, */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
370 /* start address: ptr_buf) to the destination indicated */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
371 /* by ptr_dst. The size of the data to download is */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
372 /* data_size(in byte). The session_id indicates to the */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
373 /* custom flash manager the type of data. */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
374 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
375 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
376 UWORD8 copy_byte_data_from_buffer (UWORD8 session_id, UWORD16 *buffer_size, UWORD8 **ptr_buf, UWORD16 data_size, UWORD8 *ptr_dst)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
377 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
378 UWORD8 error_id = 0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
379 UWORD16 requested_size;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
380
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
381 while (data_size != 0)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
382 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
383 while( (data_size !=0) && (*buffer_size != 0) )
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
384 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
385 *ptr_dst++ = *(*ptr_buf)++;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
386 data_size--;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
387 (*buffer_size)--;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
388 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
389 // A new buffer is requested in order to finish to copy the data
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
390 if ( data_size != 0)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
391 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
392 // Calculate the size of the data to request in 16-bit word
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
393 if (*buffer_size & 0x0001)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
394 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
395 // The size is a odd value
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
396 requested_size = (data_size >> 1) + 1;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
397 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
398 else
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
399 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
400 // the size is an even value
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
401 requested_size = (data_size >> 1);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
402 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
403
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
404 error_id = Cust_get_pointer( (UWORD16 **)ptr_buf, &requested_size, session_id);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
405
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
406 // An error is occured
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
407 if (error_id)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
408 return(error_id);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
409
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
410 *buffer_size = (requested_size << 1);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
411 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
412 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
413
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
414 return(error_id);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
415 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
416
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
417 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
418 /* copy_data_to_buffer() */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
419 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
420 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
421 /* Parameters : session_id */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
422 /* buffer_size */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
423 /* data_size */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
424 /* ptr_dst */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
425 /* ptr_src */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
426 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
427 /* Return : error_id */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
428 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
429 /* Description : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
430 /* This function copies byte per byte the data to the */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
431 /* buffer (buffer size in byte: buffer_size, start */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
432 /* address: ptr_buf) from the source indicated by */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
433 /* ptr_src. The size in byte of the data to save is */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
434 /* data_size. The session_id indicates to the custom */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
435 /* flash manager the type of data. */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
436 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
437 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
438 UWORD8 copy_byte_data_to_buffer (UWORD8 session_id, UWORD16 *buffer_size, UWORD8 **ptr_buf, UWORD16 data_size, UWORD8 *ptr_src)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
439 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
440 UWORD8 error_id = 0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
441 UWORD16 requested_size;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
442
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
443 while (data_size != 0)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
444 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
445 while( (data_size !=0) && (*buffer_size != 0) )
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
446 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
447 *(*ptr_buf)++ = *ptr_src++;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
448 data_size--;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
449 (*buffer_size)--;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
450 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
451 // A new buffer is requested in order to finish to copy the data
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
452 if (data_size != 0)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
453 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
454 // Calculate the size of the data to request in 16-bit word
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
455 if (*buffer_size & 0x0001)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
456 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
457 // The size is a odd value
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
458 requested_size = (data_size >> 1) + 1;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
459 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
460 else
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
461 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
462 // the size is an even value
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
463 requested_size = (data_size >> 1);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
464 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
465
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
466 error_id = Cust_get_pointer((UWORD16 **)ptr_buf, &requested_size, session_id);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
467
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
468 // An error is occured
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
469 if (error_id)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
470 return(error_id);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
471
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
472 *buffer_size = (requested_size << 1);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
473 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
474 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
475
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
476 return(error_id);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
477 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
478 #endif //#if (MELODY_E2) || (L1_VOICE_MEMO_AMR)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
479
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
480 #if (MELODY_E2)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
481
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
482 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
483 /* audio_twentyms_to_TDMA_convertion() */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
484 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
485 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
486 /* Parameters : 20ms value */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
487 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
488 /* Return : TDMA value */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
489 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
490 /* Description : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
491 /* This function convert a duration from 20ms unit to */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
492 /* TDMA unit. */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
493 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
494 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
495 UWORD16 audio_twentyms_to_TDMA_convertion(UWORD16 twentyms_value)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
496 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
497 UWORD16 TDMA_value;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
498
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
499 // 20ms # 4 TDMA
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
500 TDMA_value = twentyms_value << 2;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
501
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
502 // Compensation factor: 1 TDMA each 60ms.
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
503 TDMA_value += (twentyms_value/3);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
504
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
505 return(TDMA_value);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
506 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
507 #endif // MELODY_E2
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
508
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
509 #if (L1_VOICE_MEMO_AMR)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
510 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
511 /* copy_byte_data_le_from_buffer() */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
512 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
513 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
514 /* Parameters : session_id */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
515 /* buffer_size */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
516 /* data_size */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
517 /* ptr_dst */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
518 /* ptr_src */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
519 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
520 /* Return : error_id */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
521 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
522 /* Description : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
523 /* This function copies byte per byte the data from */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
524 /* the buffer (buffer size (in byte): buffer_size, */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
525 /* start address: ptr_buf) to the destination indicated */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
526 /* by ptr_dst. The size of the data to download is */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
527 /* data_size(in byte). The session_id indicates to the */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
528 /* custom flash manager the type of data. */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
529 /* Data in buffer is expected to be big-endian and will */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
530 /* be copied in order to retrieve little-endian order in */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
531 /* ptr_dst */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
532 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
533 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
534 UWORD8 copy_byte_data_le_from_buffer (UWORD8 session_id, UWORD16 *buffer_size, UWORD8 **ptr_buf, UWORD16 data_size, API *ptr_dst)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
535 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
536 UWORD8 error_id = 0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
537 UWORD16 requested_size;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
538 UWORD16 data_size_inv = 0;
264
bb75ddc13696 l1audio_func.c: reconstruction complete, perfect match to TCS211 object
Mychaela Falconia <falcon@freecalypso.org>
parents: 263
diff changeset
539 UWORD16 temp_uword16;
262
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
540
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
541 while (data_size_inv != data_size)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
542 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
543 /* we go from 0 to data_size copying to MSB (even numbers) then LSB (odd numbers) of DSP */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
544 while( (data_size_inv != data_size) && (*buffer_size != 0) )
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
545 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
546 if (data_size_inv & 0x0001)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
547 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
548 temp_uword16 |= *(*ptr_buf)++;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
549 *(ptr_dst)++ = temp_uword16;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
550 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
551 else
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
552 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
553 temp_uword16 = (*(*ptr_buf)++ << 8);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
554 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
555 data_size_inv++;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
556 (*buffer_size)--;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
557 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
558 // A new buffer is requested in order to finish to copy the data
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
559 if ( data_size_inv != data_size)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
560 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
561 // Calculate the size of the data to request in 16-bit word
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
562 if ((data_size - data_size_inv) & 0x0001)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
563 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
564 // The size is an odd value
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
565 requested_size = ((data_size - data_size_inv) >> 1) + 1;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
566 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
567 else
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
568 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
569 // the size is an even value
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
570 requested_size = ((data_size - data_size_inv) >> 1);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
571 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
572
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
573 error_id = Cust_get_pointer((UWORD16 **)ptr_buf, &requested_size, session_id);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
574
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
575 // An error is occured
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
576 if (error_id)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
577 return(error_id);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
578
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
579 *buffer_size = (requested_size << 1);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
580 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
581 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
582
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
583 if (data_size & 0x0001)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
584 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
585 *(ptr_dst)++ = temp_uword16;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
586 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
587
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
588 return(error_id);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
589 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
590
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
591 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
592 /* copy_byte_data_le_to_buffer() */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
593 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
594 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
595 /* Parameters : session_id */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
596 /* buffer_size */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
597 /* data_size */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
598 /* ptr_dst */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
599 /* ptr_src */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
600 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
601 /* Return : error_id */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
602 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
603 /* Description : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
604 /* This function copies byte per byte the data to the */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
605 /* buffer (buffer size in byte: buffer_size, start */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
606 /* address: ptr_buf) from the source indicated by */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
607 /* ptr_src. The size in byte of the data to save is */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
608 /* data_size. The session_id indicates to the custom */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
609 /* flash manager the type of data. */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
610 /* Data is expected to be little-endian in ptr_src and */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
611 /* will be copied in order to retrieve big-endian */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
612 /* order in buffer */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
613 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
614 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
615 UWORD8 copy_byte_data_le_to_buffer (UWORD8 session_id, UWORD16 *buffer_size, UWORD8 **ptr_buf, UWORD16 data_size, API *ptr_src)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
616 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
617 UWORD8 error_id = 0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
618 UWORD8 data_size_inv = 0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
619 UWORD16 requested_size;
264
bb75ddc13696 l1audio_func.c: reconstruction complete, perfect match to TCS211 object
Mychaela Falconia <falcon@freecalypso.org>
parents: 263
diff changeset
620 UWORD16 temp_uword16;
262
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
621
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
622 /* we go from 0 to data_size copying MSB (even numbers) then LSB (odd numbers) from DSP */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
623 while (data_size_inv != data_size)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
624 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
625 while( (data_size_inv != data_size) && (*buffer_size != 0) )
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
626 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
627 /* if data_size_inv is odd, we need the LSB of the DSP word */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
628 if (data_size_inv & 0x0001)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
629 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
630 *(*ptr_buf)++ = (UWORD8)(temp_uword16 & 0x00FF);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
631 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
632 /* if data_size_inv is even, we need the MSB of the DSP word */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
633 else
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
634 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
635 temp_uword16 = *(ptr_src)++;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
636 *(*ptr_buf)++ = (UWORD8)(temp_uword16 >> 8);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
637 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
638 data_size_inv++;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
639 (*buffer_size)--;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
640 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
641 // A new buffer is requested in order to finish to copy the data
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
642 if ( data_size_inv != data_size)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
643 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
644 // Calculate the size of the data to request in 16-bit word
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
645 if ((data_size - data_size_inv) & 0x0001)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
646 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
647 // The size is a odd value
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
648 requested_size = ((data_size - data_size_inv) >> 1) + 1;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
649 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
650 else
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
651 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
652 // the size is an even value
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
653 requested_size = ((data_size - data_size_inv) >> 1);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
654 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
655
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
656 error_id = Cust_get_pointer((UWORD16 **)ptr_buf, &requested_size, session_id);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
657
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
658 // An error occured
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
659 if (error_id)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
660 return(error_id);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
661
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
662 *buffer_size = (requested_size << 1);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
663 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
664 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
665
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
666 return(error_id);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
667 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
668 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
669
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
670 #if (L1_STEREOPATH == 1) && (CODE_VERSION == NOT_SIMULATION)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
671 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
672 /* l1_audio_api_handler() */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
673 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
674 /* Parameters : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
675 /* Return : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
676 /* Functionality : API int management */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
677 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
678 void l1_audio_api_handler(void)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
679 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
680 UWORD16 rootcause;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
681
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
682 if (l1a_l1s_com.stereopath_drv_task.parameters.feature_identifier == AUDIO_SP_TESTS_ID)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
683 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
684 #if (TESTMODE && (OP_L1_STANDALONE == 1))
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
685 rootcause = stp_drv_ndb->d_cport_api_dma_rootcause;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
686
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
687 l1tm_stereopath_DMA_handler((SYS_UWORD16) rootcause);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
688 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
689 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
690 } /* l1_audio_api_handler() */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
691 #endif // (L1_STEREOPATH == 1) && (CODE_VERSION == NOT_SIMULATION)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
692
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
693 #if (L1_EXT_AUDIO_MGT == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
694 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
695 /* l1_ext_audio_mgt_dma_handler() */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
696 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
697 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
698 /* Parameters : dma_status */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
699 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
700 /* Return : none */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
701 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
702 /* Description : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
703 /* This function is used to handle a DMA interrupt */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
704 /* that will notify to the external midi play process */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
705 /* that a new buffer is needed. */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
706 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
707 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
708 void l1_ext_audio_mgt_dma_handler(SYS_UWORD16 dma_status)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
709 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
710 NU_Activate_HISR(&EXT_AUDIO_MGT_hisr); // activate external MIDI HISR
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
711 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
712 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
713
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
714 #if (L1_LIMITER == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
715 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
716 /* l1_audio_lim_update_mul_low_high() */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
717 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
718 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
719 /* Parameters : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
720 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
721 /* Return : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
722 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
723 /* Description : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
724 /* ------------- */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
725 /* This function is used to update mul_low and mul_high */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
726 /* Limiter parameters in function to volume gain (Q15) */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
727 /* First the function read the last controlled volume */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
728 /* in the MCU/DSP API then it processed mul_low[0/1] */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
729 /* and mul_high[0/1] according to following equations: */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
730 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
731 /* thr_low = - thr_low_slope x volume + thr_low_0 */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
732 /* thr_high = - thr_high_slope x volume + thr_high_0 */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
733 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
734 /* mul_low[0] = 32767 / thr_low */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
735 /* mul_low[1] = 32767 x thr_low */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
736 /* mul_high[0] = 32767 / thr_high */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
737 /* mul_high[1] = 32767 x thr_high */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
738 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
739 void l1_audio_lim_update_mul_low_high()
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
740 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
741 #if (CODE_VERSION != SIMULATION)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
742 #if (ANLG_FAM == 3)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
743 WORD16 volume_q15 = ABB_Read_DLGain();
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
744 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
745 #if (ANLG_FAM == 11)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
746 WORD16 volume_q15 = (WORD16)(l1_audio_abb_Read_DLGain());
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
747 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
748 #else
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
749 WORD16 volume_q15 = 0x4000; // -6 dB for example in simulation
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
750 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
751 WORD16 thr_low, thr_high;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
752
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
753 /* Process Thr_low */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
754 thr_low = (- (l1a_l1s_com.limiter_task.parameters.thr_low_slope * volume_q15)>>15) +
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
755 l1a_l1s_com.limiter_task.parameters.thr_low_0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
756 // if (thr_low > 32767) //OMAPS00090550
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
757 // thr_low = 32767;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
758
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
759 /* Process Thr_high */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
760 thr_high = (- (l1a_l1s_com.limiter_task.parameters.thr_high_slope * volume_q15)>>15) +
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
761 l1a_l1s_com.limiter_task.parameters.thr_high_0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
762 // if (thr_high > 32767) //OMAPS00090550
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
763 // thr_high = 32767;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
764
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
765 /* Process amd store mul_low[0/1] */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
766 if (thr_low != 0)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
767 l1s_dsp_com.dsp_ndb_ptr->a_lim_mul_low[0] = 32767 / thr_low; // Q0
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
768 else
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
769 l1s_dsp_com.dsp_ndb_ptr->a_lim_mul_low[0] = 32767; // should never happen
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
770 l1s_dsp_com.dsp_ndb_ptr->a_lim_mul_low[1] = thr_low; // Q15
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
771
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
772 /* Process and store mul_high[0/1] */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
773 if (thr_high != 0)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
774 l1s_dsp_com.dsp_ndb_ptr->a_lim_mul_high[0] = 32767 / thr_high; // Q0
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
775 else
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
776 l1s_dsp_com.dsp_ndb_ptr->a_lim_mul_high[0] = 32767; // should never happen
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
777 l1s_dsp_com.dsp_ndb_ptr->a_lim_mul_high[1] = thr_high; // Q15
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
778 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
779
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
780 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
781 /* l1_audio_lim_update_mul_low_high() */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
782 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
783 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
784 /* Parameters : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
785 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
786 /* Return : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
787 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
788 /* Description : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
789 /* ------------- */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
790 /* This function MUST be called at each volume change in */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
791 /* order to request a limiter partial update. */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
792 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
793 void l1_audio_lim_partial_update()
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
794 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
795 // Set partial update command
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
796 l1a_l1s_com.limiter_task.command.partial_update = TRUE;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
797 // Force L1S execution
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
798 l1a_l1s_com.time_to_next_l1s_task = 0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
799 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
800 #endif // L1_LIMITER == 1
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
801
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
802
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
803
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
804 #if (L1_AGC_UL == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
805 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
806 /* l1_audio_agc_ul_copy_params */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
807 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
808 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
809 /* Parameters : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
810 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
811 /* Return : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
812 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
813 /* Description : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
814 /* ------------- */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
815 /* This function is used to copy the AGC UL 1x parameter */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
816 /* to API memory using a pointer */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
817 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
818
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
819 void l1_audio_agc_ul_copy_params()
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
820 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
821
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
822 l1s_dsp_com.dsp_ndb_ptr->d_agc_ul_control = l1a_l1s_com.agc_ul_task.parameters.control;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
823 l1s_dsp_com.dsp_ndb_ptr->d_agc_ul_frame_size = l1a_l1s_com.agc_ul_task.parameters.frame_size;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
824 l1s_dsp_com.dsp_ndb_ptr->d_agc_ul_targeted_level = l1a_l1s_com.agc_ul_task.parameters.targeted_level;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
825 l1s_dsp_com.dsp_ndb_ptr->d_agc_ul_signal_up = l1a_l1s_com.agc_ul_task.parameters.signal_up;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
826 l1s_dsp_com.dsp_ndb_ptr->d_agc_ul_signal_down = l1a_l1s_com.agc_ul_task.parameters.signal_down;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
827 l1s_dsp_com.dsp_ndb_ptr->d_agc_ul_max_scale = l1a_l1s_com.agc_ul_task.parameters.max_scale;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
828 l1s_dsp_com.dsp_ndb_ptr->d_agc_ul_gain_smooth_alpha = l1a_l1s_com.agc_ul_task.parameters.gain_smooth_alpha;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
829 l1s_dsp_com.dsp_ndb_ptr->d_agc_ul_gain_smooth_alpha_fast = l1a_l1s_com.agc_ul_task.parameters.gain_smooth_alpha_fast;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
830 l1s_dsp_com.dsp_ndb_ptr->d_agc_ul_gain_smooth_beta = l1a_l1s_com.agc_ul_task.parameters.gain_smooth_beta;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
831 l1s_dsp_com.dsp_ndb_ptr->d_agc_ul_gain_smooth_beta_fast = l1a_l1s_com.agc_ul_task.parameters.gain_smooth_beta_fast;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
832 l1s_dsp_com.dsp_ndb_ptr->d_agc_ul_gain_intp_flag = l1a_l1s_com.agc_ul_task.parameters.gain_intp_flag;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
833
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
834 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
835 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
836
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
837 #if (L1_AGC_DL == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
838 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
839 /* l1_audio_agc_dl_copy_params */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
840 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
841 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
842 /* Parameters : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
843 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
844 /* Return : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
845 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
846 /* Description : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
847 /* ------------- */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
848 /* This function is used to copy the AGC DL 1x parameter */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
849 /* to API memory using a pointer */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
850 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
851
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
852 void l1_audio_agc_dl_copy_params()
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
853 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
854 l1s_dsp_com.dsp_ndb_ptr->d_agc_dl_control = l1a_l1s_com.agc_dl_task.parameters.control;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
855 l1s_dsp_com.dsp_ndb_ptr->d_agc_dl_frame_size = l1a_l1s_com.agc_dl_task.parameters.frame_size;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
856 l1s_dsp_com.dsp_ndb_ptr->d_agc_dl_targeted_level = l1a_l1s_com.agc_dl_task.parameters.targeted_level;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
857 l1s_dsp_com.dsp_ndb_ptr->d_agc_dl_signal_up = l1a_l1s_com.agc_dl_task.parameters.signal_up;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
858 l1s_dsp_com.dsp_ndb_ptr->d_agc_dl_signal_down = l1a_l1s_com.agc_dl_task.parameters.signal_down;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
859 l1s_dsp_com.dsp_ndb_ptr->d_agc_dl_max_scale = l1a_l1s_com.agc_dl_task.parameters.max_scale;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
860 l1s_dsp_com.dsp_ndb_ptr->d_agc_dl_gain_smooth_alpha = l1a_l1s_com.agc_dl_task.parameters.gain_smooth_alpha;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
861 l1s_dsp_com.dsp_ndb_ptr->d_agc_dl_gain_smooth_alpha_fast = l1a_l1s_com.agc_dl_task.parameters.gain_smooth_alpha_fast;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
862 l1s_dsp_com.dsp_ndb_ptr->d_agc_dl_gain_smooth_beta = l1a_l1s_com.agc_dl_task.parameters.gain_smooth_beta;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
863 l1s_dsp_com.dsp_ndb_ptr->d_agc_dl_gain_smooth_beta_fast = l1a_l1s_com.agc_dl_task.parameters.gain_smooth_beta_fast;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
864 l1s_dsp_com.dsp_ndb_ptr->d_agc_dl_gain_intp_flag = l1a_l1s_com.agc_dl_task.parameters.gain_intp_flag;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
865
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
866 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
867 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
868
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
869
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
870 #if (L1_IIR == 2)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
871 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
872 /* l1_audio_iir4x_copy_params */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
873 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
874 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
875 /* Parameters : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
876 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
877 /* Return : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
878 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
879 /* Description : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
880 /* ------------- */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
881 /* This function is used to copy the IIR 4x parameter */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
882 /* to API memory using a pointer */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
883 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
884
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
885 void l1_audio_iir4x_copy_params()
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
886 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
887 UWORD8 i;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
888 UWORD8 j;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
889
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
890 // Set IIR parameters
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
891 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_control = l1a_l1s_com.iir_task.parameters->parameters.control;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
892 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_frame_size = l1a_l1s_com.iir_task.parameters->parameters.frame_size;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
893 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_fir_swap = l1a_l1s_com.iir_task.parameters->parameters.fir_swap;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
894
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
895 // Set parameter os FIR part
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
896 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_fir_enable = l1a_l1s_com.iir_task.parameters->parameters.fir_filter.fir_enable;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
897 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_fir_length = l1a_l1s_com.iir_task.parameters->parameters.fir_filter.fir_length;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
898 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_fir_shift = l1a_l1s_com.iir_task.parameters->parameters.fir_filter.fir_shift;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
899
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
900 for (i=0; i < (l1a_l1s_com.iir_task.parameters->parameters.fir_filter.fir_length); i++)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
901 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
902 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_fir_taps[i] = l1a_l1s_com.iir_task.parameters->parameters.fir_filter.fir_taps[i];
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
903 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
904
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
905 // Set parameters for IIR part
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
906 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_enable = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_enable;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
907 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_number = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_number;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
908
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
909 // Set parameters for IIR part - SOS 1
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
910 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_1 = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[0].sos_fact;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
911 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_form_1 = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[0].sos_fact_form;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
912
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
913 for (j=0; j < IIR_4X_ORDER_OF_SECTION; j++)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
914 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
915 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_den_1[j] = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[0].sos_den[j];
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
916 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
917 for (j=0; j < (IIR_4X_ORDER_OF_SECTION + 1); j++)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
918 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
919 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_num_1[j] = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[0].sos_num[j];
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
920 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
921 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_num_form_1 = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[0].sos_num_form;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
922
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
923
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
924 // Set parameters for IIR part - SOS 2
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
925 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_2 = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[1].sos_fact;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
926 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_form_2 = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[1].sos_fact_form;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
927
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
928 for (j=0; j < IIR_4X_ORDER_OF_SECTION; j++)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
929 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
930 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_den_2[j] = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[1].sos_den[j];
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
931 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
932 for (j=0; j < (IIR_4X_ORDER_OF_SECTION + 1); j++)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
933 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
934 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_num_2[j] = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[1].sos_num[j];
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
935 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
936 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_num_form_2 = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[1].sos_num_form;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
937
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
938
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
939 // Set parameters for IIR part - SOS 3
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
940 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_3 = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[2].sos_fact;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
941 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_form_3 = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[2].sos_fact_form;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
942
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
943 for (j=0; j < IIR_4X_ORDER_OF_SECTION; j++)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
944 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
945 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_den_3[j] = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[2].sos_den[j];
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
946 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
947 for (j=0; j < (IIR_4X_ORDER_OF_SECTION + 1); j++)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
948 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
949 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_num_3[j] = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[2].sos_num[j];
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
950 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
951 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_num_form_3 = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[2].sos_num_form;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
952
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
953
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
954 // Set parameters for IIR part - SOS 4
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
955 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_4 = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[3].sos_fact;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
956 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_form_4 = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[3].sos_fact_form;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
957
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
958 for (j=0; j < IIR_4X_ORDER_OF_SECTION; j++)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
959 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
960 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_den_4[j] = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[3].sos_den[j];
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
961 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
962 for (j=0; j < (IIR_4X_ORDER_OF_SECTION + 1); j++)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
963 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
964 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_num_4[j] = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[3].sos_num[j];
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
965 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
966 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_num_form_4 = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[3].sos_num_form;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
967
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
968
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
969 // Set parameters for IIR part - SOS 5
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
970 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_5 = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[4].sos_fact;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
971 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_form_5 = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[4].sos_fact_form;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
972
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
973 for (j=0; j < IIR_4X_ORDER_OF_SECTION; j++)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
974 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
975 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_den_5[j] = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[4].sos_den[j];
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
976 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
977 for (j=0; j < (IIR_4X_ORDER_OF_SECTION + 1); j++)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
978 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
979 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_num_5[j] = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[4].sos_num[j];
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
980 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
981 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_num_form_5 = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[4].sos_num_form;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
982
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
983
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
984 // Set parameters for IIR part - SOS 6
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
985 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_6 = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[5].sos_fact;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
986 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_fact_form_6 = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[5].sos_fact_form;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
987
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
988 for (j=0; j < IIR_4X_ORDER_OF_SECTION; j++)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
989 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
990 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_den_6[j] = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[5].sos_den[j];
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
991 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
992 for (j=0; j < (IIR_4X_ORDER_OF_SECTION + 1); j++)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
993 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
994 l1s_dsp_com.dsp_ndb_ptr->a_iir4x_sos_num_6[j] = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[5].sos_num[j];
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
995 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
996 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_sos_num_form_6 = l1a_l1s_com.iir_task.parameters->parameters.sos_filter.sos_filter[5].sos_num_form;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
997
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
998
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
999
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1000 l1s_dsp_com.dsp_ndb_ptr->d_iir4x_gain = l1a_l1s_com.iir_task.parameters->parameters.gain;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1001
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1002 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1003
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1004 #endif // L1_IIR == 2
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1005
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1006
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1007 #if (L1_DRC == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1008 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1009 /* l1_audio_drc1x_copy_params */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1010 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1011 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1012 /* Parameters : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1013 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1014 /* Return : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1015 /* */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1016 /* Description : */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1017 /* ------------- */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1018 /* This function is used to copy the DRC 1x parameter */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1019 /* to API memory using a pointer */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1020 /*-------------------------------------------------------*/
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1021
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1022 void l1_audio_drc1x_copy_params()
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1023 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1024 UWORD8 i;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1025
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1026 // Set DRC parameters
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1027 drc_ndb->d_drc_speech_mode_samp_f = l1a_l1s_com.drc_task.parameters->parameters.speech_mode_samp_f;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1028 drc_ndb->d_drc_num_subbands = l1a_l1s_com.drc_task.parameters->parameters.num_subbands;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1029 drc_ndb->d_drc_frame_len = l1a_l1s_com.drc_task.parameters->parameters.frame_len;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1030 drc_ndb->d_drc_expansion_knee_fb_bs = l1a_l1s_com.drc_task.parameters->parameters.expansion_knee_fb_bs;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1031 drc_ndb->d_drc_expansion_knee_md_hg = l1a_l1s_com.drc_task.parameters->parameters.expansion_knee_md_hg;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1032 drc_ndb->d_drc_expansion_ratio_fb_bs = l1a_l1s_com.drc_task.parameters->parameters.expansion_ratio_fb_bs;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1033 drc_ndb->d_drc_expansion_ratio_md_hg = l1a_l1s_com.drc_task.parameters->parameters.expansion_ratio_md_hg;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1034 drc_ndb->d_drc_max_amplification_fb_bs = l1a_l1s_com.drc_task.parameters->parameters.max_amplification_fb_bs;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1035 drc_ndb->d_drc_max_amplification_md_hg = l1a_l1s_com.drc_task.parameters->parameters.max_amplification_md_hg;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1036 drc_ndb->d_drc_compression_knee_fb_bs = l1a_l1s_com.drc_task.parameters->parameters.compression_knee_fb_bs;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1037 drc_ndb->d_drc_compression_knee_md_hg = l1a_l1s_com.drc_task.parameters->parameters.compression_knee_md_hg;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1038 drc_ndb->d_drc_compression_ratio_fb_bs = l1a_l1s_com.drc_task.parameters->parameters.compression_ratio_fb_bs;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1039 drc_ndb->d_drc_compression_ratio_md_hg = l1a_l1s_com.drc_task.parameters->parameters.compression_ratio_md_hg;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1040 drc_ndb->d_drc_energy_limiting_th_fb_bs = l1a_l1s_com.drc_task.parameters->parameters.energy_limiting_th_fb_bs;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1041 drc_ndb->d_drc_energy_limiting_th_md_hg = l1a_l1s_com.drc_task.parameters->parameters.energy_limiting_th_md_hg;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1042 drc_ndb->d_drc_limiter_threshold_fb = l1a_l1s_com.drc_task.parameters->parameters.limiter_threshold_fb;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1043 drc_ndb->d_drc_limiter_threshold_bs = l1a_l1s_com.drc_task.parameters->parameters.limiter_threshold_bs;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1044 drc_ndb->d_drc_limiter_threshold_md = l1a_l1s_com.drc_task.parameters->parameters.limiter_threshold_md;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1045 drc_ndb->d_drc_limiter_threshold_hg = l1a_l1s_com.drc_task.parameters->parameters.limiter_threshold_hg;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1046 drc_ndb->d_drc_limiter_hangover_spect_preserve = l1a_l1s_com.drc_task.parameters->parameters.limiter_hangover_spect_preserve;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1047 drc_ndb->d_drc_limiter_release_fb_bs = l1a_l1s_com.drc_task.parameters->parameters.limiter_release_fb_bs;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1048 drc_ndb->d_drc_limiter_release_md_hg = l1a_l1s_com.drc_task.parameters->parameters.limiter_release_md_hg;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1049 drc_ndb->d_drc_gain_track_fb_bs = l1a_l1s_com.drc_task.parameters->parameters.gain_track_fb_bs;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1050 drc_ndb->d_drc_gain_track_md_hg = l1a_l1s_com.drc_task.parameters->parameters.gain_track_md_hg;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1051
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1052 for (i=0; i < DRC_LPF_LENGTH; i++)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1053 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1054 drc_ndb->a_drc_low_pass_filter[i] = l1a_l1s_com.drc_task.parameters->parameters.low_pass_filter[i];
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1055 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1056 for (i=0; i < DRC_BPF_LENGTH; i++)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1057 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1058 drc_ndb->a_drc_mid_band_filter[i] = l1a_l1s_com.drc_task.parameters->parameters.mid_band_filter[i];
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1059 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1060
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1061 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1062
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1063 #endif // L1_DRC == 1
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1064
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1065 #if(L1_BT_AUDIO == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1066 BOOL L1Audio_InformBtAudioPathState (BOOL connected)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1067 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1068 if(connected==bt_audio.connected_status)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1069 return BT_STATUS_OK;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1070 else
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1071 return BT_STATUS_ERROR;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1072 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1073
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1074 void L1Audio_RegisterBthal (L1AudioPcmCallback pcmCallback, L1AudioConfigureCallback configCallback)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1075 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1076 bt_audio.audio_configure_callback=configCallback;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1077 bt_audio.audio_pcmblock_callback=pcmCallback;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1078 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1079 UWORD8 bt_flag=1;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1080
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1081
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1082 L1AudioPcmStatus L1Audio_PullPcmBlock (L1AudioPcmBlock *pcmBlock)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1083 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1084 UWORD8 status=0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1085 if(bt_flag == 0)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1086 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1087 AUDIO_SEND_TRACE("pull back bef init",RV_TRACE_LEVEL_ERROR);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1088 bt_audio.pcm_data_ready = 0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1089 // return L1_PCM_PENDING;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1090 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1091 // AUDIO_SEND_TRACE("pull back called",RV_TRACE_LEVEL_ERROR);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1092
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1093 if(bt_audio.pcm_data_end == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1094 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1095 AUDIO_SEND_TRACE("abnormal BT request mp3/aac",RV_TRACE_LEVEL_ERROR);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1096
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1097 if(bt_audio.pcmblock.lengthInBytes==2*C_MP3_OUTPUT_BUFFER_SIZE)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1098 l1mp3_dma_it_handler(0);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1099 else if(bt_audio.pcmblock.lengthInBytes==2*C_AAC_OUTPUT_BUFFER_SIZE)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1100 l1aac_dma_it_handler(0);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1101
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1102 bt_audio.pcm_data_end = 0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1103 bt_audio.pcm_data_ready = 0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1104 bt_flag = 0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1105 return L1_PCM_MEDIA_ENDED;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1106 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1107
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1108
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1109 if(bt_audio.pcm_data_failed==0)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1110 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1111 if(bt_audio.pcm_data_ready>0)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1112 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1113 //AUDIO_SEND_TRACE("Data ready for BT-Pull event",RV_TRACE_LEVEL_ERROR);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1114 pcmBlock->pcmBuffer= bt_audio.pcmblock.pcmBuffer;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1115 pcmBlock->lengthInBytes=bt_audio.pcmblock.lengthInBytes;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1116
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1117 bt_audio.pcm_data_ready=0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1118
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1119 if( bt_audio.pcm_data_end==1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1120 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1121 AUDIO_SEND_TRACE("Data ended for BT-Pull event",RV_TRACE_LEVEL_ERROR);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1122 return L1_PCM_MEDIA_ENDED;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1123 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1124 else
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1125 if(bt_audio.pcmblock.lengthInBytes==2*AUDIO_EXT_MIDI_BUFFER_SIZE)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1126 return L1_PCM_READY;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1127 else
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1128 status= L1_PCM_READY;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1129 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1130 else
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1131 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1132 if( bt_audio.pcm_data_end==1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1133 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1134 AUDIO_SEND_TRACE("Data ended for BT-Pull event",RV_TRACE_LEVEL_ERROR);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1135 return L1_PCM_MEDIA_ENDED;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1136 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1137 // AUDIO_SEND_TRACE("Data pending for BT-Pull event",RV_TRACE_LEVEL_ERROR);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1138 bt_audio.pcm_data_pending=1;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1139 status= L1_PCM_PENDING;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1140 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1141 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1142 else
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1143 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1144 AUDIO_SEND_TRACE("Data failed for BT-Pull event",RV_TRACE_LEVEL_ERROR);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1145 return L1_PCM_FAILED;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1146 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1147 if((bt_audio.pcmblock.lengthInBytes==2*C_MP3_OUTPUT_BUFFER_SIZE)&& bt_flag==1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1148 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1149 if(l1a_apihisr_com.mp3.command.stop==TRUE)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1150 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1151 bt_flag=0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1152 l1mp3_dma_it_handler(0);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1153 bt_audio.pcm_data_end = 0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1154 return L1_PCM_MEDIA_ENDED;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1155 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1156 else
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1157 l1mp3_dma_it_handler(0);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1158
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1159 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1160 else if(bt_audio.pcmblock.lengthInBytes==2*C_AAC_OUTPUT_BUFFER_SIZE&& bt_flag==1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1161 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1162 if(l1a_apihisr_com.aac.command.stop==TRUE)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1163 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1164 bt_flag=0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1165 AUDIO_SEND_TRACE("Media ended for BT-Pull event",RV_TRACE_LEVEL_ERROR);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1166 l1aac_dma_it_handler(0);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1167 bt_audio.pcm_data_end = 0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1168 return L1_PCM_MEDIA_ENDED;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1169 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1170 else
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1171 l1aac_dma_it_handler(0);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1172 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1173 else if(bt_audio.pcmblock.lengthInBytes==2*AUDIO_EXT_MIDI_BUFFER_SIZE && bt_flag==1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1174 if( bt_audio.pcm_data_end==1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1175 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1176 bt_flag=0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1177 return L1_PCM_MEDIA_ENDED;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1178 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1179 else
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1180 l1a_bt_audio_noti_process();
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1181 return status;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1182
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1183
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1184 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1185
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1186 void l1_audio_bt_init(UINT16 media_buf_size)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1187 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1188 bt_audio.pcm_data_pending =0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1189 bt_audio.pcm_data_end =0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1190 bt_audio.pcm_data_ready =1;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1191 bt_audio.pcm_data_failed =0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1192
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1193 bt_flag=1;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1194
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1195 if(media_buf_size==C_MP3_OUTPUT_BUFFER_SIZE)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1196 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1197 bt_audio.pcmblock.pcmBuffer=(UWORD8 *)&mp3_dma->a_mp3_dma_input_buffer[0][0];
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1198 bt_audio.pcmblock.lengthInBytes=2*media_buf_size;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1199 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1200 else if(media_buf_size==C_AAC_OUTPUT_BUFFER_SIZE)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1201 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1202 bt_audio.pcmblock.pcmBuffer=(UWORD8 *)&aac_dma->a_aac_dma_input_buffer[0][0];
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1203 bt_audio.pcmblock.lengthInBytes=2*media_buf_size;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1204 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1205 else if(media_buf_size==AUDIO_EXT_MIDI_BUFFER_SIZE)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1206 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1207 bt_audio.pcmblock.pcmBuffer=(UWORD8 *)&midi_buf.audio_play_buffer[0];
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1208 bt_audio.pcmblock.lengthInBytes=2*media_buf_size;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1209 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1210 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1211 #endif//L1_BT_AUDIO == 1
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1212
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1213 #if(L1_BT_AUDIO==1) ||(L1_WCM==1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1214 void l1_audio_manager(UWORD8 *src, UWORD16 size)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1215 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1216 UWORD16 i ;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1217 #if(L1_BT_AUDIO==1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1218 bt_audio.pcmblock.pcmBuffer=src;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1219 bt_audio.pcmblock.lengthInBytes=2*size;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1220 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1221
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1222 #if (OP_L1_STANDALONE == 0)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1223 #if 0
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1224 // l1_audio_wcm(src,size);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1225 if( wcm_enable == 1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1226 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1227 switch(size)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1228 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1229 case 2048:
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1230
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1231 arm_wcm_module( AAC, (T_SINT16 *)src , &wcm_output[0]);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1232 break;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1233 case 1152:
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1234
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1235 arm_wcm_module( MP3, (T_SINT16 *)src , &wcm_output[0]);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1236 break;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1237
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1238
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1239 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1240
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1241 for (i=0 ; i< size ; i++)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1242 while(size>0)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1243 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1244 *src++=(API)*wcm_output++;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1245 size--;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1246 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1247
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1248 /* for (i=0 ; i< size ; i++)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1249 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1250 *src++ = (UINT8 )wcm_output[i]&0x00ff;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1251 *src++ = (UINT8 )(wcm_output[i] & 0xff00) >> 8;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1252 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1253 */
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1254
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1255 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1256
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1257
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1258 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1259 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1260
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1261 #if(L1_BT_AUDIO==1)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1262 if(bt_audio.connected_status==TRUE)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1263 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1264 if(bt_audio.pcm_data_pending>0)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1265 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1266 bt_audio.pcm_data_pending = 0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1267 AUDIO_SEND_TRACE("Pending callback",RV_TRACE_LEVEL_ERROR);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1268 bt_audio.audio_pcmblock_callback(&bt_audio.pcmblock);
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1269
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1270 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1271 else
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1272 bt_audio.pcm_data_ready = 1;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1273 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1274 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1275 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1276 #endif
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1277
263
bc12be646ce8 l1audio_func.c: extraneous LoCosto function removed
Mychaela Falconia <falcon@freecalypso.org>
parents: 262
diff changeset
1278 #if 0 /* FreeCalypso: LoCosto function not present in TCS211 */
262
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1279 UWORD16 l1_ext_audio_get_frequencyrate(UWORD16 frequency_index)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1280 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1281 UWORD16 sampling_frequency=0;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1282
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1283 switch(frequency_index)
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1284 {
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1285 case 1:
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1286 sampling_frequency=8000;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1287 break;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1288 case 2:
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1289 sampling_frequency=11025;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1290 break;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1291 case 3:
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1292 sampling_frequency=16000;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1293 break;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1294 case 4:
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1295 sampling_frequency=22050;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1296 break;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1297 case 5:
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1298 sampling_frequency=32000;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1299 break;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1300 case 6:
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1301 sampling_frequency=44100;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1302 break;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1303 case 7:
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1304 sampling_frequency=48000;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1305 break;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1306 }
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1307
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1308 // Sampling frequency should never be zero
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1309 return sampling_frequency;
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1310 }
263
bc12be646ce8 l1audio_func.c: extraneous LoCosto function removed
Mychaela Falconia <falcon@freecalypso.org>
parents: 262
diff changeset
1311 #endif
bc12be646ce8 l1audio_func.c: extraneous LoCosto function removed
Mychaela Falconia <falcon@freecalypso.org>
parents: 262
diff changeset
1312
262
f79e52ade655 l1audio_func.c: initial import from LoCosto source
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
1313 #endif // AUDIO_TASK