emulator: Use external hw/common.h from LiteX

Remove code copied from `hw/common.h` and use
the header from the LiteX repository provided
using `LITEX_BASE` environment variable.

Content of `common.h` is now evolving (new functions
are added, some are removed) and syncing it
between repos would be cumbersome.
This commit is contained in:
Mateusz Holenko 2020-02-24 12:43:35 +01:00
parent 5f0c7a7faf
commit f88b259eba
2 changed files with 4 additions and 35 deletions

View File

@ -18,10 +18,11 @@ sim: all
qemu: CFLAGS += -DQEMU
qemu: all
litex: CFLAGS += -DLITEX -I${LITEX_BASE}/software/include
litex: | check_litex_base all
check_litex_base:
litex: CFLAGS += -DLITEX -I${LITEX_GENERATED} -I${LITEX_BASE}/litex/soc/software/include
litex: | check_litex all
check_litex:
@[ "${LITEX_BASE}" ] || ( echo ">> LITEX_BASE is not set"; exit 1 )
@[ "${LITEX_GENERATED}" ] || ( echo ">> LITEX_GENERATED is not set"; exit 1 )
include ${STANDALONE}/common/riscv64-unknown-elf.mk
include ${STANDALONE}/common/standalone.mk

View File

@ -146,38 +146,6 @@ void halInit(){
#ifdef LITEX
// this is copied from LiteX <hw/common.h>
#define CSR_ACCESSORS_DEFINED
static inline void csr_writeb(uint8_t value, unsigned long addr)
{
*((volatile uint8_t *)addr) = value;
}
static inline uint8_t csr_readb(unsigned long addr)
{
return *(volatile uint8_t *)addr;
}
static inline void csr_writew(uint16_t value, unsigned long addr)
{
*((volatile uint16_t *)addr) = value;
}
static inline uint16_t csr_readw(unsigned long addr)
{
return *(volatile uint16_t *)addr;
}
static inline void csr_writel(uint32_t value, unsigned long addr)
{
*((volatile uint32_t *)addr) = value;
}
static inline uint32_t csr_readl(unsigned long addr)
{
return *(volatile uint32_t *)addr;
}
// this is a file generated by LiteX
#include <generated/csr.h>