b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0
|
| 2 | /*
|
| 3 | * Driver for Audio DSP.
|
| 4 | *
|
| 5 | * Copyright (C) 2022 ASRMicro
|
| 6 | *
|
| 7 | * Author: Yjg Wang <yjgwang@asrmicro.com>
|
| 8 | */
|
| 9 |
|
| 10 |
|
| 11 | /******************************************************************************
|
| 12 | * MODULE IMPLEMENTATION FILE
|
| 13 | *******************************************************************************
|
| 14 | * Title: Header for ADSP in AP subsystem
|
| 15 | *
|
| 16 | * Filename: adsp_ve.h
|
| 17 | *
|
| 18 | * Authors: Yjg Wang
|
| 19 | *
|
| 20 | * Description: Header file for ADSP VE.
|
| 21 | *
|
| 22 | * Last Updated:
|
| 23 | *
|
| 24 | * Notes:
|
| 25 | ******************************************************************************/
|
| 26 | #ifndef _ADSP_VE_H_
|
| 27 | #define _ADSP_VE_H_
|
| 28 |
|
| 29 | #define MAX_MUSIC_STREAM_NUM 6
|
| 30 |
|
| 31 | typedef signed short Word16;
|
| 32 | typedef unsigned short UWord16;
|
| 33 |
|
| 34 | //ICAT EXPORTED STRUCT
|
| 35 | typedef struct {
|
| 36 | Word16 SampleDelay; // reference delay to echo
|
| 37 | Word16 EchoLenInMs; // Fir filter length
|
| 38 | Word16 ConvergenceSpeed; // slowdown
|
| 39 | Word16 Ref2EchoPowerRatio; // ratio of ref to echo, [-12 ~30]db, decimal number
|
| 40 | } EcParamsStruct;
|
| 41 |
|
| 42 | //ICAT EXPORTED STRUCT
|
| 43 | typedef struct {
|
| 44 | Word16 BoostGainDb; //
|
| 45 | Word16 PeakGainDb;
|
| 46 | Word16 BoostNoiseGainDb;
|
| 47 | Word16 BoostRelease;
|
| 48 | Word16 Reserved0;
|
| 49 | Word16 Reserved1;
|
| 50 | } AgcParametersT;
|
| 51 |
|
| 52 | //ICAT EXPORTED STRUCT
|
| 53 | typedef struct {
|
| 54 | UWord16 MASK;
|
| 55 | Word16 EqCoff[7][6]; // a[0], a[1], a[2], b[0], b[1], b[2]
|
| 56 | } BiQuadCoeffT;
|
| 57 |
|
| 58 | // following is ns parametes typedef
|
| 59 | //ICAT EXPORTED STRUCT
|
| 60 | typedef struct {
|
| 61 | Word16 MaxSuppressDb; // [-40 0)db.
|
| 62 | Word16 PeakNoiseDb; // [-70 -12)db.
|
| 63 | Word16 NoiseMatrix; // following is expert parameters
|
| 64 | Word16 RnnParm;
|
| 65 | } NsParamsT; //noise suppression para, for both TX&RX
|
| 66 |
|
| 67 | //ICAT EXPORTED STRUCT
|
| 68 | typedef struct {
|
| 69 | Word16 Enabled;
|
| 70 | NsParamsT NsParams;
|
| 71 | }NSConfigT;
|
| 72 |
|
| 73 | //ICAT EXPORTED STRUCT
|
| 74 | typedef struct {
|
| 75 | Word16 Enabled;
|
| 76 | BiQuadCoeffT EqParams;
|
| 77 | }EQCongfigT;
|
| 78 |
|
| 79 | //ICAT EXPORTED STRUCT
|
| 80 | typedef struct {
|
| 81 | Word16 Enabled;
|
| 82 | AgcParametersT AgcParams;
|
| 83 | }AgcCongT;
|
| 84 |
|
| 85 | //ICAT EXPORTED STRUCT
|
| 86 | typedef struct {
|
| 87 | Word16 Enabled;
|
| 88 | EcParamsStruct EcParams;
|
| 89 | }EcConfigT;
|
| 90 |
|
| 91 | //ICAT EXPORTED STRUCT
|
| 92 | typedef struct {
|
| 93 | Word16 Rnn0;
|
| 94 | Word16 Rnn1;
|
| 95 | Word16 Rnn2;
|
| 96 | Word16 Rnn3;
|
| 97 | } RnnParamsT; //noise suppression para, for both TX&RX
|
| 98 |
|
| 99 | //ICAT EXPORTED STRUCT
|
| 100 | typedef struct { // res parameters
|
| 101 | Word16 ResMode;
|
| 102 | Word16 DtGainDb;
|
| 103 | Word16 FestGainDb;
|
| 104 | Word16 NoiseFloorDbov;
|
| 105 | Word16 CnGaindb;
|
| 106 | Word16 DtThresh;
|
| 107 | Word16 Gamma;
|
| 108 | //following is expert paramters
|
| 109 | Word16 AuditoryMasking;
|
| 110 | Word16 NonlinearModel;
|
| 111 | Word16 WinitCntThresh;
|
| 112 | Word16 EstResMatrix;
|
| 113 | Word16 reserved;
|
| 114 | } NsResParamsT;
|
| 115 |
|
| 116 | //ICAT EXPORTED STRUCT
|
| 117 | typedef struct {
|
| 118 | NsParamsT NsParams;
|
| 119 | RnnParamsT NNParams;
|
| 120 | NsResParamsT ResParams;
|
| 121 | } NsTxParamsT; //TX only
|
| 122 |
|
| 123 | //ICAT EXPORTED STRUCT
|
| 124 | typedef struct
|
| 125 | { Word16 Enabled;
|
| 126 | NsTxParamsT NsParamsTx; }NsTxConfigT;
|
| 127 |
|
| 128 | //VoiceStreamRX Parameters
|
| 129 | //ICAT EXPORTED STRUCT
|
| 130 | typedef struct {
|
| 131 | NSConfigT NSRxConfig;
|
| 132 | EQCongfigT EqConfig;
|
| 133 | AgcCongT AgcConfig;
|
| 134 | Word16 Gain; //need tool to compute 0x2000 is 0dB, 0x4000 6dB,
|
| 135 | Word16 Reserved[4];
|
| 136 | }VeRxControlT;
|
| 137 |
|
| 138 | //VoiceStreamTX & Record Stream parameters
|
| 139 | //ICAT EXPORTED STRUCT
|
| 140 | typedef struct {
|
| 141 | short DCFactor;
|
| 142 | EcConfigT EcConfig;
|
| 143 | NsTxConfigT NsTxConfig;
|
| 144 | EQCongfigT EqConfig;
|
| 145 | AgcCongT AgcConfig;
|
| 146 | Word16 Gain; //need tool to compute 0x2000 is 0dB, 0x4000 6dB,
|
| 147 | Word16 Reserved[4];
|
| 148 | }VeTxControlT;
|
| 149 |
|
| 150 | //ICAT EXPORTED STRUCT
|
| 151 | typedef struct {
|
| 152 | EQCongfigT EqConfig;
|
| 153 | AgcCongT AgcConfig;
|
| 154 | Word16 Gain; //need tool to compute 0x2000 is 0dB, 0x4000 6dB,
|
| 155 | Word16 Reserved[4];
|
| 156 | }MusicStreamControlT;
|
| 157 |
|
| 158 | /*important notes:
|
| 159 | EnhanceParmsT reside in shared memory
|
| 160 |
|
| 161 | */
|
| 162 | //ICAT EXPORTED STRUCT
|
| 163 | typedef struct {
|
| 164 | short Profile; //Handset, headset, handfree, BT
|
| 165 | VeRxControlT VoiceParmRX[3]; //VoiceStreamRx 8k,16, 32k rate
|
| 166 | VeTxControlT VoiceParmTX[3]; //VoiceStreamTx 8k,16, 32k rate
|
| 167 |
|
| 168 | }VoiceParmsT;
|
| 169 |
|
| 170 | //ICAT EXPORTED STRUCT
|
| 171 | typedef struct {
|
| 172 | MusicStreamControlT MusicParms[MAX_MUSIC_STREAM_NUM]; //musicstream parms
|
| 173 | VoiceParmsT VoiceParms;
|
| 174 | VeTxControlT RecordParms; //RecordStream, need only one rate
|
| 175 | VeRxControlT FmStreamParm; // reserved for future usage ,need ns, drc, eq@32k
|
| 176 | }EnhanceParmsT;
|
| 177 |
|
| 178 | #endif //#define _ADSP_VE_H_
|