diff options
author | Michael Gielda <mgielda@antmicro.com> | 2014-04-03 14:53:04 +0200 |
---|---|---|
committer | Michael Gielda <mgielda@antmicro.com> | 2014-04-03 14:53:04 +0200 |
commit | ae1e4e08a1005a0c487f03ba189d7536e7fdcba6 (patch) | |
tree | f1c296f8a966a9a39876b0e98e16d9c5da1776dd /ecos/packages/hal/h8300 | |
parent | f157da5337118d3c5cd464266796de4262ac9dbd (diff) |
Added the OS files
Diffstat (limited to 'ecos/packages/hal/h8300')
131 files changed, 13799 insertions, 0 deletions
diff --git a/ecos/packages/hal/h8300/aki3068net/current/ChangeLog b/ecos/packages/hal/h8300/aki3068net/current/ChangeLog new file mode 100644 index 0000000..36c9df7 --- /dev/null +++ b/ecos/packages/hal/h8300/aki3068net/current/ChangeLog @@ -0,0 +1,124 @@ +2009-01-31 Bart Veer <bartv@ecoscentric.com> + + * cdl/hal_h8300_h8300h_aki3068net.cdl: update compiler flags for gcc 4.x + +2004-03-17 Yoshinori Sato <ysato@users.sourceforge.jp> + + * include/hal_diag.h + fix warning. + +2004-03-02 Yoshinori Sato <ysato@users.sourceforge.jp> + + * include/platform.inc + add h8300_save_vectors macro. + +2004-02-24 Yoshinori Sato <ysato@users.sourceforge.jp> + + * cdl/hal_h8300_h8300h_aki3068net.cdl + add Linker flags "-mrelax" + move CYGSEM_HAL_H8300_VECTOR_HOOK to hal_h8300.cdl + +2004-01-16 Yoichi Koyanagi <yk@tinywillow.com>,Yoshinori Sato <ysato@users.sourceforge.jp> + + * src/plf_ide.c + HAL_IDE_INIT return to enumerate controlers. + aki3068net_read_command fix 16bit mode access. + +2003-12-26 Yoichi Koyanagi <yk@tinywillow.com>,Yoshinori Sato <ysato@users.sourceforge.jp> + + * src/plf_ide.c + 16bit bus mode fix. + +2003-12-04 Yoshinori Sato <ysato@users.sourceforge.jp> + * include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.ldi + fix vector location from CYGSEM_HAL_H8300_VECTOR_HOOK == 0 + +2003-07-18 Nick Garnett <nickg@balti.calivar.com> + + * cdl/hal_h8300_h8300h_aki3068net.cdl: + Changed values for CYGNUM_HAL_RTC_NUMERATOR, + CYGNUM_HAL_RTC_DENOMINATOR and CYGNUM_HAL_RTC_PERIOD to + "default_value" from "calculated". This makes it easier + to change these values globally. + +2003-03-09 Yoshinori Sato <ysato@users.sourceforge.jp> + + * cdl/hal_h8300_h8300h_aki3068net.cdl + * src/hal_diag.c + CYGHAL_PLF_SCI_BASE add. + +2003-02-28 Yoshinori Sato <ysato@users.sourceforge.jp> + + * cdl/hal_h8300_h8300h_aki3068net.cdl + * src/plf_ide.c + * include/plf_io.h + * include/platform.inc + IDE I/F Support. + +2003-01-29 Yoshinori Sato <ysato@users.sourceforge.jp> + + * include/platform.inc + DRAM setup delay fix. + +2002-11-26 Yoshinori Sato <ysato@users.sourceforge.jp> + + * include/platform.inc + Buscontroler setting tuneing. + * cdl/hal_h8300_h8300h_aki3068net.cdl + CYGBLD_GLOBAL_LDFLAGS option "-mint32" add. + * include/plf_intr.h + delay_us scale fix. + * src/delay_us.S + timing tune. + +2002-10-15 Yoshinori Sato <ysato@users.sourceforge.jp> + + * include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.ldi + typo fixed. + +2002-10-15 Yoshinori Sato <ysato@users.sourceforge.jp> + + * cdl/hal_h8300_h8300h_aki3068net.cdl + CYGSEM_HAL_H8300_VECTOR_HOOK,CYGHWR_HAL_H8300_VECTOR_ADDRESS add. + * include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.cdl + typo fixed. + +2002-05-31 Yoshinori Sato <ysato@users.sourceforge.jp> + + * src/hal_diag.c + delete hal_delay_us function. + +2002-04-29 Jonathan Larmour <jlarmour@redhat.com> + + * src/delay_us.S: + Don't use .file as it can confuse debugging since the .file + doesn't contain the path and therefore the debugger will never + know where it lives! This conflicts with using -Wa,--gstabs. + +2002-04-24 Yoshinori Sato <qzb04471@nifty.ne.jp> + + * New package. + +//=========================================================================== +// ####GPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +// +// This program 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. +// +// This program 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 this program; if not, write to the +// Free Software Foundation, Inc., 51 Franklin Street, +// Fifth Floor, Boston, MA 02110-1301, USA. +// ------------------------------------------- +// ####GPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/ecos/packages/hal/h8300/aki3068net/current/cdl/hal_h8300_h8300h_aki3068net.cdl b/ecos/packages/hal/h8300/aki3068net/current/cdl/hal_h8300_h8300h_aki3068net.cdl new file mode 100644 index 0000000..9a421d9 --- /dev/null +++ b/ecos/packages/hal/h8300/aki3068net/current/cdl/hal_h8300_h8300h_aki3068net.cdl @@ -0,0 +1,333 @@ +# ==================================================================== +# +# hal_h8300_h8300h_sim.cdl +# +# AKI3068NET board HAL package configuration data +# +# ==================================================================== +## ####ECOSGPLCOPYRIGHTBEGIN#### +## ------------------------------------------- +## This file is part of eCos, the Embedded Configurable Operating System. +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +## +## This exception does not invalidate any other reasons why a work based +## on this file might be covered by the GNU General Public License. +## ------------------------------------------- +## ####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): yoshinori sato +# Original data: bartv +# Contributors: yoshinori sato +# Date: 2002-04-10 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_H8300_H8300H_AKI3068NET { + display "AKI3068NET" + parent CYGPKG_HAL_H8300 + requires CYGPKG_HAL_H8300_H8300H + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + define_header hal_h8300_h8300h_aki3068net.h + include_dir cyg/hal + description " + The aki HAL package provides the support needed to run + eCos on a Akizuki H8/3068 Network micom board." + + compile hal_diag.c plf_misc.c delay_us.S plf_ide.c + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H <pkgconf/hal_h8300_h8300h.h>" + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H <pkgconf/hal_h8300_h8300h_aki3068net.h>" + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_IO_H <cyg/hal/plf_io.h>" + + puts $::cdl_header "#define CYG_HAL_H8300" + puts $::cdl_header "#define CYGNUM_HAL_H8300_SCI_PORTS 1" + puts $::cdl_header "#define CYGHWR_HAL_VECTOR_TABLE 0xfffe20" + puts $::cdl_header "#define HAL_PLATFORM_CPU \"H8/300H\"" + puts $::cdl_header "#define HAL_PLATFORM_BOARD \"Akizuki H8/3068 Network micom\"" + puts $::cdl_header "#define HAL_PLATFORM_EXTRA \"\"" + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + legal_values {"ROM" "RAM"} + default_value {"ROM"} + no_define + define -file system.h CYG_HAL_STARTUP + description " + When targetting the AKI3068NET board it is possible to + build the system for either RAM bootstrap or ROM bootstrap. + RAM bootstrap generally requires that the board + is equipped with ROMs containing a suitable ROM monitor or + equivalent software that allows GDB to download the eCos + application and extend Memory on to the board. + The ROM bootstrap typically + requires that the eCos application be blown into EPROMs or + equivalent technology." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 1 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The AKI3068NET board has only one serial port. This option + chooses which port will be used to connect to a host + running GDB." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The CQ/7708 board has only one serial port. This option + chooses which port will be used for diagnostic output." + } + + # 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 + default_value 1000000000 + } + cdl_option CYGNUM_HAL_RTC_DENOMINATOR { + display "Real-time clock denominator" + flavor data + default_value 100 + } + cdl_option CYGNUM_HAL_H8300_RTC_PRESCALE { + display "Real-time clock base prescale" + flavor data + calculated 8192 + } + # Isn't a nice way to handle freq requirement! + cdl_option CYGNUM_HAL_RTC_PERIOD { + display "Real-time clock period" + flavor data + default_value 10 + } + } + + cdl_option CYGHWR_HAL_H8300_CPG_INPUT { + display "OSC/Clock Freqency" + flavor data + default_value 20000000 + } + + cdl_option CYGHWR_HAL_AKI3068NET_EXTRAM { + display "Extend DRAM Using" + flavor bool + default_value 1 + } + + cdl_option CYGHWR_HAL_AKI3068NET_IDE { + display "IDE I/F expand" + flavor bool + default_value 0 + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + parent CYGPKG_NONE + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "h8300-elf" } + 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 { CYGBLD_GLOBAL_WARNFLAGS . " -g -O2 -mh -mint32 -fsigned-char -fdata-sections -fno-rtti -fno-exceptions " } + 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 { "-g -nostdlib -Wl,--gc-sections -Wl,-static -mrelax -mh -mint32" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + cdl_option CYGBLD_BUILD_GDB_STUBS { + display "Build GDB stub ROM image" + default_value 0 + requires CYGSEM_HAL_ROM_MONITOR + requires CYGBLD_BUILD_COMMON_GDB_STUBS + requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + requires CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + requires CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT + no_define + description " + This option enables the building of the GDB stubs for the + board. The common HAL controls takes care of most of the + build process, but the final conversion from ELF image to + binary data is handled by the platform CDL, allowing + relocation of the data if necessary." + + make -priority 320 { + <PREFIX>/bin/gdb_module.bin : <PREFIX>/bin/gdb_module.img + $(OBJCOPY) -O binary $< $@ + } + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { CYG_HAL_STARTUP == "RAM" ? "h8300_h8300h_aki3068net_ram" : \ + "h8300_h8300h_aki3068net_rom" } + + 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 { CYG_HAL_STARTUP == "RAM" ? "<pkgconf/mlt_h8300_h8300h_aki3068net_ram.ldi>" : \ + "<pkgconf/mlt_h8300_h8300h_aki3068net_rom.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 { CYG_HAL_STARTUP == "RAM" ? "<pkgconf/mlt_h8300_h8300h_aki3068net_ram.h>" : \ + "<pkgconf/mlt_h8300_h8300h_aki3068net_rom.h>" } + } + } + + cdl_component CYGHWR_AKI3068NET_IDE_OPTIONS { + display "IDE Expand Setting" + flavor none + parent CYGPKG_NONE + active_if CYGHWR_HAL_AKI3068NET_IDE + implements CYGINT_HAL_PLF_IF_IDE + description " + IDE Expand Hardware Setting." + + cdl_option CYGHWR_HAL_IDE_REGISTER { + display "IDE Register base address" + flavor data + default_value 0x600000 + } + + cdl_option CYGHWR_HAL_IDE_ALT_REGS { + display "IDE AlternateRegister base address" + flavor data + default_value 0x600020 + } + + cdl_option CYGHWR_HAL_IDE_BUSWIDTH { + display "IDE bus width" + flavor data + legal_values {8 16} + default_value 8 + } + } + + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 0 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM" } + description " + Enable this option if this program is to be used as a ROM monitor, + i.e. applications will be loaded into RAM on the board, and this + ROM monitor may process exceptions or interrupts generated from the + application. This enables features such as utilizing a separate + interrupt stack when exceptions are generated." + } + cdl_option CYGHWR_HAL_H8300_VECTOR_ADDRESS { + display "Hook Vector Address" + flavor data + default_value 0xfffd20 + active_if CYGSEM_HAL_H8300_VECTOR_HOOK + parent CYGPKG_HAL_ROM_MONITOR + description " + Hooking Vector Table Address" + } + cdl_option CYGHAL_PLF_SCI_BASE { + display "SCI Base address" + flavor data + default_value 0xffffb8 + description " + Used SCI Channel base address." + } + cdl_option CYGDAT_REDBOOT_H8300_LINUX_COMMAND_START { + display "Default kernel command line start address" + flavor data + default_value 0x5ffe00 + description " + This option uClinux kernel command line start address of default." + } + + cdl_option CYGDAT_REDBOOT_H8300_LINUX_BOOT_COMMAND_LINE { + display "Default command line" + flavor data + default_value { "console=/dev/ttySC1" } + description " + This option uClinux kernel startup command line of default." + } +} diff --git a/ecos/packages/hal/h8300/aki3068net/current/doc/README b/ecos/packages/hal/h8300/aki3068net/current/doc/README new file mode 100644 index 0000000..911bdf8 --- /dev/null +++ b/ecos/packages/hal/h8300/aki3068net/current/doc/README @@ -0,0 +1,2 @@ +Please visit http://homepage2.nifty.com/ysato/eCos/index.en.html for up to date +information, particularly on which GNU tools to use and patches. diff --git a/ecos/packages/hal/h8300/aki3068net/current/include/hal_diag.h b/ecos/packages/hal/h8300/aki3068net/current/include/hal_diag.h new file mode 100644 index 0000000..ae7dd99 --- /dev/null +++ b/ecos/packages/hal/h8300/aki3068net/current/include/hal_diag.h @@ -0,0 +1,79 @@ +#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 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-04-06 +// 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> + +externC void hal_diag_init(void); +externC void hal_diag_write_char(cyg_uint8 c); +externC void hal_diag_read_char(cyg_uint8 *c); + +/*---------------------------------------------------------------------------*/ + +#define HAL_DIAG_INIT() hal_diag_init() + +#define HAL_DIAG_WRITE_CHAR(_c_) hal_diag_write_char(_c_) + +#define HAL_DIAG_READ_CHAR(_c_) hal_diag_read_char(&_c_) + +//----------------------------------------------------------------------------- +// Simple LED control. +externC void hal_diag_led_on( void ); +externC void hal_diag_led_off( void ); + +/*---------------------------------------------------------------------------*/ +/* end of hal_diag.h */ +#endif /* CYGONCE_HAL_HAL_DIAG_H */ diff --git a/ecos/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.h b/ecos/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.h new file mode 100644 index 0000000..fbd3d37 --- /dev/null +++ b/ecos/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.h @@ -0,0 +1,14 @@ +// eCos memory layout - Wed Nov 24 13:10:23 1999 + +// This is a generated file - changes will be lost if ConfigTool(MLT) is run + +#ifndef __ASSEMBLER__ +#include <cyg/infra/cyg_type.h> +#include <stddef.h> + +#endif + +#define CYGMEM_REGION_ram (0x420000) +#define CYGMEM_REGION_ram_SIZE (0x1E0000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) + diff --git a/ecos/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.ldi b/ecos/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.ldi new file mode 100644 index 0000000..5f31940 --- /dev/null +++ b/ecos/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.ldi @@ -0,0 +1,29 @@ +// eCos memory layout - Fri Oct 20 08:25:16 2000 + +// This is a generated file - do not edit + +#include <cyg/infra/cyg_type.inc> + +OUTPUT_FORMAT("elf32-h8300") +OUTPUT_ARCH(h8300h) + +MEMORY +{ + ram : ORIGIN = 0x400000, LENGTH = 0x28000 + iram : ORIGIN = 0xffbf20, LENGTH = 0x4000-0x100 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_text (ram, 0x400000, 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 (0x4),LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4),LMA_EQ_VMA) + SECTION_int_hook_table (iram, CYGHWR_HAL_H8300_VECTOR_ADDRESS, FOLLOWING (.data)) + SECTIONS_END +} diff --git a/ecos/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.mlt b/ecos/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.mlt new file mode 100644 index 0000000..09e5f2b --- /dev/null +++ b/ecos/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.mlt @@ -0,0 +1,12 @@ +version 0 +region ram 400000 28000 0 ! +section text 0 1 0 1 0 1 0 1 400000 400000 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 int_fook_table int_hook_table ! +section int_fook_table 0 1 0 1 0 1 0 1 data data ! +section data 0 4 0 1 0 1 0 1 bss bss ! +section bss 0 4 0 1 0 1 0 0 ! + diff --git a/ecos/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.h b/ecos/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.h new file mode 100644 index 0000000..3b12905 --- /dev/null +++ b/ecos/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.h @@ -0,0 +1,18 @@ +// eCos memory layout - Wed Nov 24 13:10:23 1999 + +// This is a generated file - changes will be lost if ConfigTool(MLT) is run + +#ifndef __ASSEMBLER__ +#include <cyg/infra/cyg_type.h> +#include <stddef.h> + +#endif + +#define CYGMEM_REGION_ram (0x400000) +#if !defined(CYGPKG_IO_ETH_DRIVERS) +#define CYGMEM_REGION_ram_SIZE (0x200000) +#else +#define CYGMEM_REGION_ram_SIZE (0x200000-0xC000) +#endif +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) + diff --git a/ecos/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.ldi b/ecos/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.ldi new file mode 100644 index 0000000..d5c11e4 --- /dev/null +++ b/ecos/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.ldi @@ -0,0 +1,49 @@ +// eCos memory layout - Fri Oct 20 08:25:16 2000 + +// This is a generated file - do not edit + +#include <cyg/infra/cyg_type.inc> + +OUTPUT_FORMAT("elf32-h8300") +OUTPUT_ARCH(h8300h) + +MEMORY +{ +#define IRAM_TOP 0xffbf20 + rom : ORIGIN = 0x000000, LENGTH = 0x60000 +#if !defined(CYGPKG_IO_ETH_DRIVERS) +#define WORK (IRAM_TOP+0x100) + ram : ORIGIN = WORK, LENGTH = 0x4000-0x100 +#else +#define WORK 0x5f4000 + ram : ORIGIN = WORK, LENGTH = 0xC000 + iram : ORIGIN = IRAM_TOP, LENGTH = 0x4000-0x100 +#endif +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (rom, 0x000000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x1), LMA_EQ_VMA) +#if !defined(CYGSEM_HAL_H8300_VECTOR_HOOK) + SECTION_int_hook_table (rom, ALIGN (0x2), LMA_EQ_VMA) +#endif + SECTION_gcc_except_table (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_data (ram, WORK, FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) +#if defined(CYGSEM_HAL_H8300_VECTOR_HOOK) +#if !defined(CYGPKG_IO_ETH_DRIVERS) + SECTION_int_hook_table (ram, CYGHWR_HAL_H8300_VECTOR_ADDRESS, LMA_EQ_VMA) +#else + SECTION_int_hook_table (iram, CYGHWR_HAL_H8300_VECTOR_ADDRESS, LMA_EQ_VMA) +#endif +#endif + SECTIONS_END +} + +#undef WORK diff --git a/ecos/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.mlt b/ecos/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.mlt new file mode 100644 index 0000000..ebd5c38 --- /dev/null +++ b/ecos/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.mlt @@ -0,0 +1,12 @@ +version 0 +region ram ffbf20 ffff20 0 ! +section rom_vectors 0 1 0 1 1 1 1 1 0 60000 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 4 0 1 0 1 0 1 bss bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! diff --git a/ecos/packages/hal/h8300/aki3068net/current/include/platform.inc b/ecos/packages/hal/h8300/aki3068net/current/include/platform.inc new file mode 100644 index 0000000..5e1d42e --- /dev/null +++ b/ecos/packages/hal/h8300/aki3068net/current/include/platform.inc @@ -0,0 +1,156 @@ +#ifndef CYGONCE_HAL_PLATFORM_INC +#define CYGONCE_HAL_PLATFORM_INC +##============================================================================= +## +## platform.inc +## +## AKI3068NET "board" assembler header file +## +##============================================================================= +## ####ECOSGPLCOPYRIGHTBEGIN#### +## ------------------------------------------- +## This file is part of eCos, the Embedded Configurable Operating System. +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +## +## This exception does not invalidate any other reasons why a work based +## on this file might be covered by the GNU General Public License. +## ------------------------------------------- +## ####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): Yoshinori Saro +## Contributors: Yoshinori Sato +## Date: 2002-04-06 +## Purpose: AKI3068NET "board" definitions. +## Description: This file contains various definitions and macros that are +## required for writing assembly code for the AKI3068NET board +## Currently there are none +## Usage: +## #include <cyg/hal/platform.inc> +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include <pkgconf/hal.h> + +#include <cyg/hal/mod_regs_bsc.h> +#include <cyg/hal/mod_regs_pio.h> + +##----------------------------------------------------------------------------- + +#if (CYGINT_HAL_PLF_IF_IDE != 0 && (CYGHWR_HAL_IDE_BUSWIDTH == 16)) +#define ABWCR_VAL ~((1 << ((CYGHWR_HAL_IDE_REGISTER >> 21) & 7)) |\ + (1 << ((CYGHWR_HAL_IDE_ALT_REGS >> 21) & 7))) +#else +#define ABWCR_VAL 0xff +#endif +#if (CYGINT_HAL_PLF_IF_IDE != 0) +#define CSCR_VAL ((1 << ((CYGHWR_HAL_IDE_REGISTER >> 21) & 7)) |\ + (1 << ((CYGHWR_HAL_IDE_ALT_REGS >> 21) & 7))) +#endif + +#define CYGPKG_HAL_H8300_MEMC_DEFINED + .macro hal_memc_init +#if defined(CYG_HAL_STARTUP_ROM) + mov.l #init_regs,er0 +1: + mov.w @er0+,r2 + beq 1f + mov.w #0x00ff,e2 ; internal I/O regs (2) high address + cmp.w #0xf000,r2 + bhi 2f + dec.w #1,e2 ; internal I/O regs (1) high address +2: + mov.w @er0+,r1 + mov.b r1l,@er2 + bra 1b + +#define INIT_REGS_DATA(REGS,DATA) \ + .word (REGS & 0xffff),DATA + +init_regs: +INIT_REGS_DATA(CYGARC_RTCOR,9) +INIT_REGS_DATA(CYGARC_RTMCSR,0x30) +INIT_REGS_DATA(CYGARC_DRCRB,0x98) +INIT_REGS_DATA(CYGARC_DRCRA,0x38) +INIT_REGS_DATA(CYGARC_ASTCR,0xfb) +INIT_REGS_DATA(CYGARC_ABWCR,ABWCR_VAL) +#if defined(CSCR_VAL) +INIT_REGS_DATA(CYGARC_CSCR,((CSCR_VAL) & 0xf0) | 0x0f) +#endif +INIT_REGS_DATA(CYGARC_WCRH ,0xff) +INIT_REGS_DATA(CYGARC_WCRL ,0xc8) +INIT_REGS_DATA(CYGARC_P1DDR,0xff) +INIT_REGS_DATA(CYGARC_P2DDR,0xff) +INIT_REGS_DATA(CYGARC_P5DDR,0x01) +INIT_REGS_DATA(CYGARC_P8DDR,0x0e) + .word 0 +init_regs_end: +;; Thanks Hiroyuki Senshu & Hiroki Minematsu + +;; External peripheral setup delay +1: + mov.l #420000,er0 ;wait 50ms +2: + dec.l #1,er0 + bpl 2b +#endif + .endm + +#define CYGPKG_HAL_H8300_DIAG_DEFINED + + .macro hal_diag_init + mov.b #0x83,r0l + mov.b r0l,@CYGARC_PADDR + mov.b #0,r0l + mov.b r0l,@CYGARC_PADR + .endm + + .macro hal_diag_excpt_start + .endm + + .macro hal_diag_intr_start + .endm + + .macro hal_diag_restore + .endm + + .macro hal_diag_data + .endm + +#if defined(CYGPKG_IO_ETH_DRIVERS) +#define CYGPKG_HAL_H8300_SAVED_VECTORS + .macro h8300_save_vectors + .byte 15 + .endm +#endif + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_PLATFORM_INC +# end of platform.inc diff --git a/ecos/packages/hal/h8300/aki3068net/current/include/plf_intr.h b/ecos/packages/hal/h8300/aki3068net/current/include/plf_intr.h new file mode 100644 index 0000000..ce5e063 --- /dev/null +++ b/ecos/packages/hal/h8300/aki3068net/current/include/plf_intr.h @@ -0,0 +1,75 @@ +#ifndef CYGONCE_HAL_PLF_INTR_H +#define CYGONCE_HAL_PLF_INTR_H + +//========================================================================== +// +// plf_intr.h +// +// AKI3068NET board interrupt and clock support +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): ysato +// Contributors: ysato +// Date: 2002-04-06 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock for the simulator. This file +// is empty since none are required! +// +// Usage: +// #include <cyg/hal/plf_intr.h> +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + + +//-------------------------------------------------------------------------- + +externC void h8300h_reset (void); +externC void hal_delay_us(int usecs); + +#define HAL_PLATFORM_RESET(x) +#define HAL_PLATFORM_RESET_ENTRY &h8300h_reset + +#define HAL_DELAY_US(n) hal_delay_us((n)) + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_PLF_INTR_H +// End of plf_intr.h diff --git a/ecos/packages/hal/h8300/aki3068net/current/include/plf_io.h b/ecos/packages/hal/h8300/aki3068net/current/include/plf_io.h new file mode 100644 index 0000000..a300a38 --- /dev/null +++ b/ecos/packages/hal/h8300/aki3068net/current/include/plf_io.h @@ -0,0 +1,90 @@ +#ifndef CYGONCE_HAL_PLF_IO_H +#define CYGONCE_HAL_PLF_IO_H + +//============================================================================= +// +// plf_io.h +// +// platform specific IO support +// +//============================================================================= +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): ysato +// Contributors: ysato +// Date: 2003-02-28 +// Purpose: aki3068net + CF IO support +// Description: The macros defined here provide the HAL APIs for handling +// basic IO +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include <pkgconf/system.h> + +//----------------------------------------------------------------------------- +// IDE interface macros +// +#define HAL_IDE_NUM_CONTROLLERS 1 + +// Initialize the IDE controller(s). +#define HAL_IDE_INIT() aki3068net_ide_setup() + +#define HAL_IDE_READ_UINT8( __ctlr, __regno, __val ) \ + aki3068net_read_command(__regno, &(__val)) +#define HAL_IDE_READ_UINT16( __ctlr, __regno, __val ) \ + aki3068net_read_data(__regno, &(__val)) +#define HAL_IDE_READ_ALTSTATUS( __ctlr, __val ) \ + aki3068net_read_control( &(__val)) + +#define HAL_IDE_WRITE_UINT8( __ctlr, __regno, __val ) \ + aki3068net_write_command(__regno, __val) +#define HAL_IDE_WRITE_UINT16( __ctlr, __regno, __val ) \ + aki3068net_write_data(__regno, __val) +#define HAL_IDE_WRITE_CONTROL( __ctlr, __val ) \ + aki3068net_write_control( __val) + +void aki3068net_read_command(cyg_uint16 r, cyg_uint8 *d); +void aki3068net_read_data (cyg_uint16 r, cyg_uint16 *d); +void aki3068net_read_control(cyg_uint8 *d); + +void aki3068net_write_command(cyg_uint16 r, cyg_uint8 d); +void aki3068net_write_data (cyg_uint16 r, cyg_uint16 d); +void aki3068net_write_control(cyg_uint8 d); + +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_PLF_IO_H +// end of plf_io.h diff --git a/ecos/packages/hal/h8300/aki3068net/current/include/plf_stub.h b/ecos/packages/hal/h8300/aki3068net/current/include/plf_stub.h new file mode 100644 index 0000000..295c219 --- /dev/null +++ b/ecos/packages/hal/h8300/aki3068net/current/include/plf_stub.h @@ -0,0 +1,89 @@ +#ifndef CYGONCE_HAL_PLF_STUB_H +#define CYGONCE_HAL_PLF_STUB_H + +//============================================================================= +// +// plf_stub.h +// +// Platform header for GDB stub support. +// +//============================================================================= +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 1999-05-18 +// Purpose: Platform HAL stub support for H8/300H simulator +// Usage: #include <cyg/hal/plf_stub.h> +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include <pkgconf/system.h> +#include <pkgconf/hal.h> + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include <cyg/infra/cyg_type.h> // CYG_UNUSED_PARAM, externC + +#include <cyg/hal/h8300_stub.h> // architecture stub support + +#include <cyg/hal/hal_diag.h> // hal_diag_led_on + +//---------------------------------------------------------------------------- +// Define some platform specific communication details. This is mostly +// handled by hal_if now, but we need to make sure the comms tables are +// properly initialized. + +externC void cyg_hal_plf_comms_init(void); + +#define HAL_STUB_PLATFORM_INIT_SERIAL() cyg_hal_plf_comms_init() + +#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) CYG_UNUSED_PARAM(int, (baud)) +#define HAL_STUB_PLATFORM_INTERRUPTIBLE 0 + +//---------------------------------------------------------------------------- +// Stub initializer. +#ifdef CYGSEM_HAL_ROM_MONITOR +# define HAL_STUB_PLATFORM_INIT() hal_diag_led_on() +#else +# define HAL_STUB_PLATFORM_INIT() CYG_EMPTY_STATEMENT +#endif + +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_PLF_STUB_H +// End of plf_stub.h diff --git a/ecos/packages/hal/h8300/aki3068net/current/src/delay_us.S b/ecos/packages/hal/h8300/aki3068net/current/src/delay_us.S new file mode 100644 index 0000000..6afdb24 --- /dev/null +++ b/ecos/packages/hal/h8300/aki3068net/current/src/delay_us.S @@ -0,0 +1,25 @@ +;;delay_us + +#include <pkgconf/hal.h> + +#include <cyg/hal/arch.inc> +#include <cyg/hal/basetype.h> +#include <cyg/hal/mod_regs_tmr.h> + +#define DELAY_COUNT (CYGHWR_HAL_H8300_PROCESSOR_SPEED/1000000)*16/8 + +// .file "delay_us.S" + .h8300h + .text + + .global CYG_LABEL_DEFN(hal_delay_us) +CYG_LABEL_DEFN(hal_delay_us): + shlr.l er0 + mov.l er0,er0 +1: + ble 4f + dec.l #1,er0 + bra 1b +4: + rts + diff --git a/ecos/packages/hal/h8300/aki3068net/current/src/hal_diag.c b/ecos/packages/hal/h8300/aki3068net/current/src/hal_diag.c new file mode 100644 index 0000000..2bfb646 --- /dev/null +++ b/ecos/packages/hal/h8300/aki3068net/current/src/hal_diag.c @@ -0,0 +1,186 @@ +/*============================================================================= +// +// hal_diag.c +// +// HAL diagnostic output code +// +//============================================================================= +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): ysato +// Contributors: ysato +// Date: 2002-04-05 +// Purpose: HAL diagnostic output +// Description: Implementations of HAL diagnostic output support. +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include <pkgconf/hal.h> + +#include <cyg/hal/hal_diag.h> +#include <cyg/hal/h8_sci.h> +#include <cyg/hal/var_intr.h> +#include <cyg/hal/hal_intr.h> +#include <cyg/hal/hal_misc.h> + +#define SCI_BASE ((cyg_uint8*)CYGHAL_PLF_SCI_BASE) + +static channel_data_t channel = { (cyg_uint8*)SCI_BASE, 0, 0}; + +void +cyg_hal_plf_comms_init(void) +{ + static int initialized = 0; + + if (initialized) + return; + + initialized = 1; + + cyg_hal_plf_sci_init(0, 0, CYGNUM_HAL_INTERRUPT_RXI1, SCI_BASE); +} + +//============================================================================= +// Led control +//============================================================================= +#define LED CYGARC_PADR + +void +hal_diag_led_on( void ) +{ + HAL_WRITE_UINT8(LED, 0x01); +} + +void +hal_diag_led_off( void ) +{ + HAL_WRITE_UINT8(LED, 0); +} + +//============================================================================= +// Compatibility with older stubs +//============================================================================= + +#if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) +#include <cyg/hal/hal_stub.h> // hal_output_gdb_string +#endif + +void hal_diag_init(void) +{ + cyg_hal_plf_sci_init_channel(&channel); +} + +void +hal_diag_write_char( cyg_uint8 c ) +{ +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + static char line[100]; + static int pos = 0; + + // No need to send CRs + if( c == '\r' ) return; + + line[pos++] = c; + + if( c == '\n' || pos == sizeof(line) ) + { + CYG_INTERRUPT_STATE old; + + // Disable interrupts. This prevents GDB trying to interrupt us + // while we are in the middle of sending a packet. The serial + // receive interrupt will be seen when we re-enable interrupts + // later. + + CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION(old); + + while(1) + { + char c1; + static char hex[] = "0123456789ABCDEF"; + cyg_uint8 csum = 0; + int i; + + cyg_hal_plf_sci_putc(&channel, '$'); + cyg_hal_plf_sci_putc(&channel, 'O'); + csum += 'O'; + for( i = 0; i < pos; i++ ) + { + char ch = line[i]; + char h = hex[(ch>>4)&0xF]; + char l = hex[ch&0xF]; + cyg_hal_plf_sci_putc(&channel, h); + cyg_hal_plf_sci_putc(&channel, l); + csum += h; + csum += l; + } + cyg_hal_plf_sci_putc(&channel, '#'); + cyg_hal_plf_sci_putc(&channel, hex[(csum>>4)&0xF]); + cyg_hal_plf_sci_putc(&channel, hex[csum&0xF]); + + // Wait for the ACK character '+' from GDB here and handle + // receiving a ^C instead. + c1 = (char) cyg_hal_plf_sci_getc(&channel); + + if( c1 == '+' ) + break; // a good acknowledge + + // Check for user break. + if( cyg_hal_is_break( &c1, 1 ) ) + cyg_hal_user_break( NULL ); + + // otherwise, loop round again + } + + pos = 0; + + // And re-enable interrupts + CYG_HAL_GDB_LEAVE_CRITICAL_IO_REGION(old); + } +#else // CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + cyg_hal_plf_sci_putc(&channel, c); +#endif +} + +void +hal_diag_read_char(cyg_uint8 *c) +{ + *c = (char) cyg_hal_plf_sci_getc(&channel); +} + +/*===========================================================================*/ +/* EOF hal_diag.c */ + diff --git a/ecos/packages/hal/h8300/aki3068net/current/src/plf_ide.c b/ecos/packages/hal/h8300/aki3068net/current/src/plf_ide.c new file mode 100644 index 0000000..b0e060e --- /dev/null +++ b/ecos/packages/hal/h8300/aki3068net/current/src/plf_ide.c @@ -0,0 +1,138 @@ +//========================================================================== +// +// plf_ide.c +// +// HAL platform IDE support function +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): ysato +// Contributors: ysato +// Date: 2003-02-28 +// Purpose: HAL IDE support function +// Description: This file contains IDE support functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include <pkgconf/hal.h> + +#include <cyg/infra/cyg_type.h> // Base types + +#include <cyg/hal/hal_arch.h> // architectural definitions +#include <cyg/hal/hal_io.h> +#include <cyg/hal/hal_if.h> +#include <cyg/hal/hal_endian.h> +#include <cyg/hal/plf_intr.h> +#include <cyg/hal/var_arch.h> + +/*------------------------------------------------------------------------*/ + +#if CYGINT_HAL_PLF_IF_IDE != 0 + +#define IDE_REG_FEATUERS 1 +#define IDE_REG_COMMAND 7 + +int aki3068net_ide_setup(void) +{ +#if CYGHWR_HAL_IDE_BUSWIDTH == 8 + aki3068net_write_command(IDE_REG_FEATUERS,0x01); /* 8bit transfer mode */ + aki3068net_write_command(IDE_REG_COMMAND, 0xef); /* set featuers */ +#endif + return HAL_IDE_NUM_CONTROLLERS; +} + +void aki3068net_read_command(cyg_uint16 r, cyg_uint8 *d) +{ +#if CYGHWR_HAL_IDE_BUSWIDTH == 8 + *d = *(volatile cyg_uint8 *)(CYGHWR_HAL_IDE_REGISTER + r); +#else + *d = *(volatile cyg_uint8 *)(CYGHWR_HAL_IDE_REGISTER + (r << 1) + 1); +#endif +} + +void aki3068net_read_data (cyg_uint16 r, cyg_uint16 *d) +{ +#if CYGHWR_HAL_IDE_BUSWIDTH == 8 + *d = *(volatile cyg_uint16 *)(CYGHWR_HAL_IDE_REGISTER + r); +#else + cyg_uint16 dt; + dt = *(volatile cyg_uint16 *)(CYGHWR_HAL_IDE_REGISTER + (r << 1)); + *d = CYG_LE16_TO_CPU(dt); +#endif +} + +void aki3068net_read_control(cyg_uint8 *d) +{ +#if CYGHWR_HAL_IDE_BUSWIDTH == 8 + *d = *(volatile cyg_uint8 *)(CYGHWR_HAL_IDE_ALT_REGS + 6); +#else + *d = *(volatile cyg_uint8 *)(CYGHWR_HAL_IDE_ALT_REGS + 12 + 1); +#endif +} + +void aki3068net_write_command(cyg_uint16 r, cyg_uint8 d) +{ +#if CYGHWR_HAL_IDE_BUSWIDTH == 8 + *(volatile cyg_uint8 *)(CYGHWR_HAL_IDE_REGISTER + r) = d; +#else + *(volatile cyg_uint16 *)(CYGHWR_HAL_IDE_REGISTER + (r << 1)) = d; +#endif +} + +void aki3068net_write_data (cyg_uint16 r, cyg_uint16 d) +{ +#if CYGHWR_HAL_IDE_BUSWIDTH == 8 + *(volatile cyg_uint8 *)(CYGHWR_HAL_IDE_REGISTER + r) = d; +#else + *(volatile CYG_WORD16 *)(CYGHWR_HAL_IDE_REGISTER + (r <<1)) = CYG_CPU_TO_LE16(d); +#endif +} + +void aki3068net_write_control(cyg_uint8 d) +{ +#if CYGHWR_HAL_IDE_BUSWIDTH == 8 + *(volatile cyg_uint8 *)(CYGHWR_HAL_IDE_ALT_REGS + 6) = d; +#else + *(volatile cyg_uint16 *)(CYGHWR_HAL_IDE_ALT_REGS + 12) = d; +#endif +} + +#endif //CYGINT_HAL_PLF_IF_IDE != 0 +/*------------------------------------------------------------------------*/ +/* End of plf_ide.c */ diff --git a/ecos/packages/hal/h8300/aki3068net/current/src/plf_misc.c b/ecos/packages/hal/h8300/aki3068net/current/src/plf_misc.c new file mode 100644 index 0000000..4707e3c --- /dev/null +++ b/ecos/packages/hal/h8300/aki3068net/current/src/plf_misc.c @@ -0,0 +1,125 @@ +//========================================================================== +// +// plf_misc.c +// +// HAL platform miscellaneous functions +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-04-05 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include <pkgconf/hal.h> + +#include <cyg/infra/cyg_type.h> // Base types + +#include <cyg/hal/hal_arch.h> // architectural definitions +#include <cyg/hal/hal_io.h> +#include <cyg/hal/hal_if.h> +#include <cyg/hal/plf_intr.h> +#include <cyg/hal/var_arch.h> + +/*------------------------------------------------------------------------*/ + +void hal_platform_init(void) +{ + hal_if_init(); +} + +void h8300h_reset(void) +{ + __asm__ ("ldc #0x80,ccr\n" + "jmp @@0\n\t"); +} + +/*------------------------------------------------------------------------*/ +/* Control C ISR support */ + +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) + +struct Hal_SavedRegisters *hal_saved_interrupt_state; + +#endif + +/*------------------------------------------------------------------------*/ +/* clock support */ + +void hal_clock_initialize(cyg_uint32 period) +{ + CYG_BYTE prescale; +#if CYGNUM_HAL_H8300_RTC_PRESCALE == 8 + prescale = 0x01; +#else +#if CYGNUM_HAL_H8300_RTC_PRESCALE == 64 + prescale = 0x02; +#else +#if CYGNUM_HAL_H8300_RTC_PRESCALE == 8192 + prescale = 0x03; +#else +#error illigal RTC prescale setting +#endif +#endif +#endif + HAL_WRITE_UINT8(CYGARC_TCORA3,period); + HAL_WRITE_UINT8(CYGARC_8TCNT3,0x00); + HAL_WRITE_UINT8(CYGARC_8TCR3,0x48 | prescale); + HAL_WRITE_UINT8(CYGARC_8TCSR3,0x00); +} + +void hal_clock_reset(cyg_uint32 vector, cyg_uint32 period) +{ + HAL_WRITE_UINT8(CYGARC_8TCR3,0x00); + HAL_WRITE_UINT8(CYGARC_8TCSR3,0x00); + hal_clock_initialize(period); +} + +void hal_clock_read(cyg_uint32 *pvalue) +{ + CYG_BYTE val; + HAL_READ_UINT8(CYGARC_8TCNT3,val); + *pvalue = val; +} + +/*------------------------------------------------------------------------*/ +/* End of plf_misc.c */ diff --git a/ecos/packages/hal/h8300/arch/current/ChangeLog b/ecos/packages/hal/h8300/arch/current/ChangeLog new file mode 100644 index 0000000..0872c4b --- /dev/null +++ b/ecos/packages/hal/h8300/arch/current/ChangeLog @@ -0,0 +1,117 @@ +2005-01-27 Yoshinori Sato <ysato@users.sourceforge.jp> + + * src/hal_misc.c: hal_lsbit_index & hal_msbit_index cleanup. + +2004-05-27 Gary Thomas <gary@mlbassoc.com> + + * src/redboot_linux_exec.c (do_exec): Be sensitive to value in + "entry_address" as this can indicate if the image to be executed + is valid (the "load" functions set it to "NO_MEMORY" when invalid) + +2004-04-22 Jani Monoses <jani@iv.ro> + + * cdl/hal_h8300.cdl : + Invoke tail with stricter syntax that works in latest coreutils. + +2004-03-18 Yoshinori Sato <ysato@users.sourceforge.jp> + + * src/context.S + fix broken ccr from context save. + * src/redboot_linux_exec.c + fix build error of undefined "CYGDAT_REDBOOT_H8300_LINUX_COMMAND_START" + * src/sci.c + delete waste code. + +2004-02-24 Yoshinori Sato <ysato@users.sourceforge.jp> + + * src/vectors.S + add CYGSEM_HAL_SAVE_STUB_VECTOR. + saved parent gdb-stub breakpoint vector. + * cdl/hal_h8300.cdl + add CYGSEM_HAL_SAVE_STUB_VECTOR + move CYGSEM_HAL_H8300_VECTOR_HOOK from target cdl's + +2003-12-04 Yoshinori Sato <ysato@users.sourceforge.jp> + + * src/vector.S + add runtime vector setup. + add trace exception pc adjust. + + +2003-07-10 Nick Garnett <nickg@balti.calivar.com> + + * <general>: Added Yoshinori Sato's changes, see following + entries, plus a few small changes of my own. + +2003-03-09 Yoshinori Sato <ysato@users.sourceforge.jp> + + * src/sci.c + * cdl/hal_h8300.cdl + move variant h8_sci.c to arch sci.c + h8300_stub.c move to variant + +2003-02-27 Yoshinori Sato <ysato@users.sourceforge.jp> + + * src/context.S + H8S support fix. + +2003-02-22 Yoshinori Sato <ysato@users.sourceforge.jp> + + * include/arch.inc + * include/h8300_stub.h + * include/hal_arch.h + * src/context.S + H8S support add. + * src/vector.S + H8S support add. + Nested interrupt mask fix. + +2003-01-31 Mark Salter <msalter@redhat.com> + + * src/hal_syscall.c (hal_syscall_handler): Let generic syscall code + handle exit. + +2002-10-17 Yoshinori Sato <ysato@users.sourceforge.jp> + + * src/h8300_stub.c + single step fix. + +2002-08-30 Yoshinori Sato <ysato@users.sourceforge.jp> + + * include/hal_io.h + RedBoot IDE support add. + +2002-04-29 Jonathan Larmour <jlarmour@redhat.com> + + * src/vectors.S: + Don't use .file as it can confuse debugging since the .file + doesn't contain the path and therefore the debugger will never + know where it lives! This conflicts with using -Wa,--gstabs. + +2002-04-24 Yoshinori Sato <qzb04471@nifty.ne.jp> + + * New package. + +//=========================================================================== +// ####GPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +// +// This program 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. +// +// This program 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 this program; if not, write to the +// Free Software Foundation, Inc., 51 Franklin Street, +// Fifth Floor, Boston, MA 02110-1301, USA. +// ------------------------------------------- +// ####GPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/ecos/packages/hal/h8300/arch/current/cdl/hal_h8300.cdl b/ecos/packages/hal/h8300/arch/current/cdl/hal_h8300.cdl new file mode 100644 index 0000000..9710a46 --- /dev/null +++ b/ecos/packages/hal/h8300/arch/current/cdl/hal_h8300.cdl @@ -0,0 +1,138 @@ +# ==================================================================== +# +# hal_h8300.cdl +# +# H8/300 architectural HAL package configuration data +# +# ==================================================================== +## ####ECOSGPLCOPYRIGHTBEGIN#### +## ------------------------------------------- +## This file is part of eCos, the Embedded Configurable Operating System. +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +## +## This exception does not invalidate any other reasons why a work based +## on this file might be covered by the GNU General Public License. +## ------------------------------------------- +## ####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): yoshinori sato +# Original data: bartv, nickg +# Contributors: yoshinori sato +# Date: 2002-02-16 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_H8300 { + display "H8/300 architecture" + parent CYGPKG_HAL + hardware + include_dir cyg/hal + define_header hal_h8300.h + description " + The H8/300 architecture HAL package provides generic + support for this processor architecture. It is also + necessary to select a specific target platform HAL + package." + + cdl_interface CYGINT_HAL_H8300_VARIANT { + display "Number of variant implementations in this configuration" + requires 1 == CYGINT_HAL_H8300_VARIANT + } + + cdl_option CYGDBG_HAL_H8300_DEBUG_GDB_CTRLC_SUPPORT { + display "Architecture GDB CTRLC support" + calculated { CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT || CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT } + active_if { CYGINT_HAL_DEBUG_GDB_CTRLC_UNSUPPORTED == 0 } + description " + If either the CTRLC or BREAK support options in hal.h are set + then set our own option to turn on shared generic support for + control C handling." + } + + compile hal_misc.c hal_syscall.c context.S sci.c + + make { + <PREFIX>/lib/vectors.o : <PACKAGE>/src/vectors.S + $(CC) -Wp,-MD,vectors.tmp $(INCLUDE_PATH) $(CFLAGS) -c -o $@ $< + @echo $@ ": \\" > $(notdir $@).deps + @tail -n +2 vectors.tmp >> $(notdir $@).deps + @echo >> $(notdir $@).deps + @rm vectors.tmp + } + cdl_component CYGPKG_REDBOOT_H8300_OPTIONS { + display "Redboot for H8300 options" + flavor none + no_define + parent CYGPKG_REDBOOT + active_if CYGPKG_REDBOOT + description " + This option lists the target's requirements for a valid Redboot + configuration." + + cdl_component CYGSEM_REDBOOT_H8300_LINUX_BOOT { + display "Support booting uCinux via RedBoot" + flavor bool + default_value 1 + description " + This option enables RedBoot to support booting of a uClinux kernel." + compile -library=libextras.a redboot_linux_exec.c + + cdl_option CYGDAT_REDBOOT_H8300_LINUX_BOOT_ENTRY { + display "Default kernel entry address" + flavor data + default_value 0x400000 + description " + This option uClinux kernel entry address of default." + } + } + } + cdl_option CYGNUM_HAL_H8300_SCI_BAUD_RATE { + display "SCI serial port default baud rate" + flavor data + legal_values { 4800 9600 14400 19200 38400 57600 115200 } + default_value { 38400 } + } + cdl_option CYGSEM_HAL_H8300_VECTOR_HOOK { + display "Interrupt Vector Hook" + flavor bool + default_value 1 + parent CYGPKG_HAL_ROM_MONITOR + description " + Interrupt Vector Table Hooking Support" + } + cdl_option CYGSEM_HAL_H8300_SAVE_STUB_VECTOR { + display "Save gdb-stub breakpoint vector" + flavor bool + default_value 0 + parent CYGPKG_HAL_ROM_MONITOR + description " + Do not change vector of the breakpoint exception that + gdb-stub uses" + } +} diff --git a/ecos/packages/hal/h8300/arch/current/doc/README b/ecos/packages/hal/h8300/arch/current/doc/README new file mode 100644 index 0000000..911bdf8 --- /dev/null +++ b/ecos/packages/hal/h8300/arch/current/doc/README @@ -0,0 +1,2 @@ +Please visit http://homepage2.nifty.com/ysato/eCos/index.en.html for up to date +information, particularly on which GNU tools to use and patches. diff --git a/ecos/packages/hal/h8300/arch/current/include/arch.inc b/ecos/packages/hal/h8300/arch/current/include/arch.inc new file mode 100644 index 0000000..1962789 --- /dev/null +++ b/ecos/packages/hal/h8300/arch/current/include/arch.inc @@ -0,0 +1,174 @@ +#ifndef CYGONCE_HAL_ARCH_INC +#define CYGONCE_HAL_ARCH_INC +##============================================================================= +## +## arch.inc +## +## H8/300 assembler header file +## +##============================================================================= +## ####ECOSGPLCOPYRIGHTBEGIN#### +## ------------------------------------------- +## This file is part of eCos, the Embedded Configurable Operating System. +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +## +## This exception does not invalidate any other reasons why a work based +## on this file might be covered by the GNU General Public License. +## ------------------------------------------- +## ####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): yoshinori sato +## Contributors: yoshinori sato +## Date: 2002-02-14 +## Purpose: Architecture definitions. +## Description: This file contains various definitions and macros that are +## useful for writing assembly code for the H8300 CPU family. +## Usage: +## #include <cyg/hal/arch.inc> +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include <pkgconf/hal.h> + +#include <cyg/hal/variant.inc> + +##----------------------------------------------------------------------------- +## CPU specific macros. These provide a common assembler interface to +## operations that may have CPU specific implementations on different +## variants of the architecture. + +#ifndef CYGPKG_HAL_H8300_CPU_INIT_DEFINED + # Initialize CPU + .macro hal_cpu_init + # Set up the PSW + ldc #0xc0,ccr + .endm +#endif + + # Enable further exception processing, and disable + # interrupt processing. + .macro hal_cpu_except_enable + .endm + + # Return from exception. + .macro hal_cpu_eret pc,sr + .endm + +##----------------------------------------------------------------------------- +# Default interrupt decoding macros. + +#ifndef CYGPKG_HAL_H8300_INTC_DEFINED + +#ifndef CYGPKG_HAL_H8300_INTC_INIT_DEFINED + # initialize all interrupts to disabled + .macro hal_intc_init + .endm +#endif + + .macro hal_intc_decode vnum + .endm + +#endif + +#------------------------------------------------------------------------------ +# MMU macros. + +#ifndef CYGPKG_HAL_H8300_MMU_DEFINED + + .macro hal_mmu_init + .endm + +#endif + +#------------------------------------------------------------------------------ +# MEMC macros. + +#ifndef CYGPKG_HAL_H8300_MEMC_DEFINED + + .macro hal_memc_init + .endm + +#endif + +#------------------------------------------------------------------------------ +# Cache macros. + +#ifndef CYGPKG_HAL_H8300_CACHE_DEFINED + + .macro hal_cache_init + .endm + +#endif + +#------------------------------------------------------------------------------ +# Diagnostics macros. + +#ifndef CYGPKG_HAL_H8300_DIAG_DEFINED + + .macro hal_diag_init + .endm + + .macro hal_diag_excpt_start + .endm + + .macro hal_diag_intr_start + .endm + + .macro hal_diag_restore + .endm + + .macro hal_diag_data + .endm +#endif + +#------------------------------------------------------------------------------ +# Timer initialization. + +#ifndef CYGPKG_HAL_H8300_TIMER_DEFINED + + .macro hal_timer_init + .endm + +#endif + +#------------------------------------------------------------------------------ +# Monitor initialization. + +#ifndef CYGPKG_HAL_H8300_MON_DEFINED + + .macro hal_mon_init + .endm + +#endif + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_ARCH_INC +# end of arch.inc diff --git a/ecos/packages/hal/h8300/arch/current/include/basetype.h b/ecos/packages/hal/h8300/arch/current/include/basetype.h new file mode 100644 index 0000000..6146c6d --- /dev/null +++ b/ecos/packages/hal/h8300/arch/current/include/basetype.h @@ -0,0 +1,64 @@ +#ifndef CYGONCE_HAL_BASETYPE_H +#define CYGONCE_HAL_BASETYPE_H + +//============================================================================= +// +// basetype.h +// +// Standard types for this architecture. +// +//============================================================================= +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 1997-09-08 +// Purpose: Define architecture base types. +// Usage: Included by "cyg_type.h", do not use directly +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +//----------------------------------------------------------------------------- +// Characterize the architecture + +#define CYG_BYTEORDER CYG_MSBFIRST // Big endian + +#define CYG_LABEL_DEFN(_name_) _##_name_ + +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_BASETYPE_H +// End of basetype.h diff --git a/ecos/packages/hal/h8300/arch/current/include/h8300_stub.h b/ecos/packages/hal/h8300/arch/current/include/h8300_stub.h new file mode 100644 index 0000000..fdb20ad --- /dev/null +++ b/ecos/packages/hal/h8300/arch/current/include/h8300_stub.h @@ -0,0 +1,127 @@ +#ifndef CYGONCE_HAL_H8300_STUB_H +#define CYGONCE_HAL_H8300_STUB_H +//======================================================================== +// +// h8300_stub.h +// +// H8/300-specific definitions for generic stub +// +//======================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//======================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-13 +// Purpose: +// Description: H8/300-specific definitions for generic stub +// Usage: +// +//####DESCRIPTIONEND#### +// +//======================================================================== + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef CYGPKG_HAL_H8300_H8300H +#define NUMREGS 10 + +#define NUMREGBYTES (4*10) + +enum regnames { + ER0,ER1,ER2,ER3,ER4,ER5,ER6, + SP, CCR,PC +}; +#endif + +#ifdef CYGPKG_HAL_H8300_H8S +#define NUMREGS 11 + +#define NUMREGBYTES (4*11) + +enum regnames { + ER6,ER5,ER4,ER3,ER2,ER1,ER0, + SP, CCR,PC ,EXR +}; +#endif + +#define REGSIZE( _x_ ) (4) + +typedef unsigned long target_register_t; + + +typedef enum regnames regnames_t; + +/* Given a trap value TRAP, return the corresponding signal. */ +extern int __computeSignal (unsigned int trap_number); + +/* Return the SPARC trap number corresponding to the last-taken trap. */ +extern int __get_trap_number (void); + +/* Return the currently-saved value corresponding to register REG. */ +extern target_register_t get_register (regnames_t reg); + +/* Store VALUE in the register corresponding to WHICH. */ +extern void put_register (regnames_t which, target_register_t value); + +/* Set the currently-saved pc register value to PC. This also updates NPC + as needed. */ +extern void set_pc (target_register_t pc); + +/* Set things up so that the next user resume will execute one instruction. + This may be done by setting breakpoints or setting a single step flag + in the saved user registers, for example. */ +void __single_step (void); + +/* Clear the single-step state. */ +void __clear_single_step (void); + +/* If the breakpoint we hit is in the breakpoint() instruction, return a + non-zero value. */ +extern int __is_breakpoint_function (void); + +/* Skip the current instruction. */ +extern void __skipinst (void); + +extern void __install_breakpoints (void); + +extern void __clear_breakpoints (void); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif // ifndef CYGONCE_HAL_H8300_STUB_H diff --git a/ecos/packages/hal/h8300/arch/current/include/hal_arch.h b/ecos/packages/hal/h8300/arch/current/include/hal_arch.h new file mode 100644 index 0000000..c730195 --- /dev/null +++ b/ecos/packages/hal/h8300/arch/current/include/hal_arch.h @@ -0,0 +1,297 @@ +#ifndef CYGONCE_HAL_HAL_ARCH_H +#define CYGONCE_HAL_HAL_ARCH_H +//========================================================================== +// +// hal_arch.h +// +// Architecture specific abstractions +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Yoshinori Sato +// Contributors: Yoshinori Sato +// Date: 2002-02-13 +// Purpose: Define architecture abstractions +// Usage: #include <cyg/hal/hal_arch.h> +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include <pkgconf/hal.h> +#include <cyg/infra/cyg_type.h> + +#include <cyg/hal/var_arch.h> + +//-------------------------------------------------------------------------- +// Exception handling function. +// This function is defined by the kernel according to this prototype. It is +// invoked from the HAL to deal with any CPU exceptions that the HAL does +// not want to deal with itself. It usually invokes the kernel's exception +// delivery mechanism. + +externC void cyg_hal_deliver_exception( CYG_WORD code, CYG_ADDRWORD data ); + +//-------------------------------------------------------------------------- +// Bit manipulation routines + +externC cyg_uint32 hal_lsbit_index(cyg_uint32 mask); +externC cyg_uint32 hal_msbit_index(cyg_uint32 mask); + +#define HAL_LSBIT_INDEX(index, mask) index = hal_lsbit_index(mask); + +#define HAL_MSBIT_INDEX(index, mask) index = hal_msbit_index(mask); + +//-------------------------------------------------------------------------- +// Context Initialization +// Initialize the context of a thread. +// Arguments: +// _sp_ name of variable containing current sp, will be written with new sp +// _thread_ thread object address, passed as argument to entry point +// _entry_ entry point address. +// _id_ bit pattern used in initializing registers, for debugging. + +#ifndef HAL_THREAD_INIT_CONTEXT_EXTRA +#define HAL_THREAD_INIT_CONTEXT_EXTRA(_regs_, _id_) +#endif + +#define HAL_THREAD_INIT_CONTEXT( _sp_, _thread_, _entry_, _id_ ) \ +{ \ + register HAL_SavedRegisters *_regs_; \ + _regs_ = (HAL_SavedRegisters *)(((CYG_ADDRWORD)(_sp_)) - \ + sizeof(HAL_SavedRegisters)); \ + HAL_THREAD_INIT_CONTEXT_EXTRA(_regs_, _id_); \ + _regs_->er0 = (CYG_WORD)(_thread_); \ + _regs_->er1 = (_id_)|0xddd1; \ + _regs_->er2 = (_id_)|0xddd2; \ + _regs_->er3 = (_id_)|0xddd3; \ + _regs_->er4 = (_id_)|0xddd4; \ + _regs_->er5 = (_id_)|0xddd5; \ + _regs_->er6 = (_id_)|0xddd6; \ + _regs_->pc = (CYG_WORD)(_entry_); \ + _regs_->ccr = 0x00; \ + _sp_ = (CYG_ADDRESS)_regs_; \ +} + +//-------------------------------------------------------------------------- +// Context switch macros. +// The arguments are pointers to locations where the stack pointer +// of the current thread is to be stored, and from where the sp of the +// next thread is to be fetched. + +externC void hal_thread_switch_context( CYG_ADDRESS to, CYG_ADDRESS from ); +externC void hal_thread_load_context( CYG_ADDRESS to ) + __attribute__ ((noreturn)); + +#define HAL_THREAD_SWITCH_CONTEXT(_fspptr_,_tspptr_) \ + hal_thread_switch_context((CYG_ADDRESS)_tspptr_, \ + (CYG_ADDRESS)_fspptr_); + +#define HAL_THREAD_LOAD_CONTEXT(_tspptr_) \ + hal_thread_load_context( (CYG_ADDRESS)_tspptr_ ); + +//-------------------------------------------------------------------------- +// Execution reorder barrier. +// When optimizing the compiler can reorder code. In multithreaded systems +// where the order of actions is vital, this can sometimes cause problems. +// This macro may be inserted into places where reordering should not happen. + +#define HAL_REORDER_BARRIER() asm volatile ( "" : : : "memory" ) + +//-------------------------------------------------------------------------- +// Breakpoint support +// HAL_BREAKPOINT() is a code sequence that will cause a breakpoint to +// happen if executed. +// HAL_BREAKINST is the value of the breakpoint instruction and +// HAL_BREAKINST_SIZE is its size in bytes. + +#define __HAL_BREAKPOINT(_label_) # _label_ +#define HAL_BREAKPOINT(_label_) \ +asm volatile (" .globl " __HAL_BREAKPOINT(_label_) "\n" \ + __HAL_BREAKPOINT(_label_) ":\n\t" \ + "trapa #3" \ + ); + +#define HAL_BREAKINST 0x5730 + +#define HAL_BREAKINST_SIZE 2 + +//-------------------------------------------------------------------------- +// Thread register state manipulation for GDB support. + +// Translate a stack pointer as saved by the thread context macros above into +// a pointer to a HAL_SavedRegisters structure. +#define HAL_THREAD_GET_SAVED_REGISTERS( _sp_, _regs_ ) \ + (_regs_) = (HAL_SavedRegisters *)(_sp_) + +#ifndef HAL_GET_GDB_EXTRA_REGISTERS +#define HAL_GET_GDB_EXTRA_REGISTERS( _regval_, _regs_ ) +#endif +#ifndef HAL_SET_GDB_EXTRA_REGISTERS +#define HAL_SET_GDB_EXTRA_REGISTERS( _regs_, _regval_ ) +#endif + + +// Copy a set of registers from a HAL_SavedRegisters structure into a +// GDB ordered array. +#define HAL_GET_GDB_REGISTERS( _aregval_ , _regs_ ) \ +{ \ + CYG_ADDRWORD *_regval_ = (CYG_ADDRWORD *)(_aregval_); \ + \ + _regval_[0] = (_regs_)->er0; \ + _regval_[1] = (_regs_)->er1; \ + _regval_[2] = (_regs_)->er2; \ + _regval_[3] = (_regs_)->er3; \ + _regval_[4] = (_regs_)->er4; \ + _regval_[5] = (_regs_)->er5; \ + _regval_[6] = (_regs_)->er6; \ + \ + _regval_[7] = (_regs_)->sp; \ + _regval_[8] = (_regs_)->ccr; \ + _regval_[9] = (_regs_)->pc & 0xffffff; \ + \ + HAL_GET_GDB_EXTRA_REGISTERS( _regval_, _regs_ ); \ +} + +// Copy a GDB ordered array into a HAL_SavedRegisters structure. +#define HAL_SET_GDB_REGISTERS( _regs_ , _aregval_ ) \ +{ \ + CYG_ADDRWORD *_regval_ = (CYG_ADDRWORD *)(_aregval_); \ + \ + (_regs_)->er0 = _regval_[0]; \ + (_regs_)->er1 = _regval_[1]; \ + (_regs_)->er2 = _regval_[2]; \ + (_regs_)->er3 = _regval_[3]; \ + (_regs_)->er4 = _regval_[4]; \ + (_regs_)->er5 = _regval_[5]; \ + (_regs_)->er6 = _regval_[6]; \ + (_regs_)->sp = _regval_[7]; \ + (_regs_)->ccr = _regval_[8]; \ + (_regs_)->pc = (_regval_[9] & 0xffffff); \ + \ + /* We do not allow the SP or PSW to be set. Changing the SP will \ + * mess up the saved state. No PSW is saved on thread context \ + * switches, so there is nowhere to save it to. \ + */ \ + \ + HAL_SET_GDB_EXTRA_REGISTERS( _regs_, _regval_ ); \ +} + +#ifndef CYGARC_HAL_GET_PC_REG +#define CYGARC_HAL_GET_PC_REG(_regs_,_val_) ((_val_) = (_regs_)->pc & 0xffffff) +#endif + +//------------------------------------------------------------------------- +// HAL setjmp +// Note: These definitions are repeated in context.S. If changes are required +// remember to update both sets. + +#define CYGARC_JMP_BUF_SP 0 +#define CYGARC_JMP_BUF_ER3 1 +#define CYGARC_JMP_BUF_ER4 2 +#define CYGARC_JMP_BUF_ER5 3 +#define CYGARC_JMP_BUF_ER6 4 +#define CYGARC_JMP_BUF_PC 5 + +#define CYGARC_JMP_BUF_SIZE 6 + +typedef cyg_uint32 hal_jmp_buf[CYGARC_JMP_BUF_SIZE]; + +externC int hal_setjmp(hal_jmp_buf env); +externC void hal_longjmp(hal_jmp_buf env, int val); + +//------------------------------------------------------------------------- +// Idle thread code. +// This macro is called in the idle thread loop, and gives the HAL the +// chance to insert code. Typical idle thread behaviour might be to halt the +// processor. + +externC void hal_idle_thread_action(cyg_uint32 loop_count); + +#define HAL_IDLE_THREAD_ACTION(_count_) hal_idle_thread_action(_count_) + +//----------------------------------------------------------------------------- +// Minimal and sensible stack sizes: the intention is that applications +// will use these to provide a stack size in the first instance prior to +// proper analysis. Idle thread stack should be this big. + +// THESE ARE NOT INTENDED TO BE MICROMETRICALLY ACCURATE FIGURES. +// THEY ARE HOWEVER ENOUGH TO START PROGRAMMING. +// YOU MUST MAKE YOUR STACKS LARGER IF YOU HAVE LARGE "AUTO" VARIABLES! + +// We define quite large stack needs for SPARClite, for it requires 576 +// bytes (144 words) to process an interrupt and thread-switch, and +// momentarily, but needed in case of recursive interrupts, it needs 208 +// words - if a sequence of saves to push out other regsets is interrupted. + +// This is not a config option because it should not be adjusted except +// under "enough rope" sort of disclaimers. + +// Worst case stack frame size: return link + 4 args + 4 pushed registers. +#define CYGNUM_HAL_STACK_FRAME_SIZE (40) + +// Stack needed for a context switch: +#define CYGNUM_HAL_STACK_CONTEXT_SIZE (60) + +// Interrupt + call to ISR, interrupt_end() and the DSR +#define CYGNUM_HAL_STACK_INTERRUPT_SIZE (128) + +#if 0 //def CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + +// An interrupt stack which is large enough for all possible interrupt +// conditions (and only used for that purpose) exists. "User" stacks +// can be much smaller + +#define CYGNUM_HAL_STACK_SIZE_MINIMUM (CYGNUM_HAL_STACK_CONTEXT_SIZE+ \ + CYGNUM_HAL_STACK_INTERRUPT_SIZE*2+ \ + CYGNUM_HAL_STACK_FRAME_SIZE*16) +#define CYGNUM_HAL_STACK_SIZE_TYPICAL (2048) + +#else // CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + +// No separate interrupt stack exists. Make sure all threads contain +// a stack sufficiently large. + +#define CYGNUM_HAL_STACK_SIZE_MINIMUM (4096) +#define CYGNUM_HAL_STACK_SIZE_TYPICAL (4096) + +#endif + +#define CYGARC_HAL_SAVE_GP() +#define CYGARC_HAL_RESTORE_GP() +//-------------------------------------------------------------------------- +#endif // CYGONCE_HAL_HAL_ARCH_H +// EOF hal_arch.h diff --git a/ecos/packages/hal/h8300/arch/current/include/hal_cache.h b/ecos/packages/hal/h8300/arch/current/include/hal_cache.h new file mode 100644 index 0000000..b855b94 --- /dev/null +++ b/ecos/packages/hal/h8300/arch/current/include/hal_cache.h @@ -0,0 +1,187 @@ +#ifndef CYGONCE_HAL_CACHE_H +#define CYGONCE_HAL_CACHE_H + +//============================================================================= +// +// hal_cache.h +// +// HAL cache control API +// +//============================================================================= +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-13 +// Purpose: Cache control API +// Description: The macros defined here provide the HAL APIs for handling +// cache control operations. +// Usage: +// #include <cyg/hal/hal_cache.h> +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include <pkgconf/hal.h> +#include <cyg/infra/cyg_type.h> + + + +//----------------------------------------------------------------------------- +// Cache dimensions + +// Data cache +//#define HAL_DCACHE_SIZE 0 // Size of data cache in bytes +//#define HAL_DCACHE_LINE_SIZE 0 // Size of a data cache line +//#define HAL_DCACHE_WAYS 0 // Associativity of the cache + +// Instruction cache +//#define HAL_ICACHE_SIZE 0 // Size of cache in bytes +//#define HAL_ICACHE_LINE_SIZE 0 // Size of a cache line +//#define HAL_ICACHE_WAYS 0 // 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() + +// Disable the data cache +#define HAL_DCACHE_DISABLE() + +// Invalidate the entire cache +#define HAL_DCACHE_INVALIDATE_ALL() + +// 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_ ) + +// 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 + +// Enable the instruction cache +#define HAL_ICACHE_ENABLE() + +// Disable the instruction cache +#define HAL_ICACHE_DISABLE() + +// Invalidate the entire cache +#define HAL_ICACHE_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 + + +//----------------------------------------------------------------------------- +// Check that a supported configuration has actually defined some macros. + +#ifndef HAL_DCACHE_ENABLE + +#error Unsupported H8300 configuration + +#endif + +//----------------------------------------------------------------------------- +// End of hal_cache.h diff --git a/ecos/packages/hal/h8300/arch/current/include/hal_intr.h b/ecos/packages/hal/h8300/arch/current/include/hal_intr.h new file mode 100644 index 0000000..db91b24 --- /dev/null +++ b/ecos/packages/hal/h8300/arch/current/include/hal_intr.h @@ -0,0 +1,207 @@ +#ifndef CYGONCE_HAL_HAL_INTR_H +#define CYGONCE_HAL_HAL_INTR_H +//========================================================================== +// +// hal_intr.h +// +// HAL Interrupt and clock support +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-13 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock. +// Usage: +// #include <cyg/hal/hal_intr.h> +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include <pkgconf/hal.h> + +#include <cyg/infra/cyg_type.h> +#include <cyg/hal/hal_io.h> + +#include <cyg/hal/var_intr.h> + +//-------------------------------------------------------------------------- +// Static data used by HAL + +// ISR tables +externC volatile CYG_ADDRESS hal_interrupt_handlers[CYGNUM_HAL_ISR_COUNT]; +externC volatile CYG_ADDRWORD hal_interrupt_data[CYGNUM_HAL_ISR_COUNT]; +externC volatile CYG_ADDRESS hal_interrupt_objects[CYGNUM_HAL_ISR_COUNT]; + +// VSR table +externC volatile CYG_ADDRESS hal_vsr_table[CYGNUM_HAL_VSR_COUNT]; + +//-------------------------------------------------------------------------- +// Default ISR +// The #define is used to test whether this routine exists, and to allow +// us to call it. + +externC cyg_uint32 hal_default_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data); + +#define HAL_DEFAULT_ISR hal_default_isr + +//-------------------------------------------------------------------------- +// Interrupt state storage + +typedef cyg_uint32 CYG_INTERRUPT_STATE; + +//-------------------------------------------------------------------------- + +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + +// Routine to execute DSRs using separate interrupt stack +externC void hal_interrupt_stack_call_pending_DSRs(void); +#define HAL_INTERRUPT_STACK_CALL_PENDING_DSRS() \ + hal_interrupt_stack_call_pending_DSRs() + +// these are offered solely for stack usage testing +// if they are not defined, then there is no interrupt stack. +#define HAL_INTERRUPT_STACK_BASE cyg_interrupt_stack_base +#define HAL_INTERRUPT_STACK_TOP cyg_interrupt_stack +// use them to declare these extern however you want: +// extern char HAL_INTERRUPT_STACK_BASE[]; +// extern char HAL_INTERRUPT_STACK_TOP[]; +// is recommended + +#endif + + +#ifndef HAL_TRANSLATE_VECTOR + +#define HAL_TRANSLATE_VECTOR(_vector_,_index_) _index_ = (_vector_) + +#endif + +//-------------------------------------------------------------------------- +// Interrupt and VSR attachment macros + +#define HAL_INTERRUPT_IN_USE( _vector_, _state_) \ +CYG_MACRO_START \ + cyg_uint32 _index_; \ + HAL_TRANSLATE_VECTOR ((_vector_), _index_); \ + \ + if( hal_interrupt_handlers[_index_] == (CYG_ADDRESS)HAL_DEFAULT_ISR ) \ + (_state_) = 0; \ + else \ + (_state_) = 1; \ +CYG_MACRO_END + +#define HAL_INTERRUPT_ATTACH( _vector_, _isr_, _data_, _object_ ) \ +CYG_MACRO_START \ + cyg_uint32 _index_; \ + HAL_TRANSLATE_VECTOR(_vector_,_index_); \ + \ + if( hal_interrupt_handlers[_index_] == (CYG_ADDRESS)HAL_DEFAULT_ISR ) \ + { \ + hal_interrupt_handlers[_index_] = (CYG_ADDRESS)_isr_; \ + hal_interrupt_data[_index_] = (CYG_ADDRWORD)_data_; \ + hal_interrupt_objects[_index_] = (CYG_ADDRESS)_object_; \ + } \ +CYG_MACRO_END + +#define HAL_INTERRUPT_DETACH( _vector_, _isr_ ) \ +CYG_MACRO_START \ + cyg_uint32 _index_; \ + HAL_TRANSLATE_VECTOR(_vector_,_index_); \ + \ + if( hal_interrupt_handlers[_index_] == (CYG_ADDRESS)_isr_ ) \ + { \ + hal_interrupt_handlers[_index_] = (CYG_ADDRESS)HAL_DEFAULT_ISR; \ + hal_interrupt_data[_index_] = 0; \ + hal_interrupt_objects[_index_] = 0; \ + } \ +CYG_MACRO_END + +#define HAL_VSR_GET( _vector_, _pvsr_ ) \ + *((CYG_ADDRESS *)_pvsr_) = hal_vsr_table[_vector_]; + + +#define HAL_VSR_SET( _vector_, _vsr_, _poldvsr_ ) \ + if( _poldvsr_ != NULL ) \ + *(CYG_ADDRESS *)_poldvsr_ = hal_vsr_table[_vector_]; \ + hal_vsr_table[_vector_] = (CYG_ADDRESS)_vsr_; + + +//-------------------------------------------------------------------------- +// Interrupt controller access +// Read interrupt control registers back after writing to them. This +// ensures that the written value is not sitting in the store buffers +// when interrupts are re-enabled. + +#define HAL_INTERRUPT_MASK( _vector_ ) \ + hal_interrupt_mask( _vector_ ) + +#define HAL_INTERRUPT_UNMASK( _vector_ ) \ + hal_interrupt_unmask( _vector_ ) + +#define HAL_INTERRUPT_ACKNOWLEDGE( _vector_ ) \ + hal_interrupt_acknowledge( _vector_ ) + +#if !defined(HAL_INTERRUPT_CONFIGURE) + +#error HAL_INTERRUPT_CONFIGURE not defined by variant + +#endif + +#define HAL_INTERRUPT_SET_LEVEL( _vector_, _level_ ) \ + hal_interrupt_set_level( _vector_, _level_ ) + + +externC void hal_interrupt_mask(int vector); +externC void hal_interrupt_unmask(int vector); +externC void hal_interrupt_acknowledge(int vector); +externC void hal_interrupt_set_level(int vector,int level); +//-------------------------------------------------------------------------- +// Clock control. +// This is almost all handled in the var_intr.h. + +#ifdef CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY +#define HAL_CLOCK_LATENCY(_pvalue_) HAL_CLOCK_READ(_pvalue_) +#endif + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_HAL_INTR_H +// EOF hal_intr.h diff --git a/ecos/packages/hal/h8300/arch/current/include/hal_io.h b/ecos/packages/hal/h8300/arch/current/include/hal_io.h new file mode 100644 index 0000000..8c92db6 --- /dev/null +++ b/ecos/packages/hal/h8300/arch/current/include/hal_io.h @@ -0,0 +1,147 @@ +#ifndef CYGONCE_HAL_HAL_IO_H +#define CYGONCE_HAL_HAL_IO_H + +//============================================================================= +// +// hal_io.h +// +// HAL device IO register support. +// +//============================================================================= +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-13 +// Purpose: Define IO register support +// Description: The macros defined here provide the HAL APIs for handling +// device IO control registers. +// +// Usage: +// #include <cyg/hal/hal_io.h> +// ... +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include <cyg/infra/cyg_type.h> +#if defined(CYGBLD_HAL_PLATFORM_IO_H) +#include CYGBLD_HAL_PLATFORM_IO_H +#endif + +//----------------------------------------------------------------------------- +// IO Register address. +// This type is for recording the address of an IO register. + +typedef volatile CYG_ADDRWORD HAL_IO_REGISTER; + +//----------------------------------------------------------------------------- +// BYTE Register access. +// Individual and vectorized access to 8 bit registers. + +#define HAL_READ_UINT8( _register_, _value_ ) \ + ((_value_) = *((volatile CYG_BYTE *)(_register_))) + +#define HAL_WRITE_UINT8( _register_, _value_ ) \ + (*((volatile CYG_BYTE *)(_register_)) = (_value_)) + +#define HAL_READ_UINT8_VECTOR( _register_, _buf_, _count_, _step_ ) \ +{ \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + (_buf_)[_i_] = ((volatile CYG_BYTE *)(_register_))[_j_]; \ +} + +#define HAL_WRITE_UINT8_VECTOR( _register_, _buf_, _count_, _step_ ) \ +{ \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + ((volatile CYG_BYTE *)(_register_))[_j_] = (_buf_)[_i_]; \ +} + + +//----------------------------------------------------------------------------- +// 16 bit access. +// Individual and vectorized access to 16 bit registers. + +#define HAL_READ_UINT16( _register_, _value_ ) \ + ((_value_) = *((volatile CYG_WORD16 *)(_register_))) + +#define HAL_WRITE_UINT16( _register_, _value_ ) \ + (*((volatile CYG_WORD16 *)(_register_)) = (_value_)) + +#define HAL_READ_UINT16_VECTOR( _register_, _buf_, _count_, _step_ ) \ +{ \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + (_buf_)[_i_] = ((volatile CYG_WORD16 *)(_register_))[_j_]; \ +} + +#define HAL_WRITE_UINT16_VECTOR( _register_, _buf_, _count_, _step_ ) \ +{ \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + ((volatile CYG_WORD16 *)(_register_))[_j_] = (_buf_)[_i_]; \ +} + +//----------------------------------------------------------------------------- +// 32 bit access. +// Individual and vectorized access to 32 bit registers. + +#define HAL_READ_UINT32( _register_, _value_ ) \ + ((_value_) = *((volatile CYG_WORD32 *)(_register_))) + +#define HAL_WRITE_UINT32( _register_, _value_ ) \ + (*((volatile CYG_WORD32 *)(_register_)) = (_value_)) + +#define HAL_READ_UINT32_VECTOR( _register_, _buf_, _count_, _step_ ) \ +{ \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + (_buf_)[_i_] = ((volatile CYG_WORD32 *)(_register_))[_j_]; \ +} + +#define HAL_WRITE_UINT32_VECTOR( _register_, _buf_, _count_, _step_ ) \ +{ \ + cyg_count32 _i_,_j_; \ + for( _i_ = 0, _j_ = 0; _i_ < (_count_); _i_++, _j_ += (_step_)) \ + ((volatile CYG_WORD32 *)(_register_))[_j_] = (_buf_)[_i_]; \ +} + +//----------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_HAL_IO_H +// End of hal_io.h diff --git a/ecos/packages/hal/h8300/arch/current/src/context.S b/ecos/packages/hal/h8300/arch/current/src/context.S new file mode 100644 index 0000000..b9ee312 --- /dev/null +++ b/ecos/packages/hal/h8300/arch/current/src/context.S @@ -0,0 +1,150 @@ +##============================================================================= +## +## context.S +## +## H8/300 context switch code +## +##============================================================================= +## ####ECOSGPLCOPYRIGHTBEGIN#### +## ------------------------------------------- +## This file is part of eCos, the Embedded Configurable Operating System. +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +## +## This exception does not invalidate any other reasons why a work based +## on this file might be covered by the GNU General Public License. +## ------------------------------------------- +## ####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): yoshinori sato +## Contributors: yoshinori sato +## Date: 2002-02-17 +## Purpose: H8/300 context switch code +## Description: This file contains implementations of the thread context +## switch routines. It also contains the longjmp() and setjmp() +## routines. +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include <pkgconf/hal.h> + +#include <cyg/hal/arch.inc> +#include <cyg/hal/basetype.h> + + +#ifdef CYGPKG_HAL_H8300_H8300H + .h8300h +#endif +#ifdef CYGPKG_HAL_H8300_H8S + .h8300s +#endif + +#------------------------------------------------------------------------------ +# hal_thread_switch_context +# Switch thread contexts +# er0 = address of sp of next thread to execute +# er1 = address of sp save location of current thread + + .global CYG_LABEL_DEFN(hal_thread_switch_context) +CYG_LABEL_DEFN(hal_thread_switch_context): + mov.w @sp,r2 ; save ccr + stc ccr,r2h + mov.w r2,@sp + hal_cpu_save_context + mov.l sp,@er1 + + # Now load the destination thread by dropping through + # to hal_thread_load_context + +#------------------------------------------------------------------------------ +# hal_thread_load_context +# Load thread context +# D0 = address of sp of next thread to execute +# Note that this function is also the second half of hal_thread_switch_context +# and is simply dropped into from it. + + .global CYG_LABEL_DEFN(hal_thread_load_context) +CYG_LABEL_DEFN(hal_thread_load_context): + + mov.l @er0,sp + hal_cpu_load_all + rte + +##----------------------------------------------------------------------------- +## HAL longjmp(), setjmp() implementations +## These implementations omit the usual movm [d2,d3,a2,a3],(sp) +## Which is the first instruction of all C compiled functions. +## Note: These definitions are repeated in hal_arch.h. If changes are required +## remember to update both sets. + +#define CYGARC_JMP_BUF_SP 0 +#define CYGARC_JMP_BUF_ER3 1 +#define CYGARC_JMP_BUF_ER4 2 +#define CYGARC_JMP_BUF_ER5 3 +#define CYGARC_JMP_BUF_ER6 4 +#define CYGARC_JMP_BUF_PC 5 + +#define CYGARC_JMP_BUF_SIZE 6 + + + # This just preserves the callee save registers + # namely a2,a3,d2,d3 + # setjmp cannot use movm to do this as we need to keep + # the sp underneath all live data at all times. + .globl CYG_LABEL_DEFN(hal_setjmp) +CYG_LABEL_DEFN(hal_setjmp): ; er0=env + mov.l er3,@(CYGARC_JMP_BUF_ER3*4,er0) + mov.l er4,@(CYGARC_JMP_BUF_ER4*4,er0) + mov.l er5,@(CYGARC_JMP_BUF_ER5*4,er0) + mov.l er6,@(CYGARC_JMP_BUF_ER6*4,er0) + mov.l @sp,er1 + mov.l er1,@(CYGARC_JMP_BUF_PC*4,er0) + mov sp,er1 + mov er1,@(CYGARC_JMP_BUF_SP*4,er0) + sub.l er0,er0 + rts + + # longjmp returns to caller of setjmp + # after restoring callee save registers + .globl CYG_LABEL_DEFN(hal_longjmp) +CYG_LABEL_DEFN(hal_longjmp): + mov.l @(CYGARC_JMP_BUF_ER3*4,er0),er3 + mov.l @(CYGARC_JMP_BUF_ER4*4,er0),er4 + mov.l @(CYGARC_JMP_BUF_ER5*4,er0),er5 + mov.l @(CYGARC_JMP_BUF_ER6*4,er0),er6 + mov.l @(CYGARC_JMP_BUF_PC*4,er0),er2 + mov.l @(CYGARC_JMP_BUF_SP*4,er0),sp + mov.l er2,@sp + mov.l er1,er0 + rts + + +#------------------------------------------------------------------------------ +# end of context.S + + diff --git a/ecos/packages/hal/h8300/arch/current/src/hal_misc.c b/ecos/packages/hal/h8300/arch/current/src/hal_misc.c new file mode 100644 index 0000000..b156059 --- /dev/null +++ b/ecos/packages/hal/h8300/arch/current/src/hal_misc.c @@ -0,0 +1,245 @@ +/*========================================================================== +// +// hal_misc.c +// +// HAL miscellaneous functions +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): nickg +// Contributors: nickg, jlarmour +// Date: 1999-02-18 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include <pkgconf/hal.h> + +#include <cyg/infra/cyg_type.h> +#include <cyg/infra/cyg_trac.h> + +#include <cyg/hal/hal_arch.h> + +#include <cyg/hal/hal_intr.h> + +#if 0 +void trace( CYG_ADDRWORD tag, CYG_ADDRWORD a1, CYG_ADDRWORD a2) +{ + CYG_ADDRWORD **pp = (CYG_ADDRWORD **)0x48100000; + CYG_ADDRWORD *ix = (CYG_ADDRWORD *)0x4810000C; + CYG_ADDRWORD *p = *pp; + *p++ = tag; + *ix = *ix + 1; + *p++ = *ix; + *p++ = a1; + *p++ = a2; + *pp = p; +} +#endif + +/*------------------------------------------------------------------------*/ + +#ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG +cyg_bool cyg_hal_stop_constructors; +#endif + +void +cyg_hal_invoke_constructors(void) +{ + typedef void (*pfunc) (void); + extern pfunc __CTOR_LIST__[]; + extern pfunc __CTOR_END__[]; + +#ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG + static pfunc *p = &__CTOR_END__[-1]; + + cyg_hal_stop_constructors = 0; + for (; p >= __CTOR_LIST__; p--) { + (*p) (); + if (cyg_hal_stop_constructors) { + p--; + break; + } + } +#else + pfunc *p; + + for (p = &__CTOR_END__[-1]; p >= __CTOR_LIST__; p--) + (*p) (); +#endif + +} // cyg_hal_invoke_constructors() + +/*------------------------------------------------------------------------*/ +// Default ISR +externC cyg_uint32 +hal_arch_default_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data) +{ + return 0; +} + +//-------------------------------------------------------------------------- +/* Determine the index of the ls bit of the supplied mask. */ + +cyg_uint32 +hal_lsbit_index(cyg_uint32 mask) +{ + int bit = -1; + + if (mask == 0) + return -1; + + if ((mask & 0xffff) == 0) { + mask >>= 16; + bit += 16; + } + if ((mask & 0xff) == 0) { + mask >>= 8; + bit += 8; + } + + __asm__("1:\n\t" + "adds #1,%0\n\t" + "shlr.b %w2\n\t" + "bcc 1b\n\t" + :"=r"(bit):"0"(bit),"r"(mask)); + + return bit; +} + +/*------------------------------------------------------------------------*/ +/* Determine the index of the ms bit of the supplied mask. */ + +cyg_uint32 +hal_msbit_index(cyg_uint32 mask) +{ + unsigned int bit = 8; + + if (mask == 0) + return -1; + + if ((mask & ~0xffff) != 0) + mask >>= 16; + else + bit += 16; + + if ((mask & 0xff00) != 0) + mask >>= 8; + else + bit += 8; + + __asm__("1:\n\t" + "dec.b %w0\n\t" + "shll.b %w2\n\t" + "bcc 1b\n\t" + :"=r"(bit):"0"(bit),"r"(mask)); + + return bit; +} + +/*------------------------------------------------------------------------*/ +/* First level C exception handler. */ + +externC void __handle_exception (void); + +externC HAL_SavedRegisters *_hal_registers; + +void +cyg_hal_exception_handler(HAL_SavedRegisters *regs,CYG_WORD vector) +{ +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + + // Set the pointer to the registers of the current exception + // context. At entry the GDB stub will expand the + // HAL_SavedRegisters structure into a (bigger) register array. + _hal_registers = regs; + + __handle_exception(); + +#endif +#if defined(CYGPKG_HAL_EXCEPTIONS) + + // We should decode the vector and pass a more appropriate + // value as the second argument. For now we simply pass a + // pointer to the saved registers. We should also divert + // breakpoint and other debug vectors into the debug stubs. + + cyg_hal_deliver_exception( vector, (CYG_ADDRWORD)regs ); + +#endif + + return; +} + +/*------------------------------------------------------------------------*/ +/* default ISR */ + +#ifndef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT +externC cyg_uint32 hal_default_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data) +{ +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) && \ + defined(CYGHWR_HAL_GDB_PORT_VECTOR) && \ + defined(HAL_CTRLC_ISR) + +#ifndef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN + if( vector == CYGHWR_HAL_GDB_PORT_VECTOR ) +#endif + { + cyg_uint32 result = HAL_CTRLC_ISR( vector, data ); + if( result != 0 ) return result; + } + +#endif + + CYG_TRACE1(true, "Interrupt: %d", vector); + CYG_FAIL("Spurious Interrupt!!!"); + return 0; +} +#endif + +/*------------------------------------------------------------------------*/ +/* Idle thread activity. */ + +externC void hal_idle_thread_action(cyg_uint32 loop_count) +{ +} + +/*------------------------------------------------------------------------*/ +/* End of hal_misc.c */ diff --git a/ecos/packages/hal/h8300/arch/current/src/hal_syscall.c b/ecos/packages/hal/h8300/arch/current/src/hal_syscall.c new file mode 100644 index 0000000..72b664f --- /dev/null +++ b/ecos/packages/hal/h8300/arch/current/src/hal_syscall.c @@ -0,0 +1,104 @@ +//============================================================================= +// +// hal_syscall.c +// +// +// +//============================================================================= +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): msalter +// Contributors:msalter,ysato +// Date: 2000-11-5 +// Purpose: +// Description: +// +// +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include <pkgconf/hal.h> + +#ifdef CYGPKG_REDBOOT +#include <pkgconf/redboot.h> +#endif + +#if defined(CYGSEM_REDBOOT_BSP_SYSCALLS) + +#include <cyg/hal/hal_stub.h> // Our header +#include <cyg/hal/hal_arch.h> // HAL_BREAKINST +#include <cyg/hal/hal_cache.h> // HAL_xCACHE_x +#include <cyg/hal/hal_intr.h> // interrupt disable/restore + +#include <cyg/hal/hal_if.h> // ROM calling interface +#include <cyg/hal/hal_misc.h> // Helper functions + +extern CYG_ADDRWORD __do_syscall(CYG_ADDRWORD func, // syscall function number + CYG_ADDRWORD arg1, CYG_ADDRWORD arg2, // up to four args. + CYG_ADDRWORD arg3, CYG_ADDRWORD arg4, + CYG_ADDRWORD *retval); // syscall return value + +#define SYS_exit 1 +#define SYS_interrupt 1000 + +int +hal_syscall_handler(void) +{ + CYG_ADDRWORD func, arg1, arg2, arg3, arg4; + CYG_ADDRWORD err; + + func = get_register(ER0); + arg1 = get_register(ER1); + arg2 = get_register(ER2); + arg3 = get_register(ER3); + arg4 = 0; + + if (func == SYS_interrupt) { + // A console interrupt landed us here. + // Invoke the debug agent so as to cause a SIGINT. + return SIGINT; + } + + if (__do_syscall(func, arg1, arg2, arg3, arg4, &err)) { + put_register(D0, err); + return 0; + } + + return SIGTRAP; +} + +#endif // CYGSEM_REDBOOT_BSP_SYSCALLS diff --git a/ecos/packages/hal/h8300/arch/current/src/redboot_linux_exec.c b/ecos/packages/hal/h8300/arch/current/src/redboot_linux_exec.c new file mode 100644 index 0000000..cdc5d47 --- /dev/null +++ b/ecos/packages/hal/h8300/arch/current/src/redboot_linux_exec.c @@ -0,0 +1,175 @@ +//========================================================================== +// +// redboot_linux_exec.c +// +// RedBoot exec command for Linux booting +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-05-28 +// Purpose: RedBoot exec command for uClinux booting +// +//####DESCRIPTIONEND#### +// +//=========================================================================== + +#include <redboot.h> + +#include <cyg/infra/cyg_type.h> +#include <cyg/hal/hal_intr.h> +#include <cyg/hal/hal_cache.h> + +#define xstr(s) str(s) +#define str(s...) #s + +#if defined(CYGDAT_REDBOOT_H8300_LINUX_COMMAND_START) +static void +do_exec(int argc, char *argv[]) +{ + cyg_uint32 entry = CYGDAT_REDBOOT_H8300_LINUX_BOOT_ENTRY; + cyg_uint32 command_addr = CYGDAT_REDBOOT_H8300_LINUX_COMMAND_START; + char *cmd_line = xstr( CYGDAT_REDBOOT_H8300_LINUX_BOOT_COMMAND_LINE ); + + bool command_addr_set,command_line_set; + + struct option_info opts[2]; + char *pcmd; + int oldints; + + init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, + &command_addr, &command_addr_set, "command line address"); + init_opts(&opts[1], 'c', true, OPTION_ARG_TYPE_STR, + &cmd_line, &command_line_set, "kernel command line"); + + if (!scan_opts(argc, argv, 1, opts, 2, (void *)&entry, + OPTION_ARG_TYPE_NUM, "entry address")) + return ; + if (entry == (unsigned long)NO_MEMORY) { + diag_printf("Can't execute Linux - invalid entry address\n"); + return; + } + + diag_printf("Now booting linux kernel:\n"); + diag_printf(" Entry Address 0x%08x\n", entry); + diag_printf(" Cmdline : %s\n", cmd_line); + + HAL_DISABLE_INTERRUPTS(oldints); + HAL_DCACHE_SYNC(); + HAL_ICACHE_DISABLE(); + HAL_DCACHE_DISABLE(); + HAL_DCACHE_SYNC(); + HAL_ICACHE_INVALIDATE_ALL(); + HAL_DCACHE_INVALIDATE_ALL(); + + pcmd = (char *)command_addr; + while ((*pcmd++ = *cmd_line++)); + + asm ("jmp @%0" : : "r" (entry)); +} + +RedBoot_cmd("exec", + "Execute an image", + "[-b <command line addr>] [-c \"kernel command line\"]\n" + " [<entry point>]", + do_exec + ); +#endif + +static void +do_set_mem(int argc, char *argv[]) +{ + struct option_info opts[5]; + unsigned long base, data; + bool base_set, data_set,len_set = 0; + static char _size = 1; + bool set_32bit, set_16bit, set_8bit; + + init_opts(&opts[0], 'b', true, OPTION_ARG_TYPE_NUM, + &base, (bool *)&base_set, "base address"); + init_opts(&opts[1], 'd', true, OPTION_ARG_TYPE_NUM, + &data, (bool *)&data_set, "write_data"); + init_opts(&opts[2], '4', false, OPTION_ARG_TYPE_FLG, + &set_32bit, (bool *)0, "dump 32 bit units"); + init_opts(&opts[3], '2', false, OPTION_ARG_TYPE_FLG, + &set_16bit, (bool *)0, "dump 16 bit units"); + init_opts(&opts[4], '1', false, OPTION_ARG_TYPE_FLG, + &set_8bit, (bool *)0, "dump 8 bit units"); + if (!scan_opts(argc, argv, 1, opts, 5, 0, 0, "")) { + return; + } + if (!base_set) { + diag_printf("illigal base\n"); + return ; + } + + if (!data_set) { + diag_printf("illigal data\n"); + return ; + } + + if (set_32bit) { + _size = 4; + } else if (set_16bit) { + _size = 2; + } else if (set_8bit) { + _size = 1; + } + + if (!len_set) { + _size = 4; + } + diag_printf("%d %x = %x\n",_size,base,data); + switch( _size ) { + case 1: + *(unsigned char *)base=data; + break; + case 2: + *(unsigned short *)base=data; + break; + case 4: + *(unsigned long *)base=data; + break; + } +} + +RedBoot_cmd("set", + "Set Memory", + "-b address -[1|2|4] -d data", + do_set_mem + ); + diff --git a/ecos/packages/hal/h8300/arch/current/src/sci.c b/ecos/packages/hal/h8300/arch/current/src/sci.c new file mode 100644 index 0000000..1d388ac --- /dev/null +++ b/ecos/packages/hal/h8300/arch/current/src/sci.c @@ -0,0 +1,313 @@ +//============================================================================= +// +// sci.c +// +// Simple driver for the H8/300 Serial Communication Interface (SCI) +// +//============================================================================= +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): ysato +// Contributors:ysato +// Date: 2002-03-21 +// Description: Simple driver for the H8/300 Serial Communication Interface +// Clients of this file can configure the behavior with: +// CYGNUM_SCI_PORTS: number of SCI ports +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include <pkgconf/hal.h> + +#ifdef CYGNUM_HAL_H8300_SCI_PORTS + +#include <cyg/hal/hal_io.h> // IO macros +#include <cyg/hal/drv_api.h> // CYG_ISR_HANDLED +#include <cyg/hal/hal_misc.h> // Helper functions +#include <cyg/hal/hal_intr.h> // HAL_ENABLE/MASK/UNMASK_INTERRUPTS +#include <cyg/hal/hal_arch.h> // SAVE/RESTORE GP +#include <cyg/hal/hal_if.h> // Calling-if API +#include <cyg/hal/mod_regs_sci.h> // serial register definitions + +#include <cyg/hal/h8_sci.h> // our header + +//-------------------------------------------------------------------------- + +void +cyg_hal_plf_sci_init_channel(void* chan) +{ + cyg_uint8 tmp; + cyg_uint8* base = ((channel_data_t *)chan)->base; + + // Disable Tx/Rx interrupts, but enable Tx/Rx + HAL_WRITE_UINT8(base+_REG_SCSCR, + CYGARC_REG_SCSCR_TE|CYGARC_REG_SCSCR_RE); + + // 8-1-no parity. + HAL_WRITE_UINT8(base+_REG_SCSMR, 0); + + // Set speed to CYGNUM_HAL_H8300_SCI_DEFAULT_BAUD_RATE + HAL_READ_UINT8(base+_REG_SCSMR, tmp); + tmp &= ~CYGARC_REG_SCSMR_CKSx_MASK; + tmp |= CYGARC_SCBRR_CKSx(CYGNUM_HAL_H8300_SCI_BAUD_RATE); + HAL_WRITE_UINT8(base+_REG_SCSMR, tmp); + HAL_WRITE_UINT8(base+_REG_SCBRR, CYGARC_SCBRR_N(CYGNUM_HAL_H8300_SCI_BAUD_RATE)); +} + +static cyg_bool +cyg_hal_plf_sci_getc_nonblock(void* __ch_data, cyg_uint8* ch) +{ + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + cyg_uint8 sr; + + HAL_READ_UINT8(base+_REG_SCSSR, sr); + if (sr & CYGARC_REG_SCSSR_ORER) { + // Serial RX overrun. Clear error and let caller try again. + HAL_WRITE_UINT8(base+_REG_SCSSR, + CYGARC_REG_SCSSR_CLEARMASK & ~CYGARC_REG_SCSSR_ORER); + return false; + } + + if ((sr & CYGARC_REG_SCSSR_RDRF) == 0) + return false; + + HAL_READ_UINT8(base+_REG_SCRDR, *ch); + + // Clear buffer full flag. + HAL_WRITE_UINT8(base+_REG_SCSSR, sr & ~CYGARC_REG_SCSSR_RDRF); + return true; +} + +cyg_uint8 +cyg_hal_plf_sci_getc(void* __ch_data) +{ + cyg_uint8 ch; + CYGARC_HAL_SAVE_GP(); + + while(!cyg_hal_plf_sci_getc_nonblock(__ch_data, &ch)); + + CYGARC_HAL_RESTORE_GP(); + return ch; +} + +void +cyg_hal_plf_sci_putc(void* __ch_data, cyg_uint8 c) +{ + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + cyg_uint8 sr; + CYGARC_HAL_SAVE_GP(); + + do { + HAL_READ_UINT8(base+_REG_SCSSR, sr); + } while ((sr & CYGARC_REG_SCSSR_TDRE) == 0); + + HAL_WRITE_UINT8(base+_REG_SCTDR, c); + + // Clear empty flag. + HAL_WRITE_UINT8(base+_REG_SCSSR, sr & ~CYGARC_REG_SCSSR_TDRE); + + // Hang around until the character has been safely sent. + do { + HAL_READ_UINT8(base+_REG_SCSSR, sr); + } while ((sr & CYGARC_REG_SCSSR_TDRE) == 0); + + CYGARC_HAL_RESTORE_GP(); +} + + +static channel_data_t channels[CYGNUM_HAL_H8300_SCI_PORTS]; + +static void +cyg_hal_plf_sci_write(void* __ch_data, const cyg_uint8* __buf, + cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + cyg_hal_plf_sci_putc(__ch_data, *__buf++); + + CYGARC_HAL_RESTORE_GP(); +} + +static void +cyg_hal_plf_sci_read(void* __ch_data, cyg_uint8* __buf, cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP(); + + while(__len-- > 0) + *__buf++ = cyg_hal_plf_sci_getc(__ch_data); + + CYGARC_HAL_RESTORE_GP(); +} + +cyg_bool +cyg_hal_plf_sci_getc_timeout(void* __ch_data, cyg_uint8* ch) +{ + channel_data_t* chan = (channel_data_t*)__ch_data; + int delay_count; + cyg_bool res; + CYGARC_HAL_SAVE_GP(); + + delay_count = chan->msec_timeout * 20; // delay in .1 ms steps + + for(;;) { + res = cyg_hal_plf_sci_getc_nonblock(__ch_data, ch); + if (res || 0 == delay_count--) + break; + + CYGACC_CALL_IF_DELAY_US(50); + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +static int +cyg_hal_plf_sci_control(void *__ch_data, __comm_control_cmd_t __func, ...) +{ + static int irq_state = 0; + channel_data_t* chan = (channel_data_t*)__ch_data; + cyg_uint8 scr; + int ret = 0; + CYGARC_HAL_SAVE_GP(); + + switch (__func) { + case __COMMCTL_IRQ_ENABLE: + irq_state = 1; + HAL_INTERRUPT_UNMASK(chan->isr_vector); + break; + case __COMMCTL_IRQ_DISABLE: + ret = irq_state; + irq_state = 0; + HAL_INTERRUPT_MASK(chan->isr_vector); + break; + case __COMMCTL_DBG_ISR_VECTOR: + ret = chan->isr_vector; + break; + case __COMMCTL_SET_TIMEOUT: + { + va_list ap; + + va_start(ap, __func); + + ret = chan->msec_timeout; + chan->msec_timeout = va_arg(ap, cyg_uint32); + + va_end(ap); + } + default: + break; + } + CYGARC_HAL_RESTORE_GP(); + return ret; +} + +static int +cyg_hal_plf_sci_isr(void *__ch_data, int* __ctrlc, + CYG_ADDRWORD __vector, CYG_ADDRWORD __data) +{ + cyg_uint8 c, sr; + cyg_uint8* base = ((channel_data_t*)__ch_data)->base; + int res = 0; + CYGARC_HAL_SAVE_GP(); + + *__ctrlc = 0; + HAL_READ_UINT8(base+_REG_SCSSR, sr); + if (sr & CYGARC_REG_SCSSR_ORER) { + // Serial RX overrun. Clear error and hope protocol recovers. + HAL_WRITE_UINT8(base+_REG_SCSSR, + CYGARC_REG_SCSSR_CLEARMASK & ~CYGARC_REG_SCSSR_ORER); + res = CYG_ISR_HANDLED; + } else if (sr & CYGARC_REG_SCSSR_RDRF) { + // Received character + HAL_READ_UINT8(base+_REG_SCRDR, c); + + // Clear buffer full flag. + HAL_WRITE_UINT8(base+_REG_SCSSR, + CYGARC_REG_SCSSR_CLEARMASK & ~CYGARC_REG_SCSSR_RDRF); + + if( cyg_hal_is_break( &c , 1 ) ) + *__ctrlc = 1; + + res = CYG_ISR_HANDLED; + } + + CYGARC_HAL_RESTORE_GP(); + return res; +} + +void +cyg_hal_plf_sci_init(int sci_index, int comm_index, + int rcv_vect, cyg_uint8* base) +{ + channel_data_t* chan = &channels[sci_index]; + hal_virtual_comm_table_t* comm; + int cur = CYGACC_CALL_IF_SET_CONSOLE_COMM(CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + // Initialize channel table + chan->base = base; + chan->isr_vector = rcv_vect; + chan->msec_timeout = 1000; + + // Disable interrupts. + HAL_INTERRUPT_MASK(chan->isr_vector); + + // Init channel + + cyg_hal_plf_sci_init_channel(chan); + + // Setup procs in the vector table + + // Initialize channel procs + CYGACC_CALL_IF_SET_CONSOLE_COMM(comm_index); + comm = CYGACC_CALL_IF_CONSOLE_PROCS(); + CYGACC_COMM_IF_CH_DATA_SET(*comm, chan); + CYGACC_COMM_IF_WRITE_SET(*comm, cyg_hal_plf_sci_write); + CYGACC_COMM_IF_READ_SET(*comm, cyg_hal_plf_sci_read); + CYGACC_COMM_IF_PUTC_SET(*comm, cyg_hal_plf_sci_putc); + CYGACC_COMM_IF_GETC_SET(*comm, cyg_hal_plf_sci_getc); + CYGACC_COMM_IF_CONTROL_SET(*comm, cyg_hal_plf_sci_control); + CYGACC_COMM_IF_DBG_ISR_SET(*comm, cyg_hal_plf_sci_isr); + CYGACC_COMM_IF_GETC_TIMEOUT_SET(*comm, cyg_hal_plf_sci_getc_timeout); + + // Restore original console + CYGACC_CALL_IF_SET_CONSOLE_COMM(cur); +} + +#endif // CYGNUM_HAL_H8300_SCI_PORTS + +//----------------------------------------------------------------------------- +// end of sci.c diff --git a/ecos/packages/hal/h8300/arch/current/src/vectors.S b/ecos/packages/hal/h8300/arch/current/src/vectors.S new file mode 100644 index 0000000..228dc95 --- /dev/null +++ b/ecos/packages/hal/h8300/arch/current/src/vectors.S @@ -0,0 +1,706 @@ +##============================================================================= +## +## vectors.S +## +## H8/300 exception vectors +## +##============================================================================= +## ####ECOSGPLCOPYRIGHTBEGIN#### +## ------------------------------------------- +## This file is part of eCos, the Embedded Configurable Operating System. +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +## +## This exception does not invalidate any other reasons why a work based +## on this file might be covered by the GNU General Public License. +## ------------------------------------------- +## ####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): Yoshinori Sato +## Contributors: Yoshinori Sato +## Date: 2002-02-14 +## Purpose: H8/300 exception vectors +## Description: This file defines the code placed into the exception +## vectors. It also contains the first level default VSRs +## that save and restore state for both exceptions and +## interrupts. +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include <pkgconf/hal.h> + +#ifdef CYGPKG_REDBOOT +#include <pkgconf/redboot.h> +#endif + +#ifdef CYGPKG_KERNEL + +#include <pkgconf/kernel.h> + +#endif + +#include <cyg/hal/arch.inc> +#include <cyg/hal/basetype.h> +#include <cyg/hal/variant.inc> + + +##----------------------------------------------------------------------------- + +#ifdef CYGPKG_HAL_H8300_H8300H + .h8300h + .macro shll2 reg + shll.l \reg + shll.l \reg + .endm + .macro shlr2 reg + shlr.l \reg + shlr.l \reg + .endm +#endif +#ifdef CYGPKG_HAL_H8300_H8S + .h8300s + .macro shll2 reg + shll.l #2,\reg + .endm + .macro shlr2 reg + shlr.l #2,\reg + .endm +#endif + +#ifdef CYGPKG_CYGMON +##----------------------------------------------------------------------------- +## Macros for Stack handling when running Cygmon + +.macro hal_cygmon_switch_app_stack +#ifdef CYGPKG_HAL_H8300_H8300H + ; Switch to interrupt stack to handle exception + + ; First, save some scratch registers + mov.l er0,@-sp + mov.l er1,@-sp + + ; Copy the exception frame + mov.l #__cygmon_interrupt_stack,er0 + mov.l @(8:16,sp),er1 + mov.l er1,@-er0 + + ; Save the pre-exception sp in the register image + mov.l sp,@-er0 + + ; Actually switch the stack + mov.l er0,sp + + mov.l @sp,er0 + adds #4,er0 + adds #4,er0 + mov.l er0,@sp + + ; Now, restore the scratch registers + mov.l @(-4:16,er0),er1 + mov.l @(-8:16,er0),er0 +#endif +#ifdef CYGPKG_HAL_H8300_H8S + ; Switch to interrupt stack to handle exception + + ; First, save some scratch registers + stm.l er0-er1,@-sp + + ; Copy the exception frame + mov.l #__cygmon_interrupt_stack,er0 + mov.l @(10,sp:16),er1 + mov.l er1,@-er0 + mov.w @(10,sp:16),r1 + mov.w r1,@-er0 + + ; Save the pre-exception sp in the register image + mov.l sp,@-er0 + + ; Actually switch the stack + mov.l er0,sp + + mov.l @sp,er0 + adds #4,er0 + adds #4,er0 + mov.l er0,@sp + + ; Now, restore the scratch registers + mov.l @(-4:16,er0),er1 + mov.l @(-8:16,er0),er0 +#endif +.endm + +.macro hal_cygmon_restore_app_stack + // For cygmon we are switching stacks immediately on exception. + // We must wait until the very end before restoring the original stack. + +#ifdef CYGPKG_HAL_H8300_H8300H + ; Save some scratch registers + subs #4,sp + mov.l er0,@-sp + mov.l er1,@-sp + + ; We need to restore the application stack pointer, but we also + ; need to restore the exception frame. + mov.l @(12:16,sp),er0 + mov.l @(16:16,sp),er1 + mov.l er1,@er0 + mov.l er0,@(8:16,sp) + + ; Restore the scratch registers + mov.l @sp+,er1 + mov.l @sp+,er0 + mov.l @sp+,sp // Restore the frame-adjusted SP +#endif +#ifdef CYGPKG_HAL_H8300_H8S + ; Save some scratch registers + subs #4,sp + stm.l er0-er1,@-sp + + ; We need to restore the application stack pointer, but we also + ; need to restore the exception frame. + mov.l @(12:16,sp),er0 + mov.w @(16:16,sp),r1 + mov.w r1,@er0 + mov.l @(18:16,sp),er1 + mov.l er1,@er0 + mov.l er0,@(8:16,sp) + + ; Restore the scratch registers + ldm.l @sp+,er0-er1 + mov.l @sp+,sp // Restore the frame-adjusted SP +#endif +.endm + +#endif // CYGPKG_CYGMON + +##----------------------------------------------------------------------------- + +#if (defined(CYG_HAL_STARTUP_ROM) || \ + defined(CYGPKG_HAL_H8300_H8300H_SIM) || \ + defined(CYGPKG_HAL_H8300_H8S_SIM)) + + .section .vectors,"a" + + .globl reset_vector + +reset_vector: + .long CYG_LABEL_DEFN(_start) + .long CYG_LABEL_DEFN(_start) +vector = 2 + .rept CYG_ISR_TABLE_SIZE-2 + .long interrupt_redirect_table+vector*4 +vector = vector + 1 + .endr +#endif + +#if !defined(CYGSEM_HAL_H8300_VECTOR_HOOK) + .section .int_hook_table,"ax" +interrupt_redirect_table: +vector = 0 + .rept CYG_ISR_TABLE_SIZE + jsr @interrupt_entry +vector = vector + 1 + .endr +#else + .section .int_hook_table,"x" +interrupt_redirect_table: + .space 4*CYG_ISR_TABLE_SIZE +#endif + +##----------------------------------------------------------------------------- +## Startup code + + .text + + .globl CYG_LABEL_DEFN(_start) +CYG_LABEL_DEFN(_start): + ; set up stack + + mov.l #__interrupt_stack,sp + + ; Initialize hardware + hal_cpu_init + hal_mmu_init + hal_memc_init + hal_diag_init + hal_intc_init + hal_cache_init + hal_timer_init + hal_mon_init + +#ifdef CYG_HAL_STARTUP_ROM + + ; Copy data from ROM to RAM + + mov.l #CYG_LABEL_DEFN(__rom_data_start),er5 + mov.l #CYG_LABEL_DEFN(__ram_data_start),er6 + mov.l #CYG_LABEL_DEFN(__ram_data_end),er4 + sub.l er6,er4 + shlr2 er4 +1: + mov.l @er5+,er0 + mov.l er0,@er6 + adds #4,er6 + dec.l #1,er4 + bne 1b + +#endif + +#if defined(CYGSEM_HAL_H8300_VECTOR_HOOK) + ; Setup Interrupt Vector (virtual) + + ;; check rom table + mov.l #8*4,er0 + mov.l @er0+,er1 + adds #4,er1 + mov.b #3,r3l +1: + mov.l @er0+,er2 + cmp.l er1,er2 + bne 3f + adds #4,er1 + dec.b r3l + bne 1b + ;; calculate vector address + mov.l @8*4,er0 + and.w #0xff,e0 + sub.l #8*4,er0 + ;; build ram vector + mov.l er0,@__interrupt_table + mov.l #0x5e000000+interrupt_entry,er1 + mov.l #save_vector_table,er3 + mov.b #0,r2l +2: + ;; check saved vector + mov.b @er3+,r2h + cmp.b r2l,r2h + beq 5f + subs #1,er3 + mov.l er1,@er0 +5: + adds #4,er0 + inc.b r2l + cmp.b #CYG_ISR_TABLE_SIZE,r2l + bcs 2b + bra 4f +3: + bra 3b +4: + +#else + mov.l #interrupt_redirect_table,er0 + mov.l er0,@__interrupt_table +#endif + + ; Clear BSS + mov.l #CYG_LABEL_DEFN(__bss_start),er5 + mov.l #CYG_LABEL_DEFN(__bss_end),er4 + sub.l #CYG_LABEL_DEFN(__bss_start),er4 + shlr2 er4 + sub.l er0,er0 +1: + mov.l er0,@er5 + adds #4,er5 + dec.l #1,er4 + bne 1b + + ; Call variant and platform HAL + ; initialization routines. + + .extern CYG_LABEL_DEFN(hal_variant_init) + jsr @CYG_LABEL_DEFN(hal_variant_init) + + .extern CYG_LABEL_DEFN(hal_platform_init) + jsr @CYG_LABEL_DEFN(hal_platform_init) + + ; Call constructors + + .extern CYG_LABEL_DEFN(cyg_hal_invoke_constructors) + jsr @CYG_LABEL_DEFN(cyg_hal_invoke_constructors) + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + .extern CYG_LABEL_DEFN(initialize_stub) + jsr @CYG_LABEL_DEFN(initialize_stub) +#endif + +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) \ + || defined(CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT) + .extern CYG_LABEL_DEFN(hal_ctrlc_isr_init) + jsr @CYG_LABEL_DEFN(hal_ctrlc_isr_init) +#endif + + + ; Call cyg_start + sub.l er0,er0 + + .extern CYG_LABEL_DEFN(cyg_start) + jsr @CYG_LABEL_DEFN(cyg_start) + +9: + bra 9b ; Loop if we return + +save_vector_table: +#if defined(CYGSEM_HAL_H8300_SAVE_STUB_VECTOR) + .byte 5,11 +#if defined(CYGPKG_HAL_H8300_SAVED_VECTORS) + h8300_save_vectors +#endif +#endif + .byte 0 ; end maker + .align 2 + +interrupt_entry: + mov.l er0,@-sp + mov.l @(4:16,sp),er0 ; interrupt vector offset + mov.l er1,@-sp + mov.l @__interrupt_table,er1 + sub.l er1,er0 + shlr2 er0 + dec.l #1,er0 + mov.l er0,@CYG_LABEL_DEFN(_intvector) + mov.l @sp+,er1 + mov.l @sp+,er0 + adds #4,sp +#ifdef CYGPKG_CYGMON + hal_cygmon_switch_app_stack +#endif + hal_cpu_save_all + h8300_var_interrupt_entry ; load isr address + jmp @er0 + +##----------------------------------------------------------------------------- +## The following macros are defined depending on whether the HAL is configured +## to support the kernel or not. + +#ifdef CYGFUN_HAL_COMMON_KERNEL_SUPPORT + + .extern CYG_LABEL_DEFN(cyg_scheduler_sched_lock) + + ; Increment the scheduler lock + + .macro increment_sched_lock reg=er0 + mov.l @CYG_LABEL_DEFN(cyg_scheduler_sched_lock),\reg + inc.l #1,\reg + mov.l \reg,@CYG_LABEL_DEFN(cyg_scheduler_sched_lock) + .endm + +#else + + .macro increment_sched_lock reg=er0 + .endm + +#endif + +##----------------------------------------------------------------------------- +## Default interrupt VSR + + .text + .globl CYG_LABEL_DEFN(__default_interrupt_vsr) +CYG_LABEL_DEFN(__default_interrupt_vsr): + + ; We come here with all the registers pushed + ; onto the stack. + + hal_diag_intr_start + + increment_sched_lock + +#if defined(CYGPKG_CYGMON) + // For Cygmon, we saved this back when we originally switched stacks. + mov.l sp,er1 ; A2 = saved thread state +#elif defined(CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK) + ; Increment interrupt nesting counter + mov.l sp,er1 + mov.l #__interrupt_stack,er0 ; A0 = interrupt stack top + cmp.l #__interrupt_stack_base,sp ; compare with base of stack + blt 1f ; if lt switch to int stack + cmp.l er0,sp ; compare sp with stack top + ble 8f ; if le already on istack +1: + mov.l er0,sp ; switch to new SP +8: + mov.l er1,@-sp ; save old SP + +#else + mov sp,er1 ; A2 = saved thread state +#endif + mov.l er1,er4 + + ; Here D3 contains the table byte offset of the vector to + ; call. + +#if defined(CYGPKG_KERNEL_INSTRUMENT) && defined(CYGDBG_KERNEL_INSTRUMENT_INTR) + + ; Call cyg_instrument to record that this interrupt is being raised. + + .extern CYG_LABEL_DEFN(cyg_instrument) + mov.l #0x0301,er0 ; type = INTR,RAISE + mov.l @CYG_LABEL_DEFN(_intvector),er2 ; arg2 = table offset + jsr CYG_LABEL_DEFN(cyg_instrument) ; call instrumentation + +#endif + +#ifdef CYGSEM_HAL_COMMON_INTERRUPTS_ALLOW_NESTING + + ; To allow nested interrupts, we set the IE bit. We do + ; not touch the IPL bits, so only higher priority interrupts + ; will be nested on top of us. Also, new interrupts will not + ; be delivered until the ISR calls + ; Cyg_Interrupt::acknowledge_interrupt(). At some future point + ; we may want to do the ack stuff here to allow immediate nesting. + + mov.l @CYG_LABEL_DEFN(_intvector),er0 + mov.b @(CYG_LABEL_DEFN(cyg_hal_level_table),er0),r0l + hal_cpu_set_int_level +#endif +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) || \ + defined(CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT) + + ; If we have Ctrl-C support enabled, save a pointer to the + ; saved CPU state here so we can plant a breakpoint there if + ; this is a ^C. + + .extern CYG_LABEL_DEFN(hal_saved_interrupt_state) + mov.l er4,@CYG_LABEL_DEFN(hal_saved_interrupt_state) + +#endif + mov.l @CYG_LABEL_DEFN(_intvector),er0 + shll2 er0 + mov.l @(CYG_LABEL_DEFN(hal_interrupt_handlers),er0),er2 + + mov.l @(CYG_LABEL_DEFN(hal_interrupt_data),er0),er1 + + shlr2 er0 + + jsr @er2 + + ; on return d0 bit 1 will indicate whether a DSR is + ; to be posted. Pass this together with a pointer to + ; the interrupt object we have just used to the + ; interrupt tidy up routine. + + ; D3 is defined to be saved across procedure calls, and + ; should still contain the vector byte index. Similarly, + ; A2 should still point to the saved machine state. + +#ifdef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + ; If interrupt was caused by GDB, the ISR call above + ; is skipped by jumping here. +2: +#endif + +#if defined(CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK) && !defined(CYGPKG_CYGMON) + + ; If we are returning from the last nested interrupt, move back + ; to the thread stack. interrupt_end() must be called on the + ; thread stack since it potentially causes a context switch. + + mov.l @sp+,sp ; pop old sp + +#endif + +#ifdef CYGFUN_HAL_COMMON_KERNEL_SUPPORT + + ; We only need to call _interrupt_end() when there is a kernel + ; present to do any tidying up. + + ; Using the vector offset in D3, get the interrupt object pointer + ; into D1. + mov.l @CYG_LABEL_DEFN(_intvector),er1 + shll2 er1 + mov.l @(CYG_LABEL_DEFN(hal_interrupt_objects),er1),er1 + + ; Even when this is not the last nested interrupt, we must call + ; _interrupt_end() to post the DSR and decrement the scheduler + ; lock. + + mov.l er3,er2 ; arg3 = saved state. + + jsr @CYG_LABEL_DEFN(interrupt_end) ; call interrupt end fn +#endif + + +# show_interrupts + + hal_diag_restore + + hal_cpu_load_all +#ifdef CYGPKG_CYGMON + hal_cygmon_restore_app_stack +#endif + mov.l er0,@-sp + mov.l @(4:16,sp),er0 + mov.l er0,@__lastpc + mov.l @sp+,er0 + + rte ; and return + + .section .bss + .global CYG_LABEL_DEFN(_intvector) +CYG_LABEL_DEFN(_intvector): + .long 0 + .global __lastpc +__lastpc: + .long 0 +__interrupt_table: + .long 0 + + .text +##----------------------------------------------------------------------------- +## Execute pending DSRs on the interrupt stack with interrupts enabled. +## Note: this can only be called from code running on a thread stack + +#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK + .extern CYG_LABEL_DEFN(cyg_interrupt_call_pending_DSRs) + .global CYG_LABEL_DEFN(hal_interrupt_stack_call_pending_DSRs) + +CYG_LABEL_DEFN(hal_interrupt_stack_call_pending_DSRs): + h8300_var_call_pending_DSR +#endif + +##----------------------------------------------------------------------------- +## Default TRAP VSR + + .text + .globl CYG_LABEL_DEFN(__default_trap_vsr) +CYG_LABEL_DEFN(__default_trap_vsr): + +#ifdef CYG_HAL_DIAG_EXCPT_END + hal_diag_excpt_start +#endif + mov.l @CYG_LABEL_DEFN(_intvector),er1 + cmp.l #11,er1 ; Adjust trap entry address + bne 1f + h8300_trap_adjust_pc +1: + mov.l sp,er0 + jsr @CYG_LABEL_DEFN(cyg_hal_exception_handler) + +#ifdef CYG_HAL_DIAG_EXCPT_END + hal_diag_excpt_end +#endif + hal_cpu_load_all +#ifdef CYGPKG_CYGMON + hal_cygmon_restore_app_stack +#endif + rte + +##----------------------------------------------------------------------------- +## VSR table. The VSRs pointed to by this table are called from the stubs +## connected to the hardware. + +#ifndef CYG_HAL_H8300_VSR_TABLE_DEFINED + + .data + + .globl CYG_LABEL_DEFN(hal_vsr_table) +CYG_LABEL_DEFN(hal_vsr_table): + .long CYG_LABEL_DEFN(__default_trap_vsr) + .long CYG_LABEL_DEFN(__default_trap_vsr) + .long 0 + .long 0 + .long 0 + .long CYG_LABEL_DEFN(__default_trap_vsr) + .long CYG_LABEL_DEFN(__default_trap_vsr) + .long CYG_LABEL_DEFN(__default_trap_vsr) + .long CYG_LABEL_DEFN(__default_trap_vsr) + .long CYG_LABEL_DEFN(__default_trap_vsr) + .long CYG_LABEL_DEFN(__default_trap_vsr) + .long CYG_LABEL_DEFN(__default_trap_vsr) + + .rept CYG_ISR_TABLE_SIZE-12 + .long CYG_LABEL_DEFN(__default_interrupt_vsr) + .endr +#endif + +##----------------------------------------------------------------------------- +## Interrupt tables + + .data + + .extern CYG_LABEL_DEFN(hal_default_isr) + + .globl CYG_LABEL_DEFN(hal_interrupt_handlers) +CYG_LABEL_DEFN(hal_interrupt_handlers): + .rept CYG_ISR_TABLE_SIZE + .long CYG_LABEL_DEFN(hal_default_isr) + .endr + + .globl CYG_LABEL_DEFN(hal_interrupt_data) +CYG_LABEL_DEFN(hal_interrupt_data): + .rept CYG_ISR_TABLE_SIZE + .long 0 + .endr + + .globl CYG_LABEL_DEFN(hal_interrupt_objects) +CYG_LABEL_DEFN(hal_interrupt_objects): + .rept CYG_ISR_TABLE_SIZE + .long 0 + .endr + + +##----------------------------------------------------------------------------- +## Temporary interrupt stack + + .section .bss + + .balign 2 + .global _cyg_interrupt_stack_base +_cyg_interrupt_stack_base: +__interrupt_stack_base: + .rept CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE + .byte 0 + .endr + .balign 2 + .global _cyg_interrupt_stack +_cyg_interrupt_stack: +__interrupt_stack: + +#ifdef CYGPKG_CYGMON + .balign 2 + .global __cygmon_interrupt_stack_base +__cygmon_interrupt_stack_base: + .rept CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE + .byte 0 + .endr + .balign 2 + .global __cygmon_interrupt_stack +__cygmon_interrupt_stack: +#endif + + .long 0,0,0,0,0,0,0,0 + +##----------------------------------------------------------------------------- + + .data + hal_diag_data + + +##----------------------------------------------------------------------------- +## end of vectors.S + diff --git a/ecos/packages/hal/h8300/edosk2674/current/ChangeLog b/ecos/packages/hal/h8300/edosk2674/current/ChangeLog new file mode 100644 index 0000000..308624a --- /dev/null +++ b/ecos/packages/hal/h8300/edosk2674/current/ChangeLog @@ -0,0 +1,58 @@ +2009-01-31 Bart Veer <bartv@ecoscentric.com> + + * cdl/hal_h8300_h8s_edosk2674.cdl: update compiler flags for gcc 4.x + +2004-03-18 Yoshinori Sato <ysato@users.sourceforge.jp> + + * include/hal_diag.h + fix warning. + +2004-03-02 Yoshinori Sato <ysato@users.sourceforge.jp> + + * include/platform.inc + add h8300_save_vectors macro. + +2004-02-24 Yoshinori Sato <ysato@users.sourceforge.jp> + + * cdl/hal_h8300_h8s_edosk2674.cdl + add Linker flags "-mrelax" + move CYGSEM_HAL_H8300_VECTOR_HOOK to hal_h8300.cdl + +2003-12-04 Uwe Kindler <ukindler@htwm.de>,Yoshinori Sato <ysato@users.sourceforge.jp> + + * include/platform.inc + fix ISCR setup. + +2003-11-29 Yoshinori Sato <ysato@users.sourceforge.jp> + + * include/plf_intr.h + target name fix + + +2003-02-21 Yoshinori Sato <qzb04471@nifty.ne.jp> + + * New package. + +//=========================================================================== +// ####GPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +// +// This program 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. +// +// This program 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 this program; if not, write to the +// Free Software Foundation, Inc., 51 Franklin Street, +// Fifth Floor, Boston, MA 02110-1301, USA. +// ------------------------------------------- +// ####GPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/ecos/packages/hal/h8300/edosk2674/current/cdl/hal_h8300_h8s_edosk2674.cdl b/ecos/packages/hal/h8300/edosk2674/current/cdl/hal_h8300_h8s_edosk2674.cdl new file mode 100644 index 0000000..2552b30 --- /dev/null +++ b/ecos/packages/hal/h8300/edosk2674/current/cdl/hal_h8300_h8s_edosk2674.cdl @@ -0,0 +1,290 @@ +# ==================================================================== +# +# hal_h8300_h8s_edosk2674.cdl +# +# EDOSK-2674 HAL package configuration data +# +# ==================================================================== +## ####ECOSGPLCOPYRIGHTBEGIN#### +## ------------------------------------------- +## This file is part of eCos, the Embedded Configurable Operating System. +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +## +## This exception does not invalidate any other reasons why a work based +## on this file might be covered by the GNU General Public License. +## ------------------------------------------- +## ####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): yoshinori sato +# Original data: yoshinori sato +# Contributors: +# Date: 2003-02-24 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_H8300_H8S_EDOSK2674 { + display "EDOSK2674" + parent CYGPKG_HAL_H8300 + requires CYGPKG_HAL_H8300_H8S + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + define_header hal_h8300_h8s_edosk2674.h + include_dir cyg/hal + description " + The edosk2674 HAL package provides the support needed to run + eCos on a Hitach Micro System Europe EDOSK2674 evalution board." + + compile hal_diag.c plf_misc.c delay_us.S + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H <pkgconf/hal_h8300_h8s.h>" + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H <pkgconf/hal_h8300_h8s_edosk2674.h>" + + puts $::cdl_header "#define CYG_HAL_H8300" + puts $::cdl_header "#define CYGNUM_HAL_H8300_SCI_PORTS 2" + puts $::cdl_header "#define CYGHWR_HAL_VECTOR_TABLE 0xffbd00" + puts $::cdl_header "#define HAL_PLATFORM_CPU \"H8S\"" + puts $::cdl_header "#define HAL_PLATFORM_BOARD \"EDOSK-2674\"" + puts $::cdl_header "#define HAL_PLATFORM_EXTRA \"\"" + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + legal_values {"ROM" "RAM"} + default_value {"ROM"} + no_define + define -file system.h CYG_HAL_STARTUP + description " + When targetting the EDOSK2674 board it is possible to + build the system for either RAM bootstrap or ROM bootstrap. + RAM bootstrap generally requires that the board + is equipped with ROMs containing a suitable ROM monitor or + equivalent software that allows GDB to download the eCos + application and extend Memory on to the board. + The ROM bootstrap typically + requires that the eCos application be blown into EPROMs or + equivalent technology." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 1 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The EDOSK2674 board has only one serial port. This option + chooses which port will be used to connect to a host + running GDB." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The CQ/7708 board has only one serial port. This option + chooses which port will be used for diagnostic output." + } + + # 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_H8300_RTC_PRESCALE { + display "Real-time clock base prescale" + flavor data + calculated 8192 + } + # Isn't a nice way to handle freq requirement! + cdl_option CYGNUM_HAL_RTC_PERIOD { + display "Real-time clock period" + flavor data + calculated 10 + } + } + + cdl_option CYGHWR_HAL_H8300_CPG_INPUT { + display "OSC/Clock Freqency" + flavor data + default_value 33000000 + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + parent CYGPKG_NONE + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "h8300-elf" } + 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 { CYGBLD_GLOBAL_WARNFLAGS . " -g -O2 -ms -mint32 -fsigned-char -fdata-sections -fno-rtti -fno-exceptions " } + 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 { "-g -nostdlib -Wl,--gc-sections -Wl,-static -mrelax -ms -mint32" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + cdl_option CYGBLD_BUILD_GDB_STUBS { + display "Build GDB stub ROM image" + default_value 0 + requires CYGSEM_HAL_ROM_MONITOR + requires CYGBLD_BUILD_COMMON_GDB_STUBS + requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + requires CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + requires CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT + no_define + description " + This option enables the building of the GDB stubs for the + board. The common HAL controls takes care of most of the + build process, but the final conversion from ELF image to + binary data is handled by the platform CDL, allowing + relocation of the data if necessary." + + make -priority 320 { + <PREFIX>/bin/gdb_module.bin : <PREFIX>/bin/gdb_module.img + $(OBJCOPY) -O binary $< $@ + } + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { CYG_HAL_STARTUP == "RAM" ? "h8300_h8s_edosk2674_ram" : \ + "h8300_h8s_edosk2674_rom" } + + 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 { CYG_HAL_STARTUP == "RAM" ? "<pkgconf/mlt_h8300_h8s_edosk2674_ram.ldi>" : \ + "<pkgconf/mlt_h8300_h8s_edosk2674_rom.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 { CYG_HAL_STARTUP == "RAM" ? "<pkgconf/mlt_h8300_h8s_edosk2674_ram.h>" : \ + "<pkgconf/mlt_h8300_h8s_edosk2674_rom.h>" } + } + } + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 0 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM" } + description " + Enable this option if this program is to be used as a ROM monitor, + i.e. applications will be loaded into RAM on the board, and this + ROM monitor may process exceptions or interrupts generated from the + application. This enables features such as utilizing a separate + interrupt stack when exceptions are generated." + } + cdl_option CYGHWR_HAL_H8300_VECTOR_ADDRESS { + display "Hook Vector Address" + flavor data + default_value 0xffbe00 + active_if CYGSEM_HAL_H8300_VECTOR_HOOK + parent CYGPKG_HAL_ROM_MONITOR + description " + Hooking Vector Table Address" + } + cdl_option CYGHAL_PLF_SCI_BASE { + display "SCI Base address" + flavor data + default_value 0xffff88 + description " + Used SCI Channel base address." + } + cdl_option CYGDAT_REDBOOT_H8300_LINUX_COMMAND_START { + display "Default kernel command line start address" + flavor data + default_value 0xbffe00 + description " + This option uClinux kernel command line start address of default." + } + + cdl_option CYGDAT_REDBOOT_H8300_LINUX_BOOT_COMMAND_LINE { + display "Default command line" + flavor data + default_value { "console=/dev/ttySC2" } + description " + This option uClinux kernel startup command line of default." + } +} diff --git a/ecos/packages/hal/h8300/edosk2674/current/doc/README b/ecos/packages/hal/h8300/edosk2674/current/doc/README new file mode 100644 index 0000000..911bdf8 --- /dev/null +++ b/ecos/packages/hal/h8300/edosk2674/current/doc/README @@ -0,0 +1,2 @@ +Please visit http://homepage2.nifty.com/ysato/eCos/index.en.html for up to date +information, particularly on which GNU tools to use and patches. diff --git a/ecos/packages/hal/h8300/edosk2674/current/include/hal_diag.h b/ecos/packages/hal/h8300/edosk2674/current/include/hal_diag.h new file mode 100644 index 0000000..fc41afc --- /dev/null +++ b/ecos/packages/hal/h8300/edosk2674/current/include/hal_diag.h @@ -0,0 +1,74 @@ +#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 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-14 +// 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> + +externC void hal_diag_init(void); +externC void hal_diag_write_char(cyg_uint8 c); +externC void hal_diag_read_char(cyg_uint8 *c); + +/*---------------------------------------------------------------------------*/ + +#define HAL_DIAG_INIT() hal_diag_init() + +#define HAL_DIAG_WRITE_CHAR(_c_) hal_diag_write_char(_c_) + +#define HAL_DIAG_READ_CHAR(_c_) hal_diag_read_char(&_c_) + +/*---------------------------------------------------------------------------*/ +/* end of hal_diag.h */ +#endif /* CYGONCE_HAL_HAL_DIAG_H */ diff --git a/ecos/packages/hal/h8300/edosk2674/current/include/pkgconf/mlt_h8300_h8s_edosk2674_ram.h b/ecos/packages/hal/h8300/edosk2674/current/include/pkgconf/mlt_h8300_h8s_edosk2674_ram.h new file mode 100644 index 0000000..5e2c701 --- /dev/null +++ b/ecos/packages/hal/h8300/edosk2674/current/include/pkgconf/mlt_h8300_h8s_edosk2674_ram.h @@ -0,0 +1,14 @@ +// eCos memory layout - Wed Nov 24 13:10:23 1999 + +// This is a generated file - changes will be lost if ConfigTool(MLT) is run + +#ifndef __ASSEMBLER__ +#include <cyg/infra/cyg_type.h> +#include <stddef.h> + +#endif + +#define CYGMEM_REGION_ram (0x420000) +#define CYGMEM_REGION_ram_SIZE (0x7E0000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) + diff --git a/ecos/packages/hal/h8300/edosk2674/current/include/pkgconf/mlt_h8300_h8s_edosk2674_ram.ldi b/ecos/packages/hal/h8300/edosk2674/current/include/pkgconf/mlt_h8300_h8s_edosk2674_ram.ldi new file mode 100644 index 0000000..62b26cd --- /dev/null +++ b/ecos/packages/hal/h8300/edosk2674/current/include/pkgconf/mlt_h8300_h8s_edosk2674_ram.ldi @@ -0,0 +1,29 @@ +// eCos memory layout - Fri Oct 20 08:25:16 2000 + +// This is a generated file - do not edit + +#include <cyg/infra/cyg_type.inc> + +OUTPUT_FORMAT("elf32-h8300") +OUTPUT_ARCH(h8300s) + +MEMORY +{ + ram : ORIGIN = 0x400000, LENGTH = 0x30000 + iram : ORIGIN = 0xff4000, LENGTH = 0x8000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_text (ram, 0x400000, 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 (0x4),LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4),LMA_EQ_VMA) + SECTION_int_hook_table (iram, CYGHWR_HAL_H8300_VECTOR_ADDRESS, FOLLOWING(.data)) + SECTIONS_END +} diff --git a/ecos/packages/hal/h8300/edosk2674/current/include/pkgconf/mlt_h8300_h8s_edosk2674_ram.mlt b/ecos/packages/hal/h8300/edosk2674/current/include/pkgconf/mlt_h8300_h8s_edosk2674_ram.mlt new file mode 100644 index 0000000..764513a --- /dev/null +++ b/ecos/packages/hal/h8300/edosk2674/current/include/pkgconf/mlt_h8300_h8s_edosk2674_ram.mlt @@ -0,0 +1,12 @@ +version 0 +region ram 400000 10000 0 ! +section text 0 1 0 1 0 1 0 1 400000 400000 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 int_hook_table int_hook_table ! +section int_hook_table 0 1 0 1 0 1 0 1 data data ! +section data 0 4 0 1 0 1 0 1 bss bss ! +section bss 0 4 0 1 0 1 0 0 ! + diff --git a/ecos/packages/hal/h8300/edosk2674/current/include/pkgconf/mlt_h8300_h8s_edosk2674_rom.h b/ecos/packages/hal/h8300/edosk2674/current/include/pkgconf/mlt_h8300_h8s_edosk2674_rom.h new file mode 100644 index 0000000..411a0b7 --- /dev/null +++ b/ecos/packages/hal/h8300/edosk2674/current/include/pkgconf/mlt_h8300_h8s_edosk2674_rom.h @@ -0,0 +1,18 @@ +// eCos memory layout - Wed Nov 24 13:10:23 1999 + +// This is a generated file - changes will be lost if ConfigTool(MLT) is run + +#ifndef __ASSEMBLER__ +#include <cyg/infra/cyg_type.h> +#include <stddef.h> + +#endif + +#define CYGMEM_REGION_ram (0x400000) +#if !defined(CYGPKG_IO_ETH_DRIVERS) +#define CYGMEM_REGION_ram_SIZE (0x800000) +#else +#define CYGMEM_REGION_ram_SIZE (0x800000-0xC000) +#endif +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) + diff --git a/ecos/packages/hal/h8300/edosk2674/current/include/pkgconf/mlt_h8300_h8s_edosk2674_rom.ldi b/ecos/packages/hal/h8300/edosk2674/current/include/pkgconf/mlt_h8300_h8s_edosk2674_rom.ldi new file mode 100644 index 0000000..c012ec6 --- /dev/null +++ b/ecos/packages/hal/h8300/edosk2674/current/include/pkgconf/mlt_h8300_h8s_edosk2674_rom.ldi @@ -0,0 +1,47 @@ +// eCos memory layout - Fri Oct 20 08:25:16 2000 + +// This is a generated file - do not edit + +#include <cyg/infra/cyg_type.inc> + +OUTPUT_FORMAT("elf32-h8300") +OUTPUT_ARCH(h8300s) + +MEMORY +{ +#define IRAM_TOP 0xff4000 + rom : ORIGIN = 0x000000, LENGTH = 0x100000 +#if !defined(CYGPKG_IO_ETH_DRIVERS) +#define WORK IRAM_TOP + ram : ORIGIN = WORK, LENGTH = 0x8000 +#else +#define WORK 0xBF4000 + ram : ORIGIN = WORK, LENGTH = 0xC000 + iram : ORIGIN = IRAM_TOP, LENGTH = 0x8000 +#endif +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (rom, 0x000000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x1), LMA_EQ_VMA) +#if !defined(CYGSEM_HAL_H8300_VECTOR_HOOK) + SECTION_int_hook_table (rom, ALIGN (0x2), LMA_EQ_VMA) +#endif + SECTION_gcc_except_table (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_data (ram, WORK,FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x4),LMA_EQ_VMA) +#if defined(CYGSEM_HAL_H8300_VECTOR_HOOK) +#if !defined(CYGPKG_IO_ETH_DRIVERS) + SECTION_int_hook_table (ram, CYGHWR_HAL_H8300_VECTOR_ADDRESS, LMA_EQ_VMA) +#else + SECTION_int_hook_table (iram, CYGHWR_HAL_H8300_VECTOR_ADDRESS, LMA_EQ_VMA) +#endif +#endif + SECTIONS_END +} diff --git a/ecos/packages/hal/h8300/edosk2674/current/include/pkgconf/mlt_h8300_h8s_edosk2674_rom.mlt b/ecos/packages/hal/h8300/edosk2674/current/include/pkgconf/mlt_h8300_h8s_edosk2674_rom.mlt new file mode 100644 index 0000000..222922a --- /dev/null +++ b/ecos/packages/hal/h8300/edosk2674/current/include/pkgconf/mlt_h8300_h8s_edosk2674_rom.mlt @@ -0,0 +1,12 @@ +version 0 +region ram ff4000 ffbfff 0 ! +section rom_vectors 0 1 0 1 1 1 1 1 0 60000 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 4 0 1 0 1 0 1 bss bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! diff --git a/ecos/packages/hal/h8300/edosk2674/current/include/platform.inc b/ecos/packages/hal/h8300/edosk2674/current/include/platform.inc new file mode 100644 index 0000000..a6e3439 --- /dev/null +++ b/ecos/packages/hal/h8300/edosk2674/current/include/platform.inc @@ -0,0 +1,141 @@ +#ifndef CYGONCE_HAL_PLATFORM_INC +#define CYGONCE_HAL_PLATFORM_INC +##============================================================================= +## +## platform.inc +## +## EDOSK-2764 "board" assembler header file +## +##============================================================================= +## ####ECOSGPLCOPYRIGHTBEGIN#### +## ------------------------------------------- +## This file is part of eCos, the Embedded Configurable Operating System. +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +## +## This exception does not invalidate any other reasons why a work based +## on this file might be covered by the GNU General Public License. +## ------------------------------------------- +## ####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): yoshinori sato +## Contributors: yoshinori sato +## Date: 2003-02-23 +## Purpose: EDOSK-2674 "board" definitions. +## Description: This file contains various definitions and macros that are +## required for writing assembly code for the am31 simulator. +## Currently there are none +## Usage: +## #include <cyg/hal/platform.inc> +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include <pkgconf/hal.h> + +#include <cyg/hal/mod_regs_bsc.h> +#include <cyg/hal/mod_regs_pio.h> +#include <cyg/hal/mod_regs_intc.h> +#include <cyg/hal/mod_regs_sys.h> + +##----------------------------------------------------------------------------- + +#define CYGPKG_HAL_H8300_MEMC_DEFINED + .macro hal_memc_init +#if defined(CYG_HAL_STARTUP_ROM) +;BSC/GPIO setup + mov.l #init_regs,er0 + mov.w #0xffff,e2 +1: + mov.w @er0+,r2 + beq 2f + mov.w @er0+,r1 + mov.b r1l,@er2 + bra 1b + +#define INIT_REGS_DATA(REGS,DATA) \ + .word ((REGS) & 0xffff),DATA + +init_regs: +INIT_REGS_DATA(CYGARC_ASTCR,0xfb) +INIT_REGS_DATA(CYGARC_RDNCR,0x00) +INIT_REGS_DATA(CYGARC_ABWCR,0x80) +INIT_REGS_DATA(CYGARC_WTCRAH,0x27) +INIT_REGS_DATA(CYGARC_WTCRAL,0x77) +INIT_REGS_DATA(CYGARC_WTCRBH,0x71) +INIT_REGS_DATA(CYGARC_WTCRBL,0x22) +INIT_REGS_DATA(CYGARC_CSACRH,0x80) +INIT_REGS_DATA(CYGARC_CSACRL,0x80) +INIT_REGS_DATA(CYGARC_BROMCRH,0xa0) +INIT_REGS_DATA(CYGARC_BROMCRL,0xa0) +INIT_REGS_DATA(CYGARC_P3DDR,0x3a) +INIT_REGS_DATA(CYGARC_P3ODR,0x06) +INIT_REGS_DATA(CYGARC_PADDR,0xff) +INIT_REGS_DATA(CYGARC_PFDDR,0xfe) +INIT_REGS_DATA(CYGARC_PGDDR,0x0f) +INIT_REGS_DATA(CYGARC_PHDDR,0x0f) +INIT_REGS_DATA(CYGARC_PFCR0,0xff) +INIT_REGS_DATA(CYGARC_PFCR2,0x0d) +INIT_REGS_DATA(CYGARC_INTCR,0x28) +INIT_REGS_DATA(CYGARC_ITSR, 0xff) +INIT_REGS_DATA(CYGARC_ITSR+1,0x3f) +INIT_REGS_DATA(CYGARC_ISCRL, 0x55) +INIT_REGS_DATA(CYGARC_ISCRL+1,0x55) +INIT_REGS_DATA(CYGARC_MSTPCRL,0xf7) + + .word 0 +2: +;SDRAM setup +#define SDRAM_SMR 0x400040 + + mov.w #0,r0 + mov.w r0,@CYGARC_DRACCR:16 + mov.w #0x188,r0 + mov.w r0,@CYGARC_REFCR:16 + mov.w #0x85b4,r0 + mov.w r0,@CYGARC_DRAMCR:16 + mov.b #0,r1l + mov.b r1l,@SDRAM_SMR + mov.w #0x84b4,r0 + mov.w r0,@CYGARC_DRAMCR:16 + +;special thanks to Arizona Cooperative Power +#endif + .endm + +#if defined(CYGPKG_IO_ETH_DRIVERS) +#define CYGPKG_HAL_H8300_SAVED_VECTORS + .macro h8300_save_vectors + .byte 16 + .endm +#endif + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_PLATFORM_INC +# end of platform.inc diff --git a/ecos/packages/hal/h8300/edosk2674/current/include/plf_intr.h b/ecos/packages/hal/h8300/edosk2674/current/include/plf_intr.h new file mode 100644 index 0000000..8bf30d7 --- /dev/null +++ b/ecos/packages/hal/h8300/edosk2674/current/include/plf_intr.h @@ -0,0 +1,75 @@ +#ifndef CYGONCE_HAL_PLF_INTR_H +#define CYGONCE_HAL_PLF_INTR_H + +//========================================================================== +// +// plf_intr.h +// +// EDOSK-2674 interrupt and clock support +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2003-02-23 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock for the simulator. This file +// is empty since none are required! +// +// Usage: +// #include <cyg/hal/plf_intr.h> +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + + +//-------------------------------------------------------------------------- + +externC void h8s_reset (void); +externC void hal_delay_us(int usecs); + +#define HAL_PLATFORM_RESET(x) +#define HAL_PLATFORM_RESET_ENTRY &h8s_reset + +#define HAL_DELAY_US(n) hal_delay_us(n) + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_PLF_INTR_H +// End of plf_intr.h diff --git a/ecos/packages/hal/h8300/edosk2674/current/include/plf_stub.h b/ecos/packages/hal/h8300/edosk2674/current/include/plf_stub.h new file mode 100644 index 0000000..59d7f77 --- /dev/null +++ b/ecos/packages/hal/h8300/edosk2674/current/include/plf_stub.h @@ -0,0 +1,85 @@ +#ifndef CYGONCE_HAL_PLF_STUB_H +#define CYGONCE_HAL_PLF_STUB_H + +//============================================================================= +// +// plf_stub.h +// +// Platform header for GDB stub support. +// +//============================================================================= +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 1999-05-18 +// Purpose: Platform HAL stub support for H8S simulator +// Usage: #include <cyg/hal/plf_stub.h> +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include <pkgconf/system.h> +#include <pkgconf/hal.h> + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include <cyg/infra/cyg_type.h> // CYG_UNUSED_PARAM, externC + +#include <cyg/hal/h8300_stub.h> // architecture stub support + +#include <cyg/hal/hal_diag.h> // hal_diag_led_on + +//---------------------------------------------------------------------------- +// Define some platform specific communication details. This is mostly +// handled by hal_if now, but we need to make sure the comms tables are +// properly initialized. + +externC void cyg_hal_plf_comms_init(void); + +#define HAL_STUB_PLATFORM_INIT_SERIAL() cyg_hal_plf_comms_init() + +#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) CYG_UNUSED_PARAM(int, (baud)) +#define HAL_STUB_PLATFORM_INTERRUPTIBLE 0 + +//---------------------------------------------------------------------------- +// Stub initializer. +#define HAL_STUB_PLATFORM_INIT() CYG_EMPTY_STATEMENT + +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_PLF_STUB_H +// End of plf_stub.h diff --git a/ecos/packages/hal/h8300/edosk2674/current/src/delay_us.S b/ecos/packages/hal/h8300/edosk2674/current/src/delay_us.S new file mode 100644 index 0000000..a59dad5 --- /dev/null +++ b/ecos/packages/hal/h8300/edosk2674/current/src/delay_us.S @@ -0,0 +1,26 @@ +;;delay_us + +#include <pkgconf/hal.h> + +#include <cyg/hal/arch.inc> +#include <cyg/hal/basetype.h> +#include <cyg/hal/mod_regs_tmr.h> + +#define DELAY_COUNT (CYGHWR_HAL_H8300_PROCESSOR_SPEED/1000000)/8*25 + +// .file "delay_us.S" + .h8300s + .text + + .global CYG_LABEL_DEFN(hal_delay_us) +CYG_LABEL_DEFN(hal_delay_us): + shlr.l er0 + shlr.l er0 + shlr.l er0 + mov.l er0,er0 +1: + ble 4f + dec.l #1,er0 + bra 1b +4: + rts diff --git a/ecos/packages/hal/h8300/edosk2674/current/src/hal_diag.c b/ecos/packages/hal/h8300/edosk2674/current/src/hal_diag.c new file mode 100644 index 0000000..0e1fa90 --- /dev/null +++ b/ecos/packages/hal/h8300/edosk2674/current/src/hal_diag.c @@ -0,0 +1,94 @@ +/*============================================================================= +// +// hal_diag.c +// +// HAL diagnostic output code +// +//============================================================================= +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): ysato +// Contributors: ysato +// Date: 2002-04-05 +// Purpose: HAL diagnostic output +// Description: Implementations of HAL diagnostic output support. +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include <pkgconf/hal.h> + +#include <cyg/hal/hal_diag.h> +#include <cyg/hal/h8_sci.h> +#include <cyg/hal/var_intr.h> + +#define SCI_BASE ((cyg_uint8*)CYGHAL_PLF_SCI_BASE) + +static channel_data_t channel = { (cyg_uint8*)SCI_BASE, 0, 0}; + +void +cyg_hal_plf_comms_init(void) +{ + static int initialized = 0; + + if (initialized) + return; + + initialized = 1; + + cyg_hal_plf_sci_init(0, 0, CYGNUM_HAL_INTERRUPT_RXI0, SCI_BASE); +} + +void hal_diag_init(void) +{ + cyg_hal_plf_sci_init_channel(&channel); +} + +void +hal_diag_write_char( cyg_uint8 c ) +{ + cyg_hal_plf_sci_putc(&channel, c); +} + +void +hal_diag_read_char(cyg_uint8 *c) +{ + *c = (char) cyg_hal_plf_sci_getc(&channel); +} + +/*===========================================================================*/ +/* EOF hal_diag.c */ + diff --git a/ecos/packages/hal/h8300/edosk2674/current/src/plf_misc.c b/ecos/packages/hal/h8300/edosk2674/current/src/plf_misc.c new file mode 100644 index 0000000..94386f1 --- /dev/null +++ b/ecos/packages/hal/h8300/edosk2674/current/src/plf_misc.c @@ -0,0 +1,128 @@ +//========================================================================== +// +// plf_misc.c +// +// HAL platform miscellaneous functions +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-04-05 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include <pkgconf/hal.h> + +#include <cyg/infra/cyg_type.h> // Base types + +#include <cyg/hal/hal_arch.h> // architectural definitions +#include <cyg/hal/hal_io.h> +#include <cyg/hal/hal_if.h> +#include <cyg/hal/plf_intr.h> +#include <cyg/hal/var_arch.h> + +/*------------------------------------------------------------------------*/ + +void hal_platform_init(void) +{ + hal_if_init(); +} + +void h8s_reset(void) +{ + __asm__ ("jmp @@4\n\t"); +} + +/*------------------------------------------------------------------------*/ +/* Control C ISR support */ + +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) + +struct Hal_SavedRegisters *hal_saved_interrupt_state; + +#endif + +/*------------------------------------------------------------------------*/ +/* clock support */ + +void hal_clock_initialize(cyg_uint32 period) +{ + cyg_uint8 prescale; + cyg_uint8 tmp; +#if CYGNUM_HAL_H8300_RTC_PRESCALE == 8 + prescale = 0x01; +#else +#if CYGNUM_HAL_H8300_RTC_PRESCALE == 64 + prescale = 0x02; +#else +#if CYGNUM_HAL_H8300_RTC_PRESCALE == 8192 + prescale = 0x03; +#else +#error illigal RTC prescale setting +#endif +#endif +#endif + HAL_READ_UINT8(CYGARC_MSTPCRL, tmp); + tmp &= ~0x01; + HAL_WRITE_UINT8(CYGARC_MSTPCRL, tmp); + HAL_WRITE_UINT8(CYGARC_8TCORA1, period); + HAL_WRITE_UINT8(CYGARC_8TCNT1, 0x00); + HAL_WRITE_UINT8(CYGARC_8TCR1, 0x48 | prescale); + HAL_WRITE_UINT8(CYGARC_8TCSR1, 0x00); +} + +void hal_clock_reset(cyg_uint32 vector, cyg_uint32 period) +{ + HAL_WRITE_UINT8(CYGARC_8TCR1,0x00); + HAL_WRITE_UINT8(CYGARC_8TCSR1,0x00); + hal_clock_initialize(period); +} + +void hal_clock_read(cyg_uint32 *pvalue) +{ + CYG_BYTE val; + HAL_READ_UINT8(CYGARC_8TCNT1,val); + *pvalue = val; +} + +/*------------------------------------------------------------------------*/ +/* End of plf_misc.c */ diff --git a/ecos/packages/hal/h8300/h8300h/current/ChangeLog b/ecos/packages/hal/h8300/h8300h/current/ChangeLog new file mode 100644 index 0000000..964dee3 --- /dev/null +++ b/ecos/packages/hal/h8300/h8300h/current/ChangeLog @@ -0,0 +1,92 @@ +2005-01-27 Yoshinori Sato <ysato@users.sourceforge.jp> + + * src/h8300_h8300h.ld: h8300h_sim target build error fix + +2004-04-22 Jani Monoses <jani@iv.ro> + + * cdl/hal_h8300_h8300h.cdl : + Invoke tail with stricter syntax that works in latest coreutils. + +2003-03-17 Yoshinori Sato <ysato@users.sourceforge.jp> + + * src/h8300h_stub.c + Bcc d:16 trace miss fix. + cleanup code. + +2003-12-12 Yoshinori Sato <ysato@users.sourceforge.jp> + + * src/h8300h_stub.c + deleet async_breakpoint. + rewrite single step support. + +2003-12-08 Yoshinori Sato <ysato@users.sourceforge.jp> + + * include/variant.inc + add h8300_trap_adjust_pc macro. + +2003-07-10 Nick Garnett <nickg@balti.calivar.com> + + * <general>: Added Yoshinori Sato's changes, see entries below, + plus a few small changes of my own. + +2003-04-10 Nick Garnett <nickg@balti.calivar.com> + + * src/h8300_h8300h.ld: + Added .eh_frame to data section. This is a stopgap fix to allow + C++ programs that define exceptions to link and run. It does not + allow them to actually throw exceptions, since that depends on + compiler changes that have not been made. Further, more + far-reaching, linker script changes will also be needs when that + happens. + Added libsupc++.a to GROUP() directive for GCC versions later than + 3.0. + +2003-03-09 Yoshinori Sato <ysato@users.sourceforge.jp> + + * src/h8300h_stub.c + move arch gdb stub support. + +2003-02-22 Yoshinori Sato <ysato@users.sourceforge.jp> + + * include/mod_regs_pio.h: P7DR define. + * include/mod_regs_tmr.h: remove WDT regs. + * include/var_arch.h: HAL_SaveRegisters add ccr. + * include/variant.h: hal_cpu_save_all/hal_cpu_load_all ccr store. + and CPU depend macros add. + * src/var_misc.c: Nested interrupt support fix. + +2003-10-17 Yoshinori Sato <ysato@users.sourceforge.jp> + + * src/h8300_h8300h.ld: CYGHWR_HAL_H8300_VECTOR_ADDRESS support. + +2002-08-14 Yoshinori Sato <qzb04471@nifty.ne.jp> + + * include/mod_regs_wdt.h: New file. Providing watchdog hardware data. + +2002-04-24 Yoshinori Sato <qzb04471@nifty.ne.jp> + + * New package. + +//=========================================================================== +// ####GPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +// +// This program 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. +// +// This program 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 this program; if not, write to the +// Free Software Foundation, Inc., 51 Franklin Street, +// Fifth Floor, Boston, MA 02110-1301, USA. +// ------------------------------------------- +// ####GPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/ecos/packages/hal/h8300/h8300h/current/cdl/hal_h8300_h8300h.cdl b/ecos/packages/hal/h8300/h8300h/current/cdl/hal_h8300_h8300h.cdl new file mode 100644 index 0000000..53dfa8a --- /dev/null +++ b/ecos/packages/hal/h8300/h8300h/current/cdl/hal_h8300_h8300h.cdl @@ -0,0 +1,112 @@ +# ==================================================================== +# +# hal_h8300_h8300h.cdl +# +# H8/300H variant architectural HAL package configuration data +# +# ==================================================================== +## ####ECOSGPLCOPYRIGHTBEGIN#### +## ------------------------------------------- +## This file is part of eCos, the Embedded Configurable Operating System. +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +## +## This exception does not invalidate any other reasons why a work based +## on this file might be covered by the GNU General Public License. +## ------------------------------------------- +## ####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Original data: nickg +# Contributors: dmoseley +# Date: 1999-11-02 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_H8300_H8300H { + display "H8/300H variant" + parent CYGPKG_HAL_H8300 + implements CYGINT_HAL_H8300_VARIANT + hardware + include_dir cyg/hal + define_header hal_h8300_h8300h.h + description " + The H8/300H variant HAL package provides generic + support for this processor architecture. It is also + necessary to select a specific target platform HAL + package." + + define_proc { + puts $::cdl_header "#include <pkgconf/hal_h8300.h>" + } + + compile var_misc.c h8300h_stub.c + + make { + <PREFIX>/lib/target.ld: <PACKAGE>/src/h8300_h8300h.ld + $(CC) -E -P -Wp,-MD,target.tmp -DEXTRAS=1 -xc $(INCLUDE_PATH) $(CFLAGS) -o $@ $< + @echo $@ ": \\" > $(notdir $@).deps + @tail -n +2 target.tmp >> $(notdir $@).deps + @echo >> $(notdir $@).deps + @rm target.tmp + } + + cdl_option CYGBLD_LINKER_SCRIPT { + display "Linker script" + flavor data + no_define + calculated { "src/h8300_h8300h.ld" } + } + + cdl_component CYGHWR_HAL_H8300H_CLOCK_SETTINGS { + display "H8/300H on-chip generic clock controls" + description " + The various clocks used by the system are controlled by + these options, some of which are derived from platform + settings." + flavor none + no_define + + cdl_option CYGHWR_HAL_H8300_DIVIDER_RATE { + display "Divider Rate (1/n)" + flavor data + legal_values { 1 2 4 8 } + default_value 1 + description " + The system clock divide rate setting" + } + cdl_option CYGHWR_HAL_H8300_PROCESSOR_SPEED { + display "Processor clock speed (MHz)" + flavor data + calculated { CYGHWR_HAL_H8300_CPG_INPUT / CYGHWR_HAL_H8300_DIVIDER_RATE } + description " + The core (CPU) speed is computed from + the input clock speed and the divider setting." + } + } +} diff --git a/ecos/packages/hal/h8300/h8300h/current/doc/README b/ecos/packages/hal/h8300/h8300h/current/doc/README new file mode 100644 index 0000000..911bdf8 --- /dev/null +++ b/ecos/packages/hal/h8300/h8300h/current/doc/README @@ -0,0 +1,2 @@ +Please visit http://homepage2.nifty.com/ysato/eCos/index.en.html for up to date +information, particularly on which GNU tools to use and patches. diff --git a/ecos/packages/hal/h8300/h8300h/current/include/h8_sci.h b/ecos/packages/hal/h8300/h8300h/current/include/h8_sci.h new file mode 100644 index 0000000..91e6b20 --- /dev/null +++ b/ecos/packages/hal/h8300/h8300h/current/include/h8_sci.h @@ -0,0 +1,79 @@ +//============================================================================= +// +// h8_sci.h +// +// Simple driver for the H8/300H Serial Communication Interface (SCI) +// +//============================================================================= +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 1999-05-17 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include <pkgconf/hal.h> + +//-------------------------------------------------------------------------- +// Exported functions + +externC void cyg_hal_plf_sci_init_channel(void* __ch_data); +externC cyg_uint8 cyg_hal_plf_sci_getc(void* __ch_data); +externC void cyg_hal_plf_sci_putc(void* __ch_data, cyg_uint8 c); +externC void cyg_hal_plf_sci_init(int sci_index, int comm_index, + int rcv_vect, cyg_uint8* base); + +//-------------------------------------------------------------------------- +// SCI register offsets +#define _REG_SCSMR 0x0 // serial mode register +#define _REG_SCBRR 0x1 // bit rate register +#define _REG_SCSCR 0x2 // serial control register +#define _REG_SCTDR 0x3 // transmit data register +#define _REG_SCSSR 0x4 // serial status register +#define _REG_SCRDR 0x5 // receive data register + +//-------------------------------------------------------------------------- + +typedef struct { + cyg_uint8* base; + cyg_int32 msec_timeout; + int isr_vector; +} channel_data_t; + +//-------------------------------------------------------------------------- +// end of h8_sci.h diff --git a/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_adc.h b/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_adc.h new file mode 100644 index 0000000..efe0a00 --- /dev/null +++ b/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_adc.h @@ -0,0 +1,69 @@ +#ifndef CYGONCE_MOD_REGS_ADC_H +#define CYGONCE_MOD_REGS_ADC_H + +//========================================================================== +// +// mod_regs_adc.h +// +// A/D D/A Converter Register +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_DASTCR 0xFEE01A +#define CYGARC_DADR0 0xFEE09C +#define CYGARC_DADR1 0xFEE09D +#define CYGARC_DACR 0xFEE09E + +#define CYGARC_ADDRAH 0xFFFFE0 +#define CYGARC_ADDRAL 0xFFFFE1 +#define CYGARC_ADDRBH 0xFFFFE2 +#define CYGARC_ADDRBL 0xFFFFE3 +#define CYGARC_ADDRCH 0xFFFFE4 +#define CYGARC_ADDRCL 0xFFFFE5 +#define CYGARC_ADDRDH 0xFFFFE6 +#define CYGARC_ADDRDL 0xFFFFE7 +#define CYGARC_ADCSR 0xFFFFE8 +#define CYGARC_ADCR 0xFFFFE9 + +#endif diff --git a/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_bsc.h b/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_bsc.h new file mode 100644 index 0000000..a800723 --- /dev/null +++ b/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_bsc.h @@ -0,0 +1,67 @@ +#ifndef CYGONCE_MOD_REGS_BSC_H +#define CYGONCE_MOD_REGS_BSC_H + +//========================================================================== +// +// mod_regs_bsc.h +// +// Bus Controler Register +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_BRCR 0xFEE013 +#define CYGARC_ADRCR 0xFEE01E +#define CYGARC_CSCR 0xFEE01F +#define CYGARC_ABWCR 0xFEE020 +#define CYGARC_ASTCR 0xFEE021 +#define CYGARC_WCRH 0xFEE022 +#define CYGARC_WCRL 0xFEE023 +#define CYGARC_BCR 0xFEE024 +#define CYGARC_DRCRA 0xFEE026 +#define CYGARC_DRCRB 0xFEE027 +#define CYGARC_RTMCSR 0xFEE028 +#define CYGARC_RTCNT 0xFEE029 +#define CYGARC_RTCOR 0xFEE02A + +#endif diff --git a/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_dmac.h b/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_dmac.h new file mode 100644 index 0000000..256ca43 --- /dev/null +++ b/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_dmac.h @@ -0,0 +1,86 @@ +#ifndef CYGONCE_MOD_REGS_DMAC_H +#define CYGONCE_MOD_REGS_DMAC_H + +//========================================================================== +// +// mod_regs_dmac.h +// +// DMA Controler Register +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_MAR0AR 0xFFFF20 +#define CYGARC_MAR0AE 0xFFFF21 +#define CYGARC_MAR0AH 0xFFFF22 +#define CYGARC_MAR0AL 0xFFFF23 +#define CYGARC_ETCR0AL 0xFFFF24 +#define CYGARC_ETCR0AH 0xFFFF25 +#define CYGARC_IOAR0A 0xFFFF26 +#define CYGARC_DTCR0A 0xFFFF27 +#define CYGARC_MAR0BR 0xFFFF28 +#define CYGARC_MAR0BE 0xFFFF29 +#define CYGARC_MAR0BH 0xFFFF2A +#define CYGARC_MAR0BL 0xFFFF2B +#define CYGARC_ETCR0BL 0xFFFF2C +#define CYGARC_ETCR0BH 0xFFFF2D +#define CYGARC_IOAR0B 0xFFFF2E +#define CYGARC_DTCR0B 0xFFFF2F +#define CYGARC_MAR1AR 0xFFFF30 +#define CYGARC_MAR1AE 0xFFFF31 +#define CYGARC_MAR1AH 0xFFFF32 +#define CYGARC_MAR1AL 0xFFFF33 +#define CYGARC_ETCR1AL 0xFFFF34 +#define CYGARC_ETCR1AH 0xFFFF35 +#define CYGARC_IOAR1A 0xFFFF36 +#define CYGARC_DTCR1A 0xFFFF37 +#define CYGARC_MAR1BR 0xFFFF38 +#define CYGARC_MAR1BE 0xFFFF39 +#define CYGARC_MAR1BH 0xFFFF3A +#define CYGARC_MAR1BL 0xFFFF3B +#define CYGARC_ETCR1BL 0xFFFF3C +#define CYGARC_ETCR1BH 0xFFFF3D +#define CYGARC_IOAR1B 0xFFFF3E +#define CYGARC_DTCR1B 0xFFFF3F + +#endif diff --git a/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_intc.h b/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_intc.h new file mode 100644 index 0000000..0098621 --- /dev/null +++ b/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_intc.h @@ -0,0 +1,59 @@ +#ifndef CYGONCE_MOD_REGS_INTC_H +#define CYGONCE_MOD_REGS_INTC_H + +//========================================================================== +// +// mod_regs_intc.h +// +// Interrupt Controler Register +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_ISCR 0xFEE014 +#define CYGARC_IER 0xFEE015 +#define CYGARC_ISR 0xFEE016 +#define CYGARC_IPRA 0xFEE018 +#define CYGARC_IPRB 0xFEE019 + +#endif diff --git a/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_pio.h b/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_pio.h new file mode 100644 index 0000000..cb022f1 --- /dev/null +++ b/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_pio.h @@ -0,0 +1,81 @@ +#ifndef CYGONCE_MOD_REGS_PIO_H +#define CYGONCE_MOD_REGS_PIO_H + +//========================================================================== +// +// mod_regs_pio.h +// +// I/O Port Controler Register +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_P1DDR 0xFEE000 +#define CYGARC_P2DDR 0xFEE001 +#define CYGARC_P3DDR 0xFEE002 +#define CYGARC_P4DDR 0xFEE003 +#define CYGARC_P5DDR 0xFEE004 +#define CYGARC_P6DDR 0xFEE005 +/*#define CYGARC_P7DDR 0xFEE006*/ +#define CYGARC_P8DDR 0xFEE007 +#define CYGARC_P9DDR 0xFEE008 +#define CYGARC_PADDR 0xFEE009 +#define CYGARC_PBDDR 0xFEE00A + +#define CYGARC_P1DR 0xFFFFD0 +#define CYGARC_P2DR 0xFFFFD1 +#define CYGARC_P3DR 0xFFFFD2 +#define CYGARC_P4DR 0xFFFFD3 +#define CYGARC_P5DR 0xFFFFD4 +#define CYGARC_P6DR 0xFFFFD5 +#define CYGARC_P7DR 0xFFFFD6 +#define CYGARC_P8DR 0xFFFFD7 +#define CYGARC_P9DR 0xFFFFD8 +#define CYGARC_PADR 0xFFFFD9 +#define CYGARC_PBDR 0xFFFFDA + +#define CYGARC_P2CR 0xFEE03C +#define CYGARC_P4CR 0xFEE03E +#define CYGARC_P5CR 0xFEE03F + +#endif diff --git a/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_sci.h b/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_sci.h new file mode 100644 index 0000000..5bc7a3b --- /dev/null +++ b/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_sci.h @@ -0,0 +1,143 @@ +#ifndef CYGONCE_MOD_REGS_SCI_H +#define CYGONCE_MOD_REGS_SCI_H + +//========================================================================== +// +// mod_regs_sci.h +// +// Serial Communication Interface Register +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_SMR0 0xFFFFB0 +#define CYGARC_BRR0 0xFFFFB1 +#define CYGARC_SCR0 0xFFFFB2 +#define CYGARC_TDR0 0xFFFFB3 +#define CYGARC_SSR0 0xFFFFB4 +#define CYGARC_RDR0 0xFFFFB5 +#define CYGARC_SCMR0 0xFFFFB6 +#define CYGARC_SMR1 0xFFFFB8 +#define CYGARC_BRR1 0xFFFFB9 +#define CYGARC_SCR1 0xFFFFBA +#define CYGARC_TDR1 0xFFFFBB +#define CYGARC_SSR1 0xFFFFBC +#define CYGARC_RDR1 0xFFFFBD +#define CYGARC_SCMR1 0xFFFFBE +#define CYGARC_SMR2 0xFFFFC0 +#define CYGARC_BRR2 0xFFFFC1 +#define CYGARC_SCR2 0xFFFFC2 +#define CYGARC_TDR2 0xFFFFC3 +#define CYGARC_SSR2 0xFFFFC4 +#define CYGARC_RDR2 0xFFFFC5 +#define CYGARC_SCMR2 0xFFFFC6 + +// Serial Mode Register +#define CYGARC_REG_SCSMR_CA 0x80 // communication mode +#define CYGARC_REG_SCSMR_CHR 0x40 // character length (7 if set) +#define CYGARC_REG_SCSMR_PE 0x20 // parity enable +#define CYGARC_REG_SCSMR_OE 0x10 // parity mode +#define CYGARC_REG_SCSMR_STOP 0x08 // stop bit length +#define CYGARC_REG_SCSMR_MP 0x04 // multiprocessor mode +#define CYGARC_REG_SCSMR_CKS1 0x02 // clock select 1 +#define CYGARC_REG_SCSMR_CKS0 0x01 // clock select 0 +#define CYGARC_REG_SCSMR_CKSx_MASK 0x03 // mask + +// Serial Control Register +#define CYGARC_REG_SCSCR_TIE 0x80 // transmit interrupt enable +#define CYGARC_REG_SCSCR_RIE 0x40 // receive interrupt enable +#define CYGARC_REG_SCSCR_TE 0x20 // transmit enable +#define CYGARC_REG_SCSCR_RE 0x10 // receive enable +#define CYGARC_REG_SCSCR_MPIE 0x08 // multiprocessor interrupt enable +#define CYGARC_REG_SCSCR_TEIE 0x04 // transmit-end interrupt enable +#define CYGARC_REG_SCSCR_CKE1 0x02 // clock enable 1 +#define CYGARC_REG_SCSCR_CKE0 0x01 // clock enable 0 + +// Serial Status Register +#define CYGARC_REG_SCSSR_TDRE 0x80 // transmit data register empty +#define CYGARC_REG_SCSSR_RDRF 0x40 // receive data register full +#define CYGARC_REG_SCSSR_ORER 0x20 // overrun error +#define CYGARC_REG_SCSSR_FER 0x10 // framing error +#define CYGARC_REG_SCSSR_PER 0x08 // parity error +#define CYGARC_REG_SCSSR_TEND 0x04 // transmit end +#define CYGARC_REG_SCSSR_MPB 0x02 // multiprocessor bit +#define CYGARC_REG_SCSSR_MPBT 0x01 // multiprocessor bit transfer + +// When clearing the status register, always write the value: +// CYGARC_REG_SCSSR_CLEARMASK & ~bit +// to prevent other bits than the one of interest to be cleared. +#define CYGARC_REG_SCSSR_CLEARMASK 0xf8 + +// Baud rate values calculation, depending on peripheral clock (Pf) +// n is CKS setting (0-3) +// N = (Pf/(64*2^(2n-1)*B))-1 +// With CYGARC_SCBRR_CKSx providing the values 1, 4, 16, 64 we get +// N = (Pf/(32*_CKS*B))-1 +// +// The CYGARC_SCBRR_OPTIMAL_CKS macro should compute the minimal CKS +// setting for the given baud rate and peripheral clock. +// +// The error of the CKS+count value can be computed by: +// E(%) = ((Pf/((N+1)*B*(64^(n-1)))-1)*100 +// +#define CYGARC_SCBRR_PRESCALE(_b_) \ +((((CYGHWR_HAL_H8300_PROCESSOR_SPEED/32/1/(_b_))-1)<256) ? 1 : \ + (((CYGHWR_HAL_H8300_PROCESSOR_SPEED/32/4/(_b_))-1)<256) ? 4 : \ + (((CYGHWR_HAL_H8300_PROCESSOR_SPEED/32/16/(_b_))-1)<256) ? 16 : 64) + +// Add half the divisor to reduce rounding errors to .5 +#define CYGARC_SCBRR_ROUNDING(_b_) \ + 16*CYGARC_SCBRR_PRESCALE(_b_)*(_b_) + +// These two macros provide the static values we need to stuff into the +// registers. +#define CYGARC_SCBRR_CKSx(_b_) \ + ((1 == CYGARC_SCBRR_PRESCALE(_b_)) ? 0 : \ + (4 == CYGARC_SCBRR_PRESCALE(_b_)) ? 1 : \ + (16 == CYGARC_SCBRR_PRESCALE(_b_)) ? 2 : 3) +#define CYGARC_SCBRR_N(_b_) \ + (((_b_) < 4800) ? 0 : \ + ((_b_) > 115200) ? 0 : \ + (((CYGHWR_HAL_H8300_PROCESSOR_SPEED+CYGARC_SCBRR_ROUNDING(_b_))/32/CYGARC_SCBRR_PRESCALE(_b_)/(_b_))-1)) + +#endif diff --git a/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_sys.h b/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_sys.h new file mode 100644 index 0000000..ab30d1a --- /dev/null +++ b/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_sys.h @@ -0,0 +1,64 @@ +#ifndef CYGONCE_MOD_REGS_SYS_H +#define CYGONCE_MOD_REGS_SYS_H + +//========================================================================== +// +// mod_regs_sys.h +// +// System Controler Register +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_MDCR 0xFEE000 +#define CYGARC_SYSCR 0xFEE001 +#define CYGARC_DIVCR 0xFEE01B +#define CYGARC_MSTCRH 0xFEE01C +#define CYGARC_MSTCRL 0xFEE01D +#define CYGARC_FLMCR1 0xFEE030 +#define CYGARC_FLMCR2 0xFEE031 +#define CYGARC_EBR1 0xFEE032 +#define CYGARC_EBR2 0xFEE033 +#define CYGARC_RAMCR 0xFEE077 + +#endif diff --git a/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_tmr.h b/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_tmr.h new file mode 100644 index 0000000..d5fc953 --- /dev/null +++ b/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_tmr.h @@ -0,0 +1,107 @@ +#ifndef CYGONCE_MOD_REGS_TMR_H +#define CYGONCE_MOD_REGS_TMR_H + +//========================================================================== +// +// mod_regs_tmr.h +// +// 16bit/8bit Timer Register +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_TSTR 0xFFFF60 +#define CYGARC_TSNC 0XFFFF61 +#define CYGARC_TMDR 0xFFFF62 +#define CYGARC_TOLR 0xFFFF63 +#define CYGARC_TISRA 0xFFFF64 +#define CYGARC_TISRB 0xFFFF65 +#define CYGARC_TISRC 0xFFFF66 +#define CYGARC_TCR0 0xFFFF68 +#define CYGARC_TIOR0 0xFFFF69 +#define CYGARC_TCNT0H 0xFFFF6A +#define CYGARC_TCNT0L 0xFFFF6B +#define CYGARC_GRA0H 0xFFFF6C +#define CYGARC_GRA0L 0xFFFF6D +#define CYGARC_GRB0H 0xFFFF6E +#define CYGARC_GRB0L 0xFFFF6F +#define CYGARC_TCR1 0xFFFF70 +#define CYGARC_TIOR1 0xFFFF71 +#define CYGARC_TCNT1H 0xFFFF72 +#define CYGARC_TCNT1L 0xFFFF73 +#define CYGARC_GRA1H 0xFFFF74 +#define CYGARC_GRA1L 0xFFFF75 +#define CYGARC_GRB1H 0xFFFF76 +#define CYGARC_GRB1L 0xFFFF77 +#define CYGARC_TCR3 0xFFFF78 +#define CYGARC_TIOR3 0xFFFF79 +#define CYGARC_TCNT3H 0xFFFF7A +#define CYGARC_TCNT3L 0xFFFF7B +#define CYGARC_GRA3H 0xFFFF7C +#define CYGARC_GRA3L 0xFFFF7D +#define CYGARC_GRB3H 0xFFFF7E +#define CYGARC_GRB3L 0xFFFF7F + +#define CYGARC_8TCR0 0xFFFF80 +#define CYGARC_8TCR1 0xFFFF81 +#define CYGARC_8TCSR0 0xFFFF82 +#define CYGARC_8TCSR1 0xFFFF83 +#define CYGARC_TCORA0 0xFFFF84 +#define CYGARC_TCORA1 0xFFFF85 +#define CYGARC_TCORB0 0xFFFF86 +#define CYGARC_TCORB1 0xFFFF87 +#define CYGARC_8TCNT0 0xFFFF88 +#define CYGARC_8TCNT1 0xFFFF89 + +#define CYGARC_8TCR2 0xFFFF90 +#define CYGARC_8TCR3 0xFFFF91 +#define CYGARC_8TCSR2 0xFFFF92 +#define CYGARC_8TCSR3 0xFFFF93 +#define CYGARC_TCORA2 0xFFFF94 +#define CYGARC_TCORA3 0xFFFF95 +#define CYGARC_TCORB2 0xFFFF96 +#define CYGARC_TCORB3 0xFFFF97 +#define CYGARC_8TCNT2 0xFFFF98 +#define CYGARC_8TCNT3 0xFFFF99 + +#endif diff --git a/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_tpc.h b/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_tpc.h new file mode 100644 index 0000000..cfb6ec4 --- /dev/null +++ b/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_tpc.h @@ -0,0 +1,62 @@ +#ifndef CYGONCE_MOD_REGS_TPC_H +#define CYGONCE_MOD_REGS_TPC_H + +//========================================================================== +// +// mod_regs_tpc.h +// +// Timming Perttern Controler Register +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_TPMR 0xFFFFA0 +#define CYGARC_TPCR 0xFFFFA1 +#define CYGARC_NDERB 0xFFFFA2 +#define CYGARC_NDERA 0xFFFFA3 +#define CYGARC_NDRB1 0xFFFFA4 +#define CYGARC_NDRA1 0xFFFFA5 +#define CYGARC_NDRB2 0xFFFFA6 +#define CYGARC_NDRA2 0xFFFFA7 + +#endif diff --git a/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_wdt.h b/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_wdt.h new file mode 100644 index 0000000..e651f3d --- /dev/null +++ b/ecos/packages/hal/h8300/h8300h/current/include/mod_regs_wdt.h @@ -0,0 +1,74 @@ +#ifndef CYGONCE_MOD_REGS_WDT_H +#define CYGONCE_MOD_REGS_WDT_H + +//========================================================================== +// +// mod_regs_wdt.h +// +// Watchdog Timer Register +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_TCSR 0xFFFF8C +#define CYGARC_TCNT 0xFFFF8D +#define CYGARC_RSTCSRW 0xFFFF8E +#define CYGARC_RSTCSRR 0xFFFF8F + +#define CYGARC_TCNT_MAGIC 0x5A00 +#define CYGARC_TCSR_MAGIC 0xA500 + +#define CYGARC_WDT_OVF 0x80 +#define CYGARC_WDT_WT 0x40 +#define CYGARC_WDT_TME 0x20 +#define CYGARC_WDT_CKS2 0x04 +#define CYGARC_WDT_CKS1 0x02 +#define CYGARC_WDT_CKS0 0x01 + +#define CYGARC_WDT_CKS 0x07 //Max Delay + +#define CYGARC_WDT_PERIOD ((1000000000/(CYGHWR_HAL_H8300_PROCESSOR_SPEED/4096))*256) + +#endif + +// EOF mod_regs_wdt.h diff --git a/ecos/packages/hal/h8300/h8300h/current/include/var_arch.h b/ecos/packages/hal/h8300/h8300h/current/include/var_arch.h new file mode 100644 index 0000000..214b2dd --- /dev/null +++ b/ecos/packages/hal/h8300/h8300h/current/include/var_arch.h @@ -0,0 +1,98 @@ +#ifndef CYGONCE_HAL_VAR_ARCH_H +#define CYGONCE_HAL_VAR_ARCH_H + +//========================================================================== +// +// var_arch.h +// +// Architecture specific abstractions +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-14 +// Purpose: Define architecture abstractions +// Description: This file contains any extra or modified definitions for +// this variant of the architecture. +// Usage: #include <cyg/hal/var_arch.h> +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include <pkgconf/hal.h> +#include <cyg/infra/cyg_type.h> + +//-------------------------------------------------------------------------- +// Processor saved states: + +typedef struct HAL_SavedRegisters +{ + // These are common to all saved states and are in the order + // stored and loaded by the movm instruction. + CYG_WORD32 er0; + CYG_WORD32 er1; + CYG_WORD32 er2; + CYG_WORD32 er3; + CYG_WORD32 er4; + CYG_WORD32 er5; + CYG_WORD32 er6; + + /* On interrupts the PC and PSW are pushed automatically by the */ + /* CPU and SP is pushed for debugging reasons. On a thread switch */ + /* the saved context is made to look the same. */ + + CYG_WORD32 sp; + CYG_WORD32 ccr; + CYG_WORD32 pc; +} HAL_SavedRegisters; + +// Internal peripheral registers +#include <cyg/hal/mod_regs_adc.h> +#include <cyg/hal/mod_regs_bsc.h> +#include <cyg/hal/mod_regs_dmac.h> +#include <cyg/hal/mod_regs_intc.h> +#include <cyg/hal/mod_regs_pio.h> +#include <cyg/hal/mod_regs_sci.h> +#include <cyg/hal/mod_regs_sys.h> +#include <cyg/hal/mod_regs_tmr.h> +#include <cyg/hal/mod_regs_tpc.h> +#include <cyg/hal/mod_regs_wdt.h> + +//-------------------------------------------------------------------------- +#endif // CYGONCE_HAL_VAR_ARCH_H +// End of var_arch.h diff --git a/ecos/packages/hal/h8300/h8300h/current/include/var_intr.h b/ecos/packages/hal/h8300/h8300h/current/include/var_intr.h new file mode 100644 index 0000000..4894d4b --- /dev/null +++ b/ecos/packages/hal/h8300/h8300h/current/include/var_intr.h @@ -0,0 +1,263 @@ +#ifndef CYGONCE_HAL_VAR_INTR_H +#define CYGONCE_HAL_VAR_INTR_H + +//========================================================================== +// +// var_intr.h +// +// H8/300H Interrupt and clock support +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-14 +// Purpose: H8/300H Interrupt Support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock for H8/300H variants of the H8/300 +// architecture. +// +// Usage: +// #include <cyg/hal/var_intr.h> +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include <pkgconf/hal.h> + +#include <cyg/infra/cyg_type.h> + +#include <cyg/hal/plf_intr.h> +#include <cyg/hal/var_arch.h> + +//-------------------------------------------------------------------------- +// Interrupt vectors. + +// The level-specific hardware vectors +// These correspond to VSRs and are the values to use for HAL_VSR_GET/SET +#define CYGNUM_HAL_VECTOR_RESET 0 +#define CYGNUM_HAL_VECTOR_RSV1 1 +#define CYGNUM_HAL_VECTOR_RSV2 2 +#define CYGNUM_HAL_VECTOR_RSV3 3 +#define CYGNUM_HAL_VECTOR_RSV4 4 +#define CYGNUM_HAL_VECTOR_RSV5 5 +#define CYGNUM_HAL_VECTOR_RSV6 6 +#define CYGNUM_HAL_VECTOR_NMI 7 +#define CYGNUM_HAL_VECTOR_TRAP0 8 +#define CYGNUM_HAL_VECTOR_TRAP1 9 +#define CYGNUM_HAL_VECTOR_TRAP2 10 +#define CYGNUM_HAL_VECTOR_TRAP3 11 + +#define CYGNUM_HAL_VSR_MIN 0 +#define CYGNUM_HAL_VSR_MAX 11 +#define CYGNUM_HAL_VSR_COUNT 12 + +// Exception numbers. These are the values used when passed out to an +// external exception handler using cyg_hal_deliver_exception() + +#define CYGNUM_HAL_EXCEPTION_NMI CYGNUM_HAL_VECTOR_NMI + +#if 0 +#define CYGNUM_HAL_EXCEPTION_DATA_ACCESS 0 +#endif + +#define CYGNUM_HAL_EXCEPTION_MIN CYGNUM_HAL_VSR_MIN +#define CYGNUM_HAL_EXCEPTION_MAX CYGNUM_HAL_VSR_MAX +#define CYGNUM_HAL_EXCEPTION_COUNT CYGNUM_HAL_VSR_COUNT + +// The decoded interrupts +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_0 12 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_1 13 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_2 14 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_3 15 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_4 16 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_5 17 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_6 18 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_7 19 + +#define CYGNUM_HAL_INTERRUPT_WDT 20 +#define CYGNUM_HAL_INTERRUPT_RFSHCMI 21 +#define CYGNUM_HAL_INTERRUPT_RSV22 22 +#define CYGNUM_HAL_INTERRUPT_ADI 23 + +#define CYGNUM_HAL_INTERRUPT_IMIA0 24 +#define CYGNUM_HAL_INTERRUPT_IMIB0 25 +#define CYGNUM_HAL_INTERRUPT_OVI0 26 +#define CYGNUM_HAL_INTERRUPT_RSV27 27 + +#define CYGNUM_HAL_INTERRUPT_IMIA1 28 +#define CYGNUM_HAL_INTERRUPT_IMIB1 29 +#define CYGNUM_HAL_INTERRUPT_OVI1 30 +#define CYGNUM_HAL_INTERRUPT_RSV31 31 + +#define CYGNUM_HAL_INTERRUPT_IMIA2 32 +#define CYGNUM_HAL_INTERRUPT_IMIB2 33 +#define CYGNUM_HAL_INTERRUPT_OVI2 34 +#define CYGNUM_HAL_INTERRUPT_RSV35 35 + +#define CYGNUM_HAL_INTERRUPT_CMIA0 36 +#define CYGNUM_HAL_INTERRUPT_CMIB0 37 +#define CYGNUM_HAL_INTERRUPT_CMIAB1 38 +#define CYGNUM_HAL_INTERRUPT_TOVI01 39 + +#define CYGNUM_HAL_INTERRUPT_CMIA2 40 +#define CYGNUM_HAL_INTERRUPT_CMIB2 41 +#define CYGNUM_HAL_INTERRUPT_CMIAB3 42 +#define CYGNUM_HAL_INTERRUPT_TOVI23 43 + +#define CYGNUM_HAL_INTERRUPT_DEND0A 44 +#define CYGNUM_HAL_INTERRUPT_DEND0B 45 +#define CYGNUM_HAL_INTERRUPT_DEND1A 46 +#define CYGNUM_HAL_INTERRUPT_DEND1B 47 + +#define CYGNUM_HAL_INTERRUPT_RSV48 48 +#define CYGNUM_HAL_INTERRUPT_RSV49 49 +#define CYGNUM_HAL_INTERRUPT_RSV50 50 +#define CYGNUM_HAL_INTERRUPT_RSV51 51 + +#define CYGNUM_HAL_INTERRUPT_ERI0 52 +#define CYGNUM_HAL_INTERRUPT_RXI0 53 +#define CYGNUM_HAL_INTERRUPT_TXI0 54 +#define CYGNUM_HAL_INTERRUPT_TEI0 55 + +#define CYGNUM_HAL_INTERRUPT_ERI1 56 +#define CYGNUM_HAL_INTERRUPT_RXI1 57 +#define CYGNUM_HAL_INTERRUPT_TXI1 58 +#define CYGNUM_HAL_INTERRUPT_TEI1 59 + +#define CYGNUM_HAL_INTERRUPT_ERI2 60 +#define CYGNUM_HAL_INTERRUPT_RXI2 61 +#define CYGNUM_HAL_INTERRUPT_TXI2 62 +#define CYGNUM_HAL_INTERRUPT_TEI2 63 + +#define CYGNUM_HAL_ISR_MIN 0 +#define CYGNUM_HAL_ISR_MAX 63 + +#define CYGNUM_HAL_ISR_COUNT (3+((CYGNUM_HAL_ISR_MAX+1)/4)) + +// The vector used by the Real time clock + +#define CYGNUM_HAL_INTERRUPT_RTC CYGNUM_HAL_INTERRUPT_CMIAB3 + +//-------------------------------------------------------------------------- +// Interrupt vector translation. + +#if !defined(HAL_TRANSLATE_VECTOR) && !defined(CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN) + +#define HAL_TRANSLATE_VECTOR(_vector_,_index_) \ + _index_ = (_vector_) + +#endif + +//-------------------------------------------------------------------------- +// H8/300H specific version of HAL_INTERRUPT_CONFIGURE + +#define HAL_INTERRUPT_CONFIGURE( _vector_, _level_, _up_ ) \ + hal_interrupt_configure( _vector_, _level_, _up_ ) + +externC void hal_interrupt_configure(int vector,int level,int up); + +#define HAL_INTERRUPT_CONFIGURE_DEFINED + +//-------------------------------------------------------------------------- +// Interrupt control macros + +#define HAL_DISABLE_INTERRUPTS(_old_) \ + asm volatile ( \ + "sub.l er0,er0\n\t" \ + "stc ccr,r0l\n\t" \ + "orc #0x80,ccr\n\t" \ + "and.b #0xc0,r0l\n\t" \ + "mov.l er0,%0" \ + : "=r"(_old_) \ + : \ + : "er0" \ + ); + +#define HAL_ENABLE_INTERRUPTS() \ + asm volatile ( \ + "andc #0x3f,ccr" \ + ); + +#define HAL_RESTORE_INTERRUPTS(_old_) \ + asm volatile ( \ + "mov.l %0,er0\n\t" \ + "and.b #0xc0,r0l\n\t" \ + "stc ccr,r0h\n\t" \ + "and.b #0x3f,r0h\n\t" \ + "or.b r0h,r0l\n\t" \ + "ldc r0l,ccr" \ + : \ + : "r"(_old_) \ + : "er0" \ + ); + +#define HAL_QUERY_INTERRUPTS(_old_) \ + asm volatile ( \ + "sub.l er0,er0\n\t" \ + "stc ccr,r0l\n\t" \ + "and.b #0xc0,r0l\n\t" \ + "mov.l er0,%0" \ + : "=r"(_old_) \ + ); + +//-------------------------------------------------------------------------- +// Clock control. + +externC void hal_clock_initialize(cyg_uint32 period); +externC void hal_clock_reset(cyg_uint32 vector,cyg_uint32 period); +externC void hal_clock_read(cyg_uint32 *pvalue); + +#define HAL_CLOCK_INITIALIZE( _period_ ) \ + hal_clock_initialize( _period_ ) + +#define HAL_CLOCK_RESET( _vector_, _period_ ) \ + hal_clock_reset( _vector_, _period_ ) + +#define HAL_CLOCK_READ( _pvalue_ ) \ + hal_clock_read( _pvalue_ ) + +// FIXME: above line should not use CYGNUM_KERNEL_COUNTERS_RTC_PERIOD since +// this means the HAL gets configured by kernel options even when the +// kernel is disabled! + + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_VAR_INTR_H +// End of var_intr.h diff --git a/ecos/packages/hal/h8300/h8300h/current/include/variant.inc b/ecos/packages/hal/h8300/h8300h/current/include/variant.inc new file mode 100644 index 0000000..9d3487a --- /dev/null +++ b/ecos/packages/hal/h8300/h8300h/current/include/variant.inc @@ -0,0 +1,215 @@ +#ifndef CYGONCE_HAL_VARIANT_INC +#define CYGONCE_HAL_VARIANT_INC +##============================================================================= +## +## variant.inc +## +## H8/300H assembler header file +## +##============================================================================= +## ####ECOSGPLCOPYRIGHTBEGIN#### +## ------------------------------------------- +## This file is part of eCos, the Embedded Configurable Operating System. +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +## +## This exception does not invalidate any other reasons why a work based +## on this file might be covered by the GNU General Public License. +## ------------------------------------------- +## ####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): ysato +## Contributors: ysato +## Date: 2002-02-28 +## Purpose: H8/300H definitions. +## Description: This file contains various definitions and macros that are +## useful for writing assembly code for the H8/300H CPU variant. +## Usage: +## #include <cyg/hal/variant.inc> +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include <pkgconf/hal.h> + +#include <cyg/hal/platform.inc> +#include <cyg/hal/basetype.h> + + +#------------------------------------------------------------------------------ +# Register definitions + +#define SYSCR 0xfee012 + +#------------------------------------------------------------------------------ +# CPU state save and restore macros + + .macro hal_cpu_save_all + subs #4,sp + mov.l sp,@-sp + mov.l er6,@-sp ; push all registers + mov.l er5,@-sp + mov.l er4,@-sp + mov.l er3,@-sp + mov.l er2,@-sp + mov.l er1,@-sp + mov.l er0,@-sp + mov.w @(4*9:16,sp),r0 + sub.l er1,er1 + mov.b r0h,r1l + mov.l er1,@(4*8:16,sp) ; copy ccr + mov.l @sp,er0 + mov.l @(4:16,sp),er1 + .endm + + .macro hal_cpu_load_all + mov.w @(4*8+2,sp),r0 + mov.w @(4*9,sp),r1 + mov.b r0l,r1h + mov.w r1,@(4*9,sp) ; set ccr to exception frame + mov.l @sp+,er0 ; pop regs + mov.l @sp+,er1 + mov.l @sp+,er2 + mov.l @sp+,er3 + mov.l @sp+,er4 + mov.l @sp+,er5 + mov.l @sp+,er6 + adds #4,sp + adds #4,sp + .endm + + .macro hal_cpu_save_context + hal_cpu_save_all + .endm + + .macro h8300_var_interrupt_entry + mov.l @CYG_LABEL_DEFN(_intvector),er0 + shll.l er0 + shll.l er0 + mov.l @(CYG_LABEL_DEFN(hal_vsr_table),er0),er0 + .endm + + .macro h8300_var_call_pending_DSR + mov.l er5,@-sp ; save some work regs + mov.l er6,@-sp + mov.l sp,er6 ; save current SP + mov.l #__interrupt_stack,sp ; interrupt stack pointer + stc ccr,r5l ; save PSW + hal_cpu_int_enable ; enable interrupts + + ; Call kernel code to invoke DSRs. + jsr @CYG_LABEL_DEFN(cyg_interrupt_call_pending_DSRs) + + ; On return the old SP in a2 and the old PSW in d2 will + ; have been preserved by the calling conventions. + + hal_cpu_int_merge r5l ; Restore previous PSW + mov.l er6,sp ; restore old SP + mov.l @sp+,er6 ; Retrieve old work regs + mov.l @sp+,er5 + rts ; and return + .endm + +# Location of PC in saved register context (HAL_SavedRegisters) +#define SAVED_CONTEXT_PC_OFFSET (4*9) + + # Enable interrupts + .macro hal_cpu_int_enable + andc #0x3f,ccr + .endm + + # Disable interrupts + .macro hal_cpu_int_disable + orc #0xc0,ccr + .endm + + # Merge the interrupt enable state of the status register in + # \sr with the current sr. + .macro hal_cpu_int_merge sr wk=r0l + and.b #0xc0,\sr + stc ccr,\wk + and.b #0x3f,\wk + or \sr,\wk + ldc \wk,ccr + .endm + + .macro hal_cpu_set_int_level + ldc ccr,r0h + or.b #0xc0,r0h + and.b r0l,r0h + mov.b r0h,ccr + .endm + + .macro h8300_trap_adjust_pc + mov.l @(36:16,sp),er0 + subs #2,er0 + mov.l er0,@(36:16,sp) + .endm + +##----------------------------------------------------------------------------- +# Default interrupt decoding macros. + +#ifndef CYGPKG_HAL_H8300_INTC_DEFINED + +#define CYG_ISR_TABLE_SIZE 64 + + .macro hal_intc_init + mov.b @SYSCR,r0l + bclr #3,r0l + mov.b r0l,@SYSCR + .endm + +#define CYGPKG_HAL_H8300_INTC_DEFINED + +#endif + + + +#ifndef CYGPKG_HAL_H8300_MON_DEFINED + + .macro hal_mon_init + .endm + +#if !(defined(CYG_HAL_STARTUP_ROM) || \ + defined(CYGPKG_HAL_H8300_H8300H_SIM) || \ + !defined(CYGSEM_HAL_USE_ROM_MONITOR)) + +#define CYG_HAL_H8300_VSR_TABLE_DEFINED + +#endif + + + +#define CYGPKG_HAL_H8300_MON_DEFINED + +#endif + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_VARIANT_INC +# end of variant.inc diff --git a/ecos/packages/hal/h8300/h8300h/current/src/h8300_h8300h.ld b/ecos/packages/hal/h8300/h8300h/current/src/h8300_h8300h.ld new file mode 100644 index 0000000..540c495 --- /dev/null +++ b/ecos/packages/hal/h8300/h8300h/current/src/h8300_h8300h.ld @@ -0,0 +1,153 @@ +//=========================================================================== +// +// MLT linker script for H8/300H +// +//=========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== + +#include <pkgconf/system.h> +#include <cyg/hal/basetype.h> +#include <pkgconf/hal.h> +STARTUP(vectors.o) +ENTRY(CYG_LABEL_DEFN(_start)) +#ifdef EXTRAS +INPUT(extras.o) +#endif +#if (__GNUC__ >= 3) +GROUP(libtarget.a libgcc.a libsupc++.a) +#else +GROUP(libtarget.a libgcc.a) +#endif + +#define ALIGN_LMA 4 +#define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1)) +#define LMA_EQ_VMA +#define FORCE_OUTPUT . = . + +#define SECTIONS_BEGIN + +#define SECTION_rom_vectors(_region_, _vma_, _lma_) \ + .vectors _vma_ : _lma_ \ + { FORCE_OUTPUT; KEEP (*(.vectors)) } \ + > _region_ + +#define SECTION_text(_region_, _vma_, _lma_) \ + .text _vma_ : _lma_ \ + { CYG_LABEL_DEFN(_stext) = ABSOLUTE(.); \ + *(.text*) *(.gnu.warning) *(.gnu.linkonce*) *(.init) } \ + > _region_ \ + CYG_LABEL_DEFN(_etext) = .; PROVIDE (etext = .); + +#define SECTION_fini(_region_, _vma_, _lma_) \ + .fini _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.fini) } \ + > _region_ + +#define SECTION_rodata(_region_, _vma_, _lma_) \ + .rodata _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.rodata*) } \ + > _region_ + +#define SECTION_rodata1(_region_, _vma_, _lma_) \ + .rodata1 _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.rodata1) } \ + > _region_ + +#define SECTION_fixup(_region_, _vma_, _lma_) \ + .fixup _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.fixup) } \ + > _region_ + +#define SECTION_gcc_except_table(_region_, _vma_, _lma_) \ + .gcc_except_table _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.gcc_except_table) } \ + > _region_ + +#if defined(CYGHWR_HAL_H8300_VECTOR_ADDRESS) +#define SECTION_int_hook_table(_region_, _vma_, _lma_) \ + .int_hook_table CYGHWR_HAL_H8300_VECTOR_ADDRESS : _lma_ \ + { CYG_LABEL_DEFN(__int_hook_start) = ABSOLUTE (.); \ + FORCE_OUTPUT; *(.int_hook_table) } \ + > _region_ \ + CYG_LABEL_DEFN(__rom_int_hook_table) = LOADADDR(.int_hook_table); \ + CYG_LABEL_DEFN(__int_hook_end) = .; +#else +#define SECTION_int_hook_table(_region_, _vma_, _lma_) \ + .int_hook_table _vma_ : _lma_ \ + { CYG_LABEL_DEFN(__int_hook_start) = ABSOLUTE (.); \ + FORCE_OUTPUT; *(.int_hook_table) } \ + > _region_ +#endif + +#define SECTION_data(_region_, _vma_, _lma_) \ + .data _vma_ : _lma_ \ + { CYG_LABEL_DEFN(__ram_data_start) = ABSOLUTE (.); *(.data*) *(.data1) \ + . = ALIGN(4); \ + KEEP(*( SORT (.ecos.table.*))) ; \ + . = ALIGN(4); \ + CYG_LABEL_DEFN(_GOT1_START_) = ABSOLUTE (.); *(.got1) CYG_LABEL_DEFN(_GOT1_END_) = ABSOLUTE (.); \ + CYG_LABEL_DEFN(_GOT2_START_) = ABSOLUTE (.); *(.got2) CYG_LABEL_DEFN(_GOT2_END_) = ABSOLUTE (.); \ + . = ALIGN (4); \ + CYG_LABEL_DEFN(__CTOR_LIST__) = ABSOLUTE (.); KEEP (*(SORT (.ctors*))) CYG_LABEL_DEFN(__CTOR_END__) = ABSOLUTE (.); \ + CYG_LABEL_DEFN(__DTOR_LIST__) = ABSOLUTE (.); KEEP (*(SORT (.dtors*))) CYG_LABEL_DEFN(__DTOR_END__) = ABSOLUTE (.); \ + CYG_LABEL_DEFN(_GOT_START) = ABSOLUTE (.); CYG_LABEL_DEFN(_GLOBAL_OFFSET_TABLE_) = ABSOLUTE (.) + 32768; CYG_LABEL_DEFN(_SDA_BASE_) = ABSOLUTE (.); \ + *(.got.plt) *(.got) CYG_LABEL_DEFN(_GOT_END_) = ABSOLUTE (.); \ + *(.eh_frame) \ + *(.dynamic) *(.sdata*) *(.sbss*) } \ + > _region_ \ + CYG_LABEL_DEFN(__rom_data_start) = LOADADDR (.data); \ + CYG_LABEL_DEFN(__ram_data_end) = .; PROVIDE (CYG_LABEL_DEFN(__ram_data_end) = .); CYG_LABEL_DEFN(_edata) = .; PROVIDE (edata = .); + +#define SECTION_bss(_region_, _vma_, _lma_) \ + .bss _vma_ : _lma_ \ + { CYG_LABEL_DEFN(__bss_start) = ABSOLUTE (.); \ + *(.scommon) *(.dynbss) *(.bss.*) *(COMMON) \ + CYG_LABEL_DEFN(__bss_end) = ABSOLUTE (.); } \ + > _region_ + +#define SECTION_2ram(_region_, _vma_, _lma_) \ + .2ram _vma_ : _lma_ \ + { CYG_LABEL_DEFN(__iram_start) = ABSOLUTE (.); \ + *( .2ram.*); \ + . = ALIGN(4); \ + CYG_LABEL_DEFN(__iram_end) = ABSOLUTE (.); } \ + > _region_ \ + CYG_LABEL_DEFN(__rom_iram_start) = LOADADDR (.2ram); + +#define SECTIONS_END . = ALIGN(4); _end = .; PROVIDE (end = .); + +#include CYGHWR_MEMORY_LAYOUT_LDI +#include CYGBLD_HAL_PLATFORM_H + +CYG_LABEL_DEFN(hal_virtual_vector_table) = CYGHWR_HAL_VECTOR_TABLE; diff --git a/ecos/packages/hal/h8300/h8300h/current/src/h8300h_stub.c b/ecos/packages/hal/h8300/h8300h/current/src/h8300h_stub.c new file mode 100644 index 0000000..f65e9b9 --- /dev/null +++ b/ecos/packages/hal/h8300/h8300h/current/src/h8300h_stub.c @@ -0,0 +1,329 @@ +//======================================================================== +// +// h8300h_stub.c +// +// Helper functions for H8/300H stub +// +//======================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//======================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Yoshinori Sato +// Contributors: Yoshinori Sato +// Date: 2002-05-03 +// Purpose: +// Description: Helper functions for H8/300H stub +// Usage: +// +//####DESCRIPTIONEND#### +// +//======================================================================== + +#include <stddef.h> + +#include <pkgconf/hal.h> + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include <cyg/hal/hal_stub.h> +#include <cyg/hal/hal_arch.h> +#include <cyg/hal/hal_intr.h> +#include <cyg/hal/hal_diag.h> + +#ifdef CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT +#include <cyg/hal/dbg-threads-api.h> // dbg_currthread_id +#endif + +/*--------------------------------------------------------------------*/ +/* Given a trap value TRAP, return the corresponding signal. */ + +int __computeSignal (unsigned int trap_number) +{ + switch (trap_number) { + case CYGNUM_HAL_VECTOR_TRAP3: + return SIGTRAP; + default: + return SIGINT; + } +} + +/*--------------------------------------------------------------------*/ +/* Return the trap number corresponding to the last-taken trap. */ + +int __get_trap_number (void) +{ + extern int CYG_LABEL_NAME(_intvector); + // The vector is not not part of the GDB register set so get it + // directly from the save context. + return CYG_LABEL_NAME(_intvector); +} + +/*--------------------------------------------------------------------*/ +/* Set the currently-saved pc register value to PC. This also updates NPC + as needed. */ + +void set_pc (target_register_t pc) +{ + put_register (PC, pc); +} + + +/*---------------------------------------------------------------------- + * Single-step support. + */ + +typedef struct { + unsigned short *addr; + unsigned short inst; +} breakinfo; + +static breakinfo InstBuffer = {(unsigned short *)-1,0}; + +/* Clear any single-step breakpoint(s) that may have been set. */ + +void __clear_single_step (void) +{ + if ((long)InstBuffer.addr != -1L) { + *InstBuffer.addr = InstBuffer.inst; + InstBuffer.addr = (unsigned short *)-1; + } +} + +/* calculate next pc */ + +enum jump_type{none,aabs,aind,ret,reg,relb,relw}; + +/* opcode decode table define + ptn: opcode pattern + msk: opcode bitmask + len: instruction length (<0 next table index) + jmp: jump operation mode */ + +struct optable { + unsigned char pattern; + unsigned char mask; + signed char length; + char type; +} __attribute__((aligned(1),packed)); + +#define OPTABLE(ptn,msk,len,jmp) {ptn,msk,len,jmp} + +const static struct optable optable_0[] = { + OPTABLE(0x00,0xff, 1,none), /* 0x00 */ + OPTABLE(0x01,0xff,-1,none), /* 0x01 */ + OPTABLE(0x02,0xfe, 1,none), /* 0x02-0x03 */ + OPTABLE(0x04,0xee, 1,none), /* 0x04-0x05/0x14-0x15 */ + OPTABLE(0x06,0xfe, 1,none), /* 0x06-0x07 */ + OPTABLE(0x08,0xea, 1,none), /* 0x08-0x09/0x0c-0x0d/0x18-0x19/0x1c-0x1d */ + OPTABLE(0x0a,0xee, 1,none), /* 0x0a-0x0b/0x1a-0x1b */ + OPTABLE(0x0e,0xee, 1,none), /* 0x0e-0x0f/0x1e-0x1f */ + OPTABLE(0x10,0xfc, 1,none), /* 0x10-0x13 */ + OPTABLE(0x16,0xfe, 1,none), /* 0x16-0x17 */ + OPTABLE(0x20,0xe0, 1,none), /* 0x20-0x3f */ + OPTABLE(0x40,0xf0, 1,relb), /* 0x40-0x4f */ + OPTABLE(0x50,0xfc, 1,none), /* 0x50-0x53 */ + OPTABLE(0x54,0xfd, 1,ret ), /* 0x54/0x56 */ + OPTABLE(0x55,0xff, 1,relb), /* 0x55 */ + OPTABLE(0x57,0xff, 1,none), /* 0x57 */ + OPTABLE(0x58,0xfb, 2,relw), /* 0x58/0x5c */ + OPTABLE(0x59,0xfb, 1,reg ), /* 0x59/0x5b */ + OPTABLE(0x5a,0xfb, 2,aabs), /* 0x5a/0x5e */ + OPTABLE(0x5b,0xfb, 2,aind), /* 0x5b/0x5f */ + OPTABLE(0x60,0xe8, 1,none), /* 0x60-0x67/0x70-0x77 */ + OPTABLE(0x68,0xfa, 1,none), /* 0x68-0x69/0x6c-0x6d */ + OPTABLE(0x6a,0xfe,-2,none), /* 0x6a-0x6b */ + OPTABLE(0x6e,0xfe, 2,none), /* 0x6e-0x6f */ + OPTABLE(0x78,0xff, 4,none), /* 0x78 */ + OPTABLE(0x79,0xff, 2,none), /* 0x79 */ + OPTABLE(0x7a,0xff, 3,none), /* 0x7a */ + OPTABLE(0x7b,0xff, 2,none), /* 0x7b */ + OPTABLE(0x7c,0xfc, 2,none), /* 0x7c-0x7f */ + OPTABLE(0x80,0x80, 1,none), /* 0x80-0xff */ +}; + +const static struct optable optable_1[] = { + OPTABLE(0x00,0xff,-3,none), /* 0x0100 */ + OPTABLE(0x40,0xf0,-3,none), /* 0x0140-0x14f */ + OPTABLE(0x80,0xf0, 1,none), /* 0x0180-0x018f */ + OPTABLE(0xc0,0xc0, 2,none), /* 0x01c0-0x01ff */ +}; + +const static struct optable optable_2[] = { + OPTABLE(0x00,0x20, 2,none), /* 0x6a0?/0x6a8?/0x6b0?/0x6b8? */ + OPTABLE(0x20,0x20, 3,none), /* 0x6a2?/0x6aa?/0x6b2?/0x6ba? */ +}; + +const static struct optable optable_3[] = { + OPTABLE(0x69,0xfb, 2,none), /* 0x010069/0x01006d/014069/0x01406d */ + OPTABLE(0x6b,0xff,-4,none), /* 0x01006b/0x01406b */ + OPTABLE(0x6f,0xff, 3,none), /* 0x01006f/0x01406f */ + OPTABLE(0x78,0xff, 5,none), /* 0x010078/0x014078 */ +}; + +const static struct optable optable_4[] = { + OPTABLE(0x00,0x78, 3,none), /* 0x0100690?/0x01006d0?/0140690/0x01406d0?/0x0100698?/0x01006d8?/0140698?/0x01406d8? */ + OPTABLE(0x20,0x78, 4,none), /* 0x0100692?/0x01006d2?/0140692/0x01406d2?/0x010069a?/0x01006da?/014069a?/0x01406da? */ +}; + +const static struct { + const struct optable *op; + int length; +} optables[] = { + {optable_0,sizeof(optable_0)/sizeof(struct optable)}, + {optable_1,sizeof(optable_1)/sizeof(struct optable)}, + {optable_2,sizeof(optable_2)/sizeof(struct optable)}, + {optable_3,sizeof(optable_3)/sizeof(struct optable)}, + {optable_4,sizeof(optable_4)/sizeof(struct optable)}, +}; + +const static unsigned char condmask[] = { + 0x00,0x40,0x01,0x04,0x02,0x08,0x10,0x20 +}; + +static int isbranch(int reson) +{ + unsigned char cond = get_register(CCR); + /* encode complex conditions */ + /* B4: N^V + B5: Z|(N^V) + B6: C|Z */ + __asm__("bld #3,%w0\n\t" + "bxor #1,%w0\n\t" + "bst #4,%w0\n\t" + "bor #2,%w0\n\t" + "bst #5,%w0\n\t" + "bld #2,%w0\n\t" + "bor #0,%w0\n\t" + "bst #6,%w0\n\t" + :"=&r"(cond):"g"(cond):"cc"); + cond &= condmask[reson >> 1]; + if (!(reson & 1)) + return cond == 0; + else + return cond != 0; +} + +static unsigned short *getnextpc(unsigned short *pc) +{ + const struct optable *op; + unsigned char *fetch_p; + unsigned char inst; + unsigned long addr; + unsigned long *sp; + int op_len; + op = optables[0].op; + op_len = optables[0].length; + fetch_p = (unsigned char *)pc; + inst = *fetch_p++; + do { + if ((inst & op->mask) == op->pattern) { + if (op->length < 0) { + op = optables[-op->length].op; + op_len = optables[-op->length].length + 1; + inst = *fetch_p++; + } else { + switch (op->type) { + case none: + return pc + op->length; + case aabs: + addr = *(unsigned long *)pc; + return (unsigned short *)(addr & 0x00ffffff); + case aind: + addr = *pc & 0xff; + return (unsigned short *)(*(unsigned long *)addr); + case ret: + sp = (unsigned long *)get_register(SP); + return (unsigned short *)(*(sp+3) & 0x00ffffff); + case reg: + addr = get_register((*pc >> 4) & 0x07); + return (unsigned short *)addr; + case relb: + if ((inst = 0x55) || isbranch(inst & 0x0f)) + (unsigned char *)pc += (signed char)(*fetch_p); + return pc+1; /* skip myself */ + case relw: + if ((inst = 0x5c) || isbranch((*fetch_p & 0xf0) >> 4)) + (unsigned char *)pc += (signed short)(*(pc+1)); + return pc+2; /* skip myself */ + } + } + } else + op++; + } while(--op_len > 0); + return NULL; +} + +/* Set breakpoint(s) to simulate a single step from the current PC. */ + +void __single_step (void) +{ + unsigned short *nextpc; + nextpc = getnextpc((unsigned short *)get_register(PC)); + InstBuffer.addr = nextpc; + InstBuffer.inst = *nextpc; + *nextpc = HAL_BREAKINST; +} + +void __install_breakpoints (void) +{ + /* NOP since single-step HW exceptions are used instead of + breakpoints. */ +} + +void __clear_breakpoints (void) +{ + +} + + +/* If the breakpoint we hit is in the breakpoint() instruction, return a + non-zero value. */ + +externC void CYG_LABEL_NAME(breakinst)(void); +int +__is_breakpoint_function () +{ + return get_register (PC) == (target_register_t)&CYG_LABEL_NAME(breakinst); +} + + +/* Skip the current instruction. */ +/* only TRAPA instruction */ + +void __skipinst (void) +{ + put_register (PC, get_register(PC) + 2); +} + +#endif // CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS diff --git a/ecos/packages/hal/h8300/h8300h/current/src/var_misc.c b/ecos/packages/hal/h8300/h8300h/current/src/var_misc.c new file mode 100644 index 0000000..3148449 --- /dev/null +++ b/ecos/packages/hal/h8300/h8300h/current/src/var_misc.c @@ -0,0 +1,262 @@ +//========================================================================== +// +// var_misc.c +// +// HAL CPU variant miscellaneous functions +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): ysato +// Contributors: ysato +// Date: 2002-03-01 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include <pkgconf/hal.h> + +#include <cyg/infra/cyg_type.h> // Base types +#include <cyg/infra/cyg_trac.h> // tracing macros +#include <cyg/infra/cyg_ass.h> // assertion macros +#include <cyg/hal/var_arch.h> +#include <cyg/hal/var_intr.h> +#include <cyg/hal/hal_io.h> + +/*------------------------------------------------------------------------*/ +/* Variant specific initialization routine. */ + +void hal_variant_init(void) +{ +} + +struct int_regs { + CYG_BYTE *ier; + CYG_BYTE *isr; + CYG_BYTE mask; + CYG_BYTE status; +}; + +#define REGS_DEF(ier,isr,mask,status) \ + {(CYG_BYTE *)ier,(CYG_BYTE *)isr,mask,status} + +const struct int_regs interrupt_registers[]= { + REGS_DEF(CYGARC_IER,CYGARC_ISR,0x01,0x01), + REGS_DEF(CYGARC_IER,CYGARC_ISR,0x02,0x02), + REGS_DEF(CYGARC_IER,CYGARC_ISR,0x04,0x04), + REGS_DEF(CYGARC_IER,CYGARC_ISR,0x08,0x08), + REGS_DEF(CYGARC_IER,CYGARC_ISR,0x10,0x10), + REGS_DEF(CYGARC_IER,CYGARC_ISR,0x20,0x20), + REGS_DEF(CYGARC_IER,CYGARC_ISR,0x40,0x40), + REGS_DEF(CYGARC_IER,CYGARC_ISR,0x80,0x80), + REGS_DEF(CYGARC_TCSR,CYGARC_TCSR,0x20,0x80), + REGS_DEF(CYGARC_RTMCSR,CYGARC_RTMCSR,0x40,0x80), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(CYGARC_ADCSR,CYGARC_ADCSR,0x40,0x80), + REGS_DEF(CYGARC_TISRA,CYGARC_TISRA,0x10,0x01), + REGS_DEF(CYGARC_TISRB,CYGARC_TISRB,0x10,0x01), + REGS_DEF(CYGARC_TISRC,CYGARC_TISRC,0x10,0x01), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(CYGARC_TISRA,CYGARC_TISRA,0x20,0x02), + REGS_DEF(CYGARC_TISRB,CYGARC_TISRB,0x20,0x02), + REGS_DEF(CYGARC_TISRC,CYGARC_TISRC,0x20,0x02), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(CYGARC_TISRA,CYGARC_TISRA,0x40,0x04), + REGS_DEF(CYGARC_TISRB,CYGARC_TISRB,0x40,0x04), + REGS_DEF(CYGARC_TISRC,CYGARC_TISRC,0x40,0x04), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(CYGARC_8TCR0,CYGARC_8TCSR0,0x40,0x40), + REGS_DEF(CYGARC_8TCR0,CYGARC_8TCSR0,0x80,0x80), + REGS_DEF(CYGARC_8TCR1,CYGARC_8TCSR1,0xC0,0xC0), + REGS_DEF(CYGARC_8TCR0,CYGARC_8TCSR0,0x20,0x20), + REGS_DEF(CYGARC_8TCR2,CYGARC_8TCSR2,0x40,0x40), + REGS_DEF(CYGARC_8TCR2,CYGARC_8TCSR2,0x80,0x80), + REGS_DEF(CYGARC_8TCR3,CYGARC_8TCSR3,0xC0,0xC0), + REGS_DEF(CYGARC_8TCR2,CYGARC_8TCSR2,0x20,0x20), + REGS_DEF(CYGARC_DTCR0A,CYGARC_DTCR0A,0x08,0x80), + REGS_DEF(CYGARC_DTCR0B,CYGARC_DTCR0B,0x08,0x80), + REGS_DEF(CYGARC_DTCR1A,CYGARC_DTCR1A,0x08,0x80), + REGS_DEF(CYGARC_DTCR1B,CYGARC_DTCR1B,0x08,0x80), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(CYGARC_SCR0,CYGARC_SSR0,0x40,0x30), + REGS_DEF(CYGARC_SCR0,CYGARC_SSR0,0x40,0x40), + REGS_DEF(CYGARC_SCR0,CYGARC_SSR0,0x80,0x80), + REGS_DEF(CYGARC_SCR0,CYGARC_SSR0,0x04,0x04), + REGS_DEF(CYGARC_SCR1,CYGARC_SSR1,0x40,0x30), + REGS_DEF(CYGARC_SCR1,CYGARC_SSR1,0x40,0x40), + REGS_DEF(CYGARC_SCR1,CYGARC_SSR1,0x80,0x80), + REGS_DEF(CYGARC_SCR1,CYGARC_SSR1,0x04,0x04), + REGS_DEF(CYGARC_SCR2,CYGARC_SSR2,0x40,0x30), + REGS_DEF(CYGARC_SCR2,CYGARC_SSR2,0x40,0x40), + REGS_DEF(CYGARC_SCR2,CYGARC_SSR2,0x80,0x80), + REGS_DEF(CYGARC_SCR2,CYGARC_SSR2,0x04,0x04) +}; + +void +hal_interrupt_mask(int vector) +{ + CYG_BYTE ier; + const struct int_regs *regs; + if( vector < 12 ) + return; + regs=&interrupt_registers[vector-12]; + if (vector == CYGNUM_HAL_INTERRUPT_WDT) { + HAL_READ_UINT8(CYGARC_TCSR,ier); + ier &= ~0x20; + HAL_WRITE_UINT16(CYGARC_TCSR,0xa500 | ier); + } else { + if ((vector >= CYGNUM_HAL_INTERRUPT_EXTERNAL_0) && regs->ier) { + HAL_READ_UINT8(regs->ier,ier); + ier &= ~(regs->mask); + HAL_WRITE_UINT8(regs->ier,ier); + } else { + CYG_FAIL("Unknown interrupt vector"); + } + } +} + +void +hal_interrupt_unmask(int vector) +{ + CYG_BYTE ier; + const struct int_regs *regs; + if( vector < 12 ) + return; + regs=&interrupt_registers[vector-12]; + if (vector == CYGNUM_HAL_INTERRUPT_WDT) { + HAL_READ_UINT8(CYGARC_TCSR,ier); + ier |= 0x20; + HAL_WRITE_UINT16(CYGARC_TCSR,0xa500 | ier); + } else { + if ((vector >= CYGNUM_HAL_INTERRUPT_EXTERNAL_0) && regs->ier) { + HAL_READ_UINT8(regs->ier,ier); + ier |= regs->mask; + HAL_WRITE_UINT8(regs->ier,ier); + } else { + CYG_FAIL("Unknown interrupt vector"); + } + } +} + +void +hal_interrupt_acknowledge(int vector) +{ + CYG_BYTE isr; + const struct int_regs *regs; + if( vector < 12 ) + return; + regs=&interrupt_registers[vector-12]; + if (vector >= CYGNUM_HAL_INTERRUPT_DEND0A && + vector <= CYGNUM_HAL_INTERRUPT_DEND1B) + return; + if (vector == CYGNUM_HAL_INTERRUPT_WDT) { + HAL_READ_UINT8(CYGARC_TCSR,isr); + isr &= ~0x80; + HAL_WRITE_UINT16(CYGARC_TCSR,0xa500 | isr); + } else { + if ((vector >= CYGNUM_HAL_INTERRUPT_EXTERNAL_0) && regs->isr) { + HAL_READ_UINT8(regs->isr,isr); + isr &= ~(regs->status); + HAL_WRITE_UINT8(regs->isr,isr); + } else { + CYG_FAIL("Unknown interrupt vector"); + } + } +} + +const char priority_table[]={ + 7, 6, 5, 5, 4, 4,-1,-1, + 3, 3,-1, 3, 2, 2, 2, 2, + 1, 1, 1, 1, 0, 0, 0, 0, + 15,15,15,15,14,14,14,14, + 13,13,13,13,-1,-1,-1,-1, + 11,11,11,11,10,10,10,10, + 9,9,9,9 +}; + +CYG_BYTE cyg_hal_level_table[64]; + +void +hal_interrupt_set_level(int vector,int level) +{ + CYG_BYTE *ipr; + CYG_BYTE ipr_mask; + int priority; + if( vector < 12 ) + return; + priority = priority_table[vector-12]; + ipr = (CYG_BYTE *)CYGARC_IPRA + ((priority & 0xf8) >> 3); + if (priority>=0) { + ipr_mask = 1 << (priority & 0x07); + if (level == 0) { + *ipr &= ~ipr_mask; + cyg_hal_level_table[vector] = 0x00; + } else { + *ipr |= ipr_mask; + cyg_hal_level_table[vector] = 0x80; + } + } else { + CYG_FAIL("Unknown interrupt vector"); + } +} + +void +hal_interrupt_configure(int vector,int level,int up) +{ + cyg_uint8 iscr,mask; + if (vector >= CYGNUM_HAL_INTERRUPT_EXTERNAL_0 && + vector <= CYGNUM_HAL_INTERRUPT_EXTERNAL_7) { + mask = 1 << (vector - CYGNUM_HAL_INTERRUPT_EXTERNAL_0); + HAL_READ_UINT8(CYGARC_ISCR,iscr); + if (level) { + iscr &= ~mask; + } + if (up) { + iscr |= mask; + } + CYG_ASSERT(!(up && level), "Cannot trigger on high level!"); + HAL_WRITE_UINT8(CYGARC_ISCR,iscr); + } +} + +/*------------------------------------------------------------------------*/ +/* End of var_misc.c */ diff --git a/ecos/packages/hal/h8300/h8max/current/ChangeLog b/ecos/packages/hal/h8300/h8max/current/ChangeLog new file mode 100644 index 0000000..be2441c --- /dev/null +++ b/ecos/packages/hal/h8300/h8max/current/ChangeLog @@ -0,0 +1,52 @@ +2009-01-31 Bart Veer <bartv@ecoscentric.com> + + * cdl/hal_h8300_h8300h_h8max.cdl: update compiler flags for gcc 4.x + +2004-03-17 Yoshinori Sato <ysato@users.sourceforge.jp> + + * src/hal_diag.c + fix warning. + +2004-03-02 Yoshinori Sato <ysato@users.sourceforge.jp> + + * include/platform.inc + add h8300_save_vectors macro. + +2004-02-24 Yoshinori Sato <ysato@users.sourceforge.jp> + + * cdl/hal_h8300_h8300h_h8max.cdl + add Linker flags "-relax" + move CYGSEM_HAL_H8300_VECTOR_HOOK to hal_h8300.cdl + +2003-12-26 Yoshinori Sato <ysato@users.sourceforge.jp> + + * include/plf_io.h + use endian macros. + +2003-03-09 Yoshinori Sato <ysato@users.sourceforge.jp> + + * New package. + +//=========================================================================== +// ####GPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +// +// This program 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. +// +// This program 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 this program; if not, write to the +// Free Software Foundation, Inc., 51 Franklin Street, +// Fifth Floor, Boston, MA 02110-1301, USA. +// ------------------------------------------- +// ####GPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/ecos/packages/hal/h8300/h8max/current/cdl/hal_h8300_h8300h_h8max.cdl b/ecos/packages/hal/h8300/h8max/current/cdl/hal_h8300_h8300h_h8max.cdl new file mode 100644 index 0000000..3f93cdd --- /dev/null +++ b/ecos/packages/hal/h8300/h8max/current/cdl/hal_h8300_h8300h_h8max.cdl @@ -0,0 +1,298 @@ +# ==================================================================== +# +# hal_h8300_h8300h_h8max.cdl +# +# H8MAX board HAL package configuration data +# +# ==================================================================== +## ####ECOSGPLCOPYRIGHTBEGIN#### +## ------------------------------------------- +## This file is part of eCos, the Embedded Configurable Operating System. +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +## +## This exception does not invalidate any other reasons why a work based +## on this file might be covered by the GNU General Public License. +## ------------------------------------------- +## ####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): yoshinori sato +# Original data: bartv +# Contributors: yoshinori sato +# Date: 2002-08-10 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_H8300_H8300H_H8MAX { + display "H8MAX" + parent CYGPKG_HAL_H8300 + requires CYGPKG_HAL_H8300_H8300H + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + implements CYGINT_HAL_PLF_IF_IDE + define_header hal_h8300_h8300h_h8max.h + include_dir cyg/hal + description " + The h8max HAL package provides the support needed to run + eCos on a H8MAX micom board." + + compile hal_diag.c plf_misc.c delay_us.S + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H <pkgconf/hal_h8300_h8300h.h>" + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H <pkgconf/hal_h8300_h8300h_h8max.h>" + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_IO_H <cyg/hal/plf_io.h>" + + puts $::cdl_header "#define CYG_HAL_H8300" + puts $::cdl_header "#define CYGNUM_HAL_H8300_SCI_PORTS 1" + puts $::cdl_header "#define CYGHWR_HAL_VECTOR_TABLE 0xfffe20" + puts $::cdl_header "#define HAL_PLATFORM_CPU \"H8/300H\"" + puts $::cdl_header "#define HAL_PLATFORM_BOARD \"H8MAX\"" + puts $::cdl_header "#define HAL_PLATFORM_EXTRA \"\"" + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + legal_values {"ROM" "RAM"} + default_value {"ROM"} + no_define + define -file system.h CYG_HAL_STARTUP + description " + When targetting the H8MAX board it is possible to + build the system for either RAM bootstrap or ROM bootstrap. + RAM bootstrap generally requires that the board + is equipped with ROMs containing a suitable ROM monitor or + equivalent software that allows GDB to download the eCos + application and extend Memory on to the board. + The ROM bootstrap typically + requires that the eCos application be blown into EPROMs or + equivalent technology." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 1 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The AKI3068NET board has only one serial port. This option + chooses which port will be used to connect to a host + running GDB." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The H8MAX board has only one serial port. This option + chooses which port will be used for diagnostic output." + } + + # 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_H8300_RTC_PRESCALE { + display "Real-time clock base prescale" + flavor data + calculated 8192 + } + # Isn't a nice way to handle freq requirement! + cdl_option CYGNUM_HAL_RTC_PERIOD { + display "Real-time clock period" + flavor data + calculated 10 + } + } + + cdl_option CYGHWR_HAL_H8300_CPG_INPUT { + display "OSC/Clock Freqency" + flavor data + default_value 25000000 + } + + cdl_option CYGHWR_HAL_H8MAX_EXTRAM { + display "Extend DRAM Using" + flavor bool + default_value 1 + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + parent CYGPKG_NONE + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "h8300-elf" } + 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 { CYGBLD_GLOBAL_WARNFLAGS . " -g -O2 -mh -mint32 -fsigned-char -fdata-sections -fno-rtti -fno-exceptions " } + 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 { "-g -nostdlib -Wl,--gc-sections -Wl,-static -mrelax -mh -mint32" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + cdl_option CYGBLD_BUILD_GDB_STUBS { + display "Build GDB stub ROM image" + default_value 0 + requires CYGSEM_HAL_ROM_MONITOR + requires CYGBLD_BUILD_COMMON_GDB_STUBS + requires CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + requires CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT + requires CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT + no_define + description " + This option enables the building of the GDB stubs for the + board. The common HAL controls takes care of most of the + build process, but the final conversion from ELF image to + binary data is handled by the platform CDL, allowing + relocation of the data if necessary." + + make -priority 320 { + <PREFIX>/bin/gdb_module.bin : <PREFIX>/bin/gdb_module.img + $(OBJCOPY) -O binary $< $@ + } + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { CYG_HAL_STARTUP == "RAM" ? "h8300_h8300h_h8max_ram" : \ + "h8300_h8300h_h8max_rom" } + + 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 { CYG_HAL_STARTUP == "RAM" ? "<pkgconf/mlt_h8300_h8300h_h8max_ram.ldi>" : \ + "<pkgconf/mlt_h8300_h8300h_h8max_rom.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 { CYG_HAL_STARTUP == "RAM" ? "<pkgconf/mlt_h8300_h8300h_h8max_ram.h>" : \ + "<pkgconf/mlt_h8300_h8300h_h8max_rom.h>" } + } + } + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 0 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM" } + description " + Enable this option if this program is to be used as a ROM monitor, + i.e. applications will be loaded into RAM on the board, and this + ROM monitor may process exceptions or interrupts generated from the + application. This enables features such as utilizing a separate + interrupt stack when exceptions are generated." + } + cdl_option CYGHWR_HAL_H8300_VECTOR_ADDRESS { + display "Hook Vector Address" + flavor data + default_value 0xfffd20 + active_if CYGSEM_HAL_H8300_VECTOR_HOOK + parent CYGPKG_HAL_ROM_MONITOR + description " + Hooking Vector Table Address" + } + cdl_option CYGHAL_PLF_SCI_BASE { + display "SCI Base address" + flavor data + default_value 0xffffb8 + description " + Used SCI Channel base address." + } + cdl_option CYGDAT_REDBOOT_H8300_LINUX_COMMAND_START { + display "Default kernel command line start address" + flavor data + default_value 0x5ffe00 + description " + This option uClinux kernel command line start address of default." + } + + cdl_option CYGDAT_REDBOOT_H8300_LINUX_BOOT_COMMAND_LINE { + display "Default command line" + flavor data + default_value { "console=/dev/ttySC1" } + description " + This option uClinux kernel startup command line of default." + } +} diff --git a/ecos/packages/hal/h8300/h8max/current/include/hal_diag.h b/ecos/packages/hal/h8300/h8max/current/include/hal_diag.h new file mode 100644 index 0000000..ae7dd99 --- /dev/null +++ b/ecos/packages/hal/h8300/h8max/current/include/hal_diag.h @@ -0,0 +1,79 @@ +#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 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-04-06 +// 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> + +externC void hal_diag_init(void); +externC void hal_diag_write_char(cyg_uint8 c); +externC void hal_diag_read_char(cyg_uint8 *c); + +/*---------------------------------------------------------------------------*/ + +#define HAL_DIAG_INIT() hal_diag_init() + +#define HAL_DIAG_WRITE_CHAR(_c_) hal_diag_write_char(_c_) + +#define HAL_DIAG_READ_CHAR(_c_) hal_diag_read_char(&_c_) + +//----------------------------------------------------------------------------- +// Simple LED control. +externC void hal_diag_led_on( void ); +externC void hal_diag_led_off( void ); + +/*---------------------------------------------------------------------------*/ +/* end of hal_diag.h */ +#endif /* CYGONCE_HAL_HAL_DIAG_H */ diff --git a/ecos/packages/hal/h8300/h8max/current/include/pkgconf/mlt_h8300_h8300h_h8max_ram.h b/ecos/packages/hal/h8300/h8max/current/include/pkgconf/mlt_h8300_h8300h_h8max_ram.h new file mode 100644 index 0000000..fbd3d37 --- /dev/null +++ b/ecos/packages/hal/h8300/h8max/current/include/pkgconf/mlt_h8300_h8300h_h8max_ram.h @@ -0,0 +1,14 @@ +// eCos memory layout - Wed Nov 24 13:10:23 1999 + +// This is a generated file - changes will be lost if ConfigTool(MLT) is run + +#ifndef __ASSEMBLER__ +#include <cyg/infra/cyg_type.h> +#include <stddef.h> + +#endif + +#define CYGMEM_REGION_ram (0x420000) +#define CYGMEM_REGION_ram_SIZE (0x1E0000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) + diff --git a/ecos/packages/hal/h8300/h8max/current/include/pkgconf/mlt_h8300_h8300h_h8max_ram.ldi b/ecos/packages/hal/h8300/h8max/current/include/pkgconf/mlt_h8300_h8300h_h8max_ram.ldi new file mode 100644 index 0000000..b48770a --- /dev/null +++ b/ecos/packages/hal/h8300/h8max/current/include/pkgconf/mlt_h8300_h8300h_h8max_ram.ldi @@ -0,0 +1,31 @@ +// eCos memory layout - Fri Oct 20 08:25:16 2000 + +// This is a generated file - do not edit + +#include <cyg/infra/cyg_type.inc> + +OUTPUT_FORMAT("elf32-h8300") +OUTPUT_ARCH(h8300h) + +MEMORY +{ + ram : ORIGIN = 0x400000, LENGTH = 0x30000 + iram : ORIGIN = 0xffbf20, LENGTH = 0x4000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_text (ram, 0x400000, 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 (0x4),LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4),LMA_EQ_VMA) + SECTION_int_hook_table (iram, CYGHWR_HAL_H8300_VECTOR_ADDRESS, FOLLOWING(.data)) + SECTIONS_END +} + +fook_table_address = 0xffbf20; diff --git a/ecos/packages/hal/h8300/h8max/current/include/pkgconf/mlt_h8300_h8300h_h8max_ram.mlt b/ecos/packages/hal/h8300/h8max/current/include/pkgconf/mlt_h8300_h8300h_h8max_ram.mlt new file mode 100644 index 0000000..764513a --- /dev/null +++ b/ecos/packages/hal/h8300/h8max/current/include/pkgconf/mlt_h8300_h8300h_h8max_ram.mlt @@ -0,0 +1,12 @@ +version 0 +region ram 400000 10000 0 ! +section text 0 1 0 1 0 1 0 1 400000 400000 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 int_hook_table int_hook_table ! +section int_hook_table 0 1 0 1 0 1 0 1 data data ! +section data 0 4 0 1 0 1 0 1 bss bss ! +section bss 0 4 0 1 0 1 0 0 ! + diff --git a/ecos/packages/hal/h8300/h8max/current/include/pkgconf/mlt_h8300_h8300h_h8max_rom.h b/ecos/packages/hal/h8300/h8max/current/include/pkgconf/mlt_h8300_h8300h_h8max_rom.h new file mode 100644 index 0000000..3b12905 --- /dev/null +++ b/ecos/packages/hal/h8300/h8max/current/include/pkgconf/mlt_h8300_h8300h_h8max_rom.h @@ -0,0 +1,18 @@ +// eCos memory layout - Wed Nov 24 13:10:23 1999 + +// This is a generated file - changes will be lost if ConfigTool(MLT) is run + +#ifndef __ASSEMBLER__ +#include <cyg/infra/cyg_type.h> +#include <stddef.h> + +#endif + +#define CYGMEM_REGION_ram (0x400000) +#if !defined(CYGPKG_IO_ETH_DRIVERS) +#define CYGMEM_REGION_ram_SIZE (0x200000) +#else +#define CYGMEM_REGION_ram_SIZE (0x200000-0xC000) +#endif +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) + diff --git a/ecos/packages/hal/h8300/h8max/current/include/pkgconf/mlt_h8300_h8300h_h8max_rom.ldi b/ecos/packages/hal/h8300/h8max/current/include/pkgconf/mlt_h8300_h8300h_h8max_rom.ldi new file mode 100644 index 0000000..d123d9c --- /dev/null +++ b/ecos/packages/hal/h8300/h8max/current/include/pkgconf/mlt_h8300_h8300h_h8max_rom.ldi @@ -0,0 +1,47 @@ +// eCos memory layout - Fri Oct 20 08:25:16 2000 + +// This is a generated file - do not edit + +#include <cyg/infra/cyg_type.inc> + +OUTPUT_FORMAT("elf32-h8300") +OUTPUT_ARCH(h8300h) + +MEMORY +{ +#define IRAM_TOP 0xffbf20 + rom : ORIGIN = 0x000000, LENGTH = 0x60000 +#if !defined(CYGPKG_IO_ETH_DRIVERS) +#define WORK IRAM_TOP+0x100 + ram : ORIGIN = WORK, LENGTH = 0x4000-0x100 +#else +#define WORK 0x5f4000 + ram : ORIGIN = WORK, LENGTH = 0xC000 + iram : ORIGIN = IRAM_TOP, LENGTH = 0x4000 +#endif +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (rom, 0x000000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x1), LMA_EQ_VMA) +#if !defined(CYGSEM_HAL_H8300_VECTOR_HOOK) + SECTION_int_hook_table (rom, ALIGN (0x2), LMA_EQ_VMA) +#endif + SECTION_fixup (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x1), LMA_EQ_VMA) + SECTION_data (ram, WORK,FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x4),LMA_EQ_VMA) +#if defined(CYGSEM_HAL_H8300_VECTOR_HOOK) +#if !defined(CYGPKG_IO_ETH_DRIVERS) + SECTION_int_hook_table (ram, CYGHWR_HAL_H8300_VECTOR_ADDRESS, LMA_EQ_VMA) +#else + SECTION_int_hook_table (iram, CYGHWR_HAL_H8300_VECTOR_ADDRESS, LMA_EQ_VMA) +#endif +#endif + SECTIONS_END +} diff --git a/ecos/packages/hal/h8300/h8max/current/include/pkgconf/mlt_h8300_h8300h_h8max_rom.mlt b/ecos/packages/hal/h8300/h8max/current/include/pkgconf/mlt_h8300_h8300h_h8max_rom.mlt new file mode 100644 index 0000000..ebd5c38 --- /dev/null +++ b/ecos/packages/hal/h8300/h8max/current/include/pkgconf/mlt_h8300_h8300h_h8max_rom.mlt @@ -0,0 +1,12 @@ +version 0 +region ram ffbf20 ffff20 0 ! +section rom_vectors 0 1 0 1 1 1 1 1 0 60000 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 4 0 1 0 1 0 1 bss bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! diff --git a/ecos/packages/hal/h8300/h8max/current/include/platform.inc b/ecos/packages/hal/h8300/h8max/current/include/platform.inc new file mode 100644 index 0000000..e481cd7 --- /dev/null +++ b/ecos/packages/hal/h8300/h8max/current/include/platform.inc @@ -0,0 +1,143 @@ +#ifndef CYGONCE_HAL_PLATFORM_INC +#define CYGONCE_HAL_PLATFORM_INC +##============================================================================= +## +## platform.inc +## +## H8MAX "board" assembler header file +## +##============================================================================= +## ####ECOSGPLCOPYRIGHTBEGIN#### +## ------------------------------------------- +## This file is part of eCos, the Embedded Configurable Operating System. +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +## +## This exception does not invalidate any other reasons why a work based +## on this file might be covered by the GNU General Public License. +## ------------------------------------------- +## ####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): Yoshinori Sato +## Contributors: Yoshinori Sato,Masahiro Ochiai +## Date: 2002-08-10 +## Purpose: H8MAX "board" definitions. +## Description: This file contains various definitions and macros that are +## required for writing assembly code for the H8MAX board +## Currently there are none +## Usage: +## #include <cyg/hal/platform.inc> +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include <pkgconf/hal.h> + +#include <cyg/hal/mod_regs_bsc.h> +#include <cyg/hal/mod_regs_pio.h> + +##----------------------------------------------------------------------------- + +#define CYGPKG_HAL_H8300_MEMC_DEFINED + .macro hal_memc_init +#if defined(CYG_HAL_STARTUP_ROM) + mov.l #init_regs,er0 +1: + mov.w @er0+,r2 + beq 1f + mov.w #0x00ff,e2 ; internal I/O regs (2) high address + cmp.w #0xf000,r2 + bhi 2f + dec.w #1,e2 ; internal I/O regs (1) high address +2: + mov.w @er0+,r1 + mov.b r1l,@er2 + bra 1b + +init_regs: +#define INIT_REGS_DATA(REGS,DATA) \ + .word (REGS & 0xffff),DATA +init_regs: +INIT_REGS_DATA(CYGARC_RTCOR,195) +INIT_REGS_DATA(CYGARC_RTMCSR,0x17) +INIT_REGS_DATA(CYGARC_DRCRB,0xb8) +INIT_REGS_DATA(CYGARC_DRCRA,0x38) +INIT_REGS_DATA(CYGARC_ASTCR,0xfa) +INIT_REGS_DATA(CYGARC_ABWCR,0xe0) +INIT_REGS_DATA(CYGARC_BCR ,0xc7) +INIT_REGS_DATA(CYGARC_CSCR ,0x1f) +INIT_REGS_DATA(CYGARC_WCRH ,0xfd) +INIT_REGS_DATA(CYGARC_WCRL ,0x44) +INIT_REGS_DATA(CYGARC_P1DDR,0xff) +INIT_REGS_DATA(CYGARC_P2DDR,0xff) +INIT_REGS_DATA(CYGARC_P6DDR,0xf6) +INIT_REGS_DATA(CYGARC_P8DDR,0xee) + .word 0 +;; Special Thanks Masahiro Ochiai + +;; External peripheral setup delay +1: + mov.l #420000,er0 ;wait 50ms +2: + dec.l #1,er0 + bpl 2b +#endif + .endm + +#define CYGPKG_HAL_H8300_DIAG_DEFINED + + .macro hal_diag_init + mov.b #0x83,r0l + mov.b r0l,@CYGARC_PADDR + mov.b #0,r0l + mov.b r0l,@CYGARC_PADR + .endm + + .macro hal_diag_excpt_start + .endm + + .macro hal_diag_intr_start + .endm + + .macro hal_diag_restore + .endm + + .macro hal_diag_data + .endm + +#if defined(CYGPKG_IO_ETH_DRIVERS) +#define CYGPKG_HAL_H8300_SAVED_VECTORS + .macro h8300_save_vectors + .byte 16 + .endm +#endif + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_PLATFORM_INC +# end of platform.inc diff --git a/ecos/packages/hal/h8300/h8max/current/include/plf_intr.h b/ecos/packages/hal/h8300/h8max/current/include/plf_intr.h new file mode 100644 index 0000000..80a47d2 --- /dev/null +++ b/ecos/packages/hal/h8300/h8max/current/include/plf_intr.h @@ -0,0 +1,75 @@ +#ifndef CYGONCE_HAL_PLF_INTR_H +#define CYGONCE_HAL_PLF_INTR_H + +//========================================================================== +// +// plf_intr.h +// +// H8MAX board interrupt and clock support +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: ysato +// Date: ysato +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock for the simulator. This file +// is empty since none are required! +// +// Usage: +// #include <cyg/hal/plf_intr.h> +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + + +//-------------------------------------------------------------------------- + +externC void h8300h_reset (void); +externC void hal_delay_us(int usecs); + +#define HAL_PLATFORM_RESET(x) +#define HAL_PLATFORM_RESET_ENTRY &h8300h_reset + +#define HAL_DELAY_US(n) hal_delay_us((n)) + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_PLF_INTR_H +// End of plf_intr.h diff --git a/ecos/packages/hal/h8300/h8max/current/include/plf_io.h b/ecos/packages/hal/h8300/h8max/current/include/plf_io.h new file mode 100644 index 0000000..8f3def9 --- /dev/null +++ b/ecos/packages/hal/h8300/h8max/current/include/plf_io.h @@ -0,0 +1,97 @@ +#ifndef CYGONCE_HAL_PLF_IO_H +#define CYGONCE_HAL_PLF_IO_H + +//============================================================================= +// +// plf_io.h +// +// platform specific IO support +// +//============================================================================= +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): ysato +// Contributors: ysato +// Date: 2002-08-29 +// Purpose: H8MAX IO support +// Description: The macros defined here provide the HAL APIs for handling +// basic IO +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include <pkgconf/system.h> +#include <cyg/hal/hal_endian.h> + +//----------------------------------------------------------------------------- +// IDE interface macros +// +#define HAL_IDE_NUM_CONTROLLERS 1 + +// Initialize the IDE controller(s). +#define HAL_IDE_INIT() (HAL_IDE_NUM_CONTROLLERS) + +#define IDE_CMD_ADDRESS 0x200000 +#define IDE_CTL_ADDRESS 0x600000 + +#define HAL_IDE_READ_UINT8( __ctlr, __regno, __val ) \ + HAL_READ_UINT8(IDE_CMD_ADDRESS + ((__regno)<<1)+1 , (__val)) +#define HAL_IDE_READ_UINT16( __ctlr, __regno, __val ) \ + hal_ide_read_uint16_swap(__regno,&(__val) ) +#define HAL_IDE_READ_ALTSTATUS( __ctlr, __val ) \ + HAL_READ_UINT16(IDE_CTL_ADDRESS + 12, (__val)) + +#define HAL_IDE_WRITE_UINT8( __ctlr, __regno, __val ) \ + HAL_WRITE_UINT16(IDE_CMD_ADDRESS + ((__regno)<<1)+1 , (__val)) +#define HAL_IDE_WRITE_UINT16( __ctlr, __regno, __val ) \ + hal_ide_write_uint16_swap(__regno, __val ) +#define HAL_IDE_WRITE_CONTROL( __ctlr, __val ) \ + HAL_WRITE_UINT16(IDE_CTL_ADDRESS + 12, (__val)) + +static inline void hal_ide_read_uint16_swap(CYG_WORD16 __regno, CYG_WORD16 *__val ) +{ + CYG_WORD16 d; + d = *(volatile CYG_WORD16 *)(IDE_CMD_ADDRESS + (__regno <<1)); + *__val = CYG_LE16_TO_CPU(d); +} + +static inline void hal_ide_write_uint16_swap(CYG_WORD16 __regno, CYG_WORD16 __val ) +{ + *(volatile CYG_WORD16 *)(IDE_CMD_ADDRESS + (__regno <<1)) = CYG_CPU_TO_LE16(__val); +} +//----------------------------------------------------------------------------- +#endif +// end of plf_io.h diff --git a/ecos/packages/hal/h8300/h8max/current/include/plf_stub.h b/ecos/packages/hal/h8300/h8max/current/include/plf_stub.h new file mode 100644 index 0000000..f8d2985 --- /dev/null +++ b/ecos/packages/hal/h8300/h8max/current/include/plf_stub.h @@ -0,0 +1,89 @@ +#ifndef CYGONCE_HAL_PLF_STUB_H +#define CYGONCE_HAL_PLF_STUB_H + +//============================================================================= +// +// plf_stub.h +// +// Platform header for GDB stub support. +// +//============================================================================= +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov,ysato +// Date: 1999-05-18 +// Purpose: Platform HAL stub support for H8/300H simulator +// Usage: #include <cyg/hal/plf_stub.h> +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include <pkgconf/system.h> +#include <pkgconf/hal.h> + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include <cyg/infra/cyg_type.h> // CYG_UNUSED_PARAM, externC + +#include <cyg/hal/h8300_stub.h> // architecture stub support + +#include <cyg/hal/hal_diag.h> // hal_diag_led_on + +//---------------------------------------------------------------------------- +// Define some platform specific communication details. This is mostly +// handled by hal_if now, but we need to make sure the comms tables are +// properly initialized. + +externC void cyg_hal_plf_comms_init(void); + +#define HAL_STUB_PLATFORM_INIT_SERIAL() cyg_hal_plf_comms_init() + +#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) CYG_UNUSED_PARAM(int, (baud)) +#define HAL_STUB_PLATFORM_INTERRUPTIBLE 0 + +//---------------------------------------------------------------------------- +// Stub initializer. +#ifdef CYGSEM_HAL_ROM_MONITOR +# define HAL_STUB_PLATFORM_INIT() hal_diag_led_on() +#else +# define HAL_STUB_PLATFORM_INIT() CYG_EMPTY_STATEMENT +#endif + +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_PLF_STUB_H +// End of plf_stub.h diff --git a/ecos/packages/hal/h8300/h8max/current/src/delay_us.S b/ecos/packages/hal/h8300/h8max/current/src/delay_us.S new file mode 100644 index 0000000..a29eb96 --- /dev/null +++ b/ecos/packages/hal/h8300/h8max/current/src/delay_us.S @@ -0,0 +1,25 @@ +;;delay_us + +#include <pkgconf/hal.h> + +#include <cyg/hal/arch.inc> +#include <cyg/hal/basetype.h> +#include <cyg/hal/mod_regs_tmr.h> + +// .file "delay_us.S" + .h8300h + .text + + .global CYG_LABEL_DEFN(hal_delay_us) +CYG_LABEL_DEFN(hal_delay_us): + shlr.l er0 + shlr.l er0 + shlr.l er0 + mov.l er0,er0 +1: + ble 4f + dec.l #1,er0 + bra 1b +4: + rts + diff --git a/ecos/packages/hal/h8300/h8max/current/src/hal_diag.c b/ecos/packages/hal/h8300/h8max/current/src/hal_diag.c new file mode 100644 index 0000000..2bfb646 --- /dev/null +++ b/ecos/packages/hal/h8300/h8max/current/src/hal_diag.c @@ -0,0 +1,186 @@ +/*============================================================================= +// +// hal_diag.c +// +// HAL diagnostic output code +// +//============================================================================= +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): ysato +// Contributors: ysato +// Date: 2002-04-05 +// Purpose: HAL diagnostic output +// Description: Implementations of HAL diagnostic output support. +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include <pkgconf/hal.h> + +#include <cyg/hal/hal_diag.h> +#include <cyg/hal/h8_sci.h> +#include <cyg/hal/var_intr.h> +#include <cyg/hal/hal_intr.h> +#include <cyg/hal/hal_misc.h> + +#define SCI_BASE ((cyg_uint8*)CYGHAL_PLF_SCI_BASE) + +static channel_data_t channel = { (cyg_uint8*)SCI_BASE, 0, 0}; + +void +cyg_hal_plf_comms_init(void) +{ + static int initialized = 0; + + if (initialized) + return; + + initialized = 1; + + cyg_hal_plf_sci_init(0, 0, CYGNUM_HAL_INTERRUPT_RXI1, SCI_BASE); +} + +//============================================================================= +// Led control +//============================================================================= +#define LED CYGARC_PADR + +void +hal_diag_led_on( void ) +{ + HAL_WRITE_UINT8(LED, 0x01); +} + +void +hal_diag_led_off( void ) +{ + HAL_WRITE_UINT8(LED, 0); +} + +//============================================================================= +// Compatibility with older stubs +//============================================================================= + +#if defined(CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS) +#include <cyg/hal/hal_stub.h> // hal_output_gdb_string +#endif + +void hal_diag_init(void) +{ + cyg_hal_plf_sci_init_channel(&channel); +} + +void +hal_diag_write_char( cyg_uint8 c ) +{ +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + static char line[100]; + static int pos = 0; + + // No need to send CRs + if( c == '\r' ) return; + + line[pos++] = c; + + if( c == '\n' || pos == sizeof(line) ) + { + CYG_INTERRUPT_STATE old; + + // Disable interrupts. This prevents GDB trying to interrupt us + // while we are in the middle of sending a packet. The serial + // receive interrupt will be seen when we re-enable interrupts + // later. + + CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION(old); + + while(1) + { + char c1; + static char hex[] = "0123456789ABCDEF"; + cyg_uint8 csum = 0; + int i; + + cyg_hal_plf_sci_putc(&channel, '$'); + cyg_hal_plf_sci_putc(&channel, 'O'); + csum += 'O'; + for( i = 0; i < pos; i++ ) + { + char ch = line[i]; + char h = hex[(ch>>4)&0xF]; + char l = hex[ch&0xF]; + cyg_hal_plf_sci_putc(&channel, h); + cyg_hal_plf_sci_putc(&channel, l); + csum += h; + csum += l; + } + cyg_hal_plf_sci_putc(&channel, '#'); + cyg_hal_plf_sci_putc(&channel, hex[(csum>>4)&0xF]); + cyg_hal_plf_sci_putc(&channel, hex[csum&0xF]); + + // Wait for the ACK character '+' from GDB here and handle + // receiving a ^C instead. + c1 = (char) cyg_hal_plf_sci_getc(&channel); + + if( c1 == '+' ) + break; // a good acknowledge + + // Check for user break. + if( cyg_hal_is_break( &c1, 1 ) ) + cyg_hal_user_break( NULL ); + + // otherwise, loop round again + } + + pos = 0; + + // And re-enable interrupts + CYG_HAL_GDB_LEAVE_CRITICAL_IO_REGION(old); + } +#else // CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + cyg_hal_plf_sci_putc(&channel, c); +#endif +} + +void +hal_diag_read_char(cyg_uint8 *c) +{ + *c = (char) cyg_hal_plf_sci_getc(&channel); +} + +/*===========================================================================*/ +/* EOF hal_diag.c */ + diff --git a/ecos/packages/hal/h8300/h8max/current/src/plf_misc.c b/ecos/packages/hal/h8300/h8max/current/src/plf_misc.c new file mode 100644 index 0000000..51bbba1 --- /dev/null +++ b/ecos/packages/hal/h8300/h8max/current/src/plf_misc.c @@ -0,0 +1,160 @@ +//========================================================================== +// +// plf_misc.c +// +// HAL platform miscellaneous functions +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): ysayo +// Contributors: ysato +// Date: 2002-08-10 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include <pkgconf/hal.h> + +#include <cyg/infra/cyg_type.h> // Base types + +#include <cyg/hal/hal_arch.h> // architectural definitions +#include <cyg/hal/hal_io.h> +#include <cyg/hal/hal_if.h> +#include <cyg/hal/plf_intr.h> +#include <cyg/hal/var_arch.h> + +/*------------------------------------------------------------------------*/ + +void hal_platform_init(void) +{ + hal_if_init(); +} + +void h8300h_reset(void) +{ + __asm__ ("ldc #0x80,ccr\n" + "jmp @@0\n\t"); +} + +/*------------------------------------------------------------------------*/ +/* Control C ISR support */ + +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) + +struct Hal_SavedRegisters *hal_saved_interrupt_state; + +#endif + +/*------------------------------------------------------------------------*/ +/* clock support */ + +void hal_clock_initialize(cyg_uint32 period) +{ + CYG_BYTE prescale; +#if CYGNUM_HAL_H8300_RTC_PRESCALE == 8 + prescale = 0x01; +#else +#if CYGNUM_HAL_H8300_RTC_PRESCALE == 64 + prescale = 0x02; +#else +#if CYGNUM_HAL_H8300_RTC_PRESCALE == 8192 + prescale = 0x03; +#else +#error illigal RTC prescale setting +#endif +#endif +#endif + HAL_WRITE_UINT8(CYGARC_TCORA3,period); + HAL_WRITE_UINT8(CYGARC_8TCNT3,0x00); + HAL_WRITE_UINT8(CYGARC_8TCR3,0x48 | prescale); + HAL_WRITE_UINT8(CYGARC_8TCSR3,0x00); +} + +void hal_clock_reset(cyg_uint32 vector, cyg_uint32 period) +{ + HAL_WRITE_UINT8(CYGARC_8TCR3,0x00); + HAL_WRITE_UINT8(CYGARC_8TCSR3,0x00); + hal_clock_initialize(period); +} + +void hal_clock_read(cyg_uint32 *pvalue) +{ + CYG_BYTE val; + HAL_READ_UINT8(CYGARC_8TCNT3,val); + *pvalue = val; +} + +//--------------------------------------------------------------------------- +// Low-level delay (in microseconds) + +#if 0 +void hal_delay_us(int usecs) +{ + volatile CYG_BYTE *tcr = (CYG_BYTE *)CYGARC_8TCR2; + volatile CYG_BYTE *tcnt = (CYG_BYTE *)CYGARC_8TCNT2; + short clocks_per_us = (CYGHWR_HAL_H8300_PROCESSOR_SPEED/1000000)/8*25; + //short clocks_per_us = (CYGHWR_HAL_H8300_PROCESSOR_SPEED/1000000)/20; + unsigned char val1,val2; + short diff; + + usecs /= 25; + + *tcnt = 0x00; + *tcr = 0x01; + + diff = 0; + while (usecs > 0) { + while (diff < clocks_per_us) { + val1 = *tcnt; + while ((val2 = *tcnt) == val1); + if (val2 < val1) + diff += val2 + 0x100 - val1; + else + diff += val2 - val1; + } + usecs -= diff / clocks_per_us; + diff -= clocks_per_us; + } + *tcr = 0x00; +} +#endif + +/*------------------------------------------------------------------------*/ +/* End of plf_misc.c */ diff --git a/ecos/packages/hal/h8300/h8s/current/ChangeLog b/ecos/packages/hal/h8300/h8s/current/ChangeLog new file mode 100644 index 0000000..fd28fc7 --- /dev/null +++ b/ecos/packages/hal/h8300/h8s/current/ChangeLog @@ -0,0 +1,48 @@ +2004-04-22 Jani Monoses <jani@iv.ro> + + * cdl/hal_h8300_h8s.cdl : + Invoke tail with stricter syntax that works in latest coreutils. + +2004-03-18 Yoshinori Sato <ysato@users.sourceforge.jp> + + * include/variant.inc + fix exr handling. + +2003-12-08 Yoshinori Sato <ysato@users.sourceforge.jp> + + * src/h8300_h8s.ld + fix typo. + * src/h8s_stub.c + rewrite. use CPU trace support. + * include/variant.inc + single step exception support. + * include/var_arch.h + add EXR read/write support. + +2003-03-09 Yoshinori Sato <ysato@users.sourceforge.jp> + + * New package. + +//=========================================================================== +// ####GPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +// +// This program 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. +// +// This program 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 this program; if not, write to the +// Free Software Foundation, Inc., 51 Franklin Street, +// Fifth Floor, Boston, MA 02110-1301, USA. +// ------------------------------------------- +// ####GPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/ecos/packages/hal/h8300/h8s/current/cdl/hal_h8300_h8s.cdl b/ecos/packages/hal/h8300/h8s/current/cdl/hal_h8300_h8s.cdl new file mode 100644 index 0000000..9bed6a8 --- /dev/null +++ b/ecos/packages/hal/h8300/h8s/current/cdl/hal_h8300_h8s.cdl @@ -0,0 +1,120 @@ +# ==================================================================== +# +# hal_h8300_h8s.cdl +# +# H8S variant architectural HAL package configuration data +# +# ==================================================================== +## ####ECOSGPLCOPYRIGHTBEGIN#### +## ------------------------------------------- +## This file is part of eCos, the Embedded Configurable Operating System. +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +## +## This exception does not invalidate any other reasons why a work based +## on this file might be covered by the GNU General Public License. +## ------------------------------------------- +## ####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): ysato +# Original data: nickg +# Contributors: ysato +# Date: 2003-01-01 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_H8300_H8S { + display "H8S variant" + parent CYGPKG_HAL_H8300 + implements CYGINT_HAL_H8300_VARIANT + hardware + include_dir cyg/hal + define_header hal_h8300_h8s.h + description " + The H8S variant HAL package provides generic + support for this processor architecture. It is also + necessary to select a specific target platform HAL + package." + + define_proc { + puts $::cdl_header "#include <pkgconf/hal_h8300.h>" + } + + compile var_misc.c h8s_stub.c + + make { + <PREFIX>/lib/target.ld: <PACKAGE>/src/h8300_h8s.ld + $(CC) -E -P -Wp,-MD,target.tmp -DEXTRAS=1 -xc $(INCLUDE_PATH) $(CFLAGS) -o $@ $< + @echo $@ ": \\" > $(notdir $@).deps + @tail -n +2 target.tmp >> $(notdir $@).deps + @echo >> $(notdir $@).deps + @rm target.tmp + } + + cdl_option CYGBLD_LINKER_SCRIPT { + display "Linker script" + flavor data + no_define + calculated { "src/h8300_h8s.ld" } + } + + cdl_component CYGHWR_HAL_H8S_CLOCK_SETTINGS { + display "H8S on-chip generic clock controls" + description " + The various clocks used by the system are controlled by + these options, some of which are derived from platform + settings." + flavor none + no_define + + cdl_option CYGHWR_HAL_H8300_DIVIDER_RATE { + display "Divider Rate (1/n)" + flavor data + legal_values { 1 2 4 8 } + default_value 1 + description " + The system clock divide rate setting" + } + cdl_option CYGHWR_HAL_H8300_MULT_RATE { + display "PLL Multiplier Rate (Nx)" + flavor data + legal_values { 1 2 4 } + default_value 1 + description " + The system clock divide rate setting" + } + cdl_option CYGHWR_HAL_H8300_PROCESSOR_SPEED { + display "Processor clock speed (MHz)" + flavor data + calculated { CYGHWR_HAL_H8300_CPG_INPUT * CYGHWR_HAL_H8300_MULT_RATE / CYGHWR_HAL_H8300_DIVIDER_RATE } + description " + The core (CPU) speed is computed from + the input clock speed and the divider setting." + } + } +} diff --git a/ecos/packages/hal/h8300/h8s/current/include/h8_sci.h b/ecos/packages/hal/h8300/h8s/current/include/h8_sci.h new file mode 100644 index 0000000..5a64ac5 --- /dev/null +++ b/ecos/packages/hal/h8300/h8s/current/include/h8_sci.h @@ -0,0 +1,79 @@ +//============================================================================= +// +// h8_sci.h +// +// Simple driver for the H8S Serial Communication Interface (SCI) +// +//============================================================================= +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 1999-05-17 +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include <pkgconf/hal.h> + +//-------------------------------------------------------------------------- +// Exported functions + +externC void cyg_hal_plf_sci_init_channel(void* __ch_data); +externC cyg_uint8 cyg_hal_plf_sci_getc(void* __ch_data); +externC void cyg_hal_plf_sci_putc(void* __ch_data, cyg_uint8 c); +externC void cyg_hal_plf_sci_init(int sci_index, int comm_index, + int rcv_vect, cyg_uint8* base); + +//-------------------------------------------------------------------------- +// SCI register offsets +#define _REG_SCSMR 0x0 // serial mode register +#define _REG_SCBRR 0x1 // bit rate register +#define _REG_SCSCR 0x2 // serial control register +#define _REG_SCTDR 0x3 // transmit data register +#define _REG_SCSSR 0x4 // serial status register +#define _REG_SCRDR 0x5 // receive data register + +//-------------------------------------------------------------------------- + +typedef struct { + cyg_uint8* base; + cyg_int32 msec_timeout; + int isr_vector; +} channel_data_t; + +//-------------------------------------------------------------------------- +// end of h8_sci.h diff --git a/ecos/packages/hal/h8300/h8s/current/include/mod_regs_adc.h b/ecos/packages/hal/h8300/h8s/current/include/mod_regs_adc.h new file mode 100644 index 0000000..58871ae --- /dev/null +++ b/ecos/packages/hal/h8300/h8s/current/include/mod_regs_adc.h @@ -0,0 +1,89 @@ +#ifndef CYGONCE_MOD_REGS_ADC_H +#define CYGONCE_MOD_REGS_ADC_H + +//========================================================================== +// +// mod_regs_adc.h +// +// A/D D/A Converter Register +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2003-01-01 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_DASTCR 0xFEE01A +#define CYGARC_DADR0 0xFFFFA4 +#define CYGARC_DADR1 0xFFFFA5 +#define CYGARC_DACR01 0xFFFFA6 +#define CYGARC_DADR2 0xFFFFA8 +#define CYGARC_DADR3 0xFFFFA9 +#define CYGARC_DACR23 0xFFFFAA + +#define CYGARC_ADDRA 0xFFFF90 +#define CYGARC_ADDRAH 0xFFFF90 +#define CYGARC_ADDRAL 0xFFFF91 +#define CYGARC_ADDRB 0xFFFF92 +#define CYGARC_ADDRBH 0xFFFF92 +#define CYGARC_ADDRBL 0xFFFF93 +#define CYGARC_ADDRC 0xFFFF94 +#define CYGARC_ADDRCH 0xFFFF94 +#define CYGARC_ADDRCL 0xFFFF95 +#define CYGARC_ADDRD 0xFFFF96 +#define CYGARC_ADDRDH 0xFFFF96 +#define CYGARC_ADDRDL 0xFFFF97 +#define CYGARC_ADDRE 0xFFFF98 +#define CYGARC_ADDREH 0xFFFF98 +#define CYGARC_ADDREL 0xFFFF99 +#define CYGARC_ADDRF 0xFFFF9A +#define CYGARC_ADDRFH 0xFFFF9A +#define CYGARC_ADDRFL 0xFFFF9B +#define CYGARC_ADDRG 0xFFFF9C +#define CYGARC_ADDRGH 0xFFFF9C +#define CYGARC_ADDRGL 0xFFFF9D +#define CYGARC_ADDRH 0xFFFF9E +#define CYGARC_ADDRHH 0xFFFF9E +#define CYGARC_ADDRHL 0xFFFF9F + +#define CYGARC_ADCSR 0xFFFFA0 +#define CYGARC_ADCR 0xFFFFA1 + +#endif diff --git a/ecos/packages/hal/h8300/h8s/current/include/mod_regs_bsc.h b/ecos/packages/hal/h8300/h8s/current/include/mod_regs_bsc.h new file mode 100644 index 0000000..9e8d292 --- /dev/null +++ b/ecos/packages/hal/h8300/h8s/current/include/mod_regs_bsc.h @@ -0,0 +1,71 @@ +#ifndef CYGONCE_MOD_REGS_BSC_H +#define CYGONCE_MOD_REGS_BSC_H + +//========================================================================== +// +// mod_regs_bsc.h +// +// Bus Controler Register +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2003-01-01 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_ABWCR 0xFFFEC0 +#define CYGARC_ASTCR 0xFFFEC1 +#define CYGARC_WTCRAH 0xFFFEC2 +#define CYGARC_WTCRAL 0xFFFEC3 +#define CYGARC_WTCRBH 0xFFFEC4 +#define CYGARC_WTCRBL 0xFFFEC5 +#define CYGARC_RDNCR 0xFFFEC6 +#define CYGARC_CSACRH 0xFFFEC8 +#define CYGARC_CSACRL 0xFFFEC9 +#define CYGARC_BROMCRH 0xFFFECA +#define CYGARC_BROMCRL 0xFFFECB +#define CYGARC_BCR 0xFFFECC +#define CYGARC_DRAMCR 0xFFFED0 +#define CYGARC_DRACCR 0xFFFED2 +#define CYGARC_REFCR 0xFFFED4 +#define CYGARC_RTCNT 0xFFFED6 +#define CYGARC_RTCOR 0xFFFED7 + +#endif diff --git a/ecos/packages/hal/h8300/h8s/current/include/mod_regs_dmac.h b/ecos/packages/hal/h8300/h8s/current/include/mod_regs_dmac.h new file mode 100644 index 0000000..1afbcf3 --- /dev/null +++ b/ecos/packages/hal/h8300/h8s/current/include/mod_regs_dmac.h @@ -0,0 +1,107 @@ +#ifndef CYGONCE_MOD_REGS_DMAC_H +#define CYGONCE_MOD_REGS_DMAC_H + +//========================================================================== +// +// mod_regs_dmac.h +// +// DMA Controler Register +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2003-01-01 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_MAR0AH 0xFFFEE0 +#define CYGARC_MAR0AL 0xFFFEE2 +#define CYGARC_IOAR0A 0xFFFEE4 +#define CYGARC_ETCR0A 0xFFFEE6 +#define CYGARC_MAR0BH 0xFFFEE8 +#define CYGARC_MAR0BL 0xFFFEEA +#define CYGARC_IOAR0B 0xFFFEEC +#define CYGARC_ETCR0B 0xFFFEEE +#define CYGARC_MAR1AH 0xFFFEF0 +#define CYGARC_MAR1AL 0xFFFEF2 +#define CYGARC_IOAR1A 0xFFFEF4 +#define CYGARC_ETCR1A 0xFFFEF6 +#define CYGARC_MAR1BH 0xFFFEF8 +#define CYGARC_MAR1BL 0xFFFEFA +#define CYGARC_IOAR1B 0xFFFEFC +#define CYGARC_ETCR1B 0xFFFEFE +#define CYGARC_DMAWER 0xFFFF20 +#define CYGARC_DMATCR 0xFFFF21 +#define CYGARC_DMACR0A 0xFFFF22 +#define CYGARC_DMACR0B 0xFFFF23 +#define CYGARC_DMACR1A 0xFFFF24 +#define CYGARC_DMACR1B 0xFFFF25 +#define CYGARC_DMABCRH 0xFFFF26 +#define CYGARC_DMABCRL 0xFFFF27 + +#define CYGARC_EDSAR0 0xFFFDC0 +#define CYGARC_EDDAR0 0xFFFDC4 +#define CYGARC_EDTCR0 0xFFFDC8 +#define CYGARC_EDMDR0 0xFFFDCC +#define CYGARC_EDMDR0H 0xFFFDCC +#define CYGARC_EDMDR0L 0xFFFDCD +#define CYGARC_EDACR0 0xFFFDCE +#define CYGARC_EDSAR1 0xFFFDD0 +#define CYGARC_EDDAR1 0xFFFDD4 +#define CYGARC_EDTCR1 0xFFFDD8 +#define CYGARC_EDMDR1 0xFFFDDC +#define CYGARC_EDMDR1H 0xFFFDDC +#define CYGARC_EDMDR1L 0xFFFDDD +#define CYGARC_EDACR1 0xFFFDDE +#define CYGARC_EDSAR2 0xFFFDE0 +#define CYGARC_EDDAR2 0xFFFDE4 +#define CYGARC_EDTCR2 0xFFFDE8 +#define CYGARC_EDMDR2 0xFFFDEC +#define CYGARC_EDMDR2H 0xFFFDEC +#define CYGARC_EDMDR2L 0xFFFDED +#define CYGARC_EDACR2 0xFFFDEE +#define CYGARC_EDSAR3 0xFFFDF0 +#define CYGARC_EDDAR3 0xFFFDF4 +#define CYGARC_EDTCR3 0xFFFDF8 +#define CYGARC_EDMDR3 0xFFFDFC +#define CYGARC_EDMDR3H 0xFFFDFC +#define CYGARC_EDMDR3L 0xFFFDFD +#define CYGARC_EDACR3 0xFFFDFE + +#endif diff --git a/ecos/packages/hal/h8300/h8s/current/include/mod_regs_intc.h b/ecos/packages/hal/h8300/h8s/current/include/mod_regs_intc.h new file mode 100644 index 0000000..16a8f34 --- /dev/null +++ b/ecos/packages/hal/h8300/h8s/current/include/mod_regs_intc.h @@ -0,0 +1,77 @@ +#ifndef CYGONCE_MOD_REGS_INTC_H +#define CYGONCE_MOD_REGS_INTC_H + +//========================================================================== +// +// mod_regs_intc.h +// +// Interrupt Controler Register +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2003-01-01 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_IPRA 0xFFFE00 +#define CYGARC_IPRB 0xFFFE02 +#define CYGARC_IPRC 0xFFFE04 +#define CYGARC_IPRD 0xFFFE06 +#define CYGARC_IPRE 0xFFFE08 +#define CYGARC_IPRF 0xFFFE0A +#define CYGARC_IPRG 0xFFFE0C +#define CYGARC_IPRH 0xFFFE0E +#define CYGARC_IPRI 0xFFFE10 +#define CYGARC_IPRJ 0xFFFE12 +#define CYGARC_IPRK 0xFFFE14 +#define CYGARC_ITSR 0xFFFE16 +#define CYGARC_SSIER 0xFFFE18 +#define CYGARC_ISCRH 0xFFFE1A +#define CYGARC_ISCRL 0xFFFE1C + +#define CYGARC_INTCR 0xFFFF31 +#define CYGARC_IER 0xFFFF32 +#define CYGARC_IERH 0xFFFF32 +#define CYGARC_IERL 0xFFFF33 +#define CYGARC_ISR 0xFFFF34 +#define CYGARC_ISRH 0xFFFF34 +#define CYGARC_ISRL 0xFFFF35 + +#endif diff --git a/ecos/packages/hal/h8300/h8s/current/include/mod_regs_pio.h b/ecos/packages/hal/h8300/h8s/current/include/mod_regs_pio.h new file mode 100644 index 0000000..9778b1c --- /dev/null +++ b/ecos/packages/hal/h8300/h8s/current/include/mod_regs_pio.h @@ -0,0 +1,120 @@ +#ifndef CYGONCE_MOD_REGS_PIO_H +#define CYGONCE_MOD_REGS_PIO_H + +//========================================================================== +// +// mod_regs_pio.h +// +// I/O Port Controler Register +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_P1DDR 0xFFFE20 +#define CYGARC_P2DDR 0xFFFE21 +#define CYGARC_P3DDR 0xFFFE22 +#define CYGARC_P4DDR 0xFFFE23 +#define CYGARC_P5DDR 0xFFFE24 +#define CYGARC_P6DDR 0xFFFE25 +#define CYGARC_P7DDR 0xFFFE26 +#define CYGARC_P8DDR 0xFFFE27 +#define CYGARC_P9DDR 0xFFFE28 +#define CYGARC_PADDR 0xFFFE29 +#define CYGARC_PBDDR 0xFFFE2A +#define CYGARC_PCDDR 0xFFFE2B +#define CYGARC_PDDDR 0xFFFE2C +#define CYGARC_PEDDR 0xFFFE2D +#define CYGARC_PFDDR 0xFFFE2E +#define CYGARC_PGDDR 0xFFFE2F +#define CYGARC_PHDDR 0xFFFF74 + +#define CYGARC_PFCR0 0xFFFE32 +#define CYGARC_PFCR1 0xFFFE33 +#define CYGARC_PFCR2 0xFFFE34 + +#define CYGARC_PAPCR 0xFFFE36 +#define CYGARC_PBPCR 0xFFFE37 +#define CYGARC_PCPCR 0xFFFE38 +#define CYGARC_PDPCR 0xFFFE39 +#define CYGARC_PEPCR 0xFFFE3A + +#define CYGARC_P3ODR 0xFFFE3C +#define CYGARC_PAODR 0xFFFE3D + +#define CYGARC_P1DR 0xFFFF60 +#define CYGARC_P2DR 0xFFFF61 +#define CYGARC_P3DR 0xFFFF62 +#define CYGARC_P4DR 0xFFFF63 +#define CYGARC_P5DR 0xFFFF64 +#define CYGARC_P6DR 0xFFFF65 +#define CYGARC_P7DR 0xFFFF66 +#define CYGARC_P8DR 0xFFFF67 +#define CYGARC_P9DR 0xFFFF68 +#define CYGARC_PADR 0xFFFF69 +#define CYGARC_PBDR 0xFFFF6A +#define CYGARC_PCDR 0xFFFF6B +#define CYGARC_PDDR 0xFFFF6C +#define CYGARC_PEDR 0xFFFF6D +#define CYGARC_PFDR 0xFFFF6E +#define CYGARC_PGDR 0xFFFF6F +#define CYGARC_PHDR 0xFFFF72 + +#define CYGARC_PORT1 0xFFFF50 +#define CYGARC_PORT2 0xFFFF51 +#define CYGARC_PORT3 0xFFFF52 +#define CYGARC_PORT4 0xFFFF53 +#define CYGARC_PORT5 0xFFFF54 +#define CYGARC_PORT6 0xFFFF55 +#define CYGARC_PORT7 0xFFFF56 +#define CYGARC_PORT8 0xFFFF57 +#define CYGARC_PORT9 0xFFFF58 +#define CYGARC_PORTA 0xFFFF59 +#define CYGARC_PORTB 0xFFFF5A +#define CYGARC_PORTC 0xFFFF5B +#define CYGARC_PORTD 0xFFFF5C +#define CYGARC_PORTE 0xFFFF5D +#define CYGARC_PORTF 0xFFFF5E +#define CYGARC_PORTG 0xFFFF5F +#define CYGARC_PORTH 0xFFFF70 + +#endif diff --git a/ecos/packages/hal/h8300/h8s/current/include/mod_regs_ppg.h b/ecos/packages/hal/h8300/h8s/current/include/mod_regs_ppg.h new file mode 100644 index 0000000..7feaec3 --- /dev/null +++ b/ecos/packages/hal/h8300/h8s/current/include/mod_regs_ppg.h @@ -0,0 +1,64 @@ +#ifndef CYGONCE_MOD_REGS_TPC_H +#define CYGONCE_MOD_REGS_TPC_H + +//========================================================================== +// +// mod_regs_ppg.h +// +// Programable Pulse Generator Register +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_PCR 0xFFFF46 +#define CYGARC_PMR 0xFFFF47 +#define CYGARC_NDERH 0xFFFF48 +#define CYGARC_NDERL 0xFFFF49 +#define CYGARC_PODRH 0xFFFF4A +#define CYGARC_PODRL 0xFFFF4B +#define CYGARC_NDRH1 0xFFFF4C +#define CYGARC_NDRL1 0xFFFF4D +#define CYGARC_NDRH2 0xFFFF4E +#define CYGARC_NDRL2 0xFFFF4F + +#endif diff --git a/ecos/packages/hal/h8300/h8s/current/include/mod_regs_sci.h b/ecos/packages/hal/h8300/h8s/current/include/mod_regs_sci.h new file mode 100644 index 0000000..72f1f83 --- /dev/null +++ b/ecos/packages/hal/h8300/h8s/current/include/mod_regs_sci.h @@ -0,0 +1,146 @@ +#ifndef CYGONCE_MOD_REGS_SCI_H +#define CYGONCE_MOD_REGS_SCI_H + +//========================================================================== +// +// mod_regs_sci.h +// +// Serial Communication Interface Register +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_SMR0 0xFFFF78 +#define CYGARC_BRR0 0xFFFF79 +#define CYGARC_SCR0 0xFFFF7A +#define CYGARC_TDR0 0xFFFF7B +#define CYGARC_SSR0 0xFFFF7C +#define CYGARC_RDR0 0xFFFF7D +#define CYGARC_SCMR0 0xFFFF7E +#define CYGARC_SMR1 0xFFFF80 +#define CYGARC_BRR1 0xFFFF81 +#define CYGARC_SCR1 0xFFFF82 +#define CYGARC_TDR1 0xFFFF83 +#define CYGARC_SSR1 0xFFFF84 +#define CYGARC_RDR1 0xFFFF85 +#define CYGARC_SCMR1 0xFFFF86 +#define CYGARC_SMR2 0xFFFF88 +#define CYGARC_BRR2 0xFFFF89 +#define CYGARC_SCR2 0xFFFF8A +#define CYGARC_TDR2 0xFFFF8B +#define CYGARC_SSR2 0xFFFF8C +#define CYGARC_RDR2 0xFFFF8D +#define CYGARC_SCMR2 0xFFFF8E + +#define CYGARC_IRCR0 0xFFFE1E +#define CYGARC_SEMR 0xFFFDA8 + +// Serial Mode Register +#define CYGARC_REG_SCSMR_CA 0x80 // communication mode +#define CYGARC_REG_SCSMR_CHR 0x40 // character length (7 if set) +#define CYGARC_REG_SCSMR_PE 0x20 // parity enable +#define CYGARC_REG_SCSMR_OE 0x10 // parity mode +#define CYGARC_REG_SCSMR_STOP 0x08 // stop bit length +#define CYGARC_REG_SCSMR_MP 0x04 // multiprocessor mode +#define CYGARC_REG_SCSMR_CKS1 0x02 // clock select 1 +#define CYGARC_REG_SCSMR_CKS0 0x01 // clock select 0 +#define CYGARC_REG_SCSMR_CKSx_MASK 0x03 // mask + +// Serial Control Register +#define CYGARC_REG_SCSCR_TIE 0x80 // transmit interrupt enable +#define CYGARC_REG_SCSCR_RIE 0x40 // receive interrupt enable +#define CYGARC_REG_SCSCR_TE 0x20 // transmit enable +#define CYGARC_REG_SCSCR_RE 0x10 // receive enable +#define CYGARC_REG_SCSCR_MPIE 0x08 // multiprocessor interrupt enable +#define CYGARC_REG_SCSCR_TEIE 0x04 // transmit-end interrupt enable +#define CYGARC_REG_SCSCR_CKE1 0x02 // clock enable 1 +#define CYGARC_REG_SCSCR_CKE0 0x01 // clock enable 0 + +// Serial Status Register +#define CYGARC_REG_SCSSR_TDRE 0x80 // transmit data register empty +#define CYGARC_REG_SCSSR_RDRF 0x40 // receive data register full +#define CYGARC_REG_SCSSR_ORER 0x20 // overrun error +#define CYGARC_REG_SCSSR_FER 0x10 // framing error +#define CYGARC_REG_SCSSR_PER 0x08 // parity error +#define CYGARC_REG_SCSSR_TEND 0x04 // transmit end +#define CYGARC_REG_SCSSR_MPB 0x02 // multiprocessor bit +#define CYGARC_REG_SCSSR_MPBT 0x01 // multiprocessor bit transfer + +// When clearing the status register, always write the value: +// CYGARC_REG_SCSSR_CLEARMASK & ~bit +// to prevent other bits than the one of interest to be cleared. +#define CYGARC_REG_SCSSR_CLEARMASK 0xf8 + +// Baud rate values calculation, depending on peripheral clock (Pf) +// n is CKS setting (0-3) +// N = (Pf/(64*2^(2n-1)*B))-1 +// With CYGARC_SCBRR_CKSx providing the values 1, 4, 16, 64 we get +// N = (Pf/(32*_CKS*B))-1 +// +// The CYGARC_SCBRR_OPTIMAL_CKS macro should compute the minimal CKS +// setting for the given baud rate and peripheral clock. +// +// The error of the CKS+count value can be computed by: +// E(%) = ((Pf/((N+1)*B*(64^(n-1)))-1)*100 +// +#define CYGARC_SCBRR_PRESCALE(_b_) \ +((((CYGHWR_HAL_H8300_PROCESSOR_SPEED/32/1/(_b_))-1)<256) ? 1 : \ + (((CYGHWR_HAL_H8300_PROCESSOR_SPEED/32/4/(_b_))-1)<256) ? 4 : \ + (((CYGHWR_HAL_H8300_PROCESSOR_SPEED/32/16/(_b_))-1)<256) ? 16 : 64) + +// Add half the divisor to reduce rounding errors to .5 +#define CYGARC_SCBRR_ROUNDING(_b_) \ + 16*CYGARC_SCBRR_PRESCALE(_b_)*(_b_) + +// These two macros provide the static values we need to stuff into the +// registers. +#define CYGARC_SCBRR_CKSx(_b_) \ + ((1 == CYGARC_SCBRR_PRESCALE(_b_)) ? 0 : \ + (4 == CYGARC_SCBRR_PRESCALE(_b_)) ? 1 : \ + (16 == CYGARC_SCBRR_PRESCALE(_b_)) ? 2 : 3) +#define CYGARC_SCBRR_N(_b_) \ + (((_b_) < 4800) ? 0 : \ + ((_b_) > 115200) ? 0 : \ + (((CYGHWR_HAL_H8300_PROCESSOR_SPEED+CYGARC_SCBRR_ROUNDING(_b_))/32/CYGARC_SCBRR_PRESCALE(_b_)/(_b_))-1)) + +#endif diff --git a/ecos/packages/hal/h8300/h8s/current/include/mod_regs_sys.h b/ecos/packages/hal/h8300/h8s/current/include/mod_regs_sys.h new file mode 100644 index 0000000..334a630 --- /dev/null +++ b/ecos/packages/hal/h8300/h8s/current/include/mod_regs_sys.h @@ -0,0 +1,66 @@ +#ifndef CYGONCE_MOD_REGS_SYS_H +#define CYGONCE_MOD_REGS_SYS_H + +//========================================================================== +// +// mod_regs_sys.h +// +// System Controler Register +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_MDCR 0xFFFF3E +#define CYGARC_SYSCR 0xFFFF3D +#define CYGARC_MSTPCRH 0xFFFF40 +#define CYGARC_MSTPCRL 0xFFFF41 +#define CYGARC_FLMCR1 0xFFFFC8 +#define CYGARC_FLMCR2 0xFFFFC9 +#define CYGARC_EBR1 0xFFFFCA +#define CYGARC_EBR2 0xFFFFCB +#define CTGARC_RAMCR 0xFFFECE +#define CYGARC_SBYCR 0xFFFF3A +#define CYGARC_SCKCR 0xFFFF3B +#define CYGARC_PLLCR 0xFFFF45 + +#endif diff --git a/ecos/packages/hal/h8300/h8s/current/include/mod_regs_tmr.h b/ecos/packages/hal/h8300/h8s/current/include/mod_regs_tmr.h new file mode 100644 index 0000000..25fbe16 --- /dev/null +++ b/ecos/packages/hal/h8300/h8s/current/include/mod_regs_tmr.h @@ -0,0 +1,126 @@ +#ifndef CYGONCE_MOD_REGS_TMR_H +#define CYGONCE_MOD_REGS_TMR_H + +//========================================================================== +// +// mod_regs_tmr.h +// +// TPU/TMR Register +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_TSTR 0xFFFFC0 +#define CYGARC_TSNC 0XFFFFC1 + +#define CYGARC_TCR0 0xFFFFD0 +#define CYGARC_TMDR0 0xFFFFD1 +#define CYGARC_TIORH0 0xFFFFD2 +#define CYGARC_TIORL0 0xFFFFD3 +#define CYGARC_TIER0 0xFFFFD4 +#define CYGARC_TSR0 0xFFFFD5 +#define CYGARC_TCNT0 0xFFFFD6 +#define CYGARC_GRA0 0xFFFFD8 +#define CYGARC_GRB0 0xFFFFDA +#define CYGARC_GRC0 0xFFFFDC +#define CYGARC_GRD0 0xFFFFDE +#define CYGARC_TCR1 0xFFFFE0 +#define CYGARC_TMDR1 0xFFFFE1 +#define CYGARC_TIORH1 0xFFFFE2 +#define CYGARC_TIORL1 0xFFFFE3 +#define CYGARC_TIER1 0xFFFFE4 +#define CYGARC_TSR1 0xFFFFE5 +#define CYGARC_TCNT1 0xFFFFE6 +#define CYGARC_GRA1 0xFFFFE8 +#define CYGARC_GRB1 0xFFFFEA +#define CYGARC_TCR2 0xFFFFF0 +#define CYGARC_TMDR2 0xFFFFF1 +#define CYGARC_TIORH2 0xFFFFF2 +#define CYGARC_TIORL2 0xFFFFF3 +#define CYGARC_TIER2 0xFFFFF4 +#define CYGARC_TSR2 0xFFFFF5 +#define CYGARC_TCNT2 0xFFFFF6 +#define CYGARC_GRA2 0xFFFFF8 +#define CYGARC_GRB2 0xFFFFFA +#define CYGARC_TCR3 0xFFFE80 +#define CYGARC_TMDR3 0xFFFE81 +#define CYGARC_TIORH3 0xFFFE82 +#define CYGARC_TIORL3 0xFFFE83 +#define CYGARC_TIER3 0xFFFE84 +#define CYGARC_TSR3 0xFFFE85 +#define CYGARC_TCNT3 0xFFFE86 +#define CYGARC_GRA3 0xFFFE88 +#define CYGARC_GRB3 0xFFFE8A +#define CYGARC_GRC3 0xFFFE8C +#define CYGARC_GRD3 0xFFFE8E +#define CYGARC_TCR4 0xFFFE90 +#define CYGARC_TMDR4 0xFFFE91 +#define CYGARC_TIORH4 0xFFFE92 +#define CYGARC_TIORL4 0xFFFE93 +#define CYGARC_TIER4 0xFFFE94 +#define CYGARC_TSR4 0xFFFE95 +#define CYGARC_TCNT4 0xFFFE96 +#define CYGARC_GRA4 0xFFFE98 +#define CYGARC_GRB4 0xFFFE9A +#define CYGARC_TCR5 0xFFFEA0 +#define CYGARC_TMDR5 0xFFFEA1 +#define CYGARC_TIORH5 0xFFFEA2 +#define CYGARC_TIORL5 0xFFFEA3 +#define CYGARC_TIER5 0xFFFEA4 +#define CYGARC_TSR5 0xFFFEA5 +#define CYGARC_TCNT5 0xFFFEA6 +#define CYGARC_GRA5 0xFFFEA8 +#define CYGARC_GRB5 0xFFFEAA + +#define CYGARC_8TCR0 0xFFFFB0 +#define CYGARC_8TCR1 0xFFFFB1 +#define CYGARC_8TCSR0 0xFFFFB2 +#define CYGARC_8TCSR1 0xFFFFB3 +#define CYGARC_8TCORA0 0xFFFFB4 +#define CYGARC_8TCORA1 0xFFFFB5 +#define CYGARC_8TCORB0 0xFFFFB6 +#define CYGARC_8TCORB1 0xFFFFB7 +#define CYGARC_8TCNT0 0xFFFFB8 +#define CYGARC_8TCNT1 0xFFFFB9 + +#endif diff --git a/ecos/packages/hal/h8300/h8s/current/include/mod_regs_wdt.h b/ecos/packages/hal/h8300/h8s/current/include/mod_regs_wdt.h new file mode 100644 index 0000000..5238e7e --- /dev/null +++ b/ecos/packages/hal/h8300/h8s/current/include/mod_regs_wdt.h @@ -0,0 +1,74 @@ +#ifndef CYGONCE_MOD_REGS_WDT_H +#define CYGONCE_MOD_REGS_WDT_H + +//========================================================================== +// +// mod_regs_wdt.h +// +// Watchdog Timer Register +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-19 +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#define CYGARC_TCSR 0xFFFFBC +#define CYGARC_TCNT 0xFFFFBD +#define CYGARC_RSTCSRW 0xFFFFBE +#define CYGARC_RSTCSRR 0xFFFFBF + +#define CYGARC_TCNT_MAGIC 0x5A00 +#define CYGARC_TCSR_MAGIC 0xA500 + +#define CYGARC_WDT_OVF 0x80 +#define CYGARC_WDT_WT 0x40 +#define CYGARC_WDT_TME 0x20 +#define CYGARC_WDT_CKS2 0x04 +#define CYGARC_WDT_CKS1 0x02 +#define CYGARC_WDT_CKS0 0x01 + +#define CYGARC_WDT_CKS 0x05 //8192 + +#define CYGARC_WDT_PERIOD ((1000000000/(CYGHWR_HAL_H8300_PROCESSOR_SPEED/8192))*256) + +#endif + +// EOF mod_regs_wdt.h diff --git a/ecos/packages/hal/h8300/h8s/current/include/var_arch.h b/ecos/packages/hal/h8300/h8s/current/include/var_arch.h new file mode 100644 index 0000000..9f36363 --- /dev/null +++ b/ecos/packages/hal/h8300/h8s/current/include/var_arch.h @@ -0,0 +1,109 @@ +#ifndef CYGONCE_HAL_VAR_ARCH_H +#define CYGONCE_HAL_VAR_ARCH_H + +//========================================================================== +// +// var_arch.h +// +// Architecture specific abstractions +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-14 +// Purpose: Define architecture abstractions +// Description: This file contains any extra or modified definitions for +// this variant of the architecture. +// Usage: #include <cyg/hal/var_arch.h> +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include <pkgconf/hal.h> +#include <cyg/infra/cyg_type.h> + +//-------------------------------------------------------------------------- +// Processor saved states: + +typedef struct HAL_SavedRegisters +{ + // These are common to all saved states and are in the order + // stored and loaded by the movm instruction. + CYG_WORD32 er6; + CYG_WORD32 er5; + CYG_WORD32 er4; + CYG_WORD32 er3; + CYG_WORD32 er2; + CYG_WORD32 er1; + CYG_WORD32 er0; + + /* On interrupts the PC and PSW are pushed automatically by the */ + /* CPU and SP is pushed for debugging reasons. On a thread switch */ + /* the saved context is made to look the same. */ + + CYG_WORD32 sp; /* Saved copy of SP in some states */ + CYG_WORD32 ccr; + CYG_WORD32 exr; + CYG_WORD32 pc; +} HAL_SavedRegisters; + +#define HAL_THREAD_INIT_CONTEXT_EXTRA(_regs_, _id_) \ + {_regs_->exr = 0;} + +#define HAL_GET_GDB_EXTRA_REGISTERS(_regval_,_regs_) \ + {_regval_[10] = (_regs_)->exr;} + +#define HAL_SET_GDB_EXTRA_REGISTERS( _regs_,_regval_) \ + {(_regs_)->exr = _regval_[10];} + +// Internal peripheral registers +#include <cyg/hal/mod_regs_adc.h> +#include <cyg/hal/mod_regs_bsc.h> +#include <cyg/hal/mod_regs_dmac.h> +#include <cyg/hal/mod_regs_intc.h> +#include <cyg/hal/mod_regs_pio.h> +#include <cyg/hal/mod_regs_sci.h> +#include <cyg/hal/mod_regs_sys.h> +#include <cyg/hal/mod_regs_tmr.h> +#include <cyg/hal/mod_regs_ppg.h> +#include <cyg/hal/mod_regs_wdt.h> + + +//-------------------------------------------------------------------------- +#endif // CYGONCE_HAL_VAR_ARCH_H +// End of var_arch.h diff --git a/ecos/packages/hal/h8300/h8s/current/include/var_intr.h b/ecos/packages/hal/h8300/h8s/current/include/var_intr.h new file mode 100644 index 0000000..41e545a --- /dev/null +++ b/ecos/packages/hal/h8300/h8s/current/include/var_intr.h @@ -0,0 +1,328 @@ +#ifndef CYGONCE_HAL_VAR_INTR_H +#define CYGONCE_HAL_VAR_INTR_H + +//========================================================================== +// +// var_intr.h +// +// H8S Interrupt and clock support +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2003-01-01 +// Purpose: H8S Interrupt Support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock for H8/300H variants of the H8/300 +// architecture. +// +// Usage: +// #include <cyg/hal/var_intr.h> +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + +#include <pkgconf/hal.h> + +#include <cyg/infra/cyg_type.h> + +#include <cyg/hal/plf_intr.h> +#include <cyg/hal/var_arch.h> + +//-------------------------------------------------------------------------- +// Interrupt vectors. + +// The level-specific hardware vectors +// These correspond to VSRs and are the values to use for HAL_VSR_GET/SET +#define CYGNUM_HAL_VECTOR_RESET_P 0 +#define CYGNUM_HAL_VECTOR_RESET_M 1 +#define CYGNUM_HAL_VECTOR_RSV2 2 +#define CYGNUM_HAL_VECTOR_RSV3 3 +#define CYGNUM_HAL_VECTOR_RSV4 4 +#define CYGNUM_HAL_VECTOR_TRACE 5 +#define CYGNUM_HAL_VECTOR_DIRECT 6 +#define CYGNUM_HAL_VECTOR_NMI 7 +#define CYGNUM_HAL_VECTOR_TRAP0 8 +#define CYGNUM_HAL_VECTOR_TRAP1 9 +#define CYGNUM_HAL_VECTOR_TRAP2 10 +#define CYGNUM_HAL_VECTOR_TRAP3 11 + +#define CYGNUM_HAL_VSR_MIN 0 +#define CYGNUM_HAL_VSR_MAX 11 +#define CYGNUM_HAL_VSR_COUNT 12 + +// Exception numbers. These are the values used when passed out to an +// external exception handler using cyg_hal_deliver_exception() + +#define CYGNUM_HAL_EXCEPTION_NMI CYGNUM_HAL_VECTOR_NMI + +#if 0 +#define CYGNUM_HAL_EXCEPTION_DATA_ACCESS 0 +#endif + +#define CYGNUM_HAL_EXCEPTION_MIN CYGNUM_HAL_VSR_MIN +#define CYGNUM_HAL_EXCEPTION_MAX CYGNUM_HAL_VSR_MAX +#define CYGNUM_HAL_EXCEPTION_COUNT CYGNUM_HAL_VSR_COUNT + +// The decoded interrupts +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_0 16 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_1 17 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_2 18 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_3 19 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_4 20 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_5 21 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_6 22 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_7 23 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_8 24 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_9 25 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_10 26 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_11 27 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_12 28 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_13 29 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_14 30 +#define CYGNUM_HAL_INTERRUPT_EXTERNAL_15 31 + +#define CYGNUM_HAL_INTERRUPT_DTC 32 +#define CYGNUM_HAL_INTERRUPT_WDT 33 +#define CYGNUM_HAL_INTERRUPT_RSV34 34 +#define CYGNUM_HAL_INTERRUPT_RFSHCMI 35 +#define CYGNUM_HAL_INTERRUPT_RSV36 36 +#define CYGNUM_HAL_INTERRUPT_RSV37 37 +#define CYGNUM_HAL_INTERRUPT_ADI 38 +#define CYGNUM_HAL_INTERRUPT_RSV39 39 + +#define CYGNUM_HAL_INTERRUPT_TGI0A 40 +#define CYGNUM_HAL_INTERRUPT_TGI0B 41 +#define CYGNUM_HAL_INTERRUPT_TGI0C 42 +#define CYGNUM_HAL_INTERRUPT_TGI0D 43 +#define CYGNUM_HAL_INTERRUPT_TGI0V 44 +#define CYGNUM_HAL_INTERRUPT_RSV45 45 +#define CYGNUM_HAL_INTERRUPT_RSV46 46 +#define CYGNUM_HAL_INTERRUPT_RSV47 47 + +#define CYGNUM_HAL_INTERRUPT_TGI1A 48 +#define CYGNUM_HAL_INTERRUPT_TGI1B 49 +#define CYGNUM_HAL_INTERRUPT_TGI1V 50 +#define CYGNUM_HAL_INTERRUPT_TGI1U 51 + +#define CYGNUM_HAL_INTERRUPT_TGI2A 52 +#define CYGNUM_HAL_INTERRUPT_TGI2B 53 +#define CYGNUM_HAL_INTERRUPT_TGI2V 54 +#define CYGNUM_HAL_INTERRUPT_TGI2U 55 + +#define CYGNUM_HAL_INTERRUPT_TGI3A 56 +#define CYGNUM_HAL_INTERRUPT_TGI3B 57 +#define CYGNUM_HAL_INTERRUPT_TGI3C 58 +#define CYGNUM_HAL_INTERRUPT_TGI3D 59 +#define CYGNUM_HAL_INTERRUPT_TGI3V 60 +#define CYGNUM_HAL_INTERRUPT_RSV61 61 +#define CYGNUM_HAL_INTERRUPT_RSV62 62 +#define CYGNUM_HAL_INTERRUPT_RSV63 63 + +#define CYGNUM_HAL_INTERRUPT_TGI4A 64 +#define CYGNUM_HAL_INTERRUPT_TGI4B 65 +#define CYGNUM_HAL_INTERRUPT_TGI4V 66 +#define CYGNUM_HAL_INTERRUPT_TGI4U 67 + +#define CYGNUM_HAL_INTERRUPT_TGI5A 68 +#define CYGNUM_HAL_INTERRUPT_TGI5B 69 +#define CYGNUM_HAL_INTERRUPT_TGI5V 70 +#define CYGNUM_HAL_INTERRUPT_TGI5U 71 + +#define CYGNUM_HAL_INTERRUPT_CMIA0 72 +#define CYGNUM_HAL_INTERRUPT_CMIB0 73 +#define CYGNUM_HAL_INTERRUPT_OVI0 74 +#define CYGNUM_HAL_INTERRUPT_RSV75 75 + +#define CYGNUM_HAL_INTERRUPT_CMIA1 76 +#define CYGNUM_HAL_INTERRUPT_CMIB1 77 +#define CYGNUM_HAL_INTERRUPT_OVI1 78 +#define CYGNUM_HAL_INTERRUPT_RSV79 79 + +#define CYGNUM_HAL_INTERRUPT_DEND0A 80 +#define CYGNUM_HAL_INTERRUPT_DEND0B 81 +#define CYGNUM_HAL_INTERRUPT_DEND1A 82 +#define CYGNUM_HAL_INTERRUPT_DEND1B 83 + +#define CYGNUM_HAL_INTERRUPT_EXDEND0 84 +#define CYGNUM_HAL_INTERRUPT_EXDEND1 85 +#define CYGNUM_HAL_INTERRUPT_EXDEND2 86 +#define CYGNUM_HAL_INTERRUPT_EXDEND3 87 + +#define CYGNUM_HAL_INTERRUPT_ERI0 88 +#define CYGNUM_HAL_INTERRUPT_RXI0 89 +#define CYGNUM_HAL_INTERRUPT_TXI0 90 +#define CYGNUM_HAL_INTERRUPT_TEI0 91 + +#define CYGNUM_HAL_INTERRUPT_ERI1 92 +#define CYGNUM_HAL_INTERRUPT_RXI1 93 +#define CYGNUM_HAL_INTERRUPT_TXI1 94 +#define CYGNUM_HAL_INTERRUPT_TEI1 95 + +#define CYGNUM_HAL_INTERRUPT_ERI2 96 +#define CYGNUM_HAL_INTERRUPT_RXI2 97 +#define CYGNUM_HAL_INTERRUPT_TXI2 98 +#define CYGNUM_HAL_INTERRUPT_TEI2 99 + +#define CYGNUM_HAL_INTERRUPT_RSV100 100 +#define CYGNUM_HAL_INTERRUPT_RSV101 101 +#define CYGNUM_HAL_INTERRUPT_RSV102 102 +#define CYGNUM_HAL_INTERRUPT_RSV103 103 +#define CYGNUM_HAL_INTERRUPT_RSV104 104 +#define CYGNUM_HAL_INTERRUPT_RSV105 105 +#define CYGNUM_HAL_INTERRUPT_RSV106 106 +#define CYGNUM_HAL_INTERRUPT_RSV107 107 +#define CYGNUM_HAL_INTERRUPT_RSV108 108 +#define CYGNUM_HAL_INTERRUPT_RSV109 109 +#define CYGNUM_HAL_INTERRUPT_RSV110 110 +#define CYGNUM_HAL_INTERRUPT_RSV111 111 +#define CYGNUM_HAL_INTERRUPT_RSV112 112 +#define CYGNUM_HAL_INTERRUPT_RSV113 113 +#define CYGNUM_HAL_INTERRUPT_RSV114 114 +#define CYGNUM_HAL_INTERRUPT_RSV115 115 +#define CYGNUM_HAL_INTERRUPT_RSV116 116 +#define CYGNUM_HAL_INTERRUPT_RSV117 117 +#define CYGNUM_HAL_INTERRUPT_RSV118 118 +#define CYGNUM_HAL_INTERRUPT_RSV119 119 +#define CYGNUM_HAL_INTERRUPT_RSV120 120 +#define CYGNUM_HAL_INTERRUPT_RSV121 121 +#define CYGNUM_HAL_INTERRUPT_RSV122 122 +#define CYGNUM_HAL_INTERRUPT_RSV123 123 +#define CYGNUM_HAL_INTERRUPT_RSV124 124 +#define CYGNUM_HAL_INTERRUPT_RSV125 125 +#define CYGNUM_HAL_INTERRUPT_RSV126 126 +#define CYGNUM_HAL_INTERRUPT_RSV127 127 + + +#define CYGNUM_HAL_ISR_MIN 16 +#define CYGNUM_HAL_ISR_MAX 127 + +#define CYGNUM_HAL_ISR_COUNT (3+((CYGNUM_HAL_ISR_MAX+1)/4)) + +// The vector used by the Real time clock + +#define CYGNUM_HAL_INTERRUPT_RTC CYGNUM_HAL_INTERRUPT_CMIA1 + +//-------------------------------------------------------------------------- +// Interrupt vector translation. + +#if !defined(HAL_TRANSLATE_VECTOR) && !defined(CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN) + +#define HAL_TRANSLATE_VECTOR(_vector_,_index_) \ + _index_ = (_vector_) + +#endif + +//-------------------------------------------------------------------------- +// H8/300H specific version of HAL_INTERRUPT_CONFIGURE + +#define HAL_INTERRUPT_CONFIGURE( _vector_, _level_, _up_ ) \ + hal_interrupt_configure( _vector_, _level_, _up_ ) + +externC void hal_interrupt_configure(int vector,int level,int up); + +#define HAL_INTERRUPT_CONFIGURE_DEFINED + +//-------------------------------------------------------------------------- +// Interrupt control macros + +#define HAL_DISABLE_INTERRUPTS(_old_) \ + asm volatile ( \ + "sub.l er0,er0\n\t" \ + "stc exr,r0l\n\t" \ + "orc #0x7,exr\n\t" \ + "and.b #0x07,r0l\n\t" \ + "mov.l er0,%0" \ + : "=r"(_old_) \ + : \ + : "er0" \ + ); + +#define HAL_ENABLE_INTERRUPTS() \ + asm volatile ( \ + "andc #0xf8,exr" \ + ); + +#define HAL_RESTORE_INTERRUPTS(_old_) \ + asm volatile ( \ + "mov.l %0,er0\n\t" \ + "and.b #0x07,r0l\n\t" \ + "stc exr,r0h\n\t" \ + "and.b #0xf8,r0h\n\t" \ + "or.b r0h,r0l\n\t" \ + "ldc r0l,exr" \ + : \ + : "r"(_old_) \ + : "er0" \ + ); + +#define HAL_QUERY_INTERRUPTS(_old_) \ + asm volatile ( \ + "sub.l er0,er0\n\t" \ + "stc exr,r0l\n\t" \ + "and.b #0x07,r0l\n\t" \ + "mov.l er0,%0" \ + : "=r"(_old_) \ + ); + +//-------------------------------------------------------------------------- +// Clock control. + +externC void hal_clock_initialize(cyg_uint32 period); +externC void hal_clock_reset(cyg_uint32 vector,cyg_uint32 period); +externC void hal_clock_read(cyg_uint32 *pvalue); + +#define HAL_CLOCK_INITIALIZE( _period_ ) \ + hal_clock_initialize( _period_ ) + +#define HAL_CLOCK_RESET( _vector_, _period_ ) \ + hal_clock_reset( _vector_, _period_ ) + +#define HAL_CLOCK_READ( _pvalue_ ) \ + hal_clock_read( _pvalue_ ) + +// FIXME: above line should not use CYGNUM_KERNEL_COUNTERS_RTC_PERIOD since +// this means the HAL gets configured by kernel options even when the +// kernel is disabled! + + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_VAR_INTR_H +// End of var_intr.h diff --git a/ecos/packages/hal/h8300/h8s/current/include/variant.inc b/ecos/packages/hal/h8300/h8s/current/include/variant.inc new file mode 100644 index 0000000..a5ccdbd --- /dev/null +++ b/ecos/packages/hal/h8300/h8s/current/include/variant.inc @@ -0,0 +1,223 @@ +#ifndef CYGONCE_HAL_VARIANT_INC +#define CYGONCE_HAL_VARIANT_INC +##============================================================================= +## +## variant.inc +## +## H8S assembler header file +## +##============================================================================= +## ####ECOSGPLCOPYRIGHTBEGIN#### +## ------------------------------------------- +## This file is part of eCos, the Embedded Configurable Operating System. +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +## +## This exception does not invalidate any other reasons why a work based +## on this file might be covered by the GNU General Public License. +## ------------------------------------------- +## ####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): ysato +## Contributors: ysato +## Date: 2003-01-01 +## Purpose: H8S definitions. +## Description: This file contains various definitions and macros that are +## useful for writing assembly code for the H8/300H CPU variant. +## Usage: +## #include <cyg/hal/variant.inc> +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +#include <pkgconf/hal.h> + +#include <cyg/hal/platform.inc> +#include <cyg/hal/basetype.h> + + +#------------------------------------------------------------------------------ +# Register definitions + +#define INTCR 0xffff31 + +#------------------------------------------------------------------------------ +# CPU state save and restore macros + + .macro hal_cpu_save_all + subs #2,sp ; reserve space + subs #4,sp + mov.l sp,@-sp + stm er0-er3,@-sp + stm er4-er6,@-sp + sub.w e0,e0 + mov.w e0,@(4*9:16,sp) ; clear exr high word + mov.w @(4*10:16,sp),r0 + sub.l er1,er1 + mov.b r0h,r1l + mov.l er1,@(4*8:16,sp) ; copy ccr + mov.l @(4*6:16,sp),er0 + mov.l @(4*5:16,sp),er1 + .endm + + .macro hal_cpu_load_all + mov.w @(4*8+2:16,sp),r1 ; load ccr + mov.w @(4*10:16,sp),r0 ; load pc+ccr high word + mov.b r1l,r0h ; replace ccr byte + mov.w r0,@(4*10:16,sp) ; restore pc+ccr high word + mov.w @(4*9+2:16,sp),r0 + mov.b r0l,r0h + mov.w r0,@(4*9+2:16,sp) ; extend exr + ldm @sp+,er4-er6 + ldm @sp+,er0-er3 + add.l #10,sp + .endm + + .macro hal_cpu_save_context + stc exr,r2l + mov.b r2l,r2h + mov.w r2,@-sp + hal_cpu_save_all + .endm + + .macro h8300_var_interrupt_entry + mov.l @CYG_LABEL_DEFN(_intvector),er0 + shll.l #2,er0 + mov.l @(CYG_LABEL_DEFN(hal_vsr_table),er0),er0 + .endm + + .macro h8300_var_call_pending_DSR + mov.l er5,@-sp ; save some work regs + mov.l er6,@-sp + mov.l sp,er6 ; save current SP + mov.l #__interrupt_stack,sp ; interrupt stack pointer + stc exr,r5l ; save PSW + hal_cpu_int_enable ; enable interrupts + + ; Call kernel code to invoke DSRs. + jsr @CYG_LABEL_DEFN(cyg_interrupt_call_pending_DSRs) + + ; On return the old SP in a2 and the old PSW in d2 will + ; have been preserved by the calling conventions. + + hal_cpu_int_merge r5l ; Restore previous PSW + mov.l er6,sp ; restore old SP + mov.l @sp+,er6 ; Retrieve old work regs + mov.l @sp+,er5 + rts ; and return + .endm + +# Location of PC in saved register context (HAL_SavedRegisters) +#define SAVED_CONTEXT_PC_OFFSET (4*10) + + # Enable interrupts + .macro hal_cpu_int_enable + andc #0xf8,exr + .endm + + # Disable interrupts + .macro hal_cpu_int_disable + orc #0x07,exr + .endm + + # Merge the interrupt enable state of the status register in + # \sr with the current sr. + .macro hal_cpu_int_merge sr wk=r0l + and.b #0x07,\sr + stc exr,\wk + and.b #0xf8,\wk + or.b \sr,\wk + ldc \wk,exr + .endm + + .macro hal_cpu_set_int_level + ldc exr,r0h + and.b #0xf8,r0h + or.b r0l,r0h + mov.b r0h,exr + .endm + + .macro h8300_trap_adjust_pc + mov.l @(40:16,sp),er0 + subs #2,er0 + mov.l er0,@(40:16,sp) + .endm + +##----------------------------------------------------------------------------- +# Default interrupt decoding macros. + +#ifndef CYGPKG_HAL_H8300_INTC_DEFINED + +#define CYG_ISR_TABLE_SIZE 128 + + .macro hal_intc_init + mov.b @INTCR,r0l + bclr #4,r0l + bset #5,r0l + mov.b r0l,@INTCR ; interrupt mode 2 + .endm + +#define CYGPKG_HAL_H8300_INTC_DEFINED + +#endif + + + +#ifndef CYGPKG_HAL_H8300_MON_DEFINED + + .macro hal_mon_init + .endm + +#if !(defined(CYG_HAL_STARTUP_ROM) || \ + defined(CYGPKG_HAL_H8300_H8300H_SIM) || \ + !defined(CYGSEM_HAL_USE_ROM_MONITOR)) + +#define CYG_HAL_H8300_VSR_TABLE_DEFINED + +#endif + + + +#define CYGPKG_HAL_H8300_MON_DEFINED + +#endif + +#ifndef CYGPKG_HAL_H8300_CPU_INIT_DEFINED +#define CYGPKG_HAL_H8300_CPU_INIT_DEFINED + # Initialize CPU + .macro hal_cpu_init + # Set up the PSW + ldc #0x80,ccr + ldc #0x07,exr + .endm +#endif + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_VARIANT_INC +# end of variant.inc diff --git a/ecos/packages/hal/h8300/h8s/current/src/h8300_h8s.ld b/ecos/packages/hal/h8300/h8s/current/src/h8300_h8s.ld new file mode 100644 index 0000000..ecd0261 --- /dev/null +++ b/ecos/packages/hal/h8300/h8s/current/src/h8300_h8s.ld @@ -0,0 +1,141 @@ +//=========================================================================== +// +// MLT linker script for H8/300H +// +//=========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== + +#include <pkgconf/system.h> +#include <cyg/hal/basetype.h> +#include <pkgconf/hal.h> +STARTUP(vectors.o) +ENTRY(CYG_LABEL_DEFN(_start)) +#ifdef EXTRAS +INPUT(extras.o) +#endif +GROUP(libtarget.a libgcc.a) + + + +#define ALIGN_LMA 4 +#define FOLLOWING(_section_) AT ((LOADADDR (_section_) + SIZEOF (_section_) + ALIGN_LMA - 1) & ~ (ALIGN_LMA - 1)) +#define LMA_EQ_VMA +#define FORCE_OUTPUT . = . + +#define SECTIONS_BEGIN + +#define SECTION_rom_vectors(_region_, _vma_, _lma_) \ + .vectors _vma_ : _lma_ \ + { FORCE_OUTPUT; KEEP (*(.vectors)) } \ + > _region_ + +#define SECTION_text(_region_, _vma_, _lma_) \ + .text _vma_ : _lma_ \ + { CYG_LABEL_DEFN(_stext) = ABSOLUTE(.); \ + *(.text*) *(.gnu.warning) *(.gnu.linkonce*) *(.init) } \ + > _region_ \ + CYG_LABEL_DEFN(_etext) = .; PROVIDE (etext = .); + +#define SECTION_fini(_region_, _vma_, _lma_) \ + .fini _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.fini) } \ + > _region_ + +#define SECTION_rodata(_region_, _vma_, _lma_) \ + .rodata _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.rodata*) } \ + > _region_ + +#define SECTION_rodata1(_region_, _vma_, _lma_) \ + .rodata1 _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.rodata1) } \ + > _region_ + +#define SECTION_fixup(_region_, _vma_, _lma_) \ + .fixup _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.fixup) } \ + > _region_ + +#define SECTION_gcc_except_table(_region_, _vma_, _lma_) \ + .gcc_except_table _vma_ : _lma_ \ + { FORCE_OUTPUT; *(.gcc_except_table) } \ + > _region_ + +#if defined(CYGSEM_HAL_H8300_VECTOR_HOOK) +#define SECTION_int_hook_table(_region_, _vma_, _lma_) \ + .int_hook_table CYGHWR_HAL_H8300_VECTOR_ADDRESS : _lma_ \ + { CYG_LABEL_DEFN(__int_hook_start) = ABSOLUTE (.); \ + FORCE_OUTPUT; *(.int_hook_table) } \ + > _region_ \ + CYG_LABEL_DEFN(__rom_int_hook_table) = LOADADDR(.int_hook_table); \ + CYG_LABEL_DEFN(__int_hook_end) = .; +#else +#define SECTION_int_hook_table(_region_, _vma_, _lma_) \ + .int_hook_table _vma_ : _lma_ \ + { CYG_LABEL_DEFN(__int_hook_start) = ABSOLUTE (.); \ + FORCE_OUTPUT; *(.int_hook_table) } \ + > _region_ +#endif + +#define SECTION_data(_region_, _vma_, _lma_) \ + .data _vma_ : _lma_ \ + { CYG_LABEL_DEFN(__ram_data_start) = ABSOLUTE (.); *(.data*) *(.data1) \ + . = ALIGN(4); \ + KEEP(*( SORT (.ecos.table.*))) ; \ + . = ALIGN(4); \ + CYG_LABEL_DEFN(_GOT1_START_) = ABSOLUTE (.); *(.got1) CYG_LABEL_DEFN(_GOT1_END_) = ABSOLUTE (.); \ + CYG_LABEL_DEFN(_GOT2_START_) = ABSOLUTE (.); *(.got2) CYG_LABEL_DEFN(_GOT2_END_) = ABSOLUTE (.); \ + . = ALIGN (4); \ + CYG_LABEL_DEFN(__CTOR_LIST__) = ABSOLUTE (.); KEEP (*(SORT (.ctors*))) CYG_LABEL_DEFN(__CTOR_END__) = ABSOLUTE (.); \ + CYG_LABEL_DEFN(__DTOR_LIST__) = ABSOLUTE (.); KEEP (*(SORT (.dtors*))) CYG_LABEL_DEFN(__DTOR_END__) = ABSOLUTE (.); \ + CYG_LABEL_DEFN(_GOT_START) = ABSOLUTE (.); CYG_LABEL_DEFN(_GLOBAL_OFFSET_TABLE_) = ABSOLUTE (.) + 32768; CYG_LABEL_DEFN(_SDA_BASE_) = ABSOLUTE (.); \ + *(.got.plt) *(.got) CYG_LABEL_DEFN(_GOT_END_) = ABSOLUTE (.); \ + *(.dynamic) *(.sdata*) *(.sbss*) } \ + > _region_ \ + CYG_LABEL_DEFN(__rom_data_start) = LOADADDR (.data); \ + CYG_LABEL_DEFN(__ram_data_end) = .; PROVIDE (CYG_LABEL_DEFN(__ram_data_end) = .); CYG_LABEL_DEFN(_edata) = .; PROVIDE (edata = .); + +#define SECTION_bss(_region_, _vma_, _lma_) \ + .bss _vma_ : _lma_ \ + { CYG_LABEL_DEFN(__bss_start) = ABSOLUTE (.); \ + *(.scommon) *(.dynbss) *(.bss.*) *(COMMON) \ + CYG_LABEL_DEFN(__bss_end) = ABSOLUTE (.); } \ + > _region_ + +#define SECTIONS_END . = ALIGN(4); _end = .; PROVIDE (end = .); + +#include CYGHWR_MEMORY_LAYOUT_LDI +#include CYGBLD_HAL_PLATFORM_H + +CYG_LABEL_DEFN(hal_virtual_vector_table) = CYGHWR_HAL_VECTOR_TABLE; diff --git a/ecos/packages/hal/h8300/h8s/current/src/h8s_stub.c b/ecos/packages/hal/h8300/h8s/current/src/h8s_stub.c new file mode 100644 index 0000000..6811df4 --- /dev/null +++ b/ecos/packages/hal/h8300/h8s/current/src/h8s_stub.c @@ -0,0 +1,157 @@ +//======================================================================== +// +// h8s_stub.c +// +// Helper functions for H8S stub +// +//======================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//======================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Yoshinori Sato +// Contributors: Yoshinori Sato +// Date: 2002-05-03 +// Purpose: +// Description: Helper functions for H8S stub +// Usage: +// +//####DESCRIPTIONEND#### +// +//======================================================================== + +#include <stddef.h> + +#include <pkgconf/hal.h> + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include <cyg/hal/hal_stub.h> +#include <cyg/hal/hal_arch.h> +#include <cyg/hal/hal_intr.h> + +#ifdef CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT +#include <cyg/hal/dbg-threads-api.h> // dbg_currthread_id +#endif + +/*--------------------------------------------------------------------*/ +/* Given a trap value TRAP, return the corresponding signal. */ + +int __computeSignal (unsigned int trap_number) +{ + switch (trap_number) { + case CYGNUM_HAL_VECTOR_TRACE: + case CYGNUM_HAL_VECTOR_TRAP3: + return SIGTRAP; + default: + return SIGINT; + } +} + +/*--------------------------------------------------------------------*/ +/* Return the trap number corresponding to the last-taken trap. */ + +int __get_trap_number (void) +{ + extern int CYG_LABEL_NAME(_intvector); + // The vector is not not part of the GDB register set so get it + // directly from the save context. + return CYG_LABEL_NAME(_intvector); +} + +/*--------------------------------------------------------------------*/ +/* Set the currently-saved pc register value to PC. This also updates NPC + as needed. */ + +void set_pc (target_register_t pc) +{ + put_register (PC, pc); +} + + +/*---------------------------------------------------------------------- + * Single-step support. + */ + +/* Clear any single-step breakpoint(s) that may have been set. */ + +void __clear_single_step (void) +{ + int exr; + exr = get_register(EXR); + exr &= 0x7f; /* clear T flag */ + put_register(EXR,exr); +} + +/* Set breakpoint(s) to simulate a single step from the current PC. */ + +void __single_step (void) +{ + int exr; + exr = get_register(EXR); + exr |= 0x80; /* set T flag */ + put_register(EXR,exr); +} + +void __install_breakpoints (void) +{ + /* NOP since single-step HW exceptions are used instead of + breakpoints. */ +} + +void __clear_breakpoints (void) +{ + +} + + +/* If the breakpoint we hit is in the breakpoint() instruction, return a + non-zero value. */ + +externC void CYG_LABEL_NAME(breakinst)(void); +int +__is_breakpoint_function () +{ + return get_register (PC) == (target_register_t)&CYG_LABEL_NAME(breakinst); +} + + +/* Skip the current instruction. */ +/* only TRAPA instruction */ + +void __skipinst (void) +{ + put_register (PC, get_register(PC) + 2); +} + +#endif // CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS diff --git a/ecos/packages/hal/h8300/h8s/current/src/var_misc.c b/ecos/packages/hal/h8300/h8s/current/src/var_misc.c new file mode 100644 index 0000000..c422e1a --- /dev/null +++ b/ecos/packages/hal/h8300/h8s/current/src/var_misc.c @@ -0,0 +1,299 @@ +//========================================================================== +// +// var_misc.c +// +// HAL CPU variant miscellaneous functions +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): ysato +// Contributors: ysato +// Date: 2002-12-31 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include <pkgconf/hal.h> + +#include <cyg/infra/cyg_type.h> // Base types +#include <cyg/infra/cyg_trac.h> // tracing macros +#include <cyg/infra/cyg_ass.h> // assertion macros +#include <cyg/hal/var_arch.h> +#include <cyg/hal/var_intr.h> +#include <cyg/hal/hal_io.h> + +/*------------------------------------------------------------------------*/ +/* Variant specific initialization routine. */ + +void hal_variant_init(void) +{ +} + +struct int_regs { + CYG_BYTE *ier; + CYG_BYTE *isr; + CYG_BYTE mask; + CYG_BYTE status; +}; + +#define REGS_DEF(ier,isr,mask,status) \ + {(CYG_BYTE *)ier,(CYG_BYTE *)isr,mask,status} + +const struct int_regs interrupt_registers[]= { + REGS_DEF(CYGARC_IERL,CYGARC_ISRL,0x01,0x01), + REGS_DEF(CYGARC_IERL,CYGARC_ISRL,0x02,0x02), + REGS_DEF(CYGARC_IERL,CYGARC_ISRL,0x04,0x04), + REGS_DEF(CYGARC_IERL,CYGARC_ISRL,0x08,0x08), + REGS_DEF(CYGARC_IERL,CYGARC_ISRL,0x10,0x10), + REGS_DEF(CYGARC_IERL,CYGARC_ISRL,0x20,0x20), + REGS_DEF(CYGARC_IERL,CYGARC_ISRL,0x40,0x40), + REGS_DEF(CYGARC_IERL,CYGARC_ISRL,0x80,0x80), + REGS_DEF(CYGARC_IERH,CYGARC_ISRH,0x01,0x01), + REGS_DEF(CYGARC_IERH,CYGARC_ISRH,0x02,0x02), + REGS_DEF(CYGARC_IERH,CYGARC_ISRH,0x04,0x04), + REGS_DEF(CYGARC_IERH,CYGARC_ISRH,0x08,0x08), + REGS_DEF(CYGARC_IERH,CYGARC_ISRH,0x10,0x10), + REGS_DEF(CYGARC_IERH,CYGARC_ISRH,0x20,0x20), + REGS_DEF(CYGARC_IERH,CYGARC_ISRH,0x40,0x40), + REGS_DEF(CYGARC_IERH,CYGARC_ISRH,0x80,0x80), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(CYGARC_TCSR,CYGARC_TCSR,0x20,0x80), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(CYGARC_REFCR,CYGARC_REFCR,0x40,0x80), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(CYGARC_ADCSR,CYGARC_ADCSR,0x40,0x80), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(CYGARC_TIER0,CYGARC_TSR0,0x01,0x01), + REGS_DEF(CYGARC_TIER0,CYGARC_TSR0,0x02,0x02), + REGS_DEF(CYGARC_TIER0,CYGARC_TSR0,0x04,0x04), + REGS_DEF(CYGARC_TIER0,CYGARC_TSR0,0x08,0x08), + REGS_DEF(CYGARC_TIER0,CYGARC_TSR0,0x10,0x10), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(CYGARC_TIER1,CYGARC_TSR1,0x01,0x01), + REGS_DEF(CYGARC_TIER1,CYGARC_TSR1,0x02,0x02), + REGS_DEF(CYGARC_TIER1,CYGARC_TSR1,0x10,0x10), + REGS_DEF(CYGARC_TIER1,CYGARC_TSR1,0x20,0x20), + REGS_DEF(CYGARC_TIER2,CYGARC_TSR2,0x01,0x01), + REGS_DEF(CYGARC_TIER2,CYGARC_TSR2,0x02,0x02), + REGS_DEF(CYGARC_TIER2,CYGARC_TSR2,0x10,0x10), + REGS_DEF(CYGARC_TIER2,CYGARC_TSR2,0x20,0x20), + REGS_DEF(CYGARC_TIER3,CYGARC_TSR3,0x01,0x01), + REGS_DEF(CYGARC_TIER3,CYGARC_TSR3,0x02,0x02), + REGS_DEF(CYGARC_TIER3,CYGARC_TSR3,0x04,0x04), + REGS_DEF(CYGARC_TIER3,CYGARC_TSR3,0x08,0x08), + REGS_DEF(CYGARC_TIER3,CYGARC_TSR3,0x10,0x10), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(CYGARC_TIER4,CYGARC_TSR4,0x01,0x01), + REGS_DEF(CYGARC_TIER4,CYGARC_TSR4,0x02,0x02), + REGS_DEF(CYGARC_TIER4,CYGARC_TSR4,0x10,0x10), + REGS_DEF(CYGARC_TIER4,CYGARC_TSR4,0x20,0x20), + REGS_DEF(CYGARC_TIER5,CYGARC_TSR5,0x01,0x01), + REGS_DEF(CYGARC_TIER5,CYGARC_TSR5,0x02,0x02), + REGS_DEF(CYGARC_TIER5,CYGARC_TSR5,0x10,0x10), + REGS_DEF(CYGARC_TIER5,CYGARC_TSR5,0x20,0x20), + REGS_DEF(CYGARC_8TCR0,CYGARC_8TCSR0,0x40,0x40), + REGS_DEF(CYGARC_8TCR0,CYGARC_8TCSR0,0x80,0x80), + REGS_DEF(CYGARC_8TCR0,CYGARC_8TCSR0,0x20,0x20), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(CYGARC_8TCR1,CYGARC_8TCSR1,0x40,0x40), + REGS_DEF(CYGARC_8TCR1,CYGARC_8TCSR1,0x80,0x80), + REGS_DEF(CYGARC_8TCR1,CYGARC_8TCSR1,0x20,0x20), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(CYGARC_DMABCRL,CYGARC_DMABCRL,0x01,0x10), + REGS_DEF(CYGARC_DMABCRL,CYGARC_DMABCRL,0x02,0x20), + REGS_DEF(CYGARC_DMABCRL,CYGARC_DMABCRL,0x04,0x40), + REGS_DEF(CYGARC_DMABCRL,CYGARC_DMABCRL,0x08,0x80), + REGS_DEF(CYGARC_EDMDR0L,CYGARC_EDMDR0L,0x80,0x40), + REGS_DEF(CYGARC_EDMDR1L,CYGARC_EDMDR1L,0x80,0x40), + REGS_DEF(CYGARC_EDMDR2L,CYGARC_EDMDR2L,0x80,0x40), + REGS_DEF(CYGARC_EDMDR3L,CYGARC_EDMDR3L,0x80,0x40), + REGS_DEF(CYGARC_SCR0,CYGARC_SSR0,0x40,0x30), + REGS_DEF(CYGARC_SCR0,CYGARC_SSR0,0x40,0x40), + REGS_DEF(CYGARC_SCR0,CYGARC_SSR0,0x80,0x80), + REGS_DEF(CYGARC_SCR0,CYGARC_SSR0,0x04,0x04), + REGS_DEF(CYGARC_SCR1,CYGARC_SSR1,0x40,0x30), + REGS_DEF(CYGARC_SCR1,CYGARC_SSR1,0x40,0x40), + REGS_DEF(CYGARC_SCR1,CYGARC_SSR1,0x80,0x80), + REGS_DEF(CYGARC_SCR1,CYGARC_SSR1,0x04,0x04), + REGS_DEF(CYGARC_SCR2,CYGARC_SSR2,0x40,0x30), + REGS_DEF(CYGARC_SCR2,CYGARC_SSR2,0x40,0x40), + REGS_DEF(CYGARC_SCR2,CYGARC_SSR2,0x80,0x80), + REGS_DEF(CYGARC_SCR2,CYGARC_SSR2,0x04,0x04), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), + REGS_DEF(NULL,NULL,0,0), +}; + +void +hal_interrupt_mask(int vector) +{ + CYG_BYTE ier; + const struct int_regs *regs=&interrupt_registers[vector-CYGNUM_HAL_INTERRUPT_EXTERNAL_0]; + if (vector == CYGNUM_HAL_INTERRUPT_WDT) { + HAL_READ_UINT8(CYGARC_TCSR,ier); + ier &= ~0x20; + HAL_WRITE_UINT16(CYGARC_TCSR,0xa500 | ier); + } else { + if ((vector >= CYGNUM_HAL_INTERRUPT_EXTERNAL_0) && regs->ier) { + HAL_READ_UINT8(regs->ier,ier); + ier &= ~(regs->mask); + HAL_WRITE_UINT8(regs->ier,ier); + } else { + CYG_FAIL("Unknown interrupt vector"); + } + } +} + +void +hal_interrupt_unmask(int vector) +{ + CYG_BYTE ier; + const struct int_regs *regs=&interrupt_registers[vector-CYGNUM_HAL_INTERRUPT_EXTERNAL_0]; + if (vector == CYGNUM_HAL_INTERRUPT_WDT) { + HAL_READ_UINT8(CYGARC_TCSR,ier); + ier |= 0x20; + HAL_WRITE_UINT16(CYGARC_TCSR,0xa500 | ier); + } else { + if ((vector >= CYGNUM_HAL_INTERRUPT_EXTERNAL_0) && regs->ier) { + HAL_READ_UINT8(regs->ier,ier); + ier |= regs->mask; + HAL_WRITE_UINT8(regs->ier,ier); + } else { + CYG_FAIL("Unknown interrupt vector"); + } + } +} + +void +hal_interrupt_acknowledge(int vector) +{ + CYG_BYTE isr; + const struct int_regs *regs=&interrupt_registers[vector-CYGNUM_HAL_INTERRUPT_EXTERNAL_0]; + if (vector >= CYGNUM_HAL_INTERRUPT_DEND0A && + vector <= CYGNUM_HAL_INTERRUPT_DEND1B) + return; + if (vector == CYGNUM_HAL_INTERRUPT_WDT) { + HAL_READ_UINT8(CYGARC_TCSR,isr); + isr &= ~0x80; + HAL_WRITE_UINT16(CYGARC_TCSR,0xa500 | isr); + } else { + if ((vector >= CYGNUM_HAL_INTERRUPT_EXTERNAL_0) && regs->isr) { + HAL_READ_UINT8(regs->isr,isr); + isr &= ~(regs->status); + HAL_WRITE_UINT8(regs->isr,isr); + } else { + CYG_FAIL("Unknown interrupt vector"); + } + } +} + +void +hal_interrupt_set_level(int vector,int level) +{ + CYG_WORD *ipr; + CYG_WORD ipr_mask; + int offset; + if ((vector < CYGNUM_HAL_INTERRUPT_EXTERNAL_0) || + (vector > CYGNUM_HAL_INTERRUPT_EXTERNAL_15)) { + return; + } else { + vector -= 16; + ipr = (CYG_WORD *)CYGARC_IPRA + vector/4; + offset = (3 - (vector & 3)) * 4; + ipr_mask = 0x0f << offset; + *ipr &= ~ipr_mask; + *ipr |= (level & 0x07) << offset; + } +} + +void +hal_interrupt_configure(int vector,int level,int up) +{ + CYG_WORD iscr,mask; + CYG_WORD *iscr_ptr; + int conf=1; + if (level) conf = 0; + if (up) conf = 2; + CYG_ASSERT(!(up && level), "Cannot trigger on high level!"); + if (vector >= CYGNUM_HAL_INTERRUPT_EXTERNAL_0 && + vector <= CYGNUM_HAL_INTERRUPT_EXTERNAL_15) { + iscr_ptr = (vector <= CYGNUM_HAL_INTERRUPT_EXTERNAL_7)?CYGARC_ISCRL:CYGARC_ISCRH; + mask = 3 << ((vector - CYGNUM_HAL_INTERRUPT_EXTERNAL_0) & 7) * 2; + HAL_READ_UINT16(iscr_ptr,iscr); + iscr &= ~mask; + iscr |= conf << ((vector - CYGNUM_HAL_INTERRUPT_EXTERNAL_0) & 7) * 2; + HAL_WRITE_UINT16(iscr_ptr,iscr); + } else { + CYG_FAIL("Unhandled interrupt vector"); + } +} + +/*------------------------------------------------------------------------*/ +/* End of var_misc.c */ diff --git a/ecos/packages/hal/h8300/sim/current/ChangeLog b/ecos/packages/hal/h8300/sim/current/ChangeLog new file mode 100644 index 0000000..8d0a3b7 --- /dev/null +++ b/ecos/packages/hal/h8300/sim/current/ChangeLog @@ -0,0 +1,77 @@ +2009-01-31 Bart Veer <bartv@ecoscentric.com> + + * cdl/hal_h8300_h8300h_sim.cdl: update compiler flags for gcc 4.x + +2004-03-18 Yoshinori Sato <ysato@users.sourceforge.jp> + + * src/hal_diag.c + fix warning. + +2004-02-24 Yoshinori Sato <ysato@users.sourceforge.jp> + + * cdl/hal_h8300_h8300h_sim.cdl + add Linker flags "-mrelax" + +2003-07-18 Nick Garnett <nickg@balti.calivar.com> + + * cdl/hal_h8300_h8300h_sim.cdl: + Changed values for CYGNUM_HAL_RTC_NUMERATOR, + CYGNUM_HAL_RTC_DENOMINATOR and CYGNUM_HAL_RTC_PERIOD to + "default_value" from "calculated". This makes it easier + to change these values globally. + +2003-03-09 Yoshinori Sato <ysato@users.sourceforge.jp> + + * cdl/hal_h8300_h8300h_sim.cdl + * src/hal_diag.c + CYGHAL_PLF_SCI_BASE add. + +2002-10-13 Yoshinori Sato <ysato@users.sourceforge.jp> + + * cdl/hal_h8300_h8300h_sim.cdl + GLOBAL_LD_FLAGS add -mint32 option. + +2002-10-13 Yoshinori Sato <ysato@users.sourceforge.jp> + + * include/pkgconf/mlt_h8300_h8300h_sim_ram.ldi + typo fix. + +2002-05-27 Yoshinori Sato <ysato@users.sourceforge.jp> + + * src/hal_diag.c + delete hal_diag_led_on/hal_diag_led_off. + +2002-04-29 Jonathan Larmour <jlarmour@redhat.com> + + * src/delay_us.S: + Don't use .file as it can confuse debugging since the .file + doesn't contain the path and therefore the debugger will never + know where it lives! This conflicts with using -Wa,--gstabs. + +2002-04-24 Yoshinori Sato <qzb04471@nifty.ne.jp> + + * New package. + +//=========================================================================== +// ####GPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +// +// This program 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. +// +// This program 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 this program; if not, write to the +// Free Software Foundation, Inc., 51 Franklin Street, +// Fifth Floor, Boston, MA 02110-1301, USA. +// ------------------------------------------- +// ####GPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/ecos/packages/hal/h8300/sim/current/cdl/hal_h8300_h8300h_sim.cdl b/ecos/packages/hal/h8300/sim/current/cdl/hal_h8300_h8300h_sim.cdl new file mode 100644 index 0000000..514bee9 --- /dev/null +++ b/ecos/packages/hal/h8300/sim/current/cdl/hal_h8300_h8300h_sim.cdl @@ -0,0 +1,211 @@ +# ==================================================================== +# +# hal_h8300_h8300h_sim.cdl +# +# H8/300H SIM HAL package configuration data +# +# ==================================================================== +## ####ECOSGPLCOPYRIGHTBEGIN#### +## ------------------------------------------- +## This file is part of eCos, the Embedded Configurable Operating System. +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +## +## This exception does not invalidate any other reasons why a work based +## on this file might be covered by the GNU General Public License. +## ------------------------------------------- +## ####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): jskov +# Original data: bartv +# Contributors: +# Date: 1999-11-02 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_H8300_H8300H_SIM { + display "H8/300H simulator" + parent CYGPKG_HAL_H8300 + requires CYGPKG_HAL_H8300_H8300H + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + define_header hal_h8300_h8300h_sim.h + include_dir cyg/hal + description " + The minimal simulator HAL package is provided for use when + only a simple simulation of the processor architecture is + desired, as opposed to detailed simulation of any specific + board. In particular it is not possible to simulate any of + the I/O devices, so device drivers cannot be used." + + compile hal_diag.c plf_misc.c delay_us.S + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H <pkgconf/hal_h8300_h8300h.h>" + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H <pkgconf/hal_h8300_h8300h_sim.h>" + + puts $::cdl_header "#define CYG_HAL_H8300" + puts $::cdl_header "#define CYGNUM_HAL_H8300_SCI_PORTS 1" + puts $::cdl_header "#define CYGHWR_HAL_VECTOR_TABLE 0xfff000" + } + + 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 " + Only supports RAM startup." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 1 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The CQ/7708 board has only one serial port. This option + chooses which port will be used to connect to a host + running GDB." + } + + # 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 + default_value 1000000000 + } + cdl_option CYGNUM_HAL_RTC_DENOMINATOR { + display "Real-time clock denominator" + flavor data + default_value 100 + } + cdl_option CYGNUM_HAL_H8300_RTC_PRESCALE { + display "Real-time clock base prescale" + flavor data + calculated 8192 + } + # Isn't a nice way to handle freq requirement! + cdl_option CYGNUM_HAL_RTC_PERIOD { + display "Real-time clock period" + flavor data + default_value 10 + } + } + + cdl_option CYGHWR_HAL_H8300_CPG_INPUT { + display "OSC/Clock Freqency" + flavor data + default_value 8000000 + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + parent CYGPKG_NONE + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "h8300-elf" } + 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 { CYGBLD_GLOBAL_WARNFLAGS . " -g -O2 -mh -mint32 -fsigned-char -fdata-sections -fno-rtti -fno-exceptions " } + 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 { "-g -nostdlib -Wl,--gc-sections -Wl,-static -mrelax -mh -mint32" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { "h8300_h8300h_sim_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_h8300_h8300h_sim_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_h8300_h8300h_sim_ram.h>" } + } + } + cdl_option CYGHAL_PLF_SCI_BASE { + display "SCI Base address" + flavor data + default_value 0xffffb0 + description " + Used SCI Channel base address." + } +} diff --git a/ecos/packages/hal/h8300/sim/current/doc/README b/ecos/packages/hal/h8300/sim/current/doc/README new file mode 100644 index 0000000..911bdf8 --- /dev/null +++ b/ecos/packages/hal/h8300/sim/current/doc/README @@ -0,0 +1,2 @@ +Please visit http://homepage2.nifty.com/ysato/eCos/index.en.html for up to date +information, particularly on which GNU tools to use and patches. diff --git a/ecos/packages/hal/h8300/sim/current/include/hal_diag.h b/ecos/packages/hal/h8300/sim/current/include/hal_diag.h new file mode 100644 index 0000000..fc41afc --- /dev/null +++ b/ecos/packages/hal/h8300/sim/current/include/hal_diag.h @@ -0,0 +1,74 @@ +#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 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-14 +// 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> + +externC void hal_diag_init(void); +externC void hal_diag_write_char(cyg_uint8 c); +externC void hal_diag_read_char(cyg_uint8 *c); + +/*---------------------------------------------------------------------------*/ + +#define HAL_DIAG_INIT() hal_diag_init() + +#define HAL_DIAG_WRITE_CHAR(_c_) hal_diag_write_char(_c_) + +#define HAL_DIAG_READ_CHAR(_c_) hal_diag_read_char(&_c_) + +/*---------------------------------------------------------------------------*/ +/* end of hal_diag.h */ +#endif /* CYGONCE_HAL_HAL_DIAG_H */ diff --git a/ecos/packages/hal/h8300/sim/current/include/pkgconf/mlt_h8300_h8300h_sim_ram.h b/ecos/packages/hal/h8300/sim/current/include/pkgconf/mlt_h8300_h8300h_sim_ram.h new file mode 100644 index 0000000..1794a75 --- /dev/null +++ b/ecos/packages/hal/h8300/sim/current/include/pkgconf/mlt_h8300_h8300h_sim_ram.h @@ -0,0 +1,18 @@ +// eCos memory layout - Wed Nov 24 13:10:23 1999 + +// This is a generated file - changes will be lost if ConfigTool(MLT) is run + +#ifndef __ASSEMBLER__ +#include <cyg/infra/cyg_type.h> +#include <stddef.h> + +#endif + +#define CYGMEM_REGION_ram (0x200000) +#define CYGMEM_REGION_ram_SIZE (0x200000) +#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 (0x300000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/ecos/packages/hal/h8300/sim/current/include/pkgconf/mlt_h8300_h8300h_sim_ram.ldi b/ecos/packages/hal/h8300/sim/current/include/pkgconf/mlt_h8300_h8300h_sim_ram.ldi new file mode 100644 index 0000000..62fe418 --- /dev/null +++ b/ecos/packages/hal/h8300/sim/current/include/pkgconf/mlt_h8300_h8300h_sim_ram.ldi @@ -0,0 +1,30 @@ +// eCos memory layout - Fri Oct 20 08:25:16 2000 + +// This is a generated file - do not edit + +#include <cyg/infra/cyg_type.inc> + +OUTPUT_FORMAT("elf32-h8300") +OUTPUT_ARCH(h8300h) + +MEMORY +{ + ram : ORIGIN = 0x000000, LENGTH = 0x200000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (ram, 0x000000, 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_int_hook_table (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/ecos/packages/hal/h8300/sim/current/include/pkgconf/mlt_h8300_h8300h_sim_ram.mlt b/ecos/packages/hal/h8300/sim/current/include/pkgconf/mlt_h8300_h8300h_sim_ram.mlt new file mode 100644 index 0000000..a850d80 --- /dev/null +++ b/ecos/packages/hal/h8300/sim/current/include/pkgconf/mlt_h8300_h8300h_sim_ram.mlt @@ -0,0 +1,12 @@ +version 0 +region ram 200000 200000 0 ! +section rom_vectors 0 1 0 1 1 1 1 1 200000 200000 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 4 0 1 0 1 0 1 bss bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! diff --git a/ecos/packages/hal/h8300/sim/current/include/platform.inc b/ecos/packages/hal/h8300/sim/current/include/platform.inc new file mode 100644 index 0000000..3df4770 --- /dev/null +++ b/ecos/packages/hal/h8300/sim/current/include/platform.inc @@ -0,0 +1,66 @@ +#ifndef CYGONCE_HAL_PLATFORM_INC +#define CYGONCE_HAL_PLATFORM_INC +##============================================================================= +## +## platform.inc +## +## H8/300H simulator "board" assembler header file +## +##============================================================================= +## ####ECOSGPLCOPYRIGHTBEGIN#### +## ------------------------------------------- +## This file is part of eCos, the Embedded Configurable Operating System. +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +## +## This exception does not invalidate any other reasons why a work based +## on this file might be covered by the GNU General Public License. +## ------------------------------------------- +## ####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): jlarmour +## Contributors: yoshinori sato +## Date: 2002-02-20 +## Purpose: H8/300H Simulator "board" definitions. +## Description: This file contains various definitions and macros that are +## required for writing assembly code for the am31 simulator. +## Currently there are none +## Usage: +## #include <cyg/hal/platform.inc> +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +##----------------------------------------------------------------------------- + +# Nothing required + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_PLATFORM_INC +# end of platform.inc diff --git a/ecos/packages/hal/h8300/sim/current/include/plf_intr.h b/ecos/packages/hal/h8300/sim/current/include/plf_intr.h new file mode 100644 index 0000000..688ad1a --- /dev/null +++ b/ecos/packages/hal/h8300/sim/current/include/plf_intr.h @@ -0,0 +1,75 @@ +#ifndef CYGONCE_HAL_PLF_INTR_H +#define CYGONCE_HAL_PLF_INTR_H + +//========================================================================== +// +// plf_intr.h +// +// H8/300H sim interrupt and clock support +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jlarmour +// Contributors: jlarmour,ysato +// Date: 1999-09-09 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock for the simulator. This file +// is empty since none are required! +// +// Usage: +// #include <cyg/hal/plf_intr.h> +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + + +//-------------------------------------------------------------------------- + +externC void h8300h_reset (void); +externC void hal_delay_us(int usecs); + +#define HAL_PLATFORM_RESET(x) +#define HAL_PLATFORM_RESET_ENTRY &h8300h_reset + +#define HAL_DELAY_US(n) hal_delay_us((n) /25) + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_PLF_INTR_H +// End of plf_intr.h diff --git a/ecos/packages/hal/h8300/sim/current/include/plf_stub.h b/ecos/packages/hal/h8300/sim/current/include/plf_stub.h new file mode 100644 index 0000000..f8d2985 --- /dev/null +++ b/ecos/packages/hal/h8300/sim/current/include/plf_stub.h @@ -0,0 +1,89 @@ +#ifndef CYGONCE_HAL_PLF_STUB_H +#define CYGONCE_HAL_PLF_STUB_H + +//============================================================================= +// +// plf_stub.h +// +// Platform header for GDB stub support. +// +//============================================================================= +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov,ysato +// Date: 1999-05-18 +// Purpose: Platform HAL stub support for H8/300H simulator +// Usage: #include <cyg/hal/plf_stub.h> +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include <pkgconf/system.h> +#include <pkgconf/hal.h> + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include <cyg/infra/cyg_type.h> // CYG_UNUSED_PARAM, externC + +#include <cyg/hal/h8300_stub.h> // architecture stub support + +#include <cyg/hal/hal_diag.h> // hal_diag_led_on + +//---------------------------------------------------------------------------- +// Define some platform specific communication details. This is mostly +// handled by hal_if now, but we need to make sure the comms tables are +// properly initialized. + +externC void cyg_hal_plf_comms_init(void); + +#define HAL_STUB_PLATFORM_INIT_SERIAL() cyg_hal_plf_comms_init() + +#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) CYG_UNUSED_PARAM(int, (baud)) +#define HAL_STUB_PLATFORM_INTERRUPTIBLE 0 + +//---------------------------------------------------------------------------- +// Stub initializer. +#ifdef CYGSEM_HAL_ROM_MONITOR +# define HAL_STUB_PLATFORM_INIT() hal_diag_led_on() +#else +# define HAL_STUB_PLATFORM_INIT() CYG_EMPTY_STATEMENT +#endif + +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_PLF_STUB_H +// End of plf_stub.h diff --git a/ecos/packages/hal/h8300/sim/current/src/delay_us.S b/ecos/packages/hal/h8300/sim/current/src/delay_us.S new file mode 100644 index 0000000..06f5d53 --- /dev/null +++ b/ecos/packages/hal/h8300/sim/current/src/delay_us.S @@ -0,0 +1,53 @@ +;;delay_us + +#include <pkgconf/hal.h> + +#include <cyg/hal/arch.inc> +#include <cyg/hal/basetype.h> +#include <cyg/hal/mod_regs_tmr.h> + +#define DELAY_COUNT (CYGHWR_HAL_H8300_PROCESSOR_SPEED/1000000)/8*25 + +// .file "delay_us.S" + .h8300h + .text + + .global CYG_LABEL_DEFN(hal_delay_us) +CYG_LABEL_DEFN(hal_delay_us): + mov.b #0,r1l + mov.b r1l,@CYGARC_8TCNT2:8 + mov.b #1,r1l + mov.b r1l,@CYGARC_8TCR2:8 + mov.b #0,r2h + sub.w e1,e1 +1: + mov.l er0,er0 + ble 6f +2: + cmp.w #DELAY_COUNT,e1 + bgt 5f + mov.b #0,r1h + mov.b @CYGARC_8TCNT2:8,r2l +3: + mov.b @CYGARC_8TCNT2:8,r1l + cmp.b r1l,r2l + beq 3b + bcs 4f + inc.b r1h +4: + sub.w r2,r1 + add.w r1,e1 + bra 2b +5: + mov.w e1,r1 + mov.b #DELAY_COUNT,r2l + divxs r2l,r1 + sub.l er2,er2 + mov.b r1l,r2l + sub.w r2,e1 + dec.l #1,er0 + bra 1b +6: + mov.b #0,r0l + mov.b r0l,@CYGARC_8TCR2 + rts diff --git a/ecos/packages/hal/h8300/sim/current/src/hal_diag.c b/ecos/packages/hal/h8300/sim/current/src/hal_diag.c new file mode 100644 index 0000000..e507afd --- /dev/null +++ b/ecos/packages/hal/h8300/sim/current/src/hal_diag.c @@ -0,0 +1,94 @@ +/*============================================================================= +// +// hal_diag.c +// +// HAL diagnostic output code +// +//============================================================================= +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-16 +// Purpose: HAL diagnostic output +// Description: Implementations of HAL diagnostic output support. +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include <pkgconf/hal.h> + +#include <cyg/hal/hal_diag.h> +#include <cyg/hal/h8_sci.h> +#include <cyg/hal/var_intr.h> + +#define SCI_BASE ((cyg_uint8*)CYGHAL_PLF_SCI_BASE) + +static channel_data_t channel = { (cyg_uint8*)SCI_BASE, 0, 0}; + +void +cyg_hal_plf_comms_init(void) +{ + static int initialized = 0; + + if (initialized) + return; + + initialized = 1; + + cyg_hal_plf_sci_init(0, 0, CYGNUM_HAL_INTERRUPT_RXI0, SCI_BASE); +} + +void hal_diag_init(void) +{ + cyg_hal_plf_sci_init_channel(&channel); +} + +void +hal_diag_write_char( cyg_uint8 c ) +{ + cyg_hal_plf_sci_putc(&channel, c); +} + +void +hal_diag_read_char(cyg_uint8 *c) +{ + *c = (char) cyg_hal_plf_sci_getc(&channel); +} + +/*===========================================================================*/ +/* EOF hal_diag.c */ + diff --git a/ecos/packages/hal/h8300/sim/current/src/plf_misc.c b/ecos/packages/hal/h8300/sim/current/src/plf_misc.c new file mode 100644 index 0000000..ea711c9 --- /dev/null +++ b/ecos/packages/hal/h8300/sim/current/src/plf_misc.c @@ -0,0 +1,124 @@ +//========================================================================== +// +// plf_misc.c +// +// HAL platform miscellaneous functions +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-17 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include <pkgconf/hal.h> + +#include <cyg/infra/cyg_type.h> // Base types + +#include <cyg/hal/hal_arch.h> // architectural definitions +#include <cyg/hal/hal_io.h> +#include <cyg/hal/hal_if.h> +#include <cyg/hal/plf_intr.h> +#include <cyg/hal/var_arch.h> + +/*------------------------------------------------------------------------*/ + +void hal_platform_init(void) +{ + hal_if_init(); +} + +void h8300h_reset(void) +{ + __asm__ ("jmp @@0\n\t"); +} + +/*------------------------------------------------------------------------*/ +/* Control C ISR support */ + +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) + +struct Hal_SavedRegisters *hal_saved_interrupt_state; + +#endif + +/*------------------------------------------------------------------------*/ +/* clock support */ + +void hal_clock_initialize(cyg_uint32 period) +{ + CYG_BYTE prescale; +#if CYGNUM_HAL_H8300_RTC_PRESCALE == 8 + prescale = 0x01; +#else +#if CYGNUM_HAL_H8300_RTC_PRESCALE == 64 + prescale = 0x02; +#else +#if CYGNUM_HAL_H8300_RTC_PRESCALE == 8192 + prescale = 0x03; +#else +#error illigal RTC prescale setting +#endif +#endif +#endif + HAL_WRITE_UINT8(CYGARC_TCORA3,period); + HAL_WRITE_UINT8(CYGARC_8TCNT3,0x00); + HAL_WRITE_UINT8(CYGARC_8TCR3,0x48 | prescale); + HAL_WRITE_UINT8(CYGARC_8TCSR3,0x00); +} + +void hal_clock_reset(cyg_uint32 vector, cyg_uint32 period) +{ + HAL_WRITE_UINT8(CYGARC_8TCR3,0x00); + HAL_WRITE_UINT8(CYGARC_8TCSR3,0x00); + hal_clock_initialize(period); +} + +void hal_clock_read(cyg_uint32 *pvalue) +{ + CYG_BYTE val; + HAL_READ_UINT8(CYGARC_8TCNT3,val); + *pvalue = val; +} + +/*------------------------------------------------------------------------*/ +/* End of plf_misc.c */ diff --git a/ecos/packages/hal/h8300/sim_s/current/ChangeLog b/ecos/packages/hal/h8300/sim_s/current/ChangeLog new file mode 100644 index 0000000..b7d7641 --- /dev/null +++ b/ecos/packages/hal/h8300/sim_s/current/ChangeLog @@ -0,0 +1,41 @@ +2009-01-31 Bart Veer <bartv@ecoscentric.com> + + * cdl/hal_h8300_h8s_sim.cdl: update compiler flags for gcc 4.x + +2004-03-18 Yoshinori Sato <ysato@users.sourceforge.jp> + + * src/hal_diag.c + fix warning. + +2004-02-24 Yoshinori Sato <ysato@users.sourceforge.jp> + + * cdl/hal_h8300_h8s_sim.cdl + add Linker flags "-mrelax" + +2003-02-21 Yoshinori Sato <qzb04471@nifty.ne.jp> + + * New package. + +//=========================================================================== +// ####GPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +// +// This program 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. +// +// This program 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 this program; if not, write to the +// Free Software Foundation, Inc., 51 Franklin Street, +// Fifth Floor, Boston, MA 02110-1301, USA. +// ------------------------------------------- +// ####GPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/ecos/packages/hal/h8300/sim_s/current/cdl/hal_h8300_h8s_sim.cdl b/ecos/packages/hal/h8300/sim_s/current/cdl/hal_h8300_h8s_sim.cdl new file mode 100644 index 0000000..bf73c6a --- /dev/null +++ b/ecos/packages/hal/h8300/sim_s/current/cdl/hal_h8300_h8s_sim.cdl @@ -0,0 +1,211 @@ +# ==================================================================== +# +# hal_h8300_h8s_sim.cdl +# +# H8S SIM HAL package configuration data +# +# ==================================================================== +## ####ECOSGPLCOPYRIGHTBEGIN#### +## ------------------------------------------- +## This file is part of eCos, the Embedded Configurable Operating System. +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +## +## This exception does not invalidate any other reasons why a work based +## on this file might be covered by the GNU General Public License. +## ------------------------------------------- +## ####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): ysato +# Original data: bartv +# Contributors: +# Date: 2003-01-01 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_H8300_H8S_SIM { + display "H8S simulator" + parent CYGPKG_HAL_H8300 + requires CYGPKG_HAL_H8300_H8S + implements CYGINT_HAL_VIRTUAL_VECTOR_SUPPORT + implements CYGINT_HAL_DEBUG_GDB_STUBS + implements CYGINT_HAL_DEBUG_GDB_STUBS_BREAK + define_header hal_h8300_h8s_sim.h + include_dir cyg/hal + description " + The minimal simulator HAL package is provided for use when + only a simple simulation of the processor architecture is + desired, as opposed to detailed simulation of any specific + board. In particular it is not possible to simulate any of + the I/O devices, so device drivers cannot be used." + + compile hal_diag.c plf_misc.c delay_us.S + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H <pkgconf/hal_h8300_h8s.h>" + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H <pkgconf/hal_h8300_h8s_sim.h>" + + puts $::cdl_header "#define CYG_HAL_H8300" + puts $::cdl_header "#define CYGNUM_HAL_H8300_SCI_PORTS 1" + puts $::cdl_header "#define CYGHWR_HAL_VECTOR_TABLE 0xfff000" + } + + 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 " + Only supports RAM startup." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 1 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + The CQ/7708 board has only one serial port. This option + chooses which port will be used to connect to a host + running GDB." + } + + # 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_H8300_RTC_PRESCALE { + display "Real-time clock base prescale" + flavor data + calculated 8192 + } + # Isn't a nice way to handle freq requirement! + cdl_option CYGNUM_HAL_RTC_PERIOD { + display "Real-time clock period" + flavor data + calculated 10 + } + } + + cdl_option CYGHWR_HAL_H8300_CPG_INPUT { + display "OSC/Clock Freqency" + flavor data + default_value 8000000 + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + parent CYGPKG_NONE + description " + Global build options including control over + compiler flags, linker flags and choice of toolchain." + + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "h8300-elf" } + 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 { CYGBLD_GLOBAL_WARNFLAGS . " -g -O2 -ms -mint32 -fsigned-char -fdata-sections -fno-rtti -fno-exceptions " } + 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 { "-g -nostdlib -Wl,--gc-sections -Wl,-static -mrelax -ms -mint32" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global flags." + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { "h8300_h8s_sim_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_h8300_h8s_sim_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_h8300_h8s_sim_ram.h>" } + } + } + cdl_option CYGHAL_PLF_SCI_BASE { + display "SCI Base address" + flavor data + default_value 0xffff78 + description " + Used SCI Channel base address." + } +} diff --git a/ecos/packages/hal/h8300/sim_s/current/doc/README b/ecos/packages/hal/h8300/sim_s/current/doc/README new file mode 100644 index 0000000..911bdf8 --- /dev/null +++ b/ecos/packages/hal/h8300/sim_s/current/doc/README @@ -0,0 +1,2 @@ +Please visit http://homepage2.nifty.com/ysato/eCos/index.en.html for up to date +information, particularly on which GNU tools to use and patches. diff --git a/ecos/packages/hal/h8300/sim_s/current/include/hal_diag.h b/ecos/packages/hal/h8300/sim_s/current/include/hal_diag.h new file mode 100644 index 0000000..fc41afc --- /dev/null +++ b/ecos/packages/hal/h8300/sim_s/current/include/hal_diag.h @@ -0,0 +1,74 @@ +#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 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-14 +// 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> + +externC void hal_diag_init(void); +externC void hal_diag_write_char(cyg_uint8 c); +externC void hal_diag_read_char(cyg_uint8 *c); + +/*---------------------------------------------------------------------------*/ + +#define HAL_DIAG_INIT() hal_diag_init() + +#define HAL_DIAG_WRITE_CHAR(_c_) hal_diag_write_char(_c_) + +#define HAL_DIAG_READ_CHAR(_c_) hal_diag_read_char(&_c_) + +/*---------------------------------------------------------------------------*/ +/* end of hal_diag.h */ +#endif /* CYGONCE_HAL_HAL_DIAG_H */ diff --git a/ecos/packages/hal/h8300/sim_s/current/include/pkgconf/mlt_h8300_h8s_sim_ram.h b/ecos/packages/hal/h8300/sim_s/current/include/pkgconf/mlt_h8300_h8s_sim_ram.h new file mode 100644 index 0000000..1794a75 --- /dev/null +++ b/ecos/packages/hal/h8300/sim_s/current/include/pkgconf/mlt_h8300_h8s_sim_ram.h @@ -0,0 +1,18 @@ +// eCos memory layout - Wed Nov 24 13:10:23 1999 + +// This is a generated file - changes will be lost if ConfigTool(MLT) is run + +#ifndef __ASSEMBLER__ +#include <cyg/infra/cyg_type.h> +#include <stddef.h> + +#endif + +#define CYGMEM_REGION_ram (0x200000) +#define CYGMEM_REGION_ram_SIZE (0x200000) +#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 (0x300000 - (size_t) CYG_LABEL_NAME (__heap1)) diff --git a/ecos/packages/hal/h8300/sim_s/current/include/pkgconf/mlt_h8300_h8s_sim_ram.ldi b/ecos/packages/hal/h8300/sim_s/current/include/pkgconf/mlt_h8300_h8s_sim_ram.ldi new file mode 100644 index 0000000..18b2427 --- /dev/null +++ b/ecos/packages/hal/h8300/sim_s/current/include/pkgconf/mlt_h8300_h8s_sim_ram.ldi @@ -0,0 +1,30 @@ +// eCos memory layout - Fri Oct 20 08:25:16 2000 + +// This is a generated file - do not edit + +#include <cyg/infra/cyg_type.inc> + +OUTPUT_FORMAT("elf32-h8300") +OUTPUT_ARCH(h8300s) + +MEMORY +{ + ram : ORIGIN = 0x000000, LENGTH = 0x200000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (ram, 0x000000, 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_int_hook_table (ram, ALIGN (0x1), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} diff --git a/ecos/packages/hal/h8300/sim_s/current/include/pkgconf/mlt_h8300_h8s_sim_ram.mlt b/ecos/packages/hal/h8300/sim_s/current/include/pkgconf/mlt_h8300_h8s_sim_ram.mlt new file mode 100644 index 0000000..a850d80 --- /dev/null +++ b/ecos/packages/hal/h8300/sim_s/current/include/pkgconf/mlt_h8300_h8s_sim_ram.mlt @@ -0,0 +1,12 @@ +version 0 +region ram 200000 200000 0 ! +section rom_vectors 0 1 0 1 1 1 1 1 200000 200000 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 4 0 1 0 1 0 1 bss bss ! +section bss 0 4 0 1 0 1 0 1 heap1 heap1 ! +section heap1 0 8 0 0 0 0 0 0 ! diff --git a/ecos/packages/hal/h8300/sim_s/current/include/platform.inc b/ecos/packages/hal/h8300/sim_s/current/include/platform.inc new file mode 100644 index 0000000..ec5298b --- /dev/null +++ b/ecos/packages/hal/h8300/sim_s/current/include/platform.inc @@ -0,0 +1,65 @@ +#ifndef CYGONCE_HAL_PLATFORM_INC +#define CYGONCE_HAL_PLATFORM_INC +##============================================================================= +## +## platform.inc +## +## H8S simulator assembler header file +## +##============================================================================= +## ####ECOSGPLCOPYRIGHTBEGIN#### +## ------------------------------------------- +## This file is part of eCos, the Embedded Configurable Operating System. +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +## +## This exception does not invalidate any other reasons why a work based +## on this file might be covered by the GNU General Public License. +## ------------------------------------------- +## ####ECOSGPLCOPYRIGHTEND#### +##============================================================================= +#######DESCRIPTIONBEGIN#### +## +## Author(s): yoshinori sato +## Contributors: yoshinori sato +## Date: 2003-02-23 +## Purpose: H8S simulator definitions. +## Description: This file contains various definitions and macros that are +## required for writing assembly code for the am31 simulator. +## Currently there are none +## Usage: +## #include <cyg/hal/platform.inc> +## ... +## +## +######DESCRIPTIONEND#### +## +##============================================================================= + +##----------------------------------------------------------------------------- + + +#------------------------------------------------------------------------------ +#endif // ifndef CYGONCE_HAL_PLATFORM_INC +# end of platform.inc diff --git a/ecos/packages/hal/h8300/sim_s/current/include/plf_intr.h b/ecos/packages/hal/h8300/sim_s/current/include/plf_intr.h new file mode 100644 index 0000000..2002ed4 --- /dev/null +++ b/ecos/packages/hal/h8300/sim_s/current/include/plf_intr.h @@ -0,0 +1,75 @@ +#ifndef CYGONCE_HAL_PLF_INTR_H +#define CYGONCE_HAL_PLF_INTR_H + +//========================================================================== +// +// plf_intr.h +// +// H8S SIM interrupt and clock support +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2003-02-23 +// Purpose: Define Interrupt support +// Description: The macros defined here provide the HAL APIs for handling +// interrupts and the clock for the simulator. This file +// is empty since none are required! +// +// Usage: +// #include <cyg/hal/plf_intr.h> +// ... +// +// +//####DESCRIPTIONEND#### +// +//========================================================================== + + +//-------------------------------------------------------------------------- + +externC void h8s_reset (void); +externC void hal_delay_us(int usecs); + +#define HAL_PLATFORM_RESET(x) +#define HAL_PLATFORM_RESET_ENTRY &h8s_reset + +#define HAL_DELAY_US(n) hal_delay_us(n) + +//-------------------------------------------------------------------------- +#endif // ifndef CYGONCE_HAL_PLF_INTR_H +// End of plf_intr.h diff --git a/ecos/packages/hal/h8300/sim_s/current/include/plf_stub.h b/ecos/packages/hal/h8300/sim_s/current/include/plf_stub.h new file mode 100644 index 0000000..59d7f77 --- /dev/null +++ b/ecos/packages/hal/h8300/sim_s/current/include/plf_stub.h @@ -0,0 +1,85 @@ +#ifndef CYGONCE_HAL_PLF_STUB_H +#define CYGONCE_HAL_PLF_STUB_H + +//============================================================================= +// +// plf_stub.h +// +// Platform header for GDB stub support. +// +//============================================================================= +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): jskov +// Contributors:jskov +// Date: 1999-05-18 +// Purpose: Platform HAL stub support for H8S simulator +// Usage: #include <cyg/hal/plf_stub.h> +// +//####DESCRIPTIONEND#### +// +//============================================================================= + +#include <pkgconf/system.h> +#include <pkgconf/hal.h> + +#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS + +#include <cyg/infra/cyg_type.h> // CYG_UNUSED_PARAM, externC + +#include <cyg/hal/h8300_stub.h> // architecture stub support + +#include <cyg/hal/hal_diag.h> // hal_diag_led_on + +//---------------------------------------------------------------------------- +// Define some platform specific communication details. This is mostly +// handled by hal_if now, but we need to make sure the comms tables are +// properly initialized. + +externC void cyg_hal_plf_comms_init(void); + +#define HAL_STUB_PLATFORM_INIT_SERIAL() cyg_hal_plf_comms_init() + +#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) CYG_UNUSED_PARAM(int, (baud)) +#define HAL_STUB_PLATFORM_INTERRUPTIBLE 0 + +//---------------------------------------------------------------------------- +// Stub initializer. +#define HAL_STUB_PLATFORM_INIT() CYG_EMPTY_STATEMENT + +#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS +//----------------------------------------------------------------------------- +#endif // CYGONCE_HAL_PLF_STUB_H +// End of plf_stub.h diff --git a/ecos/packages/hal/h8300/sim_s/current/src/delay_us.S b/ecos/packages/hal/h8300/sim_s/current/src/delay_us.S new file mode 100644 index 0000000..a59dad5 --- /dev/null +++ b/ecos/packages/hal/h8300/sim_s/current/src/delay_us.S @@ -0,0 +1,26 @@ +;;delay_us + +#include <pkgconf/hal.h> + +#include <cyg/hal/arch.inc> +#include <cyg/hal/basetype.h> +#include <cyg/hal/mod_regs_tmr.h> + +#define DELAY_COUNT (CYGHWR_HAL_H8300_PROCESSOR_SPEED/1000000)/8*25 + +// .file "delay_us.S" + .h8300s + .text + + .global CYG_LABEL_DEFN(hal_delay_us) +CYG_LABEL_DEFN(hal_delay_us): + shlr.l er0 + shlr.l er0 + shlr.l er0 + mov.l er0,er0 +1: + ble 4f + dec.l #1,er0 + bra 1b +4: + rts diff --git a/ecos/packages/hal/h8300/sim_s/current/src/hal_diag.c b/ecos/packages/hal/h8300/sim_s/current/src/hal_diag.c new file mode 100644 index 0000000..60d82cc --- /dev/null +++ b/ecos/packages/hal/h8300/sim_s/current/src/hal_diag.c @@ -0,0 +1,94 @@ +/*============================================================================= +// +// hal_diag.c +// +// HAL diagnostic output code +// +//============================================================================= +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): ysato +// Contributors: ysato +// Date: 2003-02-23 +// Purpose: HAL diagnostic output +// Description: Implementations of HAL diagnostic output support. +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include <pkgconf/hal.h> + +#include <cyg/hal/hal_diag.h> +#include <cyg/hal/h8_sci.h> +#include <cyg/hal/var_intr.h> + +#define SCI_BASE ((cyg_uint8*)CYGHAL_PLF_SCI_BASE) + +static channel_data_t channel = { (cyg_uint8*)SCI_BASE, 0, 0}; + +void +cyg_hal_plf_comms_init(void) +{ + static int initialized = 0; + + if (initialized) + return; + + initialized = 1; + + cyg_hal_plf_sci_init(0, 0, CYGNUM_HAL_INTERRUPT_RXI0, SCI_BASE); +} + +void hal_diag_init(void) +{ + cyg_hal_plf_sci_init_channel(&channel); +} + +void +hal_diag_write_char( cyg_uint8 c ) +{ + cyg_hal_plf_sci_putc(&channel, c); +} + +void +hal_diag_read_char(cyg_uint8 *c) +{ + *c = (char) cyg_hal_plf_sci_getc(&channel); +} + +/*===========================================================================*/ +/* EOF hal_diag.c */ + diff --git a/ecos/packages/hal/h8300/sim_s/current/src/plf_misc.c b/ecos/packages/hal/h8300/sim_s/current/src/plf_misc.c new file mode 100644 index 0000000..681237d --- /dev/null +++ b/ecos/packages/hal/h8300/sim_s/current/src/plf_misc.c @@ -0,0 +1,128 @@ +//========================================================================== +// +// plf_misc.c +// +// HAL platform miscellaneous functions +// +//========================================================================== +// ####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, 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., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 v2. +// +// This exception does not invalidate any other reasons why a work based +// on this file might be covered by the GNU General Public License. +// ------------------------------------------- +// ####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): yoshinori sato +// Contributors: yoshinori sato +// Date: 2002-02-17 +// Purpose: HAL miscellaneous functions +// Description: This file contains miscellaneous functions provided by the +// HAL. +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include <pkgconf/hal.h> + +#include <cyg/infra/cyg_type.h> // Base types + +#include <cyg/hal/hal_arch.h> // architectural definitions +#include <cyg/hal/hal_io.h> +#include <cyg/hal/hal_if.h> +#include <cyg/hal/plf_intr.h> +#include <cyg/hal/var_arch.h> + +/*------------------------------------------------------------------------*/ + +void hal_platform_init(void) +{ + hal_if_init(); +} + +void h8s_reset(void) +{ + __asm__ ("jmp @@0\n\t"); +} + +/*------------------------------------------------------------------------*/ +/* Control C ISR support */ + +#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) + +struct Hal_SavedRegisters *hal_saved_interrupt_state; + +#endif + +/*------------------------------------------------------------------------*/ +/* clock support */ + +void hal_clock_initialize(cyg_uint32 period) +{ + cyg_uint8 prescale; + cyg_uint8 tmp; +#if CYGNUM_HAL_H8300_RTC_PRESCALE == 8 + prescale = 0x01; +#else +#if CYGNUM_HAL_H8300_RTC_PRESCALE == 64 + prescale = 0x02; +#else +#if CYGNUM_HAL_H8300_RTC_PRESCALE == 8192 + prescale = 0x03; +#else +#error illigal RTC prescale setting +#endif +#endif +#endif + HAL_READ_UINT8(CYGARC_MSTPCRL, tmp); + tmp &= ~0x01; + HAL_WRITE_UINT8(CYGARC_MSTPCRL, tmp); + HAL_WRITE_UINT8(CYGARC_8TCORA1, period); + HAL_WRITE_UINT8(CYGARC_8TCNT1, 0x00); + HAL_WRITE_UINT8(CYGARC_8TCR1, 0x48 | prescale); + HAL_WRITE_UINT8(CYGARC_8TCSR1, 0x00); +} + +void hal_clock_reset(cyg_uint32 vector, cyg_uint32 period) +{ + HAL_WRITE_UINT8(CYGARC_8TCR1,0x00); + HAL_WRITE_UINT8(CYGARC_8TCSR1,0x00); + hal_clock_initialize(period); +} + +void hal_clock_read(cyg_uint32 *pvalue) +{ + CYG_BYTE val; + HAL_READ_UINT8(CYGARC_8TCNT1,val); + *pvalue = val; +} + +/*------------------------------------------------------------------------*/ +/* End of plf_misc.c */ |