2011-11-26 07:10:30 +00:00
|
|
|
/*
|
|
|
|
* main.c
|
|
|
|
*
|
|
|
|
* Created on: Nov 25, 2011
|
|
|
|
* Author: Doug
|
2012-05-26 03:21:04 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2011-2012 Doug Brown
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*
|
2011-11-26 07:10:30 +00:00
|
|
|
*/
|
|
|
|
|
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"
|
2012-05-27 22:41:16 +00:00
|
|
|
#include "led.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();
|
|
|
|
|
2012-05-27 22:41:16 +00:00
|
|
|
LED_Init();
|
2011-12-08 05:17:47 +00:00
|
|
|
|
2012-01-27 04:42:42 +00:00
|
|
|
// If there was a brownout detected, turn on the LED momentarily
|
2011-12-14 05:56:20 +00:00
|
|
|
if (MCUSR & (1 << BORF))
|
|
|
|
{
|
|
|
|
MCUSR = 0;
|
2012-05-27 22:41:16 +00:00
|
|
|
LED_On();
|
2011-12-14 05:56:20 +00:00
|
|
|
_delay_ms(500);
|
2012-05-27 22:41:16 +00:00
|
|
|
LED_Off();
|
2011-12-14 05:56:20 +00:00
|
|
|
}
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
2011-11-26 07:10:30 +00:00
|
|
|
return 0;
|
|
|
|
}
|