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

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

board.c File Reference

Board related utility functions such as delay(). More...

#include "board.h"
#include "lcd.h"

Include dependency graph for board.c:

Include dependency graph

Go to the source code of this file.

Classes

union  Temp
 Generic temp variable for non-reentrant main routines. More...


Functions

unsigned char SPIGetChar ()
 Send 8 ones to SPI bus and receive the result byte.

void SPI8Clocks (unsigned char nClocks)
 Send nClocks x 8 clock transitions with MOSI=1 (0xff).

void Delay (int milliseconds)
 Busy loop delay function.

void InitBoard ()
 Startup initialization of the microcontroller board.


Variables

Temp temp
 Generic temp variable for non-reentrant main routines.


Detailed Description

Board related utility functions such as delay().

Definition in file board.c.


Function Documentation

void Delay int  milliseconds  ) 
 

Busy loop delay function.

Creates n times 1 ms hardware delays

Definition at line 36 of file board.c.

References InitiateDelay, and WaitOutDelay.

Referenced by InitMMC(), LcdPrintGenericResult(), LoadPatch(), MmcCommand(), Mp3Reset(), Mp3SoftReset(), RebootMMC(), Record(), and VsSineTest().

00036 { 00037 for (;milliseconds;milliseconds--){ /* for n times do: */ 00038 InitiateDelay (1000); 00039 WaitOutDelay(); /* 1 ms delay */ 00040 } 00041 }

void InitBoard  ) 
 

Startup initialization of the microcontroller board.

Definition at line 44 of file board.c.

References InitiateDelay, MMC_OFF, and Mp3PutInReset.

Referenced by main().

00045 { 00046 AUXR = 0x11; /* Take full memory into use */ 00047 00048 Mp3PutInReset(); 00049 00050 // MP3_XRESET = 0; /* Put the MP3 chip into reset */ 00051 00052 MMC_OFF = 1; /* Turn mmc power off */ 00053 00054 00055 SPCON = 0xF2; /* Set slow spi clock */ 00056 CKCON0 = 0x01; /* CPU x 2, timer2 x 1 */ 00057 IEN0 = 0; /* Disable all interrupts */ 00058 00059 BDRCON = 0x1F; /* Set uart for 115200,8n1 */ 00060 PCON = 0x80; /* Double Baud Rate */ 00061 BRL = 248; /* 248 for 115200 */ 00062 SCON = 0x50; /* Serial Port Control Register */ 00063 TI = 1; 00064 00065 ConsoleWrite ("\r\r\rBoard: Console is up.\r"); 00066 00067 00068 TMOD = 1; 00069 00070 00071 RCAP2H = 143; /* Set timer2 for 128 interrupts in second */ 00072 RCAP2L = 89; 00073 TH2 = 143; 00074 TL2 = 89; 00075 T2CON = 0; 00076 T2MOD = 0; 00077 00078 TR2 = 1; /* Start timer2 */ 00079 // ET2 = 1; /* Enable timer2 interrupts */ 00080 00081 // P2 = 0xEF; 00082 //P3 = 0xFF; 00083 00084 InitiateDelay(0); /* Initialize the Delay System */ 00085 00086 ConsoleWrite ("Init: Board; supports: AT89C51RD2, MMC, VS10xx, RS232\r"); 00087 00088 00089 // EA = 1; /* Global enable for interrupts */ 00090 }

void SPI8Clocks unsigned char  nClocks  ) 
 

Send nClocks x 8 clock transitions with MOSI=1 (0xff).

Definition at line 26 of file board.c.

References SPIPutCharWithoutWaiting, and SPIWait.

Referenced by MmcCommand(), MmcWaitForData(), ReadPhysicalSector(), RebootMMC(), and WritePhysicalSector().

00026 { 00027 while (nClocks--){ 00028 SPIPutCharWithoutWaiting(0xff); 00029 SPIWait(); 00030 } 00031 }

unsigned char SPIGetChar  ) 
 

Send 8 ones to SPI bus and receive the result byte.

Definition at line 18 of file board.c.

References SPI_RESULT_BYTE, SPIPutCharWithoutWaiting, and SPIWait.

Referenced by ConsoleDecipherMMCResponse(), MmcCommand(), MmcGetData(), MmcWaitForData(), and WritePhysicalSector().

00018 { 00019 SPIPutCharWithoutWaiting(0xff); /* send 0xff */ 00020 SPIWait(); /* wait for the byte to transfer */ 00021 return SPI_RESULT_BYTE; /* Return the received byte */ 00022 }


Variable Documentation

union Temp temp
 

Generic temp variable for non-reentrant main routines.

Referenced by BuildFragmentTable(), FatInitGlobals(), GetAVIBlock(), InitMMC(), LoadPatch(), main(), OpenFile(), Record(), SendZerosToVS10xx(), UpdateDisplay(), and WriteClusterChain().


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