资源简介
hi3520D + nvp6114,nvp6114驱动
代码片段和文件信息
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
//#include “gpio_i2c.h“
#include “hi_i2c.h“
#include “audio.h“
#define I2C_WRITE_BYTE(abc) HI_I2C_Write(a b 1c 1)
//#define I2C_WRITE_BYTE(abc) gpio_i2c_write(abc)
#define I2C_READ_BYTE(ab) HI_I2C_Read(a b 11)
//#define I2C_READ_BYTE(ab) gpio_i2c_read(ab)
unsigned int audio_slave_addr[4] = {0x60 0x62 0x64 0x66};
/*
param:
dec[4]= {0x600x620x640x66};
ch_num: audio channel number
samplerate: 0[8k] 1[16k]
bits: 0[16bits] 1[8bits]
*/
void audio_init(unsigned char dec unsigned char ch_num unsigned char samplerate unsigned char bits)
{
I2C_WRITE_BYTE(dec 0xff 0x01);
if( (dec == 0x60) || (dec == 0x64))
{
I2C_WRITE_BYTE(dec 0x06 0x1a);
I2C_WRITE_BYTE(dec 0x07 0x80|(samplerate<<3)|(bits<<2)); //Rec I2C 8K 16bit : master
if(8 == ch_num)
{
I2C_WRITE_BYTE(dec 0x06 0x1b);
I2C_WRITE_BYTE(dec 0x08 0x02);
I2C_WRITE_BYTE(dec 0x0f 0x54); //set I2S right sequence
I2C_WRITE_BYTE(dec 0x10 0x76);
}
else if(4 == ch_num)
{
I2C_WRITE_BYTE(dec 0x06 0x1b);
I2C_WRITE_BYTE(dec 0x08 0x01);
I2C_WRITE_BYTE(dec 0x0f 0x32); //set I2S right sequence
}
I2C_WRITE_BYTE(dec 0x13 0x80|(samplerate<<3)|(bits<<2)); // PB I2C 8k 16bit : master
I2C_WRITE_BYTE(dec 0x23 0x10); // Audio playback out
//I2C_WRITE_BYTE(dec 0x23 0x18); // Audio mix out
}
else
{
I2C_WRITE_BYTE(dec 0x06 0x19);
I2C_WRITE_BYTE(dec 0x07 0x00|(samplerate<<3)|(bits<<2)); //Rec I2C 16K 16bit : slave
I2C_WRITE_BYTE(dec 0x13 0x00|(samplerate<<3)|(bits<<2)); // PB I2C 8k 16bit : slave
}
I2C_WRITE_BYTE(dec 0x24 0x14); //set mic_1‘s data to i2s_sp left channel
I2C_WRITE_BYTE(dec 0x25 0x15); //set mic_2‘s data to i2s_sp right channel
}
unsigned int audio_set_chnnum(unsigned int ch_num)
{
unsigned char result;
unsigned char value;
unsigned char dec;
dec = audio_slave_addr[0];
switch(ch_num)
{
case 2:
{
value = 0;
result = I2C_READ_BYTE(dec 0x08);
result = result&0xfc;
I2C_WRITE_BYTE(dec 0x08 result|value);
I2C_WRITE_BYTE(dec 0x0f 0x12); //set I2S right sequence
}
break;
case
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 13175 2016-03-18 18:19 nvp6114\nvp6114_drv.c
文件 6369 2016-03-18 18:19 nvp6114\motion.c
....... 2239 2016-03-18 18:19 nvp6114\coax_protocol.h
文件 52859 2016-03-18 18:19 nvp6114\video.c
文件 4924 2016-03-18 18:19 nvp6114\audio.c
文件 32115 2016-03-18 18:19 nvp6114\coax_protocol.c
....... 685 2016-03-18 18:19 nvp6114\audio.h
....... 4072 2016-03-18 18:19 nvp6114\nvpcommon.h
文件 378 2016-03-18 18:19 nvp6114\Makefile
文件 4821 2016-03-18 18:19 nvp6114\nvp6114.h
....... 628 2016-03-18 18:19 nvp6114\video.h
....... 365 2016-03-18 18:19 nvp6114\motion.h
目录 0 2016-07-22 11:11 nvp6114
----------- --------- ---------- ----- ----
122630 13
评论
共有 条评论