1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +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)
{
thread_t *me = thread_get_active();
/* Fail visibly even if a blocking action is called from somewhere where
* it's subtly not allowed, eg. board_init */
assert(me != NULL);

View File

@ -60,10 +60,10 @@ typedef uint8_t gpio_t;
* @brief Structure for UART configuration data
*/
typedef struct {
uint32_t addr; /**< UART control register address */
gpio_t rx; /**< RX pin */
gpio_t tx; /**< TX pin */
irqn_t isr_num; /**< ISR source number */
uint32_t addr; /**< UART control register address */
gpio_t rx; /**< RX pin */
gpio_t tx; /**< TX pin */
irqn_t isr_num; /**< ISR source number */
} uart_conf_t;
/**

View File

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

View File

@ -38,10 +38,10 @@ typedef void (*clic_isr_cb_t)(unsigned irq);
* @brief RISC-V CLIC per interrupt configuration registers
*/
typedef struct __attribute((packed)) {
volatile uint8_t ip; /**< Interrupt pending */
volatile uint8_t ie; /**< Interrupt enable */
volatile uint8_t attr; /**< Interrupt attributes */
volatile uint8_t ctl; /**< Interrupt control */
volatile uint8_t ip; /**< Interrupt pending */
volatile uint8_t ie; /**< Interrupt enable */
volatile uint8_t attr; /**< Interrupt attributes */
volatile uint8_t ctl; /**< Interrupt control */
} clic_clicint_t;
/**

View File

@ -33,8 +33,8 @@ extern "C" {
#endif
/**
* @brief Bit mask for the MCAUSE register
*/
* @brief Bit mask for the MCAUSE register
*/
#define CPU_CSR_MCAUSE_CAUSE_MSK (0x0fffu)
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)
{
unsigned state;
__asm__ volatile (
"csrr %[dest], mstatus"
:[dest] "=r" (state)

View File

@ -38,7 +38,7 @@ static inline void _ecall_dispatch(uint32_t num, void *ctx)
"add a1, x0, %[ctx] \n"
"ECALL\n"
: /* No outputs */
: [num] "r" (num), [ctx] "r" (ctx)
:[num] "r" (num), [ctx] "r" (ctx)
: "memory", "a0", "a1"
);
}

View File

@ -82,13 +82,15 @@ void riscv_irq_init(void)
/**
* @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
* calling thread_yield(). */
riscv_in_isr = 1;
uint32_t trap = mcause & CPU_CSR_MCAUSE_CAUSE_MSK;
/* Check for INT or TRAP */
if ((mcause & MCAUSE_INT) == MCAUSE_INT) {
/* 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
* compiler. Aligned to 64-byte boundary as per RISC-V spec and required by some
* 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 (
"addi sp, sp, -"XTSTR (CONTEXT_FRAME_SIZE)" \n"

View File

@ -30,8 +30,12 @@
#include "plic.h"
/* Local macros to calculate register offsets */
#define _REG32(p, i) (*(volatile uint32_t *) ((p) + (i)))
#define PLIC_REG(offset) _REG32(PLIC_CTRL_ADDR, offset)
#ifndef _REG32
#define _REG32(p, i) (*(volatile uint32_t *)((p) + (i)))
#endif
#ifndef PLIC_REG
#define PLIC_REG(offset) _REG32(PLIC_CTRL_ADDR, offset)
#endif
/* PLIC external ISR function list */
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
with FLASHPAGE_WRITE_BLOCK_SIZE */
riotboot_hdr_t tmp_hdr;
memset(&tmp_hdr, (~FLASHPAGE_ERASE_STATE), sizeof(riotboot_hdr_t));
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) ==
riotboot_hdr->chksum ? 0 : -1;
if (res) {
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);
uint32_t page = flashpage_page((void *)addr);
uart_write(RIOTBOOT_UART_DEV, (void *)&page, sizeof(page));
}