aic23.c
来自「在开发FPGA上比较有用」· C语言 代码 · 共 875 行 · 第 1/3 页
C
875 行
#include <stdio.h>
#include <io.h>
#include <system.h>
#include <alt_types.h>
#include <string.h>
#include <stdlib.h>
#include <sd_controller.h>
#include <sys/alt_irq.h>
#include <sys/alt_dma.h>
#include "fast_dma.h"
#include <altera_avalon_dma_regs.h>
#define AUDIO_BUFF_SIZE 0x6000
unsigned int *audioBuff=(unsigned int *)(SDRAM_BASE+0x200000);
unsigned int *audioBuff1=(unsigned int *)(SDRAM_BASE+0x206000);
unsigned int *audioBuff2=(unsigned int *)(SDRAM_BASE+0x212000);
unsigned int *audioBuff3=(unsigned int *)(SDRAM_BASE+0x218000);
unsigned int *audioBuff4=(unsigned int *)(SDRAM_BASE+0x224000);
unsigned int *audioBuff5=(unsigned int *)(SDRAM_BASE+0x360000);
unsigned int *audioBuff6=(unsigned int *)(SDRAM_BASE+0x500000);
//unsigned int *audioBuff7=(unsigned int *)(SDRAM_BASE+0x300000);
int flagaic=0;
FILE * hostfile;
int voicelong;
int AUDIO_BUFF_SIZE2;
int AUDIO_BUFF_SIZE1;
extern void *dma_base;
extern int gControl_bits;
unsigned int infifo_count;
/*******************************************************
以下为音频部分
负责人:曹汉超
********************************************************/
/*********************************************
函数名:audio_irq
功 能:音频中断处理函数
输 入:context:相关内容指针,中断号
返 回:
备 注:
读取音频外设数据,并回放写入到音频外设中
**********************************************/
void audio_irq(void *context,alt_u32 interrupt)
{
unsigned int fifo_status;
unsigned int len;
fifo_status=IORD(FREEDEV_AIC23_0_BASE,0x03);
infifo_count=IORD(FREEDEV_AIC23_0_BASE,0x04);
if(fifo_status & 0x04)
len=512;
else
len=infifo_count;
// 启动DMA传输
IOWR_ALTERA_AVALON_DMA_LENGTH(dma_base,len);
IOWR_ALTERA_AVALON_DMA_CONTROL(dma_base, gControl_bits|ALTERA_AVALON_DMA_CONTROL_GO_MSK);
}
/*************************************************
*函数名:aic23_warning_play
*参数:文件名
*功能:播放警告
/************************************************/
void aic23_warning_play(int num)
{
if(num == 3001){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/welcomeinit.dat", "r");
AUDIO_BUFF_SIZE2 = 0x12500;
}else if(num == 3002){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/initfinish.dat", "r");
AUDIO_BUFF_SIZE2 = 0x7500;
}else if(num == 3003){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/menuintroduce.dat", "r");
AUDIO_BUFF_SIZE2 = 0x35000;
}else if(num == 3004){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/sendmehome.dat", "r");
AUDIO_BUFF_SIZE2 = 0x10000;
}else if(num == 3005){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/IamOK.dat", "r");
AUDIO_BUFF_SIZE2 = 0x7500;
}else if(num == 3006){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/reachsafe.dat", "r");
AUDIO_BUFF_SIZE2 = 0x7500;
}else if(num == 3007){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/Ontheway.dat", "r");
AUDIO_BUFF_SIZE2 = 0x7500;
}else if(num == 3008){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/help_mic_intro.dat", "r");
AUDIO_BUFF_SIZE2 = 0x52000;
}else if(num == 3009){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/input_error.dat", "r");
AUDIO_BUFF_SIZE2 = 0x10000;
}else if(num == 3010){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/normal_mode_mic.dat", "r");
AUDIO_BUFF_SIZE2 = 0x12500;
}else if(num == 3011){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/failgps.dat", "r");
AUDIO_BUFF_SIZE2 = 0x10000;
}else if(num == 3012){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/faild_diantai.dat", "r");
AUDIO_BUFF_SIZE2 = 0x10000;
}else if(num == 3013){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/mp3.dat", "r");
AUDIO_BUFF_SIZE2 = 0x10000;
}else if(num == 3015){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/ZhangAiWu_50m.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
}else if(num == 3016){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/ZhangAiWu_100cm.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
}else if(num == 3017){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/ZhangAiWu_150cm.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
}else if(num == 3018){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/ZhangAiWu_200cm.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
}else if(num == 3019){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/ZhangAiWu_250cm.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
}else if(num == 3020){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/ZhangAiWu_050cm.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
}else if(num == 3021){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/ZhangAiWu_350cm.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
}else if(num == 3022){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/time_y2008.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
}else if(num == 3023){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/time_mSep.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
}else if(num == 3024){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/qianfangyouren.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
}else if(num == 3025){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/fasongjieshou.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
}else if(num == 3026){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/meiyouzhangaiwu.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
} else if(num == 3027){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/diantai_menu.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
AUDIO_BUFF_SIZE2 = 0x52000;
}else if(num == 3028){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/4road.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
AUDIO_BUFF_SIZE2 = 0x6000;
}else if(num == 3029){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/3road.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
AUDIO_BUFF_SIZE2 = 0x6000;
}else if(num == 3030){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/2road.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
AUDIO_BUFF_SIZE2 = 0x6000;
}else if(num == 3031){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/1road.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
AUDIO_BUFF_SIZE2 = 0x6000;
}else if(num == 3032){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/change_mode.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
AUDIO_BUFF_SIZE2 = 0x6000;
}else if(num == 3033){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/notchange_mode.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
AUDIO_BUFF_SIZE2 = 0x6000;
}else if(num == 3034){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/east.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
AUDIO_BUFF_SIZE2 = 0x6000;
}else if(num == 3035){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/west.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
AUDIO_BUFF_SIZE2 = 0x6000;
}else if(num == 3036){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/north.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
AUDIO_BUFF_SIZE2 = 0x6000;
}else if(num == 3037){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/south.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
AUDIO_BUFF_SIZE2 = 0x6000;
}else if(num == 3038){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/diantai_chose_destanation.dat","r");
// AUDIO_BUFF_SIZE2 = 0x20000;
AUDIO_BUFF_SIZE2 = 0x22500;
}else if(num == 3039){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/queding_fasong.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
AUDIO_BUFF_SIZE2 = 0x6000;
}else if(num == 3040){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/qingxuanzecaozuo.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
AUDIO_BUFF_SIZE2 = 0x6000;
}else if(num == 3041){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/45road.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
AUDIO_BUFF_SIZE2 = 0x6000;
}else if(num == 3042){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/408road.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
AUDIO_BUFF_SIZE2 = 0x6000;
}else if(num == 3043){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/clock_.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
AUDIO_BUFF_SIZE2 = 0x6000;
}else if(num == 3044){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/clock_.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
AUDIO_BUFF_SIZE2 = 0x6000;
}
else if(num == 3101){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/welcomeinit1.dat", "r");
AUDIO_BUFF_SIZE2 = 0x12500;
}else if(num == 3102){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/initfinish1.dat", "r");
AUDIO_BUFF_SIZE2 = 0x7500;
}else if(num == 3103){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/mainmenu1.dat", "r");
AUDIO_BUFF_SIZE2 = 0x35000;
}else if(num == 3104){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/sendmehome1.dat", "r");
AUDIO_BUFF_SIZE2 = 0x10000;
}else if(num == 3105){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/IamOK1.dat", "r");
AUDIO_BUFF_SIZE2 = 0x7500;
}else if(num == 3106){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/reachsafe1.dat", "r");
AUDIO_BUFF_SIZE2 = 0x7500;
}else if(num == 3107){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/Ontheway1.dat", "r");
AUDIO_BUFF_SIZE2 = 0x7500;
}else if(num == 3108){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/help_mic_intro1.dat", "r");
AUDIO_BUFF_SIZE2 = 0x52000;
}else if(num == 3109){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/input_error1.dat", "r");
AUDIO_BUFF_SIZE2 = 0x10000;
}else if(num == 3110){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/normal_mode_mic1.dat", "r");
AUDIO_BUFF_SIZE2 = 0x12500;
}else if(num == 3111){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/failgps1.dat", "r");
AUDIO_BUFF_SIZE2 = 0x10000;
}else if(num == 3112){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/faild_diantai1.dat", "r");
AUDIO_BUFF_SIZE2 = 0x10000;
}else if(num == 3113){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/chuxingmoshi1.dat", "r");
AUDIO_BUFF_SIZE2 = 0x10000;
}else if(num == 3114){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/qingxuanze1.dat", "r");
AUDIO_BUFF_SIZE2 = 0x6000;
}else if(num == 3115){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/ZhangAiWu_50m1.dat", "r");
AUDIO_BUFF_SIZE2 = 0x6000;
// AUDIO_BUFF_SIZE2 = 0x20000;
}else if(num == 3116){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/ZhangAiWu_100cm1.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
AUDIO_BUFF_SIZE2 = 0x6000;
}else if(num == 3117){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/ZhangAiWu_150cm1.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
AUDIO_BUFF_SIZE2 = 0x6000;
}else if(num == 3118){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/ZhangAiWu_200cm1.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
AUDIO_BUFF_SIZE2 = 0x6000;
}else if(num == 3119){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/ZhangAiWu_250cm1.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
AUDIO_BUFF_SIZE2 = 0x6000;
}else if(num == 3120){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/ZhangAiWu_300cm1.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
AUDIO_BUFF_SIZE2 = 0x6000;
}else if(num == 3121){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/ZhangAiWu_350cm1.dat", "r");
// AUDIO_BUFF_SIZE2 = 0x20000;
AUDIO_BUFF_SIZE2 = 0x6000;
}else if(num == 3122){
hostfile = fopen("/dev/sd_controller_inst/Input_Files/gongjiaomoshi1.dat", "r");
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?