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 "loud_sa.c"

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 223 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 332 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(), PlayDiskSectors(), and Record().

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

Here is the call graph for this function:

void LoadPatch  ) 
 

Load a patch code to VS10xx.

Definition at line 265 of file player.c.

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

Referenced by main().

00265 { 00266 ConsoleWrite ("Loading patch.\r"); 00267 for (temp.i=0; temp.i < CODELEN; temp.i++) { 00268 Mp3WriteRegister(atab[temp.i], dtab[temp.i]>>8, dtab[temp.i]&0xff); 00269 } 00270 Delay(10); 00271 }

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 765 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.

00765 { 00766 00767 unsigned int currentFile; 00768 00769 InitBoard(); 00770 00771 // Start "User Interface" timer 00772 ET0 = 1; 00773 EA = 1; 00774 TR0 = 1; 00775 00776 //LcdSplashScreen(); 00777 InitDisplay (DS_STATIC," "," ",0); 00778 00779 ConsoleWrite ("\rVLSIPlayer\rStarting up.\r\r"); 00780 00781 LcdReset(); 00782 LcdPutConstantString ("Filesys "); 00783 LcdLocateLine2(); 00784 LcdPrintGenericResult (InitFileSystem()); 00785 00786 Mp3Reset(); 00787 LoadPatch(); 00788 StartPatch(); 00789 00790 // If left button is pressed during boot, enter recording. 00791 if (KEY_FARLEFT){ 00792 while(KEY_LEFT) 00793 ; 00794 Record(); 00795 } 00796 00797 00798 #ifdef VS1003 00799 uiMode = UI_SPEC; //For VS1003 default to SPECTRUM ANALYZER screen 00800 #else 00801 uiMode = UI_TITLE; //For others, default to TITLE screen 00802 #endif 00803 00804 playingState = PS_NEXT_SONG; 00805 currentFile = 1; 00806 00807 while (1){ 00808 ConsoleWrite("SPMax: ");ConsolePutHex8(SPMax); 00809 ConsoleWrite("PlayingState: ");ConsolePutHex8(playingState); 00810 00811 // has someone requested to record? 00812 if (playingState == PS_RECORDING){ 00813 uiMode = UI_TITLE; 00814 playingState = Record(); //record returns PS_NEXT_SONG or PS_RECORDING 00815 while (KEY_BUTTON) 00816 ; //Wait until button is depressed 00817 ConsoleWrite("\rFinished recording.\r"); 00818 currentFile = 1; 00819 playingState == PS_NEXT_SONG; 00820 } 00821 00822 if (OpenFile(currentFile)){ 00823 currentFile = 1; 00824 if (OpenFile(currentFile)){ 00825 LcdReset(); 00826 LcdPutConstantString("No files."); 00827 while(1); 00828 } 00829 } 00830 00831 LcdReset(); 00832 LcdPutConstantString("File "); 00833 LcdPutUInt(currentFile); 00834 LcdLocateLine2(); 00835 for (temp.c=0; temp.c<8; temp.c++){ 00836 LcdPutChar(currentFileName[temp.c]); 00837 } 00838 00839 00840 while ((KEY_BUTTON)||(KEY_FARLEFT)||(KEY_FARRIGHT)|| 00841 (KEY_LEFT)||(KEY_RIGHT)) 00842 ; /* Wait until no key is pressed */ 00843 00844 while (((!KEY_BUTTON)&&(!KEY_FARLEFT)&&(!KEY_FARRIGHT)) 00845 &&(playingState == PS_NORMAL)) 00846 ; /* Wait untis some key is pressed or playing state not normal*/ 00847 00848 00849 /* See if keystroke requests previous/next song */ 00850 if (KEY_FARLEFT) currentFile--; 00851 if (KEY_FARRIGHT) currentFile++; 00852 if (currentFile==0) currentFile = 1; 00853 00854 if (KEY_BUTTON || 00855 (playingState==PS_NEXT_SONG) || 00856 (playingState==PS_PREVIOUS_SONG)){ 00857 while (KEY_BUTTON) 00858 ; 00859 00860 PlayCurrentFile(); 00861 ConsoleWrite ("Playing state after playing is: "); 00862 ConsolePutUInt (playingState); 00863 00864 if (playingState == PS_PREVIOUS_SONG) currentFile--; 00865 if (playingState == PS_NEXT_SONG) currentFile++; 00866 if (currentFile==0) currentFile = 1; 00867 if (playingState == PS_END_OF_SONG) playingState = PS_NORMAL; 00868 00869 00870 Mp3SoftReset(); 00871 LoadPatch(); 00872 StartPatch(); 00873 00874 00875 while ((KEY_BUTTON)||(KEY_FARLEFT)||(KEY_FARRIGHT)|| 00876 (KEY_LEFT)||(KEY_RIGHT)) 00877 ; /* Wait until no key is pressed */ 00878 } 00879 00880 00881 } 00882 00883 00884 }

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 724 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().

00724 { 00725 xdata char c, nFragments; 00726 00727 playingState = PS_NORMAL; /* Request to play normally */ 00728 //uiMode = UI_SPEC; /* User interface: show title SPECANA FOR VS1003*/ 00729 00730 LcdLocateHome(); 00731 LcdPutConstantString("Opening "); 00732 00733 ConsoleWrite ("Building file fragment table..."); 00734 nFragments = BuildFragmentTable(); /* Too slow, rewrite! */ 00735 ConsoleWrite("\rFragments: "); 00736 ConsolePutUInt(nFragments); 00737 00738 LcdLocateHome(); 00739 LcdPutConstantString("Playing "); 00740 00741 for (c=0; c<nFragments; c++){ 00742 sectorAddress.l = fragment[c].start; 00743 ConsoleWrite ("\rPlayer: Playing from sector "); 00744 ConsolePutUInt (sectorAddress.l); 00745 if (PlayDiskSectors(fragment[c].length)!=0){ 00746 Mp3WriteRegister(SPI_MODE,0,SM_OUTOFWAV); 00747 SendZerosToVS10xx(); 00748 return; //return without touching the value of playingState 00749 } 00750 } 00751 SendZerosToVS10xx(); 00752 00753 // After finishing normally default to requesting to play next song 00754 playingState = PS_NEXT_SONG; 00755 00756 }

Here is the call graph for this function:

void ScreenSetPlayTime  ) 
 

Sets playing time and mode icon to left display title.

Definition at line 290 of file player.c.

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

Referenced by AvailableProcessorTime().

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

Here is the call graph for this function:

void StartPatch  ) 
 

Start patch code.

Definition at line 274 of file player.c.

Referenced by main().

00275 { 00276 00277 #ifdef VS1003 00278 // Mp3WriteRegister(SPI_AIADDR, 0x00, 0x50); 00279 #else 00280 //Mp3WriteRegister(SPI_AIADDR, 0x02, 0x00); 00281 //Mp3WriteRegister(SPI_AICTRL0, 0x00, 0x00); 00282 //Mp3WriteRegister(SPI_AICTRL0, 0x00, 0x01); 00283 #endif 00284 }

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

References displayLength, displayPosition, SPMax, and userInterfaceDelayElapsed.

00246 { 00247 static char displayDelay; 00248 userInterfaceDelayElapsed = 1; 00249 if (++displayDelay==12){ 00250 displayDelay = 0; 00251 displayPosition++; 00252 if (displayPosition>displayLength+7){ 00253 displayPosition = -7; 00254 } 00255 } 00256 if (SP>SPMax) SPMax = SP; 00257 00258 00259 }


Variable Documentation

unsigned char intlevel = 0
 

Current interrupt level.

Definition at line 229 of file player.c.

xdata playingstatetype playingState = PS_NORMAL
 

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

Definition at line 226 of file player.c.

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

xdata unsigned char SPMax = 0
 

Definition at line 238 of file player.c.

Referenced by main(), and timer0_interrupt().

xdata uimodetype uiMode = UI_SPEC
 

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

Definition at line 236 of file player.c.

Referenced by AvailableProcessorTime(), main(), and Record().

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 233 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