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

Subversion Repositories hf-risc

[/] [hf-risc/] [trunk/] [software/] [include/] [hf-risc.h] - Rev 16

Go to most recent revision | Compare with Previous | Blame | View Log

/* file:          hf_risc.h
 * description:   basic C type abstraction and HAL for HF-RISC
 * date:          09/2015
 * author:        Sergio Johann Filho <sergio.filho@pucrs.br>
 */
 
/* C type extensions */
typedef unsigned char			uint8_t;
typedef char				int8_t;
typedef unsigned short int		uint16_t;
typedef short int			int16_t;
typedef unsigned int			uint32_t;
typedef int				int32_t;
typedef unsigned long long		uint64_t;
typedef long long			int64_t;
 
typedef void				(*funcptr)();
 
/* disable interrupts, return previous int status / enable interrupts */
#define _di				interrupt_set(0)
#define _ei(S)				interrupt_set(S)
 
/* memory address map */
#define ADDR_ROM_BASE			0x00000000
#define ADDR_RAM_BASE			0x40000000
#define ADDR_RESERVED_BASE		0x80000000
 
/* peripheral addresses and irq lines */
#define PERIPHERALS_BASE		0xf0000000
#define IRQ_VECTOR			(*(volatile uint32_t *)(PERIPHERALS_BASE + 0x000))
#define IRQ_CAUSE			(*(volatile uint32_t *)(PERIPHERALS_BASE + 0x010))
#define IRQ_MASK			(*(volatile uint32_t *)(PERIPHERALS_BASE + 0x020))
#define IRQ_STATUS			(*(volatile uint32_t *)(PERIPHERALS_BASE + 0x030))
#define IRQ_EPC				(*(volatile uint32_t *)(PERIPHERALS_BASE + 0x040))
#define COUNTER				(*(volatile uint32_t *)(PERIPHERALS_BASE + 0x050))
#define COMPARE				(*(volatile uint32_t *)(PERIPHERALS_BASE + 0x060))
#define COMPARE2			(*(volatile uint32_t *)(PERIPHERALS_BASE + 0x070))
#define EXTIO_IN			(*(volatile uint32_t *)(PERIPHERALS_BASE + 0x080))
#define EXTIO_OUT			(*(volatile uint32_t *)(PERIPHERALS_BASE + 0x090))
#define EXTIO_DIR			(*(volatile uint32_t *)(PERIPHERALS_BASE + 0x0a0))
#define DEBUG_ADDR			(*(volatile uint32_t *)(PERIPHERALS_BASE + 0x0d0))
#define UART				(*(volatile uint32_t *)(PERIPHERALS_BASE + 0x0e0))
#define UART_DIVISOR			(*(volatile uint32_t *)(PERIPHERALS_BASE + 0x0f0))
 
#define IRQ_COUNTER			0x0001
#define IRQ_COUNTER_NOT			0x0002
#define IRQ_COUNTER2			0x0004
#define IRQ_COUNTER2_NOT		0x0008
#define IRQ_COMPARE			0x0010
#define IRQ_COMPARE2			0x0020
#define IRQ_UART_READ_AVAILABLE		0x0040
#define IRQ_UART_WRITE_AVAILABLE	0x0080
 
#define EXT_IRQ0			0x0100
#define EXT_IRQ1			0x0200
#define EXT_IRQ2			0x0400
#define EXT_IRQ3			0x0800
#define EXT_IRQ4			0x1000
#define EXT_IRQ5			0x2000
#define EXT_IRQ6			0x4000
#define EXT_IRQ7			0x8000
 
#define PERIPHERALS_BASE_EXT		0xf8000000
#define XTEA_BASE			0xfa000000
#define XTEA_CONTROL			(*(volatile uint32_t *)(XTEA_BASE + 0x000))
#define XTEA_KEY0			(*(volatile uint32_t *)(XTEA_BASE + 0x010))
#define XTEA_KEY1			(*(volatile uint32_t *)(XTEA_BASE + 0x020))
#define XTEA_KEY2			(*(volatile uint32_t *)(XTEA_BASE + 0x030))
#define XTEA_KEY3			(*(volatile uint32_t *)(XTEA_BASE + 0x040))
#define XTEA_IN0			(*(volatile uint32_t *)(XTEA_BASE + 0x050))
#define XTEA_IN1			(*(volatile uint32_t *)(XTEA_BASE + 0x060))
#define XTEA_OUT0			(*(volatile uint32_t *)(XTEA_BASE + 0x070))
#define XTEA_OUT1			(*(volatile uint32_t *)(XTEA_BASE + 0x080))
 
#include <libc.h>
 

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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