OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/trunk/rtos/ecos-2.0/packages/hal/sparc/leon
    from Rev 27 to Rev 174
    Reverse comparison

Rev 27 → Rev 174

/v2_0/cdl/hal_sparc_leon.cdl
0,0 → 1,201
# ====================================================================
#
# hal_sparc_leon.cdl
#
# SPARC LEON target HAL package configuration data
#
# ====================================================================
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2 or (at your option) any later version.
##
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
## for more details.
##
## You should have received a copy of the GNU General Public License along
## with eCos; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
##
## As a special exception, if other files instantiate templates or use macros
## or inline functions from this file, or you compile this file and link it
## with other works to produce a work based on this file, this file does not
## by itself cause the resulting work to be covered by the GNU General Public
## License. However the source code for this file must still be made available
## in accordance with section (3) of the GNU General Public License.
##
## This exception does not invalidate any other reasons why a work based on
## this file might be covered by the GNU General Public License.
##
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
## at http://sources.redhat.com/ecos/ecos-license/
## -------------------------------------------
#####ECOSGPLCOPYRIGHTEND####
# ====================================================================
######DESCRIPTIONBEGIN####
#
# Author(s): jskov
# Original data: hmt
# Contributors:
# Date: 2000-02-10
#
#####DESCRIPTIONEND####
#
# ====================================================================
 
cdl_package CYGPKG_HAL_SPARC_LEON {
display "LEON processor"
parent CYGPKG_HAL_SPARC
define_header hal_sparc_leon.h
include_dir cyg/hal
description "
The LEON HAL package is provided for both simulator (TSIM)
and real hardware use"
 
compile hal_priv.c
 
define_proc {
puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H <pkgconf/hal_sparc.h>"
puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H <pkgconf/hal_sparc_leon.h>"
puts $::cdl_header "#define CYGHWR_HAL_SPARC_MULTIPLE_VECTOR_TRAPPING /* true for LEON */"
puts $::cdl_header "#define HAL_IDLE_THREAD_ACTION hal_idle_thread_action /* true for LEON */"
}
 
cdl_component CYG_HAL_STARTUP {
display "Startup type"
flavor data
legal_values {"RAM"}
default_value {"RAM"}
no_define
define -file system.h CYG_HAL_STARTUP
description "
When targetting the LEON processor only the RAM startup type
is usable."
}
 
# Real-time clock/counter specifics
cdl_component CYGNUM_HAL_RTC_CONSTANTS {
display "Real-time clock constants."
flavor none
cdl_option CYGNUM_HAL_RTC_NUMERATOR {
display "Real-time clock numerator"
flavor data
calculated 1000000000
}
cdl_option CYGNUM_HAL_RTC_DENOMINATOR {
display "Real-time clock denominator"
flavor data
calculated 100
}
cdl_option CYGNUM_HAL_RTC_PERIOD {
display "Real-time clock period"
flavor data
calculated 9999
}
}
 
cdl_component CYGBLD_GLOBAL_OPTIONS {
display "Global build options"
flavor none
description "
Global build options including control over
compiler flags, linker flags and choice of toolchain."
 
 
parent CYGPKG_NONE
 
cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX {
display "Global command prefix"
flavor data
no_define
default_value { "sparc-rtems" }
description "
This option specifies the command prefix used when
invoking the build tools."
}
 
cdl_option CYGBLD_GLOBAL_CFLAGS {
display "Global compiler flags"
flavor data
no_define
default_value { "-msoft-float -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" }
description "
This option controls the global compiler flags which
are used to compile all packages by
default. Individual packages may define
options which override these global flags."
}
 
cdl_option CYGBLD_GLOBAL_LDFLAGS {
display "Global linker flags"
flavor data
no_define
default_value { "-msoft-float -g -nostdlib -Wl,--gc-sections -Wl,-static" }
description "
This option controls the global linker flags. Individual
packages may define options which override these global flags."
}
}
 
cdl_component CYGPKG_HAL_SPARC_LEON_OPTIONS {
display "LEON processor build options"
flavor none
description "
Package specific build options including control over
compiler flags used only in building this package,
and details of which tests are built."
 
 
cdl_option CYGPKG_HAL_SPARC_LEON_CFLAGS_ADD {
display "Additional compiler flags"
flavor data
no_define
default_value { "" }
description "
This option modifies the set of compiler flags for
building the LEON processor HAL. These flags are
used in addition to the set of global flags."
}
 
cdl_option CYGPKG_HAL_SPARC_LEON_CFLAGS_REMOVE {
display "Suppressed compiler flags"
flavor data
no_define
default_value { "" }
description "
This option modifies the set of compiler flags for
building the LEON processor HAL. These flags are
removed from the set of global flags if present."
}
}
 
cdl_component CYGHWR_MEMORY_LAYOUT {
display "Memory layout"
flavor data
no_define
calculated { "sparc_leon_ram" }
 
cdl_option CYGHWR_MEMORY_LAYOUT_LDI {
display "Memory layout linker script fragment"
flavor data
no_define
define -file system.h CYGHWR_MEMORY_LAYOUT_LDI
calculated { "<pkgconf/mlt_sparc_leon_ram.ldi>" }
}
 
cdl_option CYGHWR_MEMORY_LAYOUT_H {
display "Memory layout header file"
flavor data
no_define
define -file system.h CYGHWR_MEMORY_LAYOUT_H
calculated { "<pkgconf/mlt_sparc_leon_ram.h>" }
}
}
}
/v2_0/include/halboot.si
0,0 → 1,151
#ifndef CYGONCE_HAL_HALBOOT_SI /* -*-asm-*- */
#define CYGONCE_HAL_HALBOOT_SI
// ====================================================================
//
// <platform>/halboot.si
//
// HAL bootup platform-oriented code (assembler)
//
// ====================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
// ====================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): hmt
// Contributors: hmt
// Date: 1999-02-01
// Purpose: Bootup code, platform oriented.
// Description:
//
//####DESCRIPTIONEND####
//
// ====================================================================
 
// External Platform Initial Setup
//
// This should set up RAM and caches, and calm down any external
// interrupt sources.
//
// It is just plain included in vectors.S
//
// RAM has not yet been touched at all; in fact all you have is a
// register window selected.
 
 
! Empty macro for debugging vectors.S
.macro led val
.endm
 
! Set memory according to simulator config
 
set 0x80000000, %l0 ! LEON register base address
 
ld [%l0 + 0x14], %l1 ! chech if we have been initialized
andcc %l1, 0x1, %g0
bne 4f
nop
 
flush ! if we are here, we are running on
set 0x1000f, %l1 ! the simulator....
 
st %l1, [%l0 + 0x14] ! enable caches
 
st %g0, [%l0 + 0x1c] ! clear LEON registers
st %g0, [%l0 + 0x20] !
st %g0, [%l0 + 0x90] !
st %g0, [%l0 + 0x94] !
st %g0, [%l0 + 0x98] !
st %g0, [%l0 + 0x9C] !
st %g0, [%l0 + 0xA0] !
st %g0, [%l0 + 0xA4] !
st %g0, [%l0 + 0xA4] !
st %g0, [%l0 + 0x78] !
st %g0, [%l0 + 0x88] !
 
ld [%l0 + 0xF8], %g1 ! load simulator rom size
clr %l2
subcc %g1, 0, %g0
be 3f
srl %g1, 13, %g1 ! calculate appropriate rom size
1:
srl %g1, 1, %g1
tst %g1
bne,a 1b
inc %l2
sll %l2, 14, %l2
st %l2, [%l0 + 0x00] ! set prom size in memcfg1
 
set 0, %l2
ld [%l0 + 0xF4], %g2 ! load simulator ram size
srl %g2, 13, %g1 ! calculate appropriate ram size
1:
srl %g1, 1, %g1
tst %g1
bne,a 1b
inc %l2
sll %l2, 9, %l2
or %l2, 0x20, %l2
st %l2, [%l0 + 0x04] ! set ram size in memcfg2
set 0x40000000, %l2
add %g2, %l2, %fp
sub %fp, 96*4, %sp
3:
st %g0, [%sp] !probe for FPU
! ld [%sp], %fsr
set 49, %l1
st %l1, [%l0 + 0x64] ! scaler = 49
st %l1, [%l0 + 0x60] ! scaler = 49
 
2:
 
set -1, %l1
st %l1, [%l0 + 0x44] ! timer 1 = 0xffffff
set 7, %l1
st %l1, [%l0 + 0x48] ! start timer 1
st %l1, [%l0 + 0x78] ! enable UARTS
st %l1, [%l0 + 0x88]
 
4:
! then copy the branch instructions into the vector
rd %tbr, %g1
andn %g1, 0xfff, %g1 ! clear non-address bits
sethi %hi(real_vector_instructions), %l0
or %l0, %lo(real_vector_instructions), %l0
ld [ %l0 ], %l1
st %l1, [ %g1 ] ! into the vector
ld [ %l0 + 4 ], %l1
st %l1, [ %g1 + 4 ] ! into the vector
 
#endif /* CYGONCE_HAL_HALBOOT_SI */
/* EOF halboot.si */
/v2_0/include/hal_clock.h
0,0 → 1,128
#ifndef CYGONCE_HAL_CLOCK_H
#define CYGONCE_HAL_CLOCK_H
 
//=============================================================================
//
// hal_clock.h
//
// HAL clock support
//
//=============================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//=============================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): nickg, gthomas, hmt
// Contributors: nickg, gthomas, hmt
// Date: 1999-01-28
// Purpose: Define clock support
// Description: The macros defined here provide the HAL APIs for handling
// the clock.
//
// Usage:
// #include <cyg/hal/hal_intr.h> // which includes this file
// ...
//
//
//####DESCRIPTIONEND####
//
//=============================================================================
 
#include <cyg/hal/hal_io.h>
 
//-----------------------------------------------------------------------------
// Clock control
 
// in erc32 simulator:
// 4 = UART A
// 5 = UART B
// 7 = UART error
// 12 = GPT (general purpose timer)
// 13 = TI1 (realtime clock)
// 15 = watchdog
 
// in erc32 simulator:
 
// The vector used by the Real time clock is defined in hal_xpic.h
 
// We could place conditional code here to choose one clock or the other
// depending on the selected interrupt vector... but pro tem: (pun intended)
 
#define SPARC_LEON_TIMER_SCALE (24)
 
/* These must be accessed word-wide to work! */
 
#define SPARC_LEON_REG (0x80000000)
 
#define SPARC_LEON_TI1_COUNTER (SPARC_LEON_REG + 0x40)
#define SPARC_LEON_TI1_CRELOAD (SPARC_LEON_REG + 0x44)
#define SPARC_LEON_SCALER (SPARC_LEON_REG + 0x60)
#define SPARC_LEON_SRELOAD (SPARC_LEON_REG + 0x64)
/* LEON timer control register bits */
#define SPARC_LEON_TI1_EN 1 /* System Enable */
#define SPARC_LEON_TI1_RL 2 /* Continuous Running */
#define SPARC_LEON_TI1_LD 4 /* Counter Load */
 
#define SPARC_LEON_TI1_CONTROL (SPARC_LEON_REG + 0x48)
 
externC cyg_int32 cyg_hal_sparc_clock_period;
 
#define HAL_CLOCK_INITIALIZE( _period_ ) CYG_MACRO_START \
cyg_hal_sparc_clock_period = (_period_); \
HAL_WRITE_UINT32( SPARC_LEON_TI1_CRELOAD, (_period_) ); \
HAL_WRITE_UINT32( SPARC_LEON_TI1_COUNTER, (_period_) ); \
HAL_WRITE_UINT32( SPARC_LEON_TI1_CONTROL, \
(SPARC_LEON_TI1_EN | \
SPARC_LEON_TI1_RL | \
SPARC_LEON_TI1_LD) ); \
CYG_MACRO_END
 
#define HAL_CLOCK_RESET( _vector_, _period_ ) /* nowt, it is freerunning */
 
#define HAL_CLOCK_READ( _pvalue_ ) CYG_MACRO_START \
cyg_uint32 _read_; \
HAL_READ_UINT32( SPARC_LEON_TI1_COUNTER, _read_ ); \
*((cyg_uint32 *)(_pvalue_)) = \
(cyg_hal_sparc_clock_period - _read_ ); \
CYG_MACRO_END
 
 
#ifdef CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY
#define HAL_CLOCK_LATENCY( _pvalue_ ) HAL_CLOCK_READ( _pvalue_ )
#endif
 
//-----------------------------------------------------------------------------
#endif // ifndef CYGONCE_HAL_CLOCK_H
// End of hal_clock.h
/v2_0/include/pkgconf/mlt_sparc_leon_ram.h
0,0 → 1,19
// eCos memory layout - Fri Oct 20 08:18:20 2000
 
// This is a generated file - do not edit
 
#ifndef __ASSEMBLER__
#include <cyg/infra/cyg_type.h>
#include <stddef.h>
 
#endif
#define CYGMEM_REGION_ram (0x40000000)
#define CYGMEM_REGION_ram_SIZE (0x80000)
#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W)
#ifndef __ASSEMBLER__
extern char CYG_LABEL_NAME (__heap1) [];
#endif
#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1))
#define CYGMEM_SECTION_heap1_SIZE (0x40080000 - (size_t) CYG_LABEL_NAME (__heap1))
 
#define CYGHWR_HAL_SPARC_MULTIPLE_VECTOR_TRAPPING
/v2_0/include/pkgconf/mlt_sparc_leon_ram.ldi
0,0 → 1,26
// eCos memory layout - Fri Oct 20 08:18:20 2000
 
// This is a generated file - do not edit
 
#include <cyg/infra/cyg_type.inc>
 
MEMORY
{
ram : ORIGIN = 0x40000000, LENGTH = 0x80000
}
 
SECTIONS
{
SECTIONS_BEGIN
SECTION_rom_vectors (ram, 0x40000000, LMA_EQ_VMA)
SECTION_text (ram, ALIGN (0x1), LMA_EQ_VMA)
SECTION_fini (ram, ALIGN (0x1), LMA_EQ_VMA)
SECTION_rodata (ram, ALIGN (0x1), LMA_EQ_VMA)
SECTION_rodata1 (ram, ALIGN (0x1), LMA_EQ_VMA)
SECTION_fixup (ram, ALIGN (0x1), LMA_EQ_VMA)
SECTION_gcc_except_table (ram, ALIGN (0x1), LMA_EQ_VMA)
SECTION_data (ram, ALIGN (0x1), LMA_EQ_VMA)
SECTION_bss (ram, ALIGN (0x8), LMA_EQ_VMA)
CYG_LABEL_DEFN(__heap1) = ALIGN (0x8);
SECTIONS_END
}
/v2_0/include/pkgconf/mlt_sparc_leon_ram.mlt
0,0 → 1,12
version 0
region ram 40000000 80000 0 !
section rom_vectors 0 1 0 1 1 1 1 1 40000000 40000000 text text !
section text 0 1 0 1 0 1 0 1 fini fini !
section fini 0 1 0 1 0 1 0 1 rodata rodata !
section rodata 0 1 0 1 0 1 0 1 rodata1 rodata1 !
section rodata1 0 1 0 1 0 1 0 1 fixup fixup !
section fixup 0 1 0 1 0 1 0 1 gcc_except_table gcc_except_table !
section gcc_except_table 0 1 0 1 0 1 0 1 data data !
section data 0 1 0 1 0 1 0 1 bss bss !
section bss 0 8 0 1 0 1 0 1 heap1 heap1 !
section heap1 0 8 0 0 0 0 0 0 !
/v2_0/include/hal_cache.h
0,0 → 1,182
#ifndef CYGONCE_HAL_CACHE_H
#define CYGONCE_HAL_CACHE_H
 
//=============================================================================
//
// hal_cache.h
//
// HAL Cache control support (such as it is in the simulator)
//
//=============================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//=============================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): nickg, gthomas, hmt
// Contributors: nickg, gthomas, hmt
// Date: 1999-01-28
// Purpose: Define Interrupt support
// Description: The macros defined here provide the HAL APIs for handling
// the caches.
//
// Usage:
// #include <cyg/hal/hal_cache.h>
// ...
//
//
//####DESCRIPTIONEND####
//
//=============================================================================
 
#include <pkgconf/hal.h>
#include <pkgconf/hal_sparc.h>
 
#include <cyg/infra/cyg_type.h>
 
//-----------------------------------------------------------------------------
// LEON cache macros
 
//-----------------------------------------------------------------------------
// Cache dimensions
 
// Data cache
#define HAL_DCACHE_SIZE 0x4000 // Size of data cache in bytes
#define HAL_DCACHE_LINE_SIZE 16 // Size of a data cache line
#define HAL_DCACHE_WAYS 1 // Associativity of the cache
 
// Instruction cache
#define HAL_ICACHE_SIZE 0x4000 // Size of cache in bytes
#define HAL_ICACHE_LINE_SIZE 16 // Size of a cache line
#define HAL_ICACHE_WAYS 1 // Associativity of the cache
 
#define HAL_DCACHE_SETS (HAL_DCACHE_SIZE/(HAL_DCACHE_LINE_SIZE*HAL_DCACHE_WAYS))
#define HAL_ICACHE_SETS (HAL_ICACHE_SIZE/(HAL_ICACHE_LINE_SIZE*HAL_ICACHE_WAYS))
 
//-----------------------------------------------------------------------------
// Global control of data cache
 
// Enable the data cache
#define HAL_DCACHE_ENABLE() //*((int *)0x80000014) |= (int)0x0000000c
// Disable the data cache
#define HAL_DCACHE_DISABLE() //*((int *)0x80000014) &= ~(int)0x0000000c
// Invalidate the entire cache
#define HAL_DCACHE_INVALIDATE_ALL() //*((int *)0x80000014) |= (int)0x00400000
// Synchronize the contents of the cache with memory.
#define HAL_DCACHE_SYNC()
 
// Set the data cache refill burst size
//#define HAL_DCACHE_BURST_SIZE(_size_)
 
// Set the data cache write mode
//#define HAL_DCACHE_WRITE_MODE( _mode_ )
 
//#define HAL_DCACHE_WRITETHRU_MODE 0
//#define HAL_DCACHE_WRITEBACK_MODE 1
 
// Load the contents of the given address range into the data cache
// and then lock the cache so that it stays there.
//#define HAL_DCACHE_LOCK(_base_, _size_)
 
// Undo a previous lock operation
//#define HAL_DCACHE_UNLOCK(_base_, _size_)
 
// Unlock entire cache
//#define HAL_DCACHE_UNLOCK_ALL()
 
//-----------------------------------------------------------------------------
// Data cache line control
 
// Allocate cache lines for the given address range without reading its
// contents from memory.
//#define HAL_DCACHE_ALLOCATE( _base_ , _size_ )
 
// Write dirty cache lines to memory and invalidate the cache entries
// for the given address range.
//#define HAL_DCACHE_FLUSH( _base_ , _size_ )
 
// Invalidate cache lines in the given range without writing to memory.
//#define HAL_DCACHE_INVALIDATE( _base_ , _size_ )
 
// Write dirty cache lines to memory for the given address range.
//#define HAL_DCACHE_STORE( _base_ , _size_ )
 
// Preread the given range into the cache with the intention of reading
// from it later.
//#define HAL_DCACHE_READ_HINT( _base_ , _size_ )
 
// Preread the given range into the cache with the intention of writing
// to it later.
//#define HAL_DCACHE_WRITE_HINT( _base_ , _size_ )
 
// Allocate and zero the cache lines associated with the given range.
//#define HAL_DCACHE_ZERO( _base_ , _size_ )
 
//-----------------------------------------------------------------------------
// Global control of Instruction cache - use Data cache controls since they
// are not separatable.
 
// Enable the instruction cache
#define HAL_ICACHE_ENABLE() HAL_DCACHE_ENABLE()
 
// Disable the instruction cache
#define HAL_ICACHE_DISABLE() HAL_DCACHE_DISABLE()
 
// Invalidate the entire cache
#define HAL_ICACHE_INVALIDATE_ALL() HAL_DCACHE_SYNC(); HAL_DCACHE_INVALIDATE_ALL()
 
// Synchronize the contents of the cache with memory.
#define HAL_ICACHE_SYNC()
 
// Set the instruction cache refill burst size
//#define HAL_ICACHE_BURST_SIZE(_size_)
 
// Load the contents of the given address range into the instruction cache
// and then lock the cache so that it stays there.
//#define HAL_ICACHE_LOCK(_base_, _size_)
 
// Undo a previous lock operation
//#define HAL_ICACHE_UNLOCK(_base_, _size_)
 
// Unlock entire cache
//#define HAL_ICACHE_UNLOCK_ALL()
 
//-----------------------------------------------------------------------------
// Instruction cache line control
 
// Invalidate cache lines in the given range without writing to memory.
//#define HAL_ICACHE_INVALIDATE( _base_ , _size_ )
 
//-----------------------------------------------------------------------------
#endif // ifndef CYGONCE_HAL_CACHE_H
// End of hal_cache.h
/v2_0/include/hal_xpic.h
0,0 → 1,122
#ifndef CYGONCE_HAL_XPIC_H
#define CYGONCE_HAL_XPIC_H
 
//=============================================================================
//
// hal_xpic.h
//
// HAL eXternal Programmable Interrupt Controller support
//
//=============================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//=============================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): nickg, gthomas, hmt
// Contributors: nickg, gthomas, hmt
// Date: 1999-01-28
// Purpose: Define Interrupt support
// Description: The macros defined here provide the HAL APIs for handling
// an external interrupt controller, and which interrupt is
// used for what.
//
// Usage:
// #include <cyg/hal/hal_intr.h> // which includes this file
// ...
//
//
//####DESCRIPTIONEND####
//
//=============================================================================
 
#include <cyg/hal/hal_io.h>
 
//-----------------------------------------------------------------------------
// Interrupt controller access
 
// in leon simulator:
// 2 = UART B
// 3 = UART A
// 1 = AHB error
// 9 = TI2 (general purpose timer)
// 8 = TI1 (realtime clock)
 
// The vector used by the Real time clock
#define CYGNUM_HAL_INTERRUPT_RTC CYGNUM_HAL_INTERRUPT_8
 
 
/* These must be accessed word-wide to work! */
#define SPARC_LEON_REG (0x80000000)
 
#define SPARC_LEON_INTCON_PENDING (SPARC_LEON_REG + 0x94)
#define SPARC_LEON_INTCON_MASK (SPARC_LEON_REG + 0x90)
#define SPARC_LEON_INTCON_CLEAR (SPARC_LEON_REG + 0x9C)
#define SPARC_LEON_INTCON_FORCE (SPARC_LEON_REG + 0x98)
 
 
#define HAL_INTERRUPT_MASK( _vector_ ) CYG_MACRO_START \
cyg_uint32 _traps_, _mask_; \
HAL_DISABLE_TRAPS( _traps_ ); \
HAL_READ_UINT32( SPARC_LEON_INTCON_MASK, _mask_ ); \
_mask_ &= ~( 1 << (_vector_) ); \
HAL_WRITE_UINT32(SPARC_LEON_INTCON_MASK, _mask_ ); \
HAL_RESTORE_INTERRUPTS( _traps_ ); \
CYG_MACRO_END
 
#define HAL_INTERRUPT_UNMASK( _vector_ ) CYG_MACRO_START \
cyg_uint32 _traps_, _mask_; \
HAL_DISABLE_TRAPS( _traps_ ); \
HAL_READ_UINT32( SPARC_LEON_INTCON_MASK, _mask_ ); \
_mask_ |= ( 1 << (_vector_) ); \
HAL_WRITE_UINT32( SPARC_LEON_INTCON_MASK, _mask_ ); \
HAL_RESTORE_INTERRUPTS( _traps_ ); \
CYG_MACRO_END
 
#define HAL_INTERRUPT_ACKNOWLEDGE( _vector_ )
/* Interrupts are automatically acknowledged by hardware, not needed ...
#define HAL_INTERRUPT_ACKNOWLEDGE( _vector_ ) CYG_MACRO_START \
cyg_uint32 _traps_; \
HAL_DISABLE_TRAPS( _traps_ ); \
HAL_WRITE_UINT32( SPARC_LEON_INTCON_CLEAR, ( 1 << (_vector_) ) ); \
HAL_RESTORE_INTERRUPTS( _traps_ ); \
CYG_MACRO_END
*/
 
#define HAL_INTERRUPT_CONFIGURE( _vector_, _level_, _up_ ) /* nothing */
 
#define HAL_INTERRUPT_SET_LEVEL( _vector_, _level_ ) /* nothing */
 
//-----------------------------------------------------------------------------
#endif // ifndef CYGONCE_HAL_XPIC_H
// End of hal_xpic.h
/v2_0/include/hal_diag.h
0,0 → 1,132
#ifndef CYGONCE_HAL_HAL_DIAG_H
#define CYGONCE_HAL_HAL_DIAG_H
 
/*=============================================================================
//
// hal_diag.h
//
// HAL Support for Kernel Diagnostic Routines
//
//=============================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//=============================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): hmt
// Contributors: hmt
// Date: 1999-01-11
// Purpose: HAL Support for Kernel Diagnostic Routines
// Description: Diagnostic routines for use during kernel development.
// Usage: #include <cyg/hal/hal_diag.h>
//
//####DESCRIPTIONEND####
//
//===========================================================================*/
 
#include <pkgconf/hal.h>
 
#include <cyg/infra/cyg_type.h>
 
/*---------------------------------------------------------------------------*/
 
#define CYG_DIAG_USE_LEON
 
/*---------------------------------------------------------------------------*/
 
#ifdef CYG_DIAG_USE_LEON
 
/*---------------------------------------------------------------------------*/
/* Register addresses */
 
#define SPARC_LEON_REG (0x80000000)
 
/* These must be accessed word-wide to work! */
#define SPARC_LEON_UART_IO( x ) ((cyg_uint32)(x))
 
#define SPARC_LEON_UART_A_RX ((volatile cyg_uint32 *)(SPARC_LEON_REG + 0x70))
#define SPARC_LEON_UART_A_TX ((volatile cyg_uint32 *)(SPARC_LEON_REG + 0x70))
#define SPARC_LEON_UART_STATUS ((volatile cyg_uint32 *)(SPARC_LEON_REG + 0x74))
#define SPARC_LEON_UART_RXAMASK (0x00001)
#define SPARC_LEON_UART_TXAMASK (0x00004)
 
/*---------------------------------------------------------------------------*/
 
#define HAL_DIAG_INIT()
 
#define HAL_DIAG_WRITE_CHAR(_c_) \
{ \
if( 1 || _c_ != '\r' ) \
{ \
while( (SPARC_LEON_UART_TXAMASK & *SPARC_LEON_UART_STATUS) == 0 ) \
continue; \
*SPARC_LEON_UART_A_TX = SPARC_LEON_UART_IO(_c_); \
} \
}
 
#define HAL_DIAG_READ_CHAR(_c_) \
{ \
while( (SPARC_LEON_UART_RXAMASK & *SPARC_LEON_UART_STATUS) == 0 ) \
continue; \
_c_ = (char)*SPARC_LEON_UART_A_TX; \
}
 
#define XHAL_DIAG_WRITE_CHAR(_c_) \
{ \
if( _c_ != '\r' ) \
{ \
*SPARC_LEON_UART_A_TX = SPARC_LEON_UART_IO(_c_); \
} \
}
 
#define XHAL_DIAG_READ_CHAR(_c_) \
{ \
_c_ = (char)*SPARC_LEON_UART_A_TX; \
}
 
#else
/*---------------------------------------------------------------------------*/
/* There is no diagnostic output on LEON processor */
 
#define HAL_DIAG_INIT()
 
#define HAL_DIAG_WRITE_CHAR(_c_)
 
#define HAL_DIAG_READ_CHAR(_c_) (_c_) = 0
 
#endif
 
/*---------------------------------------------------------------------------*/
/* end of hal_diag.h */
#endif /* CYGONCE_HAL_HAL_DIAG_H */
/v2_0/ChangeLog
0,0 → 1,54
2002-10-19 Jonathan Larmour <jifl@eCosCentric.com>
 
Patch from Jiri Gaisler:
* cdl/hal_sparc_leon.cdl: -msoft-float needn't be used in local package
since it's defined globally.
* include/hal_diag.h: Fix UART TX mask.
 
2002-03-15 Hugo Tyson <hmt@redhat.com>
 
* cdl/hal_sparc_leon.cdl: Add -msoft-cloat to CYGBLD_GLOBAL_CFLAGS
(as well as LDFLAGS) - this gives perfect test coverage in minimal
build with the sim. NB pro tem the tools are called
sparc-rtems-gcc et al, but sparc-elf-gcc et al should be OK.
 
2002-03-14 Jiri Gaisler <jiri@gaisler.com>
 
* Initial version based on the SPARClite SIM HAL.
 
//===========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//===========================================================================
 
//EOF ChangeLog
/v2_0/src/hal_priv.c
0,0 → 1,102
//===========================================================================
//
// hal_priv.c
//
// SPARC Architecture LEON-specific private variables
//
//===========================================================================
//####ECOSGPLCOPYRIGHTBEGIN####
// -------------------------------------------
// This file is part of eCos, the Embedded Configurable Operating System.
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//===========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): hmt
// Contributors: hmt
// Date: 1999-02-20
// Purpose: private vars for LEON processor.
//
//####DESCRIPTIONEND####
//
//===========================================================================
 
 
#include <cyg/hal/hal_intr.h>
#include <cyg/hal/hal_arch.h>
 
// ------------------------------------------------------------------------
// Clock static to keep period recorded.
cyg_int32 cyg_hal_sparc_clock_period = 0;
 
// ------------------------------------------------------------------------
// Board specific startups.
 
extern void hal_board_prestart( void );
extern void hal_board_poststart( void );
 
void hal_board_prestart( void )
{
}
 
void hal_board_poststart( void )
{
HAL_ENABLE_INTERRUPTS();
// OK to do this post constructors, and good for testing.
}
 
cyg_uint32
hal_lsbit_index(cyg_uint32 mask)
{
int i;
for (i = 0; i < 32; i++) {
if (mask & (1<<i)) return ((cyg_uint32)i);
}
return ((cyg_uint32)-1);
}
 
cyg_uint32
hal_msbit_index(cyg_uint32 mask)
{
int i;
for (i = 31; i >= 0; i--) {
if (mask & (1<<i)) return ((cyg_uint32)i);
}
return ((cyg_uint32)-1);
}
 
void
hal_idle_thread_action(cyg_uint32 loop_count)
{
*((volatile cyg_uint32 *) 0x80000018) = 0;
}
 
// EOF hal_priv.c
/v2_0/support/do-gdb-sim
0,0 → 1,3
#! /bin/csh
tsim-leon -nfp -gdb >& /dev/stdout &
sparc-rtems-gdb -nw -nx $*:q
/v2_0/support/README
0,0 → 1,32
 
LEON/TSIM Support
=================
 
See <http://www.gaisler.com> for information about the TSIM
simulator and Leon project per se.
 
The simulator TSIM can be run "as one" with GDB by using the
script do-gdb-sim in this directory. The script can be used in
automated testing systems to run as if it were embedded within
GDB. It contains:
 
----------------------------------------------------------------
#! /bin/csh
tsim-leon -nfp -gdb >& /dev/stdout &
sparc-rtems-gdb -nw -nx $*:q
----------------------------------------------------------------
 
which simply runs tsim in background, directing its output to the
common stdout.
 
The command to connect to the simulator target will be
 
(gdb) target remote localhost:1234
 
This fully described in the TSIM documentation from
(home) <http://www.gaisler.com/tsim.html>
(flyer) <http://www.gaisler.com/doc/tsim-erc32.pdf>
(doc) <http://www.gaisler.com/doc/tsim-1.0.18.pdf>
 
 
 

powered by: WebSVN 2.1.0

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