⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mp3.c

📁 台湾凌阳方案300万数码相机源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
/*++

Copyright (c) 2001 Sunplus Technology Co., Ltd.

Module Name:

        mp3.c

Abstract:

        Module related to user interface

Environment:

        Keil C51 Compiler

Revision History:

        6/10/2002      Leeada       created

--*/

//=============================================================================
//Header file
//=============================================================================
#include "general.h"

#if (MP3_OPTION)
#include "mp3.h"
#include "dosusr.h"
#include "doslink.h"
#include "timer.h"
#include "cardlink.h"
#include "sdramhw.h"
#include "initio.h"
#include "uiflow.h"

//=============================================================================
//Symbol
//=============================================================================

//-----------------------------------------------------------------------------
//Constant
//-----------------------------------------------------------------------------
code unsigned char BitRatetable[2][3][16]={
	//MPEG-2
	0, 32, 64, 96,128,160,192,224,256,288,320,352,0,0,0,0,
	0, 32, 48, 56, 64, 80, 96,112,128,160,192,224,0,0,0,0,
	0,  8, 16, 24, 32, 64, 80, 56, 64,128,160,112,0,0,0,0,
	//MPEG-1
	0, 32, 64, 96,128,160,192,224,256,288,320,352,0,0,0,0,
	0, 32, 48, 56, 64, 80, 96,112,128,160,192,224,0,0,0,0,
	0, 32, 40, 48, 56, 64, 80, 96,112,128,160,192,0,0,0,0,
};

code unsigned char T_Parameter[512] = {
	//word(0h-1fh)
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x00,0x80,0x00,0x00,0x20,0x00,0x20,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	//EQ_Table
	//Address(20h-3fh):normal
	0x7F,0xFF,0x7F,0xFF,0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FF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
        0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
        0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
        0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
//;================
	//15.0MHz 
	//Address (a0-a8): DAC_Table[9]: see programming guide chap 4
	0x06,0x00,0x05,0x00,0x09,0x00,0x0d,0x00,0x12,0x00,0x1c,0x00,0x1b,0x00,0x19,0x00,
	0x26,0x00,
	//Address(a9h-b1h): AUDCONFIG[9]
	0xc3,0xe4,0xc3,0xe4,0xc3,0xe4,0xc3,0xe4,0xc3,0xe4,0xc3,0xe4,0xc3,0xe4,
	0xc3,0xe4,0xc3,0xe4,
	//Address(b2h-b4h): DVR Table[3]
						  //0x5d,0xff,0x19,0x00,0x08,0x00,//13.5MHz
	0x5d,0xff,0x1c,0x00,0x09,0x00,//15.0MHz
//	//16.9344MHz
//	//Address (a0-a8): DAC_Table[9]
//		0x07,0x00,0x06,0x00,0x0A,0x00,0x0F,0x00,0x0E,0x00,0x15,0x00,0x1F,0x00,0x1C,0x00,
//		0x2B,0x00,
//	//Address(a9h-b1h): AUDCONFIG[9]
//		          0x83,0xe2,0x03,0xe1,0x83,0xe1,0x03,0xe6,0x03,0xe6,0x83,0xe3,0x83,0xe6,
//		0x03,0xe5,0x83,0xe5,
//	//Address(b2h-b4h): DVR Table[3]
//							0x5d,0xff,0x20,0x00,0x0a,0x00,//16.9344MHz

		//address(b5-bf)
	0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
		//address(c0-ff)
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};


/*
code unsigned char T_Parameter[512] = {
     //word(0h-1fh)
//Address(0h-fh)
     0x00,0x01,     // Code ID=0x0001 for 05A DSP code
     0xFF,0xFF,		// MP3 Vol
     0xFF,0xFF,     // DVR Vol
     0xFF,0xFF,     // DVR Filter: 1: fs/6, 0:fs/4
     0xFF,0xFF,     // ADC Turn ON Delay Time
     0xFF,0xFF,     // Vox Level
     0xFF,0xFF,     // White Noise Level
     0x81,0x03,     // DVR Rec Audio config
     0x83,0x01,		// DVR Play Audio config
     0xFF,0xFF,     // Mixer LL
     0xFF,0xFF,     // Mixer LR
     0xFF,0xFF,     // Mixer RL
     0xFF,0xFF,     // Mixer RR
     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,  // Reserved
//Address(10h-21h)
// IIR EQ
     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,   // Normal
     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,      // DBB

     0xcb,0x2c,0xc3,0xfd,0x6a,0x19,      // Jazz
     0x32,0x13,0xff,0x1f,0x6a,0x19,      // Rock

     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,      // POP

     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,      // CLASIC

//Address(22h-2Ah)
// System Init
     0x06,0x00,0x05,0x00,0x09,0x00,    // DAC Table, 15MHz
     //0x07,0x00,0x06,0x00,0x0A,0x00,      //16.934MHz

     0xc3,0xe4,0xc3,0xe4,0xc3,0xe4,    //15Mhz  AUD Config
	//0x83,0xe2,0x03,0xe1,0x83,0xe1,      //16.9344MHz, every word for sample-rate 32,44.1,48K 
     
     0x5d,0xff,0x1C,0x00,0x09,0x00,    //15MHz DVR config
     //0x5d,0xff,0x20,0x00,0x0a,0x00,       //16.9344MHz
//   0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,      // Reserved
//   0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,      // Reserved
//   0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,      // Reserved

//Address(2Bh-2Fh)
     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,      // Reserved
     0xFF,0xFF,0xFF,0xFF,          // Reserved

//Address(30h-4Fh)
// Vol Table
0x00,0x00, 0x41,0x00, 0x82,0x00, 0x04,0x01, 0x6f,0x01, 0x07,0x02, 0xdd,0x02, 0x0c,0x04,
0x18,0x05, 0x6a,0x06, 0x2a,0x0a, 0xcc,0x0c, 0x5d,0x0e, 0x1d,0x10, 0x14,0x12, 0x49,0x14,

0xc3,0x16, 0x8a,0x19, 0xa7,0x1c, 0x26,0x20, 0x13,0x24, 0x7a,0x28, 0x6a,0x2d, 0xf5,0x32,
0x2c,0x39, 0x26,0x40, 0xfa,0x47, 0xc3,0x50, 0x9d,0x5a, 0xac,0x65, 0x14,0x72 ,0x00,0x80,

//Address(50h-6Fh)
// DVR Vol Table
0x00,0x00, 0x41,0x00, 0x82,0x00, 0x04,0x01, 0x6f,0x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,0xFF,

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,


0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

//Address (d0-ef)

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,


0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

//Address (f0-ff)

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,

0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
};
*/

//-----------------------------------------------------------------------------
//Variable
//-----------------------------------------------------------------------------
xdata UCHAR G_MP3_Volume;

//=============================================================================
//Program
//=============================================================================
//---------------------------------------------------------------------------------------------------------------------------------------
//MP3_Initialize
//---------------------------------------------------------------------------------------------------------------------------------------
void MP3_Initialize(void) USING_0
{     
     UCHAR i;

     XBYTE[0x2019] &= 0xfb;   //Disable audio AC-97 interface
     XBYTE[0x2666] = 2;       //Serial interface clock 3 MHz
     XBYTE[0x2019] |= 0x02;   //Enable MP3 interface.
     XBYTE[0x2664] = 1;    //Enable MP3 serial interface.

     //printf("reset signal\n");
     //Reset MP3

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -