#include "board.h"
#include "ui.h"
Include dependency graph for vs10xx.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Defines | |
#define | USE_512_BYTE_DREQ 1 |
#define | VS_WRITE_COMMAND 0x02 |
VS10xx SCI Write Command byte is 0x02. | |
#define | VS_READ_COMMAND 0x03 |
VS10xx SCI Read Command byte is 0x03. | |
#define | SCI_MODE 0x0 |
VS10xx register. | |
#define | SCI_STATUS 0x1 |
VS10xx register. | |
#define | SCI_BASS 0x2 |
VS10xx register. | |
#define | SCI_CLOCKF 0x3 |
VS10xx register. | |
#define | SCI_DECODE_TIME 0x4 |
VS10xx register. | |
#define | SCI_AUDATA 0x5 |
VS10xx register. | |
#define | SCI_WRAM 0x6 |
VS10xx register. | |
#define | SCI_WRAMADDR 0x7 |
VS10xx register. | |
#define | SCI_IN0 0x8 |
#define | SCI_IN1 0x9 |
#define | SCI_AIADDR 0xa |
VS10xx register. | |
#define | SCI_VOL 0xb |
VS10xx register. | |
#define | SCI_MIXERVOL 0xc |
VS10xx register. | |
#define | SCI_ADPCMRECCTL 0xd |
VS10xx register. | |
#define | SCI_AICTRL2 0xe |
VS10xx register. | |
#define | SCI_AICTRL3 0xf |
VS10xx register. | |
#define | SM_DIFF 0x01 |
VS10xx register. | |
#define | SM_RECORD_MIXER 0x02 |
VS10xx register. | |
#define | SM_RESET 0x04 |
VS10xx register. | |
#define | SM_OUTOFMIDI 0x08 |
VS10xx register. | |
#define | SM_OUTOFWAV 0x08 |
VS10xx register. | |
#define | SM_PDOWN 0x10 |
VS10xx register. | |
#define | SM_TESTS 0x20 |
VS10xx register. | |
#define | SM_SDI_ADPCM 0x40 |
VS10xx register. | |
#define | SM_RT_MIDI 0x80 |
VS10xx register. | |
#define | SM_DACT 0x01 |
VS10xx register. | |
#define | SM_SDIORD 0x02 |
VS10xx register. | |
#define | SM_SDISHARE 0x04 |
VS10xx register. | |
#define | SM_SDINEW 0x08 |
VS10xx register. | |
#define | SM_EARSPK_0 0x00 |
#define | SM_EARSPK_1 0x10 |
#define | SM_EARSPK_2 0x20 |
#define | SM_EARSPK_3 0x30 |
#define | SM_LINE_IN 0x40 |
#define | SM_RECORD_ADPCM 0x80 |
#define | Mp3WriteRegister(addressbyte, highbyte, lowbyte) |
Write VS10xx register. | |
#define | Mp3SetVolume(leftchannel, rightchannel) |
Set VS10xx Volume Register. | |
#define | Mp3Wait() {while(!MP3_DREQ);} |
Wait for DREQ. | |
Functions | |
void | Vs1103SetMode () |
void | VsSineTest () |
Execute VS1011/VS1002 Sine Test Function. | |
void | Mp3Reset () |
Reset VS10xx. | |
void | Mp3SoftReset () |
Soft Reset of VS10xx (Between songs). | |
void | Mp3SetMixerVolume (unsigned char midiVolume, unsigned char waveVolume, unsigned char micVolume) |
unsigned int | Mp3ReadRegister (unsigned char addressbyte) |
Read the 16-bit value of a VS10xx register. | |
void | SendZerosToVS10xx () |
Send 2048 zeros. | |
unsigned char | PlayDiskSectors (unsigned int nSectorsToPlay) |
Play disk sectors from disk. | |
void | AvailableProcessorTime () |
User interface. | |
void | Vs1103B_SetMidiTranspose (int transpose) |
VS1103B specific function: set MasterTranspose. | |
void | Vs1103B_SetChannelMask (unsigned int newMask) |
VS1103B specific function: select MIDI channels. | |
void | Vs1103SetMicGain (unsigned char gain) |
Set MIC analog amplifier value. | |
void | Vs1103CancelWave () |
Terminate wave stream playing. | |
void | Vs1103CancelMidi () |
Terminate MIDI stream playing. | |
Variables | |
xdata unsigned char | playingState |
Playing State Global, 0=normal playing, 1=abort playing. | |
bit | vs1103_recording_active |
VS1103 MODE bit. | |
bit | vs1103_record_mixer |
VS1103 MODE bit. | |
bit | vs1103_use_line_input |
VS1103 MODE bit. | |
bit | vs1103_do_reset |
VS1103 MODE bit. | |
bit | vs1103_mono_output |
VS1103 MODE bit. | |
bit | vs1103_terminate |
VS1103 MODE bit. | |
bit | vs1103_earSpkHi |
VS1103 MODE bit. | |
bit | vs1103_earSpkLo |
VS1103 MODE bit. | |
bit | vs1103_real_time_midi |
VS1103 MODE bit. |
Interfacing the New Way, not handling BSYNC -> not compatible with VS1001.
Definition in file vs10xx.h.
|
Value: {\ Mp3WriteRegister(11,(leftchannel),(rightchannel));}
Definition at line 110 of file vs10xx.h. Referenced by AvailableProcessorTime(), and Mp3Reset(). |
|
Wait for DREQ.
|
|
Value: { \ Mp3SelectControl(); \ SPIPutCharWithoutWaiting(VS_WRITE_COMMAND); \ SPIPutChar((addressbyte)); \ SPIPutChar((highbyte)); \ SPIPutChar((lowbyte)); \ SPIWait(); \ Mp3DeselectControl();}
Definition at line 100 of file vs10xx.h. Referenced by AvailableProcessorTime(), LoadPatch(), Mp3Reset(), Mp3SetMixerVolume(), Mp3SoftReset(), StartPatch(), UpdateDisplay(), Vs1103B_SetChannelMask(), Vs1103B_SetMidiTranspose(), Vs1103CancelWave(), Vs1103SetMicGain(), and Vs1103SetMode(). |
|
VS10xx register.
Definition at line 36 of file vs10xx.h. Referenced by Mp3SoftReset(), Vs1103CancelWave(), and Vs1103SetMicGain(). |
|
VS10xx register.
Definition at line 33 of file vs10xx.h. Referenced by StartPatch(). |
|
VS10xx register.
|
|
VS10xx register.
Definition at line 38 of file vs10xx.h. Referenced by main(). |
|
VS10xx register.
|
|
VS10xx register.
Definition at line 25 of file vs10xx.h. Referenced by AvailableProcessorTime(). |
|
VS10xx register.
Definition at line 26 of file vs10xx.h. Referenced by Mp3Reset(). |
|
VS10xx register.
|
|
Definition at line 31 of file vs10xx.h. Referenced by PlayerTaskHandler(), and TransferSectorSCI(). |
|
Definition at line 32 of file vs10xx.h. Referenced by PlayerTaskHandler(). |
|
VS10xx register.
Definition at line 35 of file vs10xx.h. Referenced by Mp3SetMixerVolume(). |
|
VS10xx register.
Definition at line 23 of file vs10xx.h. Referenced by Vs1103SetMode(). |
|
VS10xx register.
|
|
VS10xx register.
|
|
VS10xx register.
Definition at line 29 of file vs10xx.h. Referenced by UpdateDisplay(), Vs1103B_SetChannelMask(), Vs1103B_SetMidiTranspose(), and Vs1103SetMode(). |
|
VS10xx register.
Definition at line 30 of file vs10xx.h. Referenced by UpdateDisplay(), Vs1103B_SetChannelMask(), Vs1103B_SetMidiTranspose(), and Vs1103SetMode(). |
|
VS10xx register.
|
|
VS10xx register.
|
|
|
|
|
|
|
|
|
|
|
|
VS10xx register.
|
|
VS10xx register.
|
|
VS10xx register.
|
|
|
|
VS10xx register.
|
|
VS10xx register.
|
|
VS10xx register.
|
|
VS10xx register.
|
|
VS10xx register.
|
|
VS10xx register.
|
|
VS10xx register.
|
|
VS10xx register.
|
|
Definition at line 13 of file vs10xx.h. Referenced by Mp3SoftReset(), Vs1103CancelWave(), and Vs1103SetMicGain(). |
|
VS10xx SCI Read Command byte is 0x03.
Definition at line 20 of file vs10xx.h. Referenced by Mp3ReadRegister(), and PlayerTaskHandler(). |
|
VS10xx SCI Write Command byte is 0x02.
Definition at line 17 of file vs10xx.h. Referenced by TransferSectorSCI(). |
|
User interface. This function is called when the player is playing a song and there is free processor time. The basic task of this function is to implement the player user interface. Bass/Treble settings have been changed Key has been pressed but not released Bass/Treble setting calculation There are 2 or 4 adjustments possible:
In this software, all are adjusted based from a single setting (0..128) for bass and another for treble. You may wish to allow user to control frequency and level separately or set fixed frequencies for a known speaker type. This algorithm increases the frequency range of adjustment with the increasing level. Definition at line 1105 of file player.c. References bass, CancelRecord(), currentMicGainSetting, currentMicVolume, currentMidiFile, currentMidiVolume, currentRecordFile, currentWaveFile, currentWaveVolume, EchoDisable(), EchoEnable(), KEY_DOWN, KEY_LEFT, KEY_UP, LcdReset(), lyricsDisplay, midiChannelMask, Mp3ReadRegister(), Mp3SetMixerVolume(), Mp3SetVolume, Mp3WriteRegister, PlayerTaskHandler(), rotaryValue, SCI_BASS, SelectMidiFile(), SelectRecordFile(), SelectWaveFile(), SetDisplayPercent(), SetDisplaySignedValue(), SetDisplayText(), SetMidiFromFile(), SetMidiFromUART(), transpose, treble, UI_ECHOMODE, UI_MIC_GAIN, UI_MIC_VOLUME, UI_MIDIFILE, UI_MIDISOURCE, UI_MIDITRANSPOSE, UI_MIDIVOLUME, UI_RECORDFILE, UI_VOLUME, UI_WAVEFILE, UI_WAVEVOLUME, uiMode, UpdateDisplay(), userInterfaceDelayElapsed, volume, Vs1103B_SetChannelMask(), Vs1103B_SetMidiTranspose(), and Vs1103SetMicGain(). Referenced by main(), and PlayDiskSectors(). 01105 { 01106 unsigned int i; //temp variable 01108 static bit bassUpdateNeeded; 01110 static bit keyInTransit; 01111 01112 01113 if (!userInterfaceDelayElapsed){ 01114 return; /* Not yet time to do user interface stuff */ 01115 } 01116 userInterfaceDelayElapsed = 0; 01117 01118 if (keyInTransit){ //Keypress already registered 01119 if (!KEY_UP && !KEY_DOWN && !KEY_LEFT && !KEY_RIGHT){ 01120 keyInTransit = 0; //Wait until key not pressed 01121 } 01122 }else{ //Is there a new keypress? 01123 if (KEY_UP){ 01124 rotaryValue = NEXT_THRESHOLD; 01125 keyInTransit = 1; 01126 } 01127 if (KEY_DOWN){ 01128 rotaryValue = PREV_THRESHOLD; 01129 keyInTransit = 1; 01130 } 01131 01132 if (KEY_LEFT){ 01133 if (uiMode) { 01134 uiMode--; 01135 keyInTransit = 1; 01136 rotaryValue = 0; 01137 } 01138 } 01139 if (KEY_RIGHT){ 01140 uiMode++; 01141 keyInTransit = 1; 01142 if (uiMode == UI_END_OF_MODES) { 01143 uiMode--; 01144 } 01145 rotaryValue = 0; 01146 } 01147 if (keyInTransit){ 01148 //Always do this once when a key is pressed: 01149 LcdReset(); 01150 lyricsDisplay = 0; 01151 } 01152 } 01153 01154 01155 01156 01157 // K E Y B O A R D E V E N T S 01158 // ----------------------------- 01159 01160 01161 // N E X T 01162 // N E X T 01163 01164 01165 //Is there a large PLUS(UP) rotation? This can mean 01166 //a "NEXT" or "SWITCH ON" request from the user 01167 if (rotaryValue >= NEXT_THRESHOLD) { 01168 signed char storedRotaryValue = rotaryValue; 01169 01170 01171 // Do all midi ch on/off settings in one place 01172 if ((uiMode >= UI_MIDI_CH1) && (uiMode <= UI_MIDI_CH16)){ 01173 midiChannelMask &= ~(1 << (uiMode - UI_MIDI_CH1)); 01174 Vs1103B_SetChannelMask(midiChannelMask); 01175 SetDisplayText(uiMode,"On "); 01176 rotaryValue = 0; 01177 01178 }else{ 01179 rotaryValue = 0; 01180 01181 //What parameters can be affected? 01182 switch(uiMode){ 01183 case UI_MIDITRANSPOSE: 01184 transpose++; 01185 SetDisplaySignedValue(UI_MIDITRANSPOSE,transpose); 01186 Vs1103B_SetMidiTranspose(transpose); 01187 break; 01188 01189 01190 case UI_RECORDFILE: 01191 if (currentRecordFile){ 01192 currentRecordFile=0; 01193 CancelRecord(); 01194 }else{ 01195 currentRecordFile = 0; 01196 if (!SelectRecordFile(1)){ 01197 currentRecordFile = 1; 01198 } 01199 } 01200 break; 01201 01202 case UI_WAVEFILE: 01203 if (!SelectWaveFile(currentWaveFile+1)){ 01204 currentWaveFile++; 01205 } 01206 break; 01207 01208 case UI_MIDIFILE: 01209 if (!SelectMidiFile(currentMidiFile+1)){ 01210 currentMidiFile++; 01211 } 01212 break; 01213 01214 case UI_MIDISOURCE: 01215 SetMidiFromUART(); 01216 break; 01217 01218 01219 case UI_ECHOMODE: 01220 EchoEnable(); 01221 break; 01222 01223 01224 default: 01225 //The request does not apply to current uiMode 01226 rotaryValue = storedRotaryValue; //restore value 01227 break; 01228 } 01229 } 01230 } 01231 01232 01233 01234 01235 // P R E V I O U S 01236 // P R E V I O U S 01237 01238 01239 //Is there a large MINUS rotation? This can mean 01240 //a "PREVIOUS" or "SWITCH OFF" request from the user 01241 if (rotaryValue <= PREV_THRESHOLD) { 01242 signed char storedRotaryValue = rotaryValue; 01243 01244 // Do all midi ch on/off settings in one place 01245 if ((uiMode >= UI_MIDI_CH1) && (uiMode <= UI_MIDI_CH16)){ 01246 midiChannelMask |= (1 << (uiMode - UI_MIDI_CH1)); 01247 Vs1103B_SetChannelMask(midiChannelMask); 01248 SetDisplayText(uiMode,"Off "); 01249 rotaryValue = 0; 01250 01251 }else{ 01252 rotaryValue = 0; //Store and clear 01253 //What parameters can be affected? 01254 01255 01256 switch(uiMode){ 01257 01258 01259 case UI_WAVEFILE: 01260 if (!SelectWaveFile(currentWaveFile-1)){ 01261 currentWaveFile--; 01262 } 01263 break; 01264 01265 case UI_MIDIFILE: 01266 if (!SelectMidiFile(currentMidiFile-1)){ 01267 currentMidiFile--; 01268 } 01269 break; 01270 01271 01272 case UI_RECORDFILE: 01273 if (currentRecordFile){ 01274 currentRecordFile=0; 01275 CancelRecord(); 01276 }else{ 01277 currentRecordFile = 0; 01278 if (!SelectRecordFile(-1)){ 01279 currentRecordFile = -1; 01280 } 01281 } 01282 break; 01283 01284 case UI_MIDITRANSPOSE: 01285 transpose--; 01286 SetDisplaySignedValue(UI_MIDITRANSPOSE,transpose); 01287 Vs1103B_SetMidiTranspose(transpose); 01288 break; 01289 01290 case UI_MIDISOURCE: 01291 SetMidiFromFile(); 01292 break; 01293 01294 case UI_ECHOMODE: 01295 EchoDisable(); 01296 break; 01297 01298 default: 01299 //The request does not apply to current uiMode 01300 rotaryValue = storedRotaryValue; //restore value 01301 break; 01302 } 01303 } 01304 } 01305 01306 01307 01308 01309 01310 01311 // A D J U S T 01312 // A D J U S T 01313 01314 //Is there a plus/minus value from the rotary button? 01315 if (rotaryValue){ 01316 lyricsDisplay = 0; 01317 01318 //What parameter is affected by the rotary value? 01319 switch(uiMode){ 01320 01321 case UI_MIDIVOLUME: 01322 if (rotaryValue>0){ 01323 if (currentMidiVolume<30){ 01324 currentMidiVolume++; 01325 } 01326 } else { 01327 if (currentMidiVolume){ 01328 currentMidiVolume--; 01329 } 01330 } 01331 Mp3SetMixerVolume(currentMidiVolume, currentWaveVolume, 01332 currentMicVolume); 01333 SetDisplayPercent(UI_MIDIVOLUME, currentMidiVolume); 01334 rotaryValue = 0; 01335 break; 01336 01337 case UI_WAVEVOLUME: 01338 if (rotaryValue>0){ 01339 if (currentWaveVolume<30){ 01340 currentWaveVolume++; 01341 } 01342 } else { 01343 if (currentWaveVolume){ 01344 currentWaveVolume--; 01345 } 01346 } 01347 Mp3SetMixerVolume(currentMidiVolume, currentWaveVolume, 01348 currentMicVolume); 01349 SetDisplayPercent(UI_WAVEVOLUME, currentWaveVolume); 01350 rotaryValue = 0; 01351 break; 01352 01353 case UI_MIC_VOLUME: 01354 if (rotaryValue>0){ 01355 if (currentMicVolume<30){ 01356 currentMicVolume++; 01357 } 01358 } else { 01359 if (currentMicVolume){ 01360 currentMicVolume--; 01361 } 01362 } 01363 Mp3SetMixerVolume(currentMidiVolume, currentWaveVolume, 01364 currentMicVolume); 01365 SetDisplayPercent(UI_MIC_VOLUME, currentMicVolume); 01366 rotaryValue = 0; 01367 break; 01368 01369 case UI_MIC_GAIN: 01370 if (rotaryValue>0){ 01371 if (currentMicGainSetting<62){ 01372 currentMicGainSetting++; 01373 } 01374 } else { 01375 if (currentMicGainSetting){ 01376 currentMicGainSetting--; 01377 } 01378 } 01379 Vs1103SetMicGain(currentMicGainSetting); 01380 SetDisplayPercent(UI_MIC_GAIN, currentMicGainSetting); 01381 rotaryValue = 0; 01382 break; 01383 01384 case UI_VOLUME: 01385 if (volume>=rotaryValue){ 01386 volume-=rotaryValue; 01387 } 01388 rotaryValue = 0; 01389 Mp3SetVolume(volume,volume); 01390 if (volume<100){ 01391 SetDisplayPercent(UI_VOLUME,(100-volume)); 01392 }else{ 01393 SetDisplayPercent(UI_VOLUME,0); 01394 } 01395 rotaryValue = 0; 01396 break; 01397 01398 01399 default: 01400 break; 01401 } 01402 }//Switch 01403 01404 PlayerTaskHandler(); 01405 UpdateDisplay(uiMode); 01406 PlayerTaskHandler(); 01407 01408 01409 if (bassUpdateNeeded){ 01410 unsigned int newBassRegister; 01411 01412 //User has pushed button to alter bass/treble register 01413 //calculate new value 01414 01430 //Let's start from bass frequency setting. 01431 //min(0) should give 2 (20Hz), max(127) should give 15 (150Hz) 01432 newBassRegister = (bass + 23) / 10; //into bits 3..0, clear hibits 01433 01434 //Bass boost level. 01435 //min(0) should give 0, max(127) should give 15 01436 newBassRegister |= (bass>>3)<<4; //insert to bits 7..4 01437 01438 //Then the treble frequency 01439 //min(0) should give 15(15kHx), max(127) should give 2(2kHz) 01440 newBassRegister |= (((148-treble)>>3)+2)<<8; //insert into bits 11..8 01441 01442 //Finally the treble value (-8..7) 01443 //min(0) should give -8, max(127) should give 7; 01444 newBassRegister |= ((treble>>3)-8)<<12; //insert into bits 15..12 01445 01446 if (Mp3ReadRegister(SCI_BASS)!=newBassRegister){ 01447 Mp3WriteRegister(SCI_BASS,newBassRegister>>8,newBassRegister&0xff); 01448 } 01449 } 01450 01451 }
|
Here is the call graph for this function:
|
Read the 16-bit value of a VS10xx register.
Definition at line 17 of file vs10xx.c. References Mp3DeselectControl, Mp3SelectControl, SPIPutChar, SPIPutCharWithoutWaiting, SPIWait, and VS_READ_COMMAND. Referenced by AvailableProcessorTime(), main(), PlayerTaskHandler(), UpdateDisplay(), and Vs1103CancelWave(). 00017 { 00018 unsigned int resultvalue = 0; 00019 00020 Mp3SelectControl(); 00021 SPIPutCharWithoutWaiting(VS_READ_COMMAND); 00022 SPIPutChar((addressbyte)); 00023 SPIPutChar(0xff); 00024 SPIWait(); 00025 resultvalue = (SPI_RESULT_BYTE) << 8; 00026 SPIPutCharWithoutWaiting(0xff); 00027 SPIWait(); 00028 resultvalue |= (SPI_RESULT_BYTE); 00029 Mp3DeselectControl(); 00030 return resultvalue; 00031 }
|
|
Reset VS10xx.
Definition at line 136 of file vs10xx.c. References ConsoleWrite, Delay(), LoadPatch(), Mp3DeselectControl, Mp3DeselectData, Mp3PutInReset, Mp3ReleaseFromReset, Mp3SetMixerVolume(), Mp3SetVolume, Mp3SoftReset(), Mp3WriteRegister, SCI_CLOCKF, SPIPutCharWithoutWaiting, SPISetFastClock, SPISetSlowClock, volume, vs1103_do_reset, vs1103_earSpkHi, vs1103_earSpkLo, vs1103_mono_output, vs1103_real_time_midi, vs1103_record_mixer, vs1103_recording_active, vs1103_terminate, vs1103_use_line_input, and Vs1103SetMode(). Referenced by main(). 00136 { 00137 00138 vs1103_recording_active = 0; 00139 vs1103_record_mixer = 1; 00140 vs1103_use_line_input = 1; 00141 vs1103_do_reset = 0; 00142 vs1103_mono_output = 0; 00143 vs1103_terminate = 0; 00144 vs1103_earSpkHi = 0; 00145 vs1103_earSpkLo = 0; 00146 vs1103_real_time_midi = 0; 00147 00148 SPISetSlowClock(); 00149 00150 Mp3PutInReset(); 00151 Delay(1); 00152 00153 /* Send dummy SPI byte to initialize SPI */ 00154 SPIPutCharWithoutWaiting(0xFF); 00155 00156 /* Un-reset MP3 chip */ 00157 Mp3DeselectControl(); 00158 Mp3DeselectData(); 00159 Mp3ReleaseFromReset(); 00160 00161 Delay(1); 00162 while(!MP3_DREQ); 00163 /* Start up analog with no sound */ 00164 Mp3SetVolume(0xfe,0xfe); 00165 Mp3SetMixerVolume(0,0,0); 00166 LoadPatch(); 00167 Vs1103SetMode(); 00168 00169 /* Set clock register, doubler etc. */ 00170 Mp3WriteRegister(SCI_CLOCKF, 0xa6, 0x96); //oli 0xa66c 00171 00172 00173 Delay(500); 00174 00175 Mp3SetMixerVolume(1,1,1); 00176 //ConsoleWrite("Mixer111 "); 00177 //Delay(1000); 00178 //Mp3SetVolume(0xfe,0xfe); 00179 //ConsoleWrite("Mixer 1,1,1 SecondDelay"); 00180 //Delay(2000); 00181 Mp3SetVolume(volume,volume); 00182 00183 SPISetFastClock(); 00184 00185 Mp3SoftReset(); 00186 00187 //ConsoleWrite("Clock:");ConsolePutHex16(Mp3ReadRegister(SCI_CLOCKF)); 00188 ConsoleWrite ("\rInit: VS10XX\r"); 00189 00190 }
|
Here is the call graph for this function:
|
Definition at line 303 of file vs10xx.c. References Mp3WriteRegister, and SCI_MIXERVOL. Referenced by AvailableProcessorTime(), EchoEnable(), main(), Mp3Reset(), and Mp3SoftReset(). 00305 { 00306 unsigned int i; 00307 00308 i=0x8000; // Mixer Mode On 00309 i |= (gainInput << 10); 00310 i |= (gain2 << 5); 00311 i |= (gain1); 00312 00313 Mp3WriteRegister(SCI_MIXERVOL, (i >> 8), (i & 0xff)); 00314 00315 }
|
|
Soft Reset of VS10xx (Between songs).
Definition at line 97 of file vs10xx.c. References Delay(), Mp3DeselectData, Mp3SelectData, Mp3SetMixerVolume(), Mp3WriteRegister, SCI_ADPCMRECCTL, SPIPutChar, SPIPutCharWithoutWaiting, SPIWait, USE_512_BYTE_DREQ, vs1103_do_reset, and Vs1103SetMode(). Referenced by Mp3Reset(). 00097 { 00098 00099 /* Soft Reset of VS10xx */ 00100 vs1103_do_reset = 1; 00101 Vs1103SetMode(); 00102 vs1103_do_reset = 0; 00103 00104 Delay(1); /* One millisecond delay */ 00105 while (!MP3_DREQ) /* wait for startup */ 00106 ; 00107 00108 Mp3SetMixerVolume(25,25,25); 00109 00110 Delay(1); 00111 //Mp3WriteRegister(SCI_CLOCKF, 0xa6, 0x96); 00112 00113 00114 // Set default microphone gain 00115 Delay(1); 00116 Mp3WriteRegister(SCI_ADPCMRECCTL, USE_512_BYTE_DREQ, 0x00 | 20); 00117 00118 00119 Delay(1); /* One millisecond delay */ 00120 00121 /* Send null bytes to data interface */ 00122 Mp3SelectData(); 00123 SPIPutCharWithoutWaiting(0); 00124 SPIPutChar(0); 00125 SPIPutChar(0); 00126 SPIPutChar(0); 00127 SPIWait(); 00128 Mp3DeselectData(); 00129 00130 }
|
Here is the call graph for this function:
|
Play disk sectors from disk. Starting from current value in global variable sectorAddress, sends a number of disk sectors to vs10xx and returns. Definition at line 276 of file vs10xx.c. References AvailableProcessorTime(), Address::l, playingState, sectorAddress, and TransferSectorSDI(). 00276 { 00277 00278 while (nSectorsToPlay){ 00279 00280 if (MP3_DREQ){ 00281 TransferSectorSDI(sectorAddress.l); 00282 sectorAddress.l++; 00283 nSectorsToPlay--; 00284 } 00285 00286 AvailableProcessorTime(); //Call the User Interface handler 00287 00288 /* If playing state is something else than "play normally", 00289 exit returning the request number. */ 00290 if ((playingState==PS_END_OF_SONG)|| 00291 (playingState==PS_NEXT_SONG)|| 00292 (playingState==PS_RECORDING)|| 00293 (playingState==PS_PREVIOUS_SONG)){ 00294 return playingState; 00295 } 00296 00297 } 00298 return 0; //OK Exit 00299 }
|
Here is the call graph for this function:
|
Send 2048 zeros.
Definition at line 260 of file vs10xx.c. References Temp::i, Mp3DeselectData, Mp3SelectData, SPIPutChar, SPIPutCharWithoutWaiting, SPIWait, and temp. 00260 { 00261 Mp3SelectData(); 00262 SPIPutCharWithoutWaiting(0); 00263 for (temp.i=0; temp.i<2048; temp.i++){ /* TESTING 1048 TESTING */ 00264 while (!MP3_DREQ) 00265 ; 00266 SPIPutChar(0); 00267 } 00268 SPIWait(); 00269 Mp3DeselectData(); 00270 }
|
|
VS1103B specific function: select MIDI channels.
Definition at line 323 of file vs10xx.c. References Mp3WriteRegister, SCI_WRAM, and SCI_WRAMADDR. Referenced by AvailableProcessorTime(), and SelectMidiFile(). 00323 { 00324 Mp3WriteRegister(SCI_WRAMADDR, 0x17, 0x15); 00325 while (!MP3_DREQ); 00326 Mp3WriteRegister(SCI_WRAM,(newMask >> 8),(newMask)); 00327 }
|
|
VS1103B specific function: set MasterTranspose.
Definition at line 317 of file vs10xx.c. References Mp3WriteRegister, SCI_WRAM, SCI_WRAMADDR, and transpose. Referenced by AvailableProcessorTime(). 00317 { 00318 Mp3WriteRegister(SCI_WRAMADDR, 0x11, 0x32); 00319 while (!MP3_DREQ); 00320 Mp3WriteRegister(SCI_WRAM,(transpose >> 8),(transpose)); 00321 }
|
|
Terminate MIDI stream playing.
Definition at line 343 of file vs10xx.c. References vs1103_terminate, and Vs1103SetMode(). Referenced by CancelMidi(). 00343 { 00344 vs1103_terminate = 1; 00345 Vs1103SetMode(); 00346 vs1103_terminate = 0; 00347 // The below lines are recommended but take a little 00348 // too much time for our non-multitasking 8051 00349 // architecture: 00350 //while (Mp3ReadRegister(SCI_MODE) & SM_OUTOFMIDI) 00351 // ; 00352 00353 }
|
Here is the call graph for this function:
|
Terminate wave stream playing.
Definition at line 335 of file vs10xx.c. References currentMicGain, Mp3ReadRegister(), Mp3WriteRegister, SCI_ADPCMRECCTL, and USE_512_BYTE_DREQ. Referenced by CancelWave(), and SelectWaveFile(). 00335 { 00336 Mp3WriteRegister(SCI_ADPCMRECCTL, USE_512_BYTE_DREQ, 0x80 | currentMicGain); 00337 00338 while (Mp3ReadRegister(SCI_ADPCMRECCTL) & 0x0080) 00339 ; 00340 }
|
Here is the call graph for this function:
|
Set MIC analog amplifier value.
Definition at line 329 of file vs10xx.c. References currentMicGain, Mp3WriteRegister, SCI_ADPCMRECCTL, and USE_512_BYTE_DREQ. Referenced by AvailableProcessorTime(), and main(). 00329 { 00330 if (gain>31) gain=31; 00331 currentMicGain = gain; 00332 Mp3WriteRegister(SCI_ADPCMRECCTL, USE_512_BYTE_DREQ, 0x40 | gain); 00333 }
|
|
Definition at line 48 of file vs10xx.c. References ConsolePutChar, ConsolePutHex8, ConsoleWrite, Mp3WriteRegister, SCI_MODE, SCI_WRAM, SCI_WRAMADDR, and StartPatch(). Referenced by CancelRecord(), EchoEnable(), main(), Mp3Reset(), Mp3SoftReset(), SelectRecordFile(), SetMidiFromFile(), SetMidiFromUART(), and Vs1103CancelMidi(). 00048 { 00049 unsigned char hiMode, loMode; 00050 00051 hiMode = SM_SDINEW; 00052 loMode = SM_SDI_ADPCM; 00053 00054 if (vs1103_use_line_input) hiMode |= SM_LINE_IN; 00055 if (vs1103_recording_active) hiMode |= SM_RECORD_ADPCM; 00056 if (vs1103_earSpkLo) hiMode |= SM_EARSPK_1; 00057 if (vs1103_earSpkHi) hiMode |= SM_EARSPK_2; 00058 00059 if (vs1103_do_reset) loMode |= SM_RESET; 00060 if (vs1103_mono_output) loMode |= SM_DIFF; 00061 if (vs1103_record_mixer) loMode |= SM_RECORD_MIXER; 00062 if (vs1103_terminate) loMode |= SM_OUTOFMIDI; 00063 if (vs1103_real_time_midi) loMode |= SM_RT_MIDI; 00064 00065 if (vs1103_real_time_midi){ 00066 //Enable VS1103 UART interrupt 00067 Mp3WriteRegister(SCI_WRAMADDR, 0xc0, 0x1a); 00068 Mp3WriteRegister(SCI_WRAM, 0x00, 0x3f); 00069 } 00070 00071 Mp3WriteRegister (SCI_MODE, hiMode, loMode); 00072 ConsoleWrite("SetMode: "); 00073 ConsolePutHex8(hiMode); 00074 ConsolePutHex8(loMode); 00075 ConsolePutChar(13); 00076 00077 00078 while (!MP3_DREQ) 00079 ;//wait for operation to complete 00080 00081 00082 if (!vs1103_real_time_midi){ 00083 //When real-time midi input is not active, 00084 //Uart RX goes to monitor interrupt. To prevent 00085 //from falling to the monitor, disable RX interrupt 00086 //now 00087 Mp3WriteRegister(SCI_WRAMADDR, 0xc0, 0x1a); 00088 Mp3WriteRegister(SCI_WRAM, 0x00, 0x0f); 00089 } 00090 00091 StartPatch(); 00092 00093 }
|
Here is the call graph for this function:
|
Execute VS1011/VS1002 Sine Test Function.
Definition at line 194 of file vs10xx.c. References Delay(), Mp3DeselectControl, Mp3DeselectData, Mp3PutInReset, Mp3ReleaseFromReset, Mp3SelectControl, Mp3SelectData, SPIPutChar, SPIPutCharWithoutWaiting, and SPIWait. 00194 { 00195 00196 /* Reset MP3 chip */ 00197 Mp3PutInReset(); /* Pull xRESET low -> hardware reset */ 00198 Delay(100); /* 100 ms delay */ 00199 00200 /* Send dummy SPI byte to initialize SPI of Atmel microcontroller */ 00201 SPIPutCharWithoutWaiting(0xFF); 00202 00203 /* Un-reset MP3 chip */ 00204 Mp3DeselectControl(); /* Pull xCS high */ 00205 Mp3DeselectData(); /* Pull xDCS high */ 00206 Mp3ReleaseFromReset(); /* Pull xRESET high */ 00207 Delay(100); /* 100 ms delay */ 00208 00209 //GREEN_LED = LED_ON; 00210 //RED_LED = LED_ON; 00211 00212 /* VS10xx Application Notes, chapter 4.8 ---------------------------------*/ 00213 /* As an example, let's write value 0x0820 to register 00 byte by byte */ 00214 Mp3SelectControl(); /* Now SPI writes go to SCI port */ 00215 SPIPutChar(0x02); /* Send SPI Byte, then wait for byte to be sent. */ 00216 SPIPutChar(0x00); /* 0x02 was WRITE command, 0x00 is register number */ 00217 SPIPutChar(0x08); /* This byte goes to MSB */ 00218 SPIPutChar(0x20); /* ..and this is LSB. (0x20=Allow Test Mode) */ 00219 SPIWait(); /* Wait until Atmel MCU signals SPI write complete */ 00220 Mp3DeselectControl(); /* Now SPI writes don't go to SCI port */ 00221 00222 while (!MP3_DREQ) /* Wait for DREQ = 1 */ 00223 ; /* Do nothing while waiting for DREQ = 1 */ 00224 00225 /* Send a Sine Test Header to Data port */ 00226 Mp3SelectData(); /* Now SPI writes go to SDI port */ 00227 00228 SPIPutChar(0x53); /* - This is a special VLSI Solution test header - */ 00229 SPIPutChar(0xef); /* - that starts a sine sound. It's good for - */ 00230 SPIPutChar(0x6e); /* - testing your code, the chip and also for - */ 00231 SPIPutChar(0x44); /* - seeing if your MP3 decoder was manufactured - */ 00232 SPIPutChar(0x00); /* - by VLSI Solution oy. ------------------------ */ 00233 SPIPutChar(0x00); 00234 SPIPutChar(0x00); 00235 SPIPutChar(0x00); 00236 SPIWait(); 00237 Mp3DeselectData(); 00238 00239 //RED_LED = LED_OFF; 00240 Delay (500); /* 500 ms delay */ 00241 //GREEN_LED = LED_OFF; 00242 00243 /* Stop the sine test sound */ 00244 Mp3SelectData(); 00245 SPIPutChar(0x45); 00246 SPIPutChar(0x78); 00247 SPIPutChar(0x69); 00248 SPIPutChar(0x74); 00249 SPIPutChar(0x00); 00250 SPIPutChar(0x00); 00251 SPIPutChar(0x00); 00252 SPIPutChar(0x00); 00253 SPIWait(); 00254 Mp3DeselectData(); 00255 00256 Delay(500); /* 500 ms delay */ 00257 }
|
Here is the call graph for this function:
|
Playing State Global, 0=normal playing, 1=abort playing.
Definition at line 53 of file player.c. Referenced by PlayDiskSectors(). |
|
VS1103 MODE bit.
Definition at line 36 of file vs10xx.c. Referenced by Mp3Reset(), and Mp3SoftReset(). |
|
VS1103 MODE bit.
Definition at line 39 of file vs10xx.c. Referenced by Mp3Reset(). |
|
VS1103 MODE bit.
Definition at line 40 of file vs10xx.c. Referenced by Mp3Reset(). |
|
VS1103 MODE bit.
Definition at line 37 of file vs10xx.c. Referenced by Mp3Reset(). |
|
VS1103 MODE bit.
Definition at line 41 of file vs10xx.c. Referenced by main(), Mp3Reset(), SetMidiFromFile(), and SetMidiFromUART(). |
|
VS1103 MODE bit.
Definition at line 34 of file vs10xx.c. Referenced by EchoDisable(), EchoEnable(), main(), Mp3Reset(), and SelectRecordFile(). |
|
VS1103 MODE bit.
Definition at line 33 of file vs10xx.c. Referenced by CancelRecord(), EchoEnable(), main(), Mp3Reset(), and SelectRecordFile(). |
|
VS1103 MODE bit.
Definition at line 38 of file vs10xx.c. Referenced by Mp3Reset(), and Vs1103CancelMidi(). |
|
VS1103 MODE bit.
Definition at line 35 of file vs10xx.c. Referenced by Mp3Reset(). |