Whitespace cleanup.

This commit is contained in:
Gareth McMullin 2014-10-16 13:19:34 -07:00
parent 60626e5bbe
commit a5549d630c
19 changed files with 281 additions and 271 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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)
{

View File

@ -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;
@ -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);
@ -192,4 +192,8 @@ void assert_boot_pin(void)
crl |= 0x80;
GPIOA_CRL = crl;
}
void setup_vbus_irq(void){};
void setup_vbus_irq(void)
{
}

View File

@ -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);

View File

@ -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);
}

View File

@ -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;

View File

@ -96,8 +96,7 @@ 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); \