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

📄 sta013.h

📁 这项工程将让您把自己的MP3播放器平台
💻 H
字号:
//++
//sta013.h - declarations for sta013.c module
//
// Copyright (C) 2005 by Spare Time Gizmos.  All rights reserved.
//
// This file is part of the Spare Time Gizmos' MP3 Player firmware.
//
// This firmware is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 of the License, or (at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License along with
// this program; if not, write to the Free Software Foundation, Inc., 59 Temple
// Place, Suite 330, Boston, MA  02111-1307  USA
//
//REVISION HISTORY:
// dd-mmm-yy    who     description
// 15-May-05	RLA	New file.
//--
#ifndef _sta013_h_
#define _sta013_h_

#define STA_I2C_DEV		0x86 
#define STA_IDENT		0xAC 

// STA013 register declarations...
#define STA_REG_VERSION   	0x00 
#define STA_REG_IDENT   	0x01 
#define STA_REG_PLLCTL   	0x05 
#define STA_REG_PLLCTL_M   	0x06 
#define STA_REG_PLLCTL_N   	0x07 
#define STA_REG_REQ_POL   	0x0c 
#define STA_REG_SCLK_POL   	0x0d 
#define STA_REG_ERROR_CODE  	0x0f 
#define STA_REG_SOFT_RESET   	0x10 
#define STA_REG_PLAY   		0x13 
#define STA_REG_MUTE  		0x14 
#define STA_REG_CMD_INTERRUPT   0x16 
#define STA_REG_DATA_REQ_ENABLE 0x18 
#define STA_REG_SYNCSTATUS   	0x40 
#define STA_REG_ANCCOUNT_L   	0x41 
#define STA_REG_ANCCOUNT_H   	0x42 
#define STA_REG_HEAD_H   	0x43 
#define STA_REG_HEAD_M   	0x44 
#define STA_REG_HEAD_L   	0x45 
#define STA_REG_DLA   		0x46 
#define STA_REG_DLB   		0x47 
#define STA_REG_DRA   		0x48 
#define STA_REG_DRB   		0x49 
#define STA_REG_MFSDF_441   	0x50 
#define STA_REG_PLLFRAC_441_L   0x51 
#define STA_REG_PLLFRAC_441_H   0x52 
#define STA_REG_PCMDIVIDER   	0x54 
#define STA_REG_PCMCONF   	0x55 
#define STA_REG_PCMCROSS   	0x56 
#define STA_REG_ANC_DATA_1   	0x59 
#define STA_REG_ANC_DATA_2   	0x5a 
#define STA_REG_ANC_DATA_3   	0x5b 
#define STA_REG_ANC_DATA_4   	0x5c 
#define STA_REG_ANC_DATA_5   	0x5d 
#define STA_REG_MFSDF   	0x61 
#define STA_REG_DAC_CLK_MODE   	0x63 
#define STA_REG_PLLFRAC_L   	0x64 
#define STA_REG_PLLFRAC_H   	0x65 
#define STA_REG_FRAME_CNT_L   	0x67 
#define STA_REG_FRAME_CNT_M   	0x68 
#define STA_REG_FRAME_CNT_H   	0x69 
#define STA_REG_AVERAGE_BITRATE 0x6a 
#define STA_REG_SOFTVERSION   	0x71 
#define STA_REG_RUN  		0x72 
#define STA_REG_TREBLE_FREQUENCY_LOW	0x77 
#define STA_REG_TREBLE_FREQUENCY_HIGH   0x78 
#define STA_REG_BASS_FREQUENCY_LOW   	0x79 
#define STA_REG_BASS_FREQUENCY_HIGH   	0x7a 
#define STA_REG_TREBLE_ENHANCE   	0x7b 
#define STA_REG_BASS_ENHANCE   	0x7c 
#define STA_REG_TONE_ATTEN   	0x7d 

// Ranges for STA013 parameters...
#define MIN_VOLUME_ATTENUATION          0
#define MAX_VOLUME_ATTENUATION          96
#define MIN_TONE_ATTENUATION            0
#define MAX_TONE_ATTENUATION            96
#define MIN_BASS_FREQUENCY              100
#define MAX_BASS_FREQUENCY              500
#define MIN_BASS_ENHANCE                -12 // -18dB in 1.5 dB steps
#define MAX_BASS_ENHANCE                +12 // +18dB in 1.5 dB steps
#define MIN_TREBLE_FREQUENCY            1000
#define MAX_TREBLE_FREQUENCY            5000
#define MIN_TREBLE_ENHANCE              -12 // -18dB in 1.5 dB steps
#define MAX_TREBLE_ENHANCE              +12 // +18dB in 1.5 dB steps
#define SOFTMUTE_VOLUME_CHANGE          20

// MPEG layer codes returned by the STA013...
enum _MPEG_ID {
  STA_MPEG_2_5=0,	// MPEG 2.5
			// (code 1 is unused by the STA013)
  STA_MPEG_2  =2,       // MPEG 2
  STA_MPEG_1  =3	// MPEG 1
};
typedef enum _MPEG_ID MPEG_ID;


// STA013 and MP3 methods...
extern void InitializeSTA013 (void);
extern void ResetMP3Decoder (void);
extern void StartMP3Decoder (void);
extern void StopMP3Decoder (void);
extern void PauseMP3 (void);
extern void ResumeMP3 (void);
extern MPEG_ID GetMPEGID (void);
extern WORD GetMP3BitRate (void);
extern BYTE GetMP3SampleFrequency (void);

//   These procedures and globals are actually defined in the MP3DRQ.A51 module.
// Probably this module should get its own header file, but it just didn't seem
// worth the trouble...
extern PIBCB g_pPlayListHead, g_pPlayListEnd;
extern void InitializeMP3DRQ (void);
extern void FlushPlayList (void);
extern BOOL IsPlayListEmpty (void);

//   SDCC (but not Keil!) requires a prototype for any interrupt functions that
// use non-zero register banks be included in the main program (i.e. the file
// that conains the main() procedure).  This is so that it can correctly
// reserve memory for the extra register bank(s).  Better yet, SDCC further
// requires that any interrupt function also be declared in the main program
// so that it can correctly set the interrupt vector!
extern void MP3DRQ (void) interrupt INT0_VECTOR using 1;

#endif	// _sta013_h_

⌨️ 快捷键说明

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