00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef STA013_H
00024 #define STA013_H
00025
00026 #include "global.h"
00027
00028
00029 #include "sta013conf.h"
00030
00031
00032 #define STA_I2C_DEV 0x86
00033 #define STA_IDENT 0xAC
00034
00035
00036 #define STA_REG_VERSION 0x00
00037 #define STA_REG_IDENT 0x01
00038 #define STA_REG_PLLCTL_1 0x05
00039 #define STA_REG_PLLCTL_2 0x06
00040 #define STA_REG_PLLCTL_3 0x07
00041 #define STA_REG_REQ_POL 0x0c
00042 #define STA_REG_SCLK_POL 0x0d
00043 #define STA_REG_ERROR_CODE 0x0f
00044 #define STA_REG_SOFT_RESET 0x10
00045 #define STA_REG_PLAY 0x13
00046 #define STA_REG_MUTE 0x14
00047 #define STA_REG_CMD_INTERRUPT 0x16
00048 #define STA_REG_DATA_REQ_ENABLE 0x18
00049 #define STA_REG_SYNCSTATUS 0x40
00050 #define STA_REG_ANCCOUNT_L 0x41
00051 #define STA_REG_ANCCOUNT_H 0x42
00052 #define STA_REG_HEAD_H 0x43
00053 #define STA_REG_HEAD_M 0x44
00054 #define STA_REG_HEAD_L 0x45
00055 #define STA_REG_DLA 0x46
00056 #define STA_REG_DLB 0x47
00057 #define STA_REG_DRA 0x48
00058 #define STA_REG_DRB 0x49
00059 #define STA_REG_MFSDF_441 0x50
00060 #define STA_REG_PLLFRAC_441_L 0x51
00061 #define STA_REG_PLLFRAC_441_H 0x52
00062 #define STA_REG_PCMDIVIDER 0x54
00063 #define STA_REG_PCMCONF 0x55
00064 #define STA_REG_PCMCROSS 0x56
00065 #define STA_REG_ANC_DATA_1 0x59
00066 #define STA_REG_ANC_DATA_2 0x5a
00067 #define STA_REG_ANC_DATA_3 0x5b
00068 #define STA_REG_ANC_DATA_4 0x5c
00069 #define STA_REG_ANC_DATA_5 0x5d
00070 #define STA_REG_MFSDF 0x61
00071 #define STA_REG_DAC_CLK_MODE 0x63
00072 #define STA_REG_PLLFRAC_L 0x64
00073 #define STA_REG_PLLFRAC_H 0x65
00074 #define STA_REG_FRAME_CNT_L 0x67
00075 #define STA_REG_FRAME_CNT_M 0x68
00076 #define STA_REG_FRAME_CNT_H 0x69
00077 #define STA_REG_AVERAGE_BITRATE 0x6a
00078 #define STA_REG_SOFTVERSION 0x71
00079 #define STA_REG_RUN 0x72
00080 #define STA_REG_TREBLE_FREQUENCY_LOW 0x77
00081 #define STA_REG_TREBLE_FREQUENCY_HIGH 0x78
00082 #define STA_REG_BASS_FREQUENCY_LOW 0x79
00083 #define STA_REG_BASS_FREQUENCY_HIGH 0x7a
00084 #define STA_REG_TREBLE_ENHANCE 0x7b
00085 #define STA_REG_BASS_ENHANCE 0x7c
00086 #define STA_REG_TONE_ATTEN 0x7d
00087
00088 #define MIN_VOLUME_ATTENUATION 0
00089 #define MAX_VOLUME_ATTENUATION 96
00090 #define MIN_TONE_ATTENUATION 0
00091 #define MAX_TONE_ATTENUATION 96
00092 #define MIN_BASS_FREQUENCY 100
00093 #define MAX_BASS_FREQUENCY 500
00094 #define MIN_BASS_ENHANCE -12 // -18dB in 1.5 dB steps
00095 #define MAX_BASS_ENHANCE +12 // +18dB in 1.5 dB steps
00096 #define MIN_TREBLE_FREQUENCY 1000
00097 #define MAX_TREBLE_FREQUENCY 5000
00098 #define MIN_TREBLE_ENHANCE -12 // -18dB in 1.5 dB steps
00099 #define MAX_TREBLE_ENHANCE +12 // +18dB in 1.5 dB steps
00100 #define SOFTMUTE_VOLUME_CHANGE 20
00101
00102
00103
00104
00105
00106 void sta013HWReset(void);
00107 u08 sta013ReadReg(u08 reg);
00108 void sta013WriteReg(u08 reg, u08 data);
00109 void sta013DownloadUpdate(void);
00110 u08 sta013Init(void);
00111
00112 void sta013StartDecoder(void);
00113 void sta013StopDecoder(void);
00114 void sta013PauseDecoder(void);
00115 void sta013ResumeDecoder(void);
00116
00117 void sta013GetMP3Info(u16 *bitrate, u08 *sampFreq, u08 *mode);
00118 u16 sta013GetAverageBitrate(void);
00119
00120 void sta013SetVolume(u08 volume, s08 balance);
00121 void sta013SetTone(s08 bassEnh, u16 bassFreq, s08 trebleEnh, u16 trebleFreq);
00122
00123
00124 u08 sta013Demand(void);
00125
00126 #endif