Index: current/ChangeLog =================================================================== RCS file: /cvsroot/ecos-h8/ecos/packages/hal/h8300/aki3068net/current/ChangeLog,v retrieving revision 1.1.1.1 retrieving revision 1.4 diff -u -r1.1.1.1 -r1.4 --- current/ChangeLog 26 May 2002 12:36:50 -0000 1.1.1.1 +++ current/ChangeLog 28 Feb 2003 12:24:14 -0000 1.4 @@ -1,3 +1,44 @@ +2003-02-28 Yoshinori Sato + + * 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 + + * include/platform.inc + DRAM setup delay fix. + +2002-11-26 Yoshinori Sato + + * 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 + + * include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.ldi + typo fixed. + +2002-10-15 Yoshinori Sato + + * 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 + + * src/hal_diag.c + delete hal_delay_us function. + 2002-04-29 Jonathan Larmour * src/delay_us.S: Index: current/cdl/hal_h8300_h8300h_aki3068net.cdl =================================================================== RCS file: /cvsroot/ecos-h8/ecos/packages/hal/h8300/aki3068net/current/cdl/hal_h8300_h8300h_aki3068net.cdl,v retrieving revision 1.1.1.3 retrieving revision 1.7 diff -u -r1.1.1.3 -r1.7 --- current/cdl/hal_h8300_h8300h_aki3068net.cdl 31 May 2002 15:21:37 -0000 1.1.1.3 +++ current/cdl/hal_h8300_h8300h_aki3068net.cdl 28 Feb 2003 12:24:19 -0000 1.7 @@ -40,10 +40,10 @@ # ==================================================================== ######DESCRIPTIONBEGIN#### # -# Author(s): jskov +# Author(s): yoshinori sato # Original data: bartv -# Contributors: -# Date: 1999-11-02 +# Contributors: yoshinori sato +# Date: 2002-04-10 # #####DESCRIPTIONEND#### # @@ -62,11 +62,12 @@ 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 + compile hal_diag.c plf_misc.c delay_us.S plf_ide.c define_proc { puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_IO_H " puts $::cdl_header "#define CYG_HAL_H8300" puts $::cdl_header "#define CYGNUM_HAL_H8300_SCI_PORTS 1" @@ -162,6 +163,12 @@ 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 @@ -197,11 +204,32 @@ display "Global linker flags" flavor data no_define - default_value { "-g -nostdlib -Wl,--gc-sections -Wl,-static -mh" } + default_value { "-g -nostdlib -Wl,--gc-sections -Wl,-static -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 { + /bin/gdb_module.bin : /bin/gdb_module.img + $(OBJCOPY) -O binary $< $@ + } + } } cdl_component CYGHWR_MEMORY_LAYOUT { @@ -229,6 +257,36 @@ "" } } } + + 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 @@ -241,5 +299,22 @@ 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 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 CYGHWR_HAL_H8300_VECTOR_ADDRESS { + display "Hook Vector Address" + flavor data + default_value 0xffbf20 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYGSEM_HAL_H8300_VECTOR_HOOK == 1 } + description " + Hooking Vector Table Address" } } Index: current/include/platform.inc =================================================================== RCS file: /cvsroot/ecos-h8/ecos/packages/hal/h8300/aki3068net/current/include/platform.inc,v retrieving revision 1.1.1.3 diff -u -r1.1.1.3 platform.inc --- current/include/platform.inc 31 May 2002 15:21:38 -0000 1.1.1.3 +++ current/include/platform.inc 28 Feb 2003 13:58:11 -0000 @@ -42,9 +42,9 @@ ##============================================================================= #######DESCRIPTIONBEGIN#### ## -## Author(s): jlarmour +## Author(s): Yoshinori Saro ## Contributors: Yoshinori Sato -## Date: 1999-09-09 +## 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 @@ -65,39 +65,54 @@ ##----------------------------------------------------------------------------- +#if CYGINT_HAL_PLF_IF_IDE != 0 +#define ABWCR_VAL ~((1 << ((CYGHWR_HAL_IDE_REGISTER >> 25) & 7)) |\ + (1 << ((CYGHWR_HAL_IDE_ALT_REGS >> 25) & 7))) +#else +#define ABWCR_VAL 0xff +#endif + #define CYGPKG_HAL_H8300_MEMC_DEFINED .macro hal_memc_init #if defined(CYG_HAL_STARTUP_ROM) mov.l #init_regs,er0 - mov.w #8,e1 + mov.w #0xffff,e2 1: - mov.l @er0+,er2 - mov.w @er0+,r1 + mov.w @er0+,r2 + beq 2f + mov.w @r0+,r1 mov.b r1l,@er2 - dec.w #1,e1 - bne 1b - bra 2f + bra 1b +#define INIT_REGS_DATA(REGS,DATA) \ + .word (REGS & 0xffff),DATA init_regs: - .long CYGARC_RTCOR - .word 5 ; 1.5[ms] reflesh cycle - .long CYGARC_RTMCSR - .word 0x30 ; clk x 2048 - .long CYGARC_DRCRB - .word 0x90 - .long CYGARC_DRCRA - .word 0x22 - .long CYGARC_P1DDR - .word 0xff - .long CYGARC_P2DDR - .word 0xff - .long CYGARC_P5DDR - .word 0x01 - .long CYGARC_P8DDR - .word 0x0c +INIT_REGS_DATA(CYGARC_RTCOR,9) +INIT_REGS_DATA(CYGARC_RTMCSR,0x30) +INIT_REGS_DATA(CYGARC_DRCRB,0x98) +INIT_REGS_DATA(CYGARC_DRCRA,0x3c) +INIT_REGS_DATA(CYGARC_ASTCR,0xfb) +INIT_REGS_DATA(CYGARC_ABWCR,ABWCR_VAL) +INIT_REGS_DATA(CYGARC_P1DDR,0xff) +INIT_REGS_DATA(CYGARC_P2DDR,0xff) +INIT_REGS_DATA(CYGARC_P5DDR,0x01) +INIT_REGS_DATA(CYGARC_P8DDR,0x0c) + .word 0 init_regs_end: +;; Thanks Hiroyuki Senshu +;; DRAM Setup delay 2: + mov.b #8,r0h +3: + mov.b #0,r0l +4: + dec.b r0l + bne 4b + btst #7,@CYGARC_RTMCSR:8 + beq 3b + dec r0h + bne 3b #endif .endm Index: current/include/plf_intr.h =================================================================== RCS file: /cvsroot/ecos-h8/ecos/packages/hal/h8300/aki3068net/current/include/plf_intr.h,v retrieving revision 1.1.1.3 retrieving revision 1.3 diff -u -r1.1.1.3 -r1.3 --- current/include/plf_intr.h 31 May 2002 15:21:38 -0000 1.1.1.3 +++ current/include/plf_intr.h 27 Feb 2003 14:38:11 -0000 1.3 @@ -43,9 +43,9 @@ //========================================================================== //#####DESCRIPTIONBEGIN#### // -// Author(s): jlarmour -// Contributors: jlarmour -// Date: 1999-09-09 +// 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 @@ -69,7 +69,7 @@ #define HAL_PLATFORM_RESET(x) #define HAL_PLATFORM_RESET_ENTRY &h8300h_reset -#define HAL_DELAY_US(n) hal_delay_us((n) / 16) +#define HAL_DELAY_US(n) hal_delay_us((n)) //-------------------------------------------------------------------------- #endif // ifndef CYGONCE_HAL_PLF_INTR_H Index: current/include/plf_io.h =================================================================== RCS file: current/include/plf_io.h diff -N current/include/plf_io.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ current/include/plf_io.h 28 Feb 2003 12:24:24 -0000 1.1 @@ -0,0 +1,91 @@ +#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 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license/ +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): 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 + +//----------------------------------------------------------------------------- +// 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 Index: current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.ldi =================================================================== RCS file: /cvsroot/ecos-h8/ecos/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.ldi,v retrieving revision 1.1.1.3 retrieving revision 1.5 diff -u -r1.1.1.3 -r1.5 --- current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.ldi 31 May 2002 15:21:38 -0000 1.1.1.3 +++ current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.ldi 28 Feb 2003 12:24:29 -0000 1.5 @@ -9,7 +9,8 @@ MEMORY { - ram : ORIGIN = 0x400000, LENGTH = 0x20000 + ram : ORIGIN = 0x400000, LENGTH = 0x28000 + iram : ORIGIN = 0xffbf20, LENGTH = 0x4000-0x100 } SECTIONS @@ -21,10 +22,8 @@ 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_fook_table (ram, ALIGN (0x4), 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; Index: current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.mlt =================================================================== RCS file: /cvsroot/ecos-h8/ecos/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.mlt,v retrieving revision 1.1.1.3 retrieving revision 1.3 diff -u -r1.1.1.3 -r1.3 --- current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.mlt 31 May 2002 15:21:38 -0000 1.1.1.3 +++ current/include/pkgconf/mlt_h8300_h8300h_aki3068net_ram.mlt 28 Feb 2003 12:24:29 -0000 1.3 @@ -1,11 +1,11 @@ version 0 -region ram 400000 10000 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_fook_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 ! Index: current/include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.ldi =================================================================== RCS file: /cvsroot/ecos-h8/ecos/packages/hal/h8300/aki3068net/current/include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.ldi,v retrieving revision 1.1.1.3 retrieving revision 1.6 diff -u -r1.1.1.3 -r1.6 --- current/include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.ldi 31 May 2002 15:21:38 -0000 1.1.1.3 +++ current/include/pkgconf/mlt_h8300_h8300h_aki3068net_rom.ldi 25 Nov 2002 12:07:32 -0000 1.6 @@ -9,12 +9,15 @@ MEMORY { +#define IRAM_TOP 0xffbf20 rom : ORIGIN = 0x000000, LENGTH = 0x60000 #if !defined(CYGPKG_IO_ETH_DRIVERS) - ram : ORIGIN = 0xffbf20, LENGTH = 0x4000-0x100 +#define WORK (IRAM_TOP+0x100) + ram : ORIGIN = WORK, LENGTH = 0x4000-0x100 #else - ram : ORIGIN = 0x5F4000, LENGTH = 0xC000 - iram : ORIGIN = 0xffbf20, LENGTH = 0x4000-0x100 +#define WORK 0x5f4000 + ram : ORIGIN = WORK, LENGTH = 0xC000 + iram : ORIGIN = IRAM_TOP, LENGTH = 0x4000-0x100 #endif } @@ -28,14 +31,14 @@ SECTION_rodata1 (rom, ALIGN (0x1), LMA_EQ_VMA) 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(CYGPKG_IO_ETH_DRIVERS) - SECTION_int_fook_table (ram, 0xffbf20,FOLLOWING (.gcc_except_table)) - SECTION_data (ram, ALIGN (0x4),FOLLOWING (.int_fook_table)) - SECTION_bss (ram, ALIGN (0x4),LMA_EQ_VMA) + SECTION_int_hook_table (ram, CYGHWR_HAL_H8300_VECTOR_ADDRESS,FOLLOWING (.data)) #else - SECTION_data (ram, 0x5F4000,FOLLOWING (.gcc_except_table)) - SECTION_bss (ram, ALIGN (0x4),LMA_EQ_VMA) - SECTION_int_fook_table (iram, 0xffbf20,FOLLOWING (.data)) + SECTION_int_hook_table (iram, CYGHWR_HAL_H8300_VECTOR_ADDRESS,FOLLOWING (.data)) #endif SECTIONS_END } + +#undef WORK Index: current/src/delay_us.S =================================================================== RCS file: /cvsroot/ecos-h8/ecos/packages/hal/h8300/aki3068net/current/src/delay_us.S,v retrieving revision 1.1.1.2 retrieving revision 1.3 diff -u -r1.1.1.2 -r1.3 --- current/src/delay_us.S 26 May 2002 12:36:51 -0000 1.1.1.2 +++ current/src/delay_us.S 22 Feb 2003 16:40:34 -0000 1.3 @@ -14,26 +14,12 @@ .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 r1l,@CYGARC_8TCSR2:8 - mov.b #DELAY_COUNT+1,r1l - mov.b r1l,@CYGARC_TCORA2:8 - mov.b #0x09,r1l - mov.b r1l,@CYGARC_8TCR2:8 - mov.b #0,r2h - sub.w e1,e1 -1: + shlr.l er0 mov.l er0,er0 - ble 3f -2: - btst #6,@CYGARC_8TCSR2:8 - beq 2b - bclr #6,@CYGARC_8TCSR2:8 +1: + ble 4f dec.l #1,er0 bra 1b -3: - mov.b #0,r0l - mov.b r0l,@CYGARC_8TCR2 +4: rts Index: current/src/hal_diag.c =================================================================== RCS file: /cvsroot/ecos-h8/ecos/packages/hal/h8300/aki3068net/current/src/hal_diag.c,v retrieving revision 1.1.1.3 retrieving revision 1.3 diff -u -r1.1.1.3 -r1.3 --- current/src/hal_diag.c 31 May 2002 15:21:38 -0000 1.1.1.3 +++ current/src/hal_diag.c 27 May 2002 13:25:08 -0000 1.3 @@ -40,9 +40,9 @@ //============================================================================= //#####DESCRIPTIONBEGIN#### // -// Author(s): dsm -// Contributors: dsm -// Date: 1998-03-13 +// Author(s): ysato +// Contributors: ysato +// Date: 2002-04-05 // Purpose: HAL diagnostic output // Description: Implementations of HAL diagnostic output support. // @@ -60,7 +60,7 @@ #define SCI_BASE ((cyg_uint8*)0xffffb8) -static channel_data_t channel = { (cyg_uint8*)SCI_BASE, 0, 0}; +const static channel_data_t channel = { (cyg_uint8*)SCI_BASE, 0, 0}; void cyg_hal_plf_comms_init(void) Index: current/src/plf_ide.c =================================================================== RCS file: current/src/plf_ide.c diff -N current/src/plf_ide.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ current/src/plf_ide.c 28 Feb 2003 12:24:34 -0000 1.1 @@ -0,0 +1,135 @@ +//========================================================================== +// +// 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 Red Hat, Inc. +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// +// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. +// at http://sources.redhat.com/ecos/ecos-license/ +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): 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 + +#include // Base types + +#include // architectural definitions +#include +#include +#include +#include + +/*------------------------------------------------------------------------*/ + +#if CYGINT_HAL_PLF_IF_IDE != 0 + +#define IDE_REG_FEATUERS 1 +#define IDE_REG_COMMAND 7 + +void 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 +} + +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_uint16 *)(CYGHWR_HAL_IDE_REGISTER + (r << 1)) & 0xff; +#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 + *d = *(volatile cyg_uint16 *)(CYGHWR_HAL_IDE_REGISTER + (r << 1)); +#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_uint16 *)(CYGHWR_HAL_IDE_ALT_REGS + 12) & 0xff; +#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) +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 + (__regno <<1)) = (__val >> 8) | (__val << 8); +#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 */ Index: current/src/plf_misc.c =================================================================== RCS file: /cvsroot/ecos-h8/ecos/packages/hal/h8300/aki3068net/current/src/plf_misc.c,v retrieving revision 1.1.1.3 retrieving revision 1.2 diff -u -r1.1.1.3 -r1.2 --- current/src/plf_misc.c 31 May 2002 15:21:37 -0000 1.1.1.3 +++ current/src/plf_misc.c 30 Aug 2002 05:32:00 -0000 1.2 @@ -122,40 +122,5 @@ *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 */