2011-11-26 07:10:30 +00:00
|
|
|
/*
|
|
|
|
* main.c
|
|
|
|
*
|
|
|
|
* Created on: Nov 25, 2011
|
|
|
|
* Author: Doug
|
|
|
|
*/
|
|
|
|
|
2011-12-08 05:17:47 +00:00
|
|
|
#include <avr/io.h>
|
2011-12-10 06:11:31 +00:00
|
|
|
#include <avr/interrupt.h>
|
2011-12-08 05:17:47 +00:00
|
|
|
#include <util/delay.h>
|
2011-12-10 18:35:41 +00:00
|
|
|
#include "external_mem.h"
|
2011-12-08 05:17:47 +00:00
|
|
|
#include "tests/simm_electrical_test.h"
|
2011-12-10 06:11:31 +00:00
|
|
|
#include "usb_serial/usb_serial.h"
|
2011-12-08 05:17:47 +00:00
|
|
|
|
2011-11-26 07:10:30 +00:00
|
|
|
int main(void)
|
|
|
|
{
|
2011-12-10 06:11:31 +00:00
|
|
|
cli();
|
|
|
|
|
2011-12-08 05:17:47 +00:00
|
|
|
DDRD |= (1 << 7);
|
|
|
|
PORTD &= ~(1 << 7);
|
|
|
|
|
2011-12-14 05:56:20 +00:00
|
|
|
if (MCUSR & (1 << BORF))
|
|
|
|
{
|
|
|
|
MCUSR = 0;
|
|
|
|
PORTD |= (1 << 7);
|
|
|
|
_delay_ms(500);
|
|
|
|
PORTD &= ~(1 << 7);
|
|
|
|
}
|
|
|
|
|
2011-12-10 18:35:41 +00:00
|
|
|
ExternalMem_Init();
|
|
|
|
ExternalMem_SetAddress(0);
|
2011-12-12 05:48:26 +00:00
|
|
|
ExternalMem_Assert(SIMM_CS | SIMM_OE);
|
|
|
|
ExternalMem_Deassert(SIMM_WE);
|
2011-12-10 06:11:31 +00:00
|
|
|
USBSerial_Init();
|
|
|
|
sei();
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
USBSerial_Check();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*int result = SIMMElectricalTest_Run();
|
2011-12-08 05:17:47 +00:00
|
|
|
|
|
|
|
if (result == 0)
|
|
|
|
{
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
_delay_ms(200);
|
|
|
|
PIND = (1 << 7);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
int tmpResult = result;
|
|
|
|
|
|
|
|
while (tmpResult)
|
|
|
|
{
|
|
|
|
int thisDigit = (tmpResult % 10) + 1;
|
|
|
|
|
|
|
|
while (thisDigit--)
|
|
|
|
{
|
|
|
|
PIND = (1 << 7);
|
|
|
|
_delay_ms(500);
|
|
|
|
PIND = (1 << 7);
|
|
|
|
_delay_ms(500);
|
|
|
|
}
|
|
|
|
|
|
|
|
_delay_ms(2000);
|
|
|
|
|
|
|
|
tmpResult /= 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
_delay_ms(5000);
|
|
|
|
}
|
2011-12-10 06:11:31 +00:00
|
|
|
}*/
|
2011-11-26 07:10:30 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|