1 /*
2  * ==========================================================
3  *
4  *    Copyright (C) 2020 QuickLogic Corporation
5  *    Licensed under the Apache License, Version 2.0 (the "License");
6  *    you may not use this file except in compliance with the License.
7  *    You may obtain a copy of the License at
8  * 		http://www.apache.org/licenses/LICENSE-2.0
9  *    Unless required by applicable law or agreed to in writing, software
10  *    distributed under the License is distributed on an "AS IS" BASIS,
11  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  *    See the License for the specific language governing permissions and
13  *    limitations under the License.
14  *
15  *    File      : eoss3_hal_audio_config.h
16  *    Purpose :
17  *
18  * ===========================================================
19  *
20  */
21 
22 #ifndef __EOSS3_HAL_AUDIO_CONFIG_H__
23 #define __EOSS3_HAL_AUDIO_CONFIG_H__
24 
25 #include "eoss3_hal_audio.h"
26 
27 #define QL_LPSD_THD_MASK 0xFFFF
28 #define QL_LPSD_RATIO_STOP_MASK 0x00FF0000
29 #define QL_LPSD_RATIO_RUN_MASK 0xFF000000
30 
31 enum QL_LPSD_CONFIG {
32 	QL_LPSD_THD = 0,
33 	QL_LPSD_RATIO_STOP = 16,
34         QL_LPSD_RATIO_RUN = 24,
35 };
36 
37 typedef struct {
38   char run_start;
39   char run_stop;
40   short thr;
41 }t_lpsd_mode_values;
42 
43 #define MAX_LPSD_MODES 10
44 #define LPSD_DEFAULT_MODE 8
45 
46 
47 void taskENTER_CRITICAL_todo();
48 void taskEXIT_CRITICAL_todo();
49 
50 #define QL_AUDIO_HAL_ENTER_CRITICAL_SECTION(id) //taskENTER_CRITICAL()
51 #define QL_AUDIO_HAL_EXIT_CRITICAL_SECTION(id)  //taskEXIT_CRITICAL()
52 
53 typedef enum voice_config_interrupts_e
54 {
55   e_voice_config_interrupts_unmask_all = 0,
56   e_voice_config_interrupts_mask_all = 1
57 }voice_config_interrupts_e;
58 
59 #define SRAM_ADDR_TO_DMA_ADDR(addr) ( SRAM_BASE | addr )
60 #define AUDIO_SRAM_HW_DS_CFG (1<<8)
61 #define DMAC_BLK_LEN   0
62 #define DMAC_BUF_LEN   16
63 
64 t_lpsd_mode_values a_olpsd_mode_values[MAX_LPSD_MODES] = {
65   {
66     .run_start = 58,
67     .run_stop = 66,
68     .thr = 583,
69   },  //mode0
70   {
71     .run_start = 64,
72     .run_stop = 73,
73     .thr = 700
74   }, //mode1
75   {
76     .run_start = 70,
77     .run_stop = 80,
78     .thr = 830
79   }, //mode2
80 
81   {
82     .run_start = 77,
83     .run_stop = 88,
84     .thr = 1000,
85   }, //mode3
86   {
87     .run_start = 85,
88     .run_stop = 97,
89     .thr = 1200
90   }, //mode4
91   {
92     .run_start = 94,
93     .run_stop = 107,
94     .thr = 1440
95   }, //mode5
96   {
97     .run_start = 103,
98     .run_stop = 118,
99     .thr = 1728
100   }, //mode6
101   {
102     .run_start = 113,
103     .run_stop = 130,
104     .thr = 2074
105   }, //mode7
106 
107   {
108     .run_start = 77,
109     .run_stop = 80,
110     .thr = 1200
111   }, //mode8 default mode.
112 
113   {
114     .run_start = 77,
115     .run_stop = 88,
116     .thr = 1200
117   }, //mode9 Sensory recommended mode.
118 
119 };
120 
121 
122 #endif /* __EOSS3_HAL_AUDIO_CONFIG_H__ */
123 
124