summaryrefslogtreecommitdiff
path: root/cesar/ecos/packages/hal/common/current/include
diff options
context:
space:
mode:
Diffstat (limited to 'cesar/ecos/packages/hal/common/current/include')
-rw-r--r--cesar/ecos/packages/hal/common/current/include/dbg-thread-syscall.h111
-rw-r--r--cesar/ecos/packages/hal/common/current/include/dbg-threads-api.h161
-rw-r--r--cesar/ecos/packages/hal/common/current/include/drv_api.h251
-rw-r--r--cesar/ecos/packages/hal/common/current/include/generic-stub.h366
-rw-r--r--cesar/ecos/packages/hal/common/current/include/hal_arbiter.h140
-rw-r--r--cesar/ecos/packages/hal/common/current/include/hal_endian.h110
-rw-r--r--cesar/ecos/packages/hal/common/current/include/hal_if.h739
-rw-r--r--cesar/ecos/packages/hal/common/current/include/hal_misc.h123
-rw-r--r--cesar/ecos/packages/hal/common/current/include/hal_spd.h78
-rw-r--r--cesar/ecos/packages/hal/common/current/include/hal_stub.h390
-rw-r--r--cesar/ecos/packages/hal/common/current/include/hal_tables.h117
11 files changed, 2586 insertions, 0 deletions
diff --git a/cesar/ecos/packages/hal/common/current/include/dbg-thread-syscall.h b/cesar/ecos/packages/hal/common/current/include/dbg-thread-syscall.h
new file mode 100644
index 0000000000..9e93e05105
--- /dev/null
+++ b/cesar/ecos/packages/hal/common/current/include/dbg-thread-syscall.h
@@ -0,0 +1,111 @@
+//========================================================================
+//
+// dbg-thread-syscall.h
+//
+// Supports thread-aware debugging
+//
+//========================================================================
+//####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): Red Hat, nickg
+// Contributors: Red Hat, nickg
+// Date: 1998-08-25
+// Purpose:
+// Description: Supports thread-aware debugging
+// Usage: This header is not to be included by user code.
+// This file should be included only by
+// thread-syscall-relay.c and dbg-thread-demux.c
+//
+//####DESCRIPTIONEND####
+//
+//========================================================================
+
+
+enum dbg_syscall_ids
+ {
+ dbg_null_func ,
+ dbg_capabilities_func,
+ dbg_currthread_func,
+ dbg_threadlist_func,
+ dbg_threadinfo_func,
+ dbg_getthreadreg_func,
+ dbg_setthreadreg_func,
+ dbg_scheduler_func,
+ } ;
+
+
+union dbg_thread_syscall_parms
+{
+ struct
+ {
+ struct dbg_capabilities * abilities ;
+ } cap_parms ;
+
+ struct
+ {
+ threadref * ref ;
+ } currthread_parms ;
+
+ struct
+ {
+ int startflag ;
+ threadref * lastid ;
+ threadref * nextthreadid ;
+ } threadlist_parms ;
+
+ struct
+ {
+ threadref * ref ;
+ struct cygmon_thread_debug_info * info ;
+ } info_parms ;
+
+ struct
+ {
+ threadref * thread ;
+ int regcount ;
+ void * registers ;
+ } reg_parms ;
+ struct
+ {
+ threadref * thread ; /* 64-bit thread identifier */
+ int lock; /* 0 == unlock, 1 == lock */
+ int mode; /* 0 == short (step), 1 == continue */
+ } scheduler_parms ;
+} ;
+
+
+typedef int (*dbg_syscall_func) (enum dbg_syscall_ids id,
+ union dbg_thread_syscall_parms * p ) ;
diff --git a/cesar/ecos/packages/hal/common/current/include/dbg-threads-api.h b/cesar/ecos/packages/hal/common/current/include/dbg-threads-api.h
new file mode 100644
index 0000000000..94fffeb790
--- /dev/null
+++ b/cesar/ecos/packages/hal/common/current/include/dbg-threads-api.h
@@ -0,0 +1,161 @@
+//========================================================================
+//
+// dbg-threads-api.h
+//
+// Supports thread-aware debugging
+//
+//========================================================================
+//####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): Red Hat, nickg
+// Contributors: Red Hat, nickg
+// Date: 1998-08-25
+// Purpose:
+// Description: These are the calls used to extract operating system
+// specific information used in supporting thread aware
+// debugging. The Operating Environment being debugged
+// needs to supply these functions.
+// Usage: This header is not to be included by user code.
+//
+//####DESCRIPTIONEND####
+//
+//========================================================================
+
+#if !defined(DBG_THREADS_API_INCLUDED)
+#define DBG_THREADS_API_INCLUDED 1
+
+#include <cyg/infra/cyg_type.h> /* externC */
+
+#define has_thread_void 0
+#define has_thread_current 1
+#define has_thread_registers 2
+#define has_thread_reg_change 4
+#define has_thread_list 8
+#define has_thread_info 16
+
+typedef unsigned char threadref[8] ;
+
+struct dbg_capabilities
+{
+ unsigned long mask1 ;
+} ;
+
+
+/* fill in the list of thread aware capabilities */
+externC int dbg_thread_capabilities(struct dbg_capabilities * cbp) ;
+
+
+/* Fillin the identifier of the current thread */
+/* return 1 if defined, 0 if not defined */
+externC int dbg_currthread(threadref * varparm) ;
+
+/* Return the unique ID number of a given thread. */
+/* Return 0 if not valid. */
+externC int dbg_thread_id(threadref *threadid);
+
+/* Return the unique ID number of the current thread. */
+externC int dbg_currthread_id(void);
+
+/* get the first or next member of the list of known threads */
+externC int dbg_threadlist(int startflag,
+ threadref * lastthreadid,
+ threadref * next_thread
+ ) ;
+
+/* return 1 if next_threadid has been filled in with a value */
+/* return 0 if there are none or no more */
+
+/* The O.S can fill in the following information about a thread when queried.
+ The structure of thise strings is determined by the O.S.
+ It is display oriented, so figure out what the users need to see.
+ Nulls are OK but GDB will fill some not so meaningful data.
+ These pointers may be in the calles private structures, the info will
+ get copied immediatly after the call to retreive it.
+ */
+struct cygmon_thread_debug_info
+{
+ threadref thread_id ;
+ int context_exists ; /* To the point where examining its state,
+ registers and stack makes sense to GDB */
+ char * thread_display ; /* As shown in thread status window, name, state */
+ char * unique_thread_name ; /* human readable identifier, window label */
+ char * more_display ; /* more detailed info about thread.
+ priority, queuedepth, state, stack usage, statistics */
+} ;
+
+
+
+
+externC int dbg_threadinfo(
+ threadref * threadid,
+ struct cygmon_thread_debug_info * info) ;
+
+/* Return 1 if threadid is defined and info copied, 0 otherwise */
+
+/* The O.S should fillin the array of registers using values from the
+saves context. The array MUST be in GDB register save order even if
+the saved context is different or smaller. Do not alter the values of
+registers which are NOT in the O.S. thread context. Their default values
+have already been assigned.
+*/
+
+externC int dbg_getthreadreg(
+ threadref * osthreadid,
+ int regcount, /* count of registers in the array */
+ void * regval) ; /* fillin this array */
+
+
+/* The O.S. should scan through this list of registers which are in
+GDB order and the O.S. should replace the values of all registers
+which are defined in the saved context of thread or process identified
+by osthreadid. Return 0 if the threadis does not map to a known
+process or other error. Return 1 if the setting is successful. */
+
+externC int dbg_setthreadreg(
+ threadref * osthreadid,
+ int regcount , /* number of registers */
+ void * regval) ;
+
+/* Control over OS scheduler. With the scheduler locked it should not
+ perform any rescheduling in response to interrupts. */
+externC int dbg_scheduler(
+ threadref * osthreadid,
+ int lock, /* 0 == unlock, 1 == lock */
+ int mode); /* 0 == step, 1 == continue */
+
+
+
+#endif /* DBG_THREADS_API_INCLUDED */
diff --git a/cesar/ecos/packages/hal/common/current/include/drv_api.h b/cesar/ecos/packages/hal/common/current/include/drv_api.h
new file mode 100644
index 0000000000..75a55470cc
--- /dev/null
+++ b/cesar/ecos/packages/hal/common/current/include/drv_api.h
@@ -0,0 +1,251 @@
+#ifndef CYGONCE_HAL_DRV_API_H
+#define CYGONCE_HAL_DRV_API_H
+
+/*==========================================================================
+//
+// drv_api.h
+//
+// Native API for Kernel
+//
+//==========================================================================
+//####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
+// Date: 1999-02-24
+// Purpose: Driver API
+// Description: This file defines the API used by device drivers to access
+// system services. When the kernel is present it maps directly
+// to the Kernel C API. When the kernel is absent, it is provided
+// by a set of HAL functions.
+//
+// Usage: #include <cyg/kernel/kapi.h>
+//
+//####DESCRIPTIONEND####
+//
+//========================================================================*/
+
+#include <pkgconf/hal.h>
+#include <cyg/infra/cyg_type.h>
+
+#ifdef CYGPKG_KERNEL
+
+/*------------------------------------------------------------------------*/
+/* Kernel co-resident version of API */
+
+#include <pkgconf/kernel.h>
+
+#ifndef CYGFUN_KERNEL_API_C
+#error Driver API requres Kernel API to be present
+#endif
+
+#include <cyg/kernel/kapi.h>
+
+#define cyg_drv_isr_lock cyg_interrupt_disable
+#define cyg_drv_isr_unlock cyg_interrupt_enable
+
+#define cyg_drv_dsr_lock cyg_scheduler_lock
+#define cyg_drv_dsr_unlock cyg_scheduler_unlock
+
+#define cyg_drv_mutex_t cyg_mutex_t
+#define cyg_drv_mutex_init cyg_mutex_init
+#define cyg_drv_mutex_destroy cyg_mutex_destroy
+#define cyg_drv_mutex_lock cyg_mutex_lock
+#define cyg_drv_mutex_trylock cyg_mutex_trylock
+#define cyg_drv_mutex_unlock cyg_mutex_unlock
+#define cyg_drv_mutex_release cyg_mutex_release
+
+#define cyg_drv_cond_t cyg_cond_t
+#define cyg_drv_cond_init cyg_cond_init
+#define cyg_drv_cond_destroy cyg_cond_destroy
+#define cyg_drv_cond_wait cyg_cond_wait
+#define cyg_drv_cond_signal cyg_cond_signal
+#define cyg_drv_cond_broadcast cyg_cond_broadcast
+
+#define cyg_drv_interrupt_create cyg_interrupt_create
+#define cyg_drv_interrupt_delete cyg_interrupt_delete
+#define cyg_drv_interrupt_attach cyg_interrupt_attach
+#define cyg_drv_interrupt_detach cyg_interrupt_detach
+#define cyg_drv_interrupt_mask cyg_interrupt_mask
+#define cyg_drv_interrupt_unmask cyg_interrupt_unmask
+#define cyg_drv_interrupt_mask_intunsafe cyg_interrupt_mask_intunsafe
+#define cyg_drv_interrupt_unmask_intunsafe cyg_interrupt_unmask_intunsafe
+#define cyg_drv_interrupt_acknowledge cyg_interrupt_acknowledge
+#define cyg_drv_interrupt_configure cyg_interrupt_configure
+#define cyg_drv_interrupt_level cyg_interrupt_level
+#define cyg_drv_interrupt_set_cpu cyg_interrupt_set_cpu
+#define cyg_drv_interrupt_get_cpu cyg_interrupt_get_cpu
+
+#define cyg_drv_spinlock_t cyg_spinlock_t
+#define cyg_drv_spinlock_init cyg_spinlock_init
+#define cyg_drv_spinlock_spin cyg_spinlock_spin
+#define cyg_drv_spinlock_clear cyg_spinlock_clear
+#define cyg_drv_spinlock_try cyg_spinlock_try
+#define cyg_drv_spinlock_test cyg_spinlock_test
+#define cyg_drv_spinlock_spin_intsave cyg_spinlock_spin_intsave
+#define cyg_drv_spinlock_clear_intsave cyg_spinlock_clear_intsave
+
+#else /* CYGPKG_KERNEL */
+
+/*------------------------------------------------------------------------*/
+/* Non-kernel version of API */
+
+typedef CYG_ADDRWORD cyg_addrword_t; /* May hold pointer or word */
+typedef cyg_addrword_t cyg_handle_t; /* Object handle */
+typedef cyg_uint32 cyg_priority_t; /* type for priorities */
+typedef cyg_uint32 cyg_vector_t; /* Interrupt vector id */
+typedef cyg_uint32 cyg_cpu_t; /* CPU id */
+typedef int cyg_bool_t;
+typedef cyg_int32 cyg_code_t; /* type for various codes */
+
+typedef cyg_uint32 cyg_ISR_t( cyg_vector_t vector, cyg_addrword_t data);
+typedef void cyg_DSR_t(cyg_vector_t vector,
+ cyg_ucount32 count,
+ cyg_addrword_t data);
+
+
+externC void cyg_drv_isr_lock(void);
+externC void cyg_drv_isr_unlock(void);
+
+externC void cyg_drv_dsr_lock(void);
+externC void cyg_drv_dsr_unlock(void);
+
+typedef struct
+{
+ cyg_atomic lock;
+} cyg_drv_mutex_t;
+
+externC void cyg_drv_mutex_init( cyg_drv_mutex_t *mutex );
+externC void cyg_drv_mutex_destroy( cyg_drv_mutex_t *mutex );
+externC cyg_bool_t cyg_drv_mutex_lock( cyg_drv_mutex_t *mutex );
+externC cyg_bool_t cyg_drv_mutex_trylock( cyg_drv_mutex_t *mutex );
+externC void cyg_drv_mutex_unlock( cyg_drv_mutex_t *mutex );
+externC void cyg_drv_mutex_release( cyg_drv_mutex_t *mutex );
+
+typedef struct
+{
+ cyg_atomic wait;
+ cyg_drv_mutex_t *mutex;
+} cyg_drv_cond_t;
+
+externC void cyg_drv_cond_init( cyg_drv_cond_t *cond, cyg_drv_mutex_t *mutex );
+externC void cyg_drv_cond_destroy( cyg_drv_cond_t *cond );
+externC cyg_bool_t cyg_drv_cond_wait( cyg_drv_cond_t *cond );
+externC void cyg_drv_cond_signal( cyg_drv_cond_t *cond );
+externC void cyg_drv_cond_broadcast( cyg_drv_cond_t *cond );
+
+typedef struct cyg_interrupt
+{
+ cyg_vector_t vector;
+ cyg_priority_t priority;
+ cyg_ISR_t *isr;
+ cyg_DSR_t *dsr;
+ CYG_ADDRWORD data;
+
+ struct cyg_interrupt* volatile next_dsr;
+ volatile cyg_int32 dsr_count;
+
+#ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN
+ struct cyg_interrupt *next;
+#endif
+
+} cyg_interrupt;
+
+externC void cyg_drv_interrupt_create(
+ cyg_vector_t vector,
+ cyg_priority_t priority,
+ cyg_addrword_t data,
+ cyg_ISR_t *isr,
+ cyg_DSR_t *dsr,
+ cyg_handle_t *handle,
+ cyg_interrupt *intr
+ );
+externC void cyg_drv_interrupt_delete( cyg_handle_t interrupt );
+externC void cyg_drv_interrupt_attach( cyg_handle_t interrupt );
+externC void cyg_drv_interrupt_detach( cyg_handle_t interrupt );
+
+externC void cyg_drv_interrupt_mask( cyg_vector_t vector );
+externC void cyg_drv_interrupt_mask_intunsafe( cyg_vector_t vector );
+externC void cyg_drv_interrupt_unmask( cyg_vector_t vector );
+externC void cyg_drv_interrupt_unmask_intunsafe( cyg_vector_t vector );
+externC void cyg_drv_interrupt_acknowledge( cyg_vector_t vector );
+externC void cyg_drv_interrupt_configure(
+ cyg_vector_t vector,
+ cyg_bool_t level,
+ cyg_bool_t up
+ );
+externC void cyg_drv_interrupt_level( cyg_vector_t vector, cyg_priority_t level );
+externC void cyg_drv_interrupt_set_cpu( cyg_vector_t vector, cyg_cpu_t cpu );
+externC cyg_cpu_t cyg_drv_interrupt_get_cpu( cyg_vector_t vector );
+
+
+enum cyg_ISR_results
+{
+ CYG_ISR_HANDLED = 1, /* Interrupt was handled */
+ CYG_ISR_CALL_DSR = 2 /* Schedule DSR */
+};
+
+
+typedef struct
+{
+ cyg_atomic lock;
+} cyg_drv_spinlock_t;
+
+void cyg_drv_spinlock_init(
+ cyg_drv_spinlock_t *lock, /* spinlock to initialize */
+ cyg_bool_t locked /* init locked or unlocked */
+);
+
+void cyg_drv_spinlock_destroy( cyg_drv_spinlock_t *lock );
+
+void cyg_drv_spinlock_spin( cyg_drv_spinlock_t *lock );
+
+void cyg_drv_spinlock_clear( cyg_drv_spinlock_t *lock );
+
+cyg_bool_t cyg_drv_spinlock_try( cyg_drv_spinlock_t *lock );
+
+cyg_bool_t cyg_drv_spinlock_test( cyg_drv_spinlock_t *lock );
+
+void cyg_drv_spinlock_spin_intsave( cyg_drv_spinlock_t *lock,
+ cyg_addrword_t *istate );
+
+void cyg_drv_spinlock_clear_intsave( cyg_drv_spinlock_t *lock,
+ cyg_addrword_t istate );
+
+#endif /* CYGPKG_KERNEL */
+
+/*------------------------------------------------------------------------*/
+/* EOF drv_api.h */
+#endif // CYGONCE_HAL_DRV_API_H
diff --git a/cesar/ecos/packages/hal/common/current/include/generic-stub.h b/cesar/ecos/packages/hal/common/current/include/generic-stub.h
new file mode 100644
index 0000000000..d90b0af559
--- /dev/null
+++ b/cesar/ecos/packages/hal/common/current/include/generic-stub.h
@@ -0,0 +1,366 @@
+//========================================================================
+//
+// generic-stub.h
+//
+// Definitions for the generic GDB remote stub
+//
+//========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2003 Gary Thomas
+//
+// 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): Red Hat, nickg
+// Contributors: Red Hat, nickg, dmoseley
+// Date: 1998-06-08
+// Purpose:
+// Description: Definitions for the generic GDB remote stub
+// Usage: This header is not to be included by user code, and is
+// only placed in a publically accessible directory so
+// that platform stub packages are able to include it
+// if required.
+//
+//####DESCRIPTIONEND####
+//
+//========================================================================
+
+
+#ifndef GENERIC_STUB_H
+#define GENERIC_STUB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Three typedefs must be provided before including this file.
+ target_register_t should correspond to the largest register value on
+ this target processor.
+ regnames_t corresponds to a type representing a register number.
+ uint32 must correspond to at least a 32-bit unsigned integer type
+ (it may be larger). */
+
+#ifndef ASM
+
+#ifndef __ECOS__
+#include "dbg-serial.h"
+#endif // __ECOS__
+
+struct gdb_packet
+{
+ /* The checksum calculated so far. */
+ uint32 checksum;
+ /* The checksum we've received from the remote side. */
+ uint32 xmitcsum;
+ /* Contents of the accumulated packet. */
+ char *contents;
+ /* Number of characters received. */
+ uint32 length;
+ /*
+ * state is the current state:
+ * 0 = looking for start of packet
+ * 1 = got start of packet, looking for # terminator
+ * 2 = looking for first byte of checksum
+ * 3 = looking for second byte of checksum (indicating end of packet)
+ */
+ char state;
+ char err; // This is set if the packet should be tossed because of overflow
+};
+
+/* Return the currently-saved value corresponding to register REG. */
+extern target_register_t get_register (regnames_t reg);
+
+/* Write the contents of register WHICH into VALUE as raw bytes */
+extern int get_register_as_bytes (regnames_t which, char *value);
+
+#ifdef CYGHWR_REGISTER_VALIDITY_CHECKING
+// Return the validity of register REG.
+extern int get_register_valid (regnames_t reg);
+#endif
+
+/* Store VALUE in the register corresponding to WHICH. */
+extern void put_register (regnames_t which, target_register_t value);
+
+extern int put_register_as_bytes (regnames_t which, char *value);
+
+/* Set the next instruction to be executed when the user program resumes
+ execution to PC. */
+#if !defined(SET_PC_PROTOTYPE_EXISTS) && !defined(set_pc)
+#define SET_PC_PROTOTYPE_EXISTS
+extern void set_pc (target_register_t pc);
+#endif
+
+/* Set the return value of the currently-pending syscall to VALUE. */
+extern void set_syscall_value (target_register_t value);
+
+/* Return the Nth argument to the currently-pending syscall (starting from
+ 0). */
+extern target_register_t get_syscall_arg (int n);
+
+/* Initialize the stub. This will also install any trap handlers needed by
+ the stub. */
+extern void initialize_stub (void);
+
+/* Initialize the hardware. */
+extern void initHardware (void);
+
+/* Skip the current instruction. */
+extern void __skipinst (void);
+
+/* If the address in the PC register corresponds to the breakpoint()
+ instruction, return a non-zero value. */
+#ifndef __is_breakpoint_function
+extern int __is_breakpoint_function (void);
+#endif
+
+/* Execute a breakpoint instruction. Restarting will cause the instruction
+ to be skipped. */
+#ifndef breakpoint
+extern void breakpoint (void);
+#endif
+
+/* Return the syscall # corresponding to this system call. */
+extern int __get_syscall_num (void);
+
+/* Transfer exception event processing to the stub. */
+extern void __switch_to_stub (void);
+
+/* Send an exit packet containing the specified status. */
+extern void __send_exit_status (int status);
+
+/* Copy COUNT bytes of memory from ADDR to BUF.
+ ADDR is assumed to live in the user program's space.
+ Returns number of bytes successfully read
+ (caller must check to see if less than requested). */
+extern int __read_mem_safe (void *buf,
+ void *addr,
+ int count);
+
+extern int __read_progmem_safe (void *buf,
+ void *addr,
+ int count);
+
+/* Copy COUNT bytes of memory from BUF to ADDR.
+ ADDR is assumed to live in the user program's space.
+ Returns number of bytes successfully read
+ (caller must check to see if less than requested). */
+#ifndef __write_mem_safe
+extern int __write_mem_safe (void *buf,
+ void *addr,
+ int count);
+#endif
+
+extern int __write_progmem_safe (void *buf,
+ void *addr,
+ int count);
+
+/* Set to a non-zero value if a memory fault occurs while
+ __set_mem_fault_trap () is running. */
+extern volatile int __mem_fault;
+
+#ifndef __ECOS__
+#if 1
+#include "stub-tservice.h" /* target dependent stub services */
+#else
+/* Flush the instruction cache. */
+extern void flush_i_cache (void);
+
+/* Flush the data cache. */
+extern void __flush_d_cache (void);
+
+typedef enum {
+ CACHE_NOOP, CACHE_ENABLE, CACHE_DISABLE, CACHE_FLUSH
+} cache_control_t;
+
+/* Perform the specified operation on the instruction cache.
+ Returns 1 if the cache is enabled, 0 otherwise. */
+extern int __instruction_cache (cache_control_t request);
+/* Perform the specified operation on the data cache.
+ Returns 1 if the cache is enabled, 0 otherwise. */
+extern int __data_cache (cache_control_t request);
+#endif
+#endif // __ECOS__
+
+/* Write the 'T' packet in BUFFER. SIGVAL is the signal the program
+ received. */
+extern void __build_t_packet (int sigval, char *buffer);
+
+/* Return 1 when a complete packet has been received, 0 if the packet
+ is not yet complete, or -1 if an erroneous packet was NAKed. */
+int __add_char_to_packet (unsigned character, struct gdb_packet *packet);
+
+typedef int (*__PFI)(int);
+typedef void (*__PFV)(void);
+
+/* When an exception occurs, __process_exception_vec will be invoked with
+ the signal number corresponding to the trap/exception. The function
+ should return zero if it wishes execution to resume from the saved
+ register values; a non-zero value indicates that the exception handler
+ should be reinvoked. */
+#if !defined(PROCESS_EXCEPTION_VEC_PROTOTYPE_EXISTS)
+#define PROCESS_EXCEPTION_VEC_PROTOTYPE_EXISTS
+extern volatile __PFI __process_exception_vec;
+#endif
+
+/* __process_exit_vec is invoked when a 'k' kill packet is received
+ from GDB. */
+extern volatile __PFV __process_exit_vec;
+
+/* If SIGSYSCALL is defined, and such a signal value is returned from
+ __computeSignal (), the function pointed to by this vector will
+ be invoked.
+
+ If the return value is negative, the user program is assumed to
+ have received the corresponding positive signal value, and an
+ exception will be processed. Otherwise, the user program is
+ restarted from the next instruction. */
+extern volatile __PFI __process_syscall_vec;
+
+/* A continue packet was received from GDB with a signal value. The function
+ pointed to by __process_signal_vec will be invoked with this signal
+ value.
+
+ If a zero value is returned, we will ignore the signal, and proceed
+ with the continue request. Otherwise, the program will be killed
+ with the signal. */
+extern volatile __PFI __process_signal_vec;
+
+/* If non-NULL, __init_vec is called right before the user program is
+ resumed. */
+extern volatile __PFV __init_vec;
+/* if non-NULL, __cleanup_vec is called after the user program takes
+ an exception. */
+extern volatile __PFV __cleanup_vec;
+
+/* Send an 'O' packet to GDB containing STR. */
+extern int __output_gdb_string (target_register_t addr, int string_len);
+
+/* Request MAXLEN bytes of input from GDB to be stored in DEST. If BLOCK
+ is set, GDB should block until MAXLEN bytes are available to be
+ read; otherwise, it will return immediately with whatever data is
+ available.
+ The return value is the number of bytes written into DEST. */
+extern int __get_gdb_input (target_register_t dest, int maxlen, int block);
+
+/* Return the ASCII equivalent of C (C>=0 && C<=15). The result will be
+ lower-case. */
+extern char __tohex (int c);
+
+/* Convert COUNT bytes of the memory region in MEM to a hexadecimal
+ string in DEST.
+ The resulting string will contain 2*COUNT characters.
+ If MAY_FAULT is non-zero, memory faults are trapped; if a fault occurs,
+ a NULL value will be returned.
+ The value returned is one byte past the end of the string written. */
+extern char *__mem2hex (char *mem, char *dest, int count, int may_fault);
+
+/* Given a hexadecimal string in MEM, write the equivalent bytes to DEST.
+ The string is assumed to contain 2*COUNT characters.
+ If MAY_FAULT is non-zero, memory faults are trapped; if a fault occurs,
+ a NULL value will be returned.
+ Otherwise, the value returned is one byte past the last byte written. */
+extern char *__hex2mem (char *buf, char *mem, int count, int may_fault);
+
+#ifdef CYGSEM_ECOS_SUPPORTS_PROGRAM_ARGS
+/* Set the program arguments passed into the user program's main */
+extern void __set_program_args (int argc, char **argv);
+
+/* Return the user program arguments passed in from GDB (via an 'A'
+ packet). argcPtr is a pointer into the user program, which will hold
+ the number of arguments; the strings are returned. */
+extern char **__get_program_args (target_register_t argcPtr);
+#endif
+
+/* Encode PACKET as a remote protocol packet and send it to GDB; this takes
+ care of sending the initial '$' character, as well as the trailing '#'
+ and checksum, and also waits for an ACK from the remote side, resending
+ as necessary. */
+extern void __putpacket (char *packet);
+
+/* Retrieve the next remote protocol packet from GDB, taking care of verifying
+ the checksum and sending an ACK when necessary. */
+extern void __getpacket (char *buffer);
+
+/* Convert the hexadecimal string pointed to by *PTR into an integer,
+ and store it in the value pointed to by INTVALUE. The number of
+ characters read from *PTR will be returned; *PTR will point to the first
+ non-hexadecmial character encountered. */
+extern unsigned int __hexToInt (char **ptr, target_register_t *intValue);
+
+/* Convert the value in INTVALUE into a string of hexadecimal
+ characters stored in PTR. NUMBITS are the number of bits to use
+ in INTVALUE. The number of characters written to PTR will be returned. */
+extern unsigned int __intToHex (char *ptr,
+ target_register_t intValue,
+ int numBits);
+
+/* Handle an exception, usually some sort of hardware or software trap.
+ This is responsible for communicating the exception to GDB. */
+extern void __handle_exception (void);
+
+/* Send a 'X' packet with signal SIGVAL to GDB. */
+extern void __kill_program (int sigval);
+
+/* Given a packet pointed to by PACKETCONTENTS, decode it and respond to
+ GDB appropriately. */
+extern int __process_packet (char *packetContents);
+
+/* Write the C-style string pointed to by STR to the GDB comm port.
+ Used for printing debug messages. */
+extern void __putDebugStr (char *str);
+
+#if defined(NO_MALLOC) && !defined(MAX_BP_NUM)
+#define MAX_BP_NUM 64 /* Maximum allowed # of breakpoints */
+#endif
+
+extern int hal_syscall_handler(void);
+extern int __is_bsp_syscall(void);
+
+extern void __install_breakpoint_list (void);
+extern void __clear_breakpoint_list (void);
+extern int __display_breakpoint_list (void (*print_func)(target_register_t));
+
+/* 'Z' packet types */
+#define ZTYPE_SW_BREAKPOINT 0
+#define ZTYPE_HW_BREAKPOINT 1
+#define ZTYPE_HW_WATCHPOINT_WRITE 2
+#define ZTYPE_HW_WATCHPOINT_READ 3
+#define ZTYPE_HW_WATCHPOINT_ACCESS 4
+
+#endif /* ASM */
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* GENERIC_STUB_H */
diff --git a/cesar/ecos/packages/hal/common/current/include/hal_arbiter.h b/cesar/ecos/packages/hal/common/current/include/hal_arbiter.h
new file mode 100644
index 0000000000..650a6a6238
--- /dev/null
+++ b/cesar/ecos/packages/hal/common/current/include/hal_arbiter.h
@@ -0,0 +1,140 @@
+#ifndef CYGONCE_HAL_HAL_ARBITER_H
+#define CYGONCE_HAL_HAL_ARBITER_H
+
+//=============================================================================
+//
+// hal_arbiter.h
+//
+// Functionality used by ISR arbiters
+//
+//=============================================================================
+//####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: 2001-06-29
+// Purpose: Functionality used by ISR arbiters
+// Usage: #include <cyg/hal/hal_arbiter.h>
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+#include <cyg/hal/hal_intr.h> // hal_interrupt_x tables
+#include <cyg/hal/drv_api.h> // CYG_ISR_HANDLED
+
+//=============================================================================
+// Function used to call ISRs from ISR arbiters
+// An arbiter is hooked on the shared interrupt vector and looks like this:
+//
+// cyg_uint32 _arbitration_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data)
+// {
+// cyg_uint32 isr_ret;
+// // decode interrupt source and for each active source call the ISR
+// if (source_A_active) {
+// isr_ret = hal_call_isr (CYGNUM_HAL_INTERRUPT_SOURCE_A);
+// #ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN
+// if (isr_ret & CYG_ISR_HANDLED)
+// #endif
+// return isr_ret;
+// }
+// if (source_B_active) {
+// isr_ret = hal_call_isr (CYGNUM_HAL_INTERRUPT_SOURCE_B);
+// #ifdef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN
+// if (isr_ret & CYG_ISR_HANDLED)
+// #endif
+// return isr_ret;
+// }
+// ...
+// return 0;
+// }
+//
+// Remember to attach and enable the arbiter source:
+// HAL_INTERRUPT_ATTACH(CYGNUM_HAL_INTERRUPT_ARBITER, &_arbitration_isr, 0, 0);
+// HAL_INTERRUPT_SET_LEVEL(CYGNUM_HAL_INTERRUPT_ARBITER, 1);
+// HAL_INTERRUPT_UNMASK(CYGNUM_HAL_INTERRUPT_ARBITER);
+//
+
+typedef cyg_uint32 cyg_ISR(cyg_uint32 vector, CYG_ADDRWORD data);
+
+extern void cyg_interrupt_post_dsr( CYG_ADDRWORD intr_obj );
+
+#ifndef CYGIMP_HAL_COMMON_INTERRUPTS_CHAIN
+
+static inline cyg_uint32
+hal_call_isr (cyg_uint32 vector)
+{
+ cyg_ISR *isr;
+ CYG_ADDRWORD data;
+ cyg_uint32 isr_ret;
+
+ isr = (cyg_ISR*) hal_interrupt_handlers[vector];
+ data = hal_interrupt_data[vector];
+
+ isr_ret = (*isr) (vector, data);
+
+ if (isr_ret & CYG_ISR_CALL_DSR) {
+ cyg_interrupt_post_dsr (hal_interrupt_objects[vector]);
+ }
+
+ return isr_ret & ~CYG_ISR_CALL_DSR;
+}
+
+#else
+
+// In chained mode, assume vector 0 points to the chain
+// handler. Simply call it with the vector number and let it find the
+// ISR to call - it will also post DSRs as required.
+static inline cyg_uint32
+hal_call_isr (cyg_uint32 vector)
+{
+ cyg_ISR *isr;
+ CYG_ADDRWORD data;
+ cyg_uint32 isr_ret;
+
+ isr = (cyg_ISR*) hal_interrupt_handlers[0];
+ data = hal_interrupt_data[0];
+
+ isr_ret = (*isr) (vector, data);
+
+ return isr_ret;
+}
+
+#endif
+
+//-----------------------------------------------------------------------------
+#endif // CYGONCE_HAL_HAL_ARBITER_H
+// End of hal_arbiter.h
diff --git a/cesar/ecos/packages/hal/common/current/include/hal_endian.h b/cesar/ecos/packages/hal/common/current/include/hal_endian.h
new file mode 100644
index 0000000000..4b550cfc84
--- /dev/null
+++ b/cesar/ecos/packages/hal/common/current/include/hal_endian.h
@@ -0,0 +1,110 @@
+#ifndef CYGONCE_HAL_HAL_ENDIAN_H
+#define CYGONCE_HAL_HAL_ENDIAN_H
+
+//=============================================================================
+//
+// hal_endian.h
+//
+// Endian conversion macros
+//
+//=============================================================================
+//####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: 2001-10-04
+// Purpose: Endian conversion macros
+// Usage: #include <cyg/hal/hal_endian.h>
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+#include <pkgconf/hal.h> // CYGBLD_HAL_ENDIAN_H
+#include <cyg/infra/cyg_type.h> // endian setting
+
+// Allow HALs to override the generic implementation of swap macros
+#ifdef CYGBLD_HAL_ENDIAN_H
+# include CYGBLD_HAL_ENDIAN_H
+#endif
+
+#ifndef CYG_SWAP16
+# define CYG_SWAP16(_x_) \
+ ({ cyg_uint16 _x = (_x_); ((_x << 8) | (_x >> 8)); })
+#endif
+
+#ifndef CYG_SWAP32
+# define CYG_SWAP32(_x_) \
+ ({ cyg_uint32 _x = (_x_); \
+ ((_x << 24) | \
+ ((0x0000FF00UL & _x) << 8) | \
+ ((0x00FF0000UL & _x) >> 8) | \
+ (_x >> 24)); })
+#endif
+
+
+#if (CYG_BYTEORDER == CYG_LSBFIRST)
+# define CYG_CPU_TO_BE16(_x_) CYG_SWAP16((_x_))
+# define CYG_CPU_TO_BE32(_x_) CYG_SWAP32((_x_))
+# define CYG_BE16_TO_CPU(_x_) CYG_SWAP16((_x_))
+# define CYG_BE32_TO_CPU(_x_) CYG_SWAP32((_x_))
+
+# define CYG_CPU_TO_LE16(_x_) (_x_)
+# define CYG_CPU_TO_LE32(_x_) (_x_)
+# define CYG_LE16_TO_CPU(_x_) (_x_)
+# define CYG_LE32_TO_CPU(_x_) (_x_)
+
+#elif (CYG_BYTEORDER == CYG_MSBFIRST)
+
+# define CYG_CPU_TO_BE16(_x_) (_x_)
+# define CYG_CPU_TO_BE32(_x_) (_x_)
+# define CYG_BE16_TO_CPU(_x_) (_x_)
+# define CYG_BE32_TO_CPU(_x_) (_x_)
+
+# define CYG_CPU_TO_LE16(_x_) CYG_SWAP16((_x_))
+# define CYG_CPU_TO_LE32(_x_) CYG_SWAP32((_x_))
+# define CYG_LE16_TO_CPU(_x_) CYG_SWAP16((_x_))
+# define CYG_LE32_TO_CPU(_x_) CYG_SWAP32((_x_))
+
+#else
+
+# error "Endian mode not selected"
+
+#endif
+
+//-----------------------------------------------------------------------------
+#endif // CYGONCE_HAL_HAL_ENDIAN_H
+// End of hal_endian.h
diff --git a/cesar/ecos/packages/hal/common/current/include/hal_if.h b/cesar/ecos/packages/hal/common/current/include/hal_if.h
new file mode 100644
index 0000000000..29fcaaf704
--- /dev/null
+++ b/cesar/ecos/packages/hal/common/current/include/hal_if.h
@@ -0,0 +1,739 @@
+#ifndef CYGONCE_HAL_HAL_IF_H
+#define CYGONCE_HAL_HAL_IF_H
+
+//=============================================================================
+//
+// hal_if.h
+//
+// HAL header for ROM/RAM calling interface.
+//
+//=============================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
+// Copyright (C) 2002, 2003, 2004 Gary Thomas
+//
+// 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, woehler
+// Date: 2000-06-07
+// Purpose: HAL RAM/ROM calling interface
+// Description: ROM/RAM calling interface table definitions. The layout is a
+// combination of libbsp and vectors already in use by some
+// eCos platforms.
+// Usage: #include <cyg/hal/hal_if.h>
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+#include <cyg/infra/cyg_type.h> // types & externC
+#include <cyg/hal/dbg-threads-api.h>
+#include <cyg/hal/dbg-thread-syscall.h>
+
+#include <stdarg.h>
+
+#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT
+
+// Architecture/var/platform may override the accessor macros.
+#include <cyg/hal/hal_arch.h>
+
+// Special monitor locking procedures. These are necessary when the monitor
+// and eCos share facilities, e.g. the network hardware.
+#if defined (CYGPKG_NET) || defined (CYGPKG_NET_LWIP)
+#include <cyg/hal/hal_intr.h>
+#include <cyg/hal/drv_api.h> // cyg_drv_dsr_lock(), etc
+#define _ENTER_MONITOR() \
+ cyg_uint32 ints; \
+ HAL_DISABLE_INTERRUPTS(ints); \
+ cyg_drv_dsr_lock()
+
+#define _EXIT_MONITOR() \
+ cyg_drv_dsr_unlock(); \
+ HAL_RESTORE_INTERRUPTS(ints)
+#else // !CYGPKG_NET && !CYGPKG_NET_LWIP
+#define _ENTER_MONITOR() CYG_EMPTY_STATEMENT
+#define _EXIT_MONITOR() CYG_EMPTY_STATEMENT
+#endif
+
+//--------------------------------------------------------------------------
+#ifndef _BSP_HANDLER_T_DEFINED
+#define _BSP_HANDLER_T_DEFINED
+typedef int (*bsp_handler_t)(int __irq_nr, void *__regs);
+#endif // _BSP_HANDLER_T_DEFINED
+
+//--------------------------------------------------------------------------
+// Communication interface table. CYGNUM_CALL_IF_CONSOLE_PROCS and
+// CYGNUM_CALL_IF_DEBUG_PROCS point to instances (possibly the same)
+// of this table.
+
+typedef enum {
+ /*
+ * For serial ports, the control function may be used to set and get the
+ * current baud rate. Usage:
+ *
+ * err = (*__control)(COMMCTL_SETBAUD, int bits_per_second);
+ * err => Zero if successful, -1 if error.
+ *
+ * baud = (*__control)(COMMCTL_GETBAUD);
+ * baud => -1 if error, current baud otherwise.
+ */
+ __COMMCTL_SETBAUD=0,
+ __COMMCTL_GETBAUD,
+
+ /*
+ * Install and remove debugger interrupt handlers. These are the receiver
+ * interrupt routines which are used to change control from a running
+ * program to the debugger stub.
+ */
+ __COMMCTL_INSTALL_DBG_ISR,
+ __COMMCTL_REMOVE_DBG_ISR,
+
+ /*
+ * Disable comm port interrupt. Returns TRUE if interrupt was enabled,
+ * FALSE otherwise.
+ */
+ __COMMCTL_IRQ_DISABLE,
+
+ /*
+ * Enable comm port interrupt.
+ */
+ __COMMCTL_IRQ_ENABLE,
+
+ /*
+ * Returns the number of the interrupt vector used by the debug
+ * interrupt handler.
+ */
+ __COMMCTL_DBG_ISR_VECTOR,
+
+ /*
+ * Returns the current timeout value and sets a new timeout.
+ * Timeout resolution is in milliseconds.
+ * old_timeout = (*__control)(__COMMCTL_SET_TIMEOUT,
+ * cyg_int32 new_timeout);
+ */
+ __COMMCTL_SET_TIMEOUT,
+
+ /*
+ * Forces driver to send all characters which may be buffered in
+ * the driver. This only flushes the driver buffers, not necessarily
+ * any hardware FIFO, etc.
+ */
+ __COMMCTL_FLUSH_OUTPUT,
+
+ /*
+ * Forces driver to enable or disable flushes when a newline is
+ * seen in the output stream. Flushing at line boundaries occurs
+ * in the driver, not necessarily any hardware FIFO, etc. Line
+ * buffering is optional and may only be available in some drivers.
+ */
+ __COMMCTL_ENABLE_LINE_FLUSH,
+ __COMMCTL_DISABLE_LINE_FLUSH,
+
+} __comm_control_cmd_t;
+
+
+#define CYGNUM_COMM_IF_CH_DATA 0
+#define CYGNUM_COMM_IF_WRITE 1
+#define CYGNUM_COMM_IF_READ 2
+#define CYGNUM_COMM_IF_PUTC 3
+#define CYGNUM_COMM_IF_GETC 4
+#define CYGNUM_COMM_IF_CONTROL 5
+#define CYGNUM_COMM_IF_DBG_ISR 6
+#define CYGNUM_COMM_IF_GETC_TIMEOUT 7
+
+#define CYGNUM_COMM_IF_TABLE_SIZE 8
+
+typedef volatile CYG_ADDRWORD hal_virtual_comm_table_t[CYGNUM_COMM_IF_TABLE_SIZE];
+
+// The below is a (messy) attempt at adding some type safety to the
+// above array. At the same time, the accessors allow the
+// implementation to be easily changed in the future (both tag->data
+// table and structure implementations have been suggested).
+
+typedef void* __comm_if_ch_data_t;
+typedef void (*__comm_if_write_t)(void* __ch_data, const cyg_uint8* __buf,
+ cyg_uint32 __len);
+typedef int (*__comm_if_read_t)(void* __ch_data, cyg_uint8* __buf,
+ cyg_uint32 __len);
+typedef void (*__comm_if_putc_t)(void* __ch_data, cyg_uint8 __ch);
+typedef cyg_uint8 (*__comm_if_getc_t)(void* __ch_data);
+typedef int (*__comm_if_control_t)(void *__ch_data,
+ __comm_control_cmd_t __func, ...);
+typedef int (*__comm_if_dbg_isr_t)(void *__ch_data,
+ int* __ctrlc, CYG_ADDRWORD __vector,
+ CYG_ADDRWORD __data);
+typedef cyg_bool (*__comm_if_getc_timeout_t)(void* __ch_data, cyg_uint8* __ch);
+
+#define __call_COMM0(_n_,_rt_,_t_) \
+static __inline__ _rt_ \
+__call_COMM_##_n_(hal_virtual_comm_table_t t) \
+{ \
+ _rt_ res; \
+ void *dp = (__comm_if_ch_data_t)t[CYGNUM_COMM_IF_CH_DATA]; \
+ _ENTER_MONITOR(); \
+ res = ((_t_)(t[CYGNUM_COMM_##_n_]))(dp); \
+ _EXIT_MONITOR(); \
+ return res; \
+}
+
+#define __call_voidCOMM(_n_,_rt_,_t_) \
+static __inline__ _rt_ \
+__call_COMM_##_n_(hal_virtual_comm_table_t t) \
+{ \
+ void *dp = (__comm_if_ch_data_t)t[CYGNUM_COMM_IF_CH_DATA]; \
+ _ENTER_MONITOR(); \
+ ((_t_)(t[CYGNUM_COMM_##_n_]))(dp); \
+ _EXIT_MONITOR(); \
+}
+
+#define __call_COMM1(_n_,_rt_,_t_,_t1_) \
+static __inline__ _rt_ \
+__call_COMM_##_n_(hal_virtual_comm_table_t t, _t1_ _p1_) \
+{ \
+ _rt_ res; \
+ void *dp = (__comm_if_ch_data_t)t[CYGNUM_COMM_IF_CH_DATA]; \
+ _ENTER_MONITOR(); \
+ res = ((_t_)(t[CYGNUM_COMM_##_n_]))(dp, _p1_); \
+ _EXIT_MONITOR(); \
+ return res; \
+}
+
+#define __call_voidCOMM1(_n_,_rt_,_t_,_t1_) \
+static __inline__ _rt_ \
+__call_COMM_##_n_(hal_virtual_comm_table_t t, _t1_ _p1_) \
+{ \
+ void *dp = (__comm_if_ch_data_t)t[CYGNUM_COMM_IF_CH_DATA]; \
+ _ENTER_MONITOR(); \
+ ((_t_)(t[CYGNUM_COMM_##_n_]))(dp, _p1_); \
+ _EXIT_MONITOR(); \
+}
+
+#define __call_COMM2(_n_,_rt_,_t_,_t1_,_t2_) \
+static __inline__ _rt_ \
+__call_COMM_##_n_(hal_virtual_comm_table_t t, _t1_ _p1_, _t2_ _p2_) \
+{ \
+ _rt_ res; \
+ void *dp = (__comm_if_ch_data_t)t[CYGNUM_COMM_IF_CH_DATA]; \
+ _ENTER_MONITOR(); \
+ res = ((_t_)(t[CYGNUM_COMM_##_n_]))(dp, _p1_, _p2_); \
+ _EXIT_MONITOR(); \
+ return res; \
+}
+
+#define __call_voidCOMM2(_n_,_rt_,_t_,_t1_,_t2_) \
+static __inline__ _rt_ \
+__call_COMM_##_n_(hal_virtual_comm_table_t t, _t1_ _p1_, _t2_ _p2_) \
+{ \
+ void *dp = (__comm_if_ch_data_t)t[CYGNUM_COMM_IF_CH_DATA]; \
+ _ENTER_MONITOR(); \
+ ((_t_)(t[CYGNUM_COMM_##_n_]))(dp, _p1_, _p2_); \
+ _EXIT_MONITOR(); \
+}
+
+#define __call_COMM3(_n_,_rt_,_t_,_t1_,_t2_,_t3_) \
+static __inline__ _rt_ \
+__call_COMM_##_n_(hal_virtual_comm_table_t t, _t1_ _p1_, _t2_ _p2_, _t3_ _p3_) \
+{ \
+ _rt_ res; \
+ void *dp = (__comm_if_ch_data_t)t[CYGNUM_COMM_IF_CH_DATA]; \
+ _ENTER_MONITOR(); \
+ res = ((_t_)(t[CYGNUM_COMM_##_n_]))(dp, _p1_, _p2_, _p3_); \
+ _EXIT_MONITOR(); \
+ return res; \
+}
+
+#define __call_voidCOMM3(_n_,_rt_,_t_,_t1_,_t2_,_t3_) \
+static __inline__ _rt_ \
+__call_COMM_##_n_(hal_virtual_comm_table_t t, _t1_ _p1_, _t2_ _p2_, _t3_ _p3_) \
+{ \
+ void *dp = (__comm_if_ch_data_t)t[CYGNUM_COMM_IF_CH_DATA]; \
+ _ENTER_MONITOR(); \
+ ((_t_)(t[CYGNUM_COMM_##_n_]))(dp, _p1_, _p2_, _p3_); \
+ _EXIT_MONITOR(); \
+}
+
+#ifndef CYGACC_COMM_IF_DEFINED
+
+#define CYGACC_COMM_IF_CH_DATA(_t_) \
+ ((__comm_if_ch_data_t)((_t_)[CYGNUM_COMM_IF_CH_DATA]))
+#define CYGACC_COMM_IF_CH_DATA_SET(_t_, _x_) \
+ (_t_)[CYGNUM_COMM_IF_CH_DATA]=(CYG_ADDRWORD)(_x_)
+
+__call_voidCOMM2(IF_WRITE, void, __comm_if_write_t, const cyg_uint8 *, cyg_uint32)
+#define CYGACC_COMM_IF_WRITE(_t_, _b_, _l_) \
+ __call_COMM_IF_WRITE(_t_, _b_, _l_)
+#define CYGACC_COMM_IF_WRITE_SET(_t_, _x_) \
+ (_t_)[CYGNUM_COMM_IF_WRITE]=(CYG_ADDRWORD)(_x_)
+
+__call_voidCOMM2(IF_READ, void, __comm_if_read_t, cyg_uint8 *, cyg_uint32)
+#define CYGACC_COMM_IF_READ(_t_, _b_, _l_) \
+ __call_COMM_IF_READ(_t_, _b_, _l_)
+#define CYGACC_COMM_IF_READ_SET(_t_, _x_) \
+ (_t_)[CYGNUM_COMM_IF_READ]=(CYG_ADDRWORD)(_x_)
+
+__call_voidCOMM1(IF_PUTC, void, __comm_if_putc_t, cyg_uint8)
+#define CYGACC_COMM_IF_PUTC(_t_, _c_) \
+ __call_COMM_IF_PUTC(_t_,_c_)
+#define CYGACC_COMM_IF_PUTC_SET(_t_, _x_) \
+ (_t_)[CYGNUM_COMM_IF_PUTC]=(CYG_ADDRWORD)(_x_)
+
+__call_COMM0(IF_GETC, cyg_uint8, __comm_if_getc_t)
+#define CYGACC_COMM_IF_GETC(_t_) \
+ __call_COMM_IF_GETC(_t_)
+#define CYGACC_COMM_IF_GETC_SET(_t_, _x_) \
+ (_t_)[CYGNUM_COMM_IF_GETC]=(CYG_ADDRWORD)(_x_)
+
+// This macro has not been changed to use inline functions like the
+// others, simply because it uses variable arguments, and the change
+// would break binary compatibility.
+#define CYGACC_COMM_IF_CONTROL(_t_, args...) \
+ ({ int res; \
+ _ENTER_MONITOR(); \
+ res = ((__comm_if_control_t)((_t_)[CYGNUM_COMM_IF_CONTROL]))(CYGACC_COMM_IF_CH_DATA(_t_), args); \
+ _EXIT_MONITOR(); \
+ res;})
+#define CYGACC_COMM_IF_CONTROL_SET(_t_, _x_) \
+ (_t_)[CYGNUM_COMM_IF_CONTROL]=(CYG_ADDRWORD)(_x_)
+
+__call_COMM3(IF_DBG_ISR, int, __comm_if_dbg_isr_t, int *, CYG_ADDRWORD, CYG_ADDRWORD)
+#define CYGACC_COMM_IF_DBG_ISR(_t_, _c_, _v_, _d_) \
+ __call_COMM_IF_DBG_ISR(_t_, _c_, _v_, _d_)
+#define CYGACC_COMM_IF_DBG_ISR_SET(_t_, _x_) \
+ (_t_)[CYGNUM_COMM_IF_DBG_ISR]=(CYG_ADDRWORD)(_x_)
+
+__call_COMM1(IF_GETC_TIMEOUT, cyg_bool, __comm_if_getc_timeout_t, cyg_uint8 *)
+#define CYGACC_COMM_IF_GETC_TIMEOUT(_t_, _c_) \
+ __call_COMM_IF_GETC_TIMEOUT(_t_, _c_)
+#define CYGACC_COMM_IF_GETC_TIMEOUT_SET(_t_, _x_) \
+ (_t_)[CYGNUM_COMM_IF_GETC_TIMEOUT]=(CYG_ADDRWORD)(_x_)
+
+#endif // CYGACC_COMM_IF_DEFINED
+
+//--------------------------------------------------------------------------
+// Main calling interface table. Will be assigned a location by the
+// linker script. Both ROM and RAM startup applications will know about
+// the location.
+#define CYGNUM_CALL_IF_VERSION 0
+#define CYGNUM_CALL_IF_available_1 1
+#define CYGNUM_CALL_IF_available_2 2
+#define CYGNUM_CALL_IF_available_3 3
+#define CYGNUM_CALL_IF_KILL_VECTOR 4
+#define CYGNUM_CALL_IF_CONSOLE_PROCS 5
+#define CYGNUM_CALL_IF_DEBUG_PROCS 6
+#define CYGNUM_CALL_IF_FLUSH_DCACHE 7
+#define CYGNUM_CALL_IF_FLUSH_ICACHE 8
+#define CYGNUM_CALL_IF_available_9 9
+#define CYGNUM_CALL_IF_available_10 10
+#define CYGNUM_CALL_IF_available_11 11
+#define CYGNUM_CALL_IF_SET_DEBUG_COMM 12
+#define CYGNUM_CALL_IF_SET_CONSOLE_COMM 13
+#define CYGNUM_CALL_IF_MONITOR_VERSION 14
+#define CYGNUM_CALL_IF_DBG_SYSCALL 15
+#define CYGNUM_CALL_IF_RESET 16
+#define CYGNUM_CALL_IF_CONSOLE_INTERRUPT_FLAG 17
+#define CYGNUM_CALL_IF_DELAY_US 18
+#define CYGNUM_CALL_IF_DBG_DATA 19
+#define CYGNUM_CALL_IF_FLASH_CFG_OP 20
+#define CYGNUM_CALL_IF_MONITOR_RETURN 21
+#define CYGNUM_CALL_IF_FLASH_FIS_OP 22
+
+#define CYGNUM_CALL_IF_LAST_ENTRY CYGNUM_CALL_IF_FLASH_FIS_OP
+
+#define CYGNUM_CALL_IF_INSTALL_BPT_FN 35
+
+#define CYGNUM_CALL_IF_TABLE_SIZE 64
+
+externC volatile CYG_ADDRWORD hal_virtual_vector_table[CYGNUM_CALL_IF_TABLE_SIZE];
+
+// Table version contains version information for both the CALL table
+// itself (the number of the last active entry in the table), and the
+// COMM table (the size of the table).
+#define CYGNUM_CALL_IF_TABLE_VERSION_CALL CYGNUM_CALL_IF_LAST_ENTRY
+#define CYGNUM_CALL_IF_TABLE_VERSION_CALL_HACK (CYGNUM_CALL_IF_TABLE_SIZE+1)
+#define CYGNUM_CALL_IF_TABLE_VERSION_CALL_MAX CYGNUM_CALL_IF_TABLE_SIZE
+#define CYGNUM_CALL_IF_TABLE_VERSION_COMM CYGNUM_COMM_IF_TABLE_SIZE
+#define CYGNUM_CALL_IF_TABLE_VERSION_CALL_MASK 0x0000ffff
+#define CYGNUM_CALL_IF_TABLE_VERSION_COMM_MASK 0xffff0000
+#define CYGNUM_CALL_IF_TABLE_VERSION_COMM_shift 16
+
+
+// These are special debug/console procs IDs
+// QUERY_CURRENT will cause the ID of the currently selected proc ID to be
+// returned.
+// EMPTY this is the ID used for an empty procs table (i.e, NULL
+// pointer)
+// MANGLER selects the procs space reserved for the console mangler
+// allowing the application to temporarily disable mangling
+// or temporarily switch in different console procs.
+#define CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT -1
+#define CYGNUM_CALL_IF_SET_COMM_ID_EMPTY -2
+#define CYGNUM_CALL_IF_SET_COMM_ID_MANGLER -3
+
+// The below is a (messy) attempt at adding some type safety to the
+// above array. At the same time, the accessors allow the
+// implementation to be easily changed in the future (both tag->data
+// table and structure implementations have been suggested).
+
+typedef int __call_if_version_t;
+typedef void* __call_if_ictrl_table_t;
+typedef void* __call_if_exc_table_t;
+typedef bsp_handler_t *__call_if_dbg_vector_t;
+typedef bsp_handler_t __call_if_kill_vector_t;
+typedef hal_virtual_comm_table_t *__call_if_console_procs_t;
+typedef hal_virtual_comm_table_t *__call_if_debug_procs_t;
+typedef void (__call_if_flush_dcache_t)(void *__p, int __nbytes);
+typedef void (__call_if_flush_icache_t)(void *__p, int __nbytes);
+typedef int (__call_if_set_debug_comm_t)(int __comm_id);
+typedef int (__call_if_set_console_comm_t)(int __comm_id);
+typedef void* __call_if_dbg_data_t;
+typedef int (__call_if_dbg_syscall_t) (enum dbg_syscall_ids id,
+ union dbg_thread_syscall_parms *p );
+typedef void (__call_if_reset_t)(void);
+typedef int __call_if_console_interrupt_flag_t;
+typedef void (__call_if_delay_us_t)(cyg_int32 usecs);
+typedef void (__call_if_install_bpt_fn_t)(void *__epc);
+typedef char *__call_if_monitor_version_t;
+typedef void (__call_if_monitor_return_t)(int status);
+typedef cyg_bool (__call_if_flash_fis_op_fn_t)(int __oper, char *__name, void *__val);
+//
+// This structure is used to pass parameters to/from the fconfig routines.
+// This allows a single virtual vector interface, with widely varying functionality
+//
+struct cyg_fconfig {
+ char *key; // Datum 'key'
+ int keylen; // Length of key
+ void *val; // Pointer to data
+ int type; // Type of datum
+ int offset; // Offset within data (used by _NEXT)
+};
+typedef cyg_bool (__call_if_flash_cfg_op_fn_t)(int __oper, struct cyg_fconfig *__data);
+
+#ifndef CYGACC_CALL_IF_DEFINED
+
+#define __data_VV(_n_,_tt_) \
+static __inline__ _tt_ \
+__call_vv_##_n_(void) \
+{ \
+ return ((_tt_)hal_virtual_vector_table[_n_]); \
+}
+
+#define __call_VV0(_n_,_tt_,_rt_) \
+static __inline__ _rt_ \
+__call_vv_##_n_(void) \
+{ \
+ _rt_ res; \
+ _ENTER_MONITOR(); \
+ res = ((_tt_ *)hal_virtual_vector_table[_n_])(); \
+ _EXIT_MONITOR(); \
+ return res; \
+}
+
+#define __call_voidVV0(_n_,_tt_,_rt_) \
+static __inline__ _rt_ \
+__call_vv_##_n_(void) \
+{ \
+ _ENTER_MONITOR(); \
+ ((_tt_ *)hal_virtual_vector_table[_n_])(); \
+ _EXIT_MONITOR(); \
+}
+
+#define __call_VV1(_n_,_tt_,_rt_,_t1_) \
+static __inline__ _rt_ \
+__call_vv_##_n_(_t1_ _p1_) \
+{ \
+ _rt_ res; \
+ _ENTER_MONITOR(); \
+ res = ((_tt_ *)hal_virtual_vector_table[_n_])(_p1_); \
+ _EXIT_MONITOR(); \
+ return res; \
+}
+
+#define __call_voidVV1(_n_,_tt_,_rt_,_t1_) \
+static __inline__ _rt_ \
+__call_vv_##_n_(_t1_ _p1_) \
+{ \
+ _ENTER_MONITOR(); \
+ ((_tt_ *)hal_virtual_vector_table[_n_])(_p1_); \
+ _EXIT_MONITOR(); \
+}
+
+#define __call_VV2(_n_,_tt_,_rt_,_t1_,_t2_) \
+static __inline__ _rt_ \
+__call_vv_##_n_(_t1_ _p1_, _t2_ _p2_) \
+{ \
+ _rt_ res; \
+ _ENTER_MONITOR(); \
+ res = ((_tt_ *)hal_virtual_vector_table[_n_])(_p1_,_p2_); \
+ _EXIT_MONITOR(); \
+ return res; \
+}
+
+#define __call_voidVV2(_n_,_tt_,_rt_,_t1_,_t2_) \
+static __inline__ _rt_ \
+__call_vv_##_n_(_t1_ _p1_, _t2_ _p2_) \
+{ \
+ _ENTER_MONITOR(); \
+ ((_tt_ *)hal_virtual_vector_table[_n_])(_p1_,_p2_); \
+ _EXIT_MONITOR(); \
+}
+
+#define __call_VV3(_n_,_tt_,_rt_,_t1_,_t2_,_t3_) \
+static __inline__ _rt_ \
+__call_vv_##_n_(_t1_ _p1_, _t2_ _p2_, _t3_ _p3_) \
+{ \
+ _rt_ res; \
+ _ENTER_MONITOR(); \
+ res = ((_tt_ *)hal_virtual_vector_table[_n_])(_p1_,_p2_,_p3_); \
+ _EXIT_MONITOR(); \
+ return res; \
+}
+
+#define __call_voidVV3(_n_,_tt_,_rt_,_t1_,_t2_,_t3_) \
+static __inline__ _rt_ \
+__call_vv_##_n_(_t1_ _p1_, _t2_ _p2_, _t3_ _p3_) \
+{ \
+ _ENTER_MONITOR(); \
+ ((_tt_ *)hal_virtual_vector_table[_n_])(_p1_,_p2_,_p3_); \
+ _EXIT_MONITOR(); \
+}
+
+#define __call_VV4(_n_,_tt_,_rt_,_t1_,_t2_,_t3_,_t4_) \
+static __inline__ _rt_ \
+__call_vv_##_n_(_t1_ _p1_, _t2_ _p2_, _t3_ _p3_, _t4_ _p4_) \
+{ \
+ _rt_ res; \
+ _ENTER_MONITOR(); \
+ res = ((_tt_ *)hal_virtual_vector_table[_n_])(_p1_,_p2_,_p3_,_p4_); \
+ _EXIT_MONITOR(); \
+ return res; \
+}
+
+#define __call_voidVV4(_n_,_tt_,_rt_,_t1_,_t2_,_t3_,_t4_) \
+static __inline__ _rt_ \
+__call_vv_##_n_(_t1_ _p1_, _t2_ _p2_, _t3_ _p3_, _t4_ _p4_) \
+{ \
+ _ENTER_MONITOR(); \
+ ((_tt_ *)hal_virtual_vector_table[_n_])(_p1_,_p2_,_p3_,_p4_); \
+ _EXIT_MONITOR(); \
+}
+
+
+#define CYGACC_DATA_VV(t,e) __call_vv_##e()
+#define CYGACC_CALL_VV0(t,e) __call_vv_##e
+#define CYGACC_CALL_VV1(t,e,p1) __call_vv_##e((p1))
+#define CYGACC_CALL_VV2(t,e,p1,p2) __call_vv_##e((p1),(p2))
+#define CYGACC_CALL_VV3(t,e,p1,p2,p3) __call_vv_##e((p1),(p2),(p3))
+#define CYGACC_CALL_VV4(t,e,p1,p2,p3,p4) __call_vv_##e((p1),(p2),(p3),(p4))
+
+#define CYGACC_CALL_IF_VERSION() \
+ CYGACC_DATA_VV(__call_if_version_t, CYGNUM_CALL_IF_VERSION)
+__data_VV(CYGNUM_CALL_IF_VERSION, __call_if_version_t)
+#define CYGACC_CALL_IF_VERSION_SET(_x_) \
+ hal_virtual_vector_table[CYGNUM_CALL_IF_VERSION]=(CYG_ADDRWORD)(_x_)
+
+#define CYGACC_CALL_IF_KILL_VECTOR() \
+ CYGACC_DATA_VV(__call_if_kill_vector_t, CYGNUM_CALL_IF_KILL_VECTOR)
+__data_VV(CYGNUM_CALL_IF_KILL_VECTOR, __call_if_kill_vector_t)
+#define CYGACC_CALL_IF_KILL_VECTOR_SET(_x_) \
+ hal_virtual_vector_table[CYGNUM_CALL_IF_KILL_VECTOR]=(CYG_ADDRWORD)(_x_)
+
+#define CYGACC_CALL_IF_CONSOLE_PROCS() \
+ CYGACC_DATA_VV(__call_if_console_procs_t, CYGNUM_CALL_IF_CONSOLE_PROCS)
+__data_VV(CYGNUM_CALL_IF_CONSOLE_PROCS, __call_if_console_procs_t)
+#define CYGACC_CALL_IF_CONSOLE_PROCS_SET(_x_) \
+ hal_virtual_vector_table[CYGNUM_CALL_IF_CONSOLE_PROCS]=(CYG_ADDRWORD)(_x_)
+
+#define CYGACC_CALL_IF_FLUSH_DCACHE(_p_, _n_) \
+ ((__call_if_flush_dcache_t*)hal_virtual_vector_table[CYGNUM_CALL_IF_FLUSH_DCACHE])((_p_), (_n_))
+#define CYGACC_CALL_IF_FLUSH_DCACHE_SET(_x_) \
+ hal_virtual_vector_table[CYGNUM_CALL_IF_FLUSH_DCACHE]=(CYG_ADDRWORD)(_x_)
+
+#define CYGACC_CALL_IF_FLUSH_ICACHE(_p_, _n_) \
+ ((__call_if_flush_icache_t*)hal_virtual_vector_table[CYGNUM_CALL_IF_FLUSH_ICACHE])((_p_), (_n_))
+#define CYGACC_CALL_IF_FLUSH_ICACHE_SET(_x_) \
+ hal_virtual_vector_table[CYGNUM_CALL_IF_FLUSH_ICACHE]=(CYG_ADDRWORD)(_x_)
+
+#define CYGACC_CALL_IF_DEBUG_PROCS() \
+ CYGACC_DATA_VV(__call_if_debug_procs_t, CYGNUM_CALL_IF_DEBUG_PROCS)
+__data_VV(CYGNUM_CALL_IF_DEBUG_PROCS, __call_if_debug_procs_t)
+#define CYGACC_CALL_IF_DEBUG_PROCS_SET(_x_) \
+ hal_virtual_vector_table[CYGNUM_CALL_IF_DEBUG_PROCS]=(CYG_ADDRWORD)(_x_)
+
+#define CYGACC_CALL_IF_SET_DEBUG_COMM(_i_) \
+ CYGACC_CALL_VV1(__call_if_set_debug_comm_t*, CYGNUM_CALL_IF_SET_DEBUG_COMM, (_i_))
+__call_VV1(CYGNUM_CALL_IF_SET_DEBUG_COMM, __call_if_set_debug_comm_t, int, int)
+#define CYGACC_CALL_IF_SET_DEBUG_COMM_SET(_x_) \
+ hal_virtual_vector_table[CYGNUM_CALL_IF_SET_DEBUG_COMM]=(CYG_ADDRWORD)(_x_)
+
+#define CYGACC_CALL_IF_SET_CONSOLE_COMM(_i_) \
+ CYGACC_CALL_VV1(__call_if_set_console_comm_t*, CYGNUM_CALL_IF_SET_CONSOLE_COMM, (_i_))
+__call_VV1(CYGNUM_CALL_IF_SET_CONSOLE_COMM, __call_if_set_console_comm_t, int, int)
+#define CYGACC_CALL_IF_SET_CONSOLE_COMM_SET(_x_) \
+ hal_virtual_vector_table[CYGNUM_CALL_IF_SET_CONSOLE_COMM]=(CYG_ADDRWORD)(_x_)
+
+#define CYGACC_CALL_IF_DBG_DATA() \
+ CYGACC_DATA_VV(__call_if_dbg_data_t, CYGNUM_CALL_IF_DBG_DATA)
+__data_VV(CYGNUM_CALL_IF_DBG_DATA, __call_if_dbg_data_t)
+#define CYGACC_CALL_IF_DBG_DATA_SET(_x_) \
+ hal_virtual_vector_table[CYGNUM_CALL_IF_DBG_DATA]=(CYG_ADDRWORD)(_x_)
+
+#define CYGACC_CALL_IF_DBG_SYSCALL(_id_,_p_) \
+ CYGACC_CALL_VV2(__call_if_dbg_syscall_t, CYGNUM_CALL_IF_DBG_SYSCALL, _id_, _p_)
+__call_VV2(CYGNUM_CALL_IF_DBG_SYSCALL, __call_if_dbg_syscall_t, int, enum dbg_syscall_ids , union dbg_thread_syscall_parms *)
+#define CYGACC_CALL_IF_DBG_SYSCALL_SET(_x_) \
+ hal_virtual_vector_table[CYGNUM_CALL_IF_DBG_SYSCALL]=(CYG_ADDRWORD)(_x_)
+
+#define CYGACC_CALL_IF_RESET() \
+ CYGACC_CALL_VV0(__call_if_reset_t*, CYGNUM_CALL_IF_RESET)()
+__call_voidVV0(CYGNUM_CALL_IF_RESET, __call_if_reset_t, void)
+#define CYGACC_CALL_IF_RESET_SET(_x_) \
+ hal_virtual_vector_table[CYGNUM_CALL_IF_RESET]=(CYG_ADDRWORD)(_x_)
+#define CYGACC_CALL_IF_RESET_GET() \
+ ((__call_if_reset_t*)hal_virtual_vector_table[CYGNUM_CALL_IF_RESET])
+
+#define CYGACC_CALL_IF_MONITOR_VERSION() \
+ CYGACC_DATA_VV(__call_if_monitor_version_t, CYGNUM_CALL_IF_MONITOR_VERSION)
+__data_VV(CYGNUM_CALL_IF_MONITOR_VERSION, __call_if_monitor_version_t)
+#define CYGACC_CALL_IF_MONITOR_VERSION_SET(_x_) \
+ hal_virtual_vector_table[CYGNUM_CALL_IF_MONITOR_VERSION]=(CYG_ADDRWORD)(_x_)
+
+#define CYGACC_CALL_IF_CONSOLE_INTERRUPT_FLAG() \
+ CYGACC_DATA_VV(__call_if_console_interrupt_flag_t, CYGNUM_CALL_IF_CONSOLE_INTERRUPT_FLAG)
+__data_VV(CYGNUM_CALL_IF_CONSOLE_INTERRUPT_FLAG, __call_if_console_interrupt_flag_t)
+#define CYGACC_CALL_IF_CONSOLE_INTERRUPT_FLAG_SET(_x_) \
+ hal_virtual_vector_table[CYGNUM_CALL_IF_CONSOLE_INTERRUPT_FLAG]=(CYG_ADDRWORD)(_x_)
+
+#define CYGACC_CALL_IF_DELAY_US(_u_) \
+ CYGACC_CALL_VV1(__call_if_delay_us_t*, CYGNUM_CALL_IF_DELAY_US, (_u_))
+__call_voidVV1(CYGNUM_CALL_IF_DELAY_US, __call_if_delay_us_t, void, cyg_int32)
+#define CYGACC_CALL_IF_DELAY_US_SET(_x_) \
+ hal_virtual_vector_table[CYGNUM_CALL_IF_DELAY_US]=(CYG_ADDRWORD)(_x_)
+
+#define CYGACC_CALL_IF_INSTALL_BPT_FN(_e_) \
+ CYGACC_CALL_VV1(__call_if_install_bpt_fn_t*, CYGNUM_CALL_IF_INSTALL_BPT_FN, (_e_))
+__call_voidVV1(CYGNUM_CALL_IF_INSTALL_BPT_FN, __call_if_install_bpt_fn_t, void, void *)
+#define CYGACC_CALL_IF_INSTALL_BPT_FN_SET(_x_) \
+ hal_virtual_vector_table[CYGNUM_CALL_IF_INSTALL_BPT_FN]=(CYG_ADDRWORD)(_x_)
+
+//
+// Access persistent data store - kept in FLASH or EEPROM by RedBoot
+//
+#define CYGNUM_CALL_IF_FLASH_CFG_GET (0) // Get a particular fconfig key
+#define CYGNUM_CALL_IF_FLASH_CFG_NEXT (1) // Enumerate keys (get the next one)
+#define CYGNUM_CALL_IF_FLASH_CFG_SET (2) // Update particular fconfig key
+#define CYGACC_CALL_IF_FLASH_CFG_OP2(_o_,_d_) \
+ CYGACC_CALL_VV2(__call_if_flash_cfg_op_fn_t*, CYGNUM_CALL_IF_FLASH_CFG_OP, (_o_),(_d_))
+__call_VV2(CYGNUM_CALL_IF_FLASH_CFG_OP, __call_if_flash_cfg_op_fn_t, cyg_bool, int, struct cyg_fconfig *)
+
+static __inline__ cyg_bool
+__call_if_flash_cfg_op(int op, char *key, void *data, int type)
+{
+ struct cyg_fconfig info;
+ info.key = key;
+ info.val = data;
+ info.type = type;
+ info.offset = 0;
+ return CYGACC_CALL_IF_FLASH_CFG_OP2(op, &info);
+}
+#define CYGACC_CALL_IF_FLASH_CFG_OP(_o_,_k_,_d_,_t_) \
+ __call_if_flash_cfg_op(_o_,_k_,_d_,_t_)
+#define CYGACC_CALL_IF_FLASH_CFG_OP_SET(_x_) \
+ hal_virtual_vector_table[CYGNUM_CALL_IF_FLASH_CFG_OP]=(CYG_ADDRWORD)(_x_)
+
+#define CYGACC_CALL_IF_MONITOR_RETURN(_u_) \
+ CYGACC_CALL_VV1(__call_if_monitor_return_t*, CYGNUM_CALL_IF_MONITOR_RETURN, (_u_))
+__call_voidVV1(CYGNUM_CALL_IF_MONITOR_RETURN, __call_if_monitor_return_t, void, int)
+#define CYGACC_CALL_IF_MONITOR_RETURN_SET(_x_) \
+ hal_virtual_vector_table[CYGNUM_CALL_IF_MONITOR_RETURN]=(CYG_ADDRWORD)(_x_)
+
+#define CYGACC_CALL_IF_FLASH_FIS_OP(_o_,_k_,_d_) \
+ CYGACC_CALL_VV3(__call_if_flash_fis_op_fn_t*, CYGNUM_CALL_IF_FLASH_FIS_OP, (_o_),(_k_),(_d_))
+__call_VV3(CYGNUM_CALL_IF_FLASH_FIS_OP, __call_if_flash_fis_op_fn_t, cyg_bool, int, char *, void *)
+#define CYGACC_CALL_IF_FLASH_FIS_OP_SET(_x_) \
+ hal_virtual_vector_table[CYGNUM_CALL_IF_FLASH_FIS_OP]=(CYG_ADDRWORD)(_x_)
+#define CYGNUM_CALL_IF_FLASH_FIS_GET_FLASH_BASE (0)
+#define CYGNUM_CALL_IF_FLASH_FIS_GET_SIZE (1)
+#define CYGNUM_CALL_IF_FLASH_FIS_GET_MEM_BASE (2)
+#define CYGNUM_CALL_IF_FLASH_FIS_GET_ENTRY_POINT (3)
+#define CYGNUM_CALL_IF_FLASH_FIS_GET_DATA_LENGTH (4)
+#define CYGNUM_CALL_IF_FLASH_FIS_GET_DESC_CKSUM (5)
+#define CYGNUM_CALL_IF_FLASH_FIS_GET_FILE_CKSUM (6)
+
+
+// These need to be kept uptodate with the (unadorned) masters
+// in RedBoot's flash_config.h:
+#define CYGNUM_FLASH_CFG_TYPE_CONFIG_EMPTY 0
+#define CYGNUM_FLASH_CFG_TYPE_CONFIG_BOOL 1
+#define CYGNUM_FLASH_CFG_TYPE_CONFIG_INT 2
+#define CYGNUM_FLASH_CFG_TYPE_CONFIG_STRING 3
+#define CYGNUM_FLASH_CFG_TYPE_CONFIG_SCRIPT 4
+#define CYGNUM_FLASH_CFG_TYPE_CONFIG_IP 5
+#define CYGNUM_FLASH_CFG_TYPE_CONFIG_ESA 6
+
+#endif // CYGACC_CALL_IF_DEFINED
+
+//--------------------------------------------------------------------------
+// Diag wrappers.
+externC void hal_if_diag_init(void);
+externC void hal_if_diag_write_char(char c);
+externC void hal_if_diag_read_char(char *c);
+
+//--------------------------------------------------------------------------
+// Ctrl-c support.
+externC cyg_uint32 hal_ctrlc_isr(CYG_ADDRWORD vector, CYG_ADDRWORD data);
+externC cyg_bool hal_ctrlc_check(CYG_ADDRWORD vector, CYG_ADDRWORD data);
+
+#define HAL_CTRLC_ISR hal_ctrlc_isr
+#define HAL_CTRLC_CHECK hal_ctrlc_check
+
+#else
+
+#if defined(CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT) \
+ || defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT)
+// Then other code might invoke this macro
+#define HAL_CTRLC_CHECK(a1,a2) (0) // Nothing, no CTRLC here
+#endif
+
+#endif // CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT
+
+//--------------------------------------------------------------------------
+// Functions provided by the HAL interface.
+externC void hal_if_init(void);
+#if 0 != CYGINT_HAL_PLF_IF_INIT
+externC void plf_if_init(void);
+#endif
+
+//-----------------------------------------------------------------------------
+#endif // CYGONCE_HAL_HAL_IF_H
+// End of hal_if.h
diff --git a/cesar/ecos/packages/hal/common/current/include/hal_misc.h b/cesar/ecos/packages/hal/common/current/include/hal_misc.h
new file mode 100644
index 0000000000..77b0644c89
--- /dev/null
+++ b/cesar/ecos/packages/hal/common/current/include/hal_misc.h
@@ -0,0 +1,123 @@
+#ifndef CYGONCE_HAL_HAL_MISC_H
+#define CYGONCE_HAL_HAL_MISC_H
+
+//=============================================================================
+//
+// hal_misc.h
+//
+// HAL header for miscellaneous helper routines
+//
+//=============================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//=============================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): jskov
+// Contributors:jskov
+// Date: 2000-06-08
+// Purpose: Miscellaneous routines shared between HALs
+// Usage: #include <cyg/hal/hal_misc.h>
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+#ifndef __ASSEMBLER__
+#include <cyg/infra/cyg_type.h> // types & externC
+
+//=============================================================================
+externC cyg_bool cyg_hal_is_break(char *buf, int size);
+externC void cyg_hal_user_break( CYG_ADDRWORD *regs );
+#endif
+
+//=============================================================================
+
+#define BIT0 0x00000001
+#define BIT1 0x00000002
+#define BIT2 0x00000004
+#define BIT3 0x00000008
+#define BIT4 0x00000010
+#define BIT5 0x00000020
+#define BIT6 0x00000040
+#define BIT7 0x00000080
+#define BIT8 0x00000100
+#define BIT9 0x00000200
+#define BIT10 0x00000400
+#define BIT11 0x00000800
+#define BIT12 0x00001000
+#define BIT13 0x00002000
+#define BIT14 0x00004000
+#define BIT15 0x00008000
+#define BIT16 0x00010000
+#define BIT17 0x00020000
+#define BIT18 0x00040000
+#define BIT19 0x00080000
+#define BIT20 0x00100000
+#define BIT21 0x00200000
+#define BIT22 0x00400000
+#define BIT23 0x00800000
+#define BIT24 0x01000000
+#define BIT25 0x02000000
+#define BIT26 0x04000000
+#define BIT27 0x08000000
+#define BIT28 0x10000000
+#define BIT29 0x20000000
+#define BIT30 0x40000000
+#define BIT31 0x80000000
+
+#define SZ_1K 0x00000400
+#define SZ_2K 0x00000800
+#define SZ_4K 0x00001000
+#define SZ_8K 0x00002000
+#define SZ_16K 0x00004000
+#define SZ_32K 0x00008000
+#define SZ_64K 0x00010000
+#define SZ_128K 0x00020000
+#define SZ_256K 0x00040000
+#define SZ_512K 0x00080000
+#define SZ_1M 0x00100000
+#define SZ_2M 0x00200000
+#define SZ_4M 0x00400000
+#define SZ_8M 0x00800000
+#define SZ_16M 0x01000000
+#define SZ_32M 0x02000000
+#define SZ_64M 0x04000000
+#define SZ_128M 0x08000000
+#define SZ_256M 0x10000000
+#define SZ_512M 0x20000000
+#define SZ_1G 0x40000000
+
+//-----------------------------------------------------------------------------
+#endif // CYGONCE_HAL_HAL_MISC_H
+// End of hal_misc.h
diff --git a/cesar/ecos/packages/hal/common/current/include/hal_spd.h b/cesar/ecos/packages/hal/common/current/include/hal_spd.h
new file mode 100644
index 0000000000..1b73f87b64
--- /dev/null
+++ b/cesar/ecos/packages/hal/common/current/include/hal_spd.h
@@ -0,0 +1,78 @@
+#ifndef CYGONCE_HAL_HAL_SPD_H
+#define CYGONCE_HAL_HAL_SPD_H
+
+//=============================================================================
+//
+// hal_spd.h
+//
+// HAL header for SDRAM Serial Presence Detect 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): msalter
+// Contributors:msalter
+// Date: 2002-01-17
+// Purpose: Generic HAL SPD header.
+// Usage: #include <cyg/hal/hal_spd.h>
+// Description: This header provides byte numbers and bit definitions for
+// serial EEPROM containing SDRAM module information.
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+// Commonly used bytes
+#define SPD_BANKCNT 5 // number of module banks
+#define SPD_CONFIG 11 // DIMM configuration type (Parity or not, EEC)
+#define SPD_REFRESH 12 // Referesh rate
+#define SPD_SDRAM_WIDTH 13 // DRAM width
+#define SPD_MOD_ATTRIB 21 // DRAM module attribute
+#define SPD_BANKSZ 31 // module bank density
+#define SPD_CHECKSUM 63 // checksum for bytes 0-62
+
+// SPD_MOD_ATTRIB bits
+#define SPD_ATTRIB_BUF_CTL 0x01 // Buffered Addr/Control inputs
+#define SPD_ATTRIB_REG_CTL 0x02 // Registered Addr/Control inputs
+#define SPD_ATTRIB_PLL 0x04 // On-card PLL
+#define SPD_ATTRIB_BUF_DQ 0x08 // Buffered DQMB inputs
+#define SPD_ATTRIB_REG_DQ 0x10 // Registered DQMB inputs
+#define SPD_ATTRIB_DIFF 0x20 // Differential clock input
+#define SPD_ATTRIB_RRA 0x40 // Redundant Row Address
+
+//-----------------------------------------------------------------------------
+#endif // CYGONCE_HAL_HAL_SPD_H
+// End of hal_spd.h
diff --git a/cesar/ecos/packages/hal/common/current/include/hal_stub.h b/cesar/ecos/packages/hal/common/current/include/hal_stub.h
new file mode 100644
index 0000000000..d3ee490cc2
--- /dev/null
+++ b/cesar/ecos/packages/hal/common/current/include/hal_stub.h
@@ -0,0 +1,390 @@
+#ifndef CYGONCE_HAL_HAL_STUB_H
+#define CYGONCE_HAL_HAL_STUB_H
+
+//=============================================================================
+//
+// hal_stub.h
+//
+// HAL header for GDB stub 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): jskov
+// Contributors:jskov
+// Date: 1999-02-12
+// Purpose: Generic HAL stub header.
+// Usage: #include <cyg/hal/hal_stub.h>
+// Description: This header is included by generic-stub.c to provide an
+// interface to the eCos-specific stub implementation. It is
+// not to be included by user code, and is only placed in a
+// publically accessible directory so that platform stub packages
+// are able to include it if required.
+//
+//####DESCRIPTIONEND####
+//
+//=============================================================================
+
+#include <pkgconf/hal.h>
+
+#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
+#define USE_GDBSTUB_PROTOTYPES 0 // avoid stub-tservice.h atm
+#ifndef __ECOS__
+#define __ECOS__ // use to mark eCos hacks
+#endif
+
+#include <cyg/hal/basetype.h> // HAL_LABEL_NAME
+#include <cyg/hal/hal_arch.h> // HAL header
+#include <cyg/infra/cyg_type.h> // cyg_uint32 and CYG_BYTEORDER
+
+#ifndef __CYGMON_TYPES
+#define __CYGMON_TYPES
+typedef cyg_uint32 uint32;
+typedef cyg_int32 int32;
+#endif // __CYGMON_TYPES
+
+#ifdef CYGBLD_HAL_PLATFORM_STUB_H
+#include CYGBLD_HAL_PLATFORM_STUB_H
+#else
+#include <cyg/hal/plf_stub.h>
+#endif
+#include <cyg/hal/generic-stub.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+} // to make below format correctly.
+#endif
+
+//-----------------------------------------------------------------------------
+// Definitions for generic-stub.c
+
+#define __set_mem_fault_trap(x) ({__mem_fault = 0; x(); __mem_fault;})
+
+#if (CYG_BYTEORDER==CYG_LSBFIRST)
+# if !defined(__LITTLE_ENDIAN__)
+# define __LITTLE_ENDIAN__
+# endif
+# if !defined(_LITTLE_ENDIAN)
+# define _LITTLE_ENDIAN
+# endif
+#endif
+
+//-----------------------------------------------------------------------------
+// Dummy definitions for harvard memory support for princeton memory systems.
+#ifndef TARGET_HAS_HARVARD_MEMORY
+typedef target_register_t target_addr_t;
+#define TARGET_ADDR_IS_PROGMEM(x) 0
+#define TARGET_ADDR_TO_PTR(x) ((char *) (x))
+#endif
+
+//----------------------------------------------------------------------------
+// Signal definitions to avoid 'signal.h'/
+#define SIGHUP 1 /* hangup */
+#define SIGINT 2 /* interrupt */
+#define SIGQUIT 3 /* quit */
+#define SIGILL 4 /* illegal instruction (not reset when caught) */
+#define SIGTRAP 5 /* trace trap (not reset when caught) */
+#define SIGIOT 6 /* IOT instruction */
+#define SIGABRT 6 /* used by abort, replace SIGIOT in the future */
+#define SIGEMT 7 /* EMT instruction */
+#define SIGFPE 8 /* floating point exception */
+#define SIGKILL 9 /* kill (cannot be caught or ignored) */
+#define SIGBUS 10 /* bus error */
+#define SIGSEGV 11 /* segmentation violation */
+#define SIGSYS 12 /* bad argument to system call */
+#define SIGPIPE 13 /* write on a pipe with no one to read it */
+#define SIGALRM 14 /* alarm clock */
+#define SIGTERM 15 /* software termination signal from kill */
+
+//----------------------------------------------------------------------------
+// Thread support. This setting is used in thread-pkts.h
+#ifdef CYGDBG_HAL_DEBUG_GDB_THREAD_SUPPORT
+#define DEBUG_THREADS 1
+#else
+#define DEBUG_THREADS 0
+#endif
+
+// The function stub_copy_registers() is statically defined in
+// thread-packets.c, but in eCos this external stub is defined as it
+// is used in dbg_gdb.cxx.
+externC void __stub_copy_registers(target_register_t *dest,
+ target_register_t *src);
+
+//----------------------------------------------------------------------------
+// Hardware Watch/Breakpoint support. These are the possible return values
+// of HAL_STUB_IS_STOPPED_BY_HARDWARE().
+#define HAL_STUB_HW_STOP_NONE 0 // target did not stop for hw watch/break
+#define HAL_STUB_HW_STOP_BREAK 1 // target stopped for hw breakpoint
+#define HAL_STUB_HW_STOP_WATCH 2 // target stopped for write-only watchpoint
+#define HAL_STUB_HW_STOP_RWATCH 3 // target stopped for read-only watchpoint
+#define HAL_STUB_HW_STOP_AWATCH 4 // target stopped for access watchpoint
+
+//----------------------------------------------------------------------------
+// Memory accessor functions.
+#define TARGET_HAS_OWN_MEM_FUNCS
+
+//----------------------------------------------------------------------------
+// Memory access checks.
+
+#ifndef CYG_HAL_STUB_PERMIT_DATA_READ
+#define CYG_HAL_STUB_PERMIT_DATA_READ(_addr_, __count_) (1)
+#endif
+
+#ifndef CYG_HAL_STUB_PERMIT_DATA_WRITE
+#define CYG_HAL_STUB_PERMIT_DATA_WRITE(_addr_, __count_) (1)
+#endif
+
+#ifdef TARGET_HAS_HARVARD_MEMORY
+
+#ifndef CYG_HAL_STUB_PERMIT_CODE_READ
+#define CYG_HAL_STUB_PERMIT_CODE_READ(_addr_, __count_) (1)
+#endif
+
+#ifndef CYG_HAL_STUB_PERMIT_CODE_WRITE
+#define CYG_HAL_STUB_PERMIT_CODE_WRITE(_addr_, __count_) (1)
+#endif
+
+#endif
+
+//----------------------------------------------------------------------------
+// Target extras?!
+extern int __process_target_query(char * pkt, char * out, int maxOut);
+extern int __process_target_set(char * pkt, char * out, int maxout);
+extern int __process_target_packet(char * pkt, char * out, int maxout);
+
+//---------------------------------------------------------------------------
+// Declarations to avoid compiler warnings.
+
+// Set the baud rate for the current serial port.
+extern void __set_baud_rate (int baud);
+
+// Write C to the current serial port.
+extern void putDebugChar (int c);
+
+// Read one character from the current serial port.
+extern int getDebugChar (void);
+
+// Push CH back onto the debug stream.
+extern void ungetDebugChar (int ch);
+
+// Reset the board.
+extern void __reset (void);
+
+// Multi-bp support.
+#ifndef __set_breakpoint
+extern int __set_breakpoint (target_register_t addr, target_register_t len);
+#endif
+#ifndef __remove_breakpoint
+extern int __remove_breakpoint (target_register_t addr, target_register_t len);
+#endif
+#ifndef __set_hw_breakpoint
+extern int __set_hw_breakpoint (target_register_t addr, target_register_t len);
+#endif
+#ifndef __remove_hw_breakpoint
+extern int __remove_hw_breakpoint (target_register_t addr, target_register_t len);
+#endif
+#ifndef __set_hw_watchpoint
+extern int __set_hw_watchpoint (target_register_t addr, target_register_t len, int ztype);
+#endif
+#ifndef __remove_hw_watchpoint
+extern int __remove_hw_watchpoint (target_register_t addr, target_register_t len, int ztype);
+#endif
+
+/* Install the standard set of trap handlers for the stub. */
+extern void __install_traps (void);
+
+/* Address in text section of a breakpoint instruction. */
+
+#ifndef BREAKINST_DEFINED
+#define BREAKINST_DEFINED
+extern void _breakinst (void);
+#endif
+
+/* The opcode for a breakpoint instruction. */
+
+extern unsigned long __break_opcode (void);
+
+/* Function to flush output buffers */
+extern void hal_flush_output(void);
+
+#ifdef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT
+// This one may assume a valid saved interrupt context on some platforms
+extern void cyg_hal_gdb_interrupt (target_register_t pc);
+// This one does not; use from CRITICAL_IO_REGION macros below.
+extern void cyg_hal_gdb_place_break (target_register_t pc);
+// Remove a break from either above - or not if cyg_hal_gdb_running_step
+extern int cyg_hal_gdb_remove_break (target_register_t pc);
+// Bool: is such a breakpoint set?
+extern int cyg_hal_gdb_break_is_set (void);
+
+/* This is used so that the generic stub can tell
+ * cyg_hal_gdb_remove_break() not to bother when we are avoiding stepping
+ * through a critical region ie. hal_diag_write_char() usually - that
+ * shares the GDB IO device.
+ */
+extern volatile int cyg_hal_gdb_running_step;
+
+// Use these in hal_diag.c when about to write a whole $O packet to GDB.
+// NB they require __builtin_return_address() to work: if your platform
+// does not support this, use HAL_DISABLE_INTERRUPTS &c instead.
+
+#if 1 // Can use the address of a label: this is more portable
+
+// This macro may already have been defined by the architecture HAL
+#ifndef CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION
+#define CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION( _old_ ) \
+do { \
+ HAL_DISABLE_INTERRUPTS(_old_); \
+ cyg_hal_gdb_place_break( (target_register_t)&&cyg_hal_gdb_break_place ); \
+} while ( 0 )
+#endif
+
+// This macro may already have been defined by the architecture HAL
+// Notice the trick to *use* the label - sometimes the tools want to
+// move the label if unused, which is bad.
+#ifndef CYG_HAL_GDB_LEAVE_CRITICAL_IO_REGION
+#define CYG_HAL_GDB_LEAVE_CRITICAL_IO_REGION( _old_ ) \
+do { \
+ cyg_hal_gdb_remove_break( (target_register_t)&&cyg_hal_gdb_break_place ); \
+ HAL_RESTORE_INTERRUPTS(_old_); \
+ _old_ = 1; /* actually use the label as a label... */ \
+cyg_hal_gdb_break_place:; \
+ if ( (_old_)-- > 0 ) /* ...or the compiler might move it! */ \
+ goto cyg_hal_gdb_break_place; \
+} while ( 0 )
+#endif
+
+#else // use __builtin_return_address instead.
+
+#define CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION( _old_ ) \
+do { \
+ HAL_DISABLE_INTERRUPTS(_old_); \
+ cyg_hal_gdb_place_break((target_register_t)__builtin_return_address(0)); \
+} while ( 0 )
+
+#define CYG_HAL_GDB_LEAVE_CRITICAL_IO_REGION( _old_ ) \
+do { \
+ cyg_hal_gdb_remove_break((target_register_t)__builtin_return_address(0)); \
+ HAL_RESTORE_INTERRUPTS(_old_); \
+} while ( 0 )
+
+#endif
+
+#else // NO debug_gdb_break_support
+
+// so define these just to do interrupts:
+#define CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION( _old_ ) \
+do { \
+ HAL_DISABLE_INTERRUPTS(_old_); \
+} while (0);
+
+#define CYG_HAL_GDB_LEAVE_CRITICAL_IO_REGION( _old_ ) \
+do { \
+ HAL_RESTORE_INTERRUPTS(_old_); \
+} while (0);
+
+#endif
+
+//----------------------------------------------------------------------------
+// eCos extensions to the stub
+
+extern void hal_output_gdb_string(target_register_t str, int string_len);
+
+extern target_register_t registers[]; // The current saved registers.
+extern target_register_t * _registers ;
+extern HAL_SavedRegisters *_hal_registers;
+
+extern int cyg_hal_gdb_break;
+
+#ifdef CYGPKG_ISOINFRA
+# include <pkgconf/isoinfra.h>
+#endif
+#ifdef CYGINT_ISO_STRING_STRFUNCS
+# include <string.h>
+#else
+//-----------------------------------------------------------------------------
+// String helpers. These really should come from ISOINFRA
+static inline char *strcpy( char *s, const char *t)
+{
+ char *r = s;
+
+ while( *t ) *s++ = *t++;
+
+ // Terminate the copied string.
+ *s = 0;
+
+ return r;
+}
+
+static inline size_t strlen( const char *s )
+{
+ int r = 0;
+ while( *s++ ) r++;
+ return r;
+}
+#endif
+
+//-----------------------------------------------------------------------------
+// Repeat the cache definitions here to avoid too much hackery in
+// generic-stub.h
+/* Flush the instruction cache. */
+extern void flush_i_cache (void);
+
+/* Flush the data cache. */
+extern void __flush_d_cache (void);
+
+typedef enum {
+ CACHE_NOOP, CACHE_ENABLE, CACHE_DISABLE, CACHE_FLUSH
+} cache_control_t;
+
+/* Perform the specified operation on the instruction cache.
+ Returns 1 if the cache is enabled, 0 otherwise. */
+extern int __instruction_cache (cache_control_t request);
+/* Perform the specified operation on the data cache.
+ Returns 1 if the cache is enabled, 0 otherwise. */
+extern int __data_cache (cache_control_t request);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
+
+//-----------------------------------------------------------------------------
+#endif // CYGONCE_HAL_HAL_STUB_H
+// End of hal_stub.h
diff --git a/cesar/ecos/packages/hal/common/current/include/hal_tables.h b/cesar/ecos/packages/hal/common/current/include/hal_tables.h
new file mode 100644
index 0000000000..3a1a05a7b0
--- /dev/null
+++ b/cesar/ecos/packages/hal/common/current/include/hal_tables.h
@@ -0,0 +1,117 @@
+#ifndef CYGONCE_HAL_TABLES_H
+#define CYGONCE_HAL_TABLES_H
+
+/*==========================================================================
+//
+// hal_tables.h
+//
+// Data table management
+//
+//==========================================================================
+//####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
+// Date: 2000-09-04
+// Purpose: Provide HAL tables
+// Description: This file defines a mechanism to include "tables" of objects
+// that are always included in the image no matter what, and are
+// constrained between labels.
+//
+// Usage: #include <cyg/hal/hal_tables.h>
+//
+//####DESCRIPTIONEND####
+//
+//========================================================================*/
+
+#include <pkgconf/hal.h>
+#include <cyg/infra/cyg_type.h>
+
+#include <cyg/hal/hal_arch.h>
+
+/*------------------------------------------------------------------------*/
+
+#define __string(_x) #_x
+#define __xstring(_x) __string(_x)
+
+#ifndef CYG_HAL_TABLE_BEGIN
+#define CYG_HAL_TABLE_BEGIN( _label, _name ) \
+__asm__(".section \".ecos.table." __xstring(_name) ".begin\",\"aw\"\n" \
+ ".globl " __xstring(CYG_LABEL_DEFN(_label)) "\n" \
+ ".type " __xstring(CYG_LABEL_DEFN(_label)) ",object\n" \
+ ".p2align " __xstring(CYGARC_P2ALIGNMENT) "\n" \
+__xstring(CYG_LABEL_DEFN(_label)) ":\n" \
+ ".previous\n" \
+ )
+#endif
+
+#ifndef CYG_HAL_TABLE_END
+#define CYG_HAL_TABLE_END( _label, _name ) \
+__asm__(".section \".ecos.table." __xstring(_name) ".finish\",\"aw\"\n" \
+ ".globl " __xstring(CYG_LABEL_DEFN(_label)) "\n" \
+ ".type " __xstring(CYG_LABEL_DEFN(_label)) ",object\n" \
+ ".p2align " __xstring(CYGARC_P2ALIGNMENT) "\n" \
+__xstring(CYG_LABEL_DEFN(_label)) ":\n" \
+ ".previous\n" \
+ )
+#endif
+
+// This macro must be applied to any types whose objects are to be placed in
+// tables
+#ifndef CYG_HAL_TABLE_TYPE
+#define CYG_HAL_TABLE_TYPE CYGBLD_ATTRIB_ALIGN( CYGARC_ALIGNMENT )
+#endif
+
+#ifndef CYG_HAL_TABLE_EXTRA
+#define CYG_HAL_TABLE_EXTRA( _name ) \
+ CYGBLD_ATTRIB_SECTION(".ecos.table." __xstring(_name) ".extra")
+#endif
+
+#ifndef CYG_HAL_TABLE_ENTRY
+#define CYG_HAL_TABLE_ENTRY( _name ) \
+ CYGBLD_ATTRIB_SECTION(".ecos.table." __xstring(_name) ".data") \
+ CYGBLD_ATTRIB_USED
+#endif
+
+#ifndef CYG_HAL_TABLE_QUALIFIED_ENTRY
+#define CYG_HAL_TABLE_QUALIFIED_ENTRY( _name, _qual ) \
+ CYGBLD_ATTRIB_SECTION(".ecos.table." __xstring(_name) ".data." \
+ __xstring(_qual)) \
+ CYGBLD_ATTRIB_USED
+#endif
+
+/*------------------------------------------------------------------------*/
+/* EOF hal_tables.h */
+#endif // CYGONCE_HAL_TABLES_H