mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-11-16 19:04:53 +08:00
riscv/niosv: Adding a new NIOS V BSP to RISC-V
This commit is contained in:
1 parent
d0e9ec85b0
commit
e9957cd8e3
45 files changed
+5596
No files matched your search
File diff suppressed because it is too large.
Load diff
Vendored
+141
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* Copyright (C) 2024 Kevin Kirspel
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <bsp_system.h>
|
||||
#include <alt_cache.h>
|
||||
|
||||
#define CPU_DATA_CACHE_ALIGNMENT ALT_CPU_DCACHE_LINE_SIZE
|
||||
|
||||
#define CPU_INSTRUCTION_CACHE_ALIGNMENT ALT_CPU_ICACHE_LINE_SIZE
|
||||
|
||||
#define CPU_CACHE_SUPPORT_PROVIDES_RANGE_FUNCTIONS
|
||||
|
||||
#define CPU_CACHE_SUPPORT_PROVIDES_CACHE_SIZE_FUNCTIONS
|
||||
|
||||
static inline void _CPU_cache_flush_1_data_line(const void *d_addr)
|
||||
{
|
||||
alt_dcache_flush(d_addr, ALT_CPU_DCACHE_LINE_SIZE);
|
||||
}
|
||||
|
||||
static inline void
|
||||
_CPU_cache_flush_data_range(
|
||||
const void *d_addr,
|
||||
size_t n_bytes
|
||||
)
|
||||
{
|
||||
alt_dcache_flush(d_addr, n_bytes);
|
||||
}
|
||||
|
||||
static inline void _CPU_cache_invalidate_1_data_line(const void *d_addr)
|
||||
{
|
||||
alt_dcache_flush_no_writeback(d_addr, ALT_CPU_DCACHE_LINE_SIZE);
|
||||
}
|
||||
|
||||
static inline void
|
||||
_CPU_cache_invalidate_data_range(
|
||||
const void *d_addr,
|
||||
size_t n_bytes
|
||||
)
|
||||
{
|
||||
alt_dcache_flush_no_writeback(d_addr, n_bytes);
|
||||
}
|
||||
|
||||
static inline void _CPU_cache_freeze_data(void)
|
||||
{
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
static inline void _CPU_cache_unfreeze_data(void)
|
||||
{
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
static inline void _CPU_cache_invalidate_1_instruction_line(const void *i_addr)
|
||||
{
|
||||
alt_icache_flush(i_addr, ALT_CPU_ICACHE_LINE_SIZE);
|
||||
}
|
||||
|
||||
static inline void
|
||||
_CPU_cache_invalidate_instruction_range( const void *i_addr, size_t n_bytes)
|
||||
{
|
||||
alt_icache_flush(i_addr, n_bytes);
|
||||
}
|
||||
|
||||
static inline void _CPU_cache_freeze_instruction(void)
|
||||
{
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
static inline void _CPU_cache_unfreeze_instruction(void)
|
||||
{
|
||||
/* TODO */
|
||||
}
|
||||
|
||||
static inline void _CPU_cache_flush_entire_data(void)
|
||||
{
|
||||
alt_dcache_flush_all();
|
||||
}
|
||||
|
||||
static inline void _CPU_cache_invalidate_entire_data(void)
|
||||
{
|
||||
alt_dcache_flush_all();
|
||||
}
|
||||
|
||||
static inline void _CPU_cache_enable_data(void)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void _CPU_cache_disable_data(void)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void _CPU_cache_invalidate_entire_instruction(void)
|
||||
{
|
||||
alt_icache_flush_all();
|
||||
}
|
||||
|
||||
static inline void _CPU_cache_enable_instruction(void)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void _CPU_cache_disable_instruction(void)
|
||||
{
|
||||
}
|
||||
|
||||
static inline size_t _CPU_cache_get_data_cache_size(uint32_t level)
|
||||
{
|
||||
return ALT_CPU_DCACHE_SIZE;
|
||||
}
|
||||
|
||||
static inline size_t _CPU_cache_get_instruction_cache_size(uint32_t level)
|
||||
{
|
||||
return ALT_CPU_ICACHE_SIZE;
|
||||
}
|
||||
|
||||
#include "../../shared/cache/cacheimpl.h"
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,196 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* Copyright (C) 2024 Kevin Kirspel
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2003, 2007 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __ALT_CACHE_H__
|
||||
#define __ALT_CACHE_H__
|
||||
|
||||
/*
|
||||
* Cache maintenance macros
|
||||
* CLEAN - Writeback to memory;
|
||||
* FLUSH - Writeback to memory and invalidate.
|
||||
*/
|
||||
|
||||
#if ALT_CPU_DCACHE_SIZE > 0
|
||||
#define DCACHE_CLEAN_BY_INDEX_VAL(i) \
|
||||
__asm__ volatile(".insn i 0x0F, 0x2, zero, %[i_reg], 0x081" :: [i_reg] "r"(i));
|
||||
|
||||
#define DCACHE_FLUSH_BY_INDEX_VAL(i) \
|
||||
__asm__ volatile(".insn i 0x0F, 0x2, zero, %[i_reg], 0x082" :: [i_reg] "r"(i));
|
||||
|
||||
#define DCACHE_INVALIDATE_BY_INDEX_VAL(i) \
|
||||
__asm__ volatile(".insn i 0x0F, 0x2, zero, %[i_reg], 0x080" :: [i_reg] "r"(i));
|
||||
|
||||
#define ALT_FLUSH_DATA(i) \
|
||||
__asm__ volatile(".option arch, +zicbom\n" "cbo.flush 0(%[addr])" :: [addr] "r"(i))
|
||||
|
||||
#define ALT_INVALIDATE_DATA(i) \
|
||||
__asm__ volatile(".option arch, +zicbom\n" "cbo.inval 0(%[addr])" :: [addr] "r"(i))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* alt_cache.h defines the processor specific functions for manipulating the
|
||||
* cache.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* alt_icache_flush() is called to flush the instruction cache for a memory
|
||||
* region of length "len" bytes, starting at address "start".
|
||||
*/
|
||||
|
||||
static inline void alt_icache_flush (const void* start, uint32_t len)
|
||||
{
|
||||
#if ALT_CPU_ICACHE_SIZE > 0
|
||||
__asm__ volatile(".option arch, +zifencei\n" "fence.i" ::: "memory");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* alt_dcache_flush() is called to flush the data cache for a memory
|
||||
* region of length "len" bytes, starting at address "start".
|
||||
* Any dirty lines in the data cache are written back to memory.
|
||||
*/
|
||||
|
||||
static inline void alt_dcache_flush (const void* start, uint32_t len)
|
||||
{
|
||||
#if ALT_CPU_DCACHE_SIZE > 0
|
||||
const char* i;
|
||||
const char* end = ((char*)start) + len;
|
||||
|
||||
for (i = start; i < end; i+= ALT_CPU_DCACHE_LINE_SIZE) {
|
||||
ALT_FLUSH_DATA(i);
|
||||
}
|
||||
|
||||
/*
|
||||
* For an unaligned flush request, we've got one more line left.
|
||||
* Note that this is dependent on ALT_CPU_DCACHE_LINE_SIZE to be a
|
||||
* multiple of 2 (which it always is).
|
||||
*/
|
||||
if (((uint32_t)start) & (ALT_CPU_DCACHE_LINE_SIZE - 1)) {
|
||||
ALT_FLUSH_DATA(i);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* alt_dcache_flush() is called to flush the data cache for a memory
|
||||
* region of length "len" bytes, starting at address "start".
|
||||
* Any dirty lines in the data cache are NOT written back to memory.
|
||||
*/
|
||||
|
||||
static inline void alt_dcache_flush_no_writeback (
|
||||
const void* start,
|
||||
uint32_t len
|
||||
)
|
||||
{
|
||||
#if ALT_CPU_DCACHE_SIZE > 0
|
||||
const char* i;
|
||||
const char* end = ((char*)start) + len;
|
||||
|
||||
for (i = start; i < end; i+= ALT_CPU_DCACHE_LINE_SIZE) {
|
||||
ALT_INVALIDATE_DATA(i);
|
||||
}
|
||||
|
||||
/*
|
||||
* For an unaligned invalidate request, we've got one more line left.
|
||||
* Note that this is dependent on ALT_CPU_DCACHE_LINE_SIZE to be a
|
||||
* multiple of 2 (which it always is).
|
||||
*/
|
||||
if (((uint32_t)start) & (ALT_CPU_DCACHE_LINE_SIZE - 1)) {
|
||||
ALT_INVALIDATE_DATA(i);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Flush the entire instruction cache.
|
||||
*/
|
||||
|
||||
static inline void alt_icache_flush_all (void)
|
||||
{
|
||||
#if ALT_CPU_ICACHE_SIZE > 0
|
||||
__asm__ volatile(".option arch, +zifencei\n" "fence.i" ::: "memory");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Flush the entire data cache.
|
||||
*/
|
||||
|
||||
static inline void alt_dcache_flush_all (void)
|
||||
{
|
||||
#if ALT_CPU_DCACHE_SIZE > 0
|
||||
char* i;
|
||||
for (
|
||||
i = (char*)0;
|
||||
i < (char*) ALT_CPU_DCACHE_SIZE;
|
||||
i+= ALT_CPU_DCACHE_LINE_SIZE
|
||||
) {
|
||||
DCACHE_CLEAN_BY_INDEX_VAL(i);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALT_CACHE_H__ */
|
||||
@@ -0,0 +1,153 @@
|
||||
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2024 Kevin Kirspel
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _ALTERA_AVALON_EPCQ_REGS_H
|
||||
#define _ALTERA_AVALON_EPCQ_REGS_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <bsp_system.h>
|
||||
|
||||
/*
|
||||
* EPCQ_RD_STATUS register description macros
|
||||
*/
|
||||
|
||||
/** Write in progress bit */
|
||||
#define ALTERA_EPCQ_CONTROLLER2_STATUS_WIP_MASK (0x00000001)
|
||||
#define ALTERA_EPCQ_CONTROLLER2_STATUS_WIP_AVAILABLE (0x00000000)
|
||||
#define ALTERA_EPCQ_CONTROLLER2_STATUS_WIP_BUSY (0x00000001)
|
||||
/** When to time out a poll of the write in progress bit */
|
||||
/* 0.7 sec time out */
|
||||
#define ALTERA_EPCQ_CONTROLLER2_1US_TIMEOUT_VALUE 700000
|
||||
|
||||
/*
|
||||
* EPCQ_RD_SID register description macros
|
||||
*
|
||||
* Specific device values obtained from Table 14 of:
|
||||
* "Serial Configuration (EPCS) Devices Datasheet"
|
||||
*/
|
||||
#define ALTERA_EPCQ_CONTROLLER2_SID_MASK (0x000000FF)
|
||||
#define ALTERA_EPCQ_CONTROLLER2_SID_EPCS16 (0x00000014)
|
||||
#define ALTERA_EPCQ_CONTROLLER2_SID_EPCS64 (0x00000016)
|
||||
#define ALTERA_EPCQ_CONTROLLER2_SID_EPCS128 (0x00000018)
|
||||
|
||||
/*
|
||||
* EPCQ_RD_RDID register description macros
|
||||
*
|
||||
* Specific device values obtained from Table 28 of:
|
||||
* "Quad-Serial Configuration
|
||||
* (EPCQ (www.altera.com/literature/hb/cfg/cfg_cf52012.pdf))
|
||||
* Devices Datasheet"
|
||||
*/
|
||||
#define ALTERA_EPCQ_CONTROLLER2_RDID_MASK (0x000000FF)
|
||||
#define ALTERA_EPCQ_CONTROLLER2_RDID_EPCQ16 (0x00000015)
|
||||
#define ALTERA_EPCQ_CONTROLLER2_RDID_EPCQ32 (0x00000016)
|
||||
#define ALTERA_EPCQ_CONTROLLER2_RDID_EPCQ64 (0x00000017)
|
||||
#define ALTERA_EPCQ_CONTROLLER2_RDID_EPCQ128 (0x00000018)
|
||||
#define ALTERA_EPCQ_CONTROLLER2_RDID_EPCQ256 (0x00000019)
|
||||
#define ALTERA_EPCQ_CONTROLLER2_RDID_EPCQ512 (0x00000020)
|
||||
#define ALTERA_EPCQ_CONTROLLER2_RDID_EPCQ1024 (0x00000021)
|
||||
|
||||
/*
|
||||
* EPCQ_MEM_OP register description macros
|
||||
*/
|
||||
#define ALTERA_EPCQ_CONTROLLER2_MEM_OP_CMD_MASK (0x00000003)
|
||||
#define ALTERA_EPCQ_CONTROLLER2_MEM_OP_BULK_ERASE_CMD (0x00000001)
|
||||
#define ALTERA_EPCQ_CONTROLLER2_MEM_OP_SECTOR_ERASE_CMD (0x00000002)
|
||||
#define ALTERA_EPCQ_CONTROLLER2_MEM_OP_SECTOR_PROTECT_CMD (0x00000003)
|
||||
#define ALTERA_EPCQ_CONTROLLER2_MEM_OP_WRITE_ENABLE_CMD (0x00000004)
|
||||
|
||||
/** see datasheet for sector values */
|
||||
#define ALTERA_EPCQ_CONTROLLER2_MEM_OP_SECTOR_VALUE_MASK (0x00FFFF00)
|
||||
|
||||
/*
|
||||
* EPCQ_ISR register description macros
|
||||
*/
|
||||
#define ALTERA_EPCQ_CONTROLLER2_ISR_ILLEGAL_ERASE_MASK (0x00000001)
|
||||
#define ALTERA_EPCQ_CONTROLLER2_ISR_ILLEGAL_ERASE_ACTIVE (0x00000001)
|
||||
|
||||
#define ALTERA_EPCQ_CONTROLLER2_ISR_ILLEGAL_WRITE_MASK (0x00000002)
|
||||
#define ALTERA_EPCQ_CONTROLLER2_ISR_ILLEGAL_WRITE_ACTIVE (0x00000002)
|
||||
|
||||
/*
|
||||
* EPCQ_IMR register description macros
|
||||
*/
|
||||
#define ALTERA_EPCQ_CONTROLLER2_IMR_ILLEGAL_ERASE_MASK (0x00000001)
|
||||
#define ALTERA_EPCQ_CONTROLLER2_IMR_ILLEGAL_ERASE_ENABLED (0x00000001)
|
||||
|
||||
#define ALTERA_EPCQ_CONTROLLER2_IMR_ILLEGAL_WRITE_MASK (0x00000002)
|
||||
#define ALTERA_EPCQ_CONTROLLER2_IMR_ILLEGAL_WRITE_ENABLED (0x00000002)
|
||||
|
||||
/*
|
||||
* EPCQ_CHIP_SELECT register description macros
|
||||
*/
|
||||
#define ALTERA_EPCQ_CHIP1_SELECT (0x00000001)
|
||||
#define ALTERA_EPCQ_CHIP2_SELECT (0x00000002)
|
||||
#define ALTERA_EPCQ_CHIP3_SELECT (0x00000003)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
volatile uint32_t rd_status;
|
||||
volatile uint32_t rd_sid;
|
||||
volatile uint32_t rd_rdid;
|
||||
volatile uint32_t mem_op;
|
||||
volatile uint32_t isr;
|
||||
volatile uint32_t imr;
|
||||
volatile uint32_t chip_select;
|
||||
volatile uint32_t flag_status;
|
||||
volatile uint32_t dev_id_0;
|
||||
volatile uint32_t dev_id_1;
|
||||
volatile uint32_t dev_id_2;
|
||||
volatile uint32_t dev_id_3;
|
||||
volatile uint32_t dev_id_4;
|
||||
}altera_avalon_epcq_regs;
|
||||
|
||||
#define EPCQ_REGS \
|
||||
(( volatile altera_avalon_epcq_regs* )EPCQ_CONTROLLER_AVL_CSR_BASE )
|
||||
#define EPCQ_MEM \
|
||||
(( volatile uint8_t* )EPCQ_CONTROLLER_AVL_MEM_BASE )
|
||||
#define EPCQ_MEM_32 \
|
||||
(( volatile uint32_t* )EPCQ_CONTROLLER_AVL_MEM_BASE )
|
||||
|
||||
void epcq_initialize( void );
|
||||
int epcq_read_buffer( int offset, uint8_t *dest_addr, int length );
|
||||
int epcq_write_buffer (
|
||||
int offset,
|
||||
const uint8_t* src_addr,
|
||||
int length,
|
||||
bool erase
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,101 @@
|
||||
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2024 Kevin Kirspel
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2008 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _ALTERA_AVALON_JTAG_UART_REGS_H
|
||||
#define _ALTERA_AVALON_JTAG_UART_REGS_H
|
||||
|
||||
#include <bsp_system.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ALTERA_AVALON_JTAG_UART_DATA_DATA_MSK (0x000000FFu)
|
||||
#define ALTERA_AVALON_JTAG_UART_DATA_DATA_OFST (0)
|
||||
#define ALTERA_AVALON_JTAG_UART_DATA_RVALID_MSK (0x00008000u)
|
||||
#define ALTERA_AVALON_JTAG_UART_DATA_RVALID_OFST (15)
|
||||
#define ALTERA_AVALON_JTAG_UART_DATA_RAVAIL_MSK (0xFFFF0000u)
|
||||
#define ALTERA_AVALON_JTAG_UART_DATA_RAVAIL_OFST (16)
|
||||
|
||||
#define ALTERA_AVALON_JTAG_UART_CONTROL_RE_MSK (0x00000001u)
|
||||
#define ALTERA_AVALON_JTAG_UART_CONTROL_RE_OFST (0)
|
||||
#define ALTERA_AVALON_JTAG_UART_CONTROL_WE_MSK (0x00000002u)
|
||||
#define ALTERA_AVALON_JTAG_UART_CONTROL_WE_OFST (1)
|
||||
#define ALTERA_AVALON_JTAG_UART_CONTROL_RI_MSK (0x00000100u)
|
||||
#define ALTERA_AVALON_JTAG_UART_CONTROL_RI_OFST (8)
|
||||
#define ALTERA_AVALON_JTAG_UART_CONTROL_WI_MSK (0x00000200u)
|
||||
#define ALTERA_AVALON_JTAG_UART_CONTROL_WI_OFST (9)
|
||||
#define ALTERA_AVALON_JTAG_UART_CONTROL_AC_MSK (0x00000400u)
|
||||
#define ALTERA_AVALON_JTAG_UART_CONTROL_AC_OFST (10)
|
||||
#define ALTERA_AVALON_JTAG_UART_CONTROL_WSPACE_MSK (0xFFFF0000u)
|
||||
#define ALTERA_AVALON_JTAG_UART_CONTROL_WSPACE_OFST (16)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
volatile uint32_t data;
|
||||
volatile uint32_t control;
|
||||
}altera_avalon_jtag_uart_regs;
|
||||
|
||||
#define JTAG_UART_REGS \
|
||||
((volatile altera_avalon_jtag_uart_regs*)JTAG_UART_BASE)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,180 @@
|
||||
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2024 Kevin Kirspel
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/******************************************************************************
|
||||
* *
|
||||
* License Agreement *
|
||||
* *
|
||||
* Copyright (c) 2008 Altera Corporation, San Jose, California, USA. *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a *
|
||||
* copy of this software and associated documentation files (the "Software"), *
|
||||
* to deal in the Software without restriction, including without limitation *
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense, *
|
||||
* and/or sell copies of the Software, and to permit persons to whom the *
|
||||
* Software is furnished to do so, subject to the following conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in *
|
||||
* all copies or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *
|
||||
* DEALINGS IN THE SOFTWARE. *
|
||||
* *
|
||||
* This agreement shall be governed in all respects by the laws of the State *
|
||||
* of California and by the laws of the United States of America. *
|
||||
* *
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __ALTERA_AVALON_TIMER_REGS_H__
|
||||
#define __ALTERA_AVALON_TIMER_REGS_H__
|
||||
|
||||
#include <bsp_system.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ALTERA_AVALON_TIMER_STATUS_TO_MSK (0x1)
|
||||
#define ALTERA_AVALON_TIMER_STATUS_TO_OFST (0)
|
||||
#define ALTERA_AVALON_TIMER_STATUS_RUN_MSK (0x2)
|
||||
#define ALTERA_AVALON_TIMER_STATUS_RUN_OFST (1)
|
||||
|
||||
#define ALTERA_AVALON_TIMER_CONTROL_ITO_MSK (0x1)
|
||||
#define ALTERA_AVALON_TIMER_CONTROL_ITO_OFST (0)
|
||||
#define ALTERA_AVALON_TIMER_CONTROL_CONT_MSK (0x2)
|
||||
#define ALTERA_AVALON_TIMER_CONTROL_CONT_OFST (1)
|
||||
#define ALTERA_AVALON_TIMER_CONTROL_START_MSK (0x4)
|
||||
#define ALTERA_AVALON_TIMER_CONTROL_START_OFST (2)
|
||||
#define ALTERA_AVALON_TIMER_CONTROL_STOP_MSK (0x8)
|
||||
#define ALTERA_AVALON_TIMER_CONTROL_STOP_OFST (3)
|
||||
|
||||
#define ALTERA_AVALON_TIMER_PERIODL_MSK (0xFFFF)
|
||||
#define ALTERA_AVALON_TIMER_PERIODL_OFST (0)
|
||||
|
||||
#define ALTERA_AVALON_TIMER_PERIODH_MSK (0xFFFF)
|
||||
#define ALTERA_AVALON_TIMER_PERIODH_OFST (0)
|
||||
|
||||
#define ALTERA_AVALON_TIMER_SNAPL_MSK (0xFFFF)
|
||||
#define ALTERA_AVALON_TIMER_SNAPL_OFST (0)
|
||||
|
||||
#define ALTERA_AVALON_TIMER_SNAPH_MSK (0xFFFF)
|
||||
#define ALTERA_AVALON_TIMER_SNAPH_OFST (0)
|
||||
|
||||
#define ALTERA_AVALON_TIMER_PERIOD_0_MSK (0xFFFF)
|
||||
#define ALTERA_AVALON_TIMER_PERIOD_0_OFST (0)
|
||||
|
||||
#define ALTERA_AVALON_TIMER_PERIOD_1_MSK (0xFFFF)
|
||||
#define ALTERA_AVALON_TIMER_PERIOD_1_OFST (0)
|
||||
|
||||
#define ALTERA_AVALON_TIMER_PERIOD_2_MSK (0xFFFF)
|
||||
#define ALTERA_AVALON_TIMER_PERIOD_2_OFST (0)
|
||||
|
||||
#define ALTERA_AVALON_TIMER_PERIOD_3_MSK (0xFFFF)
|
||||
#define ALTERA_AVALON_TIMER_PERIOD_3_OFST (0)
|
||||
|
||||
#define ALTERA_AVALON_TIMER_SNAP_0_MSK (0xFFFF)
|
||||
#define ALTERA_AVALON_TIMER_SNAP_0_OFST (0)
|
||||
|
||||
#define ALTERA_AVALON_TIMER_SNAP_1_MSK (0xFFFF)
|
||||
#define ALTERA_AVALON_TIMER_SNAP_1_OFST (0)
|
||||
|
||||
#define ALTERA_AVALON_TIMER_SNAP_2_MSK (0xFFFF)
|
||||
#define ALTERA_AVALON_TIMER_SNAP_2_OFST (0)
|
||||
|
||||
#define ALTERA_AVALON_TIMER_SNAP_3_MSK (0xFFFF)
|
||||
#define ALTERA_AVALON_TIMER_SNAP_3_OFST (0)
|
||||
|
||||
#define MTIMECMP_MAX_VALUE 0xFFFFFFFFFFFFFFFF
|
||||
|
||||
typedef struct
|
||||
{
|
||||
volatile uint32_t status;
|
||||
volatile uint32_t control;
|
||||
volatile uint32_t period_lo;
|
||||
volatile uint32_t period_hi;
|
||||
volatile uint32_t snap_lo;
|
||||
volatile uint32_t snap_hi;
|
||||
}altera_avalon_timer_regs_32;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
volatile uint32_t status;
|
||||
volatile uint32_t control;
|
||||
volatile uint32_t period_0;
|
||||
volatile uint32_t period_1;
|
||||
volatile uint32_t period_2;
|
||||
volatile uint32_t period_3;
|
||||
volatile uint32_t snap_0;
|
||||
volatile uint32_t snap_1;
|
||||
volatile uint32_t snap_2;
|
||||
volatile uint32_t snap_3;
|
||||
}altera_avalon_timer_regs_64;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
volatile uint32_t status;
|
||||
volatile uint32_t control;
|
||||
volatile uint32_t period;
|
||||
volatile uint32_t snap;
|
||||
volatile uint32_t prescalar;
|
||||
}altera_avalon_timer_precale_regs;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
volatile uint32_t mtimecmp_lo;
|
||||
volatile uint32_t mtimecmp_hi;
|
||||
volatile uint32_t mtime_lo;
|
||||
volatile uint32_t mtime_hi;
|
||||
}altera_niosv_timer_regs;
|
||||
|
||||
#define CLOCK_REGS \
|
||||
((volatile altera_niosv_timer_regs* )ALT_CPU_MTIME_OFFSET)
|
||||
#define CLOCK_FREQ ALT_CPU_FREQ
|
||||
#define CLOCK_VECTOR NIOSV_INTERRUPT_VECTOR_TIMER
|
||||
|
||||
#define TIMER_REGS \
|
||||
((volatile altera_avalon_timer_precale_regs* )BENCHMARK_TIMER_BASE)
|
||||
#define TIMER_FREQ BENCHMARK_TIMER_FREQ
|
||||
#define TIMER_VECTOR BENCHMARK_TIMER_IRQ
|
||||
|
||||
#define WATCHDOG_REGS \
|
||||
((volatile altera_avalon_timer_regs_32* )WATCHDOG_TIMER_BASE)
|
||||
#define WATCHDOG_FREQ WATCHDOG_TIMER_FREQ
|
||||
#define WATCHDOG_VECTOR WATCHDOG_TIMER_IRQ
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALTERA_AVALON_TIMER_REGS_H__ */
|
||||
@@ -0,0 +1,174 @@
|
||||
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2024 Kevin Kirspel
|
||||
*
|
||||
* Copyright (c) 2015 University of York.
|
||||
* Hesham Almatary <hesham@alumni.york.ac.uk>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LIBBSP_NIOSV_IRQ_H
|
||||
#define LIBBSP_NIOSV_IRQ_H
|
||||
|
||||
#ifndef ASM
|
||||
|
||||
#include <bsp.h>
|
||||
#include <rtems/irq.h>
|
||||
#include <rtems/irq-extension.h>
|
||||
#include <rtems/score/processormask.h>
|
||||
#include <rtems/score/riscv-utility.h>
|
||||
|
||||
#define NIOSV_INTERRUPT_VECTOR_SOFTWARE 0
|
||||
|
||||
#define NIOSV_INTERRUPT_VECTOR_TIMER 1
|
||||
|
||||
#define NIOSV_INTERRUPT_VECTOR_EXTERNAL(x) ((x) + 2)
|
||||
|
||||
#define NIOSV_INTERRUPT_VECTOR_IS_EXTERNAL(x) ((x) >= 2)
|
||||
|
||||
#define NIOSV_INTERRUPT_VECTOR_EXTERNAL_TO_INDEX(x) ((x) - 2)
|
||||
|
||||
#define BSP_INTERRUPT_VECTOR_COUNT \
|
||||
NIOSV_INTERRUPT_VECTOR_EXTERNAL(NIOSV_MAXIMUM_EXTERNAL_INTERRUPTS)
|
||||
|
||||
#define BSP_INTERRUPT_CUSTOM_VALID_VECTOR
|
||||
|
||||
/*
|
||||
* The following enumeration describes the value in the mcause CSR.
|
||||
*/
|
||||
enum alt_exception_cause_e {
|
||||
NIOSV_UNDEFINED_CAUSE = -1,
|
||||
NIOSV_INSTRUCTION_ADDRESS_MISALIGNED = 0,
|
||||
NIOSV_INSTRUCTION_ACCESS_FAULT = 1,
|
||||
NIOSV_ILLEGAL_INSTRUCTION = 2,
|
||||
NIOSV_BREAKPOINT = 3,
|
||||
NIOSV_LOAD_ADDRESS_MISALIGNED = 4,
|
||||
NIOSV_LOAD_ACCESS_FAULT = 5,
|
||||
NIOSV_STORE_AMO_ADDRESS_MISALIGNED = 6,
|
||||
NIOSV_STORE_AMO_ACCESS_FAULT = 7,
|
||||
NIOSV_ENVIRONMENT_CALL_FROM_U_MODE = 8,
|
||||
NIOSV_ENVIRONMENT_CALL_FROM_S_MODE = 9,
|
||||
NIOSV_RESERVED_BIT_10 = 10,
|
||||
NIOSV_ENVIRONMENT_CALL_FROM_M_MODE = 11,
|
||||
NIOSV_INSTRUCTION_PAGE_FAULT = 12,
|
||||
NIOSV_LOAD_PAGE_FAULT = 13,
|
||||
NIOSV_RESERVED_BIT_14 = 14,
|
||||
NIOSV_STORE_AMO_PAGE_FAULT = 15
|
||||
};
|
||||
typedef enum alt_exception_cause_e alt_exception_cause;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
static inline uint32_t alt_irq_pending(void)
|
||||
{
|
||||
uint32_t active, enabled;
|
||||
|
||||
active = read_csr(mip);
|
||||
enabled = read_csr(mie);
|
||||
|
||||
/*
|
||||
* we want to only process the upper 16-bits, the interrupt lines connected
|
||||
* via Platform Designer.
|
||||
*/
|
||||
return (active & enabled) >> 16;
|
||||
}
|
||||
|
||||
static inline uint32_t alt_irq_index(uint32_t active)
|
||||
{
|
||||
uint32_t mask, i;
|
||||
|
||||
i = 0;
|
||||
mask = 1;
|
||||
/*
|
||||
* Test each bit in turn looking for an active interrupt. Once one is
|
||||
* found, the interrupt handler asigned by a call to alt_irq_register() is
|
||||
* called to clear the interrupt condition.
|
||||
*/
|
||||
do {
|
||||
if (active & mask) {
|
||||
return i;
|
||||
}
|
||||
mask <<= 1;
|
||||
i++;
|
||||
} while (1);
|
||||
/* should not happen */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline bool alt_irq_is_pending(uint32_t index)
|
||||
{
|
||||
uint32_t mask, active;
|
||||
|
||||
active = alt_irq_pending();
|
||||
|
||||
if(active != 0) {
|
||||
mask = 1 << index;
|
||||
if (active & mask) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool alt_irq_is_enabled(uint32_t index)
|
||||
{
|
||||
uint32_t mask, enabled;
|
||||
|
||||
enabled = read_csr(mie) >> 16;
|
||||
|
||||
if(enabled != 0) {
|
||||
mask = 1 << index;
|
||||
if (enabled & mask) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline void alt_irq_enable(uint32_t index)
|
||||
{
|
||||
uint32_t mask;
|
||||
|
||||
mask = 1 << (index + 16);
|
||||
set_csr(mie, mask);
|
||||
}
|
||||
|
||||
static inline void alt_irq_disable(uint32_t index)
|
||||
{
|
||||
uint32_t mask;
|
||||
|
||||
mask = 1 << (index + 16);
|
||||
clear_csr(mie, mask);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* ASM */
|
||||
|
||||
#endif /* LIBBSP_NIOSV_IRQ_H */
|
||||
@@ -0,0 +1,51 @@
|
||||
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2024 Kevin Kirspel
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef BSP_NIOSV_H
|
||||
#define BSP_NIOSV_H
|
||||
|
||||
#include <bsp.h>
|
||||
|
||||
#include <rtems/score/cpuimpl.h>
|
||||
|
||||
#define NIOSV_MSTATUS_MIE_MASK 0x8
|
||||
#define NIOSV_MIE_MASK 0xFFFFFFFF
|
||||
#define NIOSV_MCAUSE_INTERRUPT_MASK 0x80000000
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
uint32_t niosv_get_core_frequency(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* BSP_NIOSV_H */
|
||||
@@ -0,0 +1 @@
|
||||
#include <rtems/tm27-default.h>
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* Copyright (C) 2024 Kevin Kirspel
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <bsp.h>
|
||||
#include <bsp/bootcard.h>
|
||||
#include <bsp/fatal.h>
|
||||
#include <bsp/irq-generic.h>
|
||||
#include <bsp/niosv.h>
|
||||
#include <rtems/sysinit.h>
|
||||
|
||||
static uint32_t niosv_core_freq;
|
||||
|
||||
static uint32_t get_core_frequency(void)
|
||||
{
|
||||
return ALT_CPU_FREQ;
|
||||
}
|
||||
|
||||
uint32_t niosv_get_core_frequency(void)
|
||||
{
|
||||
return niosv_core_freq;
|
||||
}
|
||||
|
||||
void bsp_start(void)
|
||||
{
|
||||
/* let user know we have started RTEMS */
|
||||
LED_PIO_REGS->outclear = 0x4;
|
||||
|
||||
bsp_interrupt_initialize();
|
||||
niosv_core_freq = get_core_frequency();
|
||||
}
|
||||
|
||||
static void bsp_predriver_hook( void )
|
||||
{
|
||||
epcq_initialize();
|
||||
}
|
||||
|
||||
static void bsp_postdriver_hook(void)
|
||||
{
|
||||
/* TODO: add any post driver configuration functions */
|
||||
}
|
||||
|
||||
RTEMS_SYSINIT_ITEM(
|
||||
bsp_predriver_hook,
|
||||
RTEMS_SYSINIT_DEVICE_DRIVERS,
|
||||
RTEMS_SYSINIT_ORDER_FIRST
|
||||
);
|
||||
|
||||
RTEMS_SYSINIT_ITEM(
|
||||
bsp_postdriver_hook,
|
||||
RTEMS_SYSINIT_DEVICE_DRIVERS,
|
||||
RTEMS_SYSINIT_ORDER_LAST
|
||||
);
|
||||
@@ -0,0 +1,183 @@
|
||||
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2024 Kevin Kirspel
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _ALTERA_AVALON_HBUS_REGS_H
|
||||
#define _ALTERA_AVALON_HBUS_REGS_H
|
||||
|
||||
#include <bsp_system.h>
|
||||
|
||||
/* CSR */
|
||||
#define ALTERA_HBUS_CSR_RACT_MSK (0x1)
|
||||
#define ALTERA_HBUS_CSR_RACT_OFST (0)
|
||||
#define ALTERA_HBUS_CSR_RDECERR_MSK (0x100)
|
||||
#define ALTERA_HBUS_CSR_RDECERR_OFST (8)
|
||||
#define ALTERA_HBUS_CSR_RTRSERR_MSK (0x200)
|
||||
#define ALTERA_HBUS_CSR_RTRSERR_OFST (9)
|
||||
#define ALTERA_HBUS_CSR_RRSTOERR_MSK (0x400)
|
||||
#define ALTERA_HBUS_CSR_RRSTOERR_OFST (10)
|
||||
#define ALTERA_HBUS_CSR_RDSSTALL_MSK (0x800)
|
||||
#define ALTERA_HBUS_CSR_RDSSTALL_OFST (11)
|
||||
#define ALTERA_HBUS_CSR_WACT_MSK (0x10000)
|
||||
#define ALTERA_HBUS_CSR_WACT_OFST (16)
|
||||
#define ALTERA_HBUS_CSR_WDECERR_MSK (0x1000000)
|
||||
#define ALTERA_HBUS_CSR_WDECERR_OFST (24)
|
||||
#define ALTERA_HBUS_CSR_WTRSERR_MSK (0x2000000)
|
||||
#define ALTERA_HBUS_CSR_WTRSERR_OFST (25)
|
||||
#define ALTERA_HBUS_CSR_WRSTOERR_MSK (0x4000000)
|
||||
#define ALTERA_HBUS_CSR_WRSTOERR_OFST (26)
|
||||
|
||||
/* IEN */
|
||||
#define ALTERA_HBUS_IEN_RPCINTE_MSK (0x1)
|
||||
#define ALTERA_HBUS_IEN_RPCINTE_OFST (0)
|
||||
#define ALTERA_HBUS_IEN_INTP_MSK (0x80000000)
|
||||
#define ALTERA_HBUS_IEN_INTP_OFST (31)
|
||||
|
||||
/* ISR */
|
||||
#define ALTERA_HBUS_ISR_RPCINTS_MSK (0x1)
|
||||
#define ALTERA_HBUS_ISR_RPCINTS_OFST (0)
|
||||
|
||||
/* MBR */
|
||||
#define ALTERA_HBUS_MBR_ADDRESS_MSK (0xFF000000)
|
||||
#define ALTERA_HBUS_MBR_ADDRESS(x) (x & ALTERA_HBUS_MBR_ADDRESS_MSK)
|
||||
|
||||
/* MCR */
|
||||
#define ALTERA_HBUS_MCR_WRAPSIZE_MSK (0x3)
|
||||
#define ALTERA_HBUS_MCR_WRAPSIZE_OFST (0)
|
||||
#define ALTERA_HBUS_MCR_DEVTYPE_MSK (0x10)
|
||||
#define ALTERA_HBUS_MCR_DEVTYPE_OFST (4)
|
||||
#define ALTERA_HBUS_MCR_CRT_MSK (0x20)
|
||||
#define ALTERA_HBUS_MCR_CRT_OFST (5)
|
||||
#define ALTERA_HBUS_MCR_ACS_MSK (0x10000)
|
||||
#define ALTERA_HBUS_MCR_ACS_OFST (16)
|
||||
#define ALTERA_HBUS_MCR_TCMO_MSK (0x20000)
|
||||
#define ALTERA_HBUS_MCR_TCMO_OFST (17)
|
||||
#define ALTERA_HBUS_MCR_MAXLEN_MSK (0x3FC0000)
|
||||
#define ALTERA_HBUS_MCR_MAXLEN_OFST (18)
|
||||
#define ALTERA_HBUS_MCR_MAXEN_MSK (0x80000000)
|
||||
#define ALTERA_HBUS_MCR_MAXEN_OFST (31)
|
||||
|
||||
#define ALTERA_HBUS_MCR_WRAPSIZE_SELECT(x) \
|
||||
((x) == 32 ? 0x3 : (x) == 64 ? 0x1 : (x) == 16 ? 0x2 : 0x3)
|
||||
#define ALTERA_HBUS_MCR_WRAPSIZE(x) \
|
||||
((ALTERA_HBUS_MCR_WRAPSIZE_SELECT(x) << ALTERA_HBUS_MCR_WRAPSIZE_OFST) & \
|
||||
ALTERA_HBUS_MCR_WRAPSIZE_MSK)
|
||||
#define ALTERA_HBUS_MCR_DEVTYPE(x) \
|
||||
(((x) << ALTERA_HBUS_MCR_DEVTYPE_OFST) & ALTERA_HBUS_MCR_DEVTYPE_MSK)
|
||||
#define ALTERA_HBUS_MCR_CRT(x) \
|
||||
(((x) << ALTERA_HBUS_MCR_CRT_OFST) & ALTERA_HBUS_MCR_CRT_MSK)
|
||||
#define ALTERA_HBUS_MCR_CRT_UPDATE(r, x) \
|
||||
((r) = ((r) & ALTERA_HBUS_MCR_CRT_MSK) | ALTERA_HBUS_MCR_CRT(x))
|
||||
#define ALTERA_HBUS_MCR_ACS(x) \
|
||||
(((x) << ALTERA_HBUS_MCR_ACS_OFST) & ALTERA_HBUS_MCR_ACS_MSK)
|
||||
#define ALTERA_HBUS_MCR_TCMO(x) \
|
||||
(((x) << ALTERA_HBUS_MCR_TCMO_OFST) & ALTERA_HBUS_MCR_TCMO_MSK)
|
||||
#define ALTERA_HBUS_MCR_MAXLEN(x) \
|
||||
(((((x) / 2) - 1) << ALTERA_HBUS_MCR_MAXLEN_OFST) & \
|
||||
ALTERA_HBUS_MCR_MAXLEN_MSK)
|
||||
#define ALTERA_HBUS_MCR_MAXEN(x) \
|
||||
(((x) << ALTERA_HBUS_MCR_MAXEN_OFST) & ALTERA_HBUS_MCR_MAXEN_MSK)
|
||||
|
||||
/* MTR */
|
||||
#define ALTERA_HBUS_MTR_LTCY_MSK (0xF)
|
||||
#define ALTERA_HBUS_MTR_LTCY_OFST (0)
|
||||
#define ALTERA_HBUS_MTR_RFU_MSK (0xF0)
|
||||
#define ALTERA_HBUS_MTR_RFU_OFST (4)
|
||||
#define ALTERA_HBUS_MTR_WCSH_MSK (0xF00)
|
||||
#define ALTERA_HBUS_MTR_WCSH_OFST (8)
|
||||
#define ALTERA_HBUS_MTR_RCSH_MSK (0xF000)
|
||||
#define ALTERA_HBUS_MTR_RCSH_OFST (12)
|
||||
#define ALTERA_HBUS_MTR_WCSS_MSK (0xF0000)
|
||||
#define ALTERA_HBUS_MTR_WCSS_OFST (16)
|
||||
#define ALTERA_HBUS_MTR_RCSS_MSK (0xF00000)
|
||||
#define ALTERA_HBUS_MTR_RCSS_OFST (20)
|
||||
#define ALTERA_HBUS_MTR_WCSHI_MSK (0xF000000)
|
||||
#define ALTERA_HBUS_MTR_WCSHI_OFST (24)
|
||||
#define ALTERA_HBUS_MTR_RCSHI_MSK (0xF0000000)
|
||||
#define ALTERA_HBUS_MTR_RCSHI_OFST (28)
|
||||
|
||||
#define ALTERA_HBUS_MTR_LTCY_SELECT(x) \
|
||||
((x) == 6 ? 0x1 : (x) == 4 ? 0xf : (x) == 5 ? 0x0 : (x) == 3 ? 0xe : 0x1)
|
||||
#define ALTERA_HBUS_MTR_LTCY(x) \
|
||||
((ALTERA_HBUS_MTR_LTCY_SELECT(x) << ALTERA_HBUS_MTR_LTCY_OFST) & \
|
||||
ALTERA_HBUS_MTR_LTCY_MSK)
|
||||
|
||||
/* GPOR */
|
||||
#define ALTERA_HBUS_GPOR_GPO_MSK (0x3)
|
||||
#define ALTERA_HBUS_GPOR_GPO_OFST (0)
|
||||
|
||||
/* WPR */
|
||||
#define ALTERA_HBUS_WPR_WP_MSK (0x1)
|
||||
#define ALTERA_HBUS_WPR_WP_OFST (0)
|
||||
|
||||
/* LBR */
|
||||
#define ALTERA_HBUS_LBR_LOOPBACK_MSK (0x1)
|
||||
#define ALTERA_HBUS_LBR_LOOPBACK_OFST (0)
|
||||
|
||||
/* TAR */
|
||||
#define ALTERA_HBUS_TAR_WTA_MSK (0x3)
|
||||
#define ALTERA_HBUS_TAR_WTA_OFST (0)
|
||||
#define ALTERA_HBUS_TAR_RTA_MSK (0x30)
|
||||
#define ALTERA_HBUS_TAR_RTA_OFST (4)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
volatile uint32_t csr;
|
||||
volatile uint32_t ien;
|
||||
volatile uint32_t isr;
|
||||
volatile uint32_t icr;
|
||||
volatile uint32_t mbr0;
|
||||
volatile uint32_t mbr1;
|
||||
volatile uint32_t mbr2;
|
||||
volatile uint32_t mbr3;
|
||||
volatile uint32_t mcr0;
|
||||
volatile uint32_t mcr1;
|
||||
volatile uint32_t mcr2;
|
||||
volatile uint32_t mcr3;
|
||||
volatile uint32_t mtr0;
|
||||
volatile uint32_t mtr1;
|
||||
volatile uint32_t mtr2;
|
||||
volatile uint32_t mtr3;
|
||||
volatile uint32_t gpor;
|
||||
volatile uint32_t wpr;
|
||||
volatile uint32_t lbr;
|
||||
volatile uint32_t tar;
|
||||
}altera_avalon_hbus_ctrl_regs;
|
||||
|
||||
#define HBUS_CTRL_REGS \
|
||||
(( volatile altera_avalon_hbus_ctrl_regs* ) \
|
||||
HYPERBUS_CTRL_ALTERA_AXI4_SLAVE_REGISTER_BASE )
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,59 @@
|
||||
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2024 Kevin Kirspel
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _ALTERA_AVALON_PIO_REGS_H
|
||||
#define _ALTERA_AVALON_PIO_REGS_H
|
||||
|
||||
#include <bsp_system.h>
|
||||
|
||||
#define ALTERA_AVALON_PIO_DIRECTION_INPUT 0
|
||||
#define ALTERA_AVALON_PIO_DIRECTION_OUTPUT 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
volatile uint32_t data;
|
||||
volatile uint32_t direction;
|
||||
volatile uint32_t interruptmask;
|
||||
volatile uint32_t edgecapture;
|
||||
volatile uint32_t outset;
|
||||
volatile uint32_t outclear;
|
||||
}altera_avalon_pio_regs;
|
||||
|
||||
#define LED_PIO_REGS (( volatile altera_avalon_pio_regs* )LED_PIO_BASE )
|
||||
#define USER_DIPSW_REGS (( volatile altera_avalon_pio_regs* )USER_DIPSW_BASE )
|
||||
#define USER_PB_REGS (( volatile altera_avalon_pio_regs* )USER_PB_BASE )
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,50 @@
|
||||
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2024 Kevin Kirspel
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __ALTERA_AVALON_SYSID_QSYS_REGS_H__
|
||||
#define __ALTERA_AVALON_SYSID_QSYS_REGS_H__
|
||||
|
||||
#include <bsp_system.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
volatile uint32_t sys_id;
|
||||
volatile uint32_t sys_timestamp;
|
||||
}altera_avalon_sysid_regs;
|
||||
|
||||
#define SYSID_REGS (( volatile altera_avalon_sysid_regs* )SYS_ID_BASE )
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __ALTERA_AVALON_SYSID_QSYS_REGS_H__ */
|
||||
@@ -0,0 +1,61 @@
|
||||
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2024 Kevin Kirspel
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LIBBSP_NIOSV_GENERIC_H
|
||||
#define LIBBSP_NIOSV_GENERIC_H
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/clockdrv.h>
|
||||
#include <rtems/console.h>
|
||||
|
||||
#include <bspopts.h>
|
||||
#include <bsp/default-initial-extension.h>
|
||||
#include <altera_avalon_hbus_regs.h>
|
||||
#include <altera_avalon_jtag_uart_regs.h>
|
||||
#include <altera_avalon_pio_regs.h>
|
||||
#include <altera_avalon_sysid_qsys_regs.h>
|
||||
#include <altera_avalon_timer_regs.h>
|
||||
#include <altera_avalon_epcq_regs.h>
|
||||
#include <status_led_device_driver.h>
|
||||
#include <system_device_driver.h>
|
||||
|
||||
#include <rtems/devnull.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define BSP_FEATURE_IRQ_EXTENSION
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
||||
#endif /* LIBBSP_NIOSV_GENERIC_H */
|
||||
@@ -0,0 +1,38 @@
|
||||
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2024 Kevin Kirspel
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __BSP_SYSTEM_H_
|
||||
#define __BSP_SYSTEM_H_
|
||||
|
||||
#if NIOSV_IS_NIOSVG != 0
|
||||
#include <bsp_system_vg.h>
|
||||
#else
|
||||
#include <bsp_system_vm.h>
|
||||
#endif
|
||||
|
||||
#endif /* __BSP_SYSTEM_H_ */
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,98 @@
|
||||
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2024 Kevin Kirspel
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _STATUS_LED_DRIVER_H
|
||||
#define _STATUS_LED_DRIVER_H
|
||||
|
||||
/* Definitions */
|
||||
/* IOCTL Definitions */
|
||||
#define IOCTL_STATUS_LED_TURN_ON 0x00
|
||||
#define IOCTL_STATUS_LED_TURN_OFF 0x01
|
||||
|
||||
#define STATUS_LED_1 0x01
|
||||
#define STATUS_LED_2 0x02
|
||||
#define STATUS_LED_3 0x04
|
||||
#define STATUS_LED_4 0x08
|
||||
|
||||
/* Global Structure definitions */
|
||||
typedef struct StatusLedControlStruct
|
||||
{
|
||||
uint32_t led_mask;
|
||||
}status_led_control_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define STATUS_LED_DRIVER_TABLE_ENTRY \
|
||||
{ status_led_initialize, status_led_open, status_led_close, \
|
||||
status_led_read, status_led_write, status_led_control }
|
||||
|
||||
rtems_device_driver status_led_initialize(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver status_led_open(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver status_led_close(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver status_led_read(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver status_led_write(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver status_led_control(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2024 Kevin Kirspel
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _SYSTEM_DRIVER_H
|
||||
#define _SYSTEM_DRIVER_H
|
||||
|
||||
/* Definitions */
|
||||
/* IOCTL Definitions */
|
||||
#define IOCTL_SYSTEM_SOFTWARE_VERSION 0x00
|
||||
#define IOCTL_SYSTEM_RESET 0x01
|
||||
|
||||
#define VERSION_SIZE 20
|
||||
|
||||
/* Global Structure definitions */
|
||||
typedef struct SystemControlStruct
|
||||
{
|
||||
char version[VERSION_SIZE];
|
||||
}system_control_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SYSTEM_DRIVER_TABLE_ENTRY \
|
||||
{ system_initialize, system_open, system_close, \
|
||||
system_read, system_write, system_control }
|
||||
|
||||
rtems_device_driver system_initialize(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver system_open(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver system_close(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver system_read(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver system_write(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver system_control(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* Copyright (C) 2024 Kevin Kirspel
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <bsp/bootcard.h>
|
||||
#include <bsp/niosv.h>
|
||||
|
||||
void bsp_reset(rtems_fatal_source source, rtems_fatal_code code)
|
||||
{
|
||||
(void) source;
|
||||
(void) code;
|
||||
|
||||
/*
|
||||
* The following line interferes with successfully executing RTEMS tests.
|
||||
* Uncomment in real systems.
|
||||
*/
|
||||
/* WATCHDOG_REGS->control = ALTERA_AVALON_TIMER_CONTROL_START_MSK; */
|
||||
|
||||
for(;;);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||
actions:
|
||||
- get-string: null
|
||||
- split: null
|
||||
- env-append: null
|
||||
build-type: option
|
||||
copyrights:
|
||||
- Copyright (C) 2024 Kevin Kirspel
|
||||
default:
|
||||
- enabled-by:
|
||||
- and:
|
||||
- NIOSV_IS_NIOSVG
|
||||
- NIOSV_HAS_FP
|
||||
value:
|
||||
- -march=rv32imf
|
||||
- -mabi=ilp32f
|
||||
- enabled-by: NIOSV_IS_NIOSVG
|
||||
value:
|
||||
- -march=rv32im
|
||||
- -mabi=ilp32
|
||||
- enabled-by: true
|
||||
value:
|
||||
- -march=rv32i
|
||||
- -mabi=ilp32
|
||||
description: |
|
||||
ABI flags
|
||||
enabled-by: true
|
||||
links: []
|
||||
name: ABI_FLAGS
|
||||
type: build
|
||||
@@ -0,0 +1,21 @@
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||
arch: riscv
|
||||
bsp: niosvc10lp
|
||||
build-type: bsp
|
||||
cflags: []
|
||||
copyrights:
|
||||
- Copyright (C) 2024 Kevin Kirspel
|
||||
cppflags: []
|
||||
enabled-by: true
|
||||
family: niosv
|
||||
includes: []
|
||||
install: []
|
||||
links:
|
||||
- role: build-dependency
|
||||
uid: ../../opto2
|
||||
- role: build-dependency
|
||||
uid: grp
|
||||
- role: build-dependency
|
||||
uid: objniosvc10lp
|
||||
source: []
|
||||
type: build
|
||||
@@ -0,0 +1,65 @@
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||
build-type: group
|
||||
cflags: []
|
||||
copyrights:
|
||||
- Copyright (C) 2024 Kevin Kirspel
|
||||
cppflags: []
|
||||
cxxflags: []
|
||||
enabled-by: true
|
||||
includes: []
|
||||
install: []
|
||||
ldflags: []
|
||||
links:
|
||||
- role: build-dependency
|
||||
uid: ../../obj
|
||||
- role: build-dependency
|
||||
uid: ../../objirq
|
||||
- role: build-dependency
|
||||
uid: ../../optclang
|
||||
- role: build-dependency
|
||||
uid: ../../optconsolebaud
|
||||
- role: build-dependency
|
||||
uid: ../../optgcc
|
||||
- role: build-dependency
|
||||
uid: optextirqmax
|
||||
- role: build-dependency
|
||||
uid: ../grp
|
||||
- role: build-dependency
|
||||
uid: optonchiprambegin
|
||||
- role: build-dependency
|
||||
uid: optonchipramsize
|
||||
- role: build-dependency
|
||||
uid: optonchiprombegin
|
||||
- role: build-dependency
|
||||
uid: optonchipromsize
|
||||
- role: build-dependency
|
||||
uid: optextrambegin
|
||||
- role: build-dependency
|
||||
uid: optextramsize
|
||||
- role: build-dependency
|
||||
uid: optepcqrombegin
|
||||
- role: build-dependency
|
||||
uid: optepcqromsize
|
||||
- role: build-dependency
|
||||
uid: optisniosvg
|
||||
- role: build-dependency
|
||||
uid: optniosvghasfp
|
||||
- role: build-dependency
|
||||
uid: abi
|
||||
- role: build-dependency
|
||||
uid: obj
|
||||
- role: build-dependency
|
||||
uid: ../../objmem
|
||||
- role: build-dependency
|
||||
uid: linkcmds
|
||||
- role: build-dependency
|
||||
uid: ../linkcmdsbase
|
||||
- role: build-dependency
|
||||
uid: ../start
|
||||
- role: build-dependency
|
||||
uid: ../../bspopts
|
||||
- role: build-dependency
|
||||
uid: optincludes
|
||||
type: build
|
||||
use-after: []
|
||||
use-before: []
|
||||
@@ -0,0 +1,32 @@
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||
build-type: config-file
|
||||
content: |
|
||||
MEMORY {
|
||||
ONCHIP_ROM : ORIGIN = ${NIOSV_ONCHIP_ROM_REGION_BEGIN}, LENGTH = ${NIOSV_ONCHIP_ROM_REGION_SIZE}
|
||||
ONCHIP_RAM : ORIGIN = ${NIOSV_ONCHIP_RAM_REGION_BEGIN}, LENGTH = ${NIOSV_ONCHIP_RAM_REGION_SIZE}
|
||||
EXT_RAM : ORIGIN = ${NIOSV_EXT_RAM_REGION_BEGIN}, LENGTH = ${NIOSV_EXT_RAM_REGION_SIZE}
|
||||
EPCQ_ROM : ORIGIN = ${NIOSV_EPCQ_ROM_REGION_BEGIN}, LENGTH = ${NIOSV_EPCQ_ROM_REGION_SIZE}
|
||||
}
|
||||
|
||||
REGION_ALIAS ("REGION_START", EXT_RAM);
|
||||
REGION_ALIAS ("REGION_TEXT", EXT_RAM);
|
||||
REGION_ALIAS ("REGION_TEXT_LOAD", EXT_RAM);
|
||||
REGION_ALIAS ("REGION_FAST_TEXT", EXT_RAM);
|
||||
REGION_ALIAS ("REGION_FAST_TEXT_LOAD", EXT_RAM);
|
||||
REGION_ALIAS ("REGION_RODATA", EXT_RAM);
|
||||
REGION_ALIAS ("REGION_RODATA_LOAD", EXT_RAM);
|
||||
REGION_ALIAS ("REGION_DATA", EXT_RAM);
|
||||
REGION_ALIAS ("REGION_DATA_LOAD", EXT_RAM);
|
||||
REGION_ALIAS ("REGION_FAST_DATA", EXT_RAM);
|
||||
REGION_ALIAS ("REGION_FAST_DATA_LOAD", EXT_RAM);
|
||||
REGION_ALIAS ("REGION_RTEMSSTACK", EXT_RAM);
|
||||
REGION_ALIAS ("REGION_WORK", EXT_RAM);
|
||||
|
||||
INCLUDE linkcmds.base
|
||||
copyrights:
|
||||
- Copyright (C) 2024 Kevin Kirspel
|
||||
enabled-by: true
|
||||
install-path: ${BSP_LIBDIR}
|
||||
links: []
|
||||
target: linkcmds
|
||||
type: build
|
||||
@@ -0,0 +1,34 @@
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||
build-type: objects
|
||||
cflags: []
|
||||
copyrights:
|
||||
- Copyright (C) 2024 Kevin Kirspel
|
||||
cppflags: []
|
||||
cxxflags: []
|
||||
enabled-by: true
|
||||
includes: []
|
||||
install:
|
||||
- destination: ${BSP_INCLUDEDIR}
|
||||
source:
|
||||
- bsps/riscv/niosv/include/alt_cache.h
|
||||
- bsps/riscv/niosv/include/altera_avalon_jtag_uart_regs.h
|
||||
- bsps/riscv/niosv/include/altera_avalon_timer_regs.h
|
||||
- bsps/riscv/niosv/include/altera_avalon_epcq_regs.h
|
||||
- bsps/riscv/niosv/include/tm27.h
|
||||
- destination: ${BSP_INCLUDEDIR}/bsp
|
||||
source:
|
||||
- bsps/riscv/niosv/include/bsp/irq.h
|
||||
- bsps/riscv/niosv/include/bsp/niosv.h
|
||||
links: []
|
||||
source:
|
||||
- bsps/riscv/niosv/clock/clockdrv.c
|
||||
- bsps/riscv/niosv/irq/irq.c
|
||||
- bsps/riscv/niosv/cache/alt_cache.c
|
||||
- bsps/riscv/niosv/start/bsp_fatal_halt.c
|
||||
- bsps/shared/dev/getentropy/getentropy-cpucounter.c
|
||||
- bsps/shared/dev/serial/console-termios.c
|
||||
- bsps/shared/irq/irq-default-handler.c
|
||||
- bsps/shared/start/bspgetworkarea-default.c
|
||||
- bsps/shared/start/bspfatal-default.c
|
||||
- bsps/shared/start/gettargethash-default.c
|
||||
type: build
|
||||
@@ -0,0 +1,29 @@
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||
build-type: objects
|
||||
cflags: []
|
||||
copyrights:
|
||||
- Copyright (C) 2024 Kevin Kirspel
|
||||
cppflags: []
|
||||
cxxflags: []
|
||||
enabled-by: true
|
||||
includes: []
|
||||
install:
|
||||
- destination: ${BSP_INCLUDEDIR}
|
||||
source:
|
||||
- bsps/riscv/niosv/niosvc10lp/include/bsp.h
|
||||
- bsps/riscv/niosv/niosvc10lp/include/bsp_system.h
|
||||
- bsps/riscv/niosv/niosvc10lp/include/bsp_system_vm.h
|
||||
- bsps/riscv/niosv/niosvc10lp/include/bsp_system_vg.h
|
||||
- bsps/riscv/niosv/niosvc10lp/include/altera_avalon_hbus_regs.h
|
||||
- bsps/riscv/niosv/niosvc10lp/include/altera_avalon_pio_regs.h
|
||||
- bsps/riscv/niosv/niosvc10lp/include/altera_avalon_sysid_qsys_regs.h
|
||||
- bsps/riscv/niosv/niosvc10lp/include/status_led_device_driver.h
|
||||
- bsps/riscv/niosv/niosvc10lp/include/system_device_driver.h
|
||||
links: []
|
||||
source:
|
||||
- bsps/riscv/niosv/console/console-config.c
|
||||
- bsps/riscv/niosv/flash/altera_epcq_driver.c
|
||||
- bsps/riscv/niosv/niosvc10lp/bspstart.c
|
||||
- bsps/riscv/niosv/niosvc10lp/status_led_device_driver.c
|
||||
- bsps/riscv/niosv/niosvc10lp/system_device_driver.c
|
||||
type: build
|
||||
@@ -0,0 +1,19 @@
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||
actions:
|
||||
- get-integer: null
|
||||
- assert-uint64: null
|
||||
- assert-aligned: 0x100000
|
||||
- env-assign: null
|
||||
- format-and-define: null
|
||||
build-type: option
|
||||
copyrights:
|
||||
- Copyright (C) 2024 Kevin Kirspel
|
||||
default:
|
||||
- enabled-by: true
|
||||
value: 0xFFFFFFFF
|
||||
description: ''
|
||||
enabled-by: true
|
||||
format: '{:#010x}'
|
||||
links: []
|
||||
name: NIOSV_EPCQ_ROM_REGION_BEGIN
|
||||
type: build
|
||||
@@ -0,0 +1,19 @@
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||
actions:
|
||||
- get-integer: null
|
||||
- assert-uint64: null
|
||||
- assert-aligned: 0x100000
|
||||
- env-assign: null
|
||||
- format-and-define: null
|
||||
build-type: option
|
||||
copyrights:
|
||||
- Copyright (C) 2024 Kevin Kirspel
|
||||
default:
|
||||
- enabled-by: true
|
||||
value: 0x00000000
|
||||
description: ''
|
||||
enabled-by: true
|
||||
format: '{:#010x}'
|
||||
links: []
|
||||
name: NIOSV_EPCQ_ROM_REGION_SIZE
|
||||
type: build
|
||||
@@ -0,0 +1,17 @@
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||
actions:
|
||||
- get-integer: null
|
||||
- define: null
|
||||
build-type: option
|
||||
copyrights:
|
||||
- Copyright (C) 2024 Kevin Kirspel
|
||||
default:
|
||||
- enabled-by: true
|
||||
value: 16
|
||||
description: |
|
||||
maximum number of external interrupts supported by the BSP (default 16)
|
||||
enabled-by: true
|
||||
format: '{}'
|
||||
links: []
|
||||
name: NIOSV_MAXIMUM_EXTERNAL_INTERRUPTS
|
||||
type: build
|
||||
@@ -0,0 +1,19 @@
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||
actions:
|
||||
- get-integer: null
|
||||
- assert-uint64: null
|
||||
- assert-aligned: 0x01000000
|
||||
- env-assign: null
|
||||
- format-and-define: null
|
||||
build-type: option
|
||||
copyrights:
|
||||
- Copyright (C) 2024 Kevin Kirspel
|
||||
default:
|
||||
- enabled-by: true
|
||||
value: 0xFFFFFFFF
|
||||
description: ''
|
||||
enabled-by: true
|
||||
format: '{:#010x}'
|
||||
links: []
|
||||
name: NIOSV_EXT_RAM_REGION_BEGIN
|
||||
type: build
|
||||
@@ -0,0 +1,19 @@
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||
actions:
|
||||
- get-integer: null
|
||||
- assert-uint64: null
|
||||
- assert-aligned: 0x00100000
|
||||
- env-assign: null
|
||||
- format-and-define: null
|
||||
build-type: option
|
||||
copyrights:
|
||||
- Copyright (C) 2024 Kevin Kirspel
|
||||
default:
|
||||
- enabled-by: true
|
||||
value: 0x00000000
|
||||
description: ''
|
||||
enabled-by: true
|
||||
format: '{:#010x}'
|
||||
links: []
|
||||
name: NIOSV_EXT_RAM_REGION_SIZE
|
||||
type: build
|
||||
@@ -0,0 +1,16 @@
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||
actions:
|
||||
- set-value: |
|
||||
bsps/include bsps/${ARCH}/include bsps/${ARCH}/${BSP_FAMILY}/include bsps/${ARCH}/${BSP_FAMILY}/${BSP_NAME}/include
|
||||
- substitute: null
|
||||
- split: null
|
||||
- env-assign: null
|
||||
build-type: option
|
||||
copyrights:
|
||||
- Copyright (C) 2020 embedded brains GmbH & Co. KG
|
||||
default: []
|
||||
description: ''
|
||||
enabled-by: true
|
||||
links: []
|
||||
name: BSP_INCLUDES
|
||||
type: build
|
||||
@@ -0,0 +1,17 @@
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||
actions:
|
||||
- get-boolean: null
|
||||
- define-condition: null
|
||||
- env-enable: null
|
||||
build-type: option
|
||||
copyrights:
|
||||
- Copyright (C) 2024 Kevin Kirspel
|
||||
default:
|
||||
- enabled-by: true
|
||||
value: false
|
||||
description: |
|
||||
enables support for NIOS V/g processor (disabled by default)
|
||||
enabled-by: true
|
||||
links: []
|
||||
name: NIOSV_IS_NIOSVG
|
||||
type: build
|
||||
@@ -0,0 +1,16 @@
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||
actions:
|
||||
- set-value:
|
||||
- -L${TOP}/bsps/${ARCH}/shared/start
|
||||
- -L${TOP}/bsps/${ARCH}/${BSP_FAMILY}/start
|
||||
- substitute: null
|
||||
- env-append: LDFLAGS
|
||||
build-type: option
|
||||
copyrights:
|
||||
- Copyright (C) 2024 Kevin Kirspel
|
||||
default: []
|
||||
description: ''
|
||||
enabled-by: true
|
||||
links: []
|
||||
name: LDFLAGS
|
||||
type: build
|
||||
@@ -0,0 +1,17 @@
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||
actions:
|
||||
- get-boolean: null
|
||||
- define-condition: null
|
||||
- env-enable: null
|
||||
build-type: option
|
||||
copyrights:
|
||||
- Copyright (C) 2024 Kevin Kirspel
|
||||
default:
|
||||
- enabled-by: true
|
||||
value: false
|
||||
description: |
|
||||
enables support for the NIOS V/g processor FPU (disabled by default)
|
||||
enabled-by: true
|
||||
links: []
|
||||
name: NIOSV_HAS_FP
|
||||
type: build
|
||||
@@ -0,0 +1,19 @@
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||
actions:
|
||||
- get-integer: null
|
||||
- assert-uint64: null
|
||||
- assert-aligned: 0x1000
|
||||
- env-assign: null
|
||||
- format-and-define: null
|
||||
build-type: option
|
||||
copyrights:
|
||||
- Copyright (C) 2024 Kevin Kirspel
|
||||
default:
|
||||
- enabled-by: true
|
||||
value: 0xFFFFFFFF
|
||||
description: ''
|
||||
enabled-by: true
|
||||
format: '{:#010x}'
|
||||
links: []
|
||||
name: NIOSV_ONCHIP_RAM_REGION_BEGIN
|
||||
type: build
|
||||
@@ -0,0 +1,19 @@
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||
actions:
|
||||
- get-integer: null
|
||||
- assert-uint64: null
|
||||
- assert-aligned: 0x1000
|
||||
- env-assign: null
|
||||
- format-and-define: null
|
||||
build-type: option
|
||||
copyrights:
|
||||
- Copyright (C) 2024 Kevin Kirspel
|
||||
default:
|
||||
- enabled-by: true
|
||||
value: 0
|
||||
description: ''
|
||||
enabled-by: true
|
||||
format: '{:#010x}'
|
||||
links: []
|
||||
name: NIOSV_ONCHIP_RAM_REGION_SIZE
|
||||
type: build
|
||||
@@ -0,0 +1,19 @@
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||
actions:
|
||||
- get-integer: null
|
||||
- assert-uint64: null
|
||||
- assert-aligned: 0x1000
|
||||
- env-assign: null
|
||||
- format-and-define: null
|
||||
build-type: option
|
||||
copyrights:
|
||||
- Copyright (C) 2024 Kevin Kirspel
|
||||
default:
|
||||
- enabled-by: true
|
||||
value: 0xFFFFFFFF
|
||||
description: ''
|
||||
enabled-by: true
|
||||
format: '{:#010x}'
|
||||
links: []
|
||||
name: NIOSV_ONCHIP_ROM_REGION_BEGIN
|
||||
type: build
|
||||
@@ -0,0 +1,19 @@
|
||||
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
|
||||
actions:
|
||||
- get-integer: null
|
||||
- assert-uint64: null
|
||||
- assert-aligned: 0x1000
|
||||
- env-assign: null
|
||||
- format-and-define: null
|
||||
build-type: option
|
||||
copyrights:
|
||||
- Copyright (C) 2024 Kevin Kirspel
|
||||
default:
|
||||
- enabled-by: true
|
||||
value: 0
|
||||
description: ''
|
||||
enabled-by: true
|
||||
format: '{:#010x}'
|
||||
links: []
|
||||
name: NIOSV_ONCHIP_ROM_REGION_SIZE
|
||||
type: build
|
||||
Reference in new issue
Block a user