📄 autosira_msm7731.h
字号:
/****************************************************************************
FILE
autosira_msm7731.h
DESCRIPTION
This module contains a device abstraction for an OKI Semiconductor
MSM7731 dual echo canceler and noise canceller with dual codec for
hands free applications. The library is built on top of the SPI
library
The MSM 7731 is an IC device developed for portable, handfree
communication with built-in echo canceler, acoustic echo canceler,
and transmission signal noise canceler. Built-in to the voice
signal interface is a linear CODEC for the analog interface on the
acoustic-side and a linear CODEC for the analog interface on the
line-side. On the line-side, in addition to the analog interface,
there is also a U-law PCM/16-bit linear digital interface.
Equipped with gain and mute controls for data transmission and
reception, a u-law PCM/16-bit linear digital interface for memo
recording and message output, and transfer clock and sync clock
generators for digital communication, the device is ideally suited
for handsfree systems.
*/
#ifndef __MSM7771_H
#define __MSM7731_H
#include <csrtypes.h>
/* set to pio 13 for Autosira */
#define PWNRST (1<<13)
/*
Definition of MSM7731 control registers. Note Control Register 0 (CR0) is
mapped at address 0
*/
typedef enum
{
CR0 = 0,
CR1,
CR2,
CR3,
CR4,
CR5,
CR6,
CR7,
CR8,
CR9,
CR10,
CR11,
CR12
} MSM7731_REG;
#define MSM7731_REG_MASK (0x0F)
#define MSM7731_WRITE (0x00)
#define MSM7731_READ (0x80)
#define MSM7731_READY (0x80)
#define MSM7731_PDNRST (0x80)
#define MSM7731_INTWRITE (0x80)
/* These are the persistent store keys used by the MSM */
#define PS_BASE 10
#define PS_CR0 (PS_BASE+0)
#define PS_CR1 (PS_BASE+1)
#define PS_CR2 (PS_BASE+2)
#define PS_CR3 (PS_BASE+3)
#define PS_CR4 (PS_BASE+4)
#define PS_CR5 (PS_BASE+5)
#define PS_CR6 (PS_BASE+6)
#define PS_CR7 (PS_BASE+7)
#define PS_CR8 (PS_BASE+8)
#define PS_CR9 (PS_BASE+9)
#define PS_CR10 (PS_BASE+10)
#define PS_CR11 (PS_BASE+11)
#define PS_CR12 (PS_BASE+12)
#define PS_CR13 (PS_BASE+13)
/* These are the default values read from the PS and loaded into the MSM device*/
static const uint16 msmDefaultValues[13] =
{ 0x34, /* CR0 */
0x04, /* CR1 */
0x00, /* CR2 */
0x07, /* CR3 */
0xb7, /* CR4 */
0x13, /* CR5 */
0x00, /* CR6 */
0x00, /* CR7 */
0x01, /* CR8 MSB Echo delay time */
0x00, /* CR9 LSB Echo delay time */
0x5a, /* CR10 */
0x00, /* CR11 */
0x04 /* CR12 */
};
/* These are the 16 gain settings used to control the speaker volume of the HFCK */
static const uint16 msmGain[16] =
{ 0x34, /* -36dB */
0x35, /* -33dB */
0x36, /* -30dB */
0x37, /* -27dB */
0x38, /* -24dB */
0x39, /* -21dB */
0x3a, /* -18dB */
0x3b, /* -15dB */
0x3c, /* -12dB */
0x3d, /* -9dB */
0x3e, /* -6dB */
0x3f, /* -3dB */
0x00, /* 0dB */
0x01, /* 3dB */
0x02, /* 6dB */
0x03 /* 9dB */
};
/****************************************************************************
NAME
Msm7731Init
FUNCTION
This function is called by the client at Reset to configure the
device for operation. The underlying SPI transport is initialised
and any device specific initialisation
RETURNS
void
*/
void Msm7731Init(void);
/****************************************************************************
NAME
MsmUpdate
FUNCTION
This function is called by the client at Reset to configure the
device for operation. The values from the PS are loaded into the
MSM
RETURNS
void
*/
void MsmUpdate(void);
/****************************************************************************
NAME
PsUpdate
FUNCTION
This function is called by the client at Reset to configure any
empty PS values with default values.
RETURNS
void
*/
void PsUpdate(void);
/****************************************************************************
NAME
PsUpdate
FUNCTION
This function is called by the client at Reset to configure any
empty PS values with default values.
RETURNS
void
*/
void Debug(void);
/****************************************************************************
NAME
MsmReadReady
FUNCTION
This function is called by the client to check the read ready bit
of CR11 to check that the MSM is ready to be written to.
RETURNS
void
*/
void MsmAudio(void);
void MsmPdnRst(void);
/****************************************************************************
NAME
MsmReadReady
FUNCTION
This function is called by the client to check the read ready bit
of CR11 to check that the MSM is ready to be written to.
RETURNS
void
*/
void MsmWriteDelay(void);
/****************************************************************************
NAME
MsmReadReady
FUNCTION
This function is called by the client to check the read ready bit
of CR11 to check that the MSM is ready to be written to.
RETURNS
void
*/
uint8 Msm7731ReadReady(void);
/****************************************************************************
NAME
Msm7731Write
FUNCTION
This function is called by the client to write to one of the
devices internal registers. See pages 26 to 39 of the datasheet
for a full description
CR0 - Basic operating mode setting
CR1 -
CR2 - Receive side level control
CR3 - Transmit gain adjustment
CR4 - Line echo canceler strings
CR5 - Acoustic echo canceler setting
CR6 - Internal data memory write register
CR7 - Internal data memory write register
CR8 - Internal data memory write register
CR9 - Internal data memory write register
CR10- Echo canceler I/O level setting
CR11- SYNC power-down control register
CR12- Reserved register
The control register to write to is defined by reg and the data to
be written supplied by data. This function performs a write
followed by read to verify the write cycle. In the event that a
write operation fails then FALSE is returned to indicate to the
Client that the operation was unsuccessful
RETURNS
TRUE or FALSE
*/
uint16 Msm7731Write(MSM7731_REG reg, uint8 data);
/****************************************************************************
NAME
Msm7731Read
FUNCTION
This function is called by the client to read one of the devices
internal registers. See pages 26 to 39 of the datasheet for a
full description
CR0 - Basic operating mode setting
CR1 -
CR2 - Receive side level control
CR3 - Transmit gain adjustment
CR4 - Line echo canceler strings
CR5 - Acoustic echo canceler setting
CR6 - Internal data memory write register
CR7 - Internal data memory write register
CR8 - Internal data memory write register
CR9 - Internal data memory write register
CR10- Echo canceler I/O level setting
CR11- SYNC power-down control register
CR12- Reserved register
The control regsiter to read is defined by reg
RETURNS
The contents of the control register
*/
uint8 Msm7731Read(MSM7731_REG reg);
/*This is the function which sets the gain and writes it to the MSM device*/
void setMSMGain(uint16 gain);
/*This is the function which sets the gain initial gain after power up*/
void MSMGainInit(void);
#endif /* ndef __MSM7731_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -