Skip to content

Commit a39f160

Browse files
committed
Format code according to conventions
1 parent 6f81880 commit a39f160

File tree

15 files changed

+37
-46
lines changed

15 files changed

+37
-46
lines changed

platforms/arm_atsam/bootloaders/md_boot.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
// WARNING: These are only for CTRL bootloader release "v2.18Jun 22 2018 17:28:08" for bootloader_jump support
2323
extern uint32_t _eram;
2424

25-
#define BOOTLOADER_MAGIC 0x3B9ACA00
26-
#define MAGIC_ADDR (uint32_t *)((intptr_t)(&_eram) - 4)
25+
# define BOOTLOADER_MAGIC 0x3B9ACA00
26+
# define MAGIC_ADDR (uint32_t *)((intptr_t)(&_eram) - 4)
2727

2828
// CTRL keyboards released with bootloader version below must use RAM method. Otherwise use WDT method.
2929
void bootloader_jump(void) {
@@ -40,7 +40,8 @@ void bootloader_jump(void) {
4040
*MAGIC_ADDR = BOOTLOADER_MAGIC; // Set magic number into RAM
4141
NVIC_SystemReset(); // Perform system reset
4242

43-
while (1); // Won't get here
43+
while (1)
44+
; // Won't get here
4445
}
4546
}
4647

@@ -50,17 +51,22 @@ void bootloader_jump(void) {
5051
void bootloader_jump(void) {
5152
WDT->CTRLA.bit.ENABLE = 0;
5253

53-
while (WDT->SYNCBUSY.bit.ENABLE);
54-
while (WDT->CTRLA.bit.ENABLE);
54+
while (WDT->SYNCBUSY.bit.ENABLE)
55+
;
56+
while (WDT->CTRLA.bit.ENABLE)
57+
;
5558

5659
WDT->CONFIG.bit.WINDOW = 0;
5760
WDT->CONFIG.bit.PER = 0;
5861
WDT->EWCTRL.bit.EWOFFSET = 0;
5962
WDT->CTRLA.bit.ENABLE = 1;
6063

61-
while (WDT->SYNCBUSY.bit.ENABLE);
62-
while (!WDT->CTRLA.bit.ENABLE);
64+
while (WDT->SYNCBUSY.bit.ENABLE)
65+
;
66+
while (!WDT->CTRLA.bit.ENABLE)
67+
;
6368

64-
while (1); // Wait on timeout
69+
while (1)
70+
; // Wait on timeout
6571
}
6672
#endif

platforms/avr/bootloaders/bootloadhid.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
#include <avr/eeprom.h>
2020
#include <avr/wdt.h>
2121

22-
__attribute__((weak))
23-
void bootloader_jump(void) {
22+
__attribute__((weak)) void bootloader_jump(void) {
2423
// force bootloadHID to stay in bootloader mode, so that it waits
2524
// for a new firmware to be flashed
2625
// NOTE: this byte is part of QMK's "magic number" - changing it causes the EEPROM to be re-initialized

platforms/avr/bootloaders/caterina.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818

1919
#include <avr/wdt.h>
2020

21-
__attribute__((weak))
22-
void bootloader_jump(void) {
21+
__attribute__((weak)) void bootloader_jump(void) {
2322
// this block may be optional
2423
// TODO: figure it out
2524

@@ -35,5 +34,6 @@ void bootloader_jump(void) {
3534
wdt_enable(WDTO_60MS);
3635

3736
// wait for watchdog timer to trigger
38-
while (1) { }
37+
while (1) {
38+
}
3939
}

platforms/avr/bootloaders/dfu.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@
2828
#define BOOTLOADER_RESET_KEY 0xB007B007
2929
uint32_t reset_key __attribute__((section(".noinit,\"aw\",@nobits;")));
3030

31-
__attribute__((weak))
32-
void bootloader_jump(void) {
31+
__attribute__((weak)) void bootloader_jump(void) {
3332
UDCON = 1;
3433
USBCON = (1 << FRZCLK); // disable USB
3534
UCSR1B = 0;

platforms/avr/bootloaders/halfkay.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
#include <avr/interrupt.h>
2020
#include <util/delay.h>
2121

22-
__attribute__((weak))
23-
void bootloader_jump(void) {
22+
__attribute__((weak)) void bootloader_jump(void) {
2423
// http://www.pjrc.com/teensy/jump_to_bootloader.html
2524

2625
cli();

platforms/avr/bootloaders/none.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,4 @@
1616

1717
#include "bootloader.h"
1818

19-
__attribute__((weak))
20-
void bootloader_jump(void) { }
19+
__attribute__((weak)) void bootloader_jump(void) {}

platforms/avr/bootloaders/usbasploader.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
# endif
2727
#endif
2828

29-
__attribute__((weak))
30-
void bootloader_jump(void) {
29+
__attribute__((weak)) void bootloader_jump(void) {
3130
// Taken with permission of Stephan Baerwolf from https://github.com/tinyusbboard/API/blob/master/apipage.c
3231

3332
wdt_enable(WDTO_15MS);

platforms/chibios/bootloaders/gd32v_dfu.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
__IO uint32_t *DBGMCU_KEY = (uint32_t *)DBGMCU_BASE + 0x0CU;
2525
__IO uint32_t *DBGMCU_CMD = (uint32_t *)DBGMCU_BASE + 0x08U;
2626

27-
__attribute__((weak))
28-
void bootloader_jump(void) {
27+
__attribute__((weak)) void bootloader_jump(void) {
2928
/* The MTIMER unit of the GD32VF103 doesn't have the MSFRST
3029
* register to generate a software reset request.
3130
* BUT instead two undocumented registers in the debug peripheral
@@ -37,4 +36,4 @@ void bootloader_jump(void) {
3736
}
3837

3938
/* Jumping to bootloader is not possible from user code. */
40-
void enter_bootloader_mode_if_requested(void) { }
39+
void enter_bootloader_mode_if_requested(void) {}

platforms/chibios/bootloaders/halfkay.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
#include <ch.h>
2020
#include "wait.h"
2121

22-
__attribute__((weak))
23-
void bootloader_jump(void) {
22+
__attribute__((weak)) void bootloader_jump(void) {
2423
wait_ms(100);
2524
__BKPT(0);
2625
}

platforms/chibios/bootloaders/kiibohd.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323

2424
const uint8_t sys_reset_to_loader_magic[] = "\xff\x00\x7fRESET TO LOADER\x7f\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
2525

26-
__attribute__((weak))
27-
void bootloader_jump(void) {
26+
__attribute__((weak)) void bootloader_jump(void) {
2827
void *volatile vbat = (void *)VBAT;
2928
__builtin_memcpy(vbat, (const void *)sys_reset_to_loader_magic, sizeof(sys_reset_to_loader_magic));
3029

platforms/chibios/bootloaders/none.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,4 @@
1616

1717
#include "bootloader.h"
1818

19-
__attribute__((weak))
20-
void bootloader_jump(void) { }
19+
__attribute__((weak)) void bootloader_jump(void) {}

platforms/chibios/bootloaders/stm32_dfu.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ extern uint32_t __ram0_end__;
4141
# define STM32_BOOTLOADER_DUAL_BANK_DELAY 100000
4242
# endif
4343

44-
__attribute__((weak))
45-
void bootloader_jump(void) {
44+
__attribute__((weak)) void bootloader_jump(void) {
4645
// For STM32 MCUs with dual-bank flash, and we're incapable of jumping to the bootloader. The first valid flash
4746
// bank is executed unconditionally after a reset, so it doesn't enter DFU unless BOOT0 is high. Instead, we do
4847
// it with hardware...in this case, we pull a GPIO high/low depending on the configuration, connects 3.3V to
@@ -63,17 +62,16 @@ void bootloader_jump(void) {
6362
}
6463

6564
// not needed at all, but if anybody attempts to invoke it....
66-
void enter_bootloader_mode_if_requested(void) { }
65+
void enter_bootloader_mode_if_requested(void) {}
6766

6867
#else
6968

7069
/* This code should be checked whether it runs correctly on platforms */
71-
#define SYMVAL(sym) (uint32_t)(((uint8_t *)&(sym)) - ((uint8_t *)0))
72-
#define BOOTLOADER_MAGIC 0xDEADBEEF
73-
#define MAGIC_ADDR (unsigned long *)(SYMVAL(__ram0_end__) - 4)
70+
# define SYMVAL(sym) (uint32_t)(((uint8_t *)&(sym)) - ((uint8_t *)0))
71+
# define BOOTLOADER_MAGIC 0xDEADBEEF
72+
# define MAGIC_ADDR (unsigned long *)(SYMVAL(__ram0_end__) - 4)
7473

75-
__attribute__((weak))
76-
void bootloader_jump(void) {
74+
__attribute__((weak)) void bootloader_jump(void) {
7775
*MAGIC_ADDR = BOOTLOADER_MAGIC; // set magic flag => reset handler will jump into boot loader
7876
NVIC_SystemReset();
7977
}

platforms/chibios/bootloaders/stm32duino.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,4 @@
1818

1919
#include <ch.h>
2020

21-
__attribute__((weak))
22-
void bootloader_jump(void) {
23-
NVIC_SystemReset();
24-
}
21+
__attribute__((weak)) void bootloader_jump(void) { NVIC_SystemReset(); }

platforms/chibios/bootloaders/tinyuf2.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@
2525
extern uint32_t _board_dfu_dbl_tap[];
2626
#define DBL_TAP_REG _board_dfu_dbl_tap[0]
2727

28-
__attribute__((weak))
29-
void bootloader_jump(void) {
28+
__attribute__((weak)) void bootloader_jump(void) {
3029
DBL_TAP_REG = DBL_TAP_MAGIC;
3130
NVIC_SystemReset();
3231
}
3332

3433
/* not needed, no two-stage reset */
35-
void enter_bootloader_mode_if_requested(void) { }
34+
void enter_bootloader_mode_if_requested(void) {}

platforms/test/bootloaders/none.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616

1717
#include "bootloader.h"
1818

19-
void bootloader_jump(void) { }
19+
void bootloader_jump(void) {}

0 commit comments

Comments
 (0)