00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef STA013_H
00037 #define STA013_H
00038
00039 #include "global.h"
00040
00041
00042 #include "sta013conf.h"
00043
00044
00045 #define STA_I2C_DEV 0x86
00046 #define STA_IDENT 0xAC
00047
00048
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
00116
00117
00118
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