mirror of
git://projects.qi-hardware.com/f32xbase.git
synced 2025-04-21 12:27:27 +03:00
Move platform-specific boot loader configuration into macros.
- fw/boot/boot.c (boot_loader): moved GTA-specific pull-up disable and I2C_SDA_PULL enable into macro PLATFORM_SETUP - fw/boot/boot.c (run_payload): moved GTA-specific pull-up enable and I2C_SDA_PULL disable into macro PLATFORM_EXIT - fw/boot/boot.c (boot_loader): moved GTA-specific I2C_SDA probe into macro PLATFORM_TEST - fw/common/Makefile.common: removed all references to dependencies on .target. The caller is now responsible for these. - fw/boot/dfu.c: don't include idbg/usb-ids.h; USB_VENDOR and USB_PRODUCT are now passed via macros
This commit is contained in:
@@ -27,22 +27,44 @@
|
||||
#include "dfu.h"
|
||||
|
||||
|
||||
/*
|
||||
* GTA example:
|
||||
*
|
||||
|
||||
#define PLATFORM_SETUP \
|
||||
GPIOCN |= WEAKPUD; \
|
||||
I2C_SDA_PULL = 0; \
|
||||
delay();
|
||||
|
||||
// Re-enable pull-ups
|
||||
// Don't waste power in pull-down
|
||||
#define PLATFORM_EXIT \
|
||||
GPIOCN &= ~WEAKPUD; \
|
||||
I2C_SDA_PULL = 1;
|
||||
|
||||
#define PLATFORM_TEST \
|
||||
(!I2C_SDA || dfu.state != dfuIDLE)
|
||||
*/
|
||||
|
||||
#ifndef PLATFORM_SETUP
|
||||
#define PLATFORM_SETUP
|
||||
#endif
|
||||
|
||||
#ifndef PLATFORM_EXIT
|
||||
#define PLATFORM_EXIT
|
||||
#endif
|
||||
|
||||
|
||||
void run_payload(void)
|
||||
{
|
||||
PLAYFORM_EXIT;
|
||||
|
||||
/* No interrupts while jumping between worlds */
|
||||
EA = 0;
|
||||
|
||||
/* Restart USB */
|
||||
USB0XCN = 0;
|
||||
|
||||
/* Re-enable pull-ups */
|
||||
GPIOCN &= ~WEAKPUD;
|
||||
|
||||
#ifdef GTA
|
||||
/* Don't waste power in pull-down */
|
||||
I2C_SDA_PULL = 1;
|
||||
#endif
|
||||
|
||||
debug("launching payload\n");
|
||||
|
||||
__asm
|
||||
@@ -182,21 +204,17 @@ static void boot_loader(void)
|
||||
* the GTA01/02, once the system is powered up, IDBG exits this loop.
|
||||
*/
|
||||
|
||||
GPIOCN |= WEAKPUD;
|
||||
#ifdef GTA
|
||||
I2C_SDA_PULL = 0;
|
||||
#endif
|
||||
delay();
|
||||
BOOT_SETUP;
|
||||
|
||||
dfu_init();
|
||||
usb_init();
|
||||
|
||||
#ifdef GTA
|
||||
#ifdef PLATFORM_TEST
|
||||
|
||||
while (!I2C_SDA || dfu.state != dfuIDLE)
|
||||
while (PLATFORM_TEST)
|
||||
usb_poll();
|
||||
|
||||
#else /* GTA */
|
||||
#else /* PLATFORM_TEST */
|
||||
|
||||
#define MS_TO_LOOPS(ms) ((uint32_t) (ms)*190)
|
||||
|
||||
@@ -211,7 +229,7 @@ static void boot_loader(void)
|
||||
loop = 0;
|
||||
}
|
||||
}
|
||||
#endif /* !GTA */
|
||||
#endif /* !PLATFORM_TEST */
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include "uart.h"
|
||||
#include "usb.h"
|
||||
#include "dfu.h"
|
||||
#include "idbg/usb-ids.h"
|
||||
|
||||
|
||||
#ifndef NULL
|
||||
|
||||
Reference in New Issue
Block a user