VLSI Solution Oy VS1103 VLSI Solution Karaoke, MIDI and ADPCM Player Source Code Documentation

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

lcd.c File Reference

LCD function implementations. More...

#include "board.h"
#include "lcd.h"
#include "lcdfonts.c"

Include dependency graph for lcd.c:

Include dependency graph

Go to the source code of this file.

Functions

unsigned char PlayerTaskHandler ()
 Check status of buffers and do one disk block transfer.
void LcdPutChar (char c)
 Low level: Send one data character to LCD.
void LcdPutCommand (char cmd)
 Low level: Send one command octet to LCD.
void LcdSelectFont (ROM_CHAR_PTR font)
void LcdReset ()
 Low level: Reset LCD.
void LcdPutString (char *str)
 Low level: Send a zero-terminated string of bytes to lcd from buffer in any memory.
void LcdPutConstantString (char code *str)
 Low level: Send a zero-terminated string of bytes to lcd from buffer in ROM.
void LcdFadeIn ()
void LcdFadeOut ()
void LcdSplashScreen ()
 Splash screen.
void LcdPutHex16 (unsigned int value)
 Print a 16-bit hex value on LCD.
void LcdPutHex8 (unsigned char value)
 Print an 8-bit hex value on LCD.
unsigned char LcdPrintGenericResult (unsigned char errorlevel)
 Print OK or Error (hex8) on LCD.
void LcdPutUInt (unsigned long value)
 Print a 16-bit unsigned integer value on LCD.

Variables

code const unsigned char lcd_hexchars [17] = "0123456789abcdef"
 hexadecimal character set


Detailed Description

LCD function implementations.

Required modules: board

Definition in file lcd.c.


Function Documentation

void LcdFadeIn  ) 
 

Definition at line 115 of file lcd.c.

References InitiateDelay, and LcdPutCommand().

Referenced by LcdSplashScreen().

00115                 {
00116   unsigned char c,d;
00117   for (c=0; c<254; c++){
00118     for (d=252; d; d-=2){
00119       if (d>c){
00120         LcdPutCommand (8);
00121         InitiateDelay(40);
00122       }else{
00123         LcdPutCommand (12);
00124         InitiateDelay(40);
00125       }
00126     }
00127   }
00128   LcdPutCommand(12);
00129   InitiateDelay(40);
00130 }

Here is the call graph for this function:

void LcdFadeOut  ) 
 

Definition at line 132 of file lcd.c.

References InitiateDelay, and LcdPutCommand().

Referenced by LcdSplashScreen().

00132                  {
00133   unsigned char c,d;
00134   for (c=0; c<254; c++){
00135     for (d=252; d; d-=2){
00136       if (d<c){
00137         LcdPutCommand (8);
00138         InitiateDelay(40);
00139       }else{
00140         LcdPutCommand (12);
00141         InitiateDelay(40);
00142       }
00143     }
00144   }
00145   LcdPutCommand(8);
00146   InitiateDelay(40);
00147 }

Here is the call graph for this function:

unsigned char LcdPrintGenericResult unsigned char  errorlevel  ) 
 

Print OK or Error (hex8) on LCD.

Definition at line 189 of file lcd.c.

References ConsolePutHex8, ConsoleWrite, Delay(), lcd_hexchars, LcdPutChar(), and LcdPutConstantString().

00189                                                               {
00190   if (!errorlevel){        
00191     LcdPutConstantString ("OK      ");
00192   }else{
00193     LcdPutConstantString ("Error ");
00194     LcdPutChar(lcd_hexchars[(errorlevel>>4)&0xf]);
00195     LcdPutChar(lcd_hexchars[(errorlevel)&0xf]);
00196     ConsoleWrite ("\rSystem error ");
00197     ConsolePutHex8 (errorlevel);
00198     ConsoleWrite (": \"");
00199 
00200     switch (errorlevel){
00201     case 0x01: ConsoleWrite ("No storage"); break;
00202     case 0x02: ConsoleWrite ("Storage powerup"); break;
00203     case 0x03: ConsoleWrite ("Storage init"); break;
00204     case 0x04: ConsoleWrite ("No storage ID"); break;
00205     case 0x05: ConsoleWrite ("Datablock header"); break;
00206     case 0x06: ConsoleWrite ("Storage Data reply failed"); break;
00207     case 0x07: ConsoleWrite ("Generic Storage Command"); break;
00208     case 0x08: ConsoleWrite ("Sector 0 not in recognized format"); break;
00209     case 0x09: ConsoleWrite ("No active partition"); break;
00210     case 0x0a: ConsoleWrite ("Filesystem load"); break;
00211     case 0x0b: ConsoleWrite ("No root directory"); break;
00212     case 0x0c: ConsoleWrite ("File not found"); break;
00213 
00214     };
00215     ConsoleWrite("\" failure.\r");
00216     
00217 
00218     Delay(500);
00219   }
00220   return errorlevel;
00221 }

Here is the call graph for this function:

void LcdPutChar char  c  ) 
 

Low level: Send one data character to LCD.

Parameters:
c Octet to be sent to LCD

Definition at line 17 of file lcd.c.

References InitiateDelay, LCD_DATABUS, LCD_ENABLE, LCD_RS, and WaitOutDelay.

Referenced by LcdPrintGenericResult(), LcdPutConstantString(), LcdPutHex16(), LcdPutHex8(), LcdPutString(), LcdPutUInt(), LcdSplashScreen(), and UpdateDisplay().

00017                         {
00018   //PlayerTaskHandler();
00019   WaitOutDelay();
00020   LCD_RS = LCD_DATA_MODE;
00021   LCD_DATABUS = c;
00022   LCD_ENABLE = 1; /* Rising edge */
00023   LCD_ENABLE = 1; /* Keep high...*/
00024   LCD_ENABLE = 0; /* Falling edge */
00025   InitiateDelay(84);
00026 }

void LcdPutCommand char  cmd  ) 
 

Low level: Send one command octet to LCD.

Parameters:
cmd Command octet to be sent to LCD

Definition at line 34 of file lcd.c.

References InitiateDelay, LCD_DATABUS, LCD_ENABLE, LCD_RS, and WaitOutDelay.

Referenced by LcdFadeIn(), LcdFadeOut(), and LcdReset().

00034                             {
00035   //PlayerTaskHandler();
00036   WaitOutDelay();
00037   LCD_RS = LCD_COMMAND_MODE;
00038   LCD_DATABUS = cmd;
00039   LCD_ENABLE = 1; /* Rising edge */
00040   LCD_ENABLE = 1; /* Keep High */
00041   LCD_ENABLE = 0; /* Falling edge */
00042   InitiateDelay(84);
00043 }

void LcdPutConstantString char code *  str  ) 
 

Low level: Send a zero-terminated string of bytes to lcd from buffer in ROM.

Example: LcdPutConstantString ("Hello!");

Parameters:
*str pointer to a zero-terminated string in code ROM.

Definition at line 106 of file lcd.c.

References LcdPutChar().

Referenced by InitFileSystem(), LcdPrintGenericResult(), LcdSelectFont(), LcdSplashScreen(), main(), MessageBox(), and UpdateDisplay().

00106                                          {
00107   while (*str)
00108     {
00109       LcdPutChar (*str++);
00110     }
00111 }

Here is the call graph for this function:

void LcdPutHex16 unsigned int  value  ) 
 

Print a 16-bit hex value on LCD.

Definition at line 172 of file lcd.c.

References lcd_hexchars, and LcdPutChar().

00172                                      {
00173   LcdPutChar(lcd_hexchars[value>>12]);
00174   LcdPutChar(lcd_hexchars[(value>>8)&0xf]);
00175   LcdPutChar(lcd_hexchars[(value>>4)&0xf]);
00176   LcdPutChar(lcd_hexchars[(value)&0xf]);
00177 }

Here is the call graph for this function:

void LcdPutHex8 unsigned char  value  ) 
 

Print an 8-bit hex value on LCD.

Definition at line 181 of file lcd.c.

References lcd_hexchars, and LcdPutChar().

00181                                      {
00182 
00183   LcdPutChar(lcd_hexchars[(value>>4)&0xf]);
00184   LcdPutChar(lcd_hexchars[(value)&0xf]);
00185 }

Here is the call graph for this function:

void LcdPutString char *  str  ) 
 

Low level: Send a zero-terminated string of bytes to lcd from buffer in any memory.

Example: LcdPutString (s);

Parameters:
*str pointer to a zero-terminated string in idata segment
Warning:
Do not call for const type strings in the ROM!

Definition at line 93 of file lcd.c.

References LcdPutChar().

Referenced by MessageBox().

00093                               {
00094   while (*str) {
00095     LcdPutChar (*str++);
00096   }
00097 }

Here is the call graph for this function:

void LcdPutUInt unsigned long  value  ) 
 

Print a 16-bit unsigned integer value on LCD.

Definition at line 225 of file lcd.c.

References LcdPutChar().

00225                                     {
00226   xdata unsigned char valueString[10];
00227   char c;
00228   for (c=0; c<10; c++){
00229     valueString[c]=value % 10;
00230     value = value / 10;
00231   }
00232   c=9;
00233   while ((valueString[c]==0) && (c!=0))
00234     c--;
00235   for (;c!=0;c--)
00236     LcdPutChar('0'+valueString[c]);
00237   LcdPutChar('0'+valueString[0]);
00238 
00239 }

Here is the call graph for this function:

void LcdReset  ) 
 

Low level: Reset LCD.

Definition at line 60 of file lcd.c.

References InitiateDelay, LCD_ENABLE, lcdFont_barchars, LcdPutCommand(), LcdSelectFont(), and WaitOutDelay.

Referenced by AvailableProcessorTime(), InitFileSystem(), LcdSplashScreen(), main(), and MessageBox().

00060                {
00061 
00062 
00063   LCD_ENABLE = 0;
00064   InitiateDelay(0); /* Initialize the delay system */
00065 
00066   LcdPutCommand(56); /* 8 data bits, 2 lines */
00067   InitiateDelay(139);
00068 
00069   WaitOutDelay();
00070   LcdPutCommand(56); /* Command 2 times "just in case" */
00071   InitiateDelay(139);
00072 
00073   WaitOutDelay();
00074   LcdPutCommand(12); /* Panel on, no cursor */
00075   InitiateDelay(139);
00076 
00077   WaitOutDelay();
00078   LcdPutCommand(1);  /* Clear screen */
00079   InitiateDelay(2530); /* Start a 1.53 ms delay */
00080 
00081   LcdSelectFont(lcdFont_barchars);
00082 
00083 }

Here is the call graph for this function:

void LcdSelectFont ROM_CHAR_PTR  font  ) 
 

Definition at line 47 of file lcd.c.

References LcdLocateCG, LcdLocateHome, LcdPutConstantString(), and ROM_CHAR_PTR.

Referenced by LcdReset(), and LcdSplashScreen().

00047                                      {
00048   static ROM_CHAR_PTR loadedFont = 0;
00049   if (loadedFont != font){
00050     loadedFont=font;
00051     
00052     LcdLocateCG();
00053     LcdPutConstantString(font);  
00054     LcdLocateHome();
00055    
00056   }
00057 }

Here is the call graph for this function:

void LcdSplashScreen  ) 
 

Splash screen.

Definition at line 151 of file lcd.c.

References LcdFadeIn(), LcdFadeOut(), lcdFont_vlsichars, LcdLocateHome, LcdLocateLine2, LcdPutChar(), LcdPutConstantString(), LcdReset(), and LcdSelectFont().

00151                       {
00152     
00153   LcdReset();
00154  
00155   LcdSelectFont(lcdFont_vlsichars);
00156   
00157   LcdLocateHome();
00158   
00159   LcdPutChar(0);
00160   LcdPutConstantString("\1\2\3 Sol");
00161   LcdLocateLine2();
00162   LcdPutConstantString("ution Oy");
00163 
00164  
00165   LcdFadeIn();
00166   LcdFadeOut();
00167  
00168 }

Here is the call graph for this function:

unsigned char PlayerTaskHandler  ) 
 

Check status of buffers and do one disk block transfer.

Definition at line 189 of file player.c.

References DiskBlock::Raw::buf, dataBufPtr, diskSect, GREEN_LED, Address::l, LED1, fragmentEntry::length, midiCurrentFragment, midiCurrentSector, midiDisk, midiFragment, midiSciActive, midiSectorsLeftInFragment, Mp3DeselectControl, Mp3DeselectData, Mp3ReadRegister(), Mp3SelectControl, Mp3SelectData, DiskBlock::raw, recordActive, recordCurrentSector, recordDisk, recordSectorsLeftInFragment, RED_LED, SCI_IN0, SCI_IN1, sectorAddress, SelectDisk(), SPIPutCharWithoutWaiting, SPIWait, fragmentEntry::start, TransferSectorSCI(), TransferSectorSDI(), VS_READ_COMMAND, waveCurrentFragment, waveCurrentSector, waveDisk, waveFragment, waveSdiActive, waveSectorsLeftInFragment, and WriteDiskSector().

00189                                   {  
00190   //_____________________________________________________
00191   // WAV playing ----------------------------------------
00192   //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
00193 
00194 
00195   // Highest priority: WAVE IN stream is SDI stream in
00196   // Check whether SDI in stream has space for 1 disk sector
00197   if ((waveSdiActive) && (MP3_DREQ)){    
00198     GREEN_LED=LED_ON;
00199 
00200     SelectDisk(waveDisk);
00201     TransferSectorSDI(waveCurrentSector); //Send WAV to VS1103
00202 
00203     // Find next sector or end of file
00204     waveCurrentSector++;
00205     if (waveSectorsLeftInFragment-- == 0){
00206       waveCurrentFragment++;
00207       waveCurrentSector = waveFragment[waveCurrentFragment].start;
00208       waveSectorsLeftInFragment = waveFragment[waveCurrentFragment].length;
00209       if (waveSectorsLeftInFragment == 0) {
00210         waveSdiActive = 0;
00211       }      
00212     }
00213     GREEN_LED=LED_OFF;
00214     return 1;
00215   }
00216 
00217 
00218 
00219   //_____________________________________________________
00220   //Recording -------------------------------------------
00221   //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
00222 
00223 
00224   if ((recordActive) && ((Mp3ReadRegister(SCI_IN1) >> 8) >= 0x20)){
00225     //Sector is available for storing
00226     
00227     // EA=0;
00228     // BlockReceive in C
00229     dataBufPtr = diskSect.raw.buf;
00230     // Use global pointer and unrolled loop for speed
00231     while (dataBufPtr < diskSect.raw.buf+512){
00232 
00233 
00234       // Below is the spi data transfer code in ASSEMBLER 
00235       // (for super fast data read from VS1103) and also in C.
00236 
00237       // READ ONE SECTOR (512 bytes) FROM VS1103 REC BUFFER
00238       // TO DISKSECT.RAW.BUF[512]
00239 
00240 #if 1
00241 _asm
00242 
00243   push dpl
00244   push dph
00245   push psw
00246   push acc
00247   mov   dpl,_dataBufPtr
00248   mov   dph,(_dataBufPtr + 1)
00249 
00250 
00251   // CHIP SELECT
00252   clr   _P2_3
00253   mov   _SPDAT,#0x03
00254   mov   a,_SPSTA
00255   jnb     acc.7,.-4
00256   mov   _SPDAT,#0x08
00257   mov   a,_SPSTA
00258   jnb     acc.7,.-4
00259   mov   _SPDAT,#0xFF
00260   mov   a,_SPSTA
00261   jnb     acc.7,.-4
00262   mov   a,_SPDAT
00263 
00264 
00265   mov   _SPDAT,#0xFF
00266   movx @dptr,a
00267   inc dptr
00268   // CHIP DESELECT
00269   setb  _P2_3
00270   // CHIP SELECT
00271   clr   _P2_3
00272   mov   a,_SPDAT
00273   mov   _SPDAT,#0x03
00274   movx  @dptr,a
00275   mov   _SPDAT,#0x08
00276   inc dptr  
00277   mov   a,_SPSTA
00278   mov   _SPDAT,#0xFF
00279   nop
00280   nop
00281   nop
00282   mov   a,_SPSTA
00283   mov   a,_SPDAT
00284 
00285 
00286   mov   _SPDAT,#0xFF
00287   movx @dptr,a
00288   inc dptr
00289   // CHIP DESELECT
00290   setb  _P2_3
00291   // CHIP SELECT
00292   clr   _P2_3
00293   mov   a,_SPDAT
00294   mov   _SPDAT,#0x03
00295   movx  @dptr,a
00296   mov   _SPDAT,#0x08
00297   inc dptr  
00298   mov   a,_SPSTA
00299   mov   _SPDAT,#0xFF
00300   nop
00301   nop
00302   nop
00303   mov   a,_SPSTA
00304   mov   a,_SPDAT
00305 
00306 
00307   mov   _SPDAT,#0xFF
00308   movx @dptr,a
00309   inc dptr
00310   // CHIP DESELECT
00311   setb  _P2_3
00312   // CHIP SELECT
00313   clr   _P2_3
00314   mov   a,_SPDAT
00315   mov   _SPDAT,#0x03
00316   movx  @dptr,a
00317   mov   _SPDAT,#0x08
00318   inc dptr  
00319   mov   a,_SPSTA
00320   mov   _SPDAT,#0xFF
00321   nop
00322   nop
00323   nop
00324   mov   a,_SPSTA
00325   mov   a,_SPDAT
00326 
00327 
00328   mov   _SPDAT,#0xFF
00329   movx @dptr,a
00330   inc dptr
00331   // CHIP DESELECT
00332   setb  _P2_3
00333   // CHIP SELECT
00334   clr   _P2_3
00335   mov   a,_SPDAT
00336   mov   _SPDAT,#0x03
00337   movx  @dptr,a
00338   mov   _SPDAT,#0x08
00339   inc dptr  
00340   mov   a,_SPSTA
00341   mov   _SPDAT,#0xFF
00342   nop
00343   nop
00344   nop
00345   mov   a,_SPSTA
00346   mov   a,_SPDAT
00347 
00348 
00349   mov   _SPDAT,#0xFF
00350   movx @dptr,a
00351   inc dptr
00352   // CHIP DESELECT
00353   setb  _P2_3
00354   // CHIP SELECT
00355   clr   _P2_3
00356   mov   a,_SPDAT
00357   mov   _SPDAT,#0x03
00358   movx  @dptr,a
00359   mov   _SPDAT,#0x08
00360   inc dptr  
00361   mov   a,_SPSTA
00362   mov   _SPDAT,#0xFF
00363   nop
00364   nop
00365   nop
00366   mov   a,_SPSTA
00367   mov   a,_SPDAT
00368 
00369 
00370   mov   _SPDAT,#0xFF
00371   movx @dptr,a
00372   inc dptr
00373   // CHIP DESELECT
00374   setb  _P2_3
00375   // CHIP SELECT
00376   clr   _P2_3
00377   mov   a,_SPDAT
00378   mov   _SPDAT,#0x03
00379   movx  @dptr,a
00380   mov   _SPDAT,#0x08
00381   inc dptr  
00382   mov   a,_SPSTA
00383   mov   _SPDAT,#0xFF
00384   nop
00385   nop
00386   nop
00387   mov   a,_SPSTA
00388   mov   a,_SPDAT
00389 
00390 
00391   mov   _SPDAT,#0xFF
00392   movx @dptr,a
00393   inc dptr
00394   // CHIP DESELECT
00395   setb  _P2_3
00396   // CHIP SELECT
00397   clr   _P2_3
00398   mov   a,_SPDAT
00399   mov   _SPDAT,#0x03
00400   movx  @dptr,a
00401   mov   _SPDAT,#0x08
00402   inc dptr  
00403   mov   a,_SPSTA
00404   mov   _SPDAT,#0xFF
00405   nop
00406   nop
00407   nop
00408   mov   a,_SPSTA
00409   mov   a,_SPDAT
00410 
00411 
00412   mov   _SPDAT,#0xFF
00413   movx @dptr,a
00414   inc dptr
00415   mov   a,_SPSTA
00416   mov   a,_SPDAT
00417   movx  @dptr,a
00418   inc dptr
00419 
00420   // CHIP DESELECT
00421   setb  _P2_3
00422   
00423   mov   _dataBufPtr, dpl
00424   mov   (_dataBufPtr + 1), dph
00425   pop acc
00426   pop psw
00427   pop dph
00428   pop dpl
00429 
00430 
00431 _endasm;
00432 
00433 #else
00434       Mp3SelectControl();
00435       SPIPutCharWithoutWaiting(VS_READ_COMMAND);SPIWait();
00436       SPIPutCharWithoutWaiting(SCI_IN0);SPIWait();
00437       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00438       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00439       Mp3DeselectControl();
00440 
00441 
00442       Mp3SelectControl();
00443       SPIPutCharWithoutWaiting(VS_READ_COMMAND);SPIWait();
00444       SPIPutCharWithoutWaiting(SCI_IN0);SPIWait();
00445       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00446       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00447       Mp3DeselectControl();
00448 
00449 
00450       Mp3SelectControl();
00451       SPIPutCharWithoutWaiting(VS_READ_COMMAND);SPIWait();
00452       SPIPutCharWithoutWaiting(SCI_IN0);SPIWait();
00453       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00454       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00455       Mp3DeselectControl();
00456 
00457 
00458       Mp3SelectControl();
00459       SPIPutCharWithoutWaiting(VS_READ_COMMAND);SPIWait();
00460       SPIPutCharWithoutWaiting(SCI_IN0);SPIWait();
00461       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00462       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00463       Mp3DeselectControl();
00464 
00465 
00466       Mp3SelectControl();
00467       SPIPutCharWithoutWaiting(VS_READ_COMMAND);SPIWait();
00468       SPIPutCharWithoutWaiting(SCI_IN0);SPIWait();
00469       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00470       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00471       Mp3DeselectControl();
00472 
00473 
00474       Mp3SelectControl();
00475       SPIPutCharWithoutWaiting(VS_READ_COMMAND);SPIWait();
00476       SPIPutCharWithoutWaiting(SCI_IN0);SPIWait();
00477       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00478       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00479       Mp3DeselectControl();
00480 
00481 
00482       Mp3SelectControl();
00483       SPIPutCharWithoutWaiting(VS_READ_COMMAND);SPIWait();
00484       SPIPutCharWithoutWaiting(SCI_IN0);SPIWait();
00485       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00486       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00487       Mp3DeselectControl();
00488 
00489 
00490       Mp3SelectControl();
00491       SPIPutCharWithoutWaiting(VS_READ_COMMAND);SPIWait();
00492       SPIPutCharWithoutWaiting(SCI_IN0);SPIWait();
00493       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00494       SPIPutCharWithoutWaiting(0xff); SPIWait(); *dataBufPtr++ = SPI_RESULT_BYTE;
00495       Mp3DeselectControl();
00496 
00497 
00498 #endif
00499 
00500     }
00501     //ConsolePutChar('w');
00502 
00503     EA=1;
00504 
00505     
00506     RED_LED = LED_ON;
00507     sectorAddress.l = recordCurrentSector;
00508     recordCurrentSector++;
00509 
00510     SelectDisk(recordDisk);
00511     WriteDiskSector(sectorAddress.l);
00512     RED_LED = LED_OFF;
00513     
00514     recordSectorsLeftInFragment--;
00515     if (recordSectorsLeftInFragment<1) recordActive = 0;
00516     
00517     return 2;
00518 
00519   }
00520 
00521   //_____________________________________________________
00522   //   ECHO   -------------------------------------------
00523   //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
00524 
00525 
00526   if ((echoActive  ) && ((Mp3ReadRegister(SCI_IN1) >> 8) >= 0x20)){
00527     
00528     // EA=0;
00529     // BlockReceive in C
00530     dataBufPtr = diskSect.raw.buf;
00531     // Use global pointer and unrolled loop for speed
00532     while (dataBufPtr < diskSect.raw.buf+256){
00533    
00534       //Similar fast transfer than in the recording mode 
00535       // -> record and send back to VS1103 to make echo from the microphone
00536    
00537 _asm
00538 
00539   push dpl
00540   push dph
00541   push psw
00542   push acc
00543   mov   dpl,_dataBufPtr
00544   mov   dph,(_dataBufPtr + 1)
00545 
00546 
00547   // CHIP SELECT
00548   clr   _P2_3
00549   mov   _SPDAT,#0x03
00550   mov   a,_SPSTA
00551   jnb     acc.7,.-4
00552   mov   _SPDAT,#0x08
00553   mov   a,_SPSTA
00554   jnb     acc.7,.-4
00555   mov   _SPDAT,#0xFF
00556   mov   a,_SPSTA
00557   jnb     acc.7,.-4
00558   mov   a,_SPDAT
00559 
00560 
00561   mov   _SPDAT,#0xFF
00562   movx @dptr,a
00563   inc dptr
00564   // CHIP DESELECT
00565   setb  _P2_3
00566   // CHIP SELECT
00567   clr   _P2_3
00568   mov   a,_SPDAT
00569   mov   _SPDAT,#0x03
00570   movx  @dptr,a
00571   mov   _SPDAT,#0x08
00572   inc dptr  
00573   mov   a,_SPSTA
00574   mov   _SPDAT,#0xFF
00575   nop
00576   nop
00577   nop
00578   mov   a,_SPSTA
00579   mov   a,_SPDAT
00580 
00581 
00582   mov   _SPDAT,#0xFF
00583   movx @dptr,a
00584   inc dptr
00585   // CHIP DESELECT
00586   setb  _P2_3
00587   // CHIP SELECT
00588   clr   _P2_3
00589   mov   a,_SPDAT
00590   mov   _SPDAT,#0x03
00591   movx  @dptr,a
00592   mov   _SPDAT,#0x08
00593   inc dptr  
00594   mov   a,_SPSTA
00595   mov   _SPDAT,#0xFF
00596   nop
00597   nop
00598   nop
00599   mov   a,_SPSTA
00600   mov   a,_SPDAT
00601 
00602 
00603   mov   _SPDAT,#0xFF
00604   movx @dptr,a
00605   inc dptr
00606   // CHIP DESELECT
00607   setb  _P2_3
00608   // CHIP SELECT
00609   clr   _P2_3
00610   mov   a,_SPDAT
00611   mov   _SPDAT,#0x03
00612   movx  @dptr,a
00613   mov   _SPDAT,#0x08
00614   inc dptr  
00615   mov   a,_SPSTA
00616   mov   _SPDAT,#0xFF
00617   nop
00618   nop
00619   nop
00620   mov   a,_SPSTA
00621   mov   a,_SPDAT
00622 
00623 
00624   mov   _SPDAT,#0xFF
00625   movx @dptr,a
00626   inc dptr
00627   // CHIP DESELECT
00628   setb  _P2_3
00629   // CHIP SELECT
00630   clr   _P2_3
00631   mov   a,_SPDAT
00632   mov   _SPDAT,#0x03
00633   movx  @dptr,a
00634   mov   _SPDAT,#0x08
00635   inc dptr  
00636   mov   a,_SPSTA
00637   mov   _SPDAT,#0xFF
00638   nop
00639   nop
00640   nop
00641   mov   a,_SPSTA
00642   mov   a,_SPDAT
00643 
00644 
00645   mov   _SPDAT,#0xFF
00646   movx @dptr,a
00647   inc dptr
00648   // CHIP DESELECT
00649   setb  _P2_3
00650   // CHIP SELECT
00651   clr   _P2_3
00652   mov   a,_SPDAT
00653   mov   _SPDAT,#0x03
00654   movx  @dptr,a
00655   mov   _SPDAT,#0x08
00656   inc dptr  
00657   mov   a,_SPSTA
00658   mov   _SPDAT,#0xFF
00659   nop
00660   nop
00661   nop
00662   mov   a,_SPSTA
00663   mov   a,_SPDAT
00664 
00665 
00666   mov   _SPDAT,#0xFF
00667   movx @dptr,a
00668   inc dptr
00669   // CHIP DESELECT
00670   setb  _P2_3
00671   // CHIP SELECT
00672   clr   _P2_3
00673   mov   a,_SPDAT
00674   mov   _SPDAT,#0x03
00675   movx  @dptr,a
00676   mov   _SPDAT,#0x08
00677   inc dptr  
00678   mov   a,_SPSTA
00679   mov   _SPDAT,#0xFF
00680   nop
00681   nop
00682   nop
00683   mov   a,_SPSTA
00684   mov   a,_SPDAT
00685 
00686 
00687   mov   _SPDAT,#0xFF
00688   movx @dptr,a
00689   inc dptr
00690   // CHIP DESELECT
00691   setb  _P2_3
00692   // CHIP SELECT
00693   clr   _P2_3
00694   mov   a,_SPDAT
00695   mov   _SPDAT,#0x03
00696   movx  @dptr,a
00697   mov   _SPDAT,#0x08
00698   inc dptr  
00699   mov   a,_SPSTA
00700   mov   _SPDAT,#0xFF
00701   nop
00702   nop
00703   nop
00704   mov   a,_SPSTA
00705   mov   a,_SPDAT
00706 
00707 
00708   mov   _SPDAT,#0xFF
00709   movx @dptr,a
00710   inc dptr
00711   mov   a,_SPSTA
00712   mov   a,_SPDAT
00713   movx  @dptr,a
00714   inc dptr
00715 
00716   // CHIP DESELECT
00717   setb  _P2_3
00718   
00719   mov   _dataBufPtr, dpl
00720   mov   (_dataBufPtr + 1), dph
00721   pop acc
00722   pop psw
00723   pop dph
00724   pop dpl
00725 
00726 
00727 _endasm;
00728 
00729  
00730     }
00731     //ConsolePutChar('w');
00732     
00733     EA=1;
00734     
00735 
00736     //while (MP3_DREQ){
00737     
00738       Mp3SelectData();
00739       // BlockTransmit in C
00740       dataBufPtr = diskSect.raw.buf;
00741       // Use global pointer and unrolled loop for speed
00742       while (dataBufPtr < diskSect.raw.buf+256){
00743         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00744         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00745         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00746         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00747         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00748         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00749         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00750         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00751         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00752         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00753         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00754         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00755         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00756         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00757         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00758         SPIPutCharWithoutWaiting(*dataBufPtr++); 
00759       }
00760       Mp3DeselectData();
00761       //}
00762     return 2;
00763 
00764   }
00765 
00766 
00767   //_____________________________________________________
00768   // MIDI playing ---------------------------------------
00769   //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
00770 
00771   
00772   // MIDI IN stream is SCI stream in
00773   // Check whether SCI in stream has space for 1 disk sector
00774   if (midiSciActive && (Mp3ReadRegister(SCI_IN1) & 0xff) >= 0x20){
00775     LED1 = LED_ON;
00776 
00777     SelectDisk(midiDisk);
00778     TransferSectorSCI(midiCurrentSector); //Send MID to VS1103
00779 
00780     // Find next sector or end of file
00781     midiCurrentSector++;
00782     if (midiSectorsLeftInFragment-- == 0){
00783       midiCurrentFragment++;
00784       midiCurrentSector = midiFragment[midiCurrentFragment].start;
00785       midiSectorsLeftInFragment = midiFragment[midiCurrentFragment].length;
00786       if (midiSectorsLeftInFragment == 0) {
00787         midiSciActive = 0;
00788       }      
00789     }
00790 
00791     LED1=LED_OFF;
00792     return 3;
00793   }
00794     
00795   return 0; //No transfer was pending.
00796 }

Here is the call graph for this function:


Variable Documentation

code const unsigned char lcd_hexchars[17] = "0123456789abcdef"
 

hexadecimal character set

Definition at line 11 of file lcd.c.

Referenced by LcdPrintGenericResult(), LcdPutHex16(), and LcdPutHex8().


All software copyright 2000-2004 VLSI Solution OY. Redistribution of these software modules is limited to VLSI Solution Oy chip promotional use only. Free or commercial use of these software modules in MP3 players is ok if the product includes chip(s) from VLSI. You can request the complete (compilable) package from mp3@vlsi.fi. This exampe code is provided with good faith to assist You in code development, but under no circumstances will VLSI offer any guarantees on the usability or functionality of any example software or its fitness for any purpose.