Initial commit
This commit is contained in:
6
Libs/RiscV/NEORV32/sw/lib/README.md
Normal file
6
Libs/RiscV/NEORV32/sw/lib/README.md
Normal file
@ -0,0 +1,6 @@
|
||||
## NEORV32 Core Library
|
||||
|
||||
This folder provides the hardware abstraction layer (HAL) libraries for the CPU itself and the individual processor modules (peripheral/IO devices).
|
||||
|
||||
The `source` folder contains the actual C-code hardware driver functions (*.c*) while the `include` folder provides the according header files (*.h).
|
||||
Application programs should only include the *main NEORV32 define file* `include/neorv32.h`. This file automatically includes all other provided header files.
|
1311
Libs/RiscV/NEORV32/sw/lib/include/neorv32.h
Normal file
1311
Libs/RiscV/NEORV32/sw/lib/include/neorv32.h
Normal file
File diff suppressed because it is too large
Load Diff
53
Libs/RiscV/NEORV32/sw/lib/include/neorv32_cfs.h
Normal file
53
Libs/RiscV/NEORV32/sw/lib/include/neorv32_cfs.h
Normal file
@ -0,0 +1,53 @@
|
||||
// #################################################################################################
|
||||
// # << NEORV32: neorv32_cfs.h - Custom Functions Subsystem (CFS)) HW Driver (stub) >> #
|
||||
// # ********************************************************************************************* #
|
||||
// # BSD 3-Clause License #
|
||||
// # #
|
||||
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
||||
// # #
|
||||
// # Redistribution and use in source and binary forms, with or without modification, are #
|
||||
// # permitted provided that the following conditions are met: #
|
||||
// # #
|
||||
// # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer. #
|
||||
// # #
|
||||
// # 2. Redistributions in binary form must reproduce the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer in the documentation and/or other materials #
|
||||
// # provided with the distribution. #
|
||||
// # #
|
||||
// # 3. Neither the name of the copyright holder nor the names of its contributors may be used to #
|
||||
// # endorse or promote products derived from this software without specific prior written #
|
||||
// # permission. #
|
||||
// # #
|
||||
// # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS #
|
||||
// # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF #
|
||||
// # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE #
|
||||
// # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
|
||||
// # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
|
||||
// # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED #
|
||||
// # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
|
||||
// # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED #
|
||||
// # OF THE POSSIBILITY OF SUCH DAMAGE. #
|
||||
// # ********************************************************************************************* #
|
||||
// # The NEORV32 Processor - https://github.com/stnolting/neorv32 (c) Stephan Nolting #
|
||||
// #################################################################################################
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* @file neorv32_cfs.h
|
||||
* @author Stephan Nolting
|
||||
* @brief Custom Functions Subsystem (CFS)) HW driver header file.
|
||||
*
|
||||
* @warning There are no "real" CFS driver functions available here, because these functions are defined by the actual hardware.
|
||||
* @warning Hence, the CFS designer has to provide the actual driver functions.
|
||||
*
|
||||
* @note These functions should only be used if the CFS was synthesized (IO_CFS_EN = true).
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef neorv32_cfs_h
|
||||
#define neorv32_cfs_h
|
||||
|
||||
// prototypes
|
||||
int neorv32_cfs_available(void);
|
||||
|
||||
#endif // neorv32_cfs_h
|
306
Libs/RiscV/NEORV32/sw/lib/include/neorv32_cpu.h
Normal file
306
Libs/RiscV/NEORV32/sw/lib/include/neorv32_cpu.h
Normal file
@ -0,0 +1,306 @@
|
||||
// #################################################################################################
|
||||
// # << NEORV32: neorv32_cpu.h - CPU Core Functions HW Driver >> #
|
||||
// # ********************************************************************************************* #
|
||||
// # BSD 3-Clause License #
|
||||
// # #
|
||||
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
||||
// # #
|
||||
// # Redistribution and use in source and binary forms, with or without modification, are #
|
||||
// # permitted provided that the following conditions are met: #
|
||||
// # #
|
||||
// # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer. #
|
||||
// # #
|
||||
// # 2. Redistributions in binary form must reproduce the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer in the documentation and/or other materials #
|
||||
// # provided with the distribution. #
|
||||
// # #
|
||||
// # 3. Neither the name of the copyright holder nor the names of its contributors may be used to #
|
||||
// # endorse or promote products derived from this software without specific prior written #
|
||||
// # permission. #
|
||||
// # #
|
||||
// # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS #
|
||||
// # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF #
|
||||
// # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE #
|
||||
// # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
|
||||
// # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
|
||||
// # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED #
|
||||
// # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
|
||||
// # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED #
|
||||
// # OF THE POSSIBILITY OF SUCH DAMAGE. #
|
||||
// # ********************************************************************************************* #
|
||||
// # The NEORV32 Processor - https://github.com/stnolting/neorv32 (c) Stephan Nolting #
|
||||
// #################################################################################################
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* @file neorv32_cpu.h
|
||||
* @author Stephan Nolting
|
||||
* @brief CPU Core Functions HW driver header file.
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef neorv32_cpu_h
|
||||
#define neorv32_cpu_h
|
||||
|
||||
// prototypes
|
||||
int neorv32_cpu_irq_enable(uint8_t irq_sel);
|
||||
int neorv32_cpu_irq_disable(uint8_t irq_sel);
|
||||
uint64_t neorv32_cpu_get_cycle(void);
|
||||
void neorv32_cpu_set_mcycle(uint64_t value);
|
||||
uint64_t neorv32_cpu_get_instret(void);
|
||||
void neorv32_cpu_set_minstret(uint64_t value);
|
||||
uint64_t neorv32_cpu_get_systime(void);
|
||||
void neorv32_cpu_delay_ms(uint32_t time_ms);
|
||||
void __attribute__((naked)) neorv32_cpu_goto_user_mode(void);
|
||||
uint32_t neorv32_cpu_pmp_get_num_regions(void);
|
||||
uint32_t neorv32_cpu_pmp_get_granularity(void);
|
||||
int neorv32_cpu_pmp_configure_region(uint32_t index, uint32_t base, uint32_t size, uint8_t config);
|
||||
uint32_t neorv32_cpu_hpm_get_counters(void);
|
||||
uint32_t neorv32_cpu_hpm_get_size(void);
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Prototype for "after-main handler". This function is called if main() returns.
|
||||
*
|
||||
* @param[in] return_code Return value of main() function.
|
||||
* @return Return value is irrelevant (there is no one left to check for it...).
|
||||
**************************************************************************/
|
||||
extern int __neorv32_crt0_after_main(int32_t return_code) __attribute__ ((weak));
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Store unsigned word to address space if atomic access reservation is still valid.
|
||||
*
|
||||
* @note An unaligned access address will raise an alignment exception.
|
||||
*
|
||||
* @param[in] addr Address (32-bit).
|
||||
* @param[in] wdata Data word (32-bit) to store.
|
||||
* @return Operation status (32-bit, zero if success).
|
||||
**************************************************************************/
|
||||
inline uint32_t __attribute__ ((always_inline)) neorv32_cpu_store_conditional(uint32_t addr, uint32_t wdata) {
|
||||
|
||||
#if defined __riscv_atomic || defined __riscv_a
|
||||
register uint32_t reg_addr = addr;
|
||||
register uint32_t reg_data = wdata;
|
||||
register uint32_t reg_status;
|
||||
|
||||
asm volatile ("sc.w %[status], %[da], (%[ad])" : [status] "=r" (reg_status) : [da] "r" (reg_data), [ad] "r" (reg_addr));
|
||||
|
||||
return reg_status;
|
||||
#else
|
||||
return 1; // always failing
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Conditional store unsigned word to address space.
|
||||
*
|
||||
* @note An unaligned access address will raise an alignment exception.
|
||||
*
|
||||
* @param[in] addr Address (32-bit).
|
||||
* @param[in] wdata Data word (32-bit) to store.
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_cpu_store_unsigned_word(uint32_t addr, uint32_t wdata) {
|
||||
|
||||
register uint32_t reg_addr = addr;
|
||||
register uint32_t reg_data = wdata;
|
||||
|
||||
asm volatile ("sw %[da], 0(%[ad])" : : [da] "r" (reg_data), [ad] "r" (reg_addr));
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Store unsigned half-word to address space.
|
||||
*
|
||||
* @note An unaligned access address will raise an alignment exception.
|
||||
*
|
||||
* @param[in] addr Address (32-bit).
|
||||
* @param[in] wdata Data half-word (16-bit) to store.
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_cpu_store_unsigned_half(uint32_t addr, uint16_t wdata) {
|
||||
|
||||
register uint32_t reg_addr = addr;
|
||||
register uint32_t reg_data = (uint32_t)wdata;
|
||||
|
||||
asm volatile ("sh %[da], 0(%[ad])" : : [da] "r" (reg_data), [ad] "r" (reg_addr));
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Store unsigned byte to address space.
|
||||
*
|
||||
* @param[in] addr Address (32-bit).
|
||||
* @param[in] wdata Data byte (8-bit) to store.
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_cpu_store_unsigned_byte(uint32_t addr, uint8_t wdata) {
|
||||
|
||||
register uint32_t reg_addr = addr;
|
||||
register uint32_t reg_data = (uint32_t)wdata;
|
||||
|
||||
asm volatile ("sb %[da], 0(%[ad])" : : [da] "r" (reg_data), [ad] "r" (reg_addr));
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Load unsigned word from address space and make reservation for atomic access.
|
||||
*
|
||||
* @note An unaligned access address will raise an alignment exception.
|
||||
*
|
||||
* @param[in] addr Address (32-bit).
|
||||
* @return Read data word (32-bit).
|
||||
**************************************************************************/
|
||||
inline uint32_t __attribute__ ((always_inline)) neorv32_cpu_load_reservate_word(uint32_t addr) {
|
||||
|
||||
register uint32_t reg_addr = addr;
|
||||
register uint32_t reg_data;
|
||||
|
||||
#if defined __riscv_atomic || defined __riscv_a
|
||||
asm volatile ("lr.w %[da], 0(%[ad])" : [da] "=r" (reg_data) : [ad] "r" (reg_addr));
|
||||
#else
|
||||
asm volatile ("lw %[da], 0(%[ad])" : [da] "=r" (reg_data) : [ad] "r" (reg_addr));
|
||||
#endif
|
||||
|
||||
return (uint32_t)reg_data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Load unsigned word from address space.
|
||||
*
|
||||
* @note An unaligned access address will raise an alignment exception.
|
||||
*
|
||||
* @param[in] addr Address (32-bit).
|
||||
* @return Read data word (32-bit).
|
||||
**************************************************************************/
|
||||
inline uint32_t __attribute__ ((always_inline)) neorv32_cpu_load_unsigned_word(uint32_t addr) {
|
||||
|
||||
register uint32_t reg_addr = addr;
|
||||
register uint32_t reg_data;
|
||||
|
||||
asm volatile ("lw %[da], 0(%[ad])" : [da] "=r" (reg_data) : [ad] "r" (reg_addr));
|
||||
|
||||
return (uint32_t)reg_data;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Load unsigned half-word from address space.
|
||||
*
|
||||
* @note An unaligned access address will raise an alignment exception.
|
||||
*
|
||||
* @param[in] addr Address (32-bit).
|
||||
* @return Read data half-word (16-bit).
|
||||
**************************************************************************/
|
||||
inline uint16_t __attribute__ ((always_inline)) neorv32_cpu_load_unsigned_half(uint32_t addr) {
|
||||
|
||||
register uint32_t reg_addr = addr;
|
||||
register uint32_t reg_data;
|
||||
|
||||
asm volatile ("lhu %[da], 0(%[ad])" : [da] "=r" (reg_data) : [ad] "r" (reg_addr));
|
||||
|
||||
return (uint16_t)reg_data;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Load unsigned byte from address space.
|
||||
*
|
||||
* @param[in] addr Address (32-bit).
|
||||
* @return Read data byte (8-bit).
|
||||
**************************************************************************/
|
||||
inline uint8_t __attribute__ ((always_inline)) neorv32_cpu_load_unsigned_byte(uint32_t addr) {
|
||||
|
||||
register uint32_t reg_addr = addr;
|
||||
register uint32_t reg_data;
|
||||
|
||||
asm volatile ("lbu %[da], 0(%[ad])" : [da] "=r" (reg_data) : [ad] "r" (reg_addr));
|
||||
|
||||
return (uint8_t)reg_data;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Read data from CPU configuration and status register (CSR).
|
||||
*
|
||||
* @param[in] csr_id ID of CSR to read. See #NEORV32_CSR_enum.
|
||||
* @return Read data (uint32_t).
|
||||
**************************************************************************/
|
||||
inline uint32_t __attribute__ ((always_inline)) neorv32_cpu_csr_read(const int csr_id) {
|
||||
|
||||
register uint32_t csr_data;
|
||||
|
||||
asm volatile ("csrr %[result], %[input_i]" : [result] "=r" (csr_data) : [input_i] "i" (csr_id));
|
||||
|
||||
return csr_data;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Write data to CPU configuration and status register (CSR).
|
||||
*
|
||||
* @param[in] csr_id ID of CSR to write. See #NEORV32_CSR_enum.
|
||||
* @param[in] data Data to write (uint32_t).
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_cpu_csr_write(const int csr_id, uint32_t data) {
|
||||
|
||||
register uint32_t csr_data = data;
|
||||
|
||||
asm volatile ("csrw %[input_i], %[input_j]" : : [input_i] "i" (csr_id), [input_j] "r" (csr_data));
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Put CPU into "sleep" mode.
|
||||
*
|
||||
* @note This function executes the WFI instruction.
|
||||
* The WFI (wait for interrupt) instruction will make the CPU stall until
|
||||
* an interrupt request is detected. Interrupts have to be globally enabled
|
||||
* and at least one external source must be enabled (like the MTI machine
|
||||
* timer interrupt) to allow the CPU to wake up again. If 'Zicsr' CPU extension is disabled,
|
||||
* this will permanently stall the CPU.
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_cpu_sleep(void) {
|
||||
|
||||
asm volatile ("wfi");
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Enable global CPU interrupts (via MIE flag in mstatus CSR).
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_cpu_eint(void) {
|
||||
|
||||
asm volatile ("csrrsi zero, mstatus, %0" : : "i" (1 << CSR_MSTATUS_MIE));
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Disable global CPU interrupts (via MIE flag in mstatus CSR).
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_cpu_dint(void) {
|
||||
|
||||
asm volatile ("csrrci zero, mstatus, %0" : : "i" (1 << CSR_MSTATUS_MIE));
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Trigger breakpoint exception (via EBREAK instruction).
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_cpu_breakpoint(void) {
|
||||
|
||||
asm volatile ("ebreak");
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Trigger "environment call" exception (via ECALL instruction).
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_cpu_env_call(void) {
|
||||
|
||||
asm volatile ("ecall");
|
||||
}
|
||||
|
||||
|
||||
#endif // neorv32_cpu_h
|
57
Libs/RiscV/NEORV32/sw/lib/include/neorv32_gpio.h
Normal file
57
Libs/RiscV/NEORV32/sw/lib/include/neorv32_gpio.h
Normal file
@ -0,0 +1,57 @@
|
||||
// #################################################################################################
|
||||
// # << NEORV32: neorv32_gpio.h - General Purpose Input/Output Port HW Driver (Header) >> #
|
||||
// # ********************************************************************************************* #
|
||||
// # BSD 3-Clause License #
|
||||
// # #
|
||||
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
||||
// # #
|
||||
// # Redistribution and use in source and binary forms, with or without modification, are #
|
||||
// # permitted provided that the following conditions are met: #
|
||||
// # #
|
||||
// # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer. #
|
||||
// # #
|
||||
// # 2. Redistributions in binary form must reproduce the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer in the documentation and/or other materials #
|
||||
// # provided with the distribution. #
|
||||
// # #
|
||||
// # 3. Neither the name of the copyright holder nor the names of its contributors may be used to #
|
||||
// # endorse or promote products derived from this software without specific prior written #
|
||||
// # permission. #
|
||||
// # #
|
||||
// # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS #
|
||||
// # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF #
|
||||
// # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE #
|
||||
// # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
|
||||
// # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
|
||||
// # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED #
|
||||
// # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
|
||||
// # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED #
|
||||
// # OF THE POSSIBILITY OF SUCH DAMAGE. #
|
||||
// # ********************************************************************************************* #
|
||||
// # The NEORV32 Processor - https://github.com/stnolting/neorv32 (c) Stephan Nolting #
|
||||
// #################################################################################################
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* @file neorv32_gpio.h
|
||||
* @author Stephan Nolting
|
||||
* @brief General purpose input/output port unit (GPIO) HW driver header file.
|
||||
*
|
||||
* @note These functions should only be used if the GPIO unit was synthesized (IO_GPIO_EN = true).
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef neorv32_gpio_h
|
||||
#define neorv32_gpio_h
|
||||
|
||||
// prototypes
|
||||
int neorv32_gpio_available(void);
|
||||
void neorv32_gpio_pin_set(int pin);
|
||||
void neorv32_gpio_pin_clr(int pin);
|
||||
void neorv32_gpio_pin_toggle(int pin);
|
||||
uint32_t neorv32_gpio_pin_get(int pin);
|
||||
|
||||
void neorv32_gpio_port_set(uint64_t d);
|
||||
uint64_t neorv32_gpio_port_get(void);
|
||||
|
||||
#endif // neorv32_gpio_h
|
54
Libs/RiscV/NEORV32/sw/lib/include/neorv32_gptmr.h
Normal file
54
Libs/RiscV/NEORV32/sw/lib/include/neorv32_gptmr.h
Normal file
@ -0,0 +1,54 @@
|
||||
// #################################################################################################
|
||||
// # << NEORV32: neorv32_gptmr.h - General Purpose Timer (GPTMR) HW Driver >> #
|
||||
// # ********************************************************************************************* #
|
||||
// # BSD 3-Clause License #
|
||||
// # #
|
||||
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
||||
// # #
|
||||
// # Redistribution and use in source and binary forms, with or without modification, are #
|
||||
// # permitted provided that the following conditions are met: #
|
||||
// # #
|
||||
// # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer. #
|
||||
// # #
|
||||
// # 2. Redistributions in binary form must reproduce the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer in the documentation and/or other materials #
|
||||
// # provided with the distribution. #
|
||||
// # #
|
||||
// # 3. Neither the name of the copyright holder nor the names of its contributors may be used to #
|
||||
// # endorse or promote products derived from this software without specific prior written #
|
||||
// # permission. #
|
||||
// # #
|
||||
// # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS #
|
||||
// # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF #
|
||||
// # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE #
|
||||
// # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
|
||||
// # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
|
||||
// # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED #
|
||||
// # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
|
||||
// # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED #
|
||||
// # OF THE POSSIBILITY OF SUCH DAMAGE. #
|
||||
// # ********************************************************************************************* #
|
||||
// # The NEORV32 Processor - https://github.com/stnolting/neorv32 (c) Stephan Nolting #
|
||||
// #################################################################################################
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* @file neorv32_gptmr.h
|
||||
* @author Stephan Nolting
|
||||
* @brief General purpose timer (GPTMR) HW driver header file.
|
||||
*
|
||||
* @note These functions should only be used if the GPTMR unit was synthesized (IO_GPTMR_EN = true).
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef neorv32_gptmr_h
|
||||
#define neorv32_gptmr_h
|
||||
|
||||
// prototypes
|
||||
int neorv32_gptmr_available(void);
|
||||
void neorv32_gptmr_setup(uint8_t prsc, uint8_t mode, uint32_t threshold);
|
||||
void neorv32_gptmr_disable(void);
|
||||
void neorv32_gptmr_enable(void);
|
||||
void neorv32_gptmr_restart(void);
|
||||
|
||||
#endif // neorv32_gptmr_h
|
166
Libs/RiscV/NEORV32/sw/lib/include/neorv32_intrinsics.h
Normal file
166
Libs/RiscV/NEORV32/sw/lib/include/neorv32_intrinsics.h
Normal file
@ -0,0 +1,166 @@
|
||||
// #################################################################################################
|
||||
// # << NEORV32: neorv32_intrinsics.h - Helper functions/macros for (custom) "intrinsics" >> #
|
||||
// # ********************************************************************************************* #
|
||||
// # BSD 3-Clause License #
|
||||
// # #
|
||||
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
||||
// # #
|
||||
// # Redistribution and use in source and binary forms, with or without modification, are #
|
||||
// # permitted provided that the following conditions are met: #
|
||||
// # #
|
||||
// # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer. #
|
||||
// # #
|
||||
// # 2. Redistributions in binary form must reproduce the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer in the documentation and/or other materials #
|
||||
// # provided with the distribution. #
|
||||
// # #
|
||||
// # 3. Neither the name of the copyright holder nor the names of its contributors may be used to #
|
||||
// # endorse or promote products derived from this software without specific prior written #
|
||||
// # permission. #
|
||||
// # #
|
||||
// # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS #
|
||||
// # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF #
|
||||
// # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE #
|
||||
// # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
|
||||
// # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
|
||||
// # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED #
|
||||
// # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
|
||||
// # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED #
|
||||
// # OF THE POSSIBILITY OF SUCH DAMAGE. #
|
||||
// # ********************************************************************************************* #
|
||||
// # The NEORV32 Processor - https://github.com/stnolting/neorv32 (c) Stephan Nolting #
|
||||
// #################################################################################################
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* @file neorv32_intrinsics.h
|
||||
* @author Stephan Nolting
|
||||
* @brief Helper functions and macros for custom "intrinsics" / instructions.
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef neorv32_intrinsics_h
|
||||
#define neorv32_intrinsics_h
|
||||
|
||||
/**********************************************************************//**
|
||||
* @name Custom instructions / intrinsics helper macros
|
||||
**************************************************************************/
|
||||
/**@{*/
|
||||
|
||||
//** Selection helper macro */
|
||||
#define STR1(x) #x
|
||||
//** Selection helper macro 2 */
|
||||
#define STR(x) STR1(x)
|
||||
|
||||
//** Register address converter */
|
||||
#define GET_REG_ADDR(x) REG_ADDR_##x
|
||||
|
||||
#define REG_ADDR_x0 0 /**< register 0 */
|
||||
#define REG_ADDR_x1 1 /**< register 1 */
|
||||
#define REG_ADDR_x2 2 /**< register 2 */
|
||||
#define REG_ADDR_x3 3 /**< register 3 */
|
||||
#define REG_ADDR_x4 4 /**< register 4 */
|
||||
#define REG_ADDR_x5 5 /**< register 5 */
|
||||
#define REG_ADDR_x6 6 /**< register 6 */
|
||||
#define REG_ADDR_x7 7 /**< register 7 */
|
||||
#define REG_ADDR_x8 8 /**< register 8 */
|
||||
#define REG_ADDR_x9 9 /**< register 9 */
|
||||
#define REG_ADDR_x10 10 /**< register 10 */
|
||||
#define REG_ADDR_x11 11 /**< register 11 */
|
||||
#define REG_ADDR_x12 12 /**< register 12 */
|
||||
#define REG_ADDR_x13 13 /**< register 13 */
|
||||
#define REG_ADDR_x14 14 /**< register 14 */
|
||||
#define REG_ADDR_x15 15 /**< register 15 */
|
||||
#define REG_ADDR_x16 16 /**< register 16 */
|
||||
#define REG_ADDR_x17 17 /**< register 17 */
|
||||
#define REG_ADDR_x18 18 /**< register 18 */
|
||||
#define REG_ADDR_x19 19 /**< register 19 */
|
||||
#define REG_ADDR_x20 20 /**< register 20 */
|
||||
#define REG_ADDR_x21 21 /**< register 21 */
|
||||
#define REG_ADDR_x22 22 /**< register 22 */
|
||||
#define REG_ADDR_x23 23 /**< register 23 */
|
||||
#define REG_ADDR_x24 24 /**< register 24 */
|
||||
#define REG_ADDR_x25 25 /**< register 25 */
|
||||
#define REG_ADDR_x26 26 /**< register 26 */
|
||||
#define REG_ADDR_x27 27 /**< register 27 */
|
||||
#define REG_ADDR_x28 28 /**< register 28 */
|
||||
#define REG_ADDR_x29 29 /**< register 29 */
|
||||
#define REG_ADDR_x30 30 /**< register 30 */
|
||||
#define REG_ADDR_x31 31 /**< register 31 */
|
||||
#define REG_ADDR_zero 0 /**< register 0 - according to calling convention */
|
||||
#define REG_ADDR_ra 1 /**< register 1 - according to calling convention */
|
||||
#define REG_ADDR_sp 2 /**< register 2 - according to calling convention */
|
||||
#define REG_ADDR_gp 3 /**< register 3 - according to calling convention */
|
||||
#define REG_ADDR_tp 4 /**< register 4 - according to calling convention */
|
||||
#define REG_ADDR_t0 5 /**< register 5 - according to calling convention */
|
||||
#define REG_ADDR_t1 6 /**< register 6 - according to calling convention */
|
||||
#define REG_ADDR_t2 7 /**< register 7 - according to calling convention */
|
||||
#define REG_ADDR_s0 8 /**< register 8 - according to calling convention */
|
||||
#define REG_ADDR_s1 9 /**< register 9 - according to calling convention */
|
||||
#define REG_ADDR_a0 10 /**< register 10 - according to calling convention */
|
||||
#define REG_ADDR_a1 11 /**< register 11 - according to calling convention */
|
||||
#define REG_ADDR_a2 12 /**< register 12 - according to calling convention */
|
||||
#define REG_ADDR_a3 13 /**< register 13 - according to calling convention */
|
||||
#define REG_ADDR_a4 14 /**< register 14 - according to calling convention */
|
||||
#define REG_ADDR_a5 15 /**< register 15 - according to calling convention */
|
||||
#define REG_ADDR_a6 16 /**< register 16 - according to calling convention */
|
||||
#define REG_ADDR_a7 17 /**< register 17 - according to calling convention */
|
||||
#define REG_ADDR_s2 18 /**< register 18 - according to calling convention */
|
||||
#define REG_ADDR_s3 19 /**< register 19 - according to calling convention */
|
||||
#define REG_ADDR_s4 20 /**< register 20 - according to calling convention */
|
||||
#define REG_ADDR_s5 21 /**< register 21 - according to calling convention */
|
||||
#define REG_ADDR_s6 22 /**< register 22 - according to calling convention */
|
||||
#define REG_ADDR_s7 23 /**< register 23 - according to calling convention */
|
||||
#define REG_ADDR_s8 24 /**< register 24 - according to calling convention */
|
||||
#define REG_ADDR_s9 25 /**< register 25 - according to calling convention */
|
||||
#define REG_ADDR_s10 26 /**< register 26 - according to calling convention */
|
||||
#define REG_ADDR_s11 27 /**< register 27 - according to calling convention */
|
||||
#define REG_ADDR_t3 28 /**< register 28 - according to calling convention */
|
||||
#define REG_ADDR_t4 29 /**< register 29 - according to calling convention */
|
||||
#define REG_ADDR_t5 30 /**< register 30 - according to calling convention */
|
||||
#define REG_ADDR_t6 31 /**< register 31 - according to calling convention */
|
||||
|
||||
//** Construct instruction word (32-bit) for R2-type instruction */
|
||||
#define CMD_WORD_R2_TYPE(funct7, rs2, rs1, funct3, rd, opcode) \
|
||||
( (opcode & 0x7f) << 0 ) + \
|
||||
( (rd & 0x1f) << 7 ) + \
|
||||
( (funct3 & 0x1f) << 12 ) + \
|
||||
( (rs1 & 0x1f) << 15 ) + \
|
||||
( (rs2 & 0x1f) << 20 ) + \
|
||||
( (funct7 & 0x7f) << 25 )
|
||||
|
||||
//** Construct instruction word (32-bit) for R3-type instruction */
|
||||
#define CMD_WORD_R3_TYPE(rs3, rs2, rs1, funct3, rd, opcode) \
|
||||
( (opcode & 0x7f) << 0 ) + \
|
||||
( (rd & 0x1f) << 7 ) + \
|
||||
( (funct3 & 0x1f) << 12 ) + \
|
||||
( (rs1 & 0x1f) << 15 ) + \
|
||||
( (rs2 & 0x1f) << 20 ) + \
|
||||
( (rs3 & 0x1f) << 27 )
|
||||
|
||||
//** Construct instruction word (32-bit) for I-type instruction */
|
||||
#define CMD_WORD_I_TYPE(imm12, rs1_f5, funct3, rd, opcode) \
|
||||
( (opcode & 0x7f) << 0 ) + \
|
||||
( (rd & 0x1f) << 7 ) + \
|
||||
( (funct3 & 0x1f) << 12 ) + \
|
||||
( (rs1_f5 & 0x1f) << 15 ) + \
|
||||
( (imm12 & 0xfff) << 20 )
|
||||
|
||||
//** Construct custom R3-type instruction (4 registers, funct3, opcode) */
|
||||
#define CUSTOM_INSTR_R3_TYPE(rs3, rs2, rs1, funct3, rd, opcode) \
|
||||
asm volatile (".word " STR(CMD_WORD_R3_TYPE(GET_REG_ADDR(rs3), GET_REG_ADDR(rs2), GET_REG_ADDR(rs1), funct3, GET_REG_ADDR(rd), opcode))"\n");
|
||||
|
||||
//** Construct custom R2-type instruction (3 registers, funct3, funct7, opcode) */
|
||||
#define CUSTOM_INSTR_R2_TYPE(funct7, rs2, rs1, funct3, rd, opcode) \
|
||||
asm volatile (".word " STR(CMD_WORD_R2_TYPE(funct7, GET_REG_ADDR(rs2), GET_REG_ADDR(rs1), funct3, GET_REG_ADDR(rd), opcode))"\n");
|
||||
|
||||
//** Construct custom R1-type instruction (2 registers, funct3, funct7, funct5, opcode) */
|
||||
#define CUSTOM_INSTR_R1_TYPE(funct7, funct5, rs1, funct3, rd, opcode) \
|
||||
asm volatile (".word " STR(CMD_WORD_R2_TYPE(funct7, funct5, GET_REG_ADDR(rs1), funct3, GET_REG_ADDR(rd), opcode))"\n");
|
||||
|
||||
//** Construct custom I-type instruction (2 registers, funct3, imm12, opcode) */
|
||||
#define CUSTOM_INSTR_I_TYPE(imm12, rs1, funct3, rd, opcode) \
|
||||
asm volatile (".word " STR(CMD_WORD_I_TYPE(imm12, GET_REG_ADDR(rs1), funct3, GET_REG_ADDR(rd), opcode))"\n");
|
||||
/**@}*/
|
||||
|
||||
#endif // neorv32_intrinsics_h
|
54
Libs/RiscV/NEORV32/sw/lib/include/neorv32_mtime.h
Normal file
54
Libs/RiscV/NEORV32/sw/lib/include/neorv32_mtime.h
Normal file
@ -0,0 +1,54 @@
|
||||
// #################################################################################################
|
||||
// # << NEORV32: neorv32_mtime.h - Machine System Timer (MTIME) HW Driver >> #
|
||||
// # ********************************************************************************************* #
|
||||
// # BSD 3-Clause License #
|
||||
// # #
|
||||
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
||||
// # #
|
||||
// # Redistribution and use in source and binary forms, with or without modification, are #
|
||||
// # permitted provided that the following conditions are met: #
|
||||
// # #
|
||||
// # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer. #
|
||||
// # #
|
||||
// # 2. Redistributions in binary form must reproduce the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer in the documentation and/or other materials #
|
||||
// # provided with the distribution. #
|
||||
// # #
|
||||
// # 3. Neither the name of the copyright holder nor the names of its contributors may be used to #
|
||||
// # endorse or promote products derived from this software without specific prior written #
|
||||
// # permission. #
|
||||
// # #
|
||||
// # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS #
|
||||
// # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF #
|
||||
// # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE #
|
||||
// # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
|
||||
// # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
|
||||
// # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED #
|
||||
// # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
|
||||
// # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED #
|
||||
// # OF THE POSSIBILITY OF SUCH DAMAGE. #
|
||||
// # ********************************************************************************************* #
|
||||
// # The NEORV32 Processor - https://github.com/stnolting/neorv32 (c) Stephan Nolting #
|
||||
// #################################################################################################
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* @file neorv32_mtime.h
|
||||
* @author Stephan Nolting
|
||||
* @brief Machine System Timer (MTIME) HW driver header file.
|
||||
*
|
||||
* @note These functions should only be used if the MTIME unit was synthesized (IO_MTIME_EN = true).
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef neorv32_mtime_h
|
||||
#define neorv32_mtime_h
|
||||
|
||||
// prototypes
|
||||
int neorv32_mtime_available(void);
|
||||
void neorv32_mtime_set_time(uint64_t time);
|
||||
uint64_t neorv32_mtime_get_time(void);
|
||||
void neorv32_mtime_set_timecmp(uint64_t timecmp);
|
||||
uint64_t neorv32_mtime_get_timecmp(void);
|
||||
|
||||
#endif // neorv32_mtime_h
|
72
Libs/RiscV/NEORV32/sw/lib/include/neorv32_neoled.h
Normal file
72
Libs/RiscV/NEORV32/sw/lib/include/neorv32_neoled.h
Normal file
@ -0,0 +1,72 @@
|
||||
// #################################################################################################
|
||||
// # << NEORV32: neorv32_neoled.h - Smart LED Interface (NEOLED) HW Driver >> #
|
||||
// # ********************************************************************************************* #
|
||||
// # BSD 3-Clause License #
|
||||
// # #
|
||||
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
||||
// # #
|
||||
// # Redistribution and use in source and binary forms, with or without modification, are #
|
||||
// # permitted provided that the following conditions are met: #
|
||||
// # #
|
||||
// # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer. #
|
||||
// # #
|
||||
// # 2. Redistributions in binary form must reproduce the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer in the documentation and/or other materials #
|
||||
// # provided with the distribution. #
|
||||
// # #
|
||||
// # 3. Neither the name of the copyright holder nor the names of its contributors may be used to #
|
||||
// # endorse or promote products derived from this software without specific prior written #
|
||||
// # permission. #
|
||||
// # #
|
||||
// # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS #
|
||||
// # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF #
|
||||
// # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE #
|
||||
// # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
|
||||
// # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
|
||||
// # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED #
|
||||
// # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
|
||||
// # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED #
|
||||
// # OF THE POSSIBILITY OF SUCH DAMAGE. #
|
||||
// # ********************************************************************************************* #
|
||||
// # The NEORV32 Processor - https://github.com/stnolting/neorv32 (c) Stephan Nolting #
|
||||
// #################################################################################################
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* @file neorv32_neoled.h
|
||||
* @author Stephan Nolting
|
||||
* @brief Smart LED Interface (NEOLED) HW driver header file.
|
||||
*
|
||||
* @note These functions should only be used if the NEOLED unit was synthesized (IO_NEOLED_EN = true).
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef neorv32_neoled_h
|
||||
#define neorv32_neoled_h
|
||||
|
||||
// prototypes
|
||||
int neorv32_neoled_available(void);
|
||||
void neorv32_neoled_setup(uint32_t prsc, uint32_t t_total, uint32_t t_high_zero, uint32_t t_high_one);
|
||||
void neorv32_neoled_setup_ws2812(void);
|
||||
void neorv32_neoled_set_mode(uint32_t mode);
|
||||
void neorv32_neoled_strobe_blocking(void);
|
||||
void neorv32_neoled_strobe_nonblocking(void);
|
||||
void neorv32_neoled_enable(void);
|
||||
void neorv32_neoled_disable(void);
|
||||
void neorv32_neoled_write_blocking(uint32_t data);
|
||||
uint32_t neorv32_neoled_get_buffer_size(void);
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Send single RGB(W) data word to NEOLED module (non-blocking).
|
||||
*
|
||||
* @warning This function uses NO busy/flag checks at all!
|
||||
*
|
||||
* @param[in] data LSB-aligned 24-bit RGB or 32-bit RGBW data
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_neoled_write_nonblocking(uint32_t data) {
|
||||
|
||||
NEORV32_NEOLED.DATA = data; // send new LED data
|
||||
}
|
||||
|
||||
#endif // neorv32_neoled_h
|
56
Libs/RiscV/NEORV32/sw/lib/include/neorv32_pwm.h
Normal file
56
Libs/RiscV/NEORV32/sw/lib/include/neorv32_pwm.h
Normal file
@ -0,0 +1,56 @@
|
||||
// #################################################################################################
|
||||
// # << NEORV32: neorv32_pwm.h - Pulse Width Modulation Controller (PWM) HW Driver >> #
|
||||
// # ********************************************************************************************* #
|
||||
// # BSD 3-Clause License #
|
||||
// # #
|
||||
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
||||
// # #
|
||||
// # Redistribution and use in source and binary forms, with or without modification, are #
|
||||
// # permitted provided that the following conditions are met: #
|
||||
// # #
|
||||
// # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer. #
|
||||
// # #
|
||||
// # 2. Redistributions in binary form must reproduce the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer in the documentation and/or other materials #
|
||||
// # provided with the distribution. #
|
||||
// # #
|
||||
// # 3. Neither the name of the copyright holder nor the names of its contributors may be used to #
|
||||
// # endorse or promote products derived from this software without specific prior written #
|
||||
// # permission. #
|
||||
// # #
|
||||
// # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS #
|
||||
// # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF #
|
||||
// # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE #
|
||||
// # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
|
||||
// # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
|
||||
// # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED #
|
||||
// # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
|
||||
// # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED #
|
||||
// # OF THE POSSIBILITY OF SUCH DAMAGE. #
|
||||
// # ********************************************************************************************* #
|
||||
// # The NEORV32 Processor - https://github.com/stnolting/neorv32 (c) Stephan Nolting #
|
||||
// #################################################################################################
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* @file neorv32_pwm.h
|
||||
* @author Stephan Nolting
|
||||
* @brief Pulse-Width Modulation Controller (PWM) HW driver header file.
|
||||
*
|
||||
* @note These functions should only be used if the PWM unit was synthesized (IO_PWM_EN = true).
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef neorv32_pwm_h
|
||||
#define neorv32_pwm_h
|
||||
|
||||
// prototypes
|
||||
int neorv32_pwm_available(void);
|
||||
void neorv32_pwm_setup(uint8_t prsc);
|
||||
void neorv32_pwm_disable(void);
|
||||
void neorv32_pwm_enable(void);
|
||||
int neorv32_pmw_get_num_channels(void);
|
||||
void neorv32_pwm_set(uint8_t channel, uint8_t duty);
|
||||
uint8_t neorv32_pwm_get(uint8_t channel);
|
||||
|
||||
#endif // neorv32_pwm_h
|
101
Libs/RiscV/NEORV32/sw/lib/include/neorv32_rte.h
Normal file
101
Libs/RiscV/NEORV32/sw/lib/include/neorv32_rte.h
Normal file
@ -0,0 +1,101 @@
|
||||
// #################################################################################################
|
||||
// # << NEORV32: neorv32_rte.h - NEORV32 Runtime Environment >> #
|
||||
// # ********************************************************************************************* #
|
||||
// # BSD 3-Clause License #
|
||||
// # #
|
||||
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
||||
// # #
|
||||
// # Redistribution and use in source and binary forms, with or without modification, are #
|
||||
// # permitted provided that the following conditions are met: #
|
||||
// # #
|
||||
// # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer. #
|
||||
// # #
|
||||
// # 2. Redistributions in binary form must reproduce the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer in the documentation and/or other materials #
|
||||
// # provided with the distribution. #
|
||||
// # #
|
||||
// # 3. Neither the name of the copyright holder nor the names of its contributors may be used to #
|
||||
// # endorse or promote products derived from this software without specific prior written #
|
||||
// # permission. #
|
||||
// # #
|
||||
// # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS #
|
||||
// # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF #
|
||||
// # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE #
|
||||
// # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
|
||||
// # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
|
||||
// # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED #
|
||||
// # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
|
||||
// # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED #
|
||||
// # OF THE POSSIBILITY OF SUCH DAMAGE. #
|
||||
// # ********************************************************************************************* #
|
||||
// # The NEORV32 Processor - https://github.com/stnolting/neorv32 (c) Stephan Nolting #
|
||||
// #################################################################################################
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* @file neorv32_rte.h
|
||||
* @author Stephan Nolting
|
||||
* @brief NEORV32 Runtime Environment.
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef neorv32_rte_h
|
||||
#define neorv32_rte_h
|
||||
|
||||
/**********************************************************************//**
|
||||
* NEORV32 runtime environment trap IDs.
|
||||
**************************************************************************/
|
||||
enum NEORV32_RTE_TRAP_enum {
|
||||
RTE_TRAP_I_MISALIGNED = 0, /**< Instruction address misaligned */
|
||||
RTE_TRAP_I_ACCESS = 1, /**< Instruction (bus) access fault */
|
||||
RTE_TRAP_I_ILLEGAL = 2, /**< Illegal instruction */
|
||||
RTE_TRAP_BREAKPOINT = 3, /**< Breakpoint (EBREAK instruction) */
|
||||
RTE_TRAP_L_MISALIGNED = 4, /**< Load address misaligned */
|
||||
RTE_TRAP_L_ACCESS = 5, /**< Load (bus) access fault */
|
||||
RTE_TRAP_S_MISALIGNED = 6, /**< Store address misaligned */
|
||||
RTE_TRAP_S_ACCESS = 7, /**< Store (bus) access fault */
|
||||
RTE_TRAP_UENV_CALL = 8, /**< Environment call from user mode (ECALL instruction) */
|
||||
RTE_TRAP_MENV_CALL = 9, /**< Environment call from machine mode (ECALL instruction) */
|
||||
RTE_TRAP_MSI = 10, /**< Machine software interrupt */
|
||||
RTE_TRAP_MTI = 11, /**< Machine timer interrupt */
|
||||
RTE_TRAP_MEI = 12, /**< Machine external interrupt */
|
||||
RTE_TRAP_FIRQ_0 = 13, /**< Fast interrupt channel 0 */
|
||||
RTE_TRAP_FIRQ_1 = 14, /**< Fast interrupt channel 1 */
|
||||
RTE_TRAP_FIRQ_2 = 15, /**< Fast interrupt channel 2 */
|
||||
RTE_TRAP_FIRQ_3 = 16, /**< Fast interrupt channel 3 */
|
||||
RTE_TRAP_FIRQ_4 = 17, /**< Fast interrupt channel 4 */
|
||||
RTE_TRAP_FIRQ_5 = 18, /**< Fast interrupt channel 5 */
|
||||
RTE_TRAP_FIRQ_6 = 19, /**< Fast interrupt channel 6 */
|
||||
RTE_TRAP_FIRQ_7 = 20, /**< Fast interrupt channel 7 */
|
||||
RTE_TRAP_FIRQ_8 = 21, /**< Fast interrupt channel 8 */
|
||||
RTE_TRAP_FIRQ_9 = 22, /**< Fast interrupt channel 9 */
|
||||
RTE_TRAP_FIRQ_10 = 23, /**< Fast interrupt channel 10 */
|
||||
RTE_TRAP_FIRQ_11 = 24, /**< Fast interrupt channel 11 */
|
||||
RTE_TRAP_FIRQ_12 = 25, /**< Fast interrupt channel 12 */
|
||||
RTE_TRAP_FIRQ_13 = 26, /**< Fast interrupt channel 13 */
|
||||
RTE_TRAP_FIRQ_14 = 27, /**< Fast interrupt channel 14 */
|
||||
RTE_TRAP_FIRQ_15 = 28 /**< Fast interrupt channel 15 */
|
||||
};
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* NEORV32 runtime environment: Number of available traps.
|
||||
**************************************************************************/
|
||||
#define NEORV32_RTE_NUM_TRAPS 29
|
||||
|
||||
|
||||
// prototypes
|
||||
void neorv32_rte_setup(void);
|
||||
int neorv32_rte_exception_install(uint8_t id, void (*handler)(void));
|
||||
int neorv32_rte_exception_uninstall(uint8_t id);
|
||||
|
||||
void neorv32_rte_print_hw_config(void);
|
||||
void neorv32_rte_print_hw_version(void);
|
||||
void neorv32_rte_print_credits(void);
|
||||
void neorv32_rte_print_logo(void);
|
||||
void neorv32_rte_print_license(void);
|
||||
|
||||
uint32_t neorv32_rte_get_compiler_isa(void);
|
||||
int neorv32_rte_check_isa(int silent);
|
||||
|
||||
#endif // neorv32_rte_h
|
269
Libs/RiscV/NEORV32/sw/lib/include/neorv32_slink.h
Normal file
269
Libs/RiscV/NEORV32/sw/lib/include/neorv32_slink.h
Normal file
@ -0,0 +1,269 @@
|
||||
// #################################################################################################
|
||||
// # << NEORV32: neorv32_slink.h - Stream Link Interface HW Driver >> #
|
||||
// # ********************************************************************************************* #
|
||||
// # BSD 3-Clause License #
|
||||
// # #
|
||||
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
||||
// # #
|
||||
// # Redistribution and use in source and binary forms, with or without modification, are #
|
||||
// # permitted provided that the following conditions are met: #
|
||||
// # #
|
||||
// # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer. #
|
||||
// # #
|
||||
// # 2. Redistributions in binary form must reproduce the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer in the documentation and/or other materials #
|
||||
// # provided with the distribution. #
|
||||
// # #
|
||||
// # 3. Neither the name of the copyright holder nor the names of its contributors may be used to #
|
||||
// # endorse or promote products derived from this software without specific prior written #
|
||||
// # permission. #
|
||||
// # #
|
||||
// # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS #
|
||||
// # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF #
|
||||
// # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE #
|
||||
// # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
|
||||
// # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
|
||||
// # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED #
|
||||
// # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
|
||||
// # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED #
|
||||
// # OF THE POSSIBILITY OF SUCH DAMAGE. #
|
||||
// # ********************************************************************************************* #
|
||||
// # The NEORV32 Processor - https://github.com/stnolting/neorv32 (c) Stephan Nolting #
|
||||
// #################################################################################################
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* @file neorv32_slink.h
|
||||
* @author Stephan Nolting
|
||||
* @brief Stream Link Interface HW driver header file.
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef neorv32_slink_h
|
||||
#define neorv32_slink_h
|
||||
|
||||
// prototypes
|
||||
int neorv32_slink_available(void);
|
||||
void neorv32_slink_enable(void);
|
||||
void neorv32_slink_disable(void);
|
||||
void neorv32_slink_rx_irq_config(int link_id, int irq_en, int irq_type);
|
||||
void neorv32_slink_tx_irq_config(int link_id, int irq_en, int irq_type);
|
||||
int neorv32_slink_get_rx_num(void);
|
||||
int neorv32_slink_get_tx_num(void);
|
||||
int neorv32_slink_get_rx_depth(void);
|
||||
int neorv32_slink_get_tx_depth(void);
|
||||
int neorv32_slink_check_rx_half_full(int link_id);
|
||||
int neorv32_slink_check_tx_half_full(int link_id);
|
||||
// non-blocking transmit
|
||||
int neorv32_slink_tx0_nonblocking(uint32_t tx_data);
|
||||
int neorv32_slink_tx1_nonblocking(uint32_t tx_data);
|
||||
int neorv32_slink_tx2_nonblocking(uint32_t tx_data);
|
||||
int neorv32_slink_tx3_nonblocking(uint32_t tx_data);
|
||||
int neorv32_slink_tx4_nonblocking(uint32_t tx_data);
|
||||
int neorv32_slink_tx5_nonblocking(uint32_t tx_data);
|
||||
int neorv32_slink_tx6_nonblocking(uint32_t tx_data);
|
||||
int neorv32_slink_tx7_nonblocking(uint32_t tx_data);
|
||||
// non-blocking receive
|
||||
int neorv32_slink_rx0_nonblocking(uint32_t *rx_data);
|
||||
int neorv32_slink_rx1_nonblocking(uint32_t *rx_data);
|
||||
int neorv32_slink_rx2_nonblocking(uint32_t *rx_data);
|
||||
int neorv32_slink_rx3_nonblocking(uint32_t *rx_data);
|
||||
int neorv32_slink_rx4_nonblocking(uint32_t *rx_data);
|
||||
int neorv32_slink_rx5_nonblocking(uint32_t *rx_data);
|
||||
int neorv32_slink_rx6_nonblocking(uint32_t *rx_data);
|
||||
int neorv32_slink_rx7_nonblocking(uint32_t *rx_data);
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Write data to TX stream link 0 (blocking!)
|
||||
*
|
||||
* @warning This function will raise an exception when the bus access times out!
|
||||
*
|
||||
* @param[in] tx_data Data to send to link.
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_slink_tx0_blocking(uint32_t tx_data) {
|
||||
NEORV32_SLINK.DATA[0] = tx_data;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Write data to TX stream link 1 (blocking!)
|
||||
*
|
||||
* @warning This function will raise an exception when the bus access times out!
|
||||
*
|
||||
* @param[in] tx_data Data to send to link.
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_slink_tx1_blocking(uint32_t tx_data) {
|
||||
NEORV32_SLINK.DATA[1] = tx_data;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Write data to TX stream link 2 (blocking!)
|
||||
*
|
||||
* @warning This function will raise an exception when the bus access times out!
|
||||
*
|
||||
* @param[in] tx_data Data to send to link.
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_slink_tx2_blocking(uint32_t tx_data) {
|
||||
NEORV32_SLINK.DATA[2] = tx_data;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Write data to TX stream link 3 (blocking!)
|
||||
*
|
||||
* @warning This function will raise an exception when the bus access times out!
|
||||
*
|
||||
* @param[in] tx_data Data to send to link.
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_slink_tx3_blocking(uint32_t tx_data) {
|
||||
NEORV32_SLINK.DATA[3] = tx_data;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Write data to TX stream link 4 (blocking!)
|
||||
*
|
||||
* @warning This function will raise an exception when the bus access times out!
|
||||
*
|
||||
* @param[in] tx_data Data to send to link.
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_slink_tx4_blocking(uint32_t tx_data) {
|
||||
NEORV32_SLINK.DATA[4] = tx_data;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Write data to TX stream link 5 (blocking!)
|
||||
*
|
||||
* @warning This function will raise an exception when the bus access times out!
|
||||
*
|
||||
* @param[in] tx_data Data to send to link.
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_slink_tx5_blocking(uint32_t tx_data) {
|
||||
NEORV32_SLINK.DATA[5] = tx_data;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Write data to TX stream link 6 (blocking!)
|
||||
*
|
||||
* @warning This function will raise an exception when the bus access times out!
|
||||
*
|
||||
* @param[in] tx_data Data to send to link.
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_slink_tx6_blocking(uint32_t tx_data) {
|
||||
NEORV32_SLINK.DATA[6] = tx_data;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Write data to TX stream link 7 (blocking!)
|
||||
*
|
||||
* @warning This function will raise an exception when the bus access times out!
|
||||
*
|
||||
* @param[in] tx_data Data to send to link.
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_slink_tx7_blocking(uint32_t tx_data) {
|
||||
NEORV32_SLINK.DATA[7] = tx_data;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Read data from RX stream link 0 (blocking!)
|
||||
*
|
||||
* @warning This function will raise an exception when the bus access times out!
|
||||
*
|
||||
* @param[in,out] rx_data Pointer to return read data.
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_slink_rx0_blocking(uint32_t *rx_data) {
|
||||
*rx_data = NEORV32_SLINK.DATA[0];
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Read data from RX stream link 1 (blocking!)
|
||||
*
|
||||
* @warning This function will raise an exception when the bus access times out!
|
||||
*
|
||||
* @param[in,out] rx_data Pointer to return read data.
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_slink_rx1_blocking(uint32_t *rx_data) {
|
||||
*rx_data = NEORV32_SLINK.DATA[1];
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Read data from RX stream link 2 (blocking!)
|
||||
*
|
||||
* @warning This function will raise an exception when the bus access times out!
|
||||
*
|
||||
* @param[in,out] rx_data Pointer to return read data.
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_slink_rx2_blocking(uint32_t *rx_data) {
|
||||
*rx_data = NEORV32_SLINK.DATA[2];
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Read data from RX stream link 3 (blocking!)
|
||||
*
|
||||
* @warning This function will raise an exception when the bus access times out!
|
||||
*
|
||||
* @param[in,out] rx_data Pointer to return read data.
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_slink_rx3_blocking(uint32_t *rx_data) {
|
||||
*rx_data = NEORV32_SLINK.DATA[3];
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Read data from RX stream link 4 (blocking!)
|
||||
*
|
||||
* @warning This function will raise an exception when the bus access times out!
|
||||
*
|
||||
* @param[in,out] rx_data Pointer to return read data.
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_slink_rx4_blocking(uint32_t *rx_data) {
|
||||
*rx_data = NEORV32_SLINK.DATA[4];
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Read data from RX stream link 5 (blocking!)
|
||||
*
|
||||
* @warning This function will raise an exception when the bus access times out!
|
||||
*
|
||||
* @param[in,out] rx_data Pointer to return read data.
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_slink_rx5_blocking(uint32_t *rx_data) {
|
||||
*rx_data = NEORV32_SLINK.DATA[5];
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Read data from RX stream link 6 (blocking!)
|
||||
*
|
||||
* @warning This function will raise an exception when the bus access times out!
|
||||
*
|
||||
* @param[in,out] rx_data Pointer to return read data.
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_slink_rx6_blocking(uint32_t *rx_data) {
|
||||
*rx_data = NEORV32_SLINK.DATA[6];
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* Read data from RX stream link 7 (blocking!)
|
||||
*
|
||||
* @warning This function will raise an exception when the bus access times out!
|
||||
*
|
||||
* @param[in,out] rx_data Pointer to return read data.
|
||||
**************************************************************************/
|
||||
inline void __attribute__ ((always_inline)) neorv32_slink_rx7_blocking(uint32_t *rx_data) {
|
||||
*rx_data = NEORV32_SLINK.DATA[7];
|
||||
}
|
||||
|
||||
|
||||
#endif // neorv32_slink_h
|
59
Libs/RiscV/NEORV32/sw/lib/include/neorv32_spi.h
Normal file
59
Libs/RiscV/NEORV32/sw/lib/include/neorv32_spi.h
Normal file
@ -0,0 +1,59 @@
|
||||
// #################################################################################################
|
||||
// # << NEORV32: neorv32_spi.h - Serial Peripheral Interface Controller (SPI) HW Driver >> #
|
||||
// # ********************************************************************************************* #
|
||||
// # BSD 3-Clause License #
|
||||
// # #
|
||||
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
||||
// # #
|
||||
// # Redistribution and use in source and binary forms, with or without modification, are #
|
||||
// # permitted provided that the following conditions are met: #
|
||||
// # #
|
||||
// # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer. #
|
||||
// # #
|
||||
// # 2. Redistributions in binary form must reproduce the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer in the documentation and/or other materials #
|
||||
// # provided with the distribution. #
|
||||
// # #
|
||||
// # 3. Neither the name of the copyright holder nor the names of its contributors may be used to #
|
||||
// # endorse or promote products derived from this software without specific prior written #
|
||||
// # permission. #
|
||||
// # #
|
||||
// # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS #
|
||||
// # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF #
|
||||
// # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE #
|
||||
// # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
|
||||
// # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
|
||||
// # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED #
|
||||
// # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
|
||||
// # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED #
|
||||
// # OF THE POSSIBILITY OF SUCH DAMAGE. #
|
||||
// # ********************************************************************************************* #
|
||||
// # The NEORV32 Processor - https://github.com/stnolting/neorv32 (c) Stephan Nolting #
|
||||
// #################################################################################################
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* @file neorv32_spi.h
|
||||
* @author Stephan Nolting
|
||||
* @brief Serial peripheral interface controller (SPI) HW driver header file.
|
||||
*
|
||||
* @note These functions should only be used if the SPI unit was synthesized (IO_SPI_EN = true).
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef neorv32_spi_h
|
||||
#define neorv32_spi_h
|
||||
|
||||
// prototypes
|
||||
int neorv32_spi_available(void);
|
||||
void neorv32_spi_setup(uint8_t prsc, uint8_t clk_phase, uint8_t clk_polarity, uint8_t data_size);
|
||||
void neorv32_spi_disable(void);
|
||||
void neorv32_spi_enable(void);
|
||||
void neorv32_spi_cs_en(uint8_t cs);
|
||||
void neorv32_spi_cs_dis(uint8_t cs);
|
||||
uint32_t neorv32_spi_trans(uint32_t tx_data);
|
||||
void neorv32_spi_put_nonblocking(uint32_t tx_data);
|
||||
uint32_t neorv32_spi_get_nonblocking(void);
|
||||
int neorv32_spi_busy(void);
|
||||
|
||||
#endif // neorv32_spi_h
|
53
Libs/RiscV/NEORV32/sw/lib/include/neorv32_trng.h
Normal file
53
Libs/RiscV/NEORV32/sw/lib/include/neorv32_trng.h
Normal file
@ -0,0 +1,53 @@
|
||||
// #################################################################################################
|
||||
// # << NEORV32: neorv32_trng.h - True Random Number Generator (TRNG) HW Driver >> #
|
||||
// # ********************************************************************************************* #
|
||||
// # BSD 3-Clause License #
|
||||
// # #
|
||||
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
||||
// # #
|
||||
// # Redistribution and use in source and binary forms, with or without modification, are #
|
||||
// # permitted provided that the following conditions are met: #
|
||||
// # #
|
||||
// # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer. #
|
||||
// # #
|
||||
// # 2. Redistributions in binary form must reproduce the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer in the documentation and/or other materials #
|
||||
// # provided with the distribution. #
|
||||
// # #
|
||||
// # 3. Neither the name of the copyright holder nor the names of its contributors may be used to #
|
||||
// # endorse or promote products derived from this software without specific prior written #
|
||||
// # permission. #
|
||||
// # #
|
||||
// # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS #
|
||||
// # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF #
|
||||
// # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE #
|
||||
// # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
|
||||
// # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
|
||||
// # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED #
|
||||
// # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
|
||||
// # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED #
|
||||
// # OF THE POSSIBILITY OF SUCH DAMAGE. #
|
||||
// # ********************************************************************************************* #
|
||||
// # The NEORV32 Processor - https://github.com/stnolting/neorv32 (c) Stephan Nolting #
|
||||
// #################################################################################################
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* @file neorv32_trng.h
|
||||
* @author Stephan Nolting
|
||||
* @brief True Random Number Generator (TRNG) HW driver header file.
|
||||
*
|
||||
* @note These functions should only be used if the TRNG unit was synthesized (IO_TRNG_EN = true).
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef neorv32_trng_h
|
||||
#define neorv32_trng_h
|
||||
|
||||
// prototypes
|
||||
int neorv32_trng_available(void);
|
||||
void neorv32_trng_enable(void);
|
||||
void neorv32_trng_disable(void);
|
||||
int neorv32_trng_get(uint8_t *data);
|
||||
|
||||
#endif // neorv32_trng_h
|
61
Libs/RiscV/NEORV32/sw/lib/include/neorv32_twi.h
Normal file
61
Libs/RiscV/NEORV32/sw/lib/include/neorv32_twi.h
Normal file
@ -0,0 +1,61 @@
|
||||
// #################################################################################################
|
||||
// # << NEORV32: neorv32_twi.h - Two-Wire Interface Controller (TWI) HW Driver >> #
|
||||
// # ********************************************************************************************* #
|
||||
// # BSD 3-Clause License #
|
||||
// # #
|
||||
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
||||
// # #
|
||||
// # Redistribution and use in source and binary forms, with or without modification, are #
|
||||
// # permitted provided that the following conditions are met: #
|
||||
// # #
|
||||
// # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer. #
|
||||
// # #
|
||||
// # 2. Redistributions in binary form must reproduce the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer in the documentation and/or other materials #
|
||||
// # provided with the distribution. #
|
||||
// # #
|
||||
// # 3. Neither the name of the copyright holder nor the names of its contributors may be used to #
|
||||
// # endorse or promote products derived from this software without specific prior written #
|
||||
// # permission. #
|
||||
// # #
|
||||
// # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS #
|
||||
// # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF #
|
||||
// # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE #
|
||||
// # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
|
||||
// # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
|
||||
// # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED #
|
||||
// # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
|
||||
// # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED #
|
||||
// # OF THE POSSIBILITY OF SUCH DAMAGE. #
|
||||
// # ********************************************************************************************* #
|
||||
// # The NEORV32 Processor - https://github.com/stnolting/neorv32 (c) Stephan Nolting #
|
||||
// #################################################################################################
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* @file neorv32_twi.h
|
||||
* @author Stephan Nolting
|
||||
* @brief Two-Wire Interface Controller (TWI) HW driver header file.
|
||||
*
|
||||
* @note These functions should only be used if the TWI unit was synthesized (IO_TWI_EN = true).
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef neorv32_twi_h
|
||||
#define neorv32_twi_h
|
||||
|
||||
// prototypes
|
||||
int neorv32_twi_available(void);
|
||||
void neorv32_twi_setup(uint8_t prsc);
|
||||
void neorv32_twi_disable(void);
|
||||
void neorv32_twi_enable(void);
|
||||
void neorv32_twi_mack_enable(void);
|
||||
void neorv32_twi_mack_disable(void);
|
||||
int neorv32_twi_busy(void);
|
||||
int neorv32_twi_start_trans(uint8_t a);
|
||||
int neorv32_twi_trans(uint8_t d);
|
||||
uint8_t neorv32_twi_get_data(void);
|
||||
void neorv32_twi_generate_stop(void);
|
||||
void neorv32_twi_generate_start(void);
|
||||
|
||||
#endif // neorv32_twi_h
|
82
Libs/RiscV/NEORV32/sw/lib/include/neorv32_uart.h
Normal file
82
Libs/RiscV/NEORV32/sw/lib/include/neorv32_uart.h
Normal file
@ -0,0 +1,82 @@
|
||||
// #################################################################################################
|
||||
// # << NEORV32: neorv32_uart.h - Universal Asynchronous Receiver/Transmitter (UART) HW Driver >> #
|
||||
// # ********************************************************************************************* #
|
||||
// # BSD 3-Clause License #
|
||||
// # #
|
||||
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
||||
// # #
|
||||
// # Redistribution and use in source and binary forms, with or without modification, are #
|
||||
// # permitted provided that the following conditions are met: #
|
||||
// # #
|
||||
// # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer. #
|
||||
// # #
|
||||
// # 2. Redistributions in binary form must reproduce the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer in the documentation and/or other materials #
|
||||
// # provided with the distribution. #
|
||||
// # #
|
||||
// # 3. Neither the name of the copyright holder nor the names of its contributors may be used to #
|
||||
// # endorse or promote products derived from this software without specific prior written #
|
||||
// # permission. #
|
||||
// # #
|
||||
// # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS #
|
||||
// # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF #
|
||||
// # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE #
|
||||
// # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
|
||||
// # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
|
||||
// # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED #
|
||||
// # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
|
||||
// # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED #
|
||||
// # OF THE POSSIBILITY OF SUCH DAMAGE. #
|
||||
// # ********************************************************************************************* #
|
||||
// # The NEORV32 Processor - https://github.com/stnolting/neorv32 (c) Stephan Nolting #
|
||||
// #################################################################################################
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* @file neorv32_uart.h
|
||||
* @author Stephan Nolting
|
||||
* @brief Universal asynchronous receiver/transmitter (UART0/UART1) HW driver header file
|
||||
*
|
||||
* @warning UART0 (primary UART) is used as default user console interface for all NEORV32 software framework/library functions.
|
||||
*
|
||||
* @note These functions should only be used if the UART0/UART1 unit was synthesized (IO_UART0_EN = true / IO_UART1_EN = true).
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef neorv32_uart_h
|
||||
#define neorv32_uart_h
|
||||
|
||||
// Libs required by functions
|
||||
#include <stdarg.h>
|
||||
|
||||
// prototypes for UART0 (primary UART)
|
||||
int neorv32_uart0_available(void);
|
||||
void neorv32_uart0_setup(uint32_t baudrate, uint8_t parity, uint8_t flow_con);
|
||||
void neorv32_uart0_disable(void);
|
||||
void neorv32_uart0_enable(void);
|
||||
void neorv32_uart0_putc(char c);
|
||||
int neorv32_uart0_tx_busy(void);
|
||||
char neorv32_uart0_getc(void);
|
||||
int neorv32_uart0_char_received(void);
|
||||
int neorv32_uart0_getc_safe(char *data);
|
||||
char neorv32_uart0_char_received_get(void);
|
||||
void neorv32_uart0_print(const char *s);
|
||||
void neorv32_uart0_printf(const char *format, ...);
|
||||
int neorv32_uart0_scan(char *buffer, int max_size, int echo);
|
||||
|
||||
// prototypes for UART1 (secondary UART)
|
||||
int neorv32_uart1_available(void);
|
||||
void neorv32_uart1_setup(uint32_t baudrate, uint8_t parity, uint8_t flow_con);
|
||||
void neorv32_uart1_disable(void);
|
||||
void neorv32_uart1_enable(void);
|
||||
void neorv32_uart1_putc(char c);
|
||||
int neorv32_uart1_tx_busy(void);
|
||||
char neorv32_uart1_getc(void);
|
||||
int neorv32_uart1_char_received(void);
|
||||
int neorv32_uart1_getc_safe(char *data);
|
||||
char neorv32_uart1_char_received_get(void);
|
||||
void neorv32_uart1_print(const char *s);
|
||||
void neorv32_uart1_printf(const char *format, ...);
|
||||
int neorv32_uart1_scan(char *buffer, int max_size, int echo);
|
||||
|
||||
#endif // neorv32_uart_h
|
55
Libs/RiscV/NEORV32/sw/lib/include/neorv32_wdt.h
Normal file
55
Libs/RiscV/NEORV32/sw/lib/include/neorv32_wdt.h
Normal file
@ -0,0 +1,55 @@
|
||||
// #################################################################################################
|
||||
// # << NEORV32: neorv32_wdt.h - Watchdog Timer (WDT) HW Driver >> #
|
||||
// # ********************************************************************************************* #
|
||||
// # BSD 3-Clause License #
|
||||
// # #
|
||||
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
||||
// # #
|
||||
// # Redistribution and use in source and binary forms, with or without modification, are #
|
||||
// # permitted provided that the following conditions are met: #
|
||||
// # #
|
||||
// # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer. #
|
||||
// # #
|
||||
// # 2. Redistributions in binary form must reproduce the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer in the documentation and/or other materials #
|
||||
// # provided with the distribution. #
|
||||
// # #
|
||||
// # 3. Neither the name of the copyright holder nor the names of its contributors may be used to #
|
||||
// # endorse or promote products derived from this software without specific prior written #
|
||||
// # permission. #
|
||||
// # #
|
||||
// # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS #
|
||||
// # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF #
|
||||
// # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE #
|
||||
// # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
|
||||
// # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
|
||||
// # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED #
|
||||
// # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
|
||||
// # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED #
|
||||
// # OF THE POSSIBILITY OF SUCH DAMAGE. #
|
||||
// # ********************************************************************************************* #
|
||||
// # The NEORV32 Processor - https://github.com/stnolting/neorv32 (c) Stephan Nolting #
|
||||
// #################################################################################################
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* @file neorv32_wdt.h
|
||||
* @author Stephan Nolting
|
||||
* @brief Watchdog Timer (WDT) HW driver header file.
|
||||
*
|
||||
* @note These functions should only be used if the WDT unit was synthesized (IO_WDT_EN = true).
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef neorv32_wdt_h
|
||||
#define neorv32_wdt_h
|
||||
|
||||
// prototypes
|
||||
int neorv32_wdt_available(void);
|
||||
void neorv32_wdt_setup(uint8_t prsc, uint8_t mode, uint8_t lock);
|
||||
int neorv32_wdt_disable(void);
|
||||
void neorv32_wdt_reset(void);
|
||||
int neorv32_wdt_get_cause(void);
|
||||
void neorv32_wdt_force(void);
|
||||
|
||||
#endif // neorv32_wdt_h
|
59
Libs/RiscV/NEORV32/sw/lib/include/neorv32_xirq.h
Normal file
59
Libs/RiscV/NEORV32/sw/lib/include/neorv32_xirq.h
Normal file
@ -0,0 +1,59 @@
|
||||
// #################################################################################################
|
||||
// # << NEORV32: neorv32_xirq.h - External Interrupt controller HW Driver >> #
|
||||
// # ********************************************************************************************* #
|
||||
// # BSD 3-Clause License #
|
||||
// # #
|
||||
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
||||
// # #
|
||||
// # Redistribution and use in source and binary forms, with or without modification, are #
|
||||
// # permitted provided that the following conditions are met: #
|
||||
// # #
|
||||
// # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer. #
|
||||
// # #
|
||||
// # 2. Redistributions in binary form must reproduce the above copyright notice, this list of #
|
||||
// # conditions and the following disclaimer in the documentation and/or other materials #
|
||||
// # provided with the distribution. #
|
||||
// # #
|
||||
// # 3. Neither the name of the copyright holder nor the names of its contributors may be used to #
|
||||
// # endorse or promote products derived from this software without specific prior written #
|
||||
// # permission. #
|
||||
// # #
|
||||
// # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS #
|
||||
// # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF #
|
||||
// # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE #
|
||||
// # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
|
||||
// # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
|
||||
// # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED #
|
||||
// # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
|
||||
// # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED #
|
||||
// # OF THE POSSIBILITY OF SUCH DAMAGE. #
|
||||
// # ********************************************************************************************* #
|
||||
// # The NEORV32 Processor - https://github.com/stnolting/neorv32 (c) Stephan Nolting #
|
||||
// #################################################################################################
|
||||
|
||||
|
||||
/**********************************************************************//**
|
||||
* @file neorv32_xirq.h
|
||||
* @author Stephan Nolting
|
||||
* @brief External Interrupt controller HW driver header file.
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef neorv32_xirq_h
|
||||
#define neorv32_xirq_h
|
||||
|
||||
// prototypes
|
||||
int neorv32_xirq_available(void);
|
||||
int neorv32_xirq_setup(void);
|
||||
void neorv32_xirq_global_enable(void);
|
||||
void neorv32_xirq_global_disable(void);
|
||||
int neorv32_xirq_get_num(void);
|
||||
void neorv32_xirq_clear_pending(uint8_t ch);
|
||||
void neorv32_xirq_channel_enable(uint8_t ch);
|
||||
void neorv32_xirq_channel_disable(uint8_t ch);
|
||||
|
||||
int neorv32_xirq_install(uint8_t ch, void (*handler)(void));
|
||||
int neorv32_xirq_uninstall(uint8_t ch);
|
||||
|
||||
|
||||
#endif // neorv32_xirq_h
|
Reference in New Issue
Block a user