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

Subversion Repositories openrisc_me

Compare Revisions

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

Rev 27 → Rev 174

/romboot.ld
0,0 → 1,11
 
 
MEMORY
{
rom : ORIGIN = 0x00000, LENGTH = 0x100
}
 
SECTIONS
{
.text : { *(.text) *(.data) *(.bss) } > rom
}
/plf_stub.c
0,0 → 1,93
//=============================================================================
//
// plf_stub.c
//
// Platform specific code for GDB stub support.
//
//=============================================================================
 
// - pjo, 28 sep 1999
// - Copied ARM version for use with i386/pc.
 
//####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): gthomas (based on the old ARM/AEB hal_stub.c)
// Contributors:gthomas, jskov, pjo, nickg
// Date: 1999-02-15
// Purpose: Platform specific code for GDB stub support.
//
//####DESCRIPTIONEND####
//
//=============================================================================
 
#include <pkgconf/hal.h>
 
#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
 
#ifdef CYGPKG_REDBOOT
#include <pkgconf/redboot.h>
#endif
 
#include <cyg/hal/hal_stub.h>
 
#include <cyg/hal/hal_io.h> // HAL IO macros
#include <cyg/hal/hal_intr.h> // HAL interrupt macros
 
#include <cyg/hal/plf_misc.h>
 
//-----------------------------------------------------------------------------
// Connect our VSR to the exception vectors.
 
externC void __default_exception_vsr(void);
 
#if defined(CYGSEM_REDBOOT_BSP_SYSCALLS)
externC void __syscall_tramp(void);
externC char idtStart[];
#endif // CYGSEM_REDBOOT_BSP_SYSCALLS
 
 
void hal_pc_stubs_init(void)
{
#if defined(CYGSEM_REDBOOT_BSP_SYSCALLS)
cyg_hal_pc_set_idt_entry((CYG_ADDRESS)__syscall_tramp, (short *)(idtStart + (0x80 * 8)));
#endif // CYGSEM_REDBOOT_BSP_SYSCALLS
}
 
 
//-----------------------------------------------------------------------------
 
#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
// End of plf_stub.c
/romboot.S
0,0 → 1,195
##=============================================================================
##
## romboot.S
##
## x86 romboot
##
##=============================================================================
#####ECOSGPLCOPYRIGHTBEGIN####
## -------------------------------------------
## This file is part of eCos, the Embedded Configurable Operating System.
## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
##
## eCos is free software; you can redistribute it and/or modify it under
## the terms of the GNU General Public License as published by the Free
## Software Foundation; either version 2 or (at your option) any later version.
##
## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
## WARRANTY; without even the implied warranty of MERCHANTABILITY or
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
## for more details.
##
## You should have received a copy of the GNU General Public License along
## with eCos; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
##
## As a special exception, if other files instantiate templates or use macros
## or inline functions from this file, or you compile this file and link it
## with other works to produce a work based on this file, this file does not
## by itself cause the resulting work to be covered by the GNU General Public
## License. However the source code for this file must still be made available
## in accordance with section (3) of the GNU General Public License.
##
## This exception does not invalidate any other reasons why a work based on
## this file might be covered by the GNU General Public License.
##
## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
## at http://sources.redhat.com/ecos/ecos-license/
## -------------------------------------------
#####ECOSGPLCOPYRIGHTEND####
##=============================================================================
#######DESCRIPTIONBEGIN####
##
## Author(s): jskov
## Contributors:jskov
## Date: 1999-01-07
## Purpose: x86 romboot
## Description: When booting from ROM we need to run a short sequence of real
## mode code before jumping into 32 bit protected mode. There are
## problems in GAS with mixing all this code together, and it is
## easier to just move this bit of code out to a separate file.
##
##
######DESCRIPTIONEND####
##
##=============================================================================
 
 
#include <pkgconf/system.h>
#include <pkgconf/hal.h>
 
#include <cyg/hal/arch.inc>
 
#==============================================================================
 
// .file "romboot.S"
 
#------------------------------------------------------------------------------
 
.code16
 
romboot_start:
/* Disable interrupt handling. */
cli
 
# Set DS == CS
movw %cs,%ax
movw %ax,%ds
# set ES == 0
movw $0,%ax
movw %ax,%es
 
# Call video bios to init display
movw $0xc000,%bx
movw %bx,%ds
movw 0x0000,%ax
movw $0x0000,%bx
movw %bx,%ds
cmpw $0xAA55,%ax
jne 1f
.byte 0x9a # lcall
.word 0x0003 # offset
.word 0xc000 # segment
1:
movw %cs,%ax
movw %ax,%ds
# set ES == 0
movw $0,%ax
movw %ax,%es
 
# build a GDT descriptor in memory at location zero
movw $(gdtEnd - gdtStart),%ax
movw %ax,%es:0
lea gdtStart,%ax
addw $0xFF00,%ax
movw %ax,%es:2
movw $0x000F,%ax
movw %ax,%es:4
# load GDTR
lgdt %es:0
 
# Switch to protected mode.
movl %cr0,%eax
orb $1, %al
movl %eax,%cr0
 
# and do a jump to flush instruction prefetch
jmp romboot_pm
 
hlt
 
.align 4, 0xCC
gdtStart:
/* Selector 0x00 == invalid. */
.word 0x0000
.word 0x0000
.byte 0x00
.byte 0x00
.byte 0x00
.byte 0x00
 
/* Selector 0x08 == code. */
.word 0xFFFF
.word 0x0000
.byte 0x00
.byte 0x9B
.byte 0xCF
.byte 0x00
 
/* Selector 0x10 == data. */
.word 0xFFFF
.word 0x0000
.byte 0x00
.byte 0x93
.byte 0xCF
.byte 0x00
 
/* Selector 0x18 == shorter code: faults any code
* access 0xF0000000-0xFFFFFFFF.
*/
.word 0xFFFF
.word 0x0000
.byte 0x00
.byte 0x9B
.byte 0xC7
.byte 0x00
 
/* Selector 0x20 == data; faults any access 0xF0000000-0xFFFFFFFF. */
.word 0xFFFF
.word 0x0000
.byte 0x00
.byte 0x93
.byte 0xC7
.byte 0x00
 
.align 4, 0xCC
gdtEnd:
 
# We arrive here in protected mode
romboot_pm:
 
# Load data selectors
movw $0x10, %ax
movw %ax, %ds
movw %ax, %es
movw %ax, %fs
movw %ax, %gs
# jump to start of ROM, where the PM code starts
# ljmp $8,$0xF0000
.byte 0x66,0xea # opsize + ljmp opcode
.long 0x000F0000 # destination address
.word 0x0008 # code selector
 
.code16
 
.org 0xF0
romboot_reset:
jmp romboot_start
 
.org 0x100
#------------------------------------------------------------------------------
# end of romboot.S
/hal_diag.c
0,0 → 1,140
//=============================================================================
//
// 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 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): proven
// Contributors:proven
// Date: 1998-10-05
// Purpose: HAL diagnostic output
// Description: Implementations of HAL diagnostic output support.
//
//####DESCRIPTIONEND####
//
//=============================================================================
 
#include <pkgconf/hal.h>
 
#include <cyg/infra/cyg_type.h> // base types
 
#include <cyg/hal/hal_diag.h>
 
#include <cyg/hal/plf_misc.h>
 
//-----------------------------------------------------------------------------
// New Hal_Diag init to comply with the eCos/ROM Calling Interface.
 
#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT
 
#include <cyg/hal/hal_arch.h> // basic machine info
#include <cyg/hal/hal_intr.h> // interrupt macros
#include <cyg/hal/hal_io.h> // IO macros
#include <cyg/hal/drv_api.h>
#include <cyg/hal/hal_if.h> // interface API
#include <cyg/hal/hal_misc.h> // Helper functions
 
#include <cyg/hal/pcmb_serial.h>
 
//=============================================================================
 
#if defined(CYGSEM_HAL_VIRTUAL_VECTOR_DIAG) \
|| defined(CYGPRI_HAL_IMPLEMENTS_IF_SERVICES)
 
channel_data_t pc_ser_channels[CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS];
 
void
cyg_hal_plf_comms_init(void)
{
static int initialized = 0;
int num_serial;
 
if (initialized)
return;
 
initialized = 1;
 
num_serial = CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS;
#ifdef CYGSEM_HAL_I386_PC_DIAG_SCREEN
--num_serial;
#endif
if (num_serial > 0) {
// COM1
pc_ser_channels[0].base = 0x3F8;
pc_ser_channels[0].msec_timeout = 1000;
pc_ser_channels[0].isr_vector = 36;
}
if (num_serial > 1) {
// COM2
pc_ser_channels[1].base = 0x2F8;
pc_ser_channels[1].msec_timeout = 1000;
pc_ser_channels[1].isr_vector = 35;
}
 
cyg_hal_plf_serial_init();
 
#ifdef CYGSEM_HAL_I386_PC_DIAG_SCREEN
pc_ser_channels[num_serial].base = 0x060;
pc_ser_channels[num_serial].msec_timeout = 1000;
pc_ser_channels[num_serial].isr_vector = 33;
 
cyg_hal_plf_screen_init();
 
#endif
}
 
//=============================================================================
 
#endif //defined(CYGSEM_HAL_VIRTUAL_VECTOR_DIAG)
// || defined(CYGPRI_HAL_IMPLEMENTS_IF_SERVICES)
 
#endif
 
//=============================================================================
 
#ifndef CYGSEM_HAL_VIRTUAL_VECTOR_DIAG
 
// TODO: add stand-alone code
 
#endif // CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT
 
//-----------------------------------------------------------------------------
// End of hal_diag.c
 
/plf_misc.c
0,0 → 1,245
//==========================================================================
//
// 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 Red Hat, Inc.
//
// eCos is free software; you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation; either version 2 or (at your option) any later version.
//
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with eCos; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
//
// As a special exception, if other files instantiate templates or use macros
// or inline functions from this file, or you compile this file and link it
// with other works to produce a work based on this file, this file does not
// by itself cause the resulting work to be covered by the GNU General Public
// License. However the source code for this file must still be made available
// in accordance with section (3) of the GNU General Public License.
//
// This exception does not invalidate any other reasons why a work based on
// this file might be covered by the GNU General Public License.
//
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
// at http://sources.redhat.com/ecos/ecos-license/
// -------------------------------------------
//####ECOSGPLCOPYRIGHTEND####
//==========================================================================
//#####DESCRIPTIONBEGIN####
//
// Author(s): nickg
// Contributors: nickg, jlarmour, pjo
// Date: 1999-01-21
// 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/hal_arch.h> // architectural definitions
 
#include <cyg/hal/hal_intr.h> // Interrupt handling
 
#include <cyg/hal/hal_cache.h> // Cache handling
 
#include <cyg/hal/plf_misc.h>
 
#include <cyg/hal/hal_io.h>
 
#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT
#include <cyg/hal/hal_if.h>
#endif
 
#ifdef CYGPKG_KERNEL
#include <pkgconf/kernel.h>
#include <cyg/kernel/ktypes.h>
#include <cyg/kernel/kapi.h>
#endif /* CYGPKG_KERNEL */
 
/*------------------------------------------------------------------------*/
 
extern void patch_dbg_syscalls(void * vector);
 
extern void hal_pcmb_init(void);
 
#ifdef CYGPKG_HAL_SMP_SUPPORT
__externC void cyg_hal_smp_init(void);
#endif
 
//----------------------------------------------------------------------------
// ISR tables
 
volatile CYG_ADDRESS hal_interrupt_handlers[CYGNUM_HAL_ISR_COUNT];
volatile CYG_ADDRWORD hal_interrupt_data[CYGNUM_HAL_ISR_COUNT];
volatile CYG_ADDRESS hal_interrupt_objects[CYGNUM_HAL_ISR_COUNT];
 
//-----------------------------------------------------------------------------
// IDT interrupt gate initialization
 
externC void cyg_hal_pc_set_idt_entry(CYG_ADDRESS routine,short *idtEntry)
{
idtEntry[0]=routine & 0xFFFF;
idtEntry[1]=8;
idtEntry[2]=0x8E00;
idtEntry[3]=routine >> 16;
}
 
/*------------------------------------------------------------------------*/
 
void hal_platform_init(void)
{
int vector;
 
HAL_ICACHE_INVALIDATE_ALL();
HAL_ICACHE_ENABLE();
HAL_DCACHE_INVALIDATE_ALL();
HAL_DCACHE_ENABLE();
 
// Call motherboard init function
hal_pcmb_init();
// ISR table setup: plant the default ISR in all interrupt handlers
// and the default interrupt VSR in the equivalent VSR table slots.
for (vector = CYGNUM_HAL_ISR_MIN; vector <= CYGNUM_HAL_ISR_MAX; vector++)
{
cyg_uint32 index;
HAL_TRANSLATE_VECTOR( vector, index );
hal_interrupt_handlers[index] = (CYG_ADDRESS) HAL_DEFAULT_ISR;
HAL_VSR_SET( vector, &__default_interrupt_vsr, NULL );
}
#if !defined(CYG_HAL_STARTUP_RAM)
for (vector = CYGNUM_HAL_EXCEPTION_MIN;
vector <= CYGNUM_HAL_EXCEPTION_MAX;
vector++)
{
#if defined(CYGHWR_HAL_I386_FPU_SWITCH_LAZY)
// If we are doing lazy FPU switching, the FPU switch VSR has
// already been installed, so avoid overwriting it.
if( vector != CYGNUM_HAL_VECTOR_NO_DEVICE )
#endif
{
HAL_VSR_SET( vector, &__default_exception_vsr, NULL );
}
}
#endif
 
#ifdef CYGPKG_REDBOOT
 
// Start the timer device running if we are in a RedBoot
// configuration.
HAL_CLOCK_INITIALIZE( CYGNUM_HAL_RTC_PERIOD );
#endif
hal_if_init();
 
#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) || \
defined(CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT)
{
void hal_ctrlc_isr_init(void);
hal_ctrlc_isr_init();
}
 
#endif
#ifdef CYGPKG_HAL_SMP_SUPPORT
 
cyg_hal_smp_init();
#endif
}
 
/*------------------------------------------------------------------------*/
 
void hal_pc_reset(void)
{
/* Use Intel's IDT triple-fault trick. */
asm("movl $badIdt, %eax\n"
"lidt (%eax)\n"
"int $3\n"
"hlt\n"
 
".align 4\n"
 
"badIdt:\n"
".word 0\n"
".long 0\n"
) ;
}
 
/*------------------------------------------------------------------------*/
 
void
hal_delay_us(int us)
{
while( us > 0 )
{
cyg_uint32 us1 = us;
cyg_int32 ticks;
cyg_uint32 cval1, cval2;
 
// Wait in bursts of 1s to avoid overflow problems with the
// multiply by 1000 below.
if( us1 > 1000000 )
us1 = 1000000;
 
us -= us1;
// The PC clock ticks at 838ns per tick. So we convert the us
// value we were given to clock ticks and wait for that many
// to pass.
 
ticks = (us1 * 1000UL) / 838UL;
 
HAL_CLOCK_READ( &cval1 );
 
// We just loop, waiting for clock ticks to happen,
// and subtracting them from ticks when they do.
while( ticks > 0 )
{
cyg_int32 diff;
HAL_CLOCK_READ( &cval2 );
 
diff = cval2 - cval1;
 
// Cope with counter wrap-around.
if( diff < 0 )
diff += CYGNUM_HAL_RTC_PERIOD;
 
ticks -= diff;
cval1 = cval2;
 
}
}
}
 
 
/*------------------------------------------------------------------------*/
/* End of plf_misc.c */
/PKGconf.mak
0,0 → 1,56
#==============================================================================
#
# makefile
#
# hal/i386/pc/src
#
#==============================================================================
#####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####
#==============================================================================
 
 
PACKAGE := hal_i386_pc
include ../../../../../pkgconf/pkgconf.mak
 
LIBRARY := libtarget.a
COMPILE := hal_diag.c hal_startup.c var_misc.c plf_misc.c plf_stub.c
OTHER_OBJS :=
OTHER_TARGETS :=
OTHER_CLEAN :=
 
OTHER_TARGETS :=
OTHER_CLEAN :=
OTHER_DEPS :=
 
include $(COMPONENT_REPOSITORY)/pkgconf/makrules.src

powered by: WebSVN 2.1.0

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