summaryrefslogtreecommitdiff
path: root/platforms
diff options
context:
space:
mode:
authorQMK Bot <hello@qmk.fm>2021-12-27 02:20:52 -0800
committerGitHub <noreply@github.com>2021-12-27 21:20:52 +1100
commitbe2265d0d173ac347f0ee9ed809c2a689bf835a2 (patch)
tree97c03e4d12b12e4d2e902efe8a7ab98174dfee5c /platforms
parent1127e0da6b9b88b52a5d4ca33489f5ea5343b00f (diff)
Format code according to conventions (#15593)
Diffstat (limited to 'platforms')
-rw-r--r--platforms/arm_atsam/bootloaders/md_boot.c22
-rw-r--r--platforms/avr/bootloaders/bootloadhid.c3
-rw-r--r--platforms/avr/bootloaders/caterina.c6
-rw-r--r--platforms/avr/bootloaders/dfu.c3
-rw-r--r--platforms/avr/bootloaders/halfkay.c3
-rw-r--r--platforms/avr/bootloaders/none.c3
-rw-r--r--platforms/avr/bootloaders/usbasploader.c3
-rw-r--r--platforms/chibios/bootloaders/gd32v_dfu.c5
-rw-r--r--platforms/chibios/bootloaders/halfkay.c3
-rw-r--r--platforms/chibios/bootloaders/kiibohd.c3
-rw-r--r--platforms/chibios/bootloaders/none.c3
-rw-r--r--platforms/chibios/bootloaders/stm32_dfu.c14
-rw-r--r--platforms/chibios/bootloaders/stm32duino.c5
-rw-r--r--platforms/chibios/bootloaders/tinyuf2.c5
-rw-r--r--platforms/test/bootloaders/none.c2
15 files changed, 37 insertions, 46 deletions
diff --git a/platforms/arm_atsam/bootloaders/md_boot.c b/platforms/arm_atsam/bootloaders/md_boot.c
index fe07389487..e7508ffe51 100644
--- a/platforms/arm_atsam/bootloaders/md_boot.c
+++ b/platforms/arm_atsam/bootloaders/md_boot.c
@@ -22,8 +22,8 @@
// WARNING: These are only for CTRL bootloader release "v2.18Jun 22 2018 17:28:08" for bootloader_jump support
extern uint32_t _eram;
-#define BOOTLOADER_MAGIC 0x3B9ACA00
-#define MAGIC_ADDR (uint32_t *)((intptr_t)(&_eram) - 4)
+# define BOOTLOADER_MAGIC 0x3B9ACA00
+# define MAGIC_ADDR (uint32_t *)((intptr_t)(&_eram) - 4)
// CTRL keyboards released with bootloader version below must use RAM method. Otherwise use WDT method.
void bootloader_jump(void) {
@@ -40,7 +40,8 @@ void bootloader_jump(void) {
*MAGIC_ADDR = BOOTLOADER_MAGIC; // Set magic number into RAM
NVIC_SystemReset(); // Perform system reset
- while (1); // Won't get here
+ while (1)
+ ; // Won't get here
}
}
@@ -50,17 +51,22 @@ void bootloader_jump(void) {
void bootloader_jump(void) {
WDT->CTRLA.bit.ENABLE = 0;
- while (WDT->SYNCBUSY.bit.ENABLE);
- while (WDT->CTRLA.bit.ENABLE);
+ while (WDT->SYNCBUSY.bit.ENABLE)
+ ;
+ while (WDT->CTRLA.bit.ENABLE)
+ ;
WDT->CONFIG.bit.WINDOW = 0;
WDT->CONFIG.bit.PER = 0;
WDT->EWCTRL.bit.EWOFFSET = 0;
WDT->CTRLA.bit.ENABLE = 1;
- while (WDT->SYNCBUSY.bit.ENABLE);
- while (!WDT->CTRLA.bit.ENABLE);
+ while (WDT->SYNCBUSY.bit.ENABLE)
+ ;
+ while (!WDT->CTRLA.bit.ENABLE)
+ ;
- while (1); // Wait on timeout
+ while (1)
+ ; // Wait on timeout
}
#endif
diff --git a/platforms/avr/bootloaders/bootloadhid.c b/platforms/avr/bootloaders/bootloadhid.c
index 8d18114613..ae58760d7d 100644
--- a/platforms/avr/bootloaders/bootloadhid.c
+++ b/platforms/avr/bootloaders/bootloadhid.c
@@ -19,8 +19,7 @@
#include <avr/eeprom.h>
#include <avr/wdt.h>
-__attribute__((weak))
-void bootloader_jump(void) {
+__attribute__((weak)) void bootloader_jump(void) {
// force bootloadHID to stay in bootloader mode, so that it waits
// for a new firmware to be flashed
// NOTE: this byte is part of QMK's "magic number" - changing it causes the EEPROM to be re-initialized
diff --git a/platforms/avr/bootloaders/caterina.c b/platforms/avr/bootloaders/caterina.c
index 1b43ed4e44..82a16a3765 100644
--- a/platforms/avr/bootloaders/caterina.c
+++ b/platforms/avr/bootloaders/caterina.c
@@ -18,8 +18,7 @@
#include <avr/wdt.h>
-__attribute__((weak))
-void bootloader_jump(void) {
+__attribute__((weak)) void bootloader_jump(void) {
// this block may be optional
// TODO: figure it out
@@ -35,5 +34,6 @@ void bootloader_jump(void) {
wdt_enable(WDTO_60MS);
// wait for watchdog timer to trigger
- while (1) { }
+ while (1) {
+ }
}
diff --git a/platforms/avr/bootloaders/dfu.c b/platforms/avr/bootloaders/dfu.c
index bdf5908934..cb42821a93 100644
--- a/platforms/avr/bootloaders/dfu.c
+++ b/platforms/avr/bootloaders/dfu.c
@@ -28,8 +28,7 @@
#define BOOTLOADER_RESET_KEY 0xB007B007
uint32_t reset_key __attribute__((section(".noinit,\"aw\",@nobits;")));
-__attribute__((weak))
-void bootloader_jump(void) {
+__attribute__((weak)) void bootloader_jump(void) {
UDCON = 1;
USBCON = (1 << FRZCLK); // disable USB
UCSR1B = 0;
diff --git a/platforms/avr/bootloaders/halfkay.c b/platforms/avr/bootloaders/halfkay.c
index abef86980b..6ce2e19114 100644
--- a/platforms/avr/bootloaders/halfkay.c
+++ b/platforms/avr/bootloaders/halfkay.c
@@ -19,8 +19,7 @@
#include <avr/interrupt.h>
#include <util/delay.h>
-__attribute__((weak))
-void bootloader_jump(void) {
+__attribute__((weak)) void bootloader_jump(void) {
// http://www.pjrc.com/teensy/jump_to_bootloader.html
cli();
diff --git a/platforms/avr/bootloaders/none.c b/platforms/avr/bootloaders/none.c
index 8af151c04d..624fbe242a 100644
--- a/platforms/avr/bootloaders/none.c
+++ b/platforms/avr/bootloaders/none.c
@@ -16,5 +16,4 @@
#include "bootloader.h"
-__attribute__((weak))
-void bootloader_jump(void) { }
+__attribute__((weak)) void bootloader_jump(void) {}
diff --git a/platforms/avr/bootloaders/usbasploader.c b/platforms/avr/bootloaders/usbasploader.c
index b3e9b2d72d..008bd16069 100644
--- a/platforms/avr/bootloaders/usbasploader.c
+++ b/platforms/avr/bootloaders/usbasploader.c
@@ -26,8 +26,7 @@
# endif
#endif
-__attribute__((weak))
-void bootloader_jump(void) {
+__attribute__((weak)) void bootloader_jump(void) {
// Taken with permission of Stephan Baerwolf from https://github.com/tinyusbboard/API/blob/master/apipage.c
wdt_enable(WDTO_15MS);
diff --git a/platforms/chibios/bootloaders/gd32v_dfu.c b/platforms/chibios/bootloaders/gd32v_dfu.c
index 1ab0882084..7a979638e3 100644
--- a/platforms/chibios/bootloaders/gd32v_dfu.c
+++ b/platforms/chibios/bootloaders/gd32v_dfu.c
@@ -24,8 +24,7 @@
__IO uint32_t *DBGMCU_KEY = (uint32_t *)DBGMCU_BASE + 0x0CU;
__IO uint32_t *DBGMCU_CMD = (uint32_t *)DBGMCU_BASE + 0x08U;
-__attribute__((weak))
-void bootloader_jump(void) {
+__attribute__((weak)) void bootloader_jump(void) {
/* The MTIMER unit of the GD32VF103 doesn't have the MSFRST
* register to generate a software reset request.
* BUT instead two undocumented registers in the debug peripheral
@@ -37,4 +36,4 @@ void bootloader_jump(void) {
}
/* Jumping to bootloader is not possible from user code. */
-void enter_bootloader_mode_if_requested(void) { }
+void enter_bootloader_mode_if_requested(void) {}
diff --git a/platforms/chibios/bootloaders/halfkay.c b/platforms/chibios/bootloaders/halfkay.c
index fb9b73dfb3..168c2abc23 100644
--- a/platforms/chibios/bootloaders/halfkay.c
+++ b/platforms/chibios/bootloaders/halfkay.c
@@ -19,8 +19,7 @@
#include <ch.h>
#include "wait.h"
-__attribute__((weak))
-void bootloader_jump(void) {
+__attribute__((weak)) void bootloader_jump(void) {
wait_ms(100);
__BKPT(0);
}
diff --git a/platforms/chibios/bootloaders/kiibohd.c b/platforms/chibios/bootloaders/kiibohd.c
index f4bb18f058..911e807092 100644
--- a/platforms/chibios/bootloaders/kiibohd.c
+++ b/platforms/chibios/bootloaders/kiibohd.c
@@ -23,8 +23,7 @@
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";
-__attribute__((weak))
-void bootloader_jump(void) {
+__attribute__((weak)) void bootloader_jump(void) {
void *volatile vbat = (void *)VBAT;
__builtin_memcpy(vbat, (const void *)sys_reset_to_loader_magic, sizeof(sys_reset_to_loader_magic));
diff --git a/platforms/chibios/bootloaders/none.c b/platforms/chibios/bootloaders/none.c
index 8af151c04d..624fbe242a 100644
--- a/platforms/chibios/bootloaders/none.c
+++ b/platforms/chibios/bootloaders/none.c
@@ -16,5 +16,4 @@
#include "bootloader.h"
-__attribute__((weak))
-void bootloader_jump(void) { }
+__attribute__((weak)) void bootloader_jump(void) {}
diff --git a/platforms/chibios/bootloaders/stm32_dfu.c b/platforms/chibios/bootloaders/stm32_dfu.c
index f4bd8554bf..0a113570f7 100644
--- a/platforms/chibios/bootloaders/stm32_dfu.c
+++ b/platforms/chibios/bootloaders/stm32_dfu.c
@@ -41,8 +41,7 @@ extern uint32_t __ram0_end__;
# define STM32_BOOTLOADER_DUAL_BANK_DELAY 100000
# endif
-__attribute__((weak))
-void bootloader_jump(void) {
+__attribute__((weak)) void bootloader_jump(void) {
// For STM32 MCUs with dual-bank flash, and we're incapable of jumping to the bootloader. The first valid flash
// bank is executed unconditionally after a reset, so it doesn't enter DFU unless BOOT0 is high. Instead, we do
// 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) {
}
// not needed at all, but if anybody attempts to invoke it....
-void enter_bootloader_mode_if_requested(void) { }
+void enter_bootloader_mode_if_requested(void) {}
#else
/* This code should be checked whether it runs correctly on platforms */
-#define SYMVAL(sym) (uint32_t)(((uint8_t *)&(sym)) - ((uint8_t *)0))
-#define BOOTLOADER_MAGIC 0xDEADBEEF
-#define MAGIC_ADDR (unsigned long *)(SYMVAL(__ram0_end__) - 4)
+# define SYMVAL(sym) (uint32_t)(((uint8_t *)&(sym)) - ((uint8_t *)0))
+# define BOOTLOADER_MAGIC 0xDEADBEEF
+# define MAGIC_ADDR (unsigned long *)(SYMVAL(__ram0_end__) - 4)
-__attribute__((weak))
-void bootloader_jump(void) {
+__attribute__((weak)) void bootloader_jump(void) {
*MAGIC_ADDR = BOOTLOADER_MAGIC; // set magic flag => reset handler will jump into boot loader
NVIC_SystemReset();
}
diff --git a/platforms/chibios/bootloaders/stm32duino.c b/platforms/chibios/bootloaders/stm32duino.c
index 6ff9e28b4d..dd1d551fa9 100644
--- a/platforms/chibios/bootloaders/stm32duino.c
+++ b/platforms/chibios/bootloaders/stm32duino.c
@@ -18,7 +18,4 @@
#include <ch.h>
-__attribute__((weak))
-void bootloader_jump(void) {
- NVIC_SystemReset();
-}
+__attribute__((weak)) void bootloader_jump(void) { NVIC_SystemReset(); }
diff --git a/platforms/chibios/bootloaders/tinyuf2.c b/platforms/chibios/bootloaders/tinyuf2.c
index ce82fa0c49..9ffca5dec8 100644
--- a/platforms/chibios/bootloaders/tinyuf2.c
+++ b/platforms/chibios/bootloaders/tinyuf2.c
@@ -25,11 +25,10 @@
extern uint32_t _board_dfu_dbl_tap[];
#define DBL_TAP_REG _board_dfu_dbl_tap[0]
-__attribute__((weak))
-void bootloader_jump(void) {
+__attribute__((weak)) void bootloader_jump(void) {
DBL_TAP_REG = DBL_TAP_MAGIC;
NVIC_SystemReset();
}
/* not needed, no two-stage reset */
-void enter_bootloader_mode_if_requested(void) { }
+void enter_bootloader_mode_if_requested(void) {}
diff --git a/platforms/test/bootloaders/none.c b/platforms/test/bootloaders/none.c
index 2920c68f18..5155d9ff04 100644
--- a/platforms/test/bootloaders/none.c
+++ b/platforms/test/bootloaders/none.c
@@ -16,4 +16,4 @@
#include "bootloader.h"
-void bootloader_jump(void) { }
+void bootloader_jump(void) {}