?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 6

Line No. Rev Author Line
1 6 kaklik /*! \file sta013.h \brief STMicroelectronics STA013 MP3 player driver. */
2 //*****************************************************************************
3 //
4 // File Name : 'sta013.h'
5 // Title : STMicroelectronics STA013 MP3 player driver
6 // Author : Pascal Stang
7 // Created : 10/22/2000
8 // Revised : 12/04/2000
9 // Version : 0.3
10 // Target MCU : ATmega103 (should work for Atmel AVR Series)
11 // Editor Tabs : 4
12 //
13 // NOTE: This code is currently below version 1.0, and therefore is considered
14 // to be lacking in some functionality or documentation, or may not be fully
15 // tested. Nonetheless, you can expect most functions to work.
16 //
17 /// \ingroup driver_hw
18 /// \defgroup sta013 ST STA013 MP3 Player Driver (sta013.c)
19 /// \code #include "sta013.h" \endcode
20 /// \par Overview
21 /// This library interfaces to the I2C control port of the STA013 MP3
22 /// decoder chip.  All functions necessary for setup and and control of the
23 /// decoder chip are included.  Supported functions include decoder initialize,
24 /// decoder start, stop, pause, and resume, get bitrate and sample rate, set
25 /// volume and tone controls.
26 ///
27 /// \NOTE The actual MP3 music data must be transmitted through a separate
28 /// interface using SPI.  The SPI function library is suitable for this.
29 //
30 // This code is distributed under the GNU Public License
31 // which can be found at http://www.gnu.org/licenses/gpl.txt
32 //
33 //*****************************************************************************
34  
35  
36 #ifndef STA013_H
37 #define STA013_H
38  
39 #include "global.h"
40  
41 // include project-dependent configuration
42 #include "sta013conf.h"
43  
44 // STA013 I2C address
45 #define STA_I2C_DEV 0x86
46 #define STA_IDENT 0xAC
47  
48 // STA013 register (sub)address
49 #define STA_REG_VERSION 0x00
50 #define STA_REG_IDENT 0x01
51 #define STA_REG_PLLCTL_1 0x05
52 #define STA_REG_PLLCTL_2 0x06
53 #define STA_REG_PLLCTL_3 0x07
54 #define STA_REG_REQ_POL 0x0c
55 #define STA_REG_SCLK_POL 0x0d
56 #define STA_REG_ERROR_CODE 0x0f
57 #define STA_REG_SOFT_RESET 0x10
58 #define STA_REG_PLAY 0x13
59 #define STA_REG_MUTE 0x14
60 #define STA_REG_CMD_INTERRUPT 0x16
61 #define STA_REG_DATA_REQ_ENABLE 0x18
62 #define STA_REG_SYNCSTATUS 0x40
63 #define STA_REG_ANCCOUNT_L 0x41
64 #define STA_REG_ANCCOUNT_H 0x42
65 #define STA_REG_HEAD_H 0x43
66 #define STA_REG_HEAD_M 0x44
67 #define STA_REG_HEAD_L 0x45
68 #define STA_REG_DLA 0x46
69 #define STA_REG_DLB 0x47
70 #define STA_REG_DRA 0x48
71 #define STA_REG_DRB 0x49
72 #define STA_REG_MFSDF_441 0x50
73 #define STA_REG_PLLFRAC_441_L 0x51
74 #define STA_REG_PLLFRAC_441_H 0x52
75 #define STA_REG_PCMDIVIDER 0x54
76 #define STA_REG_PCMCONF 0x55
77 #define STA_REG_PCMCROSS 0x56
78 #define STA_REG_ANC_DATA_1 0x59
79 #define STA_REG_ANC_DATA_2 0x5a
80 #define STA_REG_ANC_DATA_3 0x5b
81 #define STA_REG_ANC_DATA_4 0x5c
82 #define STA_REG_ANC_DATA_5 0x5d
83 #define STA_REG_MFSDF 0x61
84 #define STA_REG_DAC_CLK_MODE 0x63
85 #define STA_REG_PLLFRAC_L 0x64
86 #define STA_REG_PLLFRAC_H 0x65
87 #define STA_REG_FRAME_CNT_L 0x67
88 #define STA_REG_FRAME_CNT_M 0x68
89 #define STA_REG_FRAME_CNT_H 0x69
90 #define STA_REG_AVERAGE_BITRATE 0x6a
91 #define STA_REG_SOFTVERSION 0x71
92 #define STA_REG_RUN 0x72
93 #define STA_REG_TREBLE_FREQUENCY_LOW 0x77
94 #define STA_REG_TREBLE_FREQUENCY_HIGH 0x78
95 #define STA_REG_BASS_FREQUENCY_LOW 0x79
96 #define STA_REG_BASS_FREQUENCY_HIGH 0x7a
97 #define STA_REG_TREBLE_ENHANCE 0x7b
98 #define STA_REG_BASS_ENHANCE 0x7c
99 #define STA_REG_TONE_ATTEN 0x7d
100  
101 #define MIN_VOLUME_ATTENUATION 0
102 #define MAX_VOLUME_ATTENUATION 96
103 #define MIN_TONE_ATTENUATION 0
104 #define MAX_TONE_ATTENUATION 96
105 #define MIN_BASS_FREQUENCY 100
106 #define MAX_BASS_FREQUENCY 500
107 #define MIN_BASS_ENHANCE -12 // -18dB in 1.5 dB steps
108 #define MAX_BASS_ENHANCE +12 // +18dB in 1.5 dB steps
109 #define MIN_TREBLE_FREQUENCY 1000
110 #define MAX_TREBLE_FREQUENCY 5000
111 #define MIN_TREBLE_ENHANCE -12 // -18dB in 1.5 dB steps
112 #define MAX_TREBLE_ENHANCE +12 // +18dB in 1.5 dB steps
113 #define SOFTMUTE_VOLUME_CHANGE 20
114  
115 // global variables
116 //u16 Sta013UpdateIndex;
117  
118 // prototypes
119 void sta013HWReset(void);
120 u08 sta013ReadReg(u08 reg);
121 void sta013WriteReg(u08 reg, u08 data);
122 void sta013DownloadUpdate(void);
123 u08 sta013Init(void);
124  
125 void sta013StartDecoder(void);
126 void sta013StopDecoder(void);
127 void sta013PauseDecoder(void);
128 void sta013ResumeDecoder(void);
129  
130 void sta013GetMP3Info(u16 *bitrate, u08 *sampFreq, u08 *mode);
131 u16 sta013GetAverageBitrate(void);
132  
133 void sta013SetVolume(u08 volume, s08 balance);
134 void sta013SetTone(s08 bassEnh, u16 bassFreq, s08 trebleEnh, u16 trebleFreq);
135  
136  
137 u08 sta013Demand(void);
138  
139 #endif
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3