资源简介
wm8960 音频播放
代码片段和文件信息
// GPIO
#define GPICON (*(volatile unsigned int *)0xE0200220) //IIS Signals
// IIS
#define IISCON (*(volatile unsigned int *)0xEEE30000) //IIS Control
#define IISMOD (*(volatile unsigned int *)0xEEE30004) //IIS Mode
#define IISFIC (*(volatile unsigned int *)0xEEE30008) //IIS FIFO Control
#define IISPSR (*(volatile unsigned int *)0xEEE3000C) //IIS Prescaler
#define IISTXD (*(volatile unsigned int *)0xEEE30010) //IIS TXD DATA
#define IISRXD (*(volatile unsigned int *)0xEEE30014) //IIS RXD DATA
#define IISFICS (*(volatile unsigned int *)0xEEE30018) //IIS FIFO Control
void iis_init(void)
{
int N;
// 配置引脚用于i2s功能
GPICON = 0x22222222;
// 设置i2s相关时钟
// step 1: EPLL output 67.7Mhz (see p361 of s5pv210.pdf)
// EPLL_CON0/ EPLL_CON1 R/W Address = 0xE010_0110/0xE010_0114)
// FOUT = (MDIV+K/65536) X FIN / (PDIV X 2SDIV)
// Fout = (0x43+0.7)*24M / (3*2^3) = 80*24M/24 = 67.7Mhz
#define EPLL_CON0 (*(volatile unsigned int *)0xe0100110)
#define EPLL_CON1 (*(volatile unsigned int *)0xe0100114)
EPLL_CON0 = 0xa8430303; // MPLL_FOUT = 67.7Mhz
EPLL_CON1 = 0xbcee; // from linux kernel setting
// step 2: MUX_EPLL = 1 -> SCLK_EPLL = 67.7Mhz (see p361 of s5pv210.pdf)
// CLK_SRC0 R/W Address = 0xE010_0200
// 0xe0100200: 10001111
// EPLL_SEL [8] Control MUXEPLL (0:FINPLL 1:FOUTEPLL)
#define CLK_SRC0 (*(volatile unsigned int *)0xE0100200)
CLK_SRC0 = 0x10001111;
// step 3: Mux_I2S AUDIO subsystem clock selection (see P1868 P1875 of s5pv210.pdf)
#define CLK_CON (*(volatile unsigned int *)0xEEE10000)
CLK_CON = 0x1; // 1 = FOUT_EPLL MUXI2S_A 00 = Main CLK
// 设置i2s控制器
// step 4: Divider of IIS (67.7 -> 11.289Mhz)
// N + 1 = (67.7Mhz) / (256 * 44.1Khz) = 5.99
// IISCDCLK 11.289Mhz = 44.1K * 256fs
// IISSCLK 1.4112Mhz = 44.1K * 32fs
// IISLRCLK 44.1Khz
N = 5;
IISPSR = 1<<15 | N<<8;
// IIS interface active (start operation). 1 = Active
IISCON |= 1<<0 | (unsigned)1<<31;
// [9:8] 10 = Transmit and receive simultaneous mode
// 1 = Using I2SCLK (use EPLL)
IISMOD = 1<<9 | 0<<8 | 1<<10;
}
// IIC GPIO
#define GPD1CON (*(volatile unsigned *)0xE02000C0) //Port D1 control
#define GPD1DAT (*(volatile unsigned *)0xE02000C4) //Port D1 data
#define GPD1PUD (*(volatile unsigned *)0xE02000C8) //Pull-up control D
// IIC SFR
#define I2CCON0 (*(volatile unsigned *)0xE1800000) //IIC control
#define I2CSTAT0 (*(volatile unsigned *)0xE1800004) //IIC status
#define I2CADD0 (*(volatile unsigned *)0xE1800008) //IIC address
#define I2CDS0 (*(volatile unsigned *)0xE180000C) //IIC data shift
#define I2CLC0 (*(volatile unsigned *)0xE1800010) //IIC multi-master line control
// for portability of IIC driver
#define IICCON I2CCON0
#define IICSTAT I2CSTAT0
#define IICADD I2CADD0
#define IICDS I2CDS0
void iic_write(int slave_addr int addr int data)
{
I2CDS0 = slave_addr;
// bit[7:6]: 主机发送器
// bit[5]:发出s信号和I2CDS0里的从机地
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 5093 2012-12-10 16:33 audio.c
文件 118 2012-12-10 15:42 audio.h
文件 131 2012-12-07 15:33 audio.lds
目录 0 2013-05-26 20:07 include\
文件 1344 2012-05-24 10:27 include\ctype.h
文件 733 2012-05-24 10:27 include\gcclib.h
文件 187 2012-05-24 10:27 include\kernel.h
文件 686 2012-05-24 10:27 include\stdio.h
文件 1942 2012-05-24 10:27 include\string.h
文件 10005 2012-05-24 10:27 include\system.h
文件 195 2012-05-24 10:27 include\types.h
目录 0 2013-05-26 20:07 lib\
文件 1313 2012-05-24 10:27 lib\ctype.c
文件 1059 2012-12-06 15:34 lib\ctype.o
文件 1217 2012-05-24 10:27 lib\div64.h
文件 915 2012-12-06 15:34 lib\div64.o
文件 3977 2012-05-24 10:27 lib\div64.S
文件 1652 2012-12-06 15:34 lib\lib1funcs.o
文件 7442 2012-05-24 10:27 lib\lib1funcs.S
文件 19692 2012-12-06 15:34 lib\libc.a
文件 241 2012-05-24 10:27 lib\Makefile
文件 2854 2012-05-24 10:27 lib\muldi3.c
文件 878 2012-12-06 15:34 lib\muldi3.o
文件 809 2012-12-04 10:58 lib\printf.c
文件 130 2012-05-24 10:27 lib\printf.h
文件 1368 2012-12-06 15:34 lib\printf.o
文件 10634 2012-05-24 10:27 lib\string.c
文件 3428 2012-12-06 15:34 lib\string.o
文件 18939 2012-05-24 10:27 lib\vsprintf.c
文件 1658 2012-05-24 10:27 lib\vsprintf.h
文件 9328 2012-12-06 15:34 lib\vsprintf.o
............此处省略6个文件信息
评论
共有 条评论