blob: 9a0e421d7a484415b8c26401c2443370d9ef4ee3 [file] [log] [blame]
// SPDX-License-Identifier: GPL-2.0
/*
* Driver for Audio DSP.
*
* Copyright (C) 2022 ASRMicro
*
* Author: Yjg Wang <yjgwang@asrmicro.com>
*/
/******************************************************************************
* MODULE IMPLEMENTATION FILE
*******************************************************************************
* Title: Header for ADSP in AP subsystem
*
* Filename: adsp_ve.h
*
* Authors: Yjg Wang
*
* Description: Header file for ADSP VE.
*
* Last Updated:
*
* Notes:
******************************************************************************/
#ifndef _ADSP_VE_H_
#define _ADSP_VE_H_
#define MAX_MUSIC_STREAM_NUM 6
typedef signed short Word16;
typedef unsigned short UWord16;
//ICAT EXPORTED STRUCT
typedef struct {
Word16 SampleDelay; // reference delay to echo
Word16 EchoLenInMs; // Fir filter length
Word16 ConvergenceSpeed; // slowdown
Word16 Ref2EchoPowerRatio; // ratio of ref to echo, [-12 ~30]db, decimal number
} EcParamsStruct;
//ICAT EXPORTED STRUCT
typedef struct {
Word16 BoostGainDb; //
Word16 PeakGainDb;
Word16 BoostNoiseGainDb;
Word16 BoostRelease;
Word16 Reserved0;
Word16 Reserved1;
} AgcParametersT;
//ICAT EXPORTED STRUCT
typedef struct {
UWord16 MASK;
Word16 EqCoff[7][6]; // a[0], a[1], a[2], b[0], b[1], b[2]
} BiQuadCoeffT;
// following is ns parametes typedef
//ICAT EXPORTED STRUCT
typedef struct {
Word16 MaxSuppressDb; // [-40 0)db.
Word16 PeakNoiseDb; // [-70 -12)db.
Word16 NoiseMatrix; // following is expert parameters
Word16 RnnParm;
} NsParamsT; //noise suppression para, for both TX&RX
//ICAT EXPORTED STRUCT
typedef struct {
Word16 Enabled;
NsParamsT NsParams;
}NSConfigT;
//ICAT EXPORTED STRUCT
typedef struct {
Word16 Enabled;
BiQuadCoeffT EqParams;
}EQCongfigT;
//ICAT EXPORTED STRUCT
typedef struct {
Word16 Enabled;
AgcParametersT AgcParams;
}AgcCongT;
//ICAT EXPORTED STRUCT
typedef struct {
Word16 Enabled;
EcParamsStruct EcParams;
}EcConfigT;
//ICAT EXPORTED STRUCT
typedef struct {
Word16 Rnn0;
Word16 Rnn1;
Word16 Rnn2;
Word16 Rnn3;
} RnnParamsT; //noise suppression para, for both TX&RX
//ICAT EXPORTED STRUCT
typedef struct { // res parameters
Word16 ResMode;
Word16 DtGainDb;
Word16 FestGainDb;
Word16 NoiseFloorDbov;
Word16 CnGaindb;
Word16 DtThresh;
Word16 Gamma;
//following is expert paramters
Word16 AuditoryMasking;
Word16 NonlinearModel;
Word16 WinitCntThresh;
Word16 EstResMatrix;
Word16 reserved;
} NsResParamsT;
//ICAT EXPORTED STRUCT
typedef struct {
NsParamsT NsParams;
RnnParamsT NNParams;
NsResParamsT ResParams;
} NsTxParamsT; //TX only
//ICAT EXPORTED STRUCT
typedef struct
{ Word16 Enabled;
NsTxParamsT NsParamsTx; }NsTxConfigT;
//VoiceStreamRX Parameters
//ICAT EXPORTED STRUCT
typedef struct {
NSConfigT NSRxConfig;
EQCongfigT EqConfig;
AgcCongT AgcConfig;
Word16 Gain; //need tool to compute 0x2000 is 0dB, 0x4000 6dB,
Word16 Reserved[4];
}VeRxControlT;
//VoiceStreamTX & Record Stream parameters
//ICAT EXPORTED STRUCT
typedef struct {
short DCFactor;
EcConfigT EcConfig;
NsTxConfigT NsTxConfig;
EQCongfigT EqConfig;
AgcCongT AgcConfig;
Word16 Gain; //need tool to compute 0x2000 is 0dB, 0x4000 6dB,
Word16 Reserved[4];
}VeTxControlT;
//ICAT EXPORTED STRUCT
typedef struct {
EQCongfigT EqConfig;
AgcCongT AgcConfig;
Word16 Gain; //need tool to compute 0x2000 is 0dB, 0x4000 6dB,
Word16 Reserved[4];
}MusicStreamControlT;
/*important notes:
EnhanceParmsT reside in shared memory
*/
//ICAT EXPORTED STRUCT
typedef struct {
short Profile; //Handset, headset, handfree, BT
VeRxControlT VoiceParmRX[3]; //VoiceStreamRx 8k,16, 32k rate
VeTxControlT VoiceParmTX[3]; //VoiceStreamTx 8k,16, 32k rate
}VoiceParmsT;
//ICAT EXPORTED STRUCT
typedef struct {
MusicStreamControlT MusicParms[MAX_MUSIC_STREAM_NUM]; //musicstream parms
VoiceParmsT VoiceParms;
VeTxControlT RecordParms; //RecordStream, need only one rate
VeRxControlT FmStreamParm; // reserved for future usage ,need ns, drc, eq@32k
}EnhanceParmsT;
#endif //#define _ADSP_VE_H_