Whitespace cleanup.
This commit is contained in:
parent
60626e5bbe
commit
a5549d630c
|
@ -97,12 +97,15 @@ extern usbd_device *usbdev;
|
|||
#define LED_ERROR GPIO14
|
||||
#define LED_BOOTLOADER GPIO15
|
||||
|
||||
#define TMS_SET_MODE() gpio_mode_setup(TMS_PORT, GPIO_MODE_OUTPUT, \
|
||||
#define TMS_SET_MODE() \
|
||||
gpio_mode_setup(TMS_PORT, GPIO_MODE_OUTPUT, \
|
||||
GPIO_PUPD_NONE, TMS_PIN);
|
||||
#define SWDIO_MODE_FLOAT() gpio_mode_setup(SWDIO_PORT, GPIO_MODE_INPUT, \
|
||||
#define SWDIO_MODE_FLOAT() \
|
||||
gpio_mode_setup(SWDIO_PORT, GPIO_MODE_INPUT, \
|
||||
GPIO_PUPD_NONE, SWDIO_PIN);
|
||||
|
||||
#define SWDIO_MODE_DRIVE() gpio_mode_setup(SWDIO_PORT, GPIO_MODE_OUTPUT, \
|
||||
#define SWDIO_MODE_DRIVE() \
|
||||
gpio_mode_setup(SWDIO_PORT, GPIO_MODE_OUTPUT, \
|
||||
GPIO_PUPD_NONE, SWDIO_PIN);
|
||||
|
||||
|
||||
|
|
|
@ -62,14 +62,15 @@ void swdptap_reset(void)
|
|||
{
|
||||
swdptap_turnaround(0);
|
||||
/* 50 clocks with TMS high */
|
||||
for(int i = 0; i < 50; i++) swdptap_bit_out(1);
|
||||
for(int i = 0; i < 50; i++)
|
||||
swdptap_bit_out(1);
|
||||
}
|
||||
|
||||
static void swdptap_turnaround(uint8_t dir)
|
||||
{
|
||||
static uint8_t olddir = 0;
|
||||
|
||||
//DEBUG("%s", dir ? "\n-> ":"\n<- ");
|
||||
/*DEBUG("%s", dir ? "\n-> ":"\n<- ");*/
|
||||
platform_buffer_flush();
|
||||
|
||||
if(dir == olddir) return;
|
||||
|
|
|
@ -115,8 +115,7 @@ int platform_init(void)
|
|||
if (platform_hwversion () > 0) {
|
||||
gpio_set (PWR_BR_PORT, PWR_BR_PIN);
|
||||
gpio_set_mode(PWR_BR_PORT, GPIO_MODE_INPUT,
|
||||
GPIO_CNF_INPUT_PULL_UPDOWN,
|
||||
PWR_BR_PIN);
|
||||
GPIO_CNF_INPUT_PULL_UPDOWN, PWR_BR_PIN);
|
||||
}
|
||||
|
||||
/* Setup heartbeat timer */
|
||||
|
@ -134,15 +133,16 @@ int platform_init(void)
|
|||
gpio_set_mode(GPIOB, GPIO_MODE_INPUT,
|
||||
GPIO_CNF_INPUT_PULL_UPDOWN, GPIO0);
|
||||
}
|
||||
|
||||
SCB_VTOR = 0x2000; // Relocate interrupt vector table here
|
||||
/* Relocate interrupt vector table here */
|
||||
SCB_VTOR = 0x2000;
|
||||
|
||||
cdcacm_init();
|
||||
usbuart_init();
|
||||
|
||||
// Set recovery point
|
||||
/* Set recovery point */
|
||||
if (setjmp(fatal_error_jmpbuf)) {
|
||||
return 0; // Do nothing on failure
|
||||
/* Do nothing on failure */
|
||||
return 0;
|
||||
}
|
||||
|
||||
jtag_scan(NULL);
|
||||
|
@ -162,7 +162,7 @@ bool platform_target_get_power(void) {
|
|||
if (platform_hwversion() > 0) {
|
||||
return gpio_get(PWR_BR_PORT, PWR_BR_PIN);
|
||||
}
|
||||
return 1; // 1 = Unpowered
|
||||
return 1; /* 1 = Unpowered */
|
||||
}
|
||||
void platform_target_set_power(bool power)
|
||||
{
|
||||
|
|
|
@ -52,8 +52,7 @@ int platform_hwversion(void)
|
|||
int i;
|
||||
if (hwversion == -1) {
|
||||
gpio_set_mode(GPIOC, GPIO_MODE_INPUT,
|
||||
GPIO_CNF_INPUT_PULL_UPDOWN,
|
||||
GPIO14 | GPIO13);
|
||||
GPIO_CNF_INPUT_PULL_UPDOWN, GPIO14 | GPIO13);
|
||||
gpio_set(GPIOC, GPIO14 | GPIO13);
|
||||
for (i = 0; i<10; i++)
|
||||
hwversion = ~(gpio_get(GPIOC, GPIO14 | GPIO13) >> 13) & 3;
|
||||
|
@ -86,7 +85,7 @@ int platform_init(void)
|
|||
*/
|
||||
if (platform_hwversion() == 1)
|
||||
{
|
||||
RCC_CFGR &= ~( 0xf<< 24);
|
||||
RCC_CFGR &= ~(0xf << 24);
|
||||
RCC_CFGR |= (RCC_CFGR_MCO_HSECLK << 24);
|
||||
gpio_set_mode(GPIOA, GPIO_MODE_OUTPUT_50_MHZ,
|
||||
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO8);
|
||||
|
@ -117,13 +116,14 @@ int platform_init(void)
|
|||
|
||||
usbuart_init();
|
||||
|
||||
SCB_VTOR = 0x2000; // Relocate interrupt vector table here
|
||||
SCB_VTOR = 0x2000; /* Relocate interrupt vector table here */
|
||||
|
||||
cdcacm_init();
|
||||
|
||||
// Set recovery point
|
||||
/* Set recovery point */
|
||||
if (setjmp(fatal_error_jmpbuf)) {
|
||||
return 0; // Do nothing on failure
|
||||
/* Do nothing on failure */
|
||||
return 0;
|
||||
}
|
||||
|
||||
jtag_scan(NULL);
|
||||
|
@ -134,7 +134,7 @@ int platform_init(void)
|
|||
void platform_delay(uint32_t delay)
|
||||
{
|
||||
timeout_counter = delay;
|
||||
while(timeout_counter);
|
||||
while (timeout_counter);
|
||||
}
|
||||
|
||||
void platform_srst_set_val(bool assert)
|
||||
|
@ -192,4 +192,8 @@ void assert_boot_pin(void)
|
|||
crl |= 0x80;
|
||||
GPIOA_CRL = crl;
|
||||
}
|
||||
void setup_vbus_irq(void){};
|
||||
|
||||
void setup_vbus_irq(void)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -209,3 +209,4 @@ static inline uint16_t _gpio_get(uint32_t gpioport, uint16_t gpios)
|
|||
|
||||
void disconnect_usb(void);
|
||||
void assert_boot_pin(void);
|
||||
|
||||
|
|
|
@ -28,13 +28,17 @@
|
|||
|
||||
#include "usbdfu.h"
|
||||
|
||||
static uint32_t sector_addr[] = {0x8000000, 0x8004000, 0x8008000, 0x800c000,
|
||||
static uint32_t sector_addr[] = {
|
||||
0x8000000, 0x8004000, 0x8008000, 0x800c000,
|
||||
0x8010000, 0x8020000, 0x8040000, 0x8060000,
|
||||
0x8080000, 0x80a0000, 0x80c0000, 0x80e0000,
|
||||
0x8100000, 0};
|
||||
static uint16_t sector_erase_time[12]= {500, 500, 500, 500,
|
||||
1100,
|
||||
2600, 2600, 2600, 2600, 2600, 2600, 2600};
|
||||
0x8100000, 0
|
||||
};
|
||||
static uint16_t sector_erase_time[12]= {
|
||||
500, 500, 500, 500,
|
||||
1100, 2600, 2600, 2600,
|
||||
2600, 2600, 2600, 2600
|
||||
};
|
||||
static uint8_t sector_num = 0xff;
|
||||
|
||||
/* Find the sector number for a given address*/
|
||||
|
@ -61,8 +65,7 @@ void dfu_check_and_do_sector_erase(uint32_t addr)
|
|||
void dfu_flash_program_buffer(uint32_t baseaddr, void *buf, int len)
|
||||
{
|
||||
for(int i = 0; i < len; i += 4)
|
||||
flash_program_word(baseaddr + i,
|
||||
*(uint32_t*)(buf+i),
|
||||
flash_program_word(baseaddr + i, *(uint32_t*)(buf+i),
|
||||
FLASH_PROGRAM_X32);
|
||||
}
|
||||
|
||||
|
|
|
@ -166,8 +166,7 @@ usbdfu_getstatus_complete(usbd_device *dev, struct usb_setup_data *req)
|
|||
flash_unlock();
|
||||
if(prog.blocknum == 0) {
|
||||
uint32_t addr = get_le32(prog.buf + 1);
|
||||
if (addr < app_address ||
|
||||
(addr >= max_address)) {
|
||||
if ((addr < app_address) || (addr >= max_address)) {
|
||||
flash_lock();
|
||||
usbd_ep_stall_set(dev, 0, 1);
|
||||
return;
|
||||
|
@ -282,17 +281,17 @@ void dfu_main(void)
|
|||
static char *get_dev_unique_id(char *s)
|
||||
{
|
||||
#if defined(STM32F4) || defined(STM32F2)
|
||||
#define UNIQUE_SERIAL_R 0x1FFF7A10
|
||||
#define FLASH_SIZE_R 0x1fff7A22
|
||||
# define UNIQUE_SERIAL_R 0x1FFF7A10
|
||||
# define FLASH_SIZE_R 0x1fff7A22
|
||||
#elif defined(STM32F3)
|
||||
#define UNIQUE_SERIAL_R 0x1FFFF7AC
|
||||
#define FLASH_SIZE_R 0x1fff77cc
|
||||
# define UNIQUE_SERIAL_R 0x1FFFF7AC
|
||||
# define FLASH_SIZE_R 0x1fff77cc
|
||||
#elif defined(STM32L1)
|
||||
#define UNIQUE_SERIAL_R 0x1ff80050
|
||||
#define FLASH_SIZE_R 0x1FF8004C
|
||||
# define UNIQUE_SERIAL_R 0x1ff80050
|
||||
# define FLASH_SIZE_R 0x1FF8004C
|
||||
#else
|
||||
#define UNIQUE_SERIAL_R 0x1FFFF7E8;
|
||||
#define FLASH_SIZE_R 0x1ffff7e0
|
||||
# define UNIQUE_SERIAL_R 0x1FFFF7E8;
|
||||
# define FLASH_SIZE_R 0x1ffff7e0
|
||||
#endif
|
||||
volatile uint32_t *unique_id_p = (volatile uint32_t *)UNIQUE_SERIAL_R;
|
||||
uint32_t unique_id = *unique_id_p +
|
||||
|
|
|
@ -77,12 +77,12 @@ void gdb_usb_out_cb(usbd_device *dev, uint8_t ep)
|
|||
unsigned char gdb_if_getchar(void)
|
||||
{
|
||||
|
||||
while(!(out_ptr < count_out)) {
|
||||
while (!(out_ptr < count_out)) {
|
||||
/* Detach if port closed */
|
||||
if(!cdcacm_get_dtr())
|
||||
if (!cdcacm_get_dtr())
|
||||
return 0x04;
|
||||
|
||||
while(cdcacm_get_config() != 1);
|
||||
while (cdcacm_get_config() != 1);
|
||||
if (count_new) {
|
||||
memcpy(buffer_out, double_buffer_out,count_new);
|
||||
count_out = count_new;
|
||||
|
@ -99,12 +99,12 @@ unsigned char gdb_if_getchar_to(int timeout)
|
|||
{
|
||||
timeout_counter = timeout/100;
|
||||
|
||||
if(!(out_ptr < count_out)) do {
|
||||
if (!(out_ptr < count_out)) do {
|
||||
/* Detach if port closed */
|
||||
if(!cdcacm_get_dtr())
|
||||
if (!cdcacm_get_dtr())
|
||||
return 0x04;
|
||||
|
||||
while(cdcacm_get_config() != 1);
|
||||
while (cdcacm_get_config() != 1);
|
||||
if (count_new) {
|
||||
memcpy(buffer_out, double_buffer_out,count_new);
|
||||
count_out = count_new;
|
||||
|
|
|
@ -96,12 +96,11 @@ extern usbd_device *usbdev;
|
|||
gpio_set_mode(SWDIO_PORT, GPIO_MODE_OUTPUT_50_MHZ, \
|
||||
GPIO_CNF_OUTPUT_PUSHPULL, SWDIO_PIN);
|
||||
|
||||
#define UART_PIN_SETUP() do \
|
||||
{ \
|
||||
#define UART_PIN_SETUP() do { \
|
||||
AFIO_MAPR |= AFIO_MAPR_USART1_REMAP; \
|
||||
gpio_set_mode(USBUSART_PORT, GPIO_MODE_OUTPUT_2_MHZ, \
|
||||
GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, USBUSART_TX_PIN); \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
#define USB_DRIVER stm32f103_usb_driver
|
||||
#define USB_IRQ NVIC_USB_LP_CAN_RX0_IRQ
|
||||
|
|
Loading…
Reference in New Issue