📄 g711lib_si3000.h
字号:
/*********************************************************************
* *
* Software License Agreement *
* *
* The software supplied herewith by Microchip Technology *
* Incorporated (the "Company") for its dsPIC controller *
* is intended and supplied to you, the Company's customer, *
* for use solely and exclusively on Microchip dsPIC *
* products. The software is owned by the Company and/or its *
* supplier, and is protected under applicable copyright laws. All *
* rights are reserved. Any use in violation of the foregoing *
* restrictions may subject the user to criminal sanctions under *
* applicable laws, as well as to civil liability for the breach of *
* the terms and conditions of this license. *
* *
* THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO *
* WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, *
* BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND *
* FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE *
* COMPANY SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, *
* INCIDENTAL OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. *
* *
*********************************************************************/
/******************************************************************************
**
** Filename: G711Lib_Si3000.h
**
** System: RISC
**
** Platform: dsPIC33F
**
** Description: This header file contains structures for initializing SI 3000
** codec.It also has #define's for initializing these structures.
** The user can make his settings for SI 3000 codec by making
** changes to the #define's for the structure.The structure
** contained in this file is spxSi3000.
**
******************************************************************************/
#ifndef _G711LIB_SI3000_H
#define _G711LIB_SI3000_H
#include "G711Lib_common.h"
//-----------------------------------------------------------------------------
//PREPROCESSOR CONSTANTS/MACROS
//-----------------------------------------------------------------------------
#define DCIMODE 1 //1 = DCIMASTER, 0 = DCISLAVE
#if DCIMODE
#define CONTROL1 0x0010 //Set Speaker Drive Power Down to Normal
//operation and Line Drive Power Down to
//Power down line driver.
#define CONTROL2 0x0000 //High Pass Filter enabled and Digital
//Loopback to Normal operation.
#define PLL1DIVIDEN1 0x0000 //No division done.
#define PLL1MULTIPLYM1 0x0000 //No multiplication done.
#define RXGAINCONTROL 0x00EA //Line in Gain= 20db,Line in Muted,
//MIC Input Gain= 10db and Handset Input
//Muted.
#define ADCVOLUMECONTROL 0x005C //Set RX PGA Gain Control = 0db,Line out
//Mute ,Handset out Mute.
#define DACVOLUMECONTROL 0x005F //Set TX PGA Gain Control =0db,SPKR_L Mute
//to Active,SPKR_R Mute to Active.
#define STATUSREPORT 0x0000 //Set SPK_L Short Circuit,SPK_R Short
//Circuit and Line Out Short Circuit
//in Normal mode.
#define ANALOGATTENUATION 0x0000 //Set Line Out Attenuation = 0db and
//Speaker Out Attenuation = 0db.
#else
#define CONTROL1 0x0010 //Set Speaker Drive Power Down to Normal
//operation and Line Drive Power Down to
//Power down line driver.
#define CONTROL2 0x0000 //High Pass Filter enabled and Digital
//Loopback to Normal operation.
#define PLL1DIVIDEN1 0x0002 //Divided by 0x2h.
#define PLL1MULTIPLYM1 0x0013 //Multiplied by 0x13h.
#define RXGAINCONTROL 0x00EA //Line in Gain= 20db,Line in Muted,
//MIC Input Gain= 10db and Handset Input
//Muted.
#define ADCVOLUMECONTROL 0x005C //Set RX PGA Gain Control = 0db,Line out
//Mute ,Handset out Mute.
#define DACVOLUMECONTROL 0x005F //Set TX PGA Gain Control =0db,SPKR_L Mute
//to Active,SPKR_R Mute to Active.
#define STATUSREPORT 0x0000 //Set SPK_L Short Circuit,SPK_R Short
//Circuit and Line Out Short Circuit
//in Normal mode.
#define ANALOGATTENUATION 0x0000 //Set Line Out Attenuation = 0db and
//Speaker Out Attenuation = 0db.
#endif
#define DCIINTPRIORITY 0x04 //Priority for DCI interrupt.
#define G711 { CONTROL1,CONTROL2, PLL1DIVIDEN1, PLL1MULTIPLYM1,RXGAINCONTROL,\
ADCVOLUMECONTROL, DACVOLUMECONTROL, STATUSREPORT,\
ANALOGATTENUATION,DCIMODE, DCIINTPRIORITY, BCG1 }
#define G711SI3000INIT const g711Si3000 g711 = G711;
/*-----------------------------------------------------------------------------
This structure is used to configure the SI 3000 registers.The user can make
his settings for the corresponding registers in by SI 3000 putting the required
values in the #define G711.
-----------------------------------------------------------------------------*/
struct _g711Si3000
{
// Si3000 registers
int control1; //Si3000 Register1
// SR RES RES SPD LPD HPD MPD CPD
// 7 SR (Software Reset)1=Sets all registers to their reset value,
// 0=Enables chip for normal operation
// 6:5 RES (Reserved)Read returns zero
// 4 SPD (Speaker Drive Power Down)1=Normal operation,0=Power down
// left and right speaker drive
// 3 LPD (Line Drive Power Down)1=Normal operation,0=Power down
// line driver.
// 2 HPD (Handset Drive Power Down)1=Normal operation,0=Power down
// handset driver.
// 1 MPD (MIC Bias Power Down)1=Power down MIC bias buffer,0=Normal
// operation
// 0 CPD (Chip Power Down)1=Puts Si3000 into power down mode,
// 0=Normal o peration
int control2; // Si3000 Regiter2
// RES RES RES HPFD PLL DL1 DL2 RES
// 7:5 RES (Reserved) Read returns zero
// 4 HPFD (High Pass Filter Disable)1=HPF disabled,0=HPF enabled
// 3 PLL (PLL Divide by 10)1=Sets final stage of PLL to divide by
// 10,0=Sets final stage of PLL to divide by5
// 2 DL1 (Digital Loopback)1=Enables digital loopback (DAC analog
// out? ADC analog in),0=Normal operation
// 1 DL2 (Digital Loopback)1=Enables digital loopback (DAC one
// bit ? ADC one bit),0=Normal operation
// 0 RES (Reserved) Read returns zero
int pLL1divideN1; // Si3000 Register 3
// N1 N1 N1 N1 N1 N1 N1 N1
// 7:0 N1 Contains the (value 1) for determining the output
// frequency on PLL
int pLL1multiplyM1; // Si3000 Register 4
// M1 M1 M1 M1 M1 M1 M1 M1
// 7:0 M1 Contains the (value 1) for determining the output
// frequency on PLL
int rxgaincontroL1; // Si3000 Register 5
// LIG LIG LIM MCG MCM HIM IIR
// 7:6 LIG (Line in Gain)11=20dB gain,10=10dB gain,01=0dB gain,
// 00=Reserved
// 5 LIM(Line in Mute)1=Line input muted,0=Line input goes to mixer
// 4:3 MCG (MIC Input Gain)11=30dB gain,10=20dB gain,01=10dB gain,
// 00=0 dB gain
// 2 MCM(MIC Input Mute)1=Mute MIC input,0=MICinput goes into mixer
// 1 HIM (Handset Input Mute)1=Mute handset input,0=Handset input
// goes into mixer
// 0 IIR (IIR Enable)1=Enables IIR filter,0=Enables FIR filter
int adcvolumecontrol; // Si3000 Register 6
// RXG RXG RXG RXG RXG RXG LOM HOM
// 6:2 RXG (RX PGA Gain Control)11111=12dB,10111=0dB,00000=34.5dB,
// LSB=1.5dB
// 1 LOM (Line Out Mute)0=Mute,1=Active
// 0 HOM (Handset Out Mute)0=Mute,1=Active
int dacvolumecontrol; // Si3000 Register 7
// TXG TXG TXG TXG TXG TXG SLM SRM
// 6:2 TXG (TX PGA Gain Control)11111=12dB,10111=0dB00000=34.5dB,
// LSB=1.5dB
// 1 SLM (SPKR_L Mute)0=Mute,1=Active
// 0 SRM (SPKR_R Mute)0=Mute,1=Active
int statusreport; // Si3000 Register 8
// SLSC SRSC LOSC RES RES RES RES RES
// 7 SLSC (SPK_L Short Circuit)1=Indicate short circuit status is
// detected at left speaker,0=Normal mode
// 6 SRSC (SPK_R Short Circuit)1=Indicate short circuit status is
// detected at right speaker,0=Normal mode
// 5 LOSC (Line Out Short Circuit)1=Indicate short circuit status
// is detected at line out,0=Normal mode
int analogattenuation;// Si3000 Register9
// RES RES RES RES LOT LOT SOT SOT
// 7:4 RES (Reserved) Read returns zero
// 3:2 LOT (Line Out Attenuation)11=18dB analog attenuation on Line
// Output,10=12dB analog attenuation on Line Output,01=6dB analog
// attenuation on Line Output,00=0dB analog attenuation on Line
// Output
// 2:0 SOT (Speaker Out Attenuation)11=18dB analog attenuation on
// Speaker Output,10=12dB analog attenuation on Speaker Output,
// 01=6dB analog attenuation on Speaker Output,00=0dB analog
// attenuation on Speaker Output
char dcimode; //1 = master , 0 = slave
char dciintpri; //Priority for DCI interrupt.
int bcg1; //DCI bit clock generator control bits.
};
//-----------------------------------------------------------------------------
//TYPEDEFS/EXTERN
//-----------------------------------------------------------------------------
typedef struct _g711Si3000 g711Si3000;
extern const g711Si3000 g711;
#endif /* _G711LIB_SI3000_H */
/*-----------------------------------------------------------------------------
END OF FILE: G711Lib_Si3000.h
-----------------------------------------------------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -