mirror of
https://github.com/dougg3/mac-rom-simm-programmer.git
synced 2024-11-28 00:50:17 +00:00
Break out bootloader entry into HAL
For some reason, I didn't have this as part of the HAL, so the main program still had AVR dependencies.
This commit is contained in:
parent
8aec8807c9
commit
14cf8505f7
@ -27,6 +27,8 @@
|
||||
|
||||
#include "gpio_hw.h"
|
||||
#include "../gpio.h"
|
||||
#include "hardware.h"
|
||||
#include "../usbcdc.h"
|
||||
|
||||
/** Gets the GPIO pin on the board that controls the status LED
|
||||
*
|
||||
@ -37,4 +39,26 @@ static inline GPIOPin Board_LEDPin(void)
|
||||
return GPIO_PIN(GPIOD, 7);
|
||||
}
|
||||
|
||||
/** Jumps to the bootloader
|
||||
*
|
||||
*/
|
||||
static inline void Board_EnterBootloader(void)
|
||||
{
|
||||
// Insert a small delay to ensure that it arrives before rebooting.
|
||||
DelayMS(1000);
|
||||
|
||||
// Done with the USB interface -- the bootloader will re-initialize it.
|
||||
USBCDC_Disable();
|
||||
|
||||
// Disable interrupts so nothing weird happens...
|
||||
DisableInterrupts();
|
||||
|
||||
// Wait a little bit to let everything settle and let the program
|
||||
// close the port after the USB disconnect
|
||||
DelayMS(2000);
|
||||
|
||||
// And, of course, go into the bootloader.
|
||||
__asm__ __volatile__ ( "jmp 0xE000" );
|
||||
}
|
||||
|
||||
#endif /* HAL_AT90USB646_BOARD_HW_H_ */
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
// Commented-out functions should be static inline in each board-specific header file.
|
||||
//GPIOPin Board_LEDPin(void);
|
||||
//void Board_EnterBootloader(void);
|
||||
#include "board_hw.h"
|
||||
|
||||
void Board_Init(void);
|
||||
|
@ -229,22 +229,8 @@ static void SIMMProgrammer_HandleWaitingForCommandByte(uint8_t byte)
|
||||
USBCDC_SendByte(CommandReplyOK);
|
||||
// Force this to be sent immediately so the programmer software knows.
|
||||
USBCDC_Flush();
|
||||
|
||||
// Insert a small delay to ensure that it arrives before rebooting.
|
||||
DelayMS(1000);
|
||||
|
||||
// Done with the USB interface -- the bootloader will re-initialize it.
|
||||
USBCDC_Disable();
|
||||
|
||||
// Disable interrupts so nothing weird happens...
|
||||
cli();
|
||||
|
||||
// Wait a little bit to let everything settle and let the program
|
||||
// close the port after the USB disconnect
|
||||
DelayMS(2000);
|
||||
|
||||
// And, of course, go into the bootloader.
|
||||
__asm__ __volatile__ ( "jmp 0xE000" );
|
||||
// Now enter the bootloader
|
||||
Board_EnterBootloader();
|
||||
break;
|
||||
// Enter the programmer. We're already there, so reply OK.
|
||||
case EnterProgrammer:
|
||||
|
Loading…
Reference in New Issue
Block a user