2018-04-16 19:03:33 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2017 Ken Rabold
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2018-04-16 22:35:32 +02:00
|
|
|
* @defgroup cpu_fe310 SiFive FE310
|
2018-04-16 19:03:33 +02:00
|
|
|
* @ingroup cpu
|
|
|
|
* @brief Common implementations and headers for RISC-V
|
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief Basic definitions for the RISC-V common module
|
|
|
|
*
|
|
|
|
* When ever you want to do something hardware related, that is accessing MCUs
|
|
|
|
* registers, just include this file. It will then make sure that the MCU
|
|
|
|
* specific headers are included.
|
|
|
|
*
|
|
|
|
* @author Ken Rabold
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CPU_H
|
|
|
|
#define CPU_H
|
|
|
|
|
2019-12-13 16:22:25 +01:00
|
|
|
#include "thread.h"
|
2020-08-31 10:59:33 +02:00
|
|
|
#include "macros/units.h"
|
2019-12-13 16:22:25 +01:00
|
|
|
|
2019-12-05 18:52:43 +01:00
|
|
|
#include "vendor/platform.h"
|
|
|
|
#include "vendor/plic_driver.h"
|
|
|
|
|
2018-04-16 19:03:33 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Initialization of the CPU
|
|
|
|
*/
|
|
|
|
void cpu_init(void);
|
|
|
|
|
2019-12-10 11:29:27 +01:00
|
|
|
/**
|
|
|
|
* @brief Initialization of the clock
|
|
|
|
*/
|
|
|
|
void clock_init(void);
|
|
|
|
|
2019-12-11 19:44:56 +01:00
|
|
|
/**
|
|
|
|
* @brief Get and eventually compute the current CPU core clock frequency
|
|
|
|
*
|
|
|
|
* @return the cpu core clock frequency in Hz
|
|
|
|
*/
|
|
|
|
uint32_t cpu_freq(void);
|
|
|
|
|
2019-12-10 11:29:27 +01:00
|
|
|
/**
|
|
|
|
* @brief Initialization of interrupts
|
|
|
|
*/
|
|
|
|
void irq_init(void);
|
|
|
|
|
2018-04-16 19:03:33 +02:00
|
|
|
/**
|
|
|
|
* @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 Initialization of the Newlib-nano stub
|
|
|
|
*/
|
|
|
|
void nanostubs_init(void);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* CPU_H */
|
|
|
|
/** @} */
|