NEORV32 - Software Framework Documentation
Loading...
Searching...
No Matches
legacy.h
Go to the documentation of this file.
1// #################################################################################################
2// # << NEORV32: legacy.h - Backwards compatibility wrappers and functions >> #
3// # ********************************************************************************************* #
4// # BSD 3-Clause License #
5// # #
6// # Copyright (c) 2023, Stephan Nolting. All rights reserved. #
7// # #
8// # Redistribution and use in source and binary forms, with or without modification, are #
9// # permitted provided that the following conditions are met: #
10// # #
11// # 1. Redistributions of source code must retain the above copyright notice, this list of #
12// # conditions and the following disclaimer. #
13// # #
14// # 2. Redistributions in binary form must reproduce the above copyright notice, this list of #
15// # conditions and the following disclaimer in the documentation and/or other materials #
16// # provided with the distribution. #
17// # #
18// # 3. Neither the name of the copyright holder nor the names of its contributors may be used to #
19// # endorse or promote products derived from this software without specific prior written #
20// # permission. #
21// # #
22// # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS #
23// # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF #
24// # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE #
25// # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
26// # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE #
27// # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED #
28// # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
29// # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED #
30// # OF THE POSSIBILITY OF SUCH DAMAGE. #
31// # ********************************************************************************************* #
32// # The NEORV32 Processor - https://github.com/stnolting/neorv32 (c) Stephan Nolting #
33// #################################################################################################
34
35
36/**********************************************************************/
42#ifndef neorv32_legacy_h
43#define neorv32_legacy_h
44
45
46// ================================================================================================
47// UART0 & UART1
48// ================================================================================================
49
50/**********************************************************************/
56inline void __attribute__((deprecated("Use 'neorv32_uart0_puts()' instead."))) neorv32_uart0_print(const char *s) {
58}
59
60/**********************************************************************/
66inline void __attribute__((deprecated("Use 'neorv32_uart0_puts()' instead."))) neorv32_uart1_print(const char *s) {
68}
69
70
71// ================================================================================================
72// NEORV32 Runtime Environment (RTE)
73// ================================================================================================
74
75/**********************************************************************/
82inline int __attribute__((deprecated("Use 'neorv32_rte_handler_install()' instead."))) neorv32_rte_exception_install(uint8_t id, void (*handler)(void)) {
83 return neorv32_rte_handler_install(id, handler);
84}
85
86/**********************************************************************/
93inline int __attribute__((deprecated("Use 'neorv32_rte_handler_uninstall()' instead."))) neorv32_rte_exception_uninstall(uint8_t id) {
95}
96
97
98// ================================================================================================
99// Custom Functions Unit (CFU)
100// ================================================================================================
101
102/**********************************************************************/
108#define neorv32_cfu_cmd0(funct7, rs1, rs2) neorv32_cfu_r3_instr(funct7, 0, rs1, rs2)
110#define neorv32_cfu_cmd1(funct7, rs1, rs2) neorv32_cfu_r3_instr(funct7, 1, rs1, rs2)
112#define neorv32_cfu_cmd2(funct7, rs1, rs2) neorv32_cfu_r3_instr(funct7, 2, rs1, rs2)
114#define neorv32_cfu_cmd3(funct7, rs1, rs2) neorv32_cfu_r3_instr(funct7, 3, rs1, rs2)
116#define neorv32_cfu_cmd4(funct7, rs1, rs2) neorv32_cfu_r3_instr(funct7, 4, rs1, rs2)
118#define neorv32_cfu_cmd5(funct7, rs1, rs2) neorv32_cfu_r3_instr(funct7, 5, rs1, rs2)
120#define neorv32_cfu_cmd6(funct7, rs1, rs2) neorv32_cfu_r3_instr(funct7, 6, rs1, rs2)
122#define neorv32_cfu_cmd7(funct7, rs1, rs2) neorv32_cfu_r3_instr(funct7, 7, rs1, rs2)
126// ================================================================================================
127// CPU Core
128// ================================================================================================
129
130/**********************************************************************/
135inline uint64_t __attribute__((deprecated("Use 'neorv32_mtime_get_time()' instead."))) neorv32_cpu_get_systime(void) {
136 return neorv32_mtime_get_time();
137}
138
139/**********************************************************************/
143inline void __attribute__ ((always_inline, deprecated("Use 'neorv32_cpu_csr_set(CSR_MSTATUS, 1 << CSR_MSTATUS_MIE)' instead."))) neorv32_cpu_eint(void) {
144
146}
147
148/**********************************************************************/
152inline void __attribute__ ((always_inline, deprecated("Use 'neorv32_cpu_csr_clr(CSR_MSTATUS, 1 << CSR_MSTATUS_MIE)' instead."))) neorv32_cpu_dint(void) {
153
155}
156
157/**********************************************************************/
162inline int __attribute__((deprecated("Use 'neorv32_cpu_csr_set(CSR_MSTATUS, 1 << channel)' instead."))) neorv32_cpu_irq_enable(uint8_t irq_sel) {
163
164 neorv32_cpu_csr_set(CSR_MSTATUS, 1 << irq_sel);
165 return 0;
166}
167
168/**********************************************************************/
173inline int __attribute__((deprecated("Use 'neorv32_cpu_csr_clr(CSR_MSTATUS, 1 << channel)' instead."))) neorv32_cpu_irq_disable(uint8_t irq_sel) {
174
175 neorv32_cpu_csr_clr(CSR_MSTATUS, 1 << irq_sel);
176 return 0;
177}
178
179#endif // neorv32_legacy_h
int neorv32_cpu_irq_enable(uint8_t irq_sel)
Definition: legacy.h:162
void neorv32_uart1_print(const char *s)
Definition: legacy.h:66
void neorv32_uart0_print(const char *s)
Definition: legacy.h:56
int neorv32_rte_exception_uninstall(uint8_t id)
Definition: legacy.h:93
void neorv32_cpu_dint(void)
Definition: legacy.h:152
int neorv32_cpu_irq_disable(uint8_t irq_sel)
Definition: legacy.h:173
int neorv32_rte_exception_install(uint8_t id, void(*handler)(void))
Definition: legacy.h:82
uint64_t neorv32_cpu_get_systime(void)
Definition: legacy.h:135
void neorv32_cpu_eint(void)
Definition: legacy.h:143
@ CSR_MSTATUS_MIE
Definition: neorv32.h:311
@ CSR_MSTATUS
Definition: neorv32.h:72
void neorv32_cpu_csr_set(const int csr_id, uint32_t mask)
Definition: neorv32_cpu.h:243
void neorv32_cpu_csr_clr(const int csr_id, uint32_t mask)
Definition: neorv32_cpu.h:257
uint64_t neorv32_mtime_get_time(void)
Definition: neorv32_mtime.c:94
int neorv32_rte_handler_install(uint8_t id, void(*handler)(void))
Definition: neorv32_rte.c:94
int neorv32_rte_handler_uninstall(uint8_t id)
Definition: neorv32_rte.c:112
void neorv32_uart1_puts(const char *s)
Definition: neorv32_uart.c:709
void neorv32_uart0_puts(const char *s)
Definition: neorv32_uart.c:334