mac-rom-simm-programmer/main.c
Doug Brown 3fd01f77d8 Continue implementing PC build
The PC build now brings up an empty Qt window. It also runs the
programmer firmware in the background in another thread. This also adds
a shell script you can use to create the USB gadget.
2021-07-25 16:21:36 -07:00

76 lines
2.2 KiB
C

/*
* main.c
*
* Created on: Nov 25, 2011
* Author: Doug
*
* Copyright (C) 2011-2020 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.
*
* -----------------------------------------------------------------------------
*
* 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.
*/
#include "hal/board.h"
#include "hardware.h"
#include "hal/parallel_bus.h"
#include "tests/simm_electrical_test.h"
#include "simm_programmer.h"
#include "led.h"
/** Main function
*
* @return Never; the main loop is an infinite loop.
*/
#if !IS_PC_BUILD
int main(void)
#else
int programmer_thread_main(void)
#endif
{
DisableInterrupts();
Board_Init();
LED_Init();
// If there was a brownout detected, turn on the LED momentarily
if (Board_BrownoutDetected())
{
LED_On();
DelayMS(500);
LED_Off();
}
// Initialize everything and turn on interrupts
ParallelBus_Init();
SIMMProgrammer_Init();
EnableInterrupts();
// Main loop
while (1)
{
SIMMProgrammer_Check();
}
return 0;
}