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
|
|
|
*
|
2020-11-23 06:28:47 +00:00
|
|
|
* Copyright (C) 2011-2020 Doug Brown
|
2012-05-26 03:21:04 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
2020-11-18 05:03:32 +00:00
|
|
|
* -----------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* TODO: Add smarter short detection? Automatically run an electrical test at
|
|
|
|
* startup and leave everything in input mode if shorts are detected?
|
|
|
|
* I'm especially thinking about the case of SIMM control pins shorted
|
|
|
|
* together, like CS and OE, which will default to opposite output values.
|
|
|
|
* Is this even worth implementing? It's probably only useful when testing
|
|
|
|
* newly-built SIMMs. We would need to implement a protocol for this so
|
|
|
|
* the programmer software can be alerted that a short was detected.
|
2011-11-26 07:10:30 +00:00
|
|
|
*/
|
|
|
|
|
2020-11-18 05:03:32 +00:00
|
|
|
#include "hal/board.h"
|
|
|
|
#include "hardware.h"
|
|
|
|
#include "hal/parallel_bus.h"
|
2011-12-08 05:17:47 +00:00
|
|
|
#include "tests/simm_electrical_test.h"
|
2020-11-18 05:03:32 +00:00
|
|
|
#include "simm_programmer.h"
|
2012-05-27 22:41:16 +00:00
|
|
|
#include "led.h"
|
2011-12-08 05:17:47 +00:00
|
|
|
|
2020-11-18 05:03:32 +00:00
|
|
|
/** Main function
|
|
|
|
*
|
|
|
|
* @return Never; the main loop is an infinite loop.
|
|
|
|
*/
|
2011-11-26 07:10:30 +00:00
|
|
|
int main(void)
|
|
|
|
{
|
2020-11-18 05:03:32 +00:00
|
|
|
DisableInterrupts();
|
|
|
|
Board_Init();
|
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
|
2020-11-18 05:03:32 +00:00
|
|
|
if (Board_BrownoutDetected())
|
2011-12-14 05:56:20 +00:00
|
|
|
{
|
2012-05-27 22:41:16 +00:00
|
|
|
LED_On();
|
2020-11-18 05:03:32 +00:00
|
|
|
DelayMS(500);
|
2012-05-27 22:41:16 +00:00
|
|
|
LED_Off();
|
2011-12-14 05:56:20 +00:00
|
|
|
}
|
|
|
|
|
2020-11-18 05:03:32 +00:00
|
|
|
// Initialize everything and turn on interrupts
|
|
|
|
ParallelBus_Init();
|
|
|
|
SIMMProgrammer_Init();
|
|
|
|
EnableInterrupts();
|
2011-12-10 06:11:31 +00:00
|
|
|
|
2020-11-18 05:03:32 +00:00
|
|
|
// Main loop
|
2011-12-10 06:11:31 +00:00
|
|
|
while (1)
|
|
|
|
{
|
2020-11-18 05:03:32 +00:00
|
|
|
SIMMProgrammer_Check();
|
2011-12-10 06:11:31 +00:00
|
|
|
}
|
|
|
|
|
2011-11-26 07:10:30 +00:00
|
|
|
return 0;
|
|
|
|
}
|