Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

sta013.h

Go to the documentation of this file.
00001 /*! \file sta013.h \brief STMicroelectronics STA013 MP3 player driver. */
00002 //*****************************************************************************
00003 //
00004 // File Name    : 'sta013.h'
00005 // Title        : STMicroelectronics STA013 MP3 player driver
00006 // Author       : Pascal Stang
00007 // Created      : 10/22/2000
00008 // Revised      : 12/04/2000
00009 // Version      : 0.3
00010 // Target MCU   : ATmega103 (should work for Atmel AVR Series)
00011 // Editor Tabs  : 4
00012 //
00013 // NOTE: This code is currently below version 1.0, and therefore is considered
00014 // to be lacking in some functionality or documentation, or may not be fully
00015 // tested.  Nonetheless, you can expect most functions to work.
00016 //
00017 /// \ingroup driver_hw
00018 /// \defgroup sta013 ST STA013 MP3 Player Driver (sta013.c)
00019 /// \code #include "sta013.h" \endcode
00020 /// \par Overview
00021 ///     This library interfaces to the I2C control port of the STA013 MP3
00022 /// decoder chip.  All functions necessary for setup and and control of the
00023 /// decoder chip are included.  Supported functions include decoder initialize,
00024 /// decoder start, stop, pause, and resume, get bitrate and sample rate, set
00025 /// volume and tone controls.
00026 ///
00027 /// \NOTE The actual MP3 music data must be transmitted through a separate
00028 /// interface using SPI.  The SPI function library is suitable for this.
00029 //
00030 // This code is distributed under the GNU Public License
00031 //      which can be found at http://www.gnu.org/licenses/gpl.txt
00032 //
00033 //*****************************************************************************
00034 
00035 
00036 #ifndef STA013_H
00037 #define STA013_H
00038 
00039 #include "global.h"
00040 
00041 // include project-dependent configuration
00042 #include "sta013conf.h"
00043 
00044 // STA013 I2C address
00045 #define STA_I2C_DEV                     0x86
00046 #define STA_IDENT                       0xAC
00047 
00048 // STA013 register (sub)address
00049 #define STA_REG_VERSION                0x00
00050 #define STA_REG_IDENT                  0x01
00051 #define STA_REG_PLLCTL_1               0x05
00052 #define STA_REG_PLLCTL_2               0x06
00053 #define STA_REG_PLLCTL_3               0x07
00054 #define STA_REG_REQ_POL                0x0c
00055 #define STA_REG_SCLK_POL               0x0d
00056 #define STA_REG_ERROR_CODE             0x0f
00057 #define STA_REG_SOFT_RESET             0x10
00058 #define STA_REG_PLAY                   0x13
00059 #define STA_REG_MUTE                   0x14
00060 #define STA_REG_CMD_INTERRUPT          0x16
00061 #define STA_REG_DATA_REQ_ENABLE        0x18
00062 #define STA_REG_SYNCSTATUS             0x40
00063 #define STA_REG_ANCCOUNT_L             0x41
00064 #define STA_REG_ANCCOUNT_H             0x42
00065 #define STA_REG_HEAD_H                 0x43
00066 #define STA_REG_HEAD_M                 0x44
00067 #define STA_REG_HEAD_L                 0x45
00068 #define STA_REG_DLA                    0x46
00069 #define STA_REG_DLB                    0x47
00070 #define STA_REG_DRA                    0x48
00071 #define STA_REG_DRB                    0x49
00072 #define STA_REG_MFSDF_441              0x50
00073 #define STA_REG_PLLFRAC_441_L          0x51
00074 #define STA_REG_PLLFRAC_441_H          0x52
00075 #define STA_REG_PCMDIVIDER             0x54
00076 #define STA_REG_PCMCONF                0x55
00077 #define STA_REG_PCMCROSS               0x56
00078 #define STA_REG_ANC_DATA_1             0x59
00079 #define STA_REG_ANC_DATA_2             0x5a
00080 #define STA_REG_ANC_DATA_3             0x5b
00081 #define STA_REG_ANC_DATA_4             0x5c
00082 #define STA_REG_ANC_DATA_5             0x5d
00083 #define STA_REG_MFSDF                  0x61
00084 #define STA_REG_DAC_CLK_MODE           0x63
00085 #define STA_REG_PLLFRAC_L              0x64
00086 #define STA_REG_PLLFRAC_H              0x65
00087 #define STA_REG_FRAME_CNT_L            0x67
00088 #define STA_REG_FRAME_CNT_M            0x68
00089 #define STA_REG_FRAME_CNT_H            0x69
00090 #define STA_REG_AVERAGE_BITRATE        0x6a
00091 #define STA_REG_SOFTVERSION            0x71
00092 #define STA_REG_RUN                    0x72
00093 #define STA_REG_TREBLE_FREQUENCY_LOW   0x77
00094 #define STA_REG_TREBLE_FREQUENCY_HIGH  0x78
00095 #define STA_REG_BASS_FREQUENCY_LOW     0x79
00096 #define STA_REG_BASS_FREQUENCY_HIGH    0x7a
00097 #define STA_REG_TREBLE_ENHANCE         0x7b
00098 #define STA_REG_BASS_ENHANCE           0x7c
00099 #define STA_REG_TONE_ATTEN             0x7d
00100 
00101 #define MIN_VOLUME_ATTENUATION          0
00102 #define MAX_VOLUME_ATTENUATION          96
00103 #define MIN_TONE_ATTENUATION            0
00104 #define MAX_TONE_ATTENUATION            96
00105 #define MIN_BASS_FREQUENCY              100
00106 #define MAX_BASS_FREQUENCY              500
00107 #define MIN_BASS_ENHANCE                -12 // -18dB in 1.5 dB steps
00108 #define MAX_BASS_ENHANCE                +12 // +18dB in 1.5 dB steps
00109 #define MIN_TREBLE_FREQUENCY            1000
00110 #define MAX_TREBLE_FREQUENCY            5000
00111 #define MIN_TREBLE_ENHANCE              -12 // -18dB in 1.5 dB steps
00112 #define MAX_TREBLE_ENHANCE              +12 // +18dB in 1.5 dB steps
00113 #define SOFTMUTE_VOLUME_CHANGE          20
00114 
00115 // global variables
00116 //u16 Sta013UpdateIndex;
00117 
00118 // prototypes
00119 void sta013HWReset(void);
00120 u08  sta013ReadReg(u08 reg);
00121 void sta013WriteReg(u08 reg, u08 data);
00122 void sta013DownloadUpdate(void);
00123 u08  sta013Init(void);
00124 
00125 void sta013StartDecoder(void);
00126 void sta013StopDecoder(void);
00127 void sta013PauseDecoder(void);
00128 void sta013ResumeDecoder(void);
00129 
00130 void sta013GetMP3Info(u16 *bitrate, u08 *sampFreq, u08 *mode);
00131 u16 sta013GetAverageBitrate(void);
00132 
00133 void sta013SetVolume(u08 volume, s08 balance);
00134 void sta013SetTone(s08 bassEnh, u16 bassFreq, s08 trebleEnh, u16 trebleFreq);
00135 
00136 
00137 u08  sta013Demand(void);
00138 
00139 #endif

Generated on Sun Oct 29 03:41:07 2006 for Procyon AVRlib by  doxygen 1.4.2