ATMEL公司AT89C51SND1为主控制器MP3源代码
源代码在线查看: song_drv.h
/*H**************************************************************************
* NAME: song_drv.h
*----------------------------------------------------------------------------
* Copyright (c) 2003 Atmel.
*----------------------------------------------------------------------------
* RELEASE: snd1c-refd-nf-4_0_3
* REVISION: 1.11
*----------------------------------------------------------------------------
* PURPOSE
* This file contains the song driver definition
*****************************************************************************/
#ifndef _SONG_DRV_H_
#define _SONG_DRV_H_
/*_____ I N C L U D E S ____________________________________________________*/
/*_____ M A C R O S ________________________________________________________*/
#define NB_SOUND (Byte)5
#define SND_VOLUME (Byte)0
#define SND_BASS (Byte)1
#define SND_MEDIUM (Byte)2
#define SND_TREBLE (Byte)3
#define SND_BBOOST (Byte)4
#define VOLUME_MAX (Byte)31
#define BASS_MAX (Byte)31
#define MEDIUM_MAX (Byte)31
#define TREBLE_MAX (Byte)31
#define BBOOST_MAX (Byte)1
#define VOLUME_MIN (Byte)0
#define BASS_MIN (Byte)0
#define MEDIUM_MIN (Byte)0
#define TREBLE_MIN (Byte)0
#define BBOOST_MIN (Byte)0
#define VOLUME_MED (Byte)15
#define BASS_MED (Byte)15
#define MEDIUM_MED (Byte)15
#define TREBLE_MED (Byte)15
#define BBOOST_MED (Byte)0
/* MP3 Frame Header */
#define MP3_SYNC_H (Byte)0xFF
#define MP3_SYNC_L (Byte)0xF0
#define MP3_MSK_SYNC (Byte)0xF0
#define MP3_MSK_VER (Byte)0x08
#define MP3_LAYER_III (Byte)0x02
#define MP3_MSK_LAYER (Byte)0x06
#define MP3_BR_FREE (Byte)0x00
#define MP3_BR_224 (Byte)0xC0
#define MP3_BR_256 (Byte)0xD0
#define MP3_BR_320 (Byte)0xE0
#define MP3_BR_112 (Byte)0xB0
#define MP3_BR_144 (Byte)0xD0
#define MP3_BR_160 (Byte)0xE0
#define MP3_MSK_BR (Byte)0xF0
#define MP3_FS_22 (Byte)0x00
#define MP3_FS_24 (Byte)0x01
#define MP3_FS_16 (Byte)0x02
#define MP3_FS_44 (Byte)0x04
#define MP3_FS_48 (Byte)0x05
#define MP3_FS_32 (Byte)0x06
#define MP3_MSK_FS (Byte)0x0C
#define MP3_MSK_EMP (Byte)0x01
/* song_init() Return */
#define SONG_MAX_ERR (Byte)100
#define SONG_NO_ERR (Byte)0x00 /* each error coded on 1 bit */
#define SONG_LAYER_ERR (Byte)0x01
#define SONG_BR_ERR (Byte)0x02
#define SONG_FS_ERR (Byte)0x04
#define SONG_SYNC_ERR (Byte)0x08
/*_____ D E F I N I T I O N ________________________________________________*/
/*_____ D E C L A R A T I O N ______________________________________________*/
Byte song_init (void);
void song_start (void);
void song_pause (void);
void song_stop (void);
void song_snd_init (void);
void song_snd_inc (void);
void song_snd_dec (void);
void song_snd_select (void);
Byte song_get_sound (void);
Byte song_get_level (void);
#endif /* _SONG_DRV_H_ */