1 |
517 |
julius |
/* OR1K support defines
|
2 |
|
|
|
3 |
|
|
Copyright (C) 2011, ORSoC AB
|
4 |
|
|
Copyright (C) 2008, 2010 Embecosm Limited
|
5 |
|
|
|
6 |
|
|
Contributor Julius Baxter <julius.baxter@orsoc.se>
|
7 |
|
|
Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
|
8 |
|
|
|
9 |
|
|
This file is part of Newlib.
|
10 |
|
|
|
11 |
|
|
This program is free software; you can redistribute it and/or modify it
|
12 |
|
|
under the terms of the GNU General Public License as published by the Free
|
13 |
|
|
Software Foundation; either version 3 of the License, or (at your option)
|
14 |
|
|
any later version.
|
15 |
|
|
|
16 |
|
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
17 |
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
18 |
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
19 |
|
|
more details.
|
20 |
|
|
|
21 |
|
|
You should have received a copy of the GNU General Public License along
|
22 |
|
|
with this program. If not, see <http://www.gnu.org/licenses/>. */
|
23 |
|
|
/* -------------------------------------------------------------------------- */
|
24 |
|
|
/* This program is commented throughout in a fashion suitable for processing
|
25 |
|
|
with Doxygen. */
|
26 |
|
|
/* -------------------------------------------------------------------------- */
|
27 |
|
|
|
28 |
|
|
/* This machine configuration matches the Or1ksim configuration file in this
|
29 |
|
|
directory. */
|
30 |
|
|
|
31 |
|
|
#ifndef OR1K_NEWLIB_SUPPORT__H
|
32 |
|
|
#define OR1K_NEWLIB_SUPPORT__H
|
33 |
|
|
|
34 |
|
|
/*! External symbols from each board's object file */
|
35 |
|
|
extern unsigned long _board_clk_freq;
|
36 |
|
|
|
37 |
|
|
extern unsigned long _board_uart_base;
|
38 |
|
|
extern unsigned long _board_uart_baud;
|
39 |
|
|
extern unsigned long _board_uart_irq;
|
40 |
|
|
|
41 |
|
|
/*! Check if board has UART - test base address */
|
42 |
|
|
#define BOARD_HAS_UART (_board_uart_base)
|
43 |
|
|
|
44 |
|
|
/*! l.nop constants */
|
45 |
|
|
#define NOP_NOP 0x0000 /* Normal nop instruction */
|
46 |
|
|
#define NOP_EXIT 0x0001 /* End of simulation */
|
47 |
|
|
#define NOP_REPORT 0x0002 /* Simple report */
|
48 |
|
|
/*#define NOP_PRINTF 0x0003 Simprintf instruction (obsolete)*/
|
49 |
|
|
#define NOP_PUTC 0x0004 /* JPB: Simputc instruction */
|
50 |
|
|
#define NOP_CNT_RESET 0x0005 /* Reset statistics counters */
|
51 |
|
|
#define NOP_GET_TICKS 0x0006 /* JPB: Get # ticks running */
|
52 |
|
|
#define NOP_GET_PS 0x0007 /* JPB: Get picosecs/cycle */
|
53 |
|
|
#define NOP_REPORT_FIRST 0x0400 /* Report with number */
|
54 |
|
|
#define NOP_REPORT_LAST 0x03ff /* Report with number */
|
55 |
|
|
|
56 |
|
|
/*! Register access macro */
|
57 |
|
|
#define REG8(add) *((volatile unsigned char *) (add))
|
58 |
|
|
#define REG16(add) *((volatile unsigned short *) (add))
|
59 |
|
|
#define REG32(add) *((volatile unsigned long *) (add))
|
60 |
|
|
|
61 |
|
|
/*! Interrupt control function prototypes */
|
62 |
|
|
void or1k_interrupt_handler_add(int, void(*)(void*));
|
63 |
|
|
void or1k_interrupt_enable(int);
|
64 |
|
|
void or1k_interrupt_disable(int);
|
65 |
|
|
|
66 |
|
|
/*! Exception handler insertion prototype */
|
67 |
|
|
void or1k_exception_handler_add(int, void (*)(void));
|
68 |
|
|
|
69 |
|
|
/*! SPR access prototypes */
|
70 |
|
|
void or1k_mtspr (unsigned long int spr,
|
71 |
|
|
unsigned long int value);
|
72 |
|
|
unsigned long int or1k_mfspr (unsigned long int spr);
|
73 |
|
|
|
74 |
|
|
/*! Simulator prototypes */
|
75 |
|
|
void or1k_report (unsigned long int value);
|
76 |
|
|
|
77 |
|
|
/*! Cache control prototypes */
|
78 |
|
|
void or1k_icache_enable(void);
|
79 |
|
|
void or1k_icache_disable(void);
|
80 |
|
|
void or1k_icache_flush(unsigned long);
|
81 |
|
|
void or1k_dcache_enable(void);
|
82 |
|
|
void or1k_dcache_disable(void);
|
83 |
|
|
void or1k_dcache_flush(unsigned long);
|
84 |
|
|
|
85 |
|
|
/*! MMU control prototypes */
|
86 |
|
|
void or1k_immu_enable(void);
|
87 |
|
|
void or1k_immu_disable(void);
|
88 |
|
|
void or1k_dmmu_enable(void);
|
89 |
|
|
void or1k_dmmu_disable(void);
|
90 |
|
|
|
91 |
|
|
/*! Timer prototypes */
|
92 |
|
|
void or1k_timer_init(unsigned int hz);
|
93 |
|
|
void or1k_timer_enable(void);
|
94 |
|
|
void or1k_timer_disable(void);
|
95 |
|
|
unsigned long or1k_timer_get_ticks(void);
|
96 |
|
|
void or1k_timer_reset_ticks(void);
|
97 |
|
|
|
98 |
|
|
/*! Utility function prototypes */
|
99 |
|
|
unsigned long int or1k_rand(void);
|
100 |
|
|
|
101 |
|
|
#endif /* OR1K_NEWLIB_SUPPORT__H */
|