OpenCores
URL https://opencores.org/ocsvn/hf-risc/hf-risc/trunk

Subversion Repositories hf-risc

[/] [hf-risc/] [trunk/] [software/] [include/] [hf-risc.h] - Blame information for rev 20

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 serginhofr
/* file:          hf_risc.h
2
 * description:   basic C type abstraction and HAL for HF-RISC
3
 * date:          09/2015
4
 * author:        Sergio Johann Filho <sergio.filho@pucrs.br>
5
 */
6
 
7
/* C type extensions */
8
typedef unsigned char                   uint8_t;
9
typedef char                            int8_t;
10
typedef unsigned short int              uint16_t;
11
typedef short int                       int16_t;
12
typedef unsigned int                    uint32_t;
13
typedef int                             int32_t;
14
typedef unsigned long long              uint64_t;
15
typedef long long                       int64_t;
16
 
17
typedef void                            (*funcptr)();
18
 
19
/* disable interrupts, return previous int status / enable interrupts */
20
#define _di                             interrupt_set(0)
21
#define _ei(S)                          interrupt_set(S)
22
 
23
/* memory address map */
24
#define ADDR_ROM_BASE                   0x00000000
25
#define ADDR_RAM_BASE                   0x40000000
26
#define ADDR_RESERVED_BASE              0x80000000
27
 
28
/* peripheral addresses and irq lines */
29
#define PERIPHERALS_BASE                0xf0000000
30
#define IRQ_VECTOR                      (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x000))
31
#define IRQ_CAUSE                       (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x010))
32
#define IRQ_MASK                        (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x020))
33
#define IRQ_STATUS                      (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x030))
34
#define IRQ_EPC                         (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x040))
35
#define COUNTER                         (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x050))
36
#define COMPARE                         (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x060))
37
#define COMPARE2                        (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x070))
38
#define EXTIO_IN                        (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x080))
39
#define EXTIO_OUT                       (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x090))
40
#define EXTIO_DIR                       (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x0a0))
41
#define DEBUG_ADDR                      (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x0d0))
42
#define UART                            (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x0e0))
43
#define UART_DIVISOR                    (*(volatile uint32_t *)(PERIPHERALS_BASE + 0x0f0))
44
 
45 20 serginhofr
#define IRQ_COUNTER                     0x00000001
46
#define IRQ_COUNTER_NOT                 0x00000002
47
#define IRQ_COUNTER2                    0x00000004
48
#define IRQ_COUNTER2_NOT                0x00000008
49
#define IRQ_COMPARE                     0x00000010
50
#define IRQ_COMPARE2                    0x00000020
51
#define IRQ_UART_READ_AVAILABLE         0x00000040
52
#define IRQ_UART_WRITE_AVAILABLE        0x00000080
53 13 serginhofr
 
54 20 serginhofr
#define EXT_IRQ0                        0x00010000
55
#define EXT_IRQ1                        0x00020000
56
#define EXT_IRQ2                        0x00040000
57
#define EXT_IRQ3                        0x00080000
58
#define EXT_IRQ4                        0x00100000
59
#define EXT_IRQ5                        0x00200000
60
#define EXT_IRQ6                        0x00400000
61
#define EXT_IRQ7                        0x00800000
62
#define EXT_IRQ0_NOT                    0x01000000
63
#define EXT_IRQ1_NOT                    0x02000000
64
#define EXT_IRQ2_NOT                    0x04000000
65
#define EXT_IRQ3_NOT                    0x08000000
66
#define EXT_IRQ4_NOT                    0x10000000
67
#define EXT_IRQ5_NOT                    0x20000000
68
#define EXT_IRQ6_NOT                    0x40000000
69
#define EXT_IRQ7_NOT                    0x80000000
70 13 serginhofr
 
71
#define PERIPHERALS_BASE_EXT            0xf8000000
72
#define XTEA_BASE                       0xfa000000
73
#define XTEA_CONTROL                    (*(volatile uint32_t *)(XTEA_BASE + 0x000))
74
#define XTEA_KEY0                       (*(volatile uint32_t *)(XTEA_BASE + 0x010))
75
#define XTEA_KEY1                       (*(volatile uint32_t *)(XTEA_BASE + 0x020))
76
#define XTEA_KEY2                       (*(volatile uint32_t *)(XTEA_BASE + 0x030))
77
#define XTEA_KEY3                       (*(volatile uint32_t *)(XTEA_BASE + 0x040))
78
#define XTEA_IN0                        (*(volatile uint32_t *)(XTEA_BASE + 0x050))
79
#define XTEA_IN1                        (*(volatile uint32_t *)(XTEA_BASE + 0x060))
80
#define XTEA_OUT0                       (*(volatile uint32_t *)(XTEA_BASE + 0x070))
81
#define XTEA_OUT1                       (*(volatile uint32_t *)(XTEA_BASE + 0x080))
82
 
83
#include <libc.h>

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.