VLSI Solution Oy VLSI Solution Oy Evaluation MP3 Player Source Code Documentation

Main Page | Class List | File List | Class Members | File Members | Related Pages

player.c File Reference

VLSI Modular Player Main file. More...

#include "board.h"
#include "lcd.h"
#include "filesys.h"
#include "vs10xx.h"
#include "storage.h"
#include "display.h"
#include "string.h"
#include "ui.h"
#include "mmc.h"
#include "record.h"

Include dependency graph for player.c:

Include dependency graph

Go to the source code of this file.

Defines

#define u_int8   code unsigned char
 typedef for loading patch code

#define u_int16   code unsigned int
 typedef for loading patch code

#define UI_RETURN_DELAY   150
 How much to wait for button pressed before returning to title.


Functions

void timer0_interrupt (void)
 User Interface Timer interrupt.

void LoadPatch ()
 Load a patch code to VS10xx.

void StartPatch ()
 Start patch code.

void ScreenSetPlayTime ()
 Sets playing time and mode icon to left display title.

void AvailableProcessorTime ()
 This is called when there is free processor time, implement externally.

void PlayCurrentFile ()
 Plays a disk file.

void main ()
 Program Entry Point.


Variables

xdata playingstatetype playingState = PS_NORMAL
 Playing State Global, 0=normal playing, 1=abort playing.

unsigned char intlevel = 0
 Current interrupt level.

xdata unsigned char userInterfaceDelayElapsed = 0
 Interrupt-driven flag to reduce unnecessary UI updates.

xdata uimodetype uiMode = UI_SPEC
 Current User Interface mode (Title, Volume, ...).

xdata unsigned char SPMax = 0


Detailed Description

VLSI Modular Player Main file.

This file contains the main() function. It's also the main playground for player UI development. Many functions will be transferred to a new module when they're ok.

Definition in file player.c.


Define Documentation

#define u_int16   code unsigned int
 

typedef for loading patch code

Definition at line 211 of file player.c.

#define u_int8   code unsigned char
 

typedef for loading patch code

Definition at line 209 of file player.c.

#define UI_RETURN_DELAY   150
 

How much to wait for button pressed before returning to title.

Definition at line 217 of file player.c.

Referenced by AvailableProcessorTime().


Function Documentation

void AvailableProcessorTime  ) 
 

This is called when there is free processor time, implement externally.

The basic task of this function is to implement the player user interface.

Local variables:

  • volume: Current volume setting

  • bass: Current bass enhancer setting

  • treble: Current treble enhancer setting

  • reclevel: Current recording level setting

  • uiReturnDelay: Counts down to returning to UI mode 0 (title screen)

Bass/Treble setting calculation

There are 2 or 4 adjustments possible:

  • Bass Frequency (1011B/E, 1002, 10x3) : 2..15 -> 20..1500 Hz
  • Bass boost (1011B/E, 1002, 10x3) : 0..15 -> 0ff..+15dB)
  • Treble Frequency (1011E, 10x3) : 0..15 -> 0..15kHz
  • Treble level (1011E, 10x3) : -8..+7 -> -12..+10.5dB

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 328 of file player.c.

References displayStyle, displayTitle, displayValue, DS_NO_YES, DS_PERCENTAGE, DS_RAWTEXT, DS_TEXT, KEY_BUTTON, KEY_FARLEFT, KEY_FARRIGHT, lcdFont_barchars, lcdFont_vertical_barchars, LcdReset(), LcdSelectFont(), Mp3ReadRegister(), Mp3SetVolume, Mp3WriteRegister, playingState, PS_CUE, PS_END_OF_SONG, PS_NEXT_SONG, PS_NORMAL, PS_PREVIOUS_SONG, PS_RECORDING, PS_REWIND, ScreenSetPlayTime(), SPI_AICTRL1, SPI_BASS, SPIPutChar, SPIWait, UI_BASS, UI_CUE, UI_END_OF_MODES, UI_INFO, UI_RECLEVEL, UI_RETURN_DELAY, UI_SPEC, UI_STOP, UI_TITLE, UI_TREBLE, UI_VOLUME, uiMode, UpdateDisplay(), and userInterfaceDelayElapsed.

Referenced by GetAVIBlock(), and Record().

00328 { 00329 00333 static xdata unsigned char volume = 20; 00334 00336 static xdata unsigned char bass = 0; 00337 00339 static xdata unsigned char treble = 64; //middle setting = 0 00340 00342 static xdata unsigned char reclevel = 50; 00343 00344 unsigned int i; //temp variable 00345 00346 static bit bassUpdateNeeded; 00347 00351 static unsigned char uiReturnDelay=0; 00352 00353 if (!userInterfaceDelayElapsed){ 00354 return; /* Not yet time to do user interface stuff */ 00355 } 00356 00357 userInterfaceDelayElapsed = 0; 00358 00359 00360 // User Interface Modes 00361 // Return to UI_TITLE after long period of button inactivity 00362 00363 if (uiReturnDelay == 0){ 00364 if ((uiMode != UI_SPEC)&&(uiMode != UI_CUE)) 00365 uiMode = UI_TITLE; 00366 else{ 00367 } 00368 }else{ 00369 uiReturnDelay--; 00370 } 00371 00372 00373 00374 if (uiMode==UI_SPEC) //No spectrum analyzer 00375 uiMode++; 00376 00377 00378 00379 00380 if (uiMode==UI_INFO) 00381 uiMode++; //Nothing interesting currently in screen UI_INFO. 00382 if (uiMode==UI_STOP) 00383 uiMode++; //Nothing interesting currently in screen UI_STOP. 00384 00385 /* Screen updates */ 00386 switch(uiMode){ 00387 00388 case UI_TITLE: //Playing time, song title 00389 00390 displayStyle = DS_TEXT; 00391 ScreenSetPlayTime(); 00392 00393 if (playingState==PS_RECORDING){ 00394 displayStyle = DS_PERCENTAGE; 00395 } 00396 00397 break; 00398 00399 case UI_STOP: //Ask if the user wants to stop 00400 displayStyle = DS_NO_YES; 00401 strcpy (displayTitle, "Stop? "); 00402 break; 00403 00404 case UI_CUE: //Ask if the user wants to fast forward or rewind 00405 displayStyle = DS_RAWTEXT; 00406 strcpy (displayTitle, "REW/CUE <- ->"); 00407 00408 //i = Mp3ReadRegister(SPI_HDAT1); 00409 //displayTitle[5] = lcd_hexchars[i>>12]; 00410 //displayTitle[6] = lcd_hexchars[(i>>8)&0x0f]; 00411 //displayTitle[7] = lcd_hexchars[(i>>4)&0x0f]; 00412 //displayTitle[8] = lcd_hexchars[i&0x0f]; 00413 00414 break; 00415 00416 case UI_VOLUME: //Show volume bar 00417 LcdSelectFont(lcdFont_barchars); 00418 displayStyle = DS_PERCENTAGE; 00419 strcpy(displayTitle,"Volume: "); 00420 displayValue = (100-(volume>>1)); 00421 if (displayValue<0) displayValue = 0; 00422 break; 00423 00424 case UI_BASS: //Show bass bar 00425 LcdSelectFont(lcdFont_barchars); 00426 displayStyle = DS_PERCENTAGE; 00427 strcpy(displayTitle,"Bass: "); 00428 displayValue = (bass/5)*4; 00429 if (displayValue<1) displayValue = 1; 00430 break; 00431 00432 case UI_TREBLE: //Show treble bar 00433 LcdSelectFont(lcdFont_barchars); 00434 displayStyle = DS_PERCENTAGE; 00435 strcpy(displayTitle,"Treble: "); 00436 displayValue = (treble/5)*4; 00437 if (displayValue<1) displayValue = 1; 00438 break; 00439 00440 case UI_RECLEVEL: //Show recording level 00441 00442 if (playingState==PS_RECORDING){ 00443 LcdSelectFont(lcdFont_barchars); 00444 displayStyle = DS_PERCENTAGE; 00445 strcpy(displayTitle,"RecLevel"); 00446 displayValue = (reclevel); 00447 if (reclevel==0){ 00448 strcpy(displayTitle,"RecLevel <Auto> "); 00449 displayStyle = DS_RAWTEXT; //Reveal the "auto" text 00450 } 00451 }else{ 00452 //Not in recording 00453 displayStyle = DS_NO_YES; 00454 strcpy (displayTitle, "Record? "); 00455 } 00456 break; 00457 00458 00459 case UI_SPEC: // Spectrum analyzer 00460 00461 if (playingState == PS_RECORDING){ 00462 uiMode++; //Don't show specana when recording 00463 } 00464 00465 LcdSelectFont(lcdFont_vertical_barchars); 00466 displayStyle = DS_RAWTEXT; 00467 ScreenSetPlayTime(); 00468 00469 // Request to read Spectrum Analyzer register 00470 Mp3WriteRegister(7, 0x18, 0x04); 00471 00472 // Read Spectrum Analyzer registers 00473 { 00474 for (i=0;i<8;i++) { //for each band i in [0..7] 00475 signed char thisband = Mp3ReadRegister(6); 00476 00477 /* thisband now has spectrum value 0..63. We adjust it a little 00478 for best image on the evakit LCD. You also get peak values 00479 etc from the chip but we don't use them in the evakit screen. 00480 we use 8 bands, but up to 23 are obtainable from the chip. */ 00481 00482 thisband &= 63; /* mask all but level info */ 00483 thisband >>= 1; /* LCD resolution is not high */ 00484 thisband -= 3; /* base offset */ 00485 if (i==0) thisband -= 2; /* decrease bass bar level */ 00486 if (i==6) thisband += 1; /* increase treble bar level */ 00487 if (i==7) thisband += 1; /* increase treble bar level */ 00488 if (thisband>7) thisband = 7; /* high limit */ 00489 if (thisband<0) thisband =' '; /* low limit */ 00490 00491 displayTitle[i+8] = thisband; //Store to display mem 00492 00493 }//for each band 00494 } 00495 break; 00496 00497 } //switch(uiMode) 00498 00499 // Buttons handler 00500 // Perform mode-dependent button handling 00501 00502 if ((KEY_BUTTON) && (uiReturnDelay < UI_RETURN_DELAY-20)){ 00503 LcdReset(); 00504 uiMode++; 00505 uiReturnDelay = UI_RETURN_DELAY; 00506 } 00507 00508 switch(uiMode){ 00509 00510 case UI_TITLE: 00511 case UI_SPEC: 00512 00513 if (KEY_FARRIGHT){ 00514 playingState = PS_NEXT_SONG; /* Request */ 00515 } 00516 if (KEY_FARLEFT){ 00517 playingState = PS_PREVIOUS_SONG; /* Request */ 00518 } 00519 break; 00520 00521 00522 case UI_VOLUME: 00523 00524 if (KEY_FARLEFT){ 00525 uiReturnDelay = UI_RETURN_DELAY; 00526 if (volume++ == 254) volume = 254; //Change + limit to 254 (minimum vol) 00527 Mp3SetVolume(volume,volume); 00528 } 00529 00530 if (KEY_FARRIGHT){ 00531 uiReturnDelay = UI_RETURN_DELAY; 00532 if (volume-- == 0) volume = 0; //Change + limit to 0 (maximum volume) 00533 Mp3SetVolume(volume,volume); 00534 } 00535 break; // UI_VOLUME 00536 00537 case UI_BASS: 00538 case UI_TREBLE: //BASS and TREBLE use the same VS10xx register 00539 bassUpdateNeeded = 0; 00540 00541 //First let's see if a key is pressed; does the user want to set level? 00542 00543 if (uiMode==UI_BASS){ //BASS screen is active 00544 00545 if (KEY_FARLEFT){ 00546 bassUpdateNeeded = 1; 00547 if (bass-- == 0) bass = 0; //Change + limit to 0 (OFF setting) 00548 } 00549 if (KEY_FARRIGHT){ 00550 bassUpdateNeeded = 1; 00551 if (bass++ == 127) bass = 127; //Change + limit to 127 (max setting) 00552 } 00553 00554 }else{ //TREBLE screen is active 00555 00556 if (KEY_FARLEFT){ 00557 bassUpdateNeeded = 1; //SCI_BASS is for both bass and treble 00558 if (treble-- == 0) treble = 0; //Change + limit to 0 (OFF setting) 00559 } 00560 if (KEY_FARRIGHT){ 00561 bassUpdateNeeded = 1; //SCI_BASS is for both bass and treble 00562 if (treble++ == 127) treble = 127; //Change + limit to 127 (max) 00563 } 00564 00565 } 00566 00567 00568 if (bassUpdateNeeded){ 00569 unsigned int newBassRegister; 00570 00571 //User has pushed button to alter bass/treble register 00572 //calculate new value 00573 00589 //Let's start from bass frequency setting. 00590 //min(0) should give 2 (20Hz), max(127) should give 15 (150Hz) 00591 newBassRegister = (bass + 23) / 10; //into bits 3..0, clear hibits 00592 00593 //Bass boost level. 00594 //min(0) should give 0, max(127) should give 15 00595 newBassRegister |= (bass>>3)<<4; //insert to bits 7..4 00596 00597 //Then the treble frequency 00598 //min(0) should give 15(15kHx), max(127) should give 2(2kHz) 00599 newBassRegister |= (((148-treble)>>3)+2)<<8; //insert into bits 11..8 00600 00601 //Finally the treble value (-8..7) 00602 //min(0) should give -8, max(127) should give 7; 00603 newBassRegister |= ((treble>>3)-8)<<12; //insert into bits 15..12 00604 00605 00606 uiReturnDelay = UI_RETURN_DELAY; 00607 00608 if (Mp3ReadRegister(SPI_BASS)!=newBassRegister){ 00609 Mp3WriteRegister(SPI_BASS,newBassRegister>>8,newBassRegister&0xff); 00610 } 00611 00612 //i = newBassRegister; 00613 //displayTitle[4] = lcd_hexchars[i>>12]; 00614 //displayTitle[5] = lcd_hexchars[(i>>8)&0x0f]; 00615 //displayTitle[6] = lcd_hexchars[(i>>4)&0x0f]; 00616 //displayTitle[7] = lcd_hexchars[i&0x0f]; 00617 00618 00619 } 00620 00621 break; // UI_BASS and UI_TREBLE 00622 00623 00624 case UI_RECLEVEL: 00625 00626 if (playingState==PS_RECORDING){ 00627 if (KEY_FARRIGHT){ 00628 uiReturnDelay = UI_RETURN_DELAY; 00629 if (reclevel++ == 100){ 00630 reclevel = 100; 00631 } 00632 Mp3WriteRegister(SPI_AICTRL1, 00633 ((int)reclevel*32)>>8,((int)reclevel*32)&0xff); 00634 SPIPutChar(0);SPIWait(); 00635 } 00636 00637 if (KEY_FARLEFT){ 00638 uiReturnDelay = UI_RETURN_DELAY; 00639 if (reclevel-- == 0){ 00640 reclevel = 0; 00641 } 00642 Mp3WriteRegister(SPI_AICTRL1, 00643 ((int)reclevel*32)>>8,((int)reclevel*32)&0xff); 00644 SPIPutChar(0);SPIWait(); 00645 } 00646 }else{ 00647 //Not in recording 00648 if (KEY_FARRIGHT){ 00649 //Enter recording mode 00650 playingState=PS_RECORDING; //request to record 00651 } 00652 } 00653 break; // UI_RECLEVEL 00654 00655 case UI_STOP: 00656 00657 if (KEY_FARRIGHT){ 00658 playingState = PS_END_OF_SONG; /* Request to abort playing */ 00659 } 00660 break; // UI_STOP 00661 00662 case UI_CUE: 00663 00664 if (playingState == PS_NORMAL){ /* Only control when PS_NORMAL */ 00665 if (KEY_FARRIGHT){ 00666 uiReturnDelay = UI_RETURN_DELAY; /* Don't go back to title just yet */ 00667 playingState = PS_CUE; /* Request */ 00668 } 00669 if (KEY_FARLEFT){ 00670 uiReturnDelay = UI_RETURN_DELAY; 00671 playingState = PS_REWIND; /* Request */ 00672 } 00673 } 00674 00675 break; // UI_SKIP 00676 00677 case UI_END_OF_MODES: 00678 uiMode = UI_TITLE; 00679 break; // UI_END_OF_MODES 00680 00681 00682 } //End Switch 00683 00684 00685 // Draw screen 00686 UpdateDisplay(); 00687 }

Here is the call graph for this function:

void LoadPatch  ) 
 

Load a patch code to VS10xx.

Definition at line 259 of file player.c.

References atab, CODELEN, Delay(), dtab, Temp::i, Mp3WriteRegister, and temp.

Referenced by main().

00259 { 00260 #if 0 00261 ConsoleWrite ("Loading patch.\r"); 00262 for (temp.i=0; temp.i < CODELEN; temp.i++) { 00263 Mp3WriteRegister(atab[temp.i], dtab[temp.i]>>8, dtab[temp.i]&0xff); 00264 } 00265 Delay(10); 00266 #endif 00267 }

Here is the call graph for this function:

void main  ) 
 

Program Entry Point.

In the final program, main() should be very small. Currently it's the playground for developing the player functionality. Most of it will be cleared away to new functions soon.

Definition at line 735 of file player.c.

References Temp::c, currentFileName, DS_STATIC, InitBoard(), InitDisplay(), InitFileSystem(), KEY_BUTTON, KEY_FARLEFT, KEY_FARRIGHT, KEY_LEFT, KEY_RIGHT, LcdLocateLine2, LcdPrintGenericResult(), LcdPutChar(), LcdPutConstantString(), LcdPutUInt(), LcdReset(), LoadPatch(), Mp3Reset(), Mp3SoftReset(), OpenFile(), PlayCurrentFile(), playingState, PS_END_OF_SONG, PS_NEXT_SONG, PS_NORMAL, PS_PREVIOUS_SONG, PS_RECORDING, Record(), SPMax, StartPatch(), temp, UI_SPEC, UI_TITLE, and uiMode.

00735 { 00736 00737 unsigned int currentFile; 00738 00739 InitBoard(); 00740 00741 // Start "User Interface" timer 00742 ET0 = 1; 00743 EA = 1; 00744 TR0 = 1; 00745 00746 //LcdSplashScreen(); 00747 InitDisplay (DS_STATIC," "," ",0); 00748 00749 ConsoleWrite ("\rVLSIPlayer\rStarting up.\r\r"); 00750 00751 LcdReset(); 00752 LcdPutConstantString ("Filesys "); 00753 LcdLocateLine2(); 00754 LcdPrintGenericResult (InitFileSystem()); 00755 00756 Mp3Reset(); 00757 //VsSineTest(); 00758 00759 00760 // If left button is pressed during boot, enter recording. 00761 if (KEY_FARLEFT){ 00762 while(KEY_LEFT) 00763 ; 00764 Record(); 00765 } 00766 00767 00768 #ifdef VS1003 00769 uiMode = UI_SPEC; //For VS1003 default to SPECTRUM ANALYZER screen 00770 #else 00771 uiMode = UI_TITLE; //For others, default to TITLE screen 00772 #endif 00773 00774 playingState = PS_NEXT_SONG; 00775 currentFile = 1; 00776 00777 while (1){ 00778 ConsoleWrite("SPMax: ");ConsolePutHex8(SPMax); 00779 ConsoleWrite("PlayingState: ");ConsolePutHex8(playingState); 00780 00781 // has someone requested to record? 00782 if (playingState == PS_RECORDING){ 00783 uiMode = UI_TITLE; 00784 playingState = Record(); //record returns PS_NEXT_SONG or PS_RECORDING 00785 while (KEY_BUTTON) 00786 ; //Wait until button is depressed 00787 ConsoleWrite("\rFinished recording.\r"); 00788 currentFile = 1; 00789 playingState == PS_NEXT_SONG; 00790 } 00791 00792 if (OpenFile(currentFile)){ 00793 currentFile = 1; 00794 if (OpenFile(currentFile)){ 00795 LcdReset(); 00796 LcdPutConstantString("No files."); 00797 while(1); 00798 } 00799 } 00800 00801 LcdReset(); 00802 LcdPutConstantString("File "); 00803 LcdPutUInt(currentFile); 00804 LcdLocateLine2(); 00805 for (temp.c=0; temp.c<8; temp.c++){ 00806 LcdPutChar(currentFileName[temp.c]); 00807 } 00808 00809 00810 while ((KEY_BUTTON)||(KEY_FARLEFT)||(KEY_FARRIGHT)|| 00811 (KEY_LEFT)||(KEY_RIGHT)) 00812 ; /* Wait until no key is pressed */ 00813 00814 while (((!KEY_BUTTON)&&(!KEY_FARLEFT)&&(!KEY_FARRIGHT)) 00815 &&(playingState == PS_NORMAL)) 00816 ; /* Wait untis some key is pressed or playing state not normal*/ 00817 00818 00819 /* See if keystroke requests previous/next song */ 00820 if (KEY_FARLEFT) currentFile--; 00821 if (KEY_FARRIGHT) currentFile++; 00822 if (currentFile==0) currentFile = 1; 00823 00824 if (KEY_BUTTON || 00825 (playingState==PS_NEXT_SONG) || 00826 (playingState==PS_PREVIOUS_SONG)){ 00827 while (KEY_BUTTON) 00828 ; 00829 00830 PlayCurrentFile(); 00831 ConsoleWrite ("Playing state after playing is: "); 00832 ConsolePutUInt (playingState); 00833 00834 if (playingState == PS_PREVIOUS_SONG) currentFile--; 00835 if (playingState == PS_NEXT_SONG) currentFile++; 00836 if (currentFile==0) currentFile = 1; 00837 if (playingState == PS_END_OF_SONG) playingState = PS_NORMAL; 00838 00839 00840 Mp3SoftReset(); 00841 LoadPatch(); 00842 StartPatch(); 00843 00844 00845 while ((KEY_BUTTON)||(KEY_FARLEFT)||(KEY_FARRIGHT)|| 00846 (KEY_LEFT)||(KEY_RIGHT)) 00847 ; /* Wait until no key is pressed */ 00848 } 00849 00850 00851 } 00852 00853 00854 }

Here is the call graph for this function:

void PlayCurrentFile  ) 
 

Plays a disk file.

Returns 1) if the file ends or 2) if the global variable playingState is not PS_NORMAL i.e. user has requested stop or next or previous.

Definition at line 694 of file player.c.

References BuildFragmentTable(), fragment, Address::l, LcdLocateHome, LcdPutConstantString(), Mp3WriteRegister, PlayDiskSectors(), playingState, PS_NEXT_SONG, PS_NORMAL, sectorAddress, SendZerosToVS10xx(), SM_OUTOFWAV, SPI_MODE, and fragmentEntry::start.

Referenced by main().

00694 { 00695 xdata char c, nFragments; 00696 00697 playingState = PS_NORMAL; /* Request to play normally */ 00698 //uiMode = UI_SPEC; /* User interface: show title SPECANA FOR VS1003*/ 00699 00700 LcdLocateHome(); 00701 LcdPutConstantString("Opening "); 00702 00703 ConsoleWrite ("Building file fragment table..."); 00704 nFragments = BuildFragmentTable(); /* Too slow, rewrite! */ 00705 ConsoleWrite("\rFragments: "); 00706 ConsolePutUInt(nFragments); 00707 00708 LcdLocateHome(); 00709 LcdPutConstantString("Playing "); 00710 00711 for (c=0; c<nFragments; c++){ 00712 sectorAddress.l = fragment[c].start; 00713 ConsoleWrite ("\rPlayer: Playing from sector "); 00714 ConsolePutUInt (sectorAddress.l); 00715 if (PlayDiskSectors(fragment[c].length)!=0){ 00716 Mp3WriteRegister(SPI_MODE,0,SM_OUTOFWAV); 00717 SendZerosToVS10xx(); 00718 return; //return without touching the value of playingState 00719 } 00720 } 00721 SendZerosToVS10xx(); 00722 00723 // After finishing normally default to requesting to play next song 00724 playingState = PS_NEXT_SONG; 00725 00726 }

Here is the call graph for this function:

void ScreenSetPlayTime  ) 
 

Sets playing time and mode icon to left display title.

Definition at line 286 of file player.c.

References displayTitle, Mp3ReadRegister(), playingState, PS_NORMAL, PS_RECORDING, and SPI_DECODE_TIME.

Referenced by AvailableProcessorTime().

00286 { 00287 unsigned int playTime; 00288 unsigned char minutes, seconds; 00289 00290 playTime = Mp3ReadRegister(SPI_DECODE_TIME); 00291 minutes = playTime/60; 00292 seconds = playTime%60; 00293 displayTitle[0]=('0'+minutes/10); 00294 displayTitle[1]=('0'+minutes%10); 00295 displayTitle[2]=(':'); 00296 displayTitle[3]=('0'+seconds/10); 00297 displayTitle[4]=('0'+seconds%10); 00298 displayTitle[5]=(' '); 00299 displayTitle[6]=(' '); 00300 displayTitle[7]=(' '); 00301 00302 if (seconds&1){ 00303 if (playingState == PS_RECORDING){ 00304 displayTitle[6]='o'; 00305 }else{ 00306 displayTitle[6]='\x7e'; 00307 } 00308 00309 } 00310 00311 if ((playingState != PS_NORMAL)&&(playingState != PS_RECORDING)){ 00312 displayTitle[6]='\xdb'; 00313 } 00314 00315 00316 00317 }

Here is the call graph for this function:

void StartPatch  ) 
 

Start patch code.

Definition at line 270 of file player.c.

Referenced by main().

00271 { 00272 00273 #ifdef VS1003 00274 // Mp3WriteRegister(SPI_AIADDR, 0x00, 0x50); 00275 #else 00276 //Mp3WriteRegister(SPI_AIADDR, 0x02, 0x00); 00277 //Mp3WriteRegister(SPI_AICTRL0, 0x00, 0x00); 00278 //Mp3WriteRegister(SPI_AICTRL0, 0x00, 0x01); 00279 #endif 00280 }

void timer0_interrupt void   ) 
 

User Interface Timer interrupt.

Does NOT do any screen/button handling, only updates screen scroll variable and the userInterfaceDelayElapsed flag.

Definition at line 240 of file player.c.

References displayLength, displayPosition, SPMax, and userInterfaceDelayElapsed.

00240 { 00241 static char displayDelay; 00242 userInterfaceDelayElapsed = 1; 00243 if (++displayDelay==12){ 00244 displayDelay = 0; 00245 displayPosition++; 00246 if (displayPosition>displayLength+7){ 00247 displayPosition = -7; 00248 } 00249 } 00250 if (SP>SPMax) SPMax = SP; 00251 00252 00253 }


Variable Documentation

unsigned char intlevel = 0
 

Current interrupt level.

Definition at line 223 of file player.c.

xdata playingstatetype playingState = PS_NORMAL
 

Playing State Global, 0=normal playing, 1=abort playing.

Definition at line 220 of file player.c.

Referenced by AvailableProcessorTime(), main(), PlayCurrentFile(), Record(), ScreenSetPlayTime(), and SendZerosToVS10xx().

xdata unsigned char SPMax = 0
 

Definition at line 232 of file player.c.

Referenced by main(), and timer0_interrupt().

xdata uimodetype uiMode = UI_SPEC
 

Current User Interface mode (Title, Volume, ...).

Definition at line 230 of file player.c.

Referenced by AvailableProcessorTime(), and main().

xdata unsigned char userInterfaceDelayElapsed = 0
 

Interrupt-driven flag to reduce unnecessary UI updates.

This is set to 1 by timer interrupt every n milliseconds.

Definition at line 227 of file player.c.

Referenced by AvailableProcessorTime(), and timer0_interrupt().


All software copyright 2000-2004 VLSI Solution OY. Redistribution of these software modules are limited to promotional use only and only with the VS1011 / VS1002 / VS1003 MP3-Evakit evaluation boards. Free or commercial use of these software modules in MP3 players is ok if the product includes MP3 decoder chip(s) from VLSI. You can request the complete (compilable) package from mp3@vlsi.fi