1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/cpu/riscv_common/include/cpu.h
Benjamin Valentin 3e20e939c6 cpu: drop cpu_init() from public headers
Boards are no longer supposed fo call the function, so drop it from
public header files.
2021-10-18 17:31:26 +02:00

89 lines
1.9 KiB
C

/*
* Copyright (C) 2020, Koen Zandberg <koen@bergzand.net>
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @defgroup cpu_riscv_common RISC-V common
* @ingroup cpu
* @brief Common implementations and headers for the RISC-V CPU
* @{
*
* @file
* @brief Basic definitions for the RISC-V CPU module
*
* @author Koen Zandberg <koen@bergzand.net>
*/
#include <stdint.h>
#include "irq_arch.h"
#ifndef CPU_H
#define CPU_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Initialize rv32i specific core parts of the CPU
*
* Initialized the interrupt controller and the enables the FPU if present
*/
void riscv_init(void);
/**
* @brief Enable the rv32i FPU when present
*/
void riscv_fpu_init(void);
/**
* @brief Initialization of the interrupt controller
*/
void riscv_irq_init(void);
/**
* @brief Print the last instruction's address
*
* @todo: Not supported
*/
static inline void cpu_print_last_instruction(void)
{
/* This function must exist else RIOT won't compile */
}
/**
* @brief Convenience function to set bit flags in a register
*
* @param reg register to set bits in
* @param mask bits to set in the register
*/
static inline __attribute__((always_inline))
void cpu_reg_enable_bits(volatile uint32_t *reg, uint32_t mask)
{
__atomic_fetch_or(reg, mask, __ATOMIC_RELAXED);
}
/**
* @brief Convenience function to clear bit flags in a register
*
* @param reg register to clear bits in
* @param mask bits to clear in the register
*/
static inline __attribute__((always_inline))
void cpu_reg_disable_bits(volatile uint32_t *reg, uint32_t mask)
{
__atomic_fetch_and(reg, ~mask, __ATOMIC_RELAXED);
}
#ifdef __cplusplus
}
#endif
#endif /* CPU_H */
/** @} */