#include "board.h"
#include "lcd.h"
Include dependency graph for board.c:
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. |
Definition in file board.c.
|
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(), and VsSineTest(). 00036 { 00037 for (;milliseconds;milliseconds--){ /* for n times do: */ 00038 InitiateDelay (1000); 00039 WaitOutDelay(); /* 1 ms delay */ 00040 } 00041 }
|
|
Startup initialization of the microcontroller board.
Definition at line 44 of file board.c. References ConsoleWrite, InitiateDelay, Mp3PutInReset, and SPISetFastClock. 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 00053 SPCON = 0xF2; /* Set slow spi clock */ 00054 CKCON0 = 0x01; /* CPU x 2, timer2 x 1 */ 00055 IEN0 = 0; /* Disable all interrupts */ 00056 00057 BDRCON = 0x1F; /* Set uart for 115200,8n1 */ 00058 PCON = 0x80; /* Double Baud Rate */ 00059 BRL = 248; /* 248 for 115200 */ 00060 SCON = 0x50; /* Serial Port Control Register */ 00061 TI = 1; 00062 00063 ConsoleWrite ("\r\r\rBoard: Console is up.\r"); 00064 00065 00066 //Timer1: make interrupt for each up-pulse 00067 //Accomplish this by setting counter auto-reload mode 00068 //with 0xff as auto-reload value 00069 TMOD = 0x61; 00070 TH1 = 0xFF; 00071 TL1 = 0xFF; 00072 ET1 = 1; //Enable Interrupt 00073 00074 00075 00076 TR1 = 1; 00077 00078 00079 RCAP2H = 143; /* Set timer2 for 128 interrupts in second */ 00080 RCAP2L = 89; 00081 TH2 = 143; 00082 TL2 = 89; 00083 T2CON = 0; 00084 T2MOD = 0; 00085 00086 TR2 = 1; /* Start timer2 */ 00087 // ET2 = 1; /* Enable timer2 interrupts */ 00088 00089 // P2 = 0xEF; 00090 //P3 = 0xFF; 00091 00092 InitiateDelay(0); /* Initialize the Delay System */ 00093 00094 SPISetFastClock(); // Switch to fast SPI clock 00095 00096 ConsoleWrite ("Init: Board; supports: AT89C51RD2, MMC, VS10xx, RS232\r"); 00097 00098 00099 00100 // EA = 1; /* Global enable for interrupts */ 00101 }
|
|
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(), TransferSectorSCI(), TransferSectorSDI(), and WritePhysicalSector(). 00026 { 00027 while (nClocks--){ 00028 SPIPutCharWithoutWaiting(0xff); 00029 SPIWait(); 00030 } 00031 }
|
|
Send 8 ones to SPI bus and receive the result byte.
Definition at line 18 of file board.c. References SPIPutCharWithoutWaiting, and SPIWait. Referenced by 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 }
|
|
Generic temp variable for non-reentrant main routines.
Referenced by BuildFragmentTable(), EchoEnable(), FatInitGlobals(), InitMMC(), LoadPatch(), OpenFile(), SelectRecordFile(), SendZerosToVS10xx(), SetDisplayPercent(), and UpdateDisplay(). |