1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

Merge pull request #16737 from JKRhb/uncrustify

treewide: Address uncrustify suggestions
This commit is contained in:
benpicco 2021-11-21 15:42:05 +01:00 committed by GitHub
commit 2d882c3521
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 32 additions and 18 deletions

View File

@ -49,6 +49,7 @@ static inline __attribute__((always_inline)) void _block(mutex_t *mutex,
unsigned irq_state) unsigned irq_state)
{ {
thread_t *me = thread_get_active(); thread_t *me = thread_get_active();
/* Fail visibly even if a blocking action is called from somewhere where /* Fail visibly even if a blocking action is called from somewhere where
* it's subtly not allowed, eg. board_init */ * it's subtly not allowed, eg. board_init */
assert(me != NULL); assert(me != NULL);

View File

@ -18,7 +18,6 @@
#ifndef ATOMIC_UTILS_ARCH_H #ifndef ATOMIC_UTILS_ARCH_H
#define ATOMIC_UTILS_ARCH_H #define ATOMIC_UTILS_ARCH_H
#ifndef DOXYGEN
#include "periph_cpu.h" #include "periph_cpu.h"
@ -26,6 +25,8 @@
extern "C" { extern "C" {
#endif #endif
#ifndef DOXYGEN
/* clang provides no built-in atomic access to regular variables */ /* clang provides no built-in atomic access to regular variables */
#ifndef __clang__ #ifndef __clang__
@ -67,10 +68,11 @@ static inline void atomic_store_u32(volatile uint32_t *dest, uint32_t val)
#endif /* __clang__ */ #endif /* __clang__ */
#endif /* DOXYGEN */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* DOXYGEN */
#endif /* ATOMIC_UTILS_ARCH_H */ #endif /* ATOMIC_UTILS_ARCH_H */
/** @} */ /** @} */

View File

@ -33,8 +33,8 @@ extern "C" {
#endif #endif
/** /**
* @brief Bit mask for the MCAUSE register * @brief Bit mask for the MCAUSE register
*/ */
#define CPU_CSR_MCAUSE_CAUSE_MSK (0x0fffu) #define CPU_CSR_MCAUSE_CAUSE_MSK (0x0fffu)
extern volatile int riscv_in_isr; extern volatile int riscv_in_isr;
@ -100,6 +100,7 @@ static inline __attribute__((always_inline)) int irq_is_in(void)
static inline __attribute__((always_inline)) int irq_is_enabled(void) static inline __attribute__((always_inline)) int irq_is_enabled(void)
{ {
unsigned state; unsigned state;
__asm__ volatile ( __asm__ volatile (
"csrr %[dest], mstatus" "csrr %[dest], mstatus"
:[dest] "=r" (state) :[dest] "=r" (state)

View File

@ -82,13 +82,15 @@ void riscv_irq_init(void)
/** /**
* @brief Global trap and interrupt handler * @brief Global trap and interrupt handler
*/ */
static void __attribute((used)) handle_trap(uint32_t mcause) __attribute((used))
static void handle_trap(uint32_t mcause)
{ {
/* Tell RIOT to set sched_context_switch_request instead of /* Tell RIOT to set sched_context_switch_request instead of
* calling thread_yield(). */ * calling thread_yield(). */
riscv_in_isr = 1; riscv_in_isr = 1;
uint32_t trap = mcause & CPU_CSR_MCAUSE_CAUSE_MSK; uint32_t trap = mcause & CPU_CSR_MCAUSE_CAUSE_MSK;
/* Check for INT or TRAP */ /* Check for INT or TRAP */
if ((mcause & MCAUSE_INT) == MCAUSE_INT) { if ((mcause & MCAUSE_INT) == MCAUSE_INT) {
/* Cause is an interrupt - determine type */ /* Cause is an interrupt - determine type */
@ -149,7 +151,8 @@ static void __attribute((used)) handle_trap(uint32_t mcause)
/* Marking this as interrupt to ensure an mret at the end, provided by the /* Marking this as interrupt to ensure an mret at the end, provided by the
* compiler. Aligned to 64-byte boundary as per RISC-V spec and required by some * compiler. Aligned to 64-byte boundary as per RISC-V spec and required by some
* of the supported platforms (gd32)*/ * of the supported platforms (gd32)*/
static void __attribute((aligned(64))) __attribute__((interrupt)) trap_entry(void) __attribute((aligned(64)))
static void __attribute__((interrupt)) trap_entry(void)
{ {
__asm__ volatile ( __asm__ volatile (
"addi sp, sp, -"XTSTR (CONTEXT_FRAME_SIZE)" \n" "addi sp, sp, -"XTSTR (CONTEXT_FRAME_SIZE)" \n"

View File

@ -30,8 +30,12 @@
#include "plic.h" #include "plic.h"
/* Local macros to calculate register offsets */ /* Local macros to calculate register offsets */
#ifndef _REG32
#define _REG32(p, i) (*(volatile uint32_t *)((p) + (i))) #define _REG32(p, i) (*(volatile uint32_t *)((p) + (i)))
#endif
#ifndef PLIC_REG
#define PLIC_REG(offset) _REG32(PLIC_CTRL_ADDR, offset) #define PLIC_REG(offset) _REG32(PLIC_CTRL_ADDR, offset)
#endif
/* PLIC external ISR function list */ /* PLIC external ISR function list */
static plic_isr_cb_t _ext_isrs[PLIC_NUM_INTERRUPTS]; static plic_isr_cb_t _ext_isrs[PLIC_NUM_INTERRUPTS];

View File

@ -190,6 +190,7 @@ int riotboot_flashwrite_invalidate(int slot)
write the whole header to avoid running in memory alignment issues write the whole header to avoid running in memory alignment issues
with FLASHPAGE_WRITE_BLOCK_SIZE */ with FLASHPAGE_WRITE_BLOCK_SIZE */
riotboot_hdr_t tmp_hdr; riotboot_hdr_t tmp_hdr;
memset(&tmp_hdr, (~FLASHPAGE_ERASE_STATE), sizeof(riotboot_hdr_t)); memset(&tmp_hdr, (~FLASHPAGE_ERASE_STATE), sizeof(riotboot_hdr_t));
flashpage_write((void *)riotboot_slot_get_hdr(slot), &tmp_hdr, flashpage_write((void *)riotboot_slot_get_hdr(slot), &tmp_hdr,

View File

@ -59,6 +59,7 @@ int riotboot_hdr_validate(const riotboot_hdr_t *riotboot_hdr)
int res = riotboot_hdr_checksum(riotboot_hdr) == int res = riotboot_hdr_checksum(riotboot_hdr) ==
riotboot_hdr->chksum ? 0 : -1; riotboot_hdr->chksum ? 0 : -1;
if (res) { if (res) {
LOG_INFO("%s: riotboot_hdr checksum invalid\n", __func__); LOG_INFO("%s: riotboot_hdr checksum invalid\n", __func__);
} }

View File

@ -182,6 +182,7 @@ static void _get_page(uintptr_t addr)
{ {
uart_write_byte(RIOTBOOT_UART_DEV, RIOTBOOT_STAT_OK); uart_write_byte(RIOTBOOT_UART_DEV, RIOTBOOT_STAT_OK);
uint32_t page = flashpage_page((void *)addr); uint32_t page = flashpage_page((void *)addr);
uart_write(RIOTBOOT_UART_DEV, (void *)&page, sizeof(page)); uart_write(RIOTBOOT_UART_DEV, (void *)&page, sizeof(page));
} }