1 | #ifndef __OR1K_INTERNAL_H__ |
---|
2 | #define __OR1K_INTERNAL_H__ |
---|
3 | |
---|
4 | #include <stdint.h> |
---|
5 | #include <string.h> |
---|
6 | |
---|
7 | #include "include/or1k-support.h" |
---|
8 | |
---|
9 | extern uint8_t* _or1k_stack_top; |
---|
10 | extern size_t _or1k_stack_size; |
---|
11 | extern uint8_t* _or1k_stack_bottom; |
---|
12 | |
---|
13 | extern uint8_t* _or1k_exception_stack_top; |
---|
14 | extern size_t _or1k_exception_stack_size; |
---|
15 | extern uint8_t* _or1k_exception_stack_bottom; |
---|
16 | |
---|
17 | #ifdef __OR1K_MULTICORE__ |
---|
18 | extern uint8_t* *_or1k_stack_core; |
---|
19 | extern uint8_t* *_or1k_exception_stack_core; |
---|
20 | #endif |
---|
21 | |
---|
22 | |
---|
23 | // The first two vectors are not used (address 0 and reset) |
---|
24 | #define OR1K_NUM_EXCEPTIONS 30 |
---|
25 | |
---|
26 | typedef or1k_exception_handler_fptr or1k_exception_handler_table_t[OR1K_NUM_EXCEPTIONS]; |
---|
27 | |
---|
28 | #ifdef __OR1K_MULTICORE__ |
---|
29 | extern or1k_exception_handler_table_t *_or1k_exception_handler_table; |
---|
30 | #else |
---|
31 | extern or1k_exception_handler_table_t _or1k_exception_handler_table; |
---|
32 | #endif |
---|
33 | |
---|
34 | typedef or1k_interrupt_handler_fptr or1k_interrupt_handler_table_t[32]; |
---|
35 | typedef void* or1k_interrupt_handler_data_ptr_table_t[32]; |
---|
36 | |
---|
37 | #ifdef __OR1K_MULTICORE__ |
---|
38 | extern or1k_interrupt_handler_table_t *_or1k_interrupt_handler_table; |
---|
39 | extern or1k_interrupt_handler_data_ptr_table_t *_or1k_interrupt_handler_data_ptr_table; |
---|
40 | #else |
---|
41 | extern or1k_interrupt_handler_table_t _or1k_interrupt_handler_table; |
---|
42 | extern or1k_interrupt_handler_data_ptr_table_t _or1k_interrupt_handler_data_ptr_table; |
---|
43 | #endif |
---|
44 | |
---|
45 | extern void _or1k_interrupt_handler(void); |
---|
46 | |
---|
47 | struct _or1k_reent { |
---|
48 | /* Tick timer variable */ |
---|
49 | volatile uint32_t or1k_timer_ticks; |
---|
50 | |
---|
51 | /* Tick rate storage */ |
---|
52 | uint32_t or1k_timer_period; |
---|
53 | uint32_t or1k_timer_mode; |
---|
54 | }; |
---|
55 | |
---|
56 | |
---|
57 | #ifdef __OR1K_MULTICORE__ |
---|
58 | extern struct _or1k_reent (*_or1k_reent)[]; |
---|
59 | #define OR1K_REENT (*_or1k_reent)[or1k_coreid()] |
---|
60 | #else |
---|
61 | extern struct _or1k_reent _or1k_reent; |
---|
62 | #define OR1K_REENT _or1k_reent |
---|
63 | #endif |
---|
64 | |
---|
65 | extern void _or1k_reent_init(); |
---|
66 | |
---|
67 | #endif |
---|