diff options
Diffstat (limited to 'c/src/lib')
161 files changed, 0 insertions, 25290 deletions
diff --git a/c/src/lib/include/rtems/assoc.h b/c/src/lib/include/rtems/assoc.h deleted file mode 100644 index 1982d654ac..0000000000 --- a/c/src/lib/include/rtems/assoc.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * - * Rtems associativity routines. Mainly used to convert a value from - * one space to another (eg: our errno's to host errno's and v.v) - * - * - * $Id$ - */ - -#ifndef _INCLUDE_ASSOC_H -#define _INCLUDE_ASSOC_H - -typedef struct { - const char *name; - unsigned32 local_value; - unsigned32 remote_value; -} rtems_assoc_t; - -/* - * Flag/marker for optional default value in each table - */ - -#define RTEMS_ASSOC_DEFAULT_NAME "(default)" - -const rtems_assoc_t *rtems_assoc_ptr_by_name(const rtems_assoc_t *, const char *); -const rtems_assoc_t *rtems_assoc_ptr_by_value(const rtems_assoc_t *, unsigned32); -const rtems_assoc_t *rtems_assoc_ptr_by_remote(const rtems_assoc_t *, unsigned32); - -unsigned32 rtems_assoc_remote_by_local(const rtems_assoc_t *, unsigned32); -unsigned32 rtems_assoc_local_by_remote(const rtems_assoc_t *, unsigned32); -unsigned32 rtems_assoc_remote_by_name(const rtems_assoc_t *, const char *); -unsigned32 rtems_assoc_local_by_name(const rtems_assoc_t *, const char *); -const char *rtems_assoc_name_by_local(const rtems_assoc_t *, unsigned32); -const char *rtems_assoc_name_by_remote(const rtems_assoc_t *, unsigned32); - -unsigned32 rtems_assoc_remote_by_local_bitfield(const rtems_assoc_t *, unsigned32); -char *rtems_assoc_name_by_local_bitfield(const rtems_assoc_t *, unsigned32, char *); -char *rtems_assoc_name_by_remote_bitfield(const rtems_assoc_t *, unsigned32, char *); -unsigned32 rtems_assoc_local_by_remote_bitfield(const rtems_assoc_t *, unsigned32); - - -#endif /* ! _INCLUDE_ASSOC_H */ diff --git a/c/src/lib/include/rtems/error.h b/c/src/lib/include/rtems/error.h deleted file mode 100644 index a0698afb5d..0000000000 --- a/c/src/lib/include/rtems/error.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Defines and externs for rtems error reporting - * - * $Id$ - */ - -#ifndef __RTEMS_ERROR_h -#define __RTEMS_ERROR_h - -/* - * rtems_error() and rtems_panic() support - */ - -#define RTEMS_ERROR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */ -#define RTEMS_ERROR_PANIC (RTEMS_ERROR_ERRNO / 2) /* err fatal; no return */ -#define RTEMS_ERROR_ABORT (RTEMS_ERROR_ERRNO / 4) /* err is fatal; panic */ - -#define RTEMS_ERROR_MASK (RTEMS_ERROR_ERRNO | RTEMS_ERROR_ABORT | \ - RTEMS_ERROR_PANIC) /* all */ - -const char *rtems_status_text(rtems_status_code); -int rtems_error(int error_code, const char *printf_format, ...); -#ifdef __GNUC__ -void rtems_panic(const char *printf_format, ...); -/* - * We should be able to use this attribute but gcc complains that - * rtems_panic does in fact return. :( - * - * __attribute__ ((__noreturn__)); - */ -#else -void rtems_panic(const char *printf_format, ...); -#endif - -extern int rtems_panic_in_progress; - -#endif -/* end of include file */ diff --git a/c/src/lib/include/rtems/libcsupport.h b/c/src/lib/include/rtems/libcsupport.h deleted file mode 100644 index d007784526..0000000000 --- a/c/src/lib/include/rtems/libcsupport.h +++ /dev/null @@ -1,43 +0,0 @@ -/* libcsupport.h - * - * This include file contains the information regarding the - * RTEMS specific support for the standard C library. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __LIBC_SUPPORT_h -#define __LIBC_SUPPORT_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include <sys/types.h> - -void RTEMS_Malloc_Initialize( - void *start, - size_t length, - size_t sbrk_amount -); - -extern void malloc_dump(void); -extern void malloc_walk(size_t source, size_t printf_enabled); -extern void libc_init(int reentrant); -extern int host_errno(void); -extern void fix_syscall_errno(void); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/c/src/lib/include/rtems/libio.h b/c/src/lib/include/rtems/libio.h deleted file mode 100644 index dcdda85aec..0000000000 --- a/c/src/lib/include/rtems/libio.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - * General purpose communication channel for RTEMS to allow UNIX/POSIX - * system call behavior on top of RTEMS IO devices. - * - * TODO - * stat(2) - * unlink(2) - * rename(2) - * - * $Id$ - */ - -#ifndef _RTEMS_LIBIO_H -#define _RTEMS_LIBIO_H - -#include <sys/stat.h> - -typedef unsigned32 rtems_libio_offset_t; - -/* - * An open file data structure, indexed by 'fd' - * TODO: - * should really have a separate per/file data structure that this - * points to (eg: size, offset, driver, pathname should be in that) - */ - -typedef struct { - rtems_driver_name_t *driver; - rtems_libio_offset_t size; /* size of file */ - rtems_libio_offset_t offset; /* current offset into the file */ - unsigned32 flags; - char *pathname; /* opened pathname */ - Objects_Id sem; - unsigned32 data0; /* private to "driver" */ - void *data1; /* ... */ -} rtems_libio_t; - - -/* - * param block for read/write - * Note: it must include 'offset' instead of using iop's offset since - * we can have multiple outstanding i/o's on a device. - */ - -typedef struct { - rtems_libio_t *iop; - rtems_libio_offset_t offset; - unsigned8 *buffer; - unsigned32 count; - unsigned32 flags; - unsigned32 bytes_moved; -} rtems_libio_rw_args_t; - -/* - * param block for open/close - */ - -typedef struct { - rtems_libio_t *iop; - unsigned32 flags; - unsigned32 mode; -} rtems_libio_open_close_args_t; - -/* - * param block for ioctl - */ - -typedef struct { - rtems_libio_t *iop; - unsigned32 command; - void *buffer; - unsigned32 ioctl_return; -} rtems_libio_ioctl_args_t; - - -/* - * Values for 'flag' - */ - -#define LIBIO_FLAGS_NO_DELAY 0x0001 /* return immediately if no data */ -#define LIBIO_FLAGS_READ 0x0002 /* reading */ -#define LIBIO_FLAGS_WRITE 0x0004 /* writing */ -#define LIBIO_FLAGS_LINE_BUFFERED 0x0008 /* line buffered io (^h, ^u, etc) */ -#define LIBIO_FLAGS_OPEN 0x0100 /* device is open */ -#define LIBIO_FLAGS_APPEND 0x0200 /* all writes append */ -#define LIBIO_FLAGS_CREATE 0x0400 /* create file */ - -#define LIBIO_FLAGS_READ_WRITE (LIBIO_FLAGS_READ | LIBIO_FLAGS_WRITE) - -void rtems_libio_init(void); - -int __rtems_open(const char *pathname, unsigned32 flag, unsigned32 mode); -int __rtems_close(int fd); -int __rtems_read(int fd, void *buffer, unsigned32 count); -int __rtems_write(int fd, const void *buffer, unsigned32 count); -int __rtems_ioctl(int fd, unsigned32 command, void *buffer); -int __rtems_lseek(int fd, rtems_libio_offset_t offset, int whence); -int __rtems_fstat(int _fd, struct stat* _sbuf); - -/* - * External I/O handlers - */ -typedef struct { - int (*open)(const char *pathname, unsigned32 flag, unsigned32 mode); - int (*close)(int fd); - int (*read)(int fd, void *buffer, unsigned32 count); - int (*write)(int fd, const void *buffer, unsigned32 count); - int (*ioctl)(int fd, unsigned32 command, void *buffer); - int (*lseek)(int fd, rtems_libio_offset_t offset, int whence); -} rtems_libio_handler_t; - -void rtems_register_libio_handler(int handler_flag, - const rtems_libio_handler_t *handler); - -#define RTEMS_FILE_DESCRIPTOR_TYPE_FILE 0x0000 -#define RTEMS_FILE_DESCRIPTOR_TYPE_SOCKET 0x1000 -#define rtems_make_file_descriptor(fd,flags) ((fd)|(flags)) -#define rtems_file_descriptor_base(fd) ((fd) & 0x0FFF) -#define rtems_file_descriptor_type(fd) ((fd) & 0xF000) -#define rtems_file_descriptor_type_index(fd) ((((fd) & 0xF000) >> 12) - 1) - -/* - * IOCTL values - */ - -#define RTEMS_IO_GET_ATTRIBUTES 1 -#define RTEMS_IO_SET_ATTRIBUTES 2 -#define RTEMS_IO_TCDRAIN 3 - -/* - * Callbacks from TERMIOS routines to device-dependent code - */ -#include <termios.h> -typedef struct rtems_termios_callbacks { - int (*firstOpen)(int major, int minor, void *arg); - int (*lastClose)(int major, int minor, void *arg); - int (*pollRead)(int minor); - int (*write)(int minor, const char *buf, int len); - int (*setAttributes)(int minor, const struct termios *t); - int (*stopRemoteTx)(int minor); - int (*startRemoteTx)(int minor); - int outputUsesInterrupts; -} rtems_termios_callbacks; - -/* - * Device-independent TERMIOS routines - */ -void rtems_termios_initialize (void); -rtems_status_code rtems_termios_open ( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg, - const rtems_termios_callbacks *callbacks - ); -rtems_status_code rtems_termios_close (void *arg); -rtems_status_code rtems_termios_read (void *arg); -rtems_status_code rtems_termios_write (void *arg); -rtems_status_code rtems_termios_ioctl (void *arg); -int rtems_termios_enqueue_raw_characters (void *ttyp, char *buf, int len); -int rtems_termios_dequeue_characters (void *ttyp, int len); -void rtems_termios_reserve_resources( - rtems_configuration_table *configuration, - rtems_unsigned32 number_of_devices -); - -#endif /* _RTEMS_LIBIO_H */ diff --git a/c/src/lib/include/sys/filio.h b/c/src/lib/include/sys/filio.h deleted file mode 100644 index b82a649c0f..0000000000 --- a/c/src/lib/include/sys/filio.h +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1990, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)filio.h 8.1 (Berkeley) 3/28/94 - * $Id$ - */ - -#ifndef _SYS_FILIO_H_ -#define _SYS_FILIO_H_ - -#include <sys/ioccom.h> - -/* Generic file-descriptor ioctl's. */ -#define FIOCLEX _IO('f', 1) /* set close on exec on fd */ -#define FIONCLEX _IO('f', 2) /* remove close on exec */ -#define FIONREAD _IOR('f', 127, int) /* get # bytes to read */ -#define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */ -#define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */ -#define FIOSETOWN _IOW('f', 124, int) /* set owner */ -#define FIOGETOWN _IOR('f', 123, int) /* get owner */ - -#endif /* !_SYS_FILIO_H_ */ diff --git a/c/src/lib/include/sys/ioctl.h b/c/src/lib/include/sys/ioctl.h deleted file mode 100644 index e3a69a5a7f..0000000000 --- a/c/src/lib/include/sys/ioctl.h +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1990, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ioctl.h 8.6 (Berkeley) 3/28/94 - * $Id$ - */ - -#ifndef _SYS_IOCTL_H_ -#define _SYS_IOCTL_H_ - -#include <sys/ttycom.h> - -/* - * Pun for SunOS prior to 3.2. SunOS 3.2 and later support TIOCGWINSZ - * and TIOCSWINSZ (yes, even 3.2-3.5, the fact that it wasn't documented - * notwithstanding). - */ -struct ttysize { - unsigned short ts_lines; - unsigned short ts_cols; - unsigned short ts_xxx; - unsigned short ts_yyy; -}; -#define TIOCGSIZE TIOCGWINSZ -#define TIOCSSIZE TIOCSWINSZ - -#include <sys/ioccom.h> - -#include <sys/filio.h> -#include <sys/sockio.h> - -#endif /* !_SYS_IOCTL_H_ */ - -/* - * Keep outside _SYS_IOCTL_H_ - * Compatibility with old terminal driver - * - * Source level -> #define USE_OLD_TTY - * Kernel level -> options COMPAT_43 or COMPAT_SUNOS - */ -#if defined(USE_OLD_TTY) || defined(COMPAT_43) || defined(COMPAT_SUNOS) -#include <sys/ioctl_compat.h> -#endif diff --git a/c/src/lib/include/sys/sockio.h b/c/src/lib/include/sys/sockio.h deleted file mode 100644 index 020061170f..0000000000 --- a/c/src/lib/include/sys/sockio.h +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1990, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)sockio.h 8.1 (Berkeley) 3/28/94 - * $Id$ - */ - -#ifndef _SYS_SOCKIO_H_ -#define _SYS_SOCKIO_H_ - -#include <sys/ioccom.h> - -/* Socket ioctl's. */ -#define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */ -#define SIOCGHIWAT _IOR('s', 1, int) /* get high watermark */ -#define SIOCSLOWAT _IOW('s', 2, int) /* set low watermark */ -#define SIOCGLOWAT _IOR('s', 3, int) /* get low watermark */ -#define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */ -#define SIOCSPGRP _IOW('s', 8, int) /* set process group */ -#define SIOCGPGRP _IOR('s', 9, int) /* get process group */ - -#define SIOCADDRT _IOW('r', 10, struct ortentry) /* add route */ -#define SIOCDELRT _IOW('r', 11, struct ortentry) /* delete route */ -#define SIOCGETVIFCNT _IOWR('r', 15, struct sioc_vif_req)/* get vif pkt cnt */ -#define SIOCGETSGCNT _IOWR('r', 16, struct sioc_sg_req) /* get s,g pkt cnt */ - -#define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */ -#define OSIOCGIFADDR _IOWR('i', 13, struct ifreq) /* get ifnet address */ -#define SIOCGIFADDR _IOWR('i', 33, struct ifreq) /* get ifnet address */ -#define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */ -#define OSIOCGIFDSTADDR _IOWR('i', 15, struct ifreq) /* get p-p address */ -#define SIOCGIFDSTADDR _IOWR('i', 34, struct ifreq) /* get p-p address */ -#define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */ -#define SIOCGIFFLAGS _IOWR('i', 17, struct ifreq) /* get ifnet flags */ -#define OSIOCGIFBRDADDR _IOWR('i', 18, struct ifreq) /* get broadcast addr */ -#define SIOCGIFBRDADDR _IOWR('i', 35, struct ifreq) /* get broadcast addr */ -#define SIOCSIFBRDADDR _IOW('i', 19, struct ifreq) /* set broadcast addr */ -#define OSIOCGIFCONF _IOWR('i', 20, struct ifconf) /* get ifnet list */ -#define SIOCGIFCONF _IOWR('i', 36, struct ifconf) /* get ifnet list */ -#define OSIOCGIFNETMASK _IOWR('i', 21, struct ifreq) /* get net addr mask */ -#define SIOCGIFNETMASK _IOWR('i', 37, struct ifreq) /* get net addr mask */ -#define SIOCSIFNETMASK _IOW('i', 22, struct ifreq) /* set net addr mask */ -#define SIOCGIFMETRIC _IOWR('i', 23, struct ifreq) /* get IF metric */ -#define SIOCSIFMETRIC _IOW('i', 24, struct ifreq) /* set IF metric */ -#define SIOCDIFADDR _IOW('i', 25, struct ifreq) /* delete IF addr */ -#define SIOCAIFADDR _IOW('i', 26, struct ifaliasreq)/* add/chg IF alias */ - -#define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* add m'cast addr */ -#define SIOCDELMULTI _IOW('i', 50, struct ifreq) /* del m'cast addr */ -#define SIOCGIFMTU _IOWR('i', 51, struct ifreq) /* get IF mtu */ -#define SIOCSIFMTU _IOW('i', 52, struct ifreq) /* set IF mtu */ -#define SIOCGIFPHYS _IOWR('i', 53, struct ifreq) /* get IF wire */ -#define SIOCSIFPHYS _IOW('i', 54, struct ifreq) /* set IF wire */ -#define SIOCSIFMEDIA _IOWR('i', 55, struct ifreq) /* set net media */ -#define SIOCGIFMEDIA _IOWR('i', 56, struct ifmediareq) /* get net media */ - -#endif /* !_SYS_SOCKIO_H_ */ diff --git a/c/src/lib/include/sys/utsname.h b/c/src/lib/include/sys/utsname.h deleted file mode 100644 index ca15230d40..0000000000 --- a/c/src/lib/include/sys/utsname.h +++ /dev/null @@ -1,49 +0,0 @@ -/* sys/utsname.h - * - * $Id$ - */ - -#ifndef __POSIX_SYS_UTSNAME_h -#define __POSIX_SYS_UTSNAME_h - -#include <sys/times.h> -#include <sys/types.h> - -/* - * 4.4.1 Get System Name (Table 4-1), P1003.1b-1993, p. 90 - * - * NOTE: The lengths of the strings in this structure are - * just long enough to reliably contain the RTEMS information. - * For example, the fields are not long enough to support - * Internet hostnames. - */ - -struct utsname { - char sysname[ 32 ]; /* Name of this implementation of the operating system */ - char nodename[ 32 ]; /* Name of this node within an implementation */ - /* specified communication network */ - char release[ 32 ]; /* Current release level of this implementation */ - char version[ 32 ]; /* Current version level of this release */ - char machine[ 32 ]; /* Name of the hardware type on which the system */ - /* is running */ -}; - -/* - * 4.4.1 Get System Name, P1003.1b-1993, p. 90 - */ - -int uname( - struct utsname *name -); - -/* - * 4.5.2 Get Process Times, P1003.1b-1993, p. 92 - */ - -clock_t times( - struct tms *buffer -); - -#endif -/* end of include file */ - diff --git a/c/src/lib/libbsp/a29k/portsw/start/Makefile.in b/c/src/lib/libbsp/a29k/portsw/start/Makefile.in deleted file mode 100644 index f89c5a7e6f..0000000000 --- a/c/src/lib/libbsp/a29k/portsw/start/Makefile.in +++ /dev/null @@ -1,54 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -# C source names, if any, go here -- minus the .c -C_PIECES= -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -# Assembly source names, if any, go here -- minus the .s -S_PIECES=crt0 register -S_FILES=$(S_PIECES:%=%.s) -S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o) - -SRCS=$(C_FILES) $(CC_FILES) $(H_FILES) $(S_FILES) -OBJS=$(C_O_FILES) $(CC_O_FILES) $(S_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -PGM=${ARCH}/crt0.o ${ARCH}/register.o - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -all: ${ARCH} $(SRCS) $(OBJS) $(PGM) - $(INSTALL_VARIANT) -m 555 ${PGM} ${PROJECT_RELEASE}/lib diff --git a/c/src/lib/libbsp/a29k/portsw/start/amd.ah b/c/src/lib/libbsp/a29k/portsw/start/amd.ah deleted file mode 100644 index 69f34f173e..0000000000 --- a/c/src/lib/libbsp/a29k/portsw/start/amd.ah +++ /dev/null @@ -1,517 +0,0 @@ -; /* @(#)amd.ah 1.1 96/05/23 08:56:58, TEI */ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; Initialization values for registers after RESET -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; /* $Id$ */ -; -;* File information and includes. - - .file "amd.ah" - .ident "@(#)amd.ah 1.1 96/05/23 08:56:58, TEI" - - - -; -;* AMD PROCESSOR SPECIFIC VALUES... -; - -; -;* Processor revision levels... -; - -; PRL values: 31-28 27-24 -; Am29000 0 x -; Am29005 1 x -; Am29050 2 x -; Am29035 3 x -; Am29030 4 x -; Am29200 5 x -; Am29205 5 1x -; Am29240 6 0 -; Manx 7 0 -; Cougar 8 0 - - - .equ AM29000_PRL, 0x00 - - .equ AM29005_PRL, 0x10 - - .equ AM29050_PRL, 0x20 - - .equ AM29035_PRL, 0x30 - - .equ AM29030_PRL, 0x40 - - .equ AM29200_PRL, 0x50 - - .equ AM29205_PRL, 0x58 - - .equ AM29240_PRL, 0x60 - - .equ AM29040_PRL, 0x70 - - .equ MANX_PRL, 0x70 - - .equ COUGAR_PRL, 0x80 - -; -;* data structures sizes. -; - .equ CFGINFO_SIZE, 16*4 - - .equ PGMINFO_SIZE, 16*4 - - .equ VARARGS_SPACE, 16*4 - - .equ WINDOWSIZE, 0x80 -; -;* Am29027 Mode registers -; - - .equ Am29027Mode1, 0x0fc00820 - - .equ Am29027Mode2, 0x00001375 - - - -;* Processor Based Equates and Defines - - .equ SIG_SYNC, -1 - - .equ ENABLE, (SM) - - .equ DISABLE, (ENABLE | DI | DA) - - .equ DISABLE_FZ, (FZ | ENABLE | DI | DA) - - .equ CLR_TRAP, (FZ | DA) - - .equ InitOPS, (TD | SM | (3<<IMShift) | DI | DA) - - .equ InitCPS, (TD | SM | (0<<IMShift) | DI | DA) - - .equ InitCPS1, (TD | SM | (0<<IMShift) | DI ) - - .equ CPS_TMR, (SM | (0<<IMShift) | DI) - - .equ CPS_INT0, (TD | SM | (0<<IMShift)) - - .equ CPS_TMRINT0, (SM | (0<<IMShift)) - - .equ InitCFG, 0x0 - - .equ InitRBP, (B0|B1|B2|B3|B4|B5) - - .equ TMC_VALUE, 0xFFFFFF - - .equ TMR_VALUE, (IE | TMC_VALUE) - - - - - - -;* 29205 specific (internal) peripheral initialization constants. - -; Current Processor Status (CPS) Register. -; Old Processor Status Register (OPS). - - .equ DA, 0x00001 - .equ DI, 0x00002 - .equ IMShift,0x2 - .equ SM, 0x00010 - .equ PI, 0x00020 - .equ PD, 0x00040 - .equ WM, 0x00080 - .equ RE, 0x00100 - .equ LK, 0x00200 - .equ FZ, 0x00400 - .equ TU, 0x00800 - .equ TP, 0x01000 - .equ TE, 0x02000 - .equ IP, 0x04000 - .equ CA, 0x08000 - .equ MM, 0x10000 - .equ TD, 0x20000 - -; Configuration Register (CFG) - - .equ CD, 0x01 - .equ CP, 0x02 - .equ BO, 0x04 - .equ RV, 0x08 - .equ VF, 0x10 - .equ DW, 0x20 - .equ CO, 0x40 - .equ EE, 0x80 - .equ IDShift, 8 - .equ CFG_ID, 0x100 - .equ ILShift, 9 - .equ CFG_ILMask, 0x600 - .equ DDShift, 11 - .equ CFG_DD, 0x800 - .equ DLShift, 12 - .equ CFG_DLMask, 0x3000 - .equ PCEShift, 14 - .equ CFG_PCE, 0x4000 - .equ PMBShift, 16 - .equ D16, 0x8000 - .equ TBOShift, 23 - .equ PRLShift, 24 - -; Channel Control Register (CHC) - - .equ CV, 0x1 - .equ NN, 0x2 - .equ TRShift, 2 - .equ TF, 0x400 - .equ PER, 0x800 - .equ LA, 0x1000 - .equ ST, 0x2000 - .equ ML, 0x4000 - .equ LS, 0x8000 - .equ CRShift, 16 - .equ CNTLShift, 24 - .equ CEShift, 31 - .equ WBERShift, 31 - -; Register Bank Protect (RBP) - .equ B0, 0x1 - .equ B1, 0x2 - .equ B2, 0x4 - .equ B3, 0x8 - .equ B4, 0x10 - .equ B5, 0x20 - .equ B6, 0x40 - .equ B7, 0x80 - .equ B8, 0x100 - .equ B9, 0x200 - .equ B10, 0x400 - .equ B11, 0x800 - .equ B12, 0x1000 - .equ B13, 0x2000 - .equ B14, 0x4000 - .equ B15, 0x8000 - -; Timer Counter - - .equ TCVMask, 0xffffff - -; Timer Reload Register - - .equ IE, 0x1000000 - .equ IN, 0x2000000 - .equ OV, 0x4000000 - .equ TRVMAsk, 0xffffff - -; MMU Configuration - - .equ PSShift, 8 - .equ PS0Shift, 8 - .equ PS1Shift, 12 - -; LRU Recommendation (LRU) - .equ LRUMask, 0xff - -; Reason Vector (RSN) - .equ RSNMask, 0xff - -; Region Mapping Address (RMA0 | RMA1) - .equ PBAMask,0xffff - .equ VBAShift, 16 - -; Region Mapping Control (RMC0 | RMC1) - .equ TIDMask, 0xff - .equ RMC_UE, 0x100 - .equ RMC_UW, 0x200 - .equ RMC_UR, 0x400 - .equ RMC_SE, 0x800 - .equ RMC_SW, 0x1000 - .equ RMC_SR, 0x2000 - .equ RMC_VE, 0x4000 - .equ RMC_IO, 0x10000 - .equ RGSShift, 17 - .equ RMC_PGMShift, 22 - -; Instruction breakpoint Control (IBC0 | IBC1) - .equ BPIDMask, 0xff - .equ BTE, 0x100 - .equ BRM, 0x200 - .equ IBC_BSY, 0x400 - .equ BEN, 0x800 - .equ BHO, 0x1000 - -; Cache Data Register (CDR) - .equ CDR_US, 0x1 - .equ P, 0x2 - .equ CDR_V, 0x4 - .equ IATAGShift, 20 - -; Cache Interface Register (CIR) - .equ CPTRShift, 2 - .equ CIR_RW, 0x1000000 - .equ FSELShift, 28 - -; Indirect Pointer A, B, C (IPA, IPB, IPC) - .equ IPShift, 2 - -; ALU Status (ALU) - .equ FCMask, 0x1F - .equ BPShift, 5 - .equ C, 0x80 - .equ Z, 0x100 - .equ N, 0x200 - .equ ALU_V, 0x400 - .equ DF, 0x800 - -; Byte Pointer - .equ BPMask, 0x3 - -; Load/Store Count Remaining (CR) - .equ CRMask, 0xff - -; Floating Point Environment (FPE) - .equ NM, 0x1 - .equ RM, 0x2 - .equ VM, 0x4 - .equ UM, 0x8 - .equ XM, 0x10 - .equ DM, 0x20 - .equ FRMShift, 6 - .equ FF, 0x100 - .equ ACFShift, 9 - -; Integer Environment (INTE) - .equ MO, 0x1 - .equ DO, 0x2 - -; Floating Point Status (FPS) - .equ NS, 0x1 - .equ RS, 0x2 - .equ VS, 0x4 - .equ FPS_US, 0x8 - .equ XS, 0x10 - .equ DS, 0x20 - .equ NT, 0x100 - .equ RT, 0x200 - .equ VT, 0x400 - .equ UT, 0x800 - .equ XT, 0x1000 - .equ DT, 0x2000 - -; Exception Opcode (EXOP) - .equ IOPMask, 0xff - -; TLB Entry Word 0 -; .equ TIDMask, 0xff already defined above - .equ TLB_UE, 0x100 - .equ TLB_UW, 0x200 - .equ TLB_UR, 0x400 - .equ TLB_SE, 0x800 - .equ TLB_SW, 0x1000 - .equ TLB_SR, 0x2000 - .equ TLB_VE, 0x4000 - .equ VTAGShift, 15 - -; TLB Entry Word 1 - .equ TLB_IO, 0x1 - .equ U, 0x2 - .equ TLB_PGMShift, 6 - .equ RPNShift, 10 - -; Am29200 ROM Control bits. - .equ RMCT_DW0Shift, 29 - .equ RMCT_DW1Shift, 21 - .equ RMCT_DW2Shift, 13 - .equ RMCT_DW3Shift, 5 - -; Am29200 DRAM Control bits. - .equ DW3, (1<<18) - .equ DW2, (1<<22) - .equ DW1, (1<<26) - .equ DW0, (1<<30) - - ; Internal peripheral address assignments. - .equ RMCT, 0x80000000 - .equ RMCF, 0x80000004 - .equ DRCT, 0x80000008 - .equ DRCF, 0x8000000C - .equ DRM0, 0x80000010 - .equ DRM1, 0x80000014 - .equ DRM2, 0x80000018 - .equ DRM3, 0x8000001C - .equ PIACT0, 0x80000020 - .equ PIACT1, 0x80000020 - .equ ICT, 0x80000028 - .equ DMCT0, 0x80000030 - .equ DMAD0, 0x80000034 - .ifdef revA - .equ TAD0, 0x80000036 - .equ TCN0, 0x8000003A - .else - .equ TAD0, 0x80000070 ; default - .equ TCN0, 0x8000003C ; default - .endif - .equ DMCN0, 0x80000038 - .equ DMCT1, 0x80000040 - .equ DMAD1, 0x80000044 - .equ DMCN1, 0x80000048 - .equ SPCT, 0x80000080 - .equ SPST, 0x80000084 - .equ SPTH, 0x80000088 - .equ SPRB, 0x8000008C - .equ BAUD, 0x80000090 - .equ PPCT, 0x800000C0 - .equ PPST, 0x800000C1 - .equ PPDT, 0x800000C4 - .equ POCT, 0x800000D0 - .equ PIN, 0x800000D4 - .equ POUT, 0x800000D8 - .equ POEN, 0x800000DC - .equ VCT, 0x800000E0 - .equ TOP, 0x800000E4 - .equ SIDE, 0x800000E8 - .equ VDT, 0x800000EC - - ; Interrupt Controller Register bits. - .equ TXDI, (1<<5) - .equ RXDI, (1<<6) - .equ RXSI, (1<<7) - .equ PPI, (1<<11) - .equ DMA1I, (1<<13) - .equ DMA0I, (1<<14) - .equ IOPIMask, (0xFF<<16) - .equ VDI, (1<<27) - .equ ICT200_I, (TXDI|RXDI|RXSI|PPI|DMA1I|DMA0I|IOPIMask|VDI) - .equ ICT205_I, (TXDI|RXDI|RXSI|PPI|DMA1I|DMA0I|IOPIMask|VDI) - - ; Serial port Initialization bits - .equ NO_PARITY, 0 - - - ; SPST bits - .equ THREShift, 22 - -;* REGISTER Addresses - - .equ ROMCntlRegAddr, 0x80000000 - - .equ ROMCfgRegAddr, 0x80000004 - - .equ DRAMCntlRegAddr, 0x80000008 - - .equ DRAMCfgRegAddr, 0x8000000C - - .equ DRAMMap0RegAddr, 0x80000010 - - .equ DRAMMap1RegAddr, 0x80000014 - - .equ DRAMMap2RegAddr, 0x80000018 - - .equ DRAMMap3RegAddr, 0x8000001C - - .equ PIACntl0RegAddr, 0x80000020 - - .equ PIACntl1RegAddr, 0x80000024 - - .equ INTRCntlRegAddr, 0x80000028 - - .equ DMACntl0RegAddr, 0x80000030 - - .equ DMACntl1RegAddr, 0x80000040 - - .equ SERPortCntlRegAddr, 0x80000080 - - .equ SERPortStatRegAddr, 0x80000084 - - .equ SERPortTHLDRegAddr, 0x80000088 - - .equ SERPortRbufRegAddr, 0x8000008C - - .equ SERPortBaudRegAddr, 0x80000090 - - .equ PARPortCntlRegAddr, 0x800000C0 - - .equ PIOCntlRegAddr, 0x800000D0 - - .equ PIOInpRegAddr, 0x800000D4 - - .equ PIOOutRegAddr, 0x800000D8 - - .equ PIOOutEnaRegAddr, 0x800000DC - - .equ VCTCntlRegAddr, 0x800000E0 - -; -;* Control constants -; - -;* AM29030 Timer related constants. - - .equ TMR_IE, 0x01000000 - - .equ TMR_IN, 0x02000000 - - .equ TMR_OV, 0x04000000 - - .equ TMC_INITCNT, 1613 - -; -;* System initialization values. -; - - .equ __os_version, 0x0001 ; - - .equ STACKSize, 0x8000 ; - - .equ PGMExecMode, 0x0000 ; - - .equ TSTCK_OFST, 28 * 4 - - .equ CSTCK_OFST, 29 * 4 - - .equ TMSTCK_OFST, 30 * 4 - - .equ CMSTCK_OFST, 31 * 4 - - .equ CTXSW_OK, 0xA55A ; ctx switch ok - - .set NV_STARTOFST, 0x20 ; 32 bytes - - .set NV_BAUDOFST, 0x00 ; 00 bytes - - .set reg_cir, 29 - - .set reg_cdr, 30 - - .equ MSG_BUFSIZE, 0x1000 ; serial buffer size - - .equ ILLOPTRAP, 0 - - .equ UATRAP, 1 - - .equ PVTRAP, 5 - - .equ UITLBMISSTRAP, 8 - - .equ UDTLBMISSTRAP, 9 - - .equ TIMERTRAP, 14 - - .equ TRACETRAP, 15 - - .equ XLINXTRAP, 16 - - .equ SERIALTRAP, 17 - - .equ SLOWTMRTRAP, 18 - - .equ PORTTRAP, 19 - - .equ SVSCTRAP, 80 - - .equ SVSCTRAP1, 81 - - .equ V_CACHETRAP, 66 ; - - .equ V_SETSERVICE, 67 ; diff --git a/c/src/lib/libbsp/a29k/portsw/start/pswmacro.ah b/c/src/lib/libbsp/a29k/portsw/start/pswmacro.ah deleted file mode 100644 index a994719c58..0000000000 --- a/c/src/lib/libbsp/a29k/portsw/start/pswmacro.ah +++ /dev/null @@ -1,442 +0,0 @@ -; /* @(#)pswmacro.ah 1.1 96/05/23 08:56:58, TEI */ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; macros: Do_install and init_TLB -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; /* $Id$ */ - -;* File information and includes. - - .file "macro.ah" - .ident "@(#)pswmacro.ah 1.1 96/05/23 08:56:58, TEI" - - - .macro CONST32, RegName, RegValue - const RegName, RegValue - consth RegName, RegValue - .endm - - .macro CONSTX, RegName, RegValue - .if (RegValue) <= 0x0000ffff - const RegName, RegValue - .else - const RegName, RegValue - consth RegName, RegValue - .endif - .endm - - .macro PRODEV, RegName - srl RegName, RegName, 24 - .endm - -; -;* MACRO TO INSTALL VECTOR TABLE ENTRIES -; - -;* Assumes vector table address in v0 - - .macro _setvec, trapnum, trapaddr - mfsr v0, vab ; - const v2, trapnum ; - sll v1, v2, 2 ; - add v1, v1, v0 ; v0 has location of vector tab - - const v2, trapaddr ; - consth v2, trapaddr ; - store 0, 0, v2, v1 ; - nop ; - .endm - - .macro syscall, name - const tav, HIF_@name ; - asneq V_SYSCALL, gr1, gr1 ; - nop ; - nop ; - .endm - - - -;* MACRO TO INSTALL VECTOR TABLE ENTRIES - - .macro Do_Install, V_Number, V_Address - const lr4, V_Address - consth lr4, V_Address - const lr3, V_Number * 4 - consth lr3, V_Number * 4 - call lr0, V_Install - nop - .endm - - .macro Do_InstallX, V_Number, V_Address - const lr4, V_Address - consth lr4, V_Address - const lr3, V_Number * 4 - consth lr3, V_Number * 4 - call lr0, V_InstallX - nop - .endm - - - -; push a register onto the stack - .macro pushreg, reg, sp - sub sp, sp, 4 ; adjust stack pointer - store 0, 0, reg, sp ; push register - .endm - - .macro push, sp, reg - sub sp, sp, 4 - store 0, 0, reg, sp - .endm - -; pop the register from stack - .macro popreg, reg, sp - load 0, 0, reg, sp ; pop register - add sp, sp, 4 ; adjust stack pointer - .endm - .macro pop, reg, sp - load 0, 0, reg, sp - add sp, sp, 4 - .endm - -; push a special register onto stack - .macro pushspcl, spcl, tmpreg, sp - sub sp, sp, 4 ; adjust stack pointer - mfsr tmpreg, spcl ; get spcl reg - store 0, 0, tmpreg, sp ; push onto stack - .endm - - .macro pushsr, sp, reg, sreg - mfsr reg, sreg - sub sp, sp, 4 - store 0, 0, reg, sp - .endm - -; pop a special register from stack - .macro popspcl, spcl, tmpreg, sp - load 0, 0, tmpreg, sp ; pop from stack - add sp, sp, 4 ; adjust stack pointer - mtsr spcl, tmpreg ; set spcl reg - .endm - - .macro popsr, sreg, reg, sp - load 0, 0, reg, sp - add sp, sp, 4 - mtsr sreg, reg - .endm - -; -; save freeze mode registers on memory stack. -; - - .macro SaveFZState, tmp1, tmp2 - - ; save freeze mode registers. - - pushspcl pc0, tmp1, msp - pushspcl pc1, tmp1, msp - pushspcl alu, tmp1, msp - - pushspcl cha, tmp1, msp - pushspcl chd, tmp1, msp - pushspcl chc, tmp1, msp - - pushspcl ops, tmp1, msp - - ; turn freeze off - - const tmp2, FZ - mfsr tmp1, cps - andn tmp1, tmp1, tmp2 - mtsr cps, tmp1 - .endm - -; restore freeze mode registers from memory stack. - - .macro RestoreFZState, tmp1, tmp2 - - ; turn freeze on - - const tmp2, (FZ|DI|DA) - mfsr tmp1, cps - or tmp1, tmp1, tmp2 - mtsr cps, tmp1 - - ; restore freeze mode registers. - - popspcl ops, tmp1, msp - popspcl chc, tmp1, msp - popspcl chd, tmp1, msp - popspcl cha, tmp1, msp - popspcl alu, tmp1, msp - popspcl pc1, tmp1, msp - popspcl pc0, tmp1, msp - .endm - -; -;* -; - .equ WS, 512 ; window size - .equ RALLOC, 4 * 4 ; stack alloc for C - .equ SIGCTX_UM_SIZE, 40 * 4 ; - .equ SIGCTX_RFB, (38) * 4 ; user mode saved - .equ SIGCTX_SM_SIZE, 12 * 4 ; - .equ SIGCTX_SIG, (11)*4 + SIGCTX_UM_SIZE ; - .equ SIGCTX_GR1, (10)*4 + SIGCTX_UM_SIZE ; - .equ SIGCTX_RAB, (9)*4 + SIGCTX_UM_SIZE ; - .equ SIGCTX_PC0, (8)*4 + SIGCTX_UM_SIZE ; - .equ SIGCTX_PC1, (7)*4 + SIGCTX_UM_SIZE ; - .equ SIGCTX_PC2, (6)*4 + SIGCTX_UM_SIZE ; - .equ SIGCTX_CHC, (3)*4 + SIGCTX_UM_SIZE ; - .equ SIGCTX_OPS, (1)*4 + SIGCTX_UM_SIZE ; - .equ SIGCTX_TAV, (0)*4 + SIGCTX_UM_SIZE ; - - .macro sup_sv - add it2, trapreg, 0 ; transfer signal # - sub msp, msp, 4 ; - store 0, 0, it2, msp ; save signal number - sub msp, msp, 4 ; push gr1 - - store 0, 0, gr1, msp ; - sub msp, msp, 4 ; push rab - store 0, 0, rab, msp ; - const it0, WS ; Window size - - sub rab, rfb, it0 ; set rab = rfb-512 - pushsr msp, it0, PC0 ; save program counter0 - pushsr msp, it0, PC1 ; save program counter1 - pushsr msp, it0, PC2 ; save program counter2 - - pushsr msp, it0, CHA ; save channel address - pushsr msp, it0, CHD ; save channel data - pushsr msp, it0, CHC ; save channel control - pushsr msp, it0, ALU ; save alu - - pushsr msp, it0, OPS ; save ops - sub msp, msp, 4 ; - store 0, 0, tav, msp ; push tav - mtsrim chc, 0 ; no loadm/storem - - mfsr it0, ops ; get ops value - const it1, (TD | DI) ; disable interrupts - consth it1, (TD | DI) ; disable interrupts - or it0, it0, it1 ; set bits - - mtsr ops, it0 ; set new ops - const it0, sigcode ; signal handler - consth it0, sigcode ; signal handler - mtsr pc1, it0 ; store pc1 - - add it1, it0, 4 ; next addr - mtsr pc0, it1 ; store pc1 location - iret ; return - nop ; ALIGN - .endm - - .macro sig_return - mfsr it0, cps ; get processor status - const it1, FZ|DA ; Freeze + traps disable - or it0, it0, it1 ; to set FZ+DA - mtsr cps, it0 ; in freeze mode - - load 0, 0, tav, msp ; restore tav - add msp, msp, 4 ; - - popsr OPS,it0, msp ; - popsr ALU,it0, msp ; - popsr CHC,it0, msp ; - popsr CHD,it0, msp ; - - popsr CHA,it0, msp ; - popsr PC2,it0, msp ; - popsr PC1,it0, msp ; - popsr PC0,it0, msp ; - - load 0, 0, rab, msp ; - add msp, msp, 4 ; - load 0, 0, it0, msp ; - add gr1, it0, 0 ; pop rsp - - add msp, msp, 8 ; discount signal # - iret - .endm - - .macro repair_R_stack - add v0, msp, SIGCTX_GR1 ; interrupted gr1 - load 0, 0, v2, v0 ; - add v0, msp, SIGCTX_RFB ; - load 0, 0, v3, v0 ; interupted rfb - - const v1, WS ; - sub v1, v3, v1 ; rfb-512 - cpltu v0, v2, v1 ; test gr1 < rfb-512 - jmpf v0, $1 ; - - add gr1, rab, 0 ; - add v2, v1, 0 ; set LB = rfb-512 -$1: -;* if gr1 < rfb-512 yes LB = rfb-512 signalled during spill -;* if no, LB=gr1 interrupted cache < 126 registers - cpleu v0, v2, rfb ; test LB<=rfb - jmpf v0, $2 ; - nop ; - add v2, rfb, 0 ; -$2: - cpeq v0, v3, rfb ; fill rfb->'rfb - jmpt v0, $3 ; if rfb==rfb' - const tav, (0x80<<2) ; prepare for fill - or tav, tav, v2 ; - - mtsr IPA, tav ; IPA=LA<<2 - sub tav, v3, gr98 ; cache fill LA->rfb - srl tav, tav, 2 ; convert to words - sub tav, tav, 1 ; - - mtsr cr, tav ; - loadm 0, 0, gr0, v2 ; fill from LA->rfb -$3: - add rfb, v3, 0 ; move rfb upto 'rfb - sub rab, v1, 0 ; assign rab to rfb-512 - - add v0, msp, SIGCTX_GR1 ; - load 0, 0, v2, v0 ; v0 = interrupted gr1 - add gr1, v2, 0 ; move gr1 upto 'gr1 - nop ; - .endm - - .macro repair_regs - mtsrim cr, 29 - 1 ; to restore locals - loadm 0, 0, v0, msp ; - add msp, msp, 29*4 ; - popsr Q, tav, msp ; - - popsr IPC, tav, msp ; - popsr IPB, tav, msp ; - popsr IPA, tav, msp ; - pop FPStat3, msp ; floating point regs - - pop FPStat2, msp ; floating point regs - pop FPStat1, msp ; floating point regs - pop FPStat0, msp ; floating point regs - - add msp, msp, 3*4 ; R-stack repaired - .endm - -; -;*HIF related... -; - - - - -; send the message in bufaddr to Montip. - .macro SendMessageToMontip, bufaddr - const lr2, bufaddr -$1: - call lr0, _msg_send - consth lr2, bufaddr - cpeq gr96, gr96, 0 - jmpf gr96, $1 - const lr2, bufaddr - .endm - -; build a HIF_CALL message in bufaddr to send to montip. - .macro BuildHIFCALLMsg, bufaddr, tmp1, tmp2 - const tmp1, bufaddr - consth tmp1, bufaddr - const tmp2, HIF_CALL_MSGCODE - store 0, 0, tmp2, tmp1 ; msg code - add tmp1, tmp1, 4 - const tmp2, HIF_CALL_MSGLEN - store 0, 0, tmp2, tmp1 ; msg len - add tmp1, tmp1, 4 - store 0, 0, gr121, tmp1 ; service number - add tmp1, tmp1, 4 - store 0, 0, lr2, tmp1 ; lr2 - add tmp1, tmp1, 4 - store 0, 0, lr3, tmp1 ; lr3 - add tmp1, tmp1, 4 - store 0, 0, lr4, tmp1 ; lr4 - .endm - -; -;* -;* All the funky AMD style macros go in here...simply for -;* compatility -; -; - .macro IMPORT, symbol - .extern symbol - .endm - - .macro GLOBAL, symbol - .global symbol - .endm - - .macro USESECT, name, type - .sect name, type - .use name - .endm - - .macro SECTION, name, type - .sect name, type - .endm - - .macro FUNC, fname, lineno - .global fname -fname: - .endm - - .macro ENDFUNC, fname, lineno - .endm - -;*************************************LONG - .macro LONG, varname -varname: - .block 4 - .endm - -;*************************************UNSIGNED LONG - .macro ULONG, varname -varname: - .block 4 - .endm - -;*************************************SHORT - .macro SHORT, varname -varname: - .block 2 - .endm - -;*************************************CHAR - .macro CHAR, varname -varname: - .block 1 - .endm - -;*************************************LONGARRAY - .macro LONGARRAY, name, count -name: - .block count*4 - .endm - -;*************************************SHORTARRAY - - .macro SHORTARRAY, name, count -name: - .block count*2 - .endm - -;*************************************CHARARRAY - - .macro CHARARRAY, name, count -name: - .block count - .endm - - -;*************************************VOID_FPTR - - .macro VOID_FPTR, name -name: - .block 4 - .endm diff --git a/c/src/lib/libbsp/a29k/portsw/start/register.ah b/c/src/lib/libbsp/a29k/portsw/start/register.ah deleted file mode 100644 index 1dced5b043..0000000000 --- a/c/src/lib/libbsp/a29k/portsw/start/register.ah +++ /dev/null @@ -1,214 +0,0 @@ -; /* @(#)register.ah 1.1 96/05/23 08:56:57, TEI */ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; naming of various registers -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -; /* $Id$ */ - -;* File information and includes. - - .file "register.ah" - .ident "@(#)register.ah 1.1 96/05/23 08:56:57, TEI\n" - -;* Register Stack pointer and frame pointer registers. - - .extern Rrsp, Rfp - - .reg regsp, %%Rrsp - .reg fp, %%Rfp - - - .extern RTrapReg - .extern Rtrapreg - - .reg TrapReg, %%RTrapReg - .reg trapreg, %%Rtrapreg - - -;* Operating system Interrupt handler registers (gr64-gr67) - - .extern ROSint0, ROSint1, ROSint2, ROSint3 - - .reg OSint0, %%ROSint0 - .reg OSint1, %%ROSint1 - .reg OSint2, %%ROSint2 - .reg OSint3, %%ROSint3 - - .reg it0, %%ROSint0 - .reg it1, %%ROSint1 - .reg it2, %%ROSint2 - .reg it3, %%ROSint3 - - - -;* Operating system temporary (or scratch) registers (gr68-gr79) - - .extern ROStmp0, ROStmp1, ROStmp2, ROStmp3 - .extern ROStmp4, ROStmp5, ROStmp6, ROStmp7 - .extern ROStmp8, ROStmp9, ROStmp10, ROStmp11 - - .reg OStmp0, %%ROStmp0 - .reg OStmp1, %%ROStmp1 - .reg OStmp2, %%ROStmp2 - .reg OStmp3, %%ROStmp3 - - .reg OStmp4, %%ROStmp4 - .reg OStmp5, %%ROStmp5 - .reg OStmp6, %%ROStmp6 - .reg OStmp7, %%ROStmp7 - - .reg OStmp8, %%ROStmp8 - .reg OStmp9, %%ROStmp9 - .reg OStmp10, %%ROStmp10 - .reg OStmp11, %%ROStmp11 - - - .reg kt0, %%ROStmp0 - .reg kt1, %%ROStmp1 - .reg kt2, %%ROStmp2 - .reg kt3, %%ROStmp3 - - .reg kt4, %%ROStmp4 - .reg kt5, %%ROStmp5 - .reg kt6, %%ROStmp6 - .reg kt7, %%ROStmp7 - - .reg kt8, %%ROStmp8 - .reg kt9, %%ROStmp9 - .reg kt10, %%ROStmp10 - .reg kt11, %%ROStmp11 - - - .reg TempReg0, %%ROSint0 - .reg TempReg1, %%ROSint1 - .reg TempReg2, %%ROSint2 - .reg TempReg3, %%ROSint3 - - .reg TempReg4, %%ROStmp0 - .reg TempReg5, %%ROStmp1 - .reg TempReg6, %%ROStmp2 - .reg TempReg7, %%ROStmp3 - - .reg TempReg8, %%ROStmp4 - .reg TempReg9, %%ROStmp5 - .reg TempReg10, %%ROStmp6 - .reg TempReg11, %%ROStmp7 - - .reg TempReg12, %%ROStmp8 - .reg TempReg13, %%ROStmp9 - .reg TempReg14, %%ROStmp10 - .reg TempReg15, %%ROStmp11 - - -;* Assigned static registers - - .extern RSpillAddrReg, RFillAddrReg, RSignalAddrReg - .extern Rpcb, Retc - .extern RTimerExt, RTimerUtil, RLEDReg, RERRReg - .extern Ret0, Ret1, Ret2, Ret3, Ret4, Ret5, Ret6, Ret7, Reta, Retb - .extern Retx, Rety, Retz - - - .reg SpillAddrReg, %%RSpillAddrReg - .reg FillAddrReg, %%RFillAddrReg - .reg SignalAddrReg, %%RSignalAddrReg - .reg pcb, %%Rpcb - - .reg etx, %%Retx - .reg ety, %%Rety - .reg etz, %%Retz - .reg eta, %%Reta - - .reg etb, %%Retb - .reg etc, %%Retc - .reg TimerExt, %%RTimerExt - .reg TimerUtil, %%RTimerUtil - - .reg LEDReg, %%RLEDReg - .reg ERRReg, %%RERRReg - - - .reg et0, %%Ret0 - .reg et1, %%Ret1 - .reg et2, %%Ret2 - .reg et3, %%Ret3 - - .reg et4, %%Ret4 - .reg et5, %%Ret5 - .reg et6, %%Ret6 - .reg et7, %%Ret7 - -; - .equ SCB1REG_NUM, 88 - .reg SCB1REG_PTR, %%Ret0 - -; The floating point trap handlers need a few static registers - - .extern RFPStat0, RFPStat1, RFPStat2, RFPStat3 - .extern Rheapptr, RHeapPtr, RArgvPtr - - .reg FPStat0, %%RFPStat0 - .reg FPStat1, %%RFPStat1 - .reg FPStat2, %%RFPStat2 - .reg FPStat3, %%RFPStat3 - - .reg heapptr, %%Rheapptr - .reg HeapPtr, %%RHeapPtr - .reg ArgvPtr, %%RArgvPtr - - .extern RXLINXReg, RVMBCReg, RUARTReg, RETHERReg - - .reg XLINXReg, %%RXLINXReg - .reg VMBCReg, %%RVMBCReg - .reg UARTReg, %%RUARTReg - .reg ETHERReg, %%RXLINXReg - -;* Compiler and programmer registers. (gr96-gr127) - - .extern Rv0, Rv1, Rv2, Rv3, Rv4, Rv5, Rv6, Rv7, Rv8, Rv9 - .extern Rv10, Rv11, Rv12, Rv13, Rv14, Rv15 - - .reg v0, %%Rv0 - .reg v1, %%Rv1 - .reg v2, %%Rv2 - .reg v3, %%Rv3 - - .reg v4, %%Rv4 - .reg v5, %%Rv5 - .reg v6, %%Rv6 - .reg v7, %%Rv7 - - .reg v8, %%Rv8 - .reg v9, %%Rv9 - .reg v10, %%Rv10 - .reg v11, %%Rv11 - - .reg v12, %%Rv12 - .reg v13, %%Rv13 - .reg v14, %%Rv14 - .reg v15, %%Rv15 - - .extern Rtv0, Rtv1, Rtv2, Rtv3, Rtv4 - - .reg tv0, %%Rtv0 - .reg tv1, %%Rtv1 - .reg tv2, %%Rtv2 - .reg tv3, %%Rtv3 - .reg tv4, %%Rtv4 - -; **************************************************************************** -; For uatrap -; register definitions -- since this trap handler must allow for -; nested traps and interrupts such as TLB miss, protection violation, -; or Data Access Exception, and these trap handlers use the shared -; Temp registers, we must maintain our own that are safe over user- -; mode loads and stores. The following must be assigned global -; registers which are not used in INTR[0-3], TRAP[0-1], TLB miss, -; TLB protection violation, or data exception trap handlers. - -; .reg cha_cpy, OStmp4 ; copy of CHA -; .reg chd_cpy, OStmp5 ; copy of CHD -; .reg chc_cpy, OStmp6 ; copy of CHC -; .reg LTemp0, OStmp7 ; local temp 0 -; .reg LTemp1, OStmp8 ; local temp 1 - -; **************************************************************************** diff --git a/c/src/lib/libbsp/i386/shared/irq/idt.c b/c/src/lib/libbsp/i386/shared/irq/idt.c deleted file mode 100644 index 5f44bd0d2b..0000000000 --- a/c/src/lib/libbsp/i386/shared/irq/idt.c +++ /dev/null @@ -1,288 +0,0 @@ -/* - * cpu.c - This file contains implementation of C function to - * Instanciate IDT entries. More detailled information can be found - * on Intel site and more precisely in the following book : - * - * Pentium Processor familly - * Developper's Manual - * - * Volume 3 : Architecture and Programming Manual - * - * Copyright (C) 1998 Eric Valette (valette@crf.canon.fr) - * Canon Centre Recherche France. - * - * The license and distribution terms for this file may be - * found in found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include <libcpu/cpu.h> -#include <irq.h> - -static rtems_raw_irq_connect_data* raw_irq_table; -static rtems_raw_irq_connect_data default_raw_irq_entry; -static interrupt_gate_descriptor default_idt_entry; -static rtems_raw_irq_global_settings* local_settings; - -void create_interrupt_gate_descriptor (interrupt_gate_descriptor* idtEntry, - rtems_raw_irq_hdl hdl) -{ - idtEntry->low_offsets_bits = (((unsigned) hdl) & 0xffff); - idtEntry->segment_selector = i386_get_cs(); - idtEntry->fixed_value_bits = 0; - idtEntry->gate_type = 0xe; - idtEntry->privilege = 0; - idtEntry->present = 1; - idtEntry->high_offsets_bits = ((((unsigned) hdl) >> 16) & 0xffff); -} - -rtems_raw_irq_hdl get_hdl_from_vector(rtems_vector_offset index) -{ - rtems_raw_irq_hdl hdl; - interrupt_gate_descriptor* idt_entry_tbl; - unsigned limit; - - i386_get_info_from_IDTR (&idt_entry_tbl, &limit); - - /* Convert limit into number of entries */ - limit = (limit + 1) / sizeof(interrupt_gate_descriptor); - - if(index >= limit) { - return 0; - } - - * ((unsigned int*) &hdl) = (idt_entry_tbl[index].low_offsets_bits | - (idt_entry_tbl[index].high_offsets_bits << 16)); - return hdl; -} - -int i386_set_idt_entry (const rtems_raw_irq_connect_data* irq) -{ - interrupt_gate_descriptor* idt_entry_tbl; - unsigned limit; - unsigned int level; - - - i386_get_info_from_IDTR (&idt_entry_tbl, &limit); - - /* Convert limit into number of entries */ - limit = (limit + 1) / sizeof(interrupt_gate_descriptor); - - if (irq->idtIndex >= limit) { - return 0; - } - /* - * Check if default handler is actually connected. If not issue an error. - * You must first get the current handler via i386_get_current_idt_entry - * and then disconnect it using i386_delete_idt_entry. - * RATIONALE : to always have the same transition by forcing the user - * to get the previous handler before accepting to disconnect. - */ - if (get_hdl_from_vector(irq->idtIndex) != default_raw_irq_entry.hdl) { - return 0; - } - - _CPU_ISR_Disable(level); - - raw_irq_table [irq->idtIndex] = *irq; - create_interrupt_gate_descriptor (&idt_entry_tbl[irq->idtIndex], irq->hdl); - irq->on(irq); - - _CPU_ISR_Enable(level); - return 1; -} - -void _CPU_ISR_install_vector (unsigned vector, - void* hdl, - void** oldHdl) -{ - interrupt_gate_descriptor* idt_entry_tbl; - unsigned limit; - interrupt_gate_descriptor new; - unsigned int level; - - i386_get_info_from_IDTR (&idt_entry_tbl, &limit); - - /* Convert limit into number of entries */ - limit = (limit + 1) / sizeof(interrupt_gate_descriptor); - - if (vector >= limit) { - return; - } - _CPU_ISR_Disable(level) - * ((unsigned int *) oldHdl) = idt_entry_tbl[vector].low_offsets_bits | - (idt_entry_tbl[vector].high_offsets_bits << 16); - - create_interrupt_gate_descriptor(&new, hdl); - idt_entry_tbl[vector] = new; - - _CPU_ISR_Enable(level); -} - -int i386_get_current_idt_entry (rtems_raw_irq_connect_data* irq) -{ - interrupt_gate_descriptor* idt_entry_tbl; - unsigned limit; - - i386_get_info_from_IDTR (&idt_entry_tbl, &limit); - - /* Convert limit into number of entries */ - limit = (limit + 1) / sizeof(interrupt_gate_descriptor); - - if (irq->idtIndex >= limit) { - return 0; - } - raw_irq_table [irq->idtIndex].hdl = get_hdl_from_vector(irq->idtIndex); - - *irq = raw_irq_table [irq->idtIndex]; - - return 1; -} - -int i386_delete_idt_entry (const rtems_raw_irq_connect_data* irq) -{ - interrupt_gate_descriptor* idt_entry_tbl; - unsigned limit; - unsigned int level; - - i386_get_info_from_IDTR (&idt_entry_tbl, &limit); - - /* Convert limit into number of entries */ - limit = (limit + 1) / sizeof(interrupt_gate_descriptor); - - if (irq->idtIndex >= limit) { - return 0; - } - /* - * Check if handler passed is actually connected. If not issue an error. - * You must first get the current handler via i386_get_current_idt_entry - * and then disconnect it using i386_delete_idt_entry. - * RATIONALE : to always have the same transition by forcing the user - * to get the previous handler before accepting to disconnect. - */ - if (get_hdl_from_vector(irq->idtIndex) != irq->hdl){ - return 0; - } - _CPU_ISR_Disable(level); - - idt_entry_tbl[irq->idtIndex] = default_idt_entry; - - irq->off(irq); - - raw_irq_table[irq->idtIndex] = default_raw_irq_entry; - raw_irq_table[irq->idtIndex].idtIndex = irq->idtIndex; - - _CPU_ISR_Enable(level); - - return 1; -} - -/* - * Caution this function assumes the IDTR has been already set. - */ -int i386_init_idt (rtems_raw_irq_global_settings* config) -{ - unsigned limit; - unsigned i; - unsigned level; - interrupt_gate_descriptor* idt_entry_tbl; - - i386_get_info_from_IDTR (&idt_entry_tbl, &limit); - - /* Convert limit into number of entries */ - limit = (limit + 1) / sizeof(interrupt_gate_descriptor); - - if (config->idtSize != limit) { - return 0; - } - /* - * store various accelarators - */ - raw_irq_table = config->rawIrqHdlTbl; - local_settings = config; - default_raw_irq_entry = config->defaultRawEntry; - - _CPU_ISR_Disable(level); - - create_interrupt_gate_descriptor (&default_idt_entry, default_raw_irq_entry.hdl); - - for (i=0; i < limit; i++) { - interrupt_gate_descriptor new; - create_interrupt_gate_descriptor (&new, raw_irq_table[i].hdl); - idt_entry_tbl[i] = new; - if (raw_irq_table[i].hdl != default_raw_irq_entry.hdl) { - raw_irq_table[i].on(&raw_irq_table[i]); - } - else { - raw_irq_table[i].off(&raw_irq_table[i]); - } - } - _CPU_ISR_Enable(level); - - return 1; -} - -int i386_get_idt_config (rtems_raw_irq_global_settings** config) -{ - *config = local_settings; - return 1; -} - -/* - * Caution this function assumes the GDTR has been already set. - */ -int i386_set_gdt_entry (unsigned short segment_selector, unsigned base, - unsigned limit) -{ - unsigned gdt_limit; - unsigned short tmp_segment = 0; - unsigned int limit_adjusted; - segment_descriptors* gdt_entry_tbl; - - - i386_get_info_from_GDTR (&gdt_entry_tbl, &gdt_limit); - - if (segment_selector > limit) { - return 0; - } - /* - * set up limit first - */ - limit_adjusted = limit; - if ( limit > 4095 ) { - gdt_entry_tbl[segment_selector].granularity = 1; - limit_adjusted /= 4096; - } - gdt_entry_tbl[segment_selector].limit_15_0 = limit_adjusted & 0xffff; - gdt_entry_tbl[segment_selector].limit_19_16 = (limit_adjusted >> 16) & 0xf; - /* - * set up base - */ - gdt_entry_tbl[segment_selector].base_address_15_0 = base & 0xffff; - gdt_entry_tbl[segment_selector].base_address_23_16 = (base >> 16) & 0xff; - gdt_entry_tbl[segment_selector].base_address_31_24 = (base >> 24) & 0xff; - /* - * set up descriptor type (this may well becomes a parameter if needed) - */ - gdt_entry_tbl[segment_selector].type = 2; /* Data R/W */ - gdt_entry_tbl[segment_selector].descriptor_type = 1; /* Code or Data */ - gdt_entry_tbl[segment_selector].privilege = 0; /* ring 0 */ - gdt_entry_tbl[segment_selector].present = 1; /* not present */ - - /* - * Now, reload all segment registers so the limit takes effect. - */ - - asm volatile( "movw %%ds,%0 ; movw %0,%%ds - movw %%es,%0 ; movw %0,%%es - movw %%fs,%0 ; movw %0,%%fs - movw %%gs,%0 ; movw %0,%%gs - movw %%ss,%0 ; movw %0,%%ss" - : "=r" (tmp_segment) - : "0" (tmp_segment) - ); - - return 1; -} diff --git a/c/src/lib/libbsp/i960/cvme961/start/Makefile.in b/c/src/lib/libbsp/i960/cvme961/start/Makefile.in deleted file mode 100644 index 68dcd2196e..0000000000 --- a/c/src/lib/libbsp/i960/cvme961/start/Makefile.in +++ /dev/null @@ -1,54 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -# C source names, if any, go here -- minus the .c -C_PIECES= -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -# Assembly source names, if any, go here -- minus the .s -S_PIECES=start -S_FILES=$(S_PIECES:%=%.s) -S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o) - -SRCS=$(C_FILES) $(H_FILES) $(S_FILES) -OBJS=$(C_O_FILES) $(S_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -PGM=${ARCH}/start.o - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -all: ${ARCH} $(SRCS) $(OBJS) $(PGM) - $(INSTALL_VARIANT) -m 555 ${PGM} ${PROJECT_RELEASE}/lib diff --git a/c/src/lib/libbsp/m68k/efi332/start/Makefile.in b/c/src/lib/libbsp/m68k/efi332/start/Makefile.in deleted file mode 100644 index 2373aeca0b..0000000000 --- a/c/src/lib/libbsp/m68k/efi332/start/Makefile.in +++ /dev/null @@ -1,49 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -PGM=${ARCH}/start332.o - -# C source names, if any, go here -- minus the .c -C_PIECES=start332 -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -SRCS=$(C_FILES) $(H_FILES) -OBJS=$(C_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -all: ${ARCH} $(SRCS) $(OBJS) $(PGM) - $(INSTALL_VARIANT) -m 555 ${PGM} ${PROJECT_RELEASE}/lib diff --git a/c/src/lib/libbsp/m68k/efi332/start/start.c b/c/src/lib/libbsp/m68k/efi332/start/start.c deleted file mode 100644 index 05f8d75ce9..0000000000 --- a/c/src/lib/libbsp/m68k/efi332/start/start.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * $Id - */ - -#include <efi332.h> -#include <sim.h> -#define __START_C__ -#include "bsp.h" - -m68k_isr_entry M68Kvec[256]; -m68k_isr_entry vectors[256]; -char * const __argv[]= {"main", ""}; -char * const __env[]= {""}; - -/* - * This prototype really should have the noreturn attribute but - * that causes a warning since it appears that the routine does - * return. - * - * void dumby_start () __attribute__ ((noreturn)); - */ - -void dumby_start (); -void dumby_start() { -void boot_card(); - - /* We need to by-pass the link instruction since the RAM chip- - select pins are not yet configured. */ - asm volatile ( ".global start ; - start:"); - - /* disable interrupts, load stack pointer */ - asm volatile ( "oriw #0x0700, %sr; - moveal #M68Kvec, %a0; - movec %a0, %vbr; - movel #_end, %d0; - addl " STACK_SIZE ",%d0; - movel %d0,%sp; - link %a6, #0" - ); - - /* include in ram_init.S */ - /* - * Initalize the SIM module. - * The stack pointer is not usable until the RAM chip select lines - * are configured. The following code must remain inline. - */ - - /* Module Configuration Register */ - /* see section(s) 3.1.3-3.1.6 of the SIM Reference Manual */ - *SIMCR = (unsigned short int) - (FRZSW | FRZBM | SAM(0,8,SHEN) | (MM*SIM_MM) | SAM(SIM_IARB,0,IARB)); - - /* Synthesizer Control Register */ - /* see section(s) 4.8 */ - /* end include in ram_init.S */ - *SYNCR = (unsigned short int) - ( SAM(EFI_W,15,W) | SAM(0x0,14,X) | SAM(EFI_Y,8,Y) | STSIM ); - while (! (*SYNCR & SLOCK)); /* protect from clock overshoot */ - /* include in ram_init.S */ - *SYNCR = (unsigned short int) - ( SAM(EFI_W,15,W) | SAM(EFI_X,14,X) | SAM(EFI_Y,8,Y) | STSIM ); - - /* System Protection Control Register */ - /* !!! can only write to once after reset !!! */ - /* see section 3.8.4 of the SIM Reference Manual */ - *SYPCR = (unsigned char)( SAM(0x3,4,SWT) | HME | BME ); - - /* Periodic Interrupr Control Register */ - /* see section 3.8.2 of the SIM Reference Manual */ - *PICR = (unsigned short int) - ( SAM(0,8,PIRQL) | SAM(EFI_PIV,0,PIV) ); - /* ^^^ zero disables interrupt, don't enable here or ram_init will - be wrong. It's enabled below. */ - - /* Periodic Interrupt Timer Register */ - /* see section 3.8.3 of the SIM Reference Manual */ - *PITR = (unsigned short int)( SAM(0x09,0,PITM) ); - /* 1.098mS interrupt */ - - /* Port C Data */ - /* load values before enabled */ - *PORTC = (unsigned char) 0x0; - - /* Chip-Select Base Address Register */ - /* see section 7 of the SIM Reference Manual */ - *CSBARBT = (unsigned short int) - (((0x000000 >> 8)&0xfff8) | BS_512K ); /* 512k bytes located at 0x0000 */ - *CSBAR0 = (unsigned short int) - (((0x000000 >> 8)&0xfff8) | BS_1M ); /* 1M bytes located at 0x0000 */ - *CSBAR1 = (unsigned short int) - (((0x080000 >> 8)&0xfff8) | BS_256K ); /* 256k bytes located at 0x80000 */ - *CSBAR2 = (unsigned short int) - (((0x080000 >> 8)&0xfff8) | BS_256K ); /* 256 bytes located at 0x80000 */ - *CSBAR3 = (unsigned short int) - (0xfff8 | BS_64K); /* AVEC interrupts */ - *CSBAR10 = (unsigned short int) - (((0x000000 >> 8)&0xfff8) | BS_512K ); /* 512k bytes located at 0x0000 */ - - /* Chip-Select Options Registers */ - /* see section 7 of the SIM Reference Manual */ - *CSORBT = (unsigned short int) - ( BothBytes | ReadWrite | SyncAS | WaitStates_13 | UserSupSpace ); - *CSOR0 = (unsigned short int) - ( BothBytes | ReadOnly | SyncAS | External | UserSupSpace ); - *CSOR1 = (unsigned short int) - ( LowerByte | ReadWrite | SyncAS | FastTerm | UserSupSpace ); - *CSOR2 = (unsigned short int) - ( UpperByte | ReadWrite | SyncAS | FastTerm | UserSupSpace ); - *CSOR3 = (unsigned short int) - ( BothBytes | ReadWrite | SyncAS | CPUSpace | IPLevel_any | AVEC ); - *CSOR10 = (unsigned short int) - ( BothBytes | ReadOnly | SyncAS | External | UserSupSpace ); - - /* Chip Select Pin Assignment Register 0 */ - /* see section 7 of the SIM Reference Manual */ - *CSPAR0 = (unsigned short int)( - SAM(DisOut,CS_5,0x3000) | /* PC2 */ - SAM(DisOut,CS_4,0x0c00) | /* PC1 */ - SAM(DisOut,CS_3,0x0300) | /* AVEC (internally) */ - SAM(CS16bit,CS_2,0x00c0)| /* RAM UDS */ - SAM(CS16bit,CS_1,0x0030)| /* RAM LDS */ - SAM(CS16bit,CS_0,0x000c)| /* W/!R */ - SAM(CS16bit,CSBOOT,0x0003) /* ROM DS */ - ); - - /* Chip Select Pin Assignment Register 1 */ - /* see section 7 of the SIM Reference Manual */ - *CSPAR1 = (unsigned short int)( - SAM(CS16bit,CS_10,0x300)| /* ECLK */ - SAM(DisOut,CS_9,0x0c0) | /* PC6 */ - SAM(DisOut,CS_8,0x030) | /* PC5 */ - SAM(DisOut,CS_7,0x00c) | /* PC4 */ - SAM(DisOut,CS_6,0x003) /* PC3 */ - ); - - /* Port E and F Data Register */ - /* see section 9 of the SIM Reference Manual */ - *PORTE0 = (unsigned char) 0; - *PORTF0 = (unsigned char) 0; - - /* Port E and F Data Direction Register */ - /* see section 9 of the SIM Reference Manual */ - *DDRE = (unsigned char) 0xff; - *DDRF = (unsigned char) 0xfd; - - /* Port E and F Pin Assignment Register */ - /* see section 9 of the SIM Reference Manual */ - *PEPAR = (unsigned char) 0; - *PFPAR = (unsigned char) 0; - - /* end of SIM initalization code */ - /* end include in ram_init.S */ - - - - /* - * Initialize RAM by copying the .data section out of ROM (if - * needed) and "zero-ing" the .bss section. - */ - { - register char *src = _endtext; - register char *dst = _sdata; - - if (_copy_data_from_rom) - /* ROM has data at end of text; copy it. */ - while (dst < _edata) - *dst++ = *src++; - - /* Zero bss */ - for (dst = __bss_start; dst< _end; dst++) - *dst = 0; - } - - /* - * Initalize the board. - */ - Spurious_Initialize(); - console_init(); - - /* - * Execute main with arguments argv and environment env - */ - /* main(1, __argv, __env); */ - - boot_card(); - - reboot(); -} - -void reboot() {asm("trap #15");} - diff --git a/c/src/lib/libbsp/m68k/efi68k/start/Makefile.in b/c/src/lib/libbsp/m68k/efi68k/start/Makefile.in deleted file mode 100644 index ddd45a4c24..0000000000 --- a/c/src/lib/libbsp/m68k/efi68k/start/Makefile.in +++ /dev/null @@ -1,49 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -PGM=${ARCH}/start68k.o - -# C source names, if any, go here -- minus the .c -C_PIECES=start68k -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -SRCS=$(C_FILES) $(H_FILES) -OBJS=$(C_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -all: ${ARCH} $(SRCS) $(OBJS) $(PGM) - $(INSTALL_VARIANT) -m 555 ${PGM} ${PROJECT_RELEASE}/lib diff --git a/c/src/lib/libbsp/m68k/efi68k/start/start.c b/c/src/lib/libbsp/m68k/efi68k/start/start.c deleted file mode 100644 index f63381c57f..0000000000 --- a/c/src/lib/libbsp/m68k/efi68k/start/start.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * $Id$ - */ - -#include <efi68k.h> -#define __START_C__ -#include "bsp.h" - -m68k_isr_entry M68Kvec[256]; -m68k_isr_entry vectors[256]; -char * const __argv[]= {"main", ""}; -char * const __env[]= {""}; - -/* - * This prototype really should have the noreturn attribute but - * that causes a warning since it appears that the routine does - * return. - * - * void dumby_start () __attribute__ ((noreturn)); - */ - -void dumby_start (); -void dumby_start() { -void boot_card(); - - /* We need to by-pass the link instruction since the RAM chip- - select pins are not yet configured. */ - asm volatile ( ".global start ; - start:"); - - /* disable interrupts, load stack pointer */ - asm volatile ( "oriw #0x0700, %sr; - movel #_end, %d0; - addl " STACK_SIZE ",%d0; - movel %d0,%sp; - link %a6, #0" - ); - /* - * Initialize RAM by copying the .data section out of ROM (if - * needed) and "zero-ing" the .bss section. - */ - { - register char *src = _endtext; - register char *dst = _sdata; - - if (_copy_data_from_rom) - /* ROM has data at end of text; copy it. */ - while (dst < _edata) - *dst++ = *src++; - - /* Zero bss */ - for (dst = __bss_start; dst< _end; dst++) - *dst = 0; - } - - /* - * Initalize the board. - */ - Spurious_Initialize(); - console_init(); - watch_dog_init(); - tcp_init(); - - /* - * Execute main with arguments argv and environment env - */ - /* main(1, __argv, __env); */ - boot_card(); - - reboot(); -} diff --git a/c/src/lib/libbsp/m68k/gen68302/start/Makefile.in b/c/src/lib/libbsp/m68k/gen68302/start/Makefile.in deleted file mode 100644 index d96348b19d..0000000000 --- a/c/src/lib/libbsp/m68k/gen68302/start/Makefile.in +++ /dev/null @@ -1,57 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -PGMS=${ARCH}/start302.o - -# C source names, if any, go here -- minus the .c -C_PIECES= -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -# Assembly source names, if any, go here -- minus the .s -S_PIECES=start302 -S_FILES=$(S_PIECES:%=%.s) -S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o) - -SRCS=$(C_FILES) $(H_FILES) $(S_FILES) -OBJS=$(C_O_FILES) $(S_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -all: ${ARCH} $(SRCS) $(OBJS) $(PGM) - $(INSTALL_VARIANT) -m 555 ${PGMS} ${PROJECT_RELEASE}/lib - -# Install the program(s), appending _g or _p as appropriate. -# for include files, just use $(INSTALL) diff --git a/c/src/lib/libbsp/m68k/gen68302/start/start302.s b/c/src/lib/libbsp/m68k/gen68302/start/start302.s deleted file mode 100644 index 2a7c652c87..0000000000 --- a/c/src/lib/libbsp/m68k/gen68302/start/start302.s +++ /dev/null @@ -1,267 +0,0 @@ -/* entry.s - * - * This file contains the entry point for the application. - * The name of this entry point is compiler dependent. - * It jumps to the BSP which is responsible for performing - * all initialization. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include "asm.h" - - .set BAR, 0xF2 | Base Address Register location - .set SCR, 0xF4 | System Control Register location - .set BAR_VAL, 0x0f7f | BAR value - .set SCR_VAL, 0x00080f00 | SCR value - .set GIMR_VAL, 0x8780 |Global Interrupt Mode Register. (MUST BE WRITTEN). - .set BaseAddr,(BAR_VAL&0x0fff)<<12 | MC68302 internal base address - - .set oSYSRAM, 0x000 | 576 bytes of internal system RAM - - .set oGIMR, 0x812 - - .set oCS0_Base, 0x830 | 16 bits, Chip Sel 0 Base Reg - .set oCS0_Option, 0x832 | 16 bits, Chip Sel 0 Option Reg - .set oCS1_Base, 0x834 | 16 bits, Chip Sel 1 Base Reg - .set oCS1_Option, 0x836 | 16 bits, Chip Sel 1 Option Reg - .set oCS2_Base, 0x838 | 16 bits, Chip Sel 2 Base Reg - .set oCS2_Option, 0x83a | 16 bits, Chip Sel 2 Option Reg - .set oCS3_Base, 0x83c | 16 bits, Chip Sel 3 Base Reg - .set oCS3_Option, 0x83e | 16 bits, Chip Sel 3 Option Reg - - .set tmpSRAM_BASE, 0x400000 | start of temporary SRAM - .set FLASH_BASE, 0xc00000 | start of FLASH''s normal location - - -BEGIN_CODE - PUBLIC (M68Kvec) | Vector Table -SYM (M68Kvec): | standard location for vectors -V___ISSP: .long 0x00001000 |00 0 Reset: Initial SSP -V____IPC: .long SYM(start)-V___ISSP |04 1 Reset: Initial PC -V_BUSERR: .long Bad-V___ISSP |08 2 Bus Error -V_ADRERR: .long Bad-V___ISSP |0c 3 Address Error - .space 240 | reserve space for reset of vectors - -#if ( M68K_HAS_SEPARATE_STACKS == 1 ) -SYM (lowintstack): - .space 4092 | reserve for interrupt stack -SYM (hiintstack): - .space 4 | end of interrupt stack -#endif - - PUBLIC (start) | Default entry point for GNU -SYM (start): - move.w #0x2700,sr | Disable all interrupts - move.w #BAR_VAL,BAR | Set Base Address Register - move.l #SCR_VAL,SCR | Set System Control Register - lea BaseAddr,a5 - move.w #GIMR_VAL,a5@(oGIMR) | Set Global Interrupt Mode Register - -| -| Set up chip select registers for the remapping process. -| - -| -| 0 X x x x x -| 0 000 0 0-- - --- ---- ---- ---- -| x xxx x xxx x xx -| - move.w #0xc001,a5@(oCS0_Base) | Expand CS0 to full size (FLASH) - move.w #0x1f82,a5@(oCS0_Option) | 000000-03ffff, R, 0 WS - -| -| X x x x x x -| 0 100 0 0-- - --- ---- ---- ---- -| x xxx x xxx x xx -| - move.w #0xa801,a5@(oCS1_Base) | Set up and enable CS1 (SRAM) - move.w #0x1f80,a5@(oCS1_Option) | 400000-43ffff, RW, 0 WS - -| -| Copy the initial boot FLASH area to the temporary SRAM location. -| - moveq #0,d0 - movea.l d0,a0 | a0 -> start of FLASH - lea tmpSRAM_BASE,a1 | a1 -> start of tmp SRAM -| moveq #(endPreBoot-V___ISSP)/4,d0 | # longs to copy - moveq #127,d0 -cpy_flash: move.l (a0)+,(a1)+ | copy - subq.l #1,d0 - bne cpy_flash - -| -| Copy remap code to 68302''s internal system RAM. -| - movea.w #begRemap-V___ISSP,a0 | a0 -> remap code - lea a5@(oSYSRAM),a1 | a1 -> internal system RAM -| moveq #(endRemap-begRemap)/2-1,d0 | d0 = # words to copy - moveq #11,d0 -cpy_remap: move.w (a0)+,(a1)+ | copy - dbra d0,cpy_remap - -| -| Jump to the remap code in the 68302''s internal system RAM. -| - jmp a5@(oSYSRAM) | (effectively a jmp begRemap) - -| -| This remap code, when executed from the 68302''s internal system RAM -| will 1) remap CS1 so that SRAM is at 0 -| 2) remap CS0 so that FLASH is at FLASH_BASE -| and 3) jump to executable code in the remapped FLASH. -| -begRemap: move.w #0xa001,a5@(oCS1_Base) | Move CS1 (SRAM) - move.w #0xd801,a5@(oCS0_Base) | Move CS0 (FLASH) - lea FLASH_BASE,a0 - jmp a0@(endRemap-V___ISSP.w) | Jump back to FLASH -endRemap: -| -| Now set up the remaining chip select registers. -| - -| -| 4 0 x x x x -| 1 000 1 111 0 000 0--- ---- ---- -| x xxx x xxx x xx -| - move.w #0xb1e1,a5@(oCS2_Base) | Set up and enable CS2 (dpRAM) - move.w #0x1ff0,a5@(oCS2_Option) | 8f0000-8f07ff, RW, 0 WS - -| -| 8 X x x x x -| 1 000 0 0-- - --- ---- ---- ---- -| x xxx x xxx x xx -| - move.w #0xd001,a5@(oCS3_Base) | Set up and enable CS3 (IO) - move.w #0x1f80,a5@(oCS3_Option) | 800000-83ffff, RW, 0 WS - -endPreBoot: - - move.b #0x30,0x800001 | set status LED amber - - .set oPIOB_Ctrl, 0x824 - .set oPIOB_DDR, 0x826 - .set oPIOB_Data, 0x828 - - .set oPIOA_Ctrl, 0x81e - .set oPIOA_DDR, 0x820 - .set oPIOA_Data, 0x822 - - move.w #0x0ff8,a5@(oPIOB_Data) | Make output follow resistors. - move.w #0x00ff,a5@(oPIOB_DDR) | Set up PB7-PB0 for output. - move.w #0x0080,a5@(oPIOB_Ctrl) | Set up WDOG* as dedicated - | peripheral pins. - - move.w #0x1fff,a5@(oPIOA_Data) | Make output follow resistors. - move.w #0xea2a,a5@(oPIOA_DDR) | Set up PA15-PA0 for in/output. - move.w #0x0003,a5@(oPIOA_Ctrl) | Set up TXD2/RXD2 as dedicated - | peripheral pins. - -| -| Place "Bad" in all vectors from 010 thru 0ec. Vectors 0f0 and 0f4 -| are not set because they are the 68302''s BAR and SCR. -| - movea.w #0x010,a0 - moveq #(0x0f0-0x010)/4-1,d0 - move.l #Bad,d1 -cpy_Bad: move.l d1,(a0)+ - dbra d0,cpy_Bad - - .set vbase, 0x0200 - - lea vbase,a0 - moveq #31,d0 -cpy_Bad1: move.l d1,(a0)+ - dbra d0,cpy_Bad1 - -| -| Fill in special locations to configure OS -| - move.l #Bad,0x008 | Bus Error - move.l #Bad,0x00c | Address Error - move.l #Bad,0x024 | Trace -| move.l #KE_IRET,$0b4 | pSOS+ RET_I Call - -| move.l #_cnsl_isr,vbase+0x028 | SCC2 - move.l #timerisr,vbase+0x018 | Timer ISR - - | - | zero out uninitialized data area - | -zerobss: - moveal # SYM (end),a0 | find end of .bss - moveal # SYM (bss_start),a1 | find beginning of .bss - moveq #0,d0 - -loop: movel d0,a1@+ | to zero out uninitialized - cmpal a0,a1 - jlt loop | loop until _end reached - - movel # SYM (end),d0 | d0 = end of bss/start of heap - addl # SYM (heap_size),d0 | d0 = end of heap - movel d0, SYM (stack_start) | Save for brk() routine - addl # SYM (stack_size),d0 | make room for stack - andl #0xffffffc0,d0 | align it on 16 byte boundary - movw #0x3700,sr | SUPV MODE,INTERRUPTS OFF!!! - movel d0,a7 | set master stack pointer - movel d0,a6 | set base pointer - - /* - * RTEMS should maintain a separate interrupt stack on CPUs - * without one in hardware. This is currently not supported - * on versions of the m68k without a HW intr stack. - */ - -#if ( M68K_HAS_SEPARATE_STACKS == 1 ) - lea SYM (hiintstack),a0 | a0 = high end of intr stack - movec a0,isp | set interrupt stack -#endif - - move.l #0,a7@- | environp - move.l #0,a7@- | argv - move.l #0,a7@- | argc - jsr SYM (boot_card) - - nop -Bad: bra Bad - - nop -END_CODE - - -BEGIN_DATA - - PUBLIC (start_frame) -SYM (start_frame): - .space 4,0 - - PUBLIC (stack_start) -SYM (stack_start): - .space 4,0 -END_DATA - -BEGIN_BSS - - PUBLIC (environ) - .align 2 -SYM (environ): - .long 0 - - PUBLIC (heap_size) - .set SYM (heap_size),0x2000 - - PUBLIC (stack_size) - .set SYM (stack_size),0x1000 - - -END_DATA -END diff --git a/c/src/lib/libbsp/m68k/gen68340/start/Makefile.in b/c/src/lib/libbsp/m68k/gen68340/start/Makefile.in deleted file mode 100644 index ce91b95e3b..0000000000 --- a/c/src/lib/libbsp/m68k/gen68340/start/Makefile.in +++ /dev/null @@ -1,57 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -PGMS=${ARCH}/start340.o - -# C source names, if any, go here -- minus the .c -C_PIECES= -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -# Assembly source names, if any, go here -- minus the .s -S_PIECES=start340 -S_FILES=$(S_PIECES:%=%.s) -S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o) - -SRCS=$(C_FILES) $(H_FILES) $(S_FILES) -OBJS=$(C_O_FILES) $(S_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -all: ${ARCH} $(SRCS) $(OBJS) $(PGM) - $(INSTALL_VARIANT) -m 555 ${PGMS} ${PROJECT_RELEASE}/lib - -# Install the program(s), appending _g or _p as appropriate. -# for include files, just use $(INSTALL) diff --git a/c/src/lib/libbsp/m68k/gen68340/start/start340.s b/c/src/lib/libbsp/m68k/gen68340/start/start340.s deleted file mode 100644 index 58ea0c92d0..0000000000 --- a/c/src/lib/libbsp/m68k/gen68340/start/start340.s +++ /dev/null @@ -1,874 +0,0 @@ -/* - * This file contains the entry point for the application. - * The name of this entry point is compiler dependent. - * It jumps to the BSP which is responsible for performing - * all initialization. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may in - * the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * Based on the `gen68360' board support package, and covered by the - * original distribution terms. - * - * Geoffroy Montel - * France Telecom - CNET/DSM/TAM/CAT - * 4, rue du Clos Courtel - * 35512 CESSON-SEVIGNE - * FRANCE - * - * e-mail: g_montel@yahoo.com - * - * $Id$ - */ - -#include "asm.h" -#include <m68349.inc> - -#define _OLD_ASTECC 1 /* old addresses for AST68340 only, undefine for AST68349 */ - -BEGIN_CODE - /* - * Step 1: Decide on Reset Stack Pointer and Initial Program Counter - */ -Entry: - .long SYM(m340)+1024 | 0: Initial SSP - .long start | 1: Initial PC - .long SYM(_uhoh) | 2: Bus error - .long SYM(_uhoh) | 3: Address error - .long SYM(_uhoh) | 4: Illegal instruction - .long SYM(_uhoh) | 5: Zero division - .long SYM(_uhoh) | 6: CHK, CHK2 instruction - .long SYM(_uhoh) | 7: TRAPcc, TRAPV instructions - .long SYM(_uhoh) | 8: Privilege violation - .long SYM(_uhoh) | 9: Trace - .long SYM(_uhoh) | 10: Line 1010 emulator - .long SYM(_uhoh) | 11: Line 1111 emulator - .long SYM(_uhoh) | 12: Hardware breakpoint - .long SYM(_uhoh) | 13: Reserved for coprocessor violation - .long SYM(_uhoh) | 14: Format error - .long SYM(_uhoh) | 15: Uninitialized interrupt - .long SYM(_uhoh) | 16: Unassigned, reserved - .long SYM(_uhoh) | 17: - .long SYM(_uhoh) | 18: - .long SYM(_uhoh) | 19: - .long SYM(_uhoh) | 20: - .long SYM(_uhoh) | 21: - .long SYM(_uhoh) | 22: - .long SYM(_uhoh) | 23: - .long SYM(_spuriousInterrupt) | 24: Spurious interrupt - .long SYM(_uhoh) | 25: Level 1 interrupt autovector - .long SYM(_uhoh) | 26: Level 2 interrupt autovector - .long SYM(_uhoh) | 27: Level 3 interrupt autovector - .long SYM(_uhoh) | 28: Level 4 interrupt autovector - .long SYM(_uhoh) | 29: Level 5 interrupt autovector - .long SYM(_uhoh) | 30: Level 6 interrupt autovector - .long SYM(_uhoh) | 31: Level 7 interrupt autovector - .long SYM(_uhoh) | 32: Trap instruction (0-15) - .long SYM(_uhoh) | 33: - .long SYM(_uhoh) | 34: - .long SYM(_uhoh) | 35: - .long SYM(_uhoh) | 36: - .long SYM(_uhoh) | 37: - .long SYM(_uhoh) | 38: - .long SYM(_uhoh) | 39: - .long SYM(_uhoh) | 40: - .long SYM(_uhoh) | 41: - .long SYM(_uhoh) | 42: - .long SYM(_uhoh) | 43: - .long SYM(_uhoh) | 44: - .long SYM(_uhoh) | 45: - .long SYM(_uhoh) | 46: - .long SYM(_uhoh) | 47: - .long SYM(_uhoh) | 48: Reserved for coprocessor - .long SYM(_uhoh) | 49: - .long SYM(_uhoh) | 50: - .long SYM(_uhoh) | 51: - .long SYM(_uhoh) | 52: - .long SYM(_uhoh) | 53: - .long SYM(_uhoh) | 54: - .long SYM(_uhoh) | 55: - .long SYM(_uhoh) | 56: - .long SYM(_uhoh) | 57: - .long SYM(_uhoh) | 58: - .long SYM(_uhoh) | 59: Unassigned, reserved - .long SYM(_uhoh) | 60: - .long SYM(_uhoh) | 61: - .long SYM(_uhoh) | 62: - .long SYM(_uhoh) | 63: - .long SYM(_uhoh) | 64: User defined vectors (192) - .long SYM(_uhoh) | 65: - .long SYM(_uhoh) | 66: - .long SYM(_uhoh) | 67: - .long SYM(_uhoh) | 68: - .long SYM(_uhoh) | 69: - .long SYM(_uhoh) | 70: - .long SYM(_uhoh) | 71: - .long SYM(_uhoh) | 72: - .long SYM(_uhoh) | 73: - .long SYM(_uhoh) | 74: - .long SYM(_uhoh) | 75: - .long SYM(_uhoh) | 76: - .long SYM(_uhoh) | 77: - .long SYM(_uhoh) | 78: - .long SYM(_uhoh) | 79: - .long SYM(_uhoh) | 80: - .long SYM(_uhoh) | 81: - .long SYM(_uhoh) | 82: - .long SYM(_uhoh) | 83: - .long SYM(_uhoh) | 84: - .long SYM(_uhoh) | 85: - .long SYM(_uhoh) | 86: - .long SYM(_uhoh) | 87: - .long SYM(_uhoh) | 88: - .long SYM(_uhoh) | 89: - .long SYM(_uhoh) | 90: - .long SYM(_uhoh) | 91: - .long SYM(_uhoh) | 92: - .long SYM(_uhoh) | 93: - .long SYM(_uhoh) | 94: - .long SYM(_uhoh) | 95: - .long SYM(_uhoh) | 96: - .long SYM(_uhoh) | 97: - .long SYM(_uhoh) | 98: - .long SYM(_uhoh) | 99: - .long SYM(_uhoh) | 100: - .long SYM(_uhoh) | 101: - .long SYM(_uhoh) | 102: - .long SYM(_uhoh) | 103: - .long SYM(_uhoh) | 104: - .long SYM(_uhoh) | 105: - .long SYM(_uhoh) | 106: - .long SYM(_uhoh) | 107: - .long SYM(_uhoh) | 108: - .long SYM(_uhoh) | 109: - .long SYM(_uhoh) | 110: - .long SYM(_uhoh) | 111: - .long SYM(_uhoh) | 112: - .long SYM(_uhoh) | 113: - .long SYM(_uhoh) | 114: - .long SYM(_uhoh) | 115: - .long SYM(_uhoh) | 116: - .long SYM(_uhoh) | 117: - .long SYM(_uhoh) | 118: - .long SYM(_uhoh) | 119: - .long SYM(_uhoh) | 120: - .long SYM(_uhoh) | 121: - .long SYM(_uhoh) | 122: - .long SYM(_uhoh) | 123: - .long SYM(_uhoh) | 124: - .long SYM(_uhoh) | 125: - .long SYM(_uhoh) | 126: - .long SYM(_uhoh) | 127: - .long SYM(_uhoh) | 128: - .long SYM(_uhoh) | 129: - .long SYM(_uhoh) | 130: - .long SYM(_uhoh) | 131: - .long SYM(_uhoh) | 132: - .long SYM(_uhoh) | 133: - .long SYM(_uhoh) | 134: - .long SYM(_uhoh) | 135: - .long SYM(_uhoh) | 136: - .long SYM(_uhoh) | 137: - .long SYM(_uhoh) | 138: - .long SYM(_uhoh) | 139: - .long SYM(_uhoh) | 140: - .long SYM(_uhoh) | 141: - .long SYM(_uhoh) | 142: - .long SYM(_uhoh) | 143: - .long SYM(_uhoh) | 144: - .long SYM(_uhoh) | 145: - .long SYM(_uhoh) | 146: - .long SYM(_uhoh) | 147: - .long SYM(_uhoh) | 148: - .long SYM(_uhoh) | 149: - .long SYM(_uhoh) | 150: - .long SYM(_uhoh) | 151: - .long SYM(_uhoh) | 152: - .long SYM(_uhoh) | 153: - .long SYM(_uhoh) | 154: - .long SYM(_uhoh) | 155: - .long SYM(_uhoh) | 156: - .long SYM(_uhoh) | 157: - .long SYM(_uhoh) | 158: - .long SYM(_uhoh) | 159: - .long SYM(_uhoh) | 160: - .long SYM(_uhoh) | 161: - .long SYM(_uhoh) | 162: - .long SYM(_uhoh) | 163: - .long SYM(_uhoh) | 164: - .long SYM(_uhoh) | 165: - .long SYM(_uhoh) | 166: - .long SYM(_uhoh) | 167: - .long SYM(_uhoh) | 168: - .long SYM(_uhoh) | 169: - .long SYM(_uhoh) | 170: - .long SYM(_uhoh) | 171: - .long SYM(_uhoh) | 172: - .long SYM(_uhoh) | 173: - .long SYM(_uhoh) | 174: - .long SYM(_uhoh) | 175: - .long SYM(_uhoh) | 176: - .long SYM(_uhoh) | 177: - .long SYM(_uhoh) | 178: - .long SYM(_uhoh) | 179: - .long SYM(_uhoh) | 180: - .long SYM(_uhoh) | 181: - .long SYM(_uhoh) | 182: - .long SYM(_uhoh) | 183: - .long SYM(_uhoh) | 184: - .long SYM(_uhoh) | 185: - .long SYM(_uhoh) | 186: - .long SYM(_uhoh) | 187: - .long SYM(_uhoh) | 188: - .long SYM(_uhoh) | 189: - .long SYM(_uhoh) | 190: - .long SYM(_uhoh) | 191: - .long SYM(_uhoh) | 192: - .long SYM(_uhoh) | 193: - .long SYM(_uhoh) | 194: - .long SYM(_uhoh) | 195: - .long SYM(_uhoh) | 196: - .long SYM(_uhoh) | 197: - .long SYM(_uhoh) | 198: - .long SYM(_uhoh) | 199: - .long SYM(_uhoh) | 200: - .long SYM(_uhoh) | 201: - .long SYM(_uhoh) | 202: - .long SYM(_uhoh) | 203: - .long SYM(_uhoh) | 204: - .long SYM(_uhoh) | 205: - .long SYM(_uhoh) | 206: - .long SYM(_uhoh) | 207: - .long SYM(_uhoh) | 208: - .long SYM(_uhoh) | 209: - .long SYM(_uhoh) | 210: - .long SYM(_uhoh) | 211: - .long SYM(_uhoh) | 212: - .long SYM(_uhoh) | 213: - .long SYM(_uhoh) | 214: - .long SYM(_uhoh) | 215: - .long SYM(_uhoh) | 216: - .long SYM(_uhoh) | 217: - .long SYM(_uhoh) | 218: - .long SYM(_uhoh) | 219: - .long SYM(_uhoh) | 220: - .long SYM(_uhoh) | 221: - .long SYM(_uhoh) | 222: - .long SYM(_uhoh) | 223: - .long SYM(_uhoh) | 224: - .long SYM(_uhoh) | 225: - .long SYM(_uhoh) | 226: - .long SYM(_uhoh) | 227: - .long SYM(_uhoh) | 228: - .long SYM(_uhoh) | 229: - .long SYM(_uhoh) | 230: - .long SYM(_uhoh) | 231: - .long SYM(_uhoh) | 232: - .long SYM(_uhoh) | 233: - .long SYM(_uhoh) | 234: - .long SYM(_uhoh) | 235: - .long SYM(_uhoh) | 236: - .long SYM(_uhoh) | 237: - .long SYM(_uhoh) | 238: - .long SYM(_uhoh) | 239: - .long SYM(_uhoh) | 240: - .long SYM(_uhoh) | 241: - .long SYM(_uhoh) | 242: - .long SYM(_uhoh) | 243: - .long SYM(_uhoh) | 244: - .long SYM(_uhoh) | 245: - .long SYM(_uhoh) | 246: - .long SYM(_uhoh) | 247: - .long SYM(_uhoh) | 248: - .long SYM(_uhoh) | 249: - .long SYM(_uhoh) | 250: - .long SYM(_uhoh) | 251: - .long SYM(_uhoh) | 252: - .long SYM(_uhoh) | 253: - .long SYM(_uhoh) | 254: - .long SYM(_uhoh) | 255: - -/* - * Default trap handler - * With an oscilloscope you can see AS* stop - */ - PUBLIC (_uhoh) -SYM(_uhoh): nop | Leave spot for breakpoint -/* stop #0x2700 | Stop with interrupts disabled */ - move.w #0x2700,sr - move.w (a7),_boot_panic_registers+4 | SR - move.l 2(a7),_boot_panic_registers | PC - move.w 6(a7),_boot_panic_registers+6 | format & vector - movem.l d0-d7/a0-a7, _boot_panic_registers+8 - movec sfc, d0 - movem.l d0, _boot_panic_registers+72 - movec dfc, d0 - movem.l d0, _boot_panic_registers+76 - movec vbr, d0 - movem.l d0, _boot_panic_registers+80 - jmp SYM(_dbug_dumpanic) - bra.s _crt0_cold_start - -/* - * Log, but otherwise ignore, spurious interrupts - */ - PUBLIC (_spuriousInterrupt) -SYM(_spuriousInterrupt): - addql #1,SYM(_M68kSpuriousInterruptCount) - rte - -/* - * Place the low-order 3 octets of the board's ethernet address at - * a `well-known' fixed location relative to the startup location. - */ - .align 2 - .word 0 | Padding -ethernet_address_buffer: - .word 0x08F3 | Default address - .word 0xDEAD - .word 0xCAFE - -BEGIN_DATA - -/* equates */ - -.equ _CPU340, 0x0 -.equ _CPU349, 0x31 - -#ifdef _OLD_ASTECC /* old addresses for AST68340 only */ -.equ _EPLD_CS_BASE, 0x1 -.equ _PROM_Start, 0x01000000 /* CS0 */ -.equ _FLEX_Start, 0x08000000 /* CS2 */ -.equ _I2C_Start, 0x0c000000 /* CS3 */ - -.equ _BCCram_Start, 0x00000000 /* CS1 64 Kbytes */ -.equ _BCCram_Size, 0x00010000 /* CS1 64 Kbytes */ - -.equ _ExtRam_Start, 0x10000000 /* SRAM */ -.equ _ExtRam_Size, 0x00400000 /* 4 Mbytes */ - -.equ _FastRam_Start, 0x00000000 /* overlap /CS1 for the first 4 Kbytes */ -.equ _FastRam_Size, 0x00001000 /* 4 Kbytes */ - -#else /* new addresses for AST68349 and 68340 */ - -.equ _EPLD_CS_BASE, 0x5 -.equ _PROM_Start, 0x50000000 /* CS0 */ -.equ _FLEX_Start, 0x08000000 /* CS2 */ -.equ _I2C_Start, 0x0c000000 /* CS3 */ - -.equ _BCCram_Start, 0x00000000 /* CS1 64 Kbytes */ -.equ _BCCram_Size, 0x00010000 /* CS1 64 Kbytes */ - -.equ _ExtRam_Start, 0x80000000 /* DRAM */ -.equ _ExtRam_Size, 0x00400000 /* 4 Mbytes */ - -.equ _FastRam_Start, 0x00000000 /* overlap /CS1 for the first 4 Kbytes */ -.equ _FastRam_Size, 0x00001000 /* 4 Kbytes */ -#endif - -.equ _SPEED349, 0xD680 /* 24 Mhz */ -.equ _SPEED340, 0xD700 /* 25 Mhz */ -/* .equ _SPEED340, 0xCE00 16 Mhz */ - -#define crt0_boot_type d0 /* cold/warm start (must be D0) */ -#define crt0_temp d1 -#define crt0_cpu_type d2 -#define crt0_csswitch d3 -#define crt0_buswidth d4 -#define crt0_pdcs d5 -#define crt0_spare6 d6 -#define crt0_spare7 d7 -#define crt0_sim_base a0 -#define crt0_glue a1 -#define crt0_dram a2 -#define crt0_ptr3 a3 -#define crt0_ptr4 a4 -#define crt0_ptr5 a5 -#define crt0_ptr6 a6 - -/* -- PDCS buffer equates -- */ -.equ pdcs_mask, 0x1F /* DRAM configuration */ -.equ pdcs_sw12, 7 /* switch 12 */ -.equ pdcs_sw11, 6 /* switch 11 */ -.equ pdcs_sw14, 5 /* switch 14 */ - -.equ bit_cache, pdcs_sw12 /* enable cache if on */ -.equ bit_meminit, pdcs_sw11 /* init memory if on */ - -/* -- Initialization stack and vars -- */ - -_AsteccBusWidth: ds.b 1 -_AsteccCsSwitch: ds.b 1 -_AsteccCpuName: ds.l 1 - -.align 4 - -_crt0_init_stack: - ds.l 500 -_crt0_init_stktop: - -/* -- Initialization code -- */ -BEGIN_CODE - -.align 4 - dc.l _crt0_init_stktop /* reset SP */ - dc.l _crt0_cold_start /* reset PC */ - dc.l _crt0_warm_start - - .ascii "BOOT XHM68K/Spectra for ASTECC 68349 and 68340 boards" - dc.w 0 -.align 4 - -.globl start -start: - -_crt0_cold_start: - moveq.l #0,crt0_boot_type | signal cold reset - bra.s _crt0_common_start - -_crt0_warm_start: - moveq.l #1,crt0_boot_type | signal warm reset - -_crt0_common_start: - move.w #0x2700,sr | disable interrupts and switch to interrupt mode - movea.l #_crt0_init_stktop,sp | set up initialization stack - - move.l #Entry,crt0_temp | VBR initialization - movec.l crt0_temp,vbr | - moveq.l #0x07,crt0_temp - movec.l crt0_temp,dfc | prepare access in CPU space - move.l #(BASE_SIM+0x111),crt0_temp | mask CPU, RESERVED USER SPACES - moves.l crt0_temp,BASE_REG | base initialization (must be MOVES, PCC-130795) - - movea.l #BASE_SIM,crt0_sim_base - - /* -- disable Bus Monitor -- */ - move.b #0,SIM_SYPCR(crt0_sim_base) | system protection control register - - /* -- enable A31-A24 -- */ - clr.b SIM_PPRA1(crt0_sim_base) - - /* -- show cycles, user acces to SIM, 4 /CS & 4 /IT -- */ - move.w #0x427F,SIM_MCR(crt0_sim_base) - - /* -- enable /IRQ3, 5, 6, 7 -- */ - move.b #0xE8,SIM_PPRB(crt0_sim_base) - - /* -- enable autovector on /IRQ7 -- */ - move.b #0x80,SIM_AVR(crt0_sim_base) - - /* -- test CPU type -- */ - cmp.b #_CPU349,SIM_IDR(crt0_sim_base) - bne cpu_is_68340 - -/*-------------------------------------------------------------------------------------------*/ -cpu_is_68349: - - /* -- set cpu clock -- */ - move.w #_SPEED349,SIM_SYNCR(crt0_sim_base) | clock - -sync_wait349: - btst.b #3,(SIM_SYNCR+1)(crt0_sim_base) - beq sync_wait349 - - /* to allow access to the EPLD internal registers, it is necessary - to disable the global chip-select /CS0 (which decodes every external - cycles). To do that, we initialize the 68349 internal RAM, - copy a part of the initialization code in it, and jump there. - from that moment, /CS0 is not used, therefore it can be initialized - with its default value. Its width may be incorrect, but it will be - adjusted later. The goal is to avoid any conflict with - the accesses to the EPLD registers. - When this is done, we read the RESET parameters (boot prom width - and chip-select switch) and proceed with the initialization - when all is done, we jump back to the boot prom now - decoded with a properly configured /CS0 */ - - /*-------------------------------------*/ - /* -- configure internal SRAM banks -- */ - - move.l #0x00000000,QDMM_MCR(crt0_sim_base) - move.l #_FastRam_Start+0x0005,QDMM_QBAR0(crt0_sim_base) - move.l #_FastRam_Start+0x0405,QDMM_QBAR1(crt0_sim_base) - move.l #_FastRam_Start+0x0805,QDMM_QBAR2(crt0_sim_base) - move.l #_FastRam_Start+0x0c05,QDMM_QBAR3(crt0_sim_base) - - /*--------------------------------------------------------*/ - /* -- copy to address of the 68349 initialization code -- */ - - lea.l _copy_start(%pc),crt0_ptr3 - lea.l _copy_end(%pc),crt0_ptr4 - move.l crt0_ptr4,crt0_temp - sub.l crt0_ptr3,crt0_temp - add.l #3,crt0_temp | adjust to next long word - lsr.l #2,crt0_temp - - move.l #_FastRam_Start,crt0_ptr4 -_copy_loop: - move.l (crt0_ptr3)+,(crt0_ptr4)+ - subq.l #1,crt0_temp - bne.s _copy_loop - bra.l _FastRam_Start | jump to code in internal RAM - - /*------------------------------------*/ - /* -- start of initialization code -- */ - -_copy_start: - bra.l _begin_68349_init - - /*----------------------------------------------------------*/ - /* Astecc 68349 board : chip-select initialization values */ - -_table_csepld: - dc.b (_EPLD_CS_BASE&0x0F)+0x80 | 16 bits, 0ws - dc.b 0x80 | 16 bits, 0 ws - dc.b 0x90 | 16 bits, ext /dsack - dc.b 0x90 | 16 bits, ext /dsack - -_table_cs349: - dc.l 0x003FFFF4 | Mask CS0 (4Mbytes PROM, 32bits, 1WS) - dc.l (_PROM_Start&0xFFFFFF00)+0x00000003 | Base CS0 - dc.l 0x003FFFF1 | MASK CS1 (4Mbytes RAM, 16bits, 0WS) - dc.l (_BCCram_Start&0xFFFFFF00)+0x00000003 | Base CS1 - dc.l 0x000000FF | MASK CS2 (FLEX, ext DTACK, 256 bytes) - dc.l (_FLEX_Start&0xFFFFFF00)+0x00000003 | Base CS2 - dc.l 0x000000FF | Mask CS3 (I2C, ext DTACK, 256 bytes) - dc.l (_I2C_Start&0xFFFFFF00)+0x00000003 | Base CS3 - - /*-------------------------------------------------*/ -_begin_68349_init: - - /*-------------------------------------------------*/ - /* 68349 chip select initialization - - at this stage, the width of /CS0 may be incorrect - it will be corrected later - */ - -_cs68349_init: - lea.l SIM_MASKH0(crt0_sim_base),crt0_ptr4 - lea.l _table_cs349(%pc),crt0_ptr3 - - moveq.l #0x07,crt0_temp -_cs349_init2: - move.l (crt0_ptr3)+,(crt0_ptr4)+ - dbra crt0_temp,_cs349_init2 - - /*-----------------------------------------------*/ - /* -- prepare access to the internal registers --*/ - moveq.l #EPLD_SPACE,crt0_temp - movec.l crt0_temp,dfc - movec.l crt0_temp,sfc - move.l #GLUE_EPLD,crt0_glue - move.l #DRAM_EPLD,crt0_dram - - /*-------------------------------------------*/ - /* EPLD generated /CS[3..0] must be disabled */ - -_csepld_clear: - move.l crt0_glue,crt0_ptr4 - move.w #3,crt0_spare6 - clr.b crt0_temp - -_csepld_clear1: - moves.b crt0_temp,(crt0_ptr4)+ - dbra crt0_spare6,_csepld_clear1 - - /*---------------------------------------------------------*/ - /* -- get width of boot PROM, and active chip-select set --*/ - moves.b REG_BUSWIDTH(crt0_dram),crt0_csswitch - move.b crt0_csswitch,crt0_buswidth - - /* state of CS_SWITCH : sel == 0 => CPU chip_selects (/CS[3..0]) - : sel == 1 => EPLD chip_selects (/CS[3..0]) */ - and.b #1,crt0_csswitch - - /* bus width of /CS0 during reset bw[1..0] : 0 1 2 3 - bus width : 32 16 8 ext./dsackx */ - rol.b #2,crt0_buswidth - and.b #3,crt0_buswidth - - /*----------------------------------------------------*/ - /* -- configure chip select 0 with boot prom width -- */ - lea.l SIM_MASKH0(crt0_sim_base),crt0_ptr4 - lea.l _table_cs349(%pc),crt0_ptr3 - move.l (crt0_ptr3)+,crt0_temp - and.b #0xFC,crt0_temp | clear PS0 & PS1 - or.b crt0_buswidth,crt0_temp | set boot PROM bus width - move.l crt0_temp,(crt0_ptr4)+ - - /*------------------------*/ - /* -- read PDCS buffer -- */ - moves.b REG_PDCS(crt0_glue),crt0_pdcs -/* move.b #0x3F,crt0_pdcs pour test */ - - - /*---------------------------------------*/ - /* -- EPLD chip-select initialization -- */ - /*---------------------------------------*/ - btst.b #0,crt0_csswitch - beq _cs_init_end - - /*--------------------------------------------*/ - /* 68349 generated /CS[3..0] must be disabled */ - lea.l SIM_MASKH0(crt0_sim_base),crt0_ptr4 - lea.l _table_cs349(%pc),crt0_ptr3 - moveq.l #0x03,crt0_temp -_cs349_clear: - move.l (crt0_ptr3)+,(crt0_ptr4)+ - move.l (crt0_ptr3)+,crt0_spare6 - and.b #0xFE,crt0_spare6 | disable chip-select - move.l crt0_spare6,(crt0_ptr4)+ - dbra crt0_temp,_cs349_clear - - /*---------------------------------------------*/ - /* EPLD generated /CS[3..0] must be configured */ -_csepld_init: - move.l crt0_glue,crt0_ptr4 - lea.l _table_csepld(%pc),crt0_ptr3 - - move.b (crt0_ptr3)+,crt0_temp - or.b #0x20,crt0_temp | default width is 32 bits - tst.b crt0_buswidth | is boot PROM bus width 32 bits ? - beq _csepld1 | if not - and.b #0xDF,crt0_temp | set width to 16 bits -_csepld1: - moves.b crt0_temp,(crt0_ptr4)+ - - moveq.l #0x02,crt0_spare6 -_csepld2: - move.b (crt0_ptr3)+,crt0_temp - moves.b crt0_temp,(crt0_ptr4)+ - dbra crt0_spare6,_csepld2 - -_cs_init_end: - - /*--------------------------------------*/ - /* -- DRAM controller initialization -- */ -_dram_init: - move.w #15,crt0_temp - move.l #_ExtRam_Start,crt0_ptr3 - -_dram_init1: - clr.l (crt0_ptr3)+ | must access DRAM - dbra crt0_temp,_dram_init1 | prior to init refresh - -_dram_init2: - move.b #3,crt0_temp - moves.b crt0_temp,REG_WS(crt0_dram) | set 3 wait-states - - move.b #0x81,crt0_temp - moves.b crt0_temp,REG_REFRESH(crt0_dram) | refresh every 10µs - - move.b #0,crt0_temp - moves.b crt0_temp,REG_CONFIG(crt0_dram) | default size = 4Mbytes - - /*-----------------------*/ - /* -- configure cache -- */ -_init_cache: - move.l #0x000001E0,CACHE_MCR(crt0_sim_base) - btst.b #bit_cache,crt0_pdcs - bne _init_cache_end - or.l #0x00000001,CACHE_MCR(crt0_sim_base) - -_init_cache_end: - - /*-----------------------------*/ - /* -- timers initialization -- */ - - clr.b crt0_temp - moves.b crt0_temp,REG_TIMER1(crt0_glue) | disable timer 1 - moves.b crt0_temp,REG_TIMER2(crt0_glue) | disable timer 2 - - /*--------------------------*/ - /* -- I2C initialization -- */ - move.b #3,crt0_temp - moves.b crt0_temp,REG_I2C(crt0_glue) | tri-states I2C ports - - /*-----------------------------------------*/ - /* -- baudrate generator initialization -- */ - move.b #2,crt0_temp - moves.b crt0_temp,REG_BAUDRATE(crt0_glue) | baudrate = 38400 - - /*-------------------------------*/ - /* -- IO port initialization -- */ - clr.b crt0_temp - moves.b crt0_temp,REG_IO(crt0_glue) | set port as input - - /* -- */ - - move.l #68349,crt0_cpu_type - - - /* -- jump back to PROM -- */ - - jmp.l (_fill_test) | must be absolute long - -_copy_end: - -/*------------------------------------------------- - initialization code for the 68340 board - -------------------------------------------------*/ - - /* Astecc 68340 board : chip-select initialization values */ -_table_cs340: - dc.l 0x003FFFF0 /* Mask CS0 (4Mbytes PROM, 32bits, 0WS) */ - dc.l ((_PROM_Start&0xFFFFFF00)+0x00000003) /* Base CS0 */ - dc.l 0x0000FFFD /* MASK CS1 (RAMBCC340, 0WS, FTE) */ - dc.l ((_BCCram_Start&0xFFFFFF00)+0x00000003) /* Base CS1 */ - dc.l 0x000000FF /* MASK CS2 (FLEX, ext DTACK, 256 bytes) */ - dc.l ((_FLEX_Start&0xFFFFFF00)+0x00000003) /* Base CS2 */ - dc.l 0x000000FF /* Mask CS3 (I2C, ext DTACK, 256 bytes) */ - dc.l ((_I2C_Start&0xFFFFFF00)+0x00000003) /* Base CS3 */ - -cpu_is_68340: - - /* -- set cpu clock -- */ - move.w #_SPEED340,SIM_SYNCR(crt0_sim_base) | clock -sync_wait340: - btst.b #3,(SIM_SYNCR+1)(crt0_sim_base) - beq sync_wait340 - - /* -- chip select initialization -- */ - lea.l SIM_MASKH0(crt0_sim_base),crt0_ptr4 - lea.l _table_cs340(%pc),crt0_ptr3 - moveq.l #0x07,crt0_temp -_b_cs340: - move.l (crt0_ptr3)+,crt0_ptr5 - move.l crt0_ptr5,(crt0_ptr4)+ | pour test - dbra crt0_temp,_b_cs340 - - move.l #68340,crt0_cpu_type - move.b #0,crt0_csswitch | CPU - move.b #1,crt0_buswidth | 16 bits - - - /*------------------------------------------------- - fill RAM if COLDSTART - -------------------------------------------------*/ -_fill_test: - - tst.l crt0_boot_type - bne _dont_fill - - cmp.b #_CPU349,SIM_IDR(crt0_sim_base) - bne _fill - btst.b #bit_meminit,crt0_pdcs - bne _dont_fill - - /* fill main memory */ -_fill: - move.l #_crt0_init_stack,crt0_ptr3 | skip Astecc vars - move.l #_ExtRam_Start,crt0_temp - sub.l #_crt0_init_stack,crt0_temp - add.l #_ExtRam_Size,crt0_temp | get size - lsr.l #2,crt0_temp | ajust for long word -_fill_loop: - clr.l (crt0_ptr3)+ - subq.l #1,crt0_temp - bne _fill_loop - - cmp.b #_CPU349,SIM_IDR(crt0_sim_base) - bne _fill_bccram - - /* fill QDMM memory */ - movea.l #_FastRam_Start,crt0_ptr3 | get start - move.l #_FastRam_Size,crt0_temp | get size - lsr.l #2,crt0_temp | ajust for long word - -_QDMMfill_loop: - clr.l (crt0_ptr3)+ - subq.l #1,crt0_temp - bne _QDMMfill_loop - bra _dont_fill - - /* fill BCC memory */ -_fill_bccram: - movea.l #_BCCram_Start,crt0_ptr3 | get start - move.l #_BCCram_Size,crt0_temp | get size - lsr.l #2,crt0_temp | ajust for long word -_BCCfill_loop: - clr.l (crt0_ptr3)+ - subq.l #1,crt0_temp - bne _BCCfill_loop - - *-------------------------------------------------*/ -_dont_fill: - move.b crt0_csswitch,_AsteccCsSwitch - move.b crt0_buswidth,_AsteccBusWidth - move.l crt0_cpu_type,_AsteccCpuName - - jmp SYM(_Init68340) | Start C code (which never returns) - -/* - * Copy DATA segment, clear BSS segment, set up real stack, - * initialize heap, start C program. - * Assume that DATA and BSS sizes are multiples of 4. - */ - PUBLIC (_CopyDataClearBSSAndStart) -SYM(_CopyDataClearBSSAndStart): - lea copy_start,a0 | Get start of DATA in RAM - lea SYM(etext),a2 | Get start of DATA in ROM - cmpl a0,a2 | Are they the same? - beq.s NOCOPY | Yes, no copy necessary - lea copy_end,a1 | Get end of DATA in RAM - bra.s COPYLOOPTEST | Branch into copy loop -COPYLOOP: - movel a2@+,a0@+ | Copy word from ROM to RAM -COPYLOOPTEST: - cmpl a1,a0 | Done? - bcs.s COPYLOOP | No, skip -NOCOPY: - - lea clear_start,a0 | Get start of BSS - lea clear_end,a1 | Get end of BSS - clrl d0 | Value to set - bra.s ZEROLOOPTEST | Branch into clear loop -ZEROLOOP: - movel d0,a0@+ | Clear a word -ZEROLOOPTEST: - cmpl a1,a0 | Done? - bcs.s ZEROLOOP | No, skip - - movel #stack_init,a7 | set master stack pointer - movel d0,a7@- | environp - movel d0,a7@- | argv - movel d0,a7@- | argc - jsr SYM(boot_card) | Call C main - - PUBLIC (_mainDone) -SYM(_mainDone): - nop | Leave spot for breakpoint - movew #1,a7 | Force a double bus error - movel d0,a7@- | This should cause a RESET -/* stop #0x2700 | Stop with interrupts disabled */ - move.w #0x2700,sr - bra.s SYM(_mainDone) | Stuck forever - - .align 2 - PUBLIC (_HeapSize) -SYM (_HeapSize): - .long HeapSize - PUBLIC (_StackSize) -SYM (_StackSize): - .long StackSize -END_CODE - -BEGIN_DATA_DCL - .align 2 - PUBLIC (environ) -SYM (environ): - .long 0 - PUBLIC (_M68kSpuriousInterruptCount) -SYM (_M68kSpuriousInterruptCount): - .long 0 -END_DATA_DCL - -END - diff --git a/c/src/lib/libbsp/m68k/gen68340/start/startfor340only.s b/c/src/lib/libbsp/m68k/gen68340/start/startfor340only.s deleted file mode 100644 index 930694f02e..0000000000 --- a/c/src/lib/libbsp/m68k/gen68340/start/startfor340only.s +++ /dev/null @@ -1,499 +0,0 @@ -/* - * This file contains the entry point for the application. - * The name of this entry point is compiler dependent. - * It jumps to the BSP which is responsible for performing - * all initialization. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may in - * the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * Based on the `gen68360' board support package, and covered by the - * original distribution terms. - * - * Geoffroy Montel - * France Telecom - CNET/DSM/TAM/CAT - * 4, rue du Clos Courtel - * 35512 CESSON-SEVIGNE - * FRANCE - * - * e-mail: g_montel@yahoo.com - * - * $Id$ - */ - -#include "asm.h" -#include <m68340.inc> - -BEGIN_CODE - /* - * Step 1: Decide on Reset Stack Pointer and Initial Program Counter - */ -Entry: - .long SYM(m340)+1024 | 0: Initial SSP - .long start | 1: Initial PC - .long SYM(_uhoh) | 2: Bus error - .long SYM(_uhoh) | 3: Address error - .long SYM(_uhoh) | 4: Illegal instruction - .long SYM(_uhoh) | 5: Zero division - .long SYM(_uhoh) | 6: CHK, CHK2 instruction - .long SYM(_uhoh) | 7: TRAPcc, TRAPV instructions - .long SYM(_uhoh) | 8: Privilege violation - .long SYM(_uhoh) | 9: Trace - .long SYM(_uhoh) | 10: Line 1010 emulator - .long SYM(_uhoh) | 11: Line 1111 emulator - .long SYM(_uhoh) | 12: Hardware breakpoint - .long SYM(_uhoh) | 13: Reserved for coprocessor violation - .long SYM(_uhoh) | 14: Format error - .long SYM(_uhoh) | 15: Uninitialized interrupt - .long SYM(_uhoh) | 16: Unassigned, reserved - .long SYM(_uhoh) | 17: - .long SYM(_uhoh) | 18: - .long SYM(_uhoh) | 19: - .long SYM(_uhoh) | 20: - .long SYM(_uhoh) | 21: - .long SYM(_uhoh) | 22: - .long SYM(_uhoh) | 23: - .long SYM(_spuriousInterrupt) | 24: Spurious interrupt - .long SYM(_uhoh) | 25: Level 1 interrupt autovector - .long SYM(_uhoh) | 26: Level 2 interrupt autovector - .long SYM(_uhoh) | 27: Level 3 interrupt autovector - .long SYM(_uhoh) | 28: Level 4 interrupt autovector - .long SYM(_uhoh) | 29: Level 5 interrupt autovector - .long SYM(_uhoh) | 30: Level 6 interrupt autovector - .long SYM(_uhoh) | 31: Level 7 interrupt autovector - .long SYM(_uhoh) | 32: Trap instruction (0-15) - .long SYM(_uhoh) | 33: - .long SYM(_uhoh) | 34: - .long SYM(_uhoh) | 35: - .long SYM(_uhoh) | 36: - .long SYM(_uhoh) | 37: - .long SYM(_uhoh) | 38: - .long SYM(_uhoh) | 39: - .long SYM(_uhoh) | 40: - .long SYM(_uhoh) | 41: - .long SYM(_uhoh) | 42: - .long SYM(_uhoh) | 43: - .long SYM(_uhoh) | 44: - .long SYM(_uhoh) | 45: - .long SYM(_uhoh) | 46: - .long SYM(_uhoh) | 47: - .long SYM(_uhoh) | 48: Reserved for coprocessor - .long SYM(_uhoh) | 49: - .long SYM(_uhoh) | 50: - .long SYM(_uhoh) | 51: - .long SYM(_uhoh) | 52: - .long SYM(_uhoh) | 53: - .long SYM(_uhoh) | 54: - .long SYM(_uhoh) | 55: - .long SYM(_uhoh) | 56: - .long SYM(_uhoh) | 57: - .long SYM(_uhoh) | 58: - .long SYM(_uhoh) | 59: Unassigned, reserved - .long SYM(_uhoh) | 60: - .long SYM(_uhoh) | 61: - .long SYM(_uhoh) | 62: - .long SYM(_uhoh) | 63: - .long SYM(_uhoh) | 64: User defined vectors (192) - .long SYM(_uhoh) | 65: - .long SYM(_uhoh) | 66: - .long SYM(_uhoh) | 67: - .long SYM(_uhoh) | 68: - .long SYM(_uhoh) | 69: - .long SYM(_uhoh) | 70: - .long SYM(_uhoh) | 71: - .long SYM(_uhoh) | 72: - .long SYM(_uhoh) | 73: - .long SYM(_uhoh) | 74: - .long SYM(_uhoh) | 75: - .long SYM(_uhoh) | 76: - .long SYM(_uhoh) | 77: - .long SYM(_uhoh) | 78: - .long SYM(_uhoh) | 79: - .long SYM(_uhoh) | 80: - .long SYM(_uhoh) | 81: - .long SYM(_uhoh) | 82: - .long SYM(_uhoh) | 83: - .long SYM(_uhoh) | 84: - .long SYM(_uhoh) | 85: - .long SYM(_uhoh) | 86: - .long SYM(_uhoh) | 87: - .long SYM(_uhoh) | 88: - .long SYM(_uhoh) | 89: - .long SYM(_uhoh) | 90: - .long SYM(_uhoh) | 91: - .long SYM(_uhoh) | 92: - .long SYM(_uhoh) | 93: - .long SYM(_uhoh) | 94: - .long SYM(_uhoh) | 95: - .long SYM(_uhoh) | 96: - .long SYM(_uhoh) | 97: - .long SYM(_uhoh) | 98: - .long SYM(_uhoh) | 99: - .long SYM(_uhoh) | 100: - .long SYM(_uhoh) | 101: - .long SYM(_uhoh) | 102: - .long SYM(_uhoh) | 103: - .long SYM(_uhoh) | 104: - .long SYM(_uhoh) | 105: - .long SYM(_uhoh) | 106: - .long SYM(_uhoh) | 107: - .long SYM(_uhoh) | 108: - .long SYM(_uhoh) | 109: - .long SYM(_uhoh) | 110: - .long SYM(_uhoh) | 111: - .long SYM(_uhoh) | 112: - .long SYM(_uhoh) | 113: - .long SYM(_uhoh) | 114: - .long SYM(_uhoh) | 115: - .long SYM(_uhoh) | 116: - .long SYM(_uhoh) | 117: - .long SYM(_uhoh) | 118: - .long SYM(_uhoh) | 119: - .long SYM(_uhoh) | 120: - .long SYM(_uhoh) | 121: - .long SYM(_uhoh) | 122: - .long SYM(_uhoh) | 123: - .long SYM(_uhoh) | 124: - .long SYM(_uhoh) | 125: - .long SYM(_uhoh) | 126: - .long SYM(_uhoh) | 127: - .long SYM(_uhoh) | 128: - .long SYM(_uhoh) | 129: - .long SYM(_uhoh) | 130: - .long SYM(_uhoh) | 131: - .long SYM(_uhoh) | 132: - .long SYM(_uhoh) | 133: - .long SYM(_uhoh) | 134: - .long SYM(_uhoh) | 135: - .long SYM(_uhoh) | 136: - .long SYM(_uhoh) | 137: - .long SYM(_uhoh) | 138: - .long SYM(_uhoh) | 139: - .long SYM(_uhoh) | 140: - .long SYM(_uhoh) | 141: - .long SYM(_uhoh) | 142: - .long SYM(_uhoh) | 143: - .long SYM(_uhoh) | 144: - .long SYM(_uhoh) | 145: - .long SYM(_uhoh) | 146: - .long SYM(_uhoh) | 147: - .long SYM(_uhoh) | 148: - .long SYM(_uhoh) | 149: - .long SYM(_uhoh) | 150: - .long SYM(_uhoh) | 151: - .long SYM(_uhoh) | 152: - .long SYM(_uhoh) | 153: - .long SYM(_uhoh) | 154: - .long SYM(_uhoh) | 155: - .long SYM(_uhoh) | 156: - .long SYM(_uhoh) | 157: - .long SYM(_uhoh) | 158: - .long SYM(_uhoh) | 159: - .long SYM(_uhoh) | 160: - .long SYM(_uhoh) | 161: - .long SYM(_uhoh) | 162: - .long SYM(_uhoh) | 163: - .long SYM(_uhoh) | 164: - .long SYM(_uhoh) | 165: - .long SYM(_uhoh) | 166: - .long SYM(_uhoh) | 167: - .long SYM(_uhoh) | 168: - .long SYM(_uhoh) | 169: - .long SYM(_uhoh) | 170: - .long SYM(_uhoh) | 171: - .long SYM(_uhoh) | 172: - .long SYM(_uhoh) | 173: - .long SYM(_uhoh) | 174: - .long SYM(_uhoh) | 175: - .long SYM(_uhoh) | 176: - .long SYM(_uhoh) | 177: - .long SYM(_uhoh) | 178: - .long SYM(_uhoh) | 179: - .long SYM(_uhoh) | 180: - .long SYM(_uhoh) | 181: - .long SYM(_uhoh) | 182: - .long SYM(_uhoh) | 183: - .long SYM(_uhoh) | 184: - .long SYM(_uhoh) | 185: - .long SYM(_uhoh) | 186: - .long SYM(_uhoh) | 187: - .long SYM(_uhoh) | 188: - .long SYM(_uhoh) | 189: - .long SYM(_uhoh) | 190: - .long SYM(_uhoh) | 191: - .long SYM(_uhoh) | 192: - .long SYM(_uhoh) | 193: - .long SYM(_uhoh) | 194: - .long SYM(_uhoh) | 195: - .long SYM(_uhoh) | 196: - .long SYM(_uhoh) | 197: - .long SYM(_uhoh) | 198: - .long SYM(_uhoh) | 199: - .long SYM(_uhoh) | 200: - .long SYM(_uhoh) | 201: - .long SYM(_uhoh) | 202: - .long SYM(_uhoh) | 203: - .long SYM(_uhoh) | 204: - .long SYM(_uhoh) | 205: - .long SYM(_uhoh) | 206: - .long SYM(_uhoh) | 207: - .long SYM(_uhoh) | 208: - .long SYM(_uhoh) | 209: - .long SYM(_uhoh) | 210: - .long SYM(_uhoh) | 211: - .long SYM(_uhoh) | 212: - .long SYM(_uhoh) | 213: - .long SYM(_uhoh) | 214: - .long SYM(_uhoh) | 215: - .long SYM(_uhoh) | 216: - .long SYM(_uhoh) | 217: - .long SYM(_uhoh) | 218: - .long SYM(_uhoh) | 219: - .long SYM(_uhoh) | 220: - .long SYM(_uhoh) | 221: - .long SYM(_uhoh) | 222: - .long SYM(_uhoh) | 223: - .long SYM(_uhoh) | 224: - .long SYM(_uhoh) | 225: - .long SYM(_uhoh) | 226: - .long SYM(_uhoh) | 227: - .long SYM(_uhoh) | 228: - .long SYM(_uhoh) | 229: - .long SYM(_uhoh) | 230: - .long SYM(_uhoh) | 231: - .long SYM(_uhoh) | 232: - .long SYM(_uhoh) | 233: - .long SYM(_uhoh) | 234: - .long SYM(_uhoh) | 235: - .long SYM(_uhoh) | 236: - .long SYM(_uhoh) | 237: - .long SYM(_uhoh) | 238: - .long SYM(_uhoh) | 239: - .long SYM(_uhoh) | 240: - .long SYM(_uhoh) | 241: - .long SYM(_uhoh) | 242: - .long SYM(_uhoh) | 243: - .long SYM(_uhoh) | 244: - .long SYM(_uhoh) | 245: - .long SYM(_uhoh) | 246: - .long SYM(_uhoh) | 247: - .long SYM(_uhoh) | 248: - .long SYM(_uhoh) | 249: - .long SYM(_uhoh) | 250: - .long SYM(_uhoh) | 251: - .long SYM(_uhoh) | 252: - .long SYM(_uhoh) | 253: - .long SYM(_uhoh) | 254: - .long SYM(_uhoh) | 255: - -/* - * Default trap handler - * With an oscilloscope you can see AS* stop - */ - PUBLIC (_uhoh) -SYM(_uhoh): nop | Leave spot for breakpoint - stop #0x2700 | Stop with interrupts disabled - bra.s SYM(_uhoh) | Stuck forever - -/* - * Log, but otherwise ignore, spurious interrupts - */ - PUBLIC (_spuriousInterrupt) -SYM(_spuriousInterrupt): - addql #1,SYM(_M68kSpuriousInterruptCount) - rte - -/* - * Place the low-order 3 octets of the board's ethernet address at - * a `well-known' fixed location relative to the startup location. - */ - .align 2 - .word 0 | Padding -ethernet_address_buffer: - .word 0x08F3 | Default address - .word 0xDEAD - .word 0xCAFE - -/* -- equates -- */ -.equ _PROM_Start, 0x01000000 /* CS0 */ -.equ _BCCram_Start, 0x00000000 /* CS1 */ -.equ _FLEX_Start, 0x08000000 /* CS2 */ -.equ _I2C_Start, 0x02000000 /* CS3 */ -.equ _EXTram_Start, 0x10000000 /* CS4 */ -.equ _EXTram_Size, 0x000400000 /* 4 Mbytes */ -.equ _SPEED, 0xD780 /* 25 Mhz CPU349 */ -/* .equ _SPEED, 0xD700 25 Mhz */ -/* .equ _SPEED, 0xCE00 16 Mhz */ - -BEGIN_DATA - -_crt0_init_stack: - ds.l 0x1000 -_crt0_init_stktop: - - -BEGIN_CODE - dc.l _crt0_init_stktop /* reset SP */ - dc.l _crt0_cold_start /* reset PC */ - dc.l _crt0_warm_start - - .ascii "RTEMS" - dc.w 0 - -.align 2 - -_table_cs: - /* carte Astecc - 68340 */ - dc.l 0x003FFFF0 /* Mask CS0 (4Mbytes PROM, 32bits, 0WS) */ -/* dc.l 0x003FFFFD Mask CS0 (4Mbytes PROM, 16bits, 3WS) */ - dc.l ((_PROM_Start&0xFFFFFF00)+0x00000003) /* Base CS0 */ -/* dc.l 0x0000FFF1 MASK CS1 (RAMBCC340, 0WS, FTE) */ - dc.l 0x0000FFFD /* MASK CS1 (RAMBCC340, 0WS, FTE) */ -/* dc.l ((_BCCram_Start&0xFFFFFF00)+0x00000007) Base CS1 */ - dc.l ((_BCCram_Start&0xFFFFFF00)+0x00000003) /* Base CS1 */ - dc.l 0x000000FF /* MASK CS2 (FLEX, ext DTACK, 256 bytes) */ - dc.l ((_FLEX_Start&0xFFFFFF00)+0x00000003) /* Base CS2 */ - dc.l 0x000000FF /* Mask CS3 (I2C, ext DTACK, 256 bytes) */ - dc.l ((_I2C_Start&0xFFFFFF00)+0x00000003) /* Base CS3 */ - -/* - * Initial PC - */ -.globl start -start: - -_crt0_cold_start: - moveq.l #0,d0 /* signal cold reset */ - bra.s _crt0_common_start - -_crt0_warm_start: - moveq.l #1,d0 /* signal warm reset */ - -_crt0_common_start: - move.w #0x2700,sr /* disable interrupts and switch to interrupt mode */ - movea.l #_crt0_init_stktop,sp /* set up initialization stack */ - - lea Entry,a0 /* Get base of vector table */ - movec a0,vbr /* Set up the VBR */ - - moveq.l #0x07,d1 - movec.l d1,dfc /* prepare access in CPU space */ - move.l #(BASE_SIM+1),d1 - moves.l d1,BASE_REG /* base initialization (must be MOVES, PCC-130795) */ - moveq.l #0x05,d1 - movec.l d1,dfc - - movea.l #BASE_SIM,a0 - - /* -- disable Bus Monitor -- */ - move.b #0,SIM_SYPCR(a0) /* system protection control register */ - - /* -- set frequency to 25.16 Mhz -- */ - move.w #_SPEED,SIM_SYNCR(a0) /* clock */ - -sync_wait: - btst.b #3,(SIM_SYNCR+1)(a0) - beq sync_wait - - /* -- enable A31-A24 -- */ - clr.b SIM_PPRA1(a0) - - /* -- show cycles, user acces to SIM, 4 /CS & 4 /IT -- */ - move.w #0x427F,SIM_MCR(a0) - - /* -- chip select initialization -- */ - lea.l SIM_MASKH0(a0),a2 - lea.l _table_cs(%pc),a1 - - moveq.l #0x07,d1 - -_b_cs: - move.l (a1)+, (a2)+ - dbra d1,_b_cs - - /* fill RAM if COLDSTART */ - tst.l d0 - bne _dont_fill - - movea.l #_EXTram_Start,a0 /* get start */ - move.l #_EXTram_Size,d1 /* get size */ - lsr.l #2,d1 /* ajust for long word */ - -_fill_loop: - clr.l (a0)+ - subq.l #1,d1 - bne _fill_loop - -_dont_fill: - jmp SYM(_Init68340) | Start C code (which never returns) - -/* - * Copy DATA segment, clear BSS segment, set up real stack, - * initialize heap, start C program. - * Assume that DATA and BSS sizes are multiples of 4. - */ - PUBLIC (_CopyDataClearBSSAndStart) -SYM(_CopyDataClearBSSAndStart): - lea copy_start,a0 | Get start of DATA in RAM - lea SYM(etext),a2 | Get start of DATA in ROM - cmpl a0,a2 | Are they the same? - beq.s NOCOPY | Yes, no copy necessary - lea copy_end,a1 | Get end of DATA in RAM - bra.s COPYLOOPTEST | Branch into copy loop -COPYLOOP: - movel a2@+,a0@+ | Copy word from ROM to RAM -COPYLOOPTEST: - cmpl a1,a0 | Done? - bcs.s COPYLOOP | No, skip -NOCOPY: - - lea clear_start,a0 | Get start of BSS - lea clear_end,a1 | Get end of BSS - clrl d0 | Value to set - bra.s ZEROLOOPTEST | Branch into clear loop -ZEROLOOP: - movel d0,a0@+ | Clear a word -ZEROLOOPTEST: - cmpl a1,a0 | Done? - bcs.s ZEROLOOP | No, skip - - movel #stack_init,a7 | set master stack pointer - movel d0,a7@- | environp - movel d0,a7@- | argv - movel d0,a7@- | argc - jsr SYM(boot_card) | Call C main - - PUBLIC (_mainDone) -SYM(_mainDone): - nop | Leave spot for breakpoint - movew #1,a7 | Force a double bus error - movel d0,a7@- | This should cause a RESET - stop #0x2700 | Stop with interrupts disabled - bra.s SYM(_mainDone) | Stuck forever - - .align 2 - PUBLIC (_HeapSize) -SYM (_HeapSize): - .long HeapSize - PUBLIC (_StackSize) -SYM (_StackSize): - .long StackSize -END_CODE - -BEGIN_DATA_DCL - .align 2 - PUBLIC (environ) -SYM (environ): - .long 0 - PUBLIC (_M68kSpuriousInterruptCount) -SYM (_M68kSpuriousInterruptCount): - .long 0 -END_DATA_DCL - -END - diff --git a/c/src/lib/libbsp/m68k/gen68360/start/Makefile.in b/c/src/lib/libbsp/m68k/gen68360/start/Makefile.in deleted file mode 100644 index 4d339f46fc..0000000000 --- a/c/src/lib/libbsp/m68k/gen68360/start/Makefile.in +++ /dev/null @@ -1,57 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -PGMS=${ARCH}/start360.o - -# C source names, if any, go here -- minus the .c -C_PIECES= -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -# Assembly source names, if any, go here -- minus the .s -S_PIECES=start360 -S_FILES=$(S_PIECES:%=%.s) -S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o) - -SRCS=$(C_FILES) $(H_FILES) $(S_FILES) -OBJS=$(C_O_FILES) $(S_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -all: ${ARCH} $(SRCS) $(OBJS) $(PGM) - $(INSTALL_VARIANT) -m 555 ${PGMS} ${PROJECT_RELEASE}/lib - -# Install the program(s), appending _g or _p as appropriate. -# for include files, just use $(INSTALL) diff --git a/c/src/lib/libbsp/m68k/gen68360/start/start360.s b/c/src/lib/libbsp/m68k/gen68360/start/start360.s deleted file mode 100644 index 2c979e294f..0000000000 --- a/c/src/lib/libbsp/m68k/gen68360/start/start360.s +++ /dev/null @@ -1,432 +0,0 @@ -/* - * - * This file contains the entry point for the application. - * The name of this entry point is compiler dependent. - * It jumps to the BSP which is responsible for performing - * all initialization. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may in - * the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * Based on the `gen68302' board support package, and covered by the - * original distribution terms. - * - * W. Eric Norum - * Saskatchewan Accelerator Laboratory - * University of Saskatchewan - * Saskatoon, Saskatchewan, CANADA - * eric@skatter.usask.ca - * - * $Id$ - */ - -#include "asm.h" - -BEGIN_CODE - /* - * Step 1: Decide on Reset Stack Pointer and Initial Program Counter - */ -Entry: - .long SYM(m360)+1024 | 0: Initial SSP - .long start | 1: Initial PC - .long SYM(_uhoh) | 2: Bus error - .long SYM(_uhoh) | 3: Address error - .long SYM(_uhoh) | 4: Illegal instruction - .long SYM(_uhoh) | 5: Zero division - .long SYM(_uhoh) | 6: CHK, CHK2 instruction - .long SYM(_uhoh) | 7: TRAPcc, TRAPV instructions - .long SYM(_uhoh) | 8: Privilege violation - .long SYM(_uhoh) | 9: Trace - .long SYM(_uhoh) | 10: Line 1010 emulator - .long SYM(_uhoh) | 11: Line 1111 emulator - .long SYM(_uhoh) | 12: Hardware breakpoint - .long SYM(_uhoh) | 13: Reserved for coprocessor violation - .long SYM(_uhoh) | 14: Format error - .long SYM(_uhoh) | 15: Uninitialized interrupt - .long SYM(_uhoh) | 16: Unassigned, reserved - .long SYM(_uhoh) | 17: - .long SYM(_uhoh) | 18: - .long SYM(_uhoh) | 19: - .long SYM(_uhoh) | 20: - .long SYM(_uhoh) | 21: - .long SYM(_uhoh) | 22: - .long SYM(_uhoh) | 23: - .long SYM(_spuriousInterrupt) | 24: Spurious interrupt - .long SYM(_uhoh) | 25: Level 1 interrupt autovector - .long SYM(_uhoh) | 26: Level 2 interrupt autovector - .long SYM(_uhoh) | 27: Level 3 interrupt autovector - .long SYM(_uhoh) | 28: Level 4 interrupt autovector - .long SYM(_uhoh) | 29: Level 5 interrupt autovector - .long SYM(_uhoh) | 30: Level 6 interrupt autovector - .long SYM(_uhoh) | 31: Level 7 interrupt autovector - .long SYM(_uhoh) | 32: Trap instruction (0-15) - .long SYM(_uhoh) | 33: - .long SYM(_uhoh) | 34: - .long SYM(_uhoh) | 35: - .long SYM(_uhoh) | 36: - .long SYM(_uhoh) | 37: - .long SYM(_uhoh) | 38: - .long SYM(_uhoh) | 39: - .long SYM(_uhoh) | 40: - .long SYM(_uhoh) | 41: - .long SYM(_uhoh) | 42: - .long SYM(_uhoh) | 43: - .long SYM(_uhoh) | 44: - .long SYM(_uhoh) | 45: - .long SYM(_uhoh) | 46: - .long SYM(_uhoh) | 47: - .long SYM(_uhoh) | 48: Reserved for coprocessor - .long SYM(_uhoh) | 49: - .long SYM(_uhoh) | 50: - .long SYM(_uhoh) | 51: - .long SYM(_uhoh) | 52: - .long SYM(_uhoh) | 53: - .long SYM(_uhoh) | 54: - .long SYM(_uhoh) | 55: - .long SYM(_uhoh) | 56: - .long SYM(_uhoh) | 57: - .long SYM(_uhoh) | 58: - .long SYM(_uhoh) | 59: Unassigned, reserved - .long SYM(_uhoh) | 60: - .long SYM(_uhoh) | 61: - .long SYM(_uhoh) | 62: - .long SYM(_uhoh) | 63: - .long SYM(_uhoh) | 64: User defined vectors (192) - .long SYM(_uhoh) | 65: - .long SYM(_uhoh) | 66: - .long SYM(_uhoh) | 67: - .long SYM(_uhoh) | 68: - .long SYM(_uhoh) | 69: - .long SYM(_uhoh) | 70: - .long SYM(_uhoh) | 71: - .long SYM(_uhoh) | 72: - .long SYM(_uhoh) | 73: - .long SYM(_uhoh) | 74: - .long SYM(_uhoh) | 75: - .long SYM(_uhoh) | 76: - .long SYM(_uhoh) | 77: - .long SYM(_uhoh) | 78: - .long SYM(_uhoh) | 79: - .long SYM(_uhoh) | 80: - .long SYM(_uhoh) | 81: - .long SYM(_uhoh) | 82: - .long SYM(_uhoh) | 83: - .long SYM(_uhoh) | 84: - .long SYM(_uhoh) | 85: - .long SYM(_uhoh) | 86: - .long SYM(_uhoh) | 87: - .long SYM(_uhoh) | 88: - .long SYM(_uhoh) | 89: - .long SYM(_uhoh) | 90: - .long SYM(_uhoh) | 91: - .long SYM(_uhoh) | 92: - .long SYM(_uhoh) | 93: - .long SYM(_uhoh) | 94: - .long SYM(_uhoh) | 95: - .long SYM(_uhoh) | 96: - .long SYM(_uhoh) | 97: - .long SYM(_uhoh) | 98: - .long SYM(_uhoh) | 99: - .long SYM(_uhoh) | 100: - .long SYM(_uhoh) | 101: - .long SYM(_uhoh) | 102: - .long SYM(_uhoh) | 103: - .long SYM(_uhoh) | 104: - .long SYM(_uhoh) | 105: - .long SYM(_uhoh) | 106: - .long SYM(_uhoh) | 107: - .long SYM(_uhoh) | 108: - .long SYM(_uhoh) | 109: - .long SYM(_uhoh) | 110: - .long SYM(_uhoh) | 111: - .long SYM(_uhoh) | 112: - .long SYM(_uhoh) | 113: - .long SYM(_uhoh) | 114: - .long SYM(_uhoh) | 115: - .long SYM(_uhoh) | 116: - .long SYM(_uhoh) | 117: - .long SYM(_uhoh) | 118: - .long SYM(_uhoh) | 119: - .long SYM(_uhoh) | 120: - .long SYM(_uhoh) | 121: - .long SYM(_uhoh) | 122: - .long SYM(_uhoh) | 123: - .long SYM(_uhoh) | 124: - .long SYM(_uhoh) | 125: - .long SYM(_uhoh) | 126: - .long SYM(_uhoh) | 127: - .long SYM(_uhoh) | 128: - .long SYM(_uhoh) | 129: - .long SYM(_uhoh) | 130: - .long SYM(_uhoh) | 131: - .long SYM(_uhoh) | 132: - .long SYM(_uhoh) | 133: - .long SYM(_uhoh) | 134: - .long SYM(_uhoh) | 135: - .long SYM(_uhoh) | 136: - .long SYM(_uhoh) | 137: - .long SYM(_uhoh) | 138: - .long SYM(_uhoh) | 139: - .long SYM(_uhoh) | 140: - .long SYM(_uhoh) | 141: - .long SYM(_uhoh) | 142: - .long SYM(_uhoh) | 143: - .long SYM(_uhoh) | 144: - .long SYM(_uhoh) | 145: - .long SYM(_uhoh) | 146: - .long SYM(_uhoh) | 147: - .long SYM(_uhoh) | 148: - .long SYM(_uhoh) | 149: - .long SYM(_uhoh) | 150: - .long SYM(_uhoh) | 151: - .long SYM(_uhoh) | 152: - .long SYM(_uhoh) | 153: - .long SYM(_uhoh) | 154: - .long SYM(_uhoh) | 155: - .long SYM(_uhoh) | 156: - .long SYM(_uhoh) | 157: - .long SYM(_uhoh) | 158: - .long SYM(_uhoh) | 159: - .long SYM(_uhoh) | 160: - .long SYM(_uhoh) | 161: - .long SYM(_uhoh) | 162: - .long SYM(_uhoh) | 163: - .long SYM(_uhoh) | 164: - .long SYM(_uhoh) | 165: - .long SYM(_uhoh) | 166: - .long SYM(_uhoh) | 167: - .long SYM(_uhoh) | 168: - .long SYM(_uhoh) | 169: - .long SYM(_uhoh) | 170: - .long SYM(_uhoh) | 171: - .long SYM(_uhoh) | 172: - .long SYM(_uhoh) | 173: - .long SYM(_uhoh) | 174: - .long SYM(_uhoh) | 175: - .long SYM(_uhoh) | 176: - .long SYM(_uhoh) | 177: - .long SYM(_uhoh) | 178: - .long SYM(_uhoh) | 179: - .long SYM(_uhoh) | 180: - .long SYM(_uhoh) | 181: - .long SYM(_uhoh) | 182: - .long SYM(_uhoh) | 183: - .long SYM(_uhoh) | 184: - .long SYM(_uhoh) | 185: - .long SYM(_uhoh) | 186: - .long SYM(_uhoh) | 187: - .long SYM(_uhoh) | 188: - .long SYM(_uhoh) | 189: - .long SYM(_uhoh) | 190: - .long SYM(_uhoh) | 191: - .long SYM(_uhoh) | 192: - .long SYM(_uhoh) | 193: - .long SYM(_uhoh) | 194: - .long SYM(_uhoh) | 195: - .long SYM(_uhoh) | 196: - .long SYM(_uhoh) | 197: - .long SYM(_uhoh) | 198: - .long SYM(_uhoh) | 199: - .long SYM(_uhoh) | 200: - .long SYM(_uhoh) | 201: - .long SYM(_uhoh) | 202: - .long SYM(_uhoh) | 203: - .long SYM(_uhoh) | 204: - .long SYM(_uhoh) | 205: - .long SYM(_uhoh) | 206: - .long SYM(_uhoh) | 207: - .long SYM(_uhoh) | 208: - .long SYM(_uhoh) | 209: - .long SYM(_uhoh) | 210: - .long SYM(_uhoh) | 211: - .long SYM(_uhoh) | 212: - .long SYM(_uhoh) | 213: - .long SYM(_uhoh) | 214: - .long SYM(_uhoh) | 215: - .long SYM(_uhoh) | 216: - .long SYM(_uhoh) | 217: - .long SYM(_uhoh) | 218: - .long SYM(_uhoh) | 219: - .long SYM(_uhoh) | 220: - .long SYM(_uhoh) | 221: - .long SYM(_uhoh) | 222: - .long SYM(_uhoh) | 223: - .long SYM(_uhoh) | 224: - .long SYM(_uhoh) | 225: - .long SYM(_uhoh) | 226: - .long SYM(_uhoh) | 227: - .long SYM(_uhoh) | 228: - .long SYM(_uhoh) | 229: - .long SYM(_uhoh) | 230: - .long SYM(_uhoh) | 231: - .long SYM(_uhoh) | 232: - .long SYM(_uhoh) | 233: - .long SYM(_uhoh) | 234: - .long SYM(_uhoh) | 235: - .long SYM(_uhoh) | 236: - .long SYM(_uhoh) | 237: - .long SYM(_uhoh) | 238: - .long SYM(_uhoh) | 239: - .long SYM(_uhoh) | 240: - .long SYM(_uhoh) | 241: - .long SYM(_uhoh) | 242: - .long SYM(_uhoh) | 243: - .long SYM(_uhoh) | 244: - .long SYM(_uhoh) | 245: - .long SYM(_uhoh) | 246: - .long SYM(_uhoh) | 247: - .long SYM(_uhoh) | 248: - .long SYM(_uhoh) | 249: - .long SYM(_uhoh) | 250: - .long SYM(_uhoh) | 251: - .long SYM(_uhoh) | 252: - .long SYM(_uhoh) | 253: - .long SYM(_uhoh) | 254: - .long SYM(_uhoh) | 255: - -/* - * Default trap handler - * With an oscilloscope you can see AS* stop - */ - PUBLIC (_uhoh) -SYM(_uhoh): nop | Leave spot for breakpoint - stop #0x2700 | Stop with interrupts disabled - bra.s SYM(_uhoh) | Stuck forever - -/* - * Log, but otherwise ignore, spurious interrupts - */ - PUBLIC (_spuriousInterrupt) -SYM(_spuriousInterrupt): - addql #1,SYM(_M68kSpuriousInterruptCount) - rte - -/* - * Place the low-order 3 octets of the board's ethernet address at - * a `well-known' fixed location relative to the startup location. - */ - .align 2 - .word 0 | Padding -ethernet_address_buffer: - .word 0x08F3 | Default address - .word 0xDEAD - .word 0xCAFE - -/* - * Initial PC - */ -.globl start -start: - /* - * Step 2: Stay in Supervisor Mode - */ -#if ( M68K_HAS_SEPARATE_STACKS == 1 ) - oriw #0x3000,sr | Switch to Master Stack Pointer - lea SYM(m360)+1024-64,a7 | Put stack in dual-port ram - | a little below the interrupt stack -#endif - - /* - * Step 3: Write the VBR - */ - lea Entry,a0 | Get base of vector table - movec a0,vbr | Set up the VBR - - /* - * Step 4: Write the MBAR - */ - movec dfc,d1 | Save destination register - moveq #7,d0 | CPU-space funcction code - movec d0,dfc | Set destination function code register - movel #SYM(m360)+0x101,d0 | MBAR value (mask CPU space accesses) - movesl d0,0x3FF00 | Set MBAR - movec d1,dfc | Restore destination register - - /* - * Step 5: Verify a dual-port RAM location - */ - lea SYM(m360),a0 | Point a0 to first DPRAM location - moveb #0x33,d0 | Set the test value - moveb d0,a0@ | Set the memory location - cmpb a0@,d0 | Does it read back? - bne SYM(_uhoh) | If not, bad news! - notb d0 | Flip bits - moveb d0,a0@ | Set the memory location - cmpb a0@,d0 | Does it read back? - bne SYM(_uhoh) | If not, bad news! - - /* - * Remaining steps are handled by C code - */ - jmp SYM(_Init68360) | Start C code (which never returns) - -/* - * Copy DATA segment, clear BSS segment, set up real stack, - * initialize heap, start C program. - * Assume that DATA and BSS sizes are multiples of 4. - */ - PUBLIC (_CopyDataClearBSSAndStart) -SYM(_CopyDataClearBSSAndStart): - lea copy_start,a0 | Get start of DATA in RAM - lea SYM(etext),a2 | Get start of DATA in ROM - cmpl a0,a2 | Are they the same? - beq.s NOCOPY | Yes, no copy necessary - lea copy_end,a1 | Get end of DATA in RAM - bra.s COPYLOOPTEST | Branch into copy loop -COPYLOOP: - movel a2@+,a0@+ | Copy word from ROM to RAM -COPYLOOPTEST: - cmpl a1,a0 | Done? - bcs.s COPYLOOP | No, skip -NOCOPY: - - lea clear_start,a0 | Get start of BSS - lea clear_end,a1 | Get end of BSS - clrl d0 | Value to set - bra.s ZEROLOOPTEST | Branch into clear loop -ZEROLOOP: - movel d0,a0@+ | Clear a word -ZEROLOOPTEST: - cmpl a1,a0 | Done? - bcs.s ZEROLOOP | No, skip - - movel #stack_init,a7 | set master stack pointer - movel d0,a7@- | environp - movel d0,a7@- | argv - movel d0,a7@- | argc - jsr SYM(boot_card) | Call C main - - PUBLIC (_mainDone) -SYM(_mainDone): - nop | Leave spot for breakpoint - movew #1,a7 | Force a double bus error - movel d0,a7@- | This should cause a RESET - stop #0x2700 | Stop with interrupts disabled - bra.s SYM(_mainDone) | Stuck forever - - .align 2 - PUBLIC (_HeapSize) -SYM (_HeapSize): - .long HeapSize - PUBLIC (_StackSize) -SYM (_StackSize): - .long StackSize -END_CODE - -BEGIN_DATA_DCL - .align 2 - PUBLIC (environ) -SYM (environ): - .long 0 - PUBLIC (_M68kSpuriousInterruptCount) -SYM (_M68kSpuriousInterruptCount): - .long 0 -END_DATA_DCL - -END - diff --git a/c/src/lib/libbsp/m68k/ods68302/start/Makefile.in b/c/src/lib/libbsp/m68k/ods68302/start/Makefile.in deleted file mode 100644 index a6d3ba2c08..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/start/Makefile.in +++ /dev/null @@ -1,69 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -PGM=${ARCH}/start302.o - -ifeq ($(RTEMS_DEBUGGER),yes) -RESET_SRC = debugreset -else -RESET_SRC = reset -CFLAGS += -DGDB_MONITOR_ACTIVE -endif - -# C source names, if any, go here -- minus the .c -C_PIECES=cpuboot -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -# Assembly source names, if any, go here -- minus the .s -S_PIECES=$(RESET_SRC) -S_FILES=$(S_PIECES:%=%.s) -S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o) - -SRCS=$(C_FILES) $(H_FILES) $(S_FILES) -OBJS=$(S_O_FILES) $(C_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -${PGM}: ${OBJS} - $(make-rel) - -all: ${ARCH} $(SRCS) $(OBJS) $(PGM) - $(INSTALL_VARIANT) -m 555 ${PGM} ${PROJECT_RELEASE}/lib - -# Install the program(s), appending _g or _p as appropriate. -# for include files, just use $(INSTALL) - - diff --git a/c/src/lib/libbsp/m68k/ods68302/start/cpuboot.c b/c/src/lib/libbsp/m68k/ods68302/start/cpuboot.c deleted file mode 100644 index fd8a4146de..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/start/cpuboot.c +++ /dev/null @@ -1,133 +0,0 @@ -/*****************************************************************************/ -/* - Boot the CPU. - - Occurs in 3 phases for a 68302. - - Phase 1. - - Called as soon as able after reset. The BAR has been programed, and - a small stack exists in the DPRAM. All interrupts are masked, and - the processor is running in supervisor mode. No other hardware or - chip selects are active. - - This phase programs the chip select registers, the parallel ports - are set into default configurations, and basic registers cleared or - reset. The leds are programmed to show the end of phase 1. - - Phase 2. - - This is a piece of code which is copied to DPRAM and executed. It - should not do any more thann is currently present. The return to ROM - is managed by modifing the return address. Again leds show the status. - - Phase 3. - - This code executes with a valid C environment. That is the data - section has been intialised and the bss section set to 0. This phase - performs any special card initialisation and then calls boot card. - - $Id$ - -*/ -/*****************************************************************************/ - -#include <bsp.h> -#include <m68302.h> -#include <debugport.h> -#include <crc.h> - -/* - Open the address, reset all registers - */ - -void boot_phase_1() -{ - M302_SCR = SCR_DEFAULT; - - WRITE_OR(CSEL_ROM, ROM_SIZE, ROM_WAIT_STATES, OR_MASK_RW, OR_MASK_FC); - WRITE_BR(CSEL_ROM, RAM_BASE, BR_READ_ONLY, BR_FC_NULL, BR_ENABLED); - WRITE_OR(CSEL_RAM, RAM_SIZE, RAM_WAIT_STATES, OR_MASK_RW, OR_MASK_FC); - WRITE_BR(CSEL_RAM, ROM_BASE, BR_READ_WRITE, BR_FC_NULL, BR_ENABLED); - -#if defined(CSEL_1) - WRITE_OR(CSEL_1, CSEL_1_SIZE, CSEL_1_WAIT_STATES, OR_MASK_RW, OR_MASK_FC); - WRITE_BR(CSEL_1, CSEL_1_BASE, BR_READ_WRITE, BR_FC_NULL, BR_ENABLED); -#endif - -#if defined(CSEL_2) - WRITE_OR(CSEL_2, CSEL_2_SIZE, CSEL_2_WAIT_STATES, OR_MASK_RW, OR_MASK_FC); - WRITE_BR(CSEL_2, CSEL_2_BASE, BR_READ_WRITE, BR_FC_NULL, BR_ENABLED); -#endif - - m302.reg.gimr = m302.reg.ipr = m302.reg.imr = m302.reg.isr = 0; - - m302.reg.simode = 0; - - m302.reg.pacnt = CARD_PA_CONFIGURATION; - m302.reg.paddr = CARD_PA_DEFAULT_DIRECTIONS; - m302.reg.padat = CARD_PA_DEFAULT_DATA; - - m302.reg.pbcnt = CARD_PB_CONFIGURATION; - m302.reg.pbddr = CARD_PB_DEFAULT_DIRECTIONS; - m302.reg.pbdat = CARD_PB_DEFAULT_DATA; - - m302.reg.wrr = WATCHDOG_TIMEOUT_PERIOD | WATCHDOG_ENABLE; - -#if defined(LED_CONTROL) - LED_CONTROL(LED_1_RED, LED_2_OFF, LED_3_OFF, LED_4_OFF, - LED_5_OFF, LED_6_OFF, LED_7_OFF, LED_8_OFF); -#endif -} - -/* - Swap the chip select mapping for ROM and RAM - */ - -void boot_phase_2(void) -{ - rtems_unsigned32 stack; - -#if defined(LED_CONTROL) - LED_CONTROL(LED_1_RED, LED_2_RED, LED_3_OFF, LED_4_OFF, - LED_5_OFF, LED_6_OFF, LED_7_OFF, LED_8_OFF); -#endif - - WRITE_BR(CSEL_ROM, ROM_BASE, BR_READ_ONLY, BR_FC_NULL, BR_ENABLED); - WRITE_BR(CSEL_RAM, RAM_BASE, BR_READ_WRITE, BR_FC_NULL, BR_ENABLED); - -#if defined(LED_CONTROL) - LED_CONTROL(LED_1_GREEN, LED_2_RED, LED_3_OFF, LED_4_OFF, - LED_5_OFF, LED_6_OFF, LED_7_OFF, LED_8_OFF); -#endif - - /* seems to want 2, looked at assember code output */ - *(&stack + 2) |= ROM_BASE; -} - -/* - Any pre-main initialisation, the C environment is setup, how-ever C++ - static constructors have not been called, and RTEMS is not initialised. - */ - -void boot_card(); -void set_debug_traps(); -void breakpoint(); - -void boot_phase_3(void) -{ - if (GDB_RUN_MONITOR()) - { - set_debug_traps(); - breakpoint(); - } - - debug_port_banner(); - - /* FIXME : add RAM and ROM checks */ - - /* boot the bsp, what ever this means */ - boot_card(); - - WATCHDOG_TRIGGER(); -} diff --git a/c/src/lib/libbsp/m68k/ods68302/start/debugreset.S b/c/src/lib/libbsp/m68k/ods68302/start/debugreset.S deleted file mode 100644 index 74049191c4..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/start/debugreset.S +++ /dev/null @@ -1,107 +0,0 @@ -/* - * $Id$ - * - * Re-written the gen68302 start-up code. - * - * Uses gas syntax only, removed the OAR asm.h. - * - * Supplies a complete vector table in ROM. - * - * Manages all vectors with seperate handlers to trap unhandled - * execptions. - * - * Uses the target specific header file to get the runtime - * configuration - * - * COPYRIGHT (c) 1996 - * Objective Design Systems Pty Ltd (ODS) - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - */ - -| -| Entry from debugger -| - .sect .text - -| -| Start -| -| Entered from a hardware reset. -| - - .global start | Default entry point for GNU -start: - - move.w #0x2700,%sr | Disable all interrupts - - | - | zero out uninitialized data area - | - -zerobss: - moveal #end,%a0 | find end of .bss - moveal #bss_start,%a1 | find beginning of .bss - moveq #0,%d0 - -zerobss_loop: - - movel %d0,%a1@+ | to zero out uninitialized - cmpal %a0,%a1 - jlt zerobss_loop | loop until _end reached - - movel #end,%d0 | d0 = end of bss/start of heap - addl #heap_size,%d0 | d0 = end of heap - - movel %d0,stack_start | Save for brk() routine - addl #stack_size,%d0 | make room for stack - andl #0xffffffc0,%d0 | align it on 16 byte boundary - - movw #0x3700,%sr | SUPV MODE,INTERRUPTS OFF!!! - movel %d0,%a7 | set master stack pointer - movel %d0,%a6 | set base pointer - - jsr boot_phase_3 - -| -| Initialised data -| - - .sect .data - - .global start_frame - -start_frame: - .space 4,0 - - .global stack_start - -stack_start: - .space 4,0 - -| -| Uninitialised data -| - - .sect .bss - - .global environ - .align 2 - -environ: - .long 0 - - .global heap_size - .set heap_size,0x2000 - - .global stack_size - .set stack_size,0x1000 - - diff --git a/c/src/lib/libbsp/m68k/ods68302/start/reset.S b/c/src/lib/libbsp/m68k/ods68302/start/reset.S deleted file mode 100644 index 71d1071243..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/start/reset.S +++ /dev/null @@ -1,881 +0,0 @@ -/* - * $Id$ - * - * Re-written the gen68302 start-up code. - * - * Uses gas syntax only, removed the OAR asm.h. - * - * Supplies a complete vector table in ROM. - * - * Manages all vectors with seperate handlers to trap unhandled - * execptions. - * - * Uses the target specific header file to get the runtime - * configuration - * - * COPYRIGHT (c) 1996 - * Objective Design Systems Pty Ltd (ODS) - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - */ - -| -| some basic defined, this is that is required -| -#define MC68302_BAR 0x000000F2 -#define MC68302_BAR_FC_CFC 0x0000 -#define MC68302_SYS_RAM_SIZE 0x240 - -| -| Boot boot code in a special section, ld postions -| -| Initial stack pointer is in the dual ported RAM -| - .sect .text - - .global M68Kvec | Vector Table - -M68Kvec: | standard location for vectors - -| -| Make relative, can have the code positioned any where -| - -V___ISSP: .long MC68302_BASE + MC68302_SYS_RAM_SIZE -V____IPC: .long start - V___ISSP - -| -| Create the rest of the vector table to point to the unhandled expection -| handler -| -| Lots of macros, how-ever it creates a simple ROM vector table -| - -exception_handler = unhandled_exception - V___ISSP -#define MAKE_EXCEPTION_VECTOR(n) V___##n: .long (exception_handler + (n * 8)) - -MAKE_EXCEPTION_VECTOR(2) -MAKE_EXCEPTION_VECTOR(3) -MAKE_EXCEPTION_VECTOR(4) -MAKE_EXCEPTION_VECTOR(5) -MAKE_EXCEPTION_VECTOR(6) -MAKE_EXCEPTION_VECTOR(7) -MAKE_EXCEPTION_VECTOR(8) -MAKE_EXCEPTION_VECTOR(9) - -MAKE_EXCEPTION_VECTOR(10) -MAKE_EXCEPTION_VECTOR(11) -MAKE_EXCEPTION_VECTOR(12) -MAKE_EXCEPTION_VECTOR(13) -MAKE_EXCEPTION_VECTOR(14) -MAKE_EXCEPTION_VECTOR(15) -MAKE_EXCEPTION_VECTOR(16) -MAKE_EXCEPTION_VECTOR(17) -MAKE_EXCEPTION_VECTOR(18) -MAKE_EXCEPTION_VECTOR(19) - -MAKE_EXCEPTION_VECTOR(20) -MAKE_EXCEPTION_VECTOR(21) -MAKE_EXCEPTION_VECTOR(22) -MAKE_EXCEPTION_VECTOR(23) -MAKE_EXCEPTION_VECTOR(24) -MAKE_EXCEPTION_VECTOR(25) -MAKE_EXCEPTION_VECTOR(26) -MAKE_EXCEPTION_VECTOR(27) -MAKE_EXCEPTION_VECTOR(28) -MAKE_EXCEPTION_VECTOR(29) - -MAKE_EXCEPTION_VECTOR(30) -MAKE_EXCEPTION_VECTOR(31) -MAKE_EXCEPTION_VECTOR(32) -MAKE_EXCEPTION_VECTOR(33) -MAKE_EXCEPTION_VECTOR(34) -MAKE_EXCEPTION_VECTOR(35) -MAKE_EXCEPTION_VECTOR(36) -MAKE_EXCEPTION_VECTOR(37) -MAKE_EXCEPTION_VECTOR(38) -MAKE_EXCEPTION_VECTOR(39) - -MAKE_EXCEPTION_VECTOR(40) -MAKE_EXCEPTION_VECTOR(41) -MAKE_EXCEPTION_VECTOR(42) -MAKE_EXCEPTION_VECTOR(43) -MAKE_EXCEPTION_VECTOR(44) -MAKE_EXCEPTION_VECTOR(45) -MAKE_EXCEPTION_VECTOR(46) -MAKE_EXCEPTION_VECTOR(47) -MAKE_EXCEPTION_VECTOR(48) -MAKE_EXCEPTION_VECTOR(49) - -MAKE_EXCEPTION_VECTOR(50) -MAKE_EXCEPTION_VECTOR(51) -MAKE_EXCEPTION_VECTOR(52) -MAKE_EXCEPTION_VECTOR(53) -MAKE_EXCEPTION_VECTOR(54) -MAKE_EXCEPTION_VECTOR(55) -MAKE_EXCEPTION_VECTOR(56) -MAKE_EXCEPTION_VECTOR(57) -MAKE_EXCEPTION_VECTOR(58) -MAKE_EXCEPTION_VECTOR(59) - -MAKE_EXCEPTION_VECTOR(60) -MAKE_EXCEPTION_VECTOR(61) -MAKE_EXCEPTION_VECTOR(62) -MAKE_EXCEPTION_VECTOR(63) -MAKE_EXCEPTION_VECTOR(64) -MAKE_EXCEPTION_VECTOR(65) -MAKE_EXCEPTION_VECTOR(66) -MAKE_EXCEPTION_VECTOR(67) -MAKE_EXCEPTION_VECTOR(68) -MAKE_EXCEPTION_VECTOR(69) - -MAKE_EXCEPTION_VECTOR(70) -MAKE_EXCEPTION_VECTOR(71) -MAKE_EXCEPTION_VECTOR(72) -MAKE_EXCEPTION_VECTOR(73) -MAKE_EXCEPTION_VECTOR(74) -MAKE_EXCEPTION_VECTOR(75) -MAKE_EXCEPTION_VECTOR(76) -MAKE_EXCEPTION_VECTOR(77) -MAKE_EXCEPTION_VECTOR(78) -MAKE_EXCEPTION_VECTOR(79) - -MAKE_EXCEPTION_VECTOR(80) -MAKE_EXCEPTION_VECTOR(81) -MAKE_EXCEPTION_VECTOR(82) -MAKE_EXCEPTION_VECTOR(83) -MAKE_EXCEPTION_VECTOR(84) -MAKE_EXCEPTION_VECTOR(85) -MAKE_EXCEPTION_VECTOR(86) -MAKE_EXCEPTION_VECTOR(87) -MAKE_EXCEPTION_VECTOR(88) -MAKE_EXCEPTION_VECTOR(89) - -MAKE_EXCEPTION_VECTOR(90) -MAKE_EXCEPTION_VECTOR(91) -MAKE_EXCEPTION_VECTOR(92) -MAKE_EXCEPTION_VECTOR(93) -MAKE_EXCEPTION_VECTOR(94) -MAKE_EXCEPTION_VECTOR(95) -MAKE_EXCEPTION_VECTOR(96) -MAKE_EXCEPTION_VECTOR(97) -MAKE_EXCEPTION_VECTOR(98) -MAKE_EXCEPTION_VECTOR(99) - -MAKE_EXCEPTION_VECTOR(100) -MAKE_EXCEPTION_VECTOR(101) -MAKE_EXCEPTION_VECTOR(102) -MAKE_EXCEPTION_VECTOR(103) -MAKE_EXCEPTION_VECTOR(104) -MAKE_EXCEPTION_VECTOR(105) -MAKE_EXCEPTION_VECTOR(106) -MAKE_EXCEPTION_VECTOR(107) -MAKE_EXCEPTION_VECTOR(108) -MAKE_EXCEPTION_VECTOR(109) - -MAKE_EXCEPTION_VECTOR(110) -MAKE_EXCEPTION_VECTOR(111) -MAKE_EXCEPTION_VECTOR(112) -MAKE_EXCEPTION_VECTOR(113) -MAKE_EXCEPTION_VECTOR(114) -MAKE_EXCEPTION_VECTOR(115) -MAKE_EXCEPTION_VECTOR(116) -MAKE_EXCEPTION_VECTOR(117) -MAKE_EXCEPTION_VECTOR(118) -MAKE_EXCEPTION_VECTOR(119) - -MAKE_EXCEPTION_VECTOR(120) -MAKE_EXCEPTION_VECTOR(121) -MAKE_EXCEPTION_VECTOR(122) -MAKE_EXCEPTION_VECTOR(123) -MAKE_EXCEPTION_VECTOR(124) -MAKE_EXCEPTION_VECTOR(125) -MAKE_EXCEPTION_VECTOR(126) -MAKE_EXCEPTION_VECTOR(127) -MAKE_EXCEPTION_VECTOR(128) -MAKE_EXCEPTION_VECTOR(129) - -MAKE_EXCEPTION_VECTOR(130) -MAKE_EXCEPTION_VECTOR(131) -MAKE_EXCEPTION_VECTOR(132) -MAKE_EXCEPTION_VECTOR(133) -MAKE_EXCEPTION_VECTOR(134) -MAKE_EXCEPTION_VECTOR(135) -MAKE_EXCEPTION_VECTOR(136) -MAKE_EXCEPTION_VECTOR(137) -MAKE_EXCEPTION_VECTOR(138) -MAKE_EXCEPTION_VECTOR(139) - -MAKE_EXCEPTION_VECTOR(140) -MAKE_EXCEPTION_VECTOR(141) -MAKE_EXCEPTION_VECTOR(142) -MAKE_EXCEPTION_VECTOR(143) -MAKE_EXCEPTION_VECTOR(144) -MAKE_EXCEPTION_VECTOR(145) -MAKE_EXCEPTION_VECTOR(146) -MAKE_EXCEPTION_VECTOR(147) -MAKE_EXCEPTION_VECTOR(148) -MAKE_EXCEPTION_VECTOR(149) - -MAKE_EXCEPTION_VECTOR(150) -MAKE_EXCEPTION_VECTOR(151) -MAKE_EXCEPTION_VECTOR(152) -MAKE_EXCEPTION_VECTOR(153) -MAKE_EXCEPTION_VECTOR(154) -MAKE_EXCEPTION_VECTOR(155) -MAKE_EXCEPTION_VECTOR(156) -MAKE_EXCEPTION_VECTOR(157) -MAKE_EXCEPTION_VECTOR(158) -MAKE_EXCEPTION_VECTOR(159) - -MAKE_EXCEPTION_VECTOR(160) -MAKE_EXCEPTION_VECTOR(161) -MAKE_EXCEPTION_VECTOR(162) -MAKE_EXCEPTION_VECTOR(163) -MAKE_EXCEPTION_VECTOR(164) -MAKE_EXCEPTION_VECTOR(165) -MAKE_EXCEPTION_VECTOR(166) -MAKE_EXCEPTION_VECTOR(167) -MAKE_EXCEPTION_VECTOR(168) -MAKE_EXCEPTION_VECTOR(169) - -MAKE_EXCEPTION_VECTOR(170) -MAKE_EXCEPTION_VECTOR(171) -MAKE_EXCEPTION_VECTOR(172) -MAKE_EXCEPTION_VECTOR(173) -MAKE_EXCEPTION_VECTOR(174) -MAKE_EXCEPTION_VECTOR(175) -MAKE_EXCEPTION_VECTOR(176) -MAKE_EXCEPTION_VECTOR(177) -MAKE_EXCEPTION_VECTOR(178) -MAKE_EXCEPTION_VECTOR(179) - -MAKE_EXCEPTION_VECTOR(180) -MAKE_EXCEPTION_VECTOR(181) -MAKE_EXCEPTION_VECTOR(182) -MAKE_EXCEPTION_VECTOR(183) -MAKE_EXCEPTION_VECTOR(184) -MAKE_EXCEPTION_VECTOR(185) -MAKE_EXCEPTION_VECTOR(186) -MAKE_EXCEPTION_VECTOR(187) -MAKE_EXCEPTION_VECTOR(188) -MAKE_EXCEPTION_VECTOR(189) - -MAKE_EXCEPTION_VECTOR(190) -MAKE_EXCEPTION_VECTOR(191) -MAKE_EXCEPTION_VECTOR(192) -MAKE_EXCEPTION_VECTOR(193) -MAKE_EXCEPTION_VECTOR(194) -MAKE_EXCEPTION_VECTOR(195) -MAKE_EXCEPTION_VECTOR(196) -MAKE_EXCEPTION_VECTOR(197) -MAKE_EXCEPTION_VECTOR(198) -MAKE_EXCEPTION_VECTOR(199) - -MAKE_EXCEPTION_VECTOR(200) -MAKE_EXCEPTION_VECTOR(201) -MAKE_EXCEPTION_VECTOR(202) -MAKE_EXCEPTION_VECTOR(203) -MAKE_EXCEPTION_VECTOR(204) -MAKE_EXCEPTION_VECTOR(205) -MAKE_EXCEPTION_VECTOR(206) -MAKE_EXCEPTION_VECTOR(207) -MAKE_EXCEPTION_VECTOR(208) -MAKE_EXCEPTION_VECTOR(209) - -MAKE_EXCEPTION_VECTOR(210) -MAKE_EXCEPTION_VECTOR(211) -MAKE_EXCEPTION_VECTOR(212) -MAKE_EXCEPTION_VECTOR(213) -MAKE_EXCEPTION_VECTOR(214) -MAKE_EXCEPTION_VECTOR(215) -MAKE_EXCEPTION_VECTOR(216) -MAKE_EXCEPTION_VECTOR(217) -MAKE_EXCEPTION_VECTOR(218) -MAKE_EXCEPTION_VECTOR(219) - -MAKE_EXCEPTION_VECTOR(220) -MAKE_EXCEPTION_VECTOR(221) -MAKE_EXCEPTION_VECTOR(222) -MAKE_EXCEPTION_VECTOR(223) -MAKE_EXCEPTION_VECTOR(224) -MAKE_EXCEPTION_VECTOR(225) -MAKE_EXCEPTION_VECTOR(226) -MAKE_EXCEPTION_VECTOR(227) -MAKE_EXCEPTION_VECTOR(228) -MAKE_EXCEPTION_VECTOR(229) - -MAKE_EXCEPTION_VECTOR(230) -MAKE_EXCEPTION_VECTOR(231) -MAKE_EXCEPTION_VECTOR(232) -MAKE_EXCEPTION_VECTOR(233) -MAKE_EXCEPTION_VECTOR(234) -MAKE_EXCEPTION_VECTOR(235) -MAKE_EXCEPTION_VECTOR(236) -MAKE_EXCEPTION_VECTOR(237) -MAKE_EXCEPTION_VECTOR(238) -MAKE_EXCEPTION_VECTOR(239) - -MAKE_EXCEPTION_VECTOR(240) -MAKE_EXCEPTION_VECTOR(241) -MAKE_EXCEPTION_VECTOR(242) -MAKE_EXCEPTION_VECTOR(243) -MAKE_EXCEPTION_VECTOR(244) -MAKE_EXCEPTION_VECTOR(245) -MAKE_EXCEPTION_VECTOR(246) -MAKE_EXCEPTION_VECTOR(247) -MAKE_EXCEPTION_VECTOR(248) -MAKE_EXCEPTION_VECTOR(249) - -MAKE_EXCEPTION_VECTOR(250) -MAKE_EXCEPTION_VECTOR(251) -MAKE_EXCEPTION_VECTOR(252) -MAKE_EXCEPTION_VECTOR(253) -MAKE_EXCEPTION_VECTOR(254) -MAKE_EXCEPTION_VECTOR(255) - -| -| Start -| -| Entered from a hardware reset. -| - - .global start | Default entry point for GNU -start: - - move.w #0x2700,%sr | Disable all interrupts - - | - | Program the BAR, give us a stack !! - | - - moveq #0,%d0 - move.w #(MC68302_BASE >> 12),%d0 - or.w #(MC68302_BAR_FC_CFC << 12),%d0 - move.l #MC68302_BAR,%a0 - move.w %d0,%a0@(0) - - | - | watch for sign extended maths with the linker on (boot_phase_1-V___ISSP) - | manage the address with code, limited address of 2K at reset for CS0 - | - - move.l #boot_phase_1,%d0 - and.l #0x1FFF,%d0 - move.l %d0,%a0 - jsr %a0@(0) | programs all basic 302 registers - - | - | Map to the 68302 registers - | - - move.l #MC68302_BASE,%a5 - - | - | Make a vector table in RAM - | - - move.l #RAM_BASE,%a0 | a0 -> rom vector table - moveal #ROM_BASE,%a1 | d1 -> start of tmp SRAM - - move.l #255,%d0 - -copy_vec_table: - - move.l (%a0)+,%d1 - or.l #ROM_BASE,%d1 - move.l %d1,(%a1)+ - subq.l #1,%d0 - bne copy_vec_table - -#if defined(SYSTEM_TABLE_ANCHOR_OFFSET) - | - | Clear the system table - | - - move.l #SYSTEM_TABLE_ANCHOR_OFFSET,%a0 - move.l #0,(%a0) -#endif - - | - | Copy the chip select swap code to DPRAM and run it - | - - move.l #boot_phase_2,%d0 - and.l #(ROM_SIZE - 1),%d0 - move.l %d0,%a0 | a0 -> remap code - lea %a5@(0),%a1 | a1 -> internal system RAM - - move.l #boot_phase_3,%d0 - and.l #(ROM_SIZE - 1),%d0 - sub.l %a0,%d0 - -copy_remap: - move.b (%a0)+,(%a1)+ | copy - dbra %d0,copy_remap - - | - | Jump to the remap code in the 68302''s internal system RAM. - | - - jsr %a5@(0) | execute the swap code - - | - | Map to the 68302 registers - | - - move.l #MC68302_BASE,%a5 - - | - | Copy initialized data area from ROM to RAM - | - -copy_data: - moveal #etext,%a0 | find the end of .text - moveal #data_start,%a1 | find the beginning of .data - moveal #edata,%a2 | find the end of .data - -copy_data_loop: - - movel %a0@+,%a1@+ | copy the data - cmpal %a2,%a1 - jlt copy_data_loop | loop until edata reached - - | - | zero out uninitialized data area - | - -zerobss: - moveal #end,%a0 | find end of .bss - moveal #bss_start,%a1 | find beginning of .bss - moveq #0,%d0 - -zerobss_loop: - - movel %d0,%a1@+ | to zero out uninitialized - cmpal %a0,%a1 - jlt zerobss_loop | loop until _end reached - - movel #end,%d0 | d0 = end of bss/start of heap - addl #heap_size,%d0 | d0 = end of heap - - movel %d0,stack_start | Save for brk() routine - addl #stack_size,%d0 | make room for stack - andl #0xffffffc0,%d0 | align it on 16 byte boundary - - movw #0x3700,%sr | SUPV MODE,INTERRUPTS OFF!!! - movel %d0,%a7 | set master stack pointer - movel %d0,%a6 | set base pointer - - jsr boot_phase_3 - -| -| Create an unhandled exception jump table. The table has an entry for -| each vector in the vector table. The entry pushes the vector number onto -| the stack and then calls a common exception handler using PIC. -| -| The macros are to create the labels and format vectors. -| - -#define cat(x, y) x ## y -#define FORMAT_ID(n) (n << 2) -#define EXCEPTION_HANDLER(h, n) EH__##n: move.w cat(h, FORMAT_ID(n)),-(%sp) ; \ - bra common_exception_handler - -unhandled_exception: - -EXCEPTION_HANDLER(#, 0) -EXCEPTION_HANDLER(#, 1) -EXCEPTION_HANDLER(#, 2) -EXCEPTION_HANDLER(#, 3) -EXCEPTION_HANDLER(#, 4) -EXCEPTION_HANDLER(#, 5) -EXCEPTION_HANDLER(#, 6) -EXCEPTION_HANDLER(#, 7) -EXCEPTION_HANDLER(#, 8) -EXCEPTION_HANDLER(#, 9) - -EXCEPTION_HANDLER(#, 10) -EXCEPTION_HANDLER(#, 11) -EXCEPTION_HANDLER(#, 12) -EXCEPTION_HANDLER(#, 13) -EXCEPTION_HANDLER(#, 14) -EXCEPTION_HANDLER(#, 15) -EXCEPTION_HANDLER(#, 16) -EXCEPTION_HANDLER(#, 17) -EXCEPTION_HANDLER(#, 18) -EXCEPTION_HANDLER(#, 19) - -EXCEPTION_HANDLER(#, 20) -EXCEPTION_HANDLER(#, 21) -EXCEPTION_HANDLER(#, 22) -EXCEPTION_HANDLER(#, 23) -EXCEPTION_HANDLER(#, 24) -EXCEPTION_HANDLER(#, 25) -EXCEPTION_HANDLER(#, 26) -EXCEPTION_HANDLER(#, 27) -EXCEPTION_HANDLER(#, 28) -EXCEPTION_HANDLER(#, 29) - -EXCEPTION_HANDLER(#, 30) -EXCEPTION_HANDLER(#, 31) -EXCEPTION_HANDLER(#, 32) -EXCEPTION_HANDLER(#, 33) -EXCEPTION_HANDLER(#, 34) -EXCEPTION_HANDLER(#, 35) -EXCEPTION_HANDLER(#, 36) -EXCEPTION_HANDLER(#, 37) -EXCEPTION_HANDLER(#, 38) -EXCEPTION_HANDLER(#, 39) - -EXCEPTION_HANDLER(#, 40) -EXCEPTION_HANDLER(#, 41) -EXCEPTION_HANDLER(#, 42) -EXCEPTION_HANDLER(#, 43) -EXCEPTION_HANDLER(#, 44) -EXCEPTION_HANDLER(#, 45) -EXCEPTION_HANDLER(#, 46) -EXCEPTION_HANDLER(#, 47) -EXCEPTION_HANDLER(#, 48) -EXCEPTION_HANDLER(#, 49) - -EXCEPTION_HANDLER(#, 50) -EXCEPTION_HANDLER(#, 51) -EXCEPTION_HANDLER(#, 52) -EXCEPTION_HANDLER(#, 53) -EXCEPTION_HANDLER(#, 54) -EXCEPTION_HANDLER(#, 55) -EXCEPTION_HANDLER(#, 56) -EXCEPTION_HANDLER(#, 57) -EXCEPTION_HANDLER(#, 58) -EXCEPTION_HANDLER(#, 59) - -EXCEPTION_HANDLER(#, 60) -EXCEPTION_HANDLER(#, 61) -EXCEPTION_HANDLER(#, 62) -EXCEPTION_HANDLER(#, 63) -EXCEPTION_HANDLER(#, 64) -EXCEPTION_HANDLER(#, 65) -EXCEPTION_HANDLER(#, 66) -EXCEPTION_HANDLER(#, 67) -EXCEPTION_HANDLER(#, 68) -EXCEPTION_HANDLER(#, 69) - -EXCEPTION_HANDLER(#, 70) -EXCEPTION_HANDLER(#, 71) -EXCEPTION_HANDLER(#, 72) -EXCEPTION_HANDLER(#, 73) -EXCEPTION_HANDLER(#, 74) -EXCEPTION_HANDLER(#, 75) -EXCEPTION_HANDLER(#, 76) -EXCEPTION_HANDLER(#, 77) -EXCEPTION_HANDLER(#, 78) -EXCEPTION_HANDLER(#, 79) - -EXCEPTION_HANDLER(#, 80) -EXCEPTION_HANDLER(#, 81) -EXCEPTION_HANDLER(#, 82) -EXCEPTION_HANDLER(#, 83) -EXCEPTION_HANDLER(#, 84) -EXCEPTION_HANDLER(#, 85) -EXCEPTION_HANDLER(#, 86) -EXCEPTION_HANDLER(#, 87) -EXCEPTION_HANDLER(#, 88) -EXCEPTION_HANDLER(#, 89) - -EXCEPTION_HANDLER(#, 90) -EXCEPTION_HANDLER(#, 91) -EXCEPTION_HANDLER(#, 92) -EXCEPTION_HANDLER(#, 93) -EXCEPTION_HANDLER(#, 94) -EXCEPTION_HANDLER(#, 95) -EXCEPTION_HANDLER(#, 96) -EXCEPTION_HANDLER(#, 97) -EXCEPTION_HANDLER(#, 98) -EXCEPTION_HANDLER(#, 99) - -EXCEPTION_HANDLER(#, 100) -EXCEPTION_HANDLER(#, 101) -EXCEPTION_HANDLER(#, 102) -EXCEPTION_HANDLER(#, 103) -EXCEPTION_HANDLER(#, 104) -EXCEPTION_HANDLER(#, 105) -EXCEPTION_HANDLER(#, 106) -EXCEPTION_HANDLER(#, 107) -EXCEPTION_HANDLER(#, 108) -EXCEPTION_HANDLER(#, 109) - -EXCEPTION_HANDLER(#, 110) -EXCEPTION_HANDLER(#, 111) -EXCEPTION_HANDLER(#, 112) -EXCEPTION_HANDLER(#, 113) -EXCEPTION_HANDLER(#, 114) -EXCEPTION_HANDLER(#, 115) -EXCEPTION_HANDLER(#, 116) -EXCEPTION_HANDLER(#, 117) -EXCEPTION_HANDLER(#, 118) -EXCEPTION_HANDLER(#, 119) - -EXCEPTION_HANDLER(#, 120) -EXCEPTION_HANDLER(#, 121) -EXCEPTION_HANDLER(#, 122) -EXCEPTION_HANDLER(#, 123) -EXCEPTION_HANDLER(#, 124) -EXCEPTION_HANDLER(#, 125) -EXCEPTION_HANDLER(#, 126) -EXCEPTION_HANDLER(#, 127) -EXCEPTION_HANDLER(#, 128) -EXCEPTION_HANDLER(#, 129) - -EXCEPTION_HANDLER(#, 130) -EXCEPTION_HANDLER(#, 131) -EXCEPTION_HANDLER(#, 132) -EXCEPTION_HANDLER(#, 133) -EXCEPTION_HANDLER(#, 134) -EXCEPTION_HANDLER(#, 135) -EXCEPTION_HANDLER(#, 136) -EXCEPTION_HANDLER(#, 137) -EXCEPTION_HANDLER(#, 138) -EXCEPTION_HANDLER(#, 139) - -EXCEPTION_HANDLER(#, 140) -EXCEPTION_HANDLER(#, 141) -EXCEPTION_HANDLER(#, 142) -EXCEPTION_HANDLER(#, 143) -EXCEPTION_HANDLER(#, 144) -EXCEPTION_HANDLER(#, 145) -EXCEPTION_HANDLER(#, 146) -EXCEPTION_HANDLER(#, 147) -EXCEPTION_HANDLER(#, 148) -EXCEPTION_HANDLER(#, 149) - -EXCEPTION_HANDLER(#, 150) -EXCEPTION_HANDLER(#, 151) -EXCEPTION_HANDLER(#, 152) -EXCEPTION_HANDLER(#, 153) -EXCEPTION_HANDLER(#, 154) -EXCEPTION_HANDLER(#, 155) -EXCEPTION_HANDLER(#, 156) -EXCEPTION_HANDLER(#, 157) -EXCEPTION_HANDLER(#, 158) -EXCEPTION_HANDLER(#, 159) - -EXCEPTION_HANDLER(#, 160) -EXCEPTION_HANDLER(#, 161) -EXCEPTION_HANDLER(#, 162) -EXCEPTION_HANDLER(#, 163) -EXCEPTION_HANDLER(#, 164) -EXCEPTION_HANDLER(#, 165) -EXCEPTION_HANDLER(#, 166) -EXCEPTION_HANDLER(#, 167) -EXCEPTION_HANDLER(#, 168) -EXCEPTION_HANDLER(#, 169) - -EXCEPTION_HANDLER(#, 170) -EXCEPTION_HANDLER(#, 171) -EXCEPTION_HANDLER(#, 172) -EXCEPTION_HANDLER(#, 173) -EXCEPTION_HANDLER(#, 174) -EXCEPTION_HANDLER(#, 175) -EXCEPTION_HANDLER(#, 176) -EXCEPTION_HANDLER(#, 177) -EXCEPTION_HANDLER(#, 178) -EXCEPTION_HANDLER(#, 179) - -EXCEPTION_HANDLER(#, 180) -EXCEPTION_HANDLER(#, 181) -EXCEPTION_HANDLER(#, 182) -EXCEPTION_HANDLER(#, 183) -EXCEPTION_HANDLER(#, 184) -EXCEPTION_HANDLER(#, 185) -EXCEPTION_HANDLER(#, 186) -EXCEPTION_HANDLER(#, 187) -EXCEPTION_HANDLER(#, 188) -EXCEPTION_HANDLER(#, 189) - -EXCEPTION_HANDLER(#, 190) -EXCEPTION_HANDLER(#, 191) -EXCEPTION_HANDLER(#, 192) -EXCEPTION_HANDLER(#, 193) -EXCEPTION_HANDLER(#, 194) -EXCEPTION_HANDLER(#, 195) -EXCEPTION_HANDLER(#, 196) -EXCEPTION_HANDLER(#, 197) -EXCEPTION_HANDLER(#, 198) -EXCEPTION_HANDLER(#, 199) - -EXCEPTION_HANDLER(#, 200) -EXCEPTION_HANDLER(#, 201) -EXCEPTION_HANDLER(#, 202) -EXCEPTION_HANDLER(#, 203) -EXCEPTION_HANDLER(#, 204) -EXCEPTION_HANDLER(#, 205) -EXCEPTION_HANDLER(#, 206) -EXCEPTION_HANDLER(#, 207) -EXCEPTION_HANDLER(#, 208) -EXCEPTION_HANDLER(#, 209) - -EXCEPTION_HANDLER(#, 210) -EXCEPTION_HANDLER(#, 211) -EXCEPTION_HANDLER(#, 212) -EXCEPTION_HANDLER(#, 213) -EXCEPTION_HANDLER(#, 214) -EXCEPTION_HANDLER(#, 215) -EXCEPTION_HANDLER(#, 216) -EXCEPTION_HANDLER(#, 217) -EXCEPTION_HANDLER(#, 218) -EXCEPTION_HANDLER(#, 219) - -EXCEPTION_HANDLER(#, 220) -EXCEPTION_HANDLER(#, 221) -EXCEPTION_HANDLER(#, 222) -EXCEPTION_HANDLER(#, 223) -EXCEPTION_HANDLER(#, 224) -EXCEPTION_HANDLER(#, 225) -EXCEPTION_HANDLER(#, 226) -EXCEPTION_HANDLER(#, 227) -EXCEPTION_HANDLER(#, 228) -EXCEPTION_HANDLER(#, 229) - -EXCEPTION_HANDLER(#, 230) -EXCEPTION_HANDLER(#, 231) -EXCEPTION_HANDLER(#, 232) -EXCEPTION_HANDLER(#, 233) -EXCEPTION_HANDLER(#, 234) -EXCEPTION_HANDLER(#, 235) -EXCEPTION_HANDLER(#, 236) -EXCEPTION_HANDLER(#, 237) -EXCEPTION_HANDLER(#, 238) -EXCEPTION_HANDLER(#, 239) - -EXCEPTION_HANDLER(#, 240) -EXCEPTION_HANDLER(#, 241) -EXCEPTION_HANDLER(#, 242) -EXCEPTION_HANDLER(#, 243) -EXCEPTION_HANDLER(#, 244) -EXCEPTION_HANDLER(#, 245) -EXCEPTION_HANDLER(#, 246) -EXCEPTION_HANDLER(#, 247) -EXCEPTION_HANDLER(#, 248) -EXCEPTION_HANDLER(#, 249) - -EXCEPTION_HANDLER(#, 250) -EXCEPTION_HANDLER(#, 251) -EXCEPTION_HANDLER(#, 252) -EXCEPTION_HANDLER(#, 253) -EXCEPTION_HANDLER(#, 254) -EXCEPTION_HANDLER(#, 255) - - -common_exception_handler: - - | - | Need to put the format/vector above the PC and status register - | - - move.l %d0,-(%sp) | free a register - move.w 4(%sp),%d0 | get the format/vector id - - | - | If a bus error or address error then trash the extra - | data saved on the stack - | - - cmp.w #0x0008,%d0 - beq ceh_10 - - cmp.w #0x000C,%d0 - beq ceh_10 - - bra ceh_20 - -ceh_10: - - move.w %d0,12(%sp) | need to move the format/id - move.l (%sp)+,%d0 | recover d0 - addq #8,%sp | trash the stack - move.l %d0,-(%sp) | free a register, again - move.w 4(%sp),%d0 | get the format/vector id - -ceh_20: - - move.w 6(%sp),4(%sp) - move.w 8(%sp),6(%sp) - move.w 10(%sp),8(%sp) - move.w %d0,10(%sp) | put the format/vector id - move.l (%sp)+,%d0 - - | - | Save all the registers, pass control to a dump trace routine - | - - movem.l %d0-%d7/%a0-%a7,%sp@- - - | - | check to see if ROM is mapped to zero - | - - move.l #trace_exception,%d1 | get the linked address - and.l #(ROM_SIZE - 1),%d1 | obtain the offset into the ROM - lea.l %pc@(0),%a0 | were are we currently - move.l %a0,%d0 | need to use a data register - and.l #~(ROM_SIZE - 1),%d0 | keep the top part of the address - or.l %d1,%d0 | apply it to the trace exception offset - move.l %d0,%a0 | need an address register for jumping - jsr %a0@(0) - -ceh_30: - jmp ceh_30 -| -| The RAM based vector table -| - - .sect .vtable - - .global vector_table - -vector_table: - .space (256 * 4),0 - -| -| Initialised data -| - - .sect .data - - .global start_frame - -start_frame: - .space 4,0 - - .global stack_start - -stack_start: - .space 4,0 - -| -| Uninitialised data -| - - .sect .bss - - .global environ - .align 2 - -environ: - .long 0 - - .global heap_size - .set heap_size,0x2000 - - .global stack_size - .set stack_size,0x1000 - - diff --git a/c/src/lib/libbsp/m68k/ods68302/startup/cpuboot.c b/c/src/lib/libbsp/m68k/ods68302/startup/cpuboot.c deleted file mode 100644 index fd8a4146de..0000000000 --- a/c/src/lib/libbsp/m68k/ods68302/startup/cpuboot.c +++ /dev/null @@ -1,133 +0,0 @@ -/*****************************************************************************/ -/* - Boot the CPU. - - Occurs in 3 phases for a 68302. - - Phase 1. - - Called as soon as able after reset. The BAR has been programed, and - a small stack exists in the DPRAM. All interrupts are masked, and - the processor is running in supervisor mode. No other hardware or - chip selects are active. - - This phase programs the chip select registers, the parallel ports - are set into default configurations, and basic registers cleared or - reset. The leds are programmed to show the end of phase 1. - - Phase 2. - - This is a piece of code which is copied to DPRAM and executed. It - should not do any more thann is currently present. The return to ROM - is managed by modifing the return address. Again leds show the status. - - Phase 3. - - This code executes with a valid C environment. That is the data - section has been intialised and the bss section set to 0. This phase - performs any special card initialisation and then calls boot card. - - $Id$ - -*/ -/*****************************************************************************/ - -#include <bsp.h> -#include <m68302.h> -#include <debugport.h> -#include <crc.h> - -/* - Open the address, reset all registers - */ - -void boot_phase_1() -{ - M302_SCR = SCR_DEFAULT; - - WRITE_OR(CSEL_ROM, ROM_SIZE, ROM_WAIT_STATES, OR_MASK_RW, OR_MASK_FC); - WRITE_BR(CSEL_ROM, RAM_BASE, BR_READ_ONLY, BR_FC_NULL, BR_ENABLED); - WRITE_OR(CSEL_RAM, RAM_SIZE, RAM_WAIT_STATES, OR_MASK_RW, OR_MASK_FC); - WRITE_BR(CSEL_RAM, ROM_BASE, BR_READ_WRITE, BR_FC_NULL, BR_ENABLED); - -#if defined(CSEL_1) - WRITE_OR(CSEL_1, CSEL_1_SIZE, CSEL_1_WAIT_STATES, OR_MASK_RW, OR_MASK_FC); - WRITE_BR(CSEL_1, CSEL_1_BASE, BR_READ_WRITE, BR_FC_NULL, BR_ENABLED); -#endif - -#if defined(CSEL_2) - WRITE_OR(CSEL_2, CSEL_2_SIZE, CSEL_2_WAIT_STATES, OR_MASK_RW, OR_MASK_FC); - WRITE_BR(CSEL_2, CSEL_2_BASE, BR_READ_WRITE, BR_FC_NULL, BR_ENABLED); -#endif - - m302.reg.gimr = m302.reg.ipr = m302.reg.imr = m302.reg.isr = 0; - - m302.reg.simode = 0; - - m302.reg.pacnt = CARD_PA_CONFIGURATION; - m302.reg.paddr = CARD_PA_DEFAULT_DIRECTIONS; - m302.reg.padat = CARD_PA_DEFAULT_DATA; - - m302.reg.pbcnt = CARD_PB_CONFIGURATION; - m302.reg.pbddr = CARD_PB_DEFAULT_DIRECTIONS; - m302.reg.pbdat = CARD_PB_DEFAULT_DATA; - - m302.reg.wrr = WATCHDOG_TIMEOUT_PERIOD | WATCHDOG_ENABLE; - -#if defined(LED_CONTROL) - LED_CONTROL(LED_1_RED, LED_2_OFF, LED_3_OFF, LED_4_OFF, - LED_5_OFF, LED_6_OFF, LED_7_OFF, LED_8_OFF); -#endif -} - -/* - Swap the chip select mapping for ROM and RAM - */ - -void boot_phase_2(void) -{ - rtems_unsigned32 stack; - -#if defined(LED_CONTROL) - LED_CONTROL(LED_1_RED, LED_2_RED, LED_3_OFF, LED_4_OFF, - LED_5_OFF, LED_6_OFF, LED_7_OFF, LED_8_OFF); -#endif - - WRITE_BR(CSEL_ROM, ROM_BASE, BR_READ_ONLY, BR_FC_NULL, BR_ENABLED); - WRITE_BR(CSEL_RAM, RAM_BASE, BR_READ_WRITE, BR_FC_NULL, BR_ENABLED); - -#if defined(LED_CONTROL) - LED_CONTROL(LED_1_GREEN, LED_2_RED, LED_3_OFF, LED_4_OFF, - LED_5_OFF, LED_6_OFF, LED_7_OFF, LED_8_OFF); -#endif - - /* seems to want 2, looked at assember code output */ - *(&stack + 2) |= ROM_BASE; -} - -/* - Any pre-main initialisation, the C environment is setup, how-ever C++ - static constructors have not been called, and RTEMS is not initialised. - */ - -void boot_card(); -void set_debug_traps(); -void breakpoint(); - -void boot_phase_3(void) -{ - if (GDB_RUN_MONITOR()) - { - set_debug_traps(); - breakpoint(); - } - - debug_port_banner(); - - /* FIXME : add RAM and ROM checks */ - - /* boot the bsp, what ever this means */ - boot_card(); - - WATCHDOG_TRIGGER(); -} diff --git a/c/src/lib/libbsp/mips/README b/c/src/lib/libbsp/mips/README deleted file mode 100644 index 7f16e33d39..0000000000 --- a/c/src/lib/libbsp/mips/README +++ /dev/null @@ -1,7 +0,0 @@ -# -# $Id$ -# - -The MIPS bsp are now called p4600 and p4650, referring to which cpu they use. -The same bsp sub-directory can be used, the cpu is selected by the bsp -specific makefiles (p4600.cfg and p4650.cfg). diff --git a/c/src/lib/libbsp/mips/p4000/README b/c/src/lib/libbsp/mips/p4000/README deleted file mode 100644 index 361366d01d..0000000000 --- a/c/src/lib/libbsp/mips/p4000/README +++ /dev/null @@ -1,47 +0,0 @@ -# -# $Id$ -# -# @(#)README 08/20/96 1.2 -# - -BSP NAME: p4000 -BOARD: Algorithmics P4000 SBC -BUS: N/A -CPU FAMILY: mips -CPU: IDT 4650 -COPROCESSORS: N/A -MODE: 32 bit mode - -DEBUG MONITOR: IDT/SIM - -PERIPHERALS -=========== -TIMERS: 4650 internal - RESOLUTION: half of internal clock frequency -SERIAL PORTS: IDT/SIM controlled -REAL-TIME CLOCK: none -DMA: none -VIDEO: none -SCSI: none -NETWORKING: none - -DRIVER INFORMATION -================== -CLOCK DRIVER: 4650 internal -IOSUPP DRIVER: N/A -SHMSUPP: N/A -TIMER DRIVER: 4650 internal -TTY DRIVER: uses IDT/SIM - -STDIO -===== -PORT: Console port 0 -ELECTRICAL: RS-232 -BAUD: 9600 -BITS PER CHARACTER: 8 -PARITY: None -STOP BITS: 1 - -NOTES -===== - diff --git a/c/src/lib/libbsp/mips/p4000/bsp_specs b/c/src/lib/libbsp/mips/p4000/bsp_specs deleted file mode 100644 index 3f488f47b6..0000000000 --- a/c/src/lib/libbsp/mips/p4000/bsp_specs +++ /dev/null @@ -1,23 +0,0 @@ -%rename cpp old_cpp -%rename lib old_lib -%rename endfile old_endfile -%rename startfile old_startfile -%rename link old_link - -*cpp: -%(old_cpp) %{qrtems: -D__embedded__} -Asystem(embedded) - -*lib: -%{!qrtems: %(old_lib)} %{qrtems: --start-group \ -%{!qrtems_debug: -lrtemsall} %{qrtems_debug: -lrtemsall_g} \ --lc -lgcc --end-group \ -%{!qnolinkcmds: -T linkcmds%s}} - -*startfile: -%{!qrtems: %(old_startfile)} %{qrtems: \ -%{!qrtems_debug: idt_csu.o%s} \ -%{qrtems_debug: idt_csu_g.o%s}} - -*link: -%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N -e start} - diff --git a/c/src/lib/libbsp/mips/p4000/console/console.c b/c/src/lib/libbsp/mips/p4000/console/console.c deleted file mode 100644 index c862c91cfa..0000000000 --- a/c/src/lib/libbsp/mips/p4000/console/console.c +++ /dev/null @@ -1,275 +0,0 @@ -/* - * This file contains the IDT 4650 console IO package. - * - * Author: Craig Lebakken <craigl@transition.com> - * - * COPYRIGHT (c) 1996 by Transition Networks Inc. - * - * To anyone who acknowledges that this file is provided "AS IS" - * without any express or implied warranty: - * permission to use, copy, modify, and distribute this file - * for any purpose is hereby granted without fee, provided that - * the above copyright notice and this notice appears in all - * copies, and that the name of Transition Networks not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * Transition Networks makes no representations about the suitability - * of this software for any purpose. - * - * Derived from c/src/lib/libbsp/no_cpu/no_bsp/console/console.c: - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - - -/* - * Rather than deleting this, it is commented out to (hopefully) help - * the submitter send updates. - * - * static char _sccsid[] = "@(#)console.c 08/20/96 1.6\n"; - */ - - - -#include <bsp.h> -#include <rtems/libio.h> -#include <ctype.h> - -char idtsim_getchar( void ); -void idtsim_putchar( char c ); -void mips_leddisplay( char a, char b, char c, char d ); - - -/* console_initialize - * - * This routine initializes the console IO driver. - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * Return values: - */ - -rtems_device_driver console_initialize( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg -) -{ - rtems_status_code status; - - status = rtems_io_register_name( - "/dev/console", - major, - (rtems_device_minor_number) 0 - ); - - if (status != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred(status); - - return RTEMS_SUCCESSFUL; -} - - -/* is_character_ready - * - * This routine returns TRUE if a character is available. - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * Return values: - */ - -rtems_boolean is_character_ready( - char *ch -) -{ - *ch = '\0'; /* return NULL for no particular reason */ - return(TRUE); -} - -/* inbyte - * - * This routine reads a character from the SOURCE. - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * Return values: - * character read from SOURCE - */ - -char inbyte( void ) -{ - /* - * If polling, wait until a character is available. - */ - - return idtsim_getchar(); -} - -/* outbyte - * - * This routine transmits a character out the SOURCE. It may support - * XON/XOFF flow control. - * - * Input parameters: - * ch - character to be transmitted - * - * Output parameters: NONE - */ - -void outbyte( - char ch -) -{ -#define NUM_LEDS 4 - static unsigned int cur_led = 0; - static unsigned char led_chars[NUM_LEDS]; - - /* - * If polling, wait for the transmitter to be ready. - * Check for flow control requests and process. - * Then output the character. - */ - - idtsim_putchar( ch ); - - /* print out first four alpha numeric characters in a line */ - if ( ch == '\n' ) - { - mips_leddisplay( led_chars[0], led_chars[1], led_chars[2], led_chars[3] ); - cur_led = 0; - } - else if ( isalnum( (unsigned char) ch ) && cur_led < NUM_LEDS ) - { - led_chars[cur_led++] = ch; - } - -} - - -#if 0 -static int console_fd = -1; -#endif - -/* - * Open entry point - */ - -rtems_device_driver console_open( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -) -{ -#if 0 - int console_fd = open("tty0", 2); /* open for read/write */ -#endif - return RTEMS_SUCCESSFUL; -} - -/* - * Close entry point - */ - -rtems_device_driver console_close( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -) -{ -#if 0 - if ( console_fd ) - close( console_fd ); -#endif - return RTEMS_SUCCESSFUL; -} - -/* - * read bytes from the serial port. We only have stdin. - */ - -rtems_device_driver console_read( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -) -{ - rtems_libio_rw_args_t *rw_args; - char *buffer; - int maximum; - int count = 0; - - rw_args = (rtems_libio_rw_args_t *) arg; - - buffer = rw_args->buffer; - maximum = rw_args->count; - - for (count = 0; count < maximum; count++) { - buffer[ count ] = inbyte(); - if (buffer[ count ] == '\n' || buffer[ count ] == '\r') { - buffer[ count++ ] = '\n'; - break; - } - } - - rw_args->bytes_moved = count; - return (count >= 0) ? RTEMS_SUCCESSFUL : RTEMS_UNSATISFIED; -} - -/* - * write bytes to the serial port. Stdout and stderr are the same. - */ - -rtems_device_driver console_write( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -) -{ - int count; - int maximum; - rtems_libio_rw_args_t *rw_args; - char *buffer; - - rw_args = (rtems_libio_rw_args_t *) arg; - - buffer = rw_args->buffer; - maximum = rw_args->count; - - for (count = 0; count < maximum; count++) { - if ( buffer[ count ] == '\n') { - outbyte('\r'); - } - outbyte( buffer[ count ] ); - } - - rw_args->bytes_moved = maximum; - return 0; -} - -/* - * IO Control entry point - */ - -rtems_device_driver console_control( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -) -{ - return RTEMS_SUCCESSFUL; -} diff --git a/c/src/lib/libbsp/mips/p4000/console/led.S b/c/src/lib/libbsp/mips/p4000/console/led.S deleted file mode 100644 index e62b82e041..0000000000 --- a/c/src/lib/libbsp/mips/p4000/console/led.S +++ /dev/null @@ -1,23 +0,0 @@ -/* - * $Id$ - */ - -#include <rtems/score/iregdef.h> -#include <rtems/score/idtmon.h> -#include <rtems/score/idtcpu.h> - - -FRAME(mips_leddisplay,sp,0,ra) - j ra - nop -ENDFRAME(mips_leddisplay) - -FRAME(sbddisplay,sp,0,ra) - j ra -ENDFRAME(sbddisplay) - - -FRAME(sbdblank,sp,0,ra) - j ra -ENDFRAME(sbdblank) - diff --git a/c/src/lib/libbsp/mips/p4000/include/bsp.h b/c/src/lib/libbsp/mips/p4000/include/bsp.h deleted file mode 100644 index da700b8dba..0000000000 --- a/c/src/lib/libbsp/mips/p4000/include/bsp.h +++ /dev/null @@ -1,118 +0,0 @@ -/* bsp.h - * - * This include file contains all board IO definitions. - * - * XXX : put yours in here - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ -/* @(#)bsp.h 03/15/96 1.1 */ - -#ifndef __P4000_BSP_h -#define __P4000_BSP_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include <rtems.h> -#include <console.h> -#include <clockdrv.h> - -extern void WriteDisplay( char * string ); - -/* - * Define the time limits for RTEMS Test Suite test durations. - * Long test and short test duration limits are provided. These - * values are in seconds and need to be converted to ticks for the - * application. - * - */ - -#define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */ -#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */ - -/* - * Stuff for Time Test 27 - */ - -#define MUST_WAIT_FOR_INTERRUPT 0 - -#define Install_tm27_vector( handler ) set_vector( (handler), 0, 1 ) - -#define Cause_tm27_intr() - -#define Clear_tm27_intr() - -#define Lower_tm27_intr() - -extern unsigned32 mips_get_timer( void ); - -#define CPU_CLOCK_RATE_MHZ (50) -#define CLOCKS_PER_MICROSECOND ( CPU_CLOCK_RATE_MHZ ) /* equivalent to CPU clock speed in MHz */ - -/* - * Simple spin delay in microsecond units for device drivers. - * This is very dependent on the clock speed of the target. - * - * NOTE: This macro generates a warning like "integer constant out - * of range" which is safe to ignore. In 64 bit mode, unsigned32 - * types are actually 64 bits long so that comparisons between - * unsigned32 types and pointers are valid. The warning is caused - * by code in the delay macro that is necessary for 64 bit mode. - */ - -#define delay( microseconds ) \ - { \ - unsigned32 _end_clock = mips_get_timer() + microseconds * CLOCKS_PER_MICROSECOND; \ - _end_clock %= 0x100000000; /* make sure result is 32 bits */ \ - \ - /* handle timer overflow, if necessary */ \ - while ( _end_clock < mips_get_timer() ); \ - \ - while ( _end_clock > mips_get_timer() ); \ - } - -/* Constants */ - -#define RAM_START 0 -#define RAM_END 0x100000 - -/* miscellaneous stuff assumed to exist */ - -extern rtems_configuration_table BSP_Configuration; - -/* - * Device Driver Table Entries - */ - -/* - * NOTE: Use the standard Console driver entry - */ - -/* - * NOTE: Use the standard Clock driver entry - */ - -/* miscellaneous stuff assumed to exist */ - -mips_isr_entry set_vector( /* returns old vector */ - rtems_isr_entry handler, /* isr routine */ - rtems_vector_number vector, /* vector number */ - int type /* RTEMS or RAW intr */ -); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/c/src/lib/libbsp/mips/p4000/include/coverhd.h b/c/src/lib/libbsp/mips/p4000/include/coverhd.h deleted file mode 100644 index aca390463b..0000000000 --- a/c/src/lib/libbsp/mips/p4000/include/coverhd.h +++ /dev/null @@ -1,116 +0,0 @@ -/* coverhd.h - * - * This include file has defines to represent the overhead associated - * with calling a particular directive from C. These are used in the - * Timing Test Suite to ignore the overhead required to pass arguments - * to directives. On some CPUs and/or target boards, this overhead - * is significant and makes it difficult to distinguish internal - * RTEMS execution time from that used to call the directive. - * This file should be updated after running the C overhead timing - * test. Once this update has been performed, the RTEMS Time Test - * Suite should be rebuilt to account for these overhead times in the - * timing results. - * - * NOTE: If these are all zero, then the times reported include - * all calling overhead including passing of arguments. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ -/* @(#)coverhd.h 04/08/96 1.3 */ - -#ifndef __COVERHD_h -#define __COVERHD_h - -#ifdef __cplusplus -extern "C" { -#endif - -#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 5 -#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 4 -#define CALLING_OVERHEAD_TASK_CREATE 6 -#define CALLING_OVERHEAD_TASK_IDENT 4 -#define CALLING_OVERHEAD_TASK_START 5 -#define CALLING_OVERHEAD_TASK_RESTART 4 -#define CALLING_OVERHEAD_TASK_DELETE 4 -#define CALLING_OVERHEAD_TASK_SUSPEND 4 -#define CALLING_OVERHEAD_TASK_RESUME 4 -#define CALLING_OVERHEAD_TASK_SET_PRIORITY 5 -#define CALLING_OVERHEAD_TASK_MODE 4 -#define CALLING_OVERHEAD_TASK_GET_NOTE 5 -#define CALLING_OVERHEAD_TASK_SET_NOTE 5 -#define CALLING_OVERHEAD_TASK_WAKE_WHEN 9 -#define CALLING_OVERHEAD_TASK_WAKE_AFTER 4 -#define CALLING_OVERHEAD_INTERRUPT_CATCH 5 -#define CALLING_OVERHEAD_CLOCK_GET 9 -#define CALLING_OVERHEAD_CLOCK_SET 8 -#define CALLING_OVERHEAD_CLOCK_TICK 3 - -#define CALLING_OVERHEAD_TIMER_CREATE 4 -#define CALLING_OVERHEAD_TIMER_IDENT 4 -#define CALLING_OVERHEAD_TIMER_DELETE 4 -#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 6 -#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 10 -#define CALLING_OVERHEAD_TIMER_RESET 4 -#define CALLING_OVERHEAD_TIMER_CANCEL 4 -#define CALLING_OVERHEAD_SEMAPHORE_CREATE 5 -#define CALLING_OVERHEAD_SEMAPHORE_IDENT 4 -#define CALLING_OVERHEAD_SEMAPHORE_DELETE 4 -#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 5 -#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 4 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 5 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 4 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 4 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 4 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 4 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 5 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 5 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 4 - -#define CALLING_OVERHEAD_EVENT_SEND 4 -#define CALLING_OVERHEAD_EVENT_RECEIVE 5 -#define CALLING_OVERHEAD_SIGNAL_CATCH 5 -#define CALLING_OVERHEAD_SIGNAL_SEND 4 -#define CALLING_OVERHEAD_PARTITION_CREATE 6 -#define CALLING_OVERHEAD_PARTITION_IDENT 4 -#define CALLING_OVERHEAD_PARTITION_DELETE 4 -#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 4 -#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 4 -#define CALLING_OVERHEAD_REGION_CREATE 6 -#define CALLING_OVERHEAD_REGION_IDENT 4 -#define CALLING_OVERHEAD_REGION_DELETE 4 -#define CALLING_OVERHEAD_REGION_GET_SEGMENT 5 -#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 4 -#define CALLING_OVERHEAD_PORT_CREATE 6 -#define CALLING_OVERHEAD_PORT_IDENT 4 -#define CALLING_OVERHEAD_PORT_DELETE 4 -#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 4 -#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 4 - -#define CALLING_OVERHEAD_IO_INITIALIZE 5 -#define CALLING_OVERHEAD_IO_OPEN 5 -#define CALLING_OVERHEAD_IO_CLOSE 5 -#define CALLING_OVERHEAD_IO_READ 5 -#define CALLING_OVERHEAD_IO_WRITE 5 -#define CALLING_OVERHEAD_IO_CONTROL 5 -#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 4 -#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 4 -#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 4 -#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 4 -#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 4 -#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 4 -#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 3 - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/c/src/lib/libbsp/mips/p4000/liblnk/lnklib.S b/c/src/lib/libbsp/mips/p4000/liblnk/lnklib.S deleted file mode 100644 index ae2509ce3c..0000000000 --- a/c/src/lib/libbsp/mips/p4000/liblnk/lnklib.S +++ /dev/null @@ -1,62 +0,0 @@ -/* - * $Id$ - */ - -#include <rtems/score/iregdef.h> -#include <rtems/score/idtcpu.h> - -#define FRAME(name,frm_reg,offset,ret_reg) \ - .globl name; \ - .ent name; \ -name:; \ - .frame frm_reg,offset,ret_reg - -#define ENDFRAME(name) \ - .end name - -#define PROM_LINK(name,entry) \ - .globl name; \ - .ent name; \ -name: la $2,+entry; \ - j $2; \ - .end name - -#define PROM_ENTRY(x) (0xbfc00000+((x)*8)) - -#define PROM_RESET PROM_ENTRY(0) -#define PROM_NOT_IMP PROM_ENTRY(1) -#define PROM_RESTART PROM_ENTRY(2) -#define PROM_REINIT PROM_ENTRY(3) -#define PROM_GETCHAR PROM_ENTRY(11) -#define PROM_PUTCHAR PROM_ENTRY(12) -#define PROM_SHOWCHAR PROM_ENTRY(13) -#define PROM_PRINTF PROM_ENTRY(16) -#define PROM_RETURN PROM_ENTRY(17) - -#define PROM_RGETS PROM_ENTRY(25) -#define PROM_FLUSHCACHE PROM_ENTRY(28) -#define PROM_CLEARCACHE PROM_ENTRY(29) -#define PROM_SETJMP PROM_ENTRY(30) -#define PROM_LONGJMP PROM_ENTRY(31) - - .text - -PROM_LINK(idtsim_putchar, PROM_PUTCHAR) -PROM_LINK(idtsim_getchar, PROM_GETCHAR) -PROM_LINK(idtsim_showchar, PROM_SHOWCHAR) -PROM_LINK(idtsim__exit, PROM_RETURN) -PROM_LINK(idtsim_reinit, PROM_REINIT) -PROM_LINK(idtsim_restart, PROM_RESTART) -PROM_LINK(idtsim_reset, PROM_RESET) -PROM_LINK(idtsim_promexit, PROM_RETURN) -PROM_LINK(idtsim_setjmp, PROM_SETJMP) -PROM_LINK(idtsim_longjmp, PROM_LONGJMP) - -FRAME(idtsim_init_sbrk,sp,0,ra) - j ra -ENDFRAME(idtsim_init_sbrk) - -FRAME(idtsim_init_file,sp,0,ra) - j ra -ENDFRAME(idtsim_init_file) - diff --git a/c/src/lib/libbsp/mips/p4000/start/start.S b/c/src/lib/libbsp/mips/p4000/start/start.S deleted file mode 100644 index 8dc31c8999..0000000000 --- a/c/src/lib/libbsp/mips/p4000/start/start.S +++ /dev/null @@ -1,299 +0,0 @@ -/* - -Based upon IDT provided code with the following release: - -This source code has been made available to you by IDT on an AS-IS -basis. Anyone receiving this source is licensed under IDT copyrights -to use it in any way he or she deems fit, including copying it, -modifying it, compiling it, and redistributing it either with or -without modifications. No license under IDT patents or patent -applications is to be implied by the copyright license. - -Any user of this software should understand that IDT cannot provide -technical support for this software and will not be responsible for -any consequences resulting from the use of this software. - -Any person who transfers this source code or any derivative work must -include the IDT copyright notice, this paragraph, and the preceeding -two paragraphs in the transferred software. - -COPYRIGHT IDT CORPORATION 1996 -LICENSED MATERIAL - PROGRAM PROPERTY OF IDT - - $Id$ -*/ - -/************************************************************************* -** -** Copyright 1991-95 Integrated Device Technology, Inc. -** All Rights Reserved -** -** idt_csu.S -- IDT stand alone startup code -** -**************************************************************************/ -#include <rtems/score/iregdef.h> -#include <rtems/score/idtcpu.h> -#include <rtems/score/idtmon.h> - - -.extern _fbss,4 /* this is defined by the linker */ -.extern end,4 /* this is defined by the linker */ - -.lcomm sim_mem_cfg_struct,12 - - .text - - -#define TMP_STKSIZE 1024 - -/************************************************************************** -** -** start - Typicl standalone start up code required for R3000/R4000 -** -** -** 1) Initialize the STATUS Register -** a) Clear parity error bit -** b) Set co_processor 1 usable bit ON -** c) Clear all IntMask Enables -** d) Set kernel/disabled mode -** 2) Initialize Cause Register -** a) clear software interrupt bits -** 3) Determine FPU installed or not -** if not, clear CoProcessor 1 usable bit -** 4) Clear bss area -** 5) MUST allocate temporary stack until memory size determined -** It MUST be uncached to prevent overwriting when caches are cleared -** 6) Install exception handlers -** 7) Determine memory and cache sizes -** 8) Establish permanent stack (cached or uncached as defined by bss) -** 9) Flush Instruction and Data caches -** 10) If there is a Translation Lookaside Buffer, Clear the TLB -** 11) Execute initialization code if the IDT/c library is to be used -** -** 12) Jump to user's "main()" -** 13) Jump to promexit -** -** IDT/C 5.x defines _R3000, IDT/C 6.x defines _R4000 internally. -** This is used to mark code specific to R3xxx or R4xxx processors. -** IDT/C 6.x defines __mips to be the ISA level for which we're -** generating code. This is used to make sure the stack etc. is -** double word aligned, when using -mips3 (default) or -mips2, -** when compiling with IDT/C6.x -** -***************************************************************************/ - -FRAME(start,sp,0,ra) - - .set noreorder -#ifdef _R3000 - li v0,SR_PE|SR_CU1 /* reset parity error and set */ - /* cp1 usable */ -#endif -#ifdef _R4000 -#if __mips==3 || defined(R4650) - li v0,SR_CU1|SR_DE|SR_FR /* initally clear ERL, enable FPA 64bit regs*/ - /* 4650: Need fr to be set anyway */ -#else - li v0,SR_CU1|SR_DE /* initally clear ERL, enable FPA 32bit regs*/ -#endif mips3 -#endif - - mtc0 v0,C0_SR /* clr IntMsks/ kernel/disabled mode */ - nop - mtc0 zero,C0_CAUSE /* clear software interrupts */ - nop - -#ifdef _R4000 - li v0,CFG_C_NONCOHERENT # initialise default cache mode - mtc0 v0,C0_CONFIG -#endif - -/* -** check to see if an fpu is really plugged in -*/ - li t3,0xaaaa5555 /* put a's and 5's in t3 */ - mtc1 t3,fp0 /* try to write them into fp0 */ - mtc1 zero,fp1 /* try to write zero in fp */ - mfc1 t0,fp0 - mfc1 t1,fp1 - nop - bne t0,t3,1f /* branch if no match */ - nop - bne t1,zero,1f /* double check for positive id */ - nop - /* We have a FPU. clear fcsr */ - ctc1 zero, fcr31 - j 2f /* status register already correct */ - nop -1: -#ifdef _R3000 - li v0, SR_PE /* reset parity error/NO cp1 usable */ -#endif - -#ifdef _R4000 - li v0,SR_DE /* clear ERL and disable FPA */ -#endif - - mtc0 v0, C0_SR /* reset status register */ -2: - la gp, _gp - - la v0,_fbss /* clear bss before using it */ - la v1,end /* end of bss */ -3: sw zero,0(v0) - bltu v0,v1,3b - add v0,4 - - -/************************************************************************ -** -** Temporary Stack - needed to handle stack saves until -** memory size is determined and permanent stack set -** -** MUST be uncached to avoid confusion at cache -** switching during memory sizing -** -*************************************************************************/ -#if __mips==3 - /* For MIPS 3, we need to be sure that the stack is aligned on a - * double word boundary. - */ - andi t0, v0, 0x7 - beqz t0, 11f /* Last three bits Zero, already aligned */ - nop - add v0, 4 -11: -#endif - - or v0, K1BASE /* switch to uncached */ - add v1, v0, TMP_STKSIZE /* end of bss + length of tmp stack */ - sub v1, v1, (4*4) /* overhead */ - move sp, v1 /* set sp to top of stack */ -4: sw zero, 0(v0) - bltu v0, v1, 4b /* clear out temp stack */ - add v0, 4 - - jal init_exc_vecs /* install exception handlers */ - nop /* MUST do before memory probes */ - - la v0, 5f - li v1, K1BASE /* force into uncached space */ - or v0, v1 /* during memory/cache probes */ - j v0 - nop -5: - la a0, sim_mem_cfg_struct - jal sim_mem_cfg /* Make SIM call to get mem size */ - nop - la a0, sim_mem_cfg_struct - lw a0, 0(a0) /* Get memory size from struct */ -#ifdef _R3000 - jal config_Icache - nop - jal config_Dcache /* determine size of D & I caches */ - nop -#endif -#ifdef _R4000 - jal config_cache /* determine size of D & I caches */ - nop -#endif - - move v0, a0 /* mem_size */ - -#if __mips==3 - /* For MIPS 3, we need to be sure that the stack (and hence v0 - * here) is aligned on a double word boundary. - */ - andi t0, v0, 0x7 - beqz t0, 12f /* Last three bits Zero, already aligned */ - nop - subu v0, 4 /* mem_size was not aligned on doubleword bdry????*/ -12: -#endif - - - -/************************************************************************** -** -** Permanent Stack - now know top of memory, put permanent stack there -** -***************************************************************************/ - - la t2, _fbss /* cache mode as linked */ - and t2, 0xF0000000 /* isolate segment */ - la t1, 6f - j t1 /* back to original cache mode */ - nop -6: - or v0, t2 /* stack back to original cache mode */ - addiu v0,v0,-16 /* overhead */ - move sp, v0 /* now replace count w top of memory */ - move v1, v0 - subu v1, P_STACKSIZE /* clear requested stack size */ - -7: sw zero, 0(v1) /* clear P_STACKSIZE stack */ - bltu v1,v0,7b - add v1, 4 - .set reorder - -#ifdef _R3000 - jal flush_Icache - jal flush_Dcache /* flush Data & Instruction caches */ -#endif -#ifdef _R4000 - jal flush_cache_nowrite /* flush Data & Instruction caches */ -#endif - - - -/************************************************************************** -** -** If this chip supports a Translation Lookaside Buffer, clear it -** -***************************************************************************/ - - .set noreorder - mfc0 t1, C0_SR /* look at Status Register */ - nop - .set reorder -#ifdef _R3000 - li t2, SR_TS /* TLB Shutdown bit */ - and t1,t2 /* TLB Shutdown if 1 */ - bnez t1, 8f /* skip clearing if no TLB */ -#endif - -#ifndef R4650 - jal init_tlb /* clear the tlb */ -#endif - - -/************************************************************************ -** -** Initialization required if using IDT/c or libc.a, standard C Lib -** -** can SKIP if not necessary for application -** -************************************************************************/ -8: - - jal idtsim_init_sbrk - jal idtsim_init_file -/*********************** END I/O initialization **********************/ - - - jal main - - jal idtsim_promexit - -ENDFRAME(start) - - - .globl sim_mem_cfg -sim_mem_cfg: - .set noat - .set noreorder - li AT, (0xbfc00000+((55)*8)) - jr AT - nop - .set at - .set reorder diff --git a/c/src/lib/libbsp/mips/p4000/startup/bspclean.c b/c/src/lib/libbsp/mips/p4000/startup/bspclean.c deleted file mode 100644 index 5382c8491c..0000000000 --- a/c/src/lib/libbsp/mips/p4000/startup/bspclean.c +++ /dev/null @@ -1,38 +0,0 @@ -/* bsp_cleanup() - * - * This routine normally is part of start.s and usually returns - * control to a monitor. - * - * INPUT: NONE - * - * OUTPUT: NONE - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -/* - * Rather than deleting this, it is commented out to (hopefully) help - * the submitter send updates. - * - * static char _sccsid[] = "@(#)bspclean.c 03/15/96 1.1\n"; - */ - - - -#include <rtems.h> -#include <bsp.h> - -void idtsim__exit(); - -void bsp_cleanup( void ) -{ - idtsim__exit(); -} diff --git a/c/src/lib/libbsp/mips/p4000/startup/bspstart.c b/c/src/lib/libbsp/mips/p4000/startup/bspstart.c deleted file mode 100644 index bdd0c3074d..0000000000 --- a/c/src/lib/libbsp/mips/p4000/startup/bspstart.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * This routine starts the application. It includes application, - * board, and monitor specific initialization and configuration. - * The generic CPU dependent initialization has been performed - * before this routine is invoked. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -/* - * Rather than deleting this, it is commented out to (hopefully) help - * the submitter send updates. - * - * static char _sccsid[] = "@(#)bspstart.c 06/11/96 1.2\n"; - */ - - -#include <bsp.h> -#include <rtems/libio.h> - -#include <libcsupport.h> - -#include <string.h> - -/* - * The original table from the application and our copy of it with - * some changes. - */ - -extern rtems_configuration_table Configuration; - -rtems_configuration_table BSP_Configuration; - -rtems_cpu_table Cpu_table; - -char *rtems_progname; - -/* - * Use the shared implementations of the following routines - */ - -void bsp_postdriver_hook(void); -void bsp_libc_init( void *, unsigned32, int ); - -/* - * Function: bsp_pretasking_hook - * Created: 95/03/10 - * - * Description: - * BSP pretasking hook. Called just before drivers are initialized. - * Used to setup libc and install any BSP extensions. - * - * NOTES: - * Must not use libc (to do io) from here, since drivers are - * not yet initialized. - * - */ - -#define LIBC_HEAP_SIZE (64 * 1024) - -void bsp_pretasking_hook(void) -{ - extern int end; - rtems_unsigned32 heap_start; - - heap_start = (rtems_unsigned32) &end; - if (heap_start & (CPU_ALIGNMENT-1)) - heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - bsp_libc_init((void *) heap_start, LIBC_HEAP_SIZE, 0); - -#ifdef RTEMS_DEBUG - rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); -#endif -} - -extern int end; /* defined by linker */ - -/* - * bsp_start - * - * This routine does the bulk of the system initialization. - */ - -void bsp_start( void ) -{ - /* - * Allocate the memory for the RTEMS Work Space. This can come from - * a variety of places: hard coded address, malloc'ed from outside - * RTEMS world (e.g. simulator or primitive memory manager), or (as - * typically done by stock BSPs) by subtracting the required amount - * of work space from the last physical address on the CPU board. - */ - - /* - * Need to "allocate" the memory for the RTEMS Workspace and - * tell the RTEMS configuration where it is. This memory is - * not malloc'ed. It is just "pulled from the air". - */ - - BSP_Configuration.work_space_start = - (void *)((unsigned64)((&end) + LIBC_HEAP_SIZE + 0x2000) & ~0x7); - - /* - * initialize the CPU table for this BSP - */ - - Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */ - Cpu_table.postdriver_hook = bsp_postdriver_hook; - Cpu_table.interrupt_stack_size = 4096; -} diff --git a/c/src/lib/libbsp/mips/p4000/startup/ghlinkcmds b/c/src/lib/libbsp/mips/p4000/startup/ghlinkcmds deleted file mode 100644 index 34cdbab802..0000000000 --- a/c/src/lib/libbsp/mips/p4000/startup/ghlinkcmds +++ /dev/null @@ -1,19 +0,0 @@ -# -# $Id$ -# - --map --sec -{ - .text 0x80010000 : - .data align(16) : - .rodata : - .fini : -# .sdata : - .symtab : - .strtab : - .debug : -# .sbss : - .bss align(8) : - .init 0xbfc00000 : -} diff --git a/c/src/lib/libbsp/mips/p4000/startup/idtmem.S b/c/src/lib/libbsp/mips/p4000/startup/idtmem.S deleted file mode 100644 index 70a7096877..0000000000 --- a/c/src/lib/libbsp/mips/p4000/startup/idtmem.S +++ /dev/null @@ -1,938 +0,0 @@ -/* - -Based upon IDT provided code with the following release: - -This source code has been made available to you by IDT on an AS-IS -basis. Anyone receiving this source is licensed under IDT copyrights -to use it in any way he or she deems fit, including copying it, -modifying it, compiling it, and redistributing it either with or -without modifications. No license under IDT patents or patent -applications is to be implied by the copyright license. - -Any user of this software should understand that IDT cannot provide -technical support for this software and will not be responsible for -any consequences resulting from the use of this software. - -Any person who transfers this source code or any derivative work must -include the IDT copyright notice, this paragraph, and the preceeding -two paragraphs in the transferred software. - -COPYRIGHT IDT CORPORATION 1996 -LICENSED MATERIAL - PROGRAM PROPERTY OF IDT - - $Id$ - -*/ - -/************************************************************************ -** -** idtmem.s - memory and cache functions -** -** Copyright 1991 Integrated Device Technology, Inc. -** All Rights Reserved -** -**************************************************************************/ - -/* - * 950313: Ketan fixed bugs in mfc0/mtc0 hazards, and removed hack - * to set mem_size. - */ - -#include <rtems/score/iregdef.h> -#include <rtems/score/idtcpu.h> -#include <rtems/score/idtmon.h> - - .data -mem_size: - .word 0 -dcache_size: - .word 0 -icache_size: -#if defined(CPU_R3000) - .word MINCACHE -#endif -#if defined(CPU_R4000) - .word 0 -#endif - -#if defined(CPU_R4000) - .data -scache_size: - .word 0 -icache_linesize: - .word 0 -dcache_linesize: - .word 0 -scache_linesize: - .word 0 -#endif - - - .text - -#if defined (CPU_R3000) -#define CONFIGFRM ((2*4)+4) - -/************************************************************************* -** -** Config_Dcache() -- determine size of Data cache -** -**************************************************************************/ - -FRAME(config_Dcache,sp, CONFIGFRM, ra) - .set noreorder - subu sp,CONFIGFRM - sw ra,CONFIGFRM-4(sp) /* save return address */ - sw s0,4*4(sp) /* save s0 in first regsave slot */ - mfc0 s0,C0_SR /* save SR */ - nop - mtc0 zero,C0_SR /* disable interrupts */ - .set reorder - jal _size_cache /* returns Data cache size in v0 */ - sw v0, dcache_size /* save it */ - and s0, ~SR_PE /* do not clear PE */ - .set noreorder - mtc0 s0,C0_SR /* restore SR */ - nop - .set reorder - lw s0, 4*4(sp) /* restore s0 */ - lw ra,CONFIGFRM-4(sp) /* restore ra */ - addu sp,CONFIGFRM /* pop stack */ - j ra -ENDFRAME(config_Dcache) - - -/************************************************************************* -** -** Config_Icache() -- determine size of Instruction cache -** MUST be run in uncached mode/handled in idt_csu.s -** -**************************************************************************/ - -FRAME(config_Icache,sp, CONFIGFRM, ra) - .set noreorder - subu sp,CONFIGFRM - sw ra,CONFIGFRM-4(sp) /* save return address */ - sw s0,4*4(sp) /* save s0 in first regsave slot */ - mfc0 s0,C0_SR /* save SR */ - nop - mtc0 zero, C0_SR /* disable interrupts */ - li v0,SR_SWC /* swap caches/disable ints */ - mtc0 v0,C0_SR - nop - .set reorder - jal _size_cache /* returns instruction cache size */ - .set noreorder - mtc0 zero,C0_SR /* swap back caches */ - nop - and s0,~SR_PE /* do not inadvertantly clear PE */ - mtc0 s0,C0_SR /* restore SR */ - nop - .set reorder - sw v0, icache_size /* save it AFTER caches back */ - lw s0,4*4(sp) /* restore s0 */ - lw ra,CONFIGFRM-4(sp) /* restore ra */ - addu sp,CONFIGFRM /* pop stack */ - j ra -ENDFRAME(config_Icache) - -/************************************************************************ -** -** _size_cache() -** returns cache size in v0 -** -************************************************************************/ - -FRAME(_size_cache,sp,0,ra) - .set noreorder - mfc0 t0,C0_SR /* save current sr */ - nop - and t0,~SR_PE /* do not inadvertently clear PE */ - or v0,t0,SR_ISC /* isolate cache */ - mtc0 v0,C0_SR - /* - * First check if there is a cache there at all - */ - move v0,zero - li v1,0xa5a5a5a5 /* distinctive pattern */ - sw v1,K0BASE /* try to write into cache */ - lw t1,K0BASE /* try to read from cache */ - nop - mfc0 t2,C0_SR - nop - .set reorder - and t2,SR_CM - bne t2,zero,3f /* cache miss, must be no cache */ - bne v1,t1,3f /* data not equal -> no cache */ - /* - * Clear cache size boundries to known state. - */ - li v0,MINCACHE -1: - sw zero,K0BASE(v0) - sll v0,1 - ble v0,MAXCACHE,1b - - li v0,-1 - sw v0,K0BASE(zero) /* store marker in cache */ - li v0,MINCACHE /* MIN cache size */ - -2: lw v1,K0BASE(v0) /* Look for marker */ - bne v1,zero,3f /* found marker */ - sll v0,1 /* cache size * 2 */ - ble v0,MAXCACHE,2b /* keep looking */ - move v0,zero /* must be no cache */ - .set noreorder -3: mtc0 t0,C0_SR /* restore sr */ - j ra - nop -ENDFRAME(_size_cache) - .set reorder - - -#define FLUSHFRM (2*4) - -/*************************************************************************** -** -** flush_Dcache() - flush entire Data cache -** -****************************************************************************/ -FRAME(flush_Dcache,sp,FLUSHFRM,ra) - lw t2, dcache_size - .set noreorder - mfc0 t3,C0_SR /* save SR */ - nop - and t3,~SR_PE /* dont inadvertently clear PE */ - beq t2,zero,_Dflush_done /* no D cache, get out! */ - nop - li v0, SR_ISC /* isolate cache */ - mtc0 v0, C0_SR - nop - .set reorder - li t0,K0BASE /* set loop registers */ - or t1,t0,t2 - -2: sb zero,0(t0) - sb zero,4(t0) - sb zero,8(t0) - sb zero,12(t0) - sb zero,16(t0) - sb zero,20(t0) - sb zero,24(t0) - addu t0,32 - sb zero,-4(t0) - bne t0,t1,2b - - .set noreorder -_Dflush_done: - mtc0 t3,C0_SR /* restore Status Register */ - .set reorder - j ra -ENDFRAME(flush_Dcache) - - -/*************************************************************************** -** -** flush_Icache() - flush entire Instruction cache -** -** NOTE: Icache can only be flushed/cleared when uncached -** Code forces into uncached memory regardless of calling mode -** -****************************************************************************/ -FRAME(flush_Icache,sp,FLUSHFRM,ra) - lw t1,icache_size - .set noreorder - mfc0 t3,C0_SR /* save SR */ - nop - la v0,1f - li v1,K1BASE - or v0,v1 - j v0 /* force into non-cached space */ - nop -1: - and t3,~SR_PE /* dont inadvertently clear PE */ - beq t1,zero,_Iflush_done /* no i-cache get out */ - nop - li v0,SR_ISC|SR_SWC /* disable intr, isolate and swap */ - mtc0 v0,C0_SR - li t0,K0BASE - .set reorder - or t1,t0,t1 - -1: sb zero,0(t0) - sb zero,4(t0) - sb zero,8(t0) - sb zero,12(t0) - sb zero,16(t0) - sb zero,20(t0) - sb zero,24(t0) - addu t0,32 - sb zero,-4(t0) - bne t0,t1,1b - .set noreorder -_Iflush_done: - mtc0 t3,C0_SR /* un-isolate, enable interrupts */ - .set reorder - j ra -ENDFRAME(flush_Icache) - -/************************************************************************** -** -** clear_Dcache(base_addr, byte_count) - flush portion of Data cache -** -** a0 = base address of portion to be cleared -** a1 = byte count of length -** -***************************************************************************/ -FRAME(clear_Dcache,sp,0,ra) - - lw t2, dcache_size /* Data cache size */ - .set noreorder - mfc0 t3,C0_SR /* save SR */ - nop - and t3,~SR_PE /* dont inadvertently clear PE */ - nop - nop - .set reorder - /* - * flush data cache - */ - - .set noreorder - nop - li v0,SR_ISC /* isolate data cache */ - mtc0 v0,C0_SR - .set reorder - bltu t2,a1,1f /* cache is smaller than region */ - move t2,a1 -1: addu t2,a0 /* ending address + 1 */ - move t0,a0 - -1: sb zero,0(t0) - sb zero,4(t0) - sb zero,8(t0) - sb zero,12(t0) - sb zero,16(t0) - sb zero,20(t0) - sb zero,24(t0) - addu t0,32 - sb zero,-4(t0) - bltu t0,t2,1b - - .set noreorder - mtc0 t3,C0_SR /* un-isolate, enable interrupts */ - nop - .set reorder - j ra -ENDFRAME(clear_Dcache) - - -/************************************************************************** -** -** clear_Icache(base_addr, byte_count) - flush portion of Instruction cache -** -** a0 = base address of portion to be cleared -** a1 = byte count of length -** -** NOTE: Icache can only be flushed/cleared when uncached -** Code forces into uncached memory regardless of calling mode -** -***************************************************************************/ -FRAME(clear_Icache,sp,0,ra) - - lw t1, icache_size /* Instruction cache size */ - /* - * flush text cache - */ - .set noreorder - mfc0 t3,C0_SR /* save SR */ - nop - la v0,1f - li v1,K1BASE - or v0,v1 - j v0 /* force into non-cached space */ - nop -1: - and t3,~SR_PE /* dont inadvertently clear PE */ - nop - nop - li v0,SR_ISC|SR_SWC /* disable intr, isolate and swap */ - mtc0 v0,C0_SR - .set reorder - bltu t1,a1,1f /* cache is smaller than region */ - move t1,a1 -1: addu t1,a0 /* ending address + 1 */ - move t0,a0 - - sb zero,0(t0) - sb zero,4(t0) - sb zero,8(t0) - sb zero,12(t0) - sb zero,16(t0) - sb zero,20(t0) - sb zero,24(t0) - addu t0,32 - sb zero,-4(t0) - bltu t0,t1,1b - .set noreorder - mtc0 t3,C0_SR /* un-isolate, enable interrupts */ - nop - nop - nop /* allow time for caches to swap */ - .set reorder - j ra -ENDFRAME(clear_Icache) - - -/************************************************************************** -** -** get_mem_conf - get memory configuration -** -***************************************************************************/ - - -FRAME(get_mem_conf,sp,0,ra) - - lw t6, mem_size - sw t6, 0(a0) - lw t7, icache_size - sw t7, 4(a0) - lw t8, dcache_size - sw t8, 8(a0) - j ra - -ENDFRAME(get_mem_conf) -#endif /* defined CPU_R3000 */ - -#if defined(CPU_R4000) -#define LEAF(label) FRAME(label,sp,0,ra) -#define XLEAF(label) \ - .globl label ; \ -label: -#define END(label) ENDFRAME(label) - -/* - * cacheop macro to automate cache operations - * first some helpers... - */ -#define _mincache(size, maxsize) \ - bltu size,maxsize,8f ; \ - move size,maxsize ; \ -8: - -#define _align(tmp, minaddr, maxaddr, linesize) \ - subu tmp,linesize,1 ; \ - not tmp ; \ - and minaddr,tmp ; \ - addu maxaddr,-1 ; \ - and maxaddr,tmp - -/* This is a bit of a hack really because it relies on minaddr=a0 */ -#define _doop1(op1) \ - cache op1,0(a0) - -#define _doop2(op1, op2) \ - cache op1,0(a0) ; \ - cache op2,0(a0) - -/* specials for cache initialisation */ -#define _doop1lw1(op1) \ - cache op1,0(a0) ; \ - lw zero,0(a0) ; \ - cache op1,0(a0) - -#define _doop121(op1,op2) \ - cache op1,0(a0) ; \ - nop; \ - cache op2,0(a0) ; \ - nop; \ - cache op1,0(a0) - -#define _oploopn(minaddr, maxaddr, linesize, tag, ops) \ - .set noreorder ; \ -7: _doop##tag##ops ; \ - bne minaddr,maxaddr,7b ; \ - addu minaddr,linesize ; \ - .set reorder - -/* finally the cache operation macros */ -#define icacheopn(kva, n, cache_size, cache_linesize, tag, ops) \ - _mincache(n, cache_size); \ - blez n,9f ; \ - addu n,kva ; \ - _align(t1, kva, n, cache_linesize) ; \ - _oploopn(kva, n, cache_linesize, tag, ops) ; \ -9: - -#define vcacheopn(kva, n, cache_size, cache_linesize, tag, ops) \ - blez n,9f ; \ - addu n,kva ; \ - _align(t1, kva, n, cache_linesize) ; \ - _oploopn(kva, n, cache_linesize, tag, ops) ; \ -9: - -#define icacheop(kva, n, cache_size, cache_linesize, op) \ - icacheopn(kva, n, cache_size, cache_linesize, 1, (op)) - -#define vcacheop(kva, n, cache_size, cache_linesize, op) \ - vcacheopn(kva, n, cache_size, cache_linesize, 1, (op)) - - .text - -/* - * static void _size_cache() R4000 - * - * Internal routine to determine cache sizes by looking at R4000 config - * register. Sizes are returned in registers, as follows: - * t2 icache size - * t3 dcache size - * t6 scache size - * t4 icache line size - * t5 dcache line size - * t7 scache line size - */ -LEAF(_size_cache) - mfc0 t0,C0_CONFIG - - and t1,t0,CFG_ICMASK - srl t1,CFG_ICSHIFT - li t2,0x1000 - sll t2,t1 - - and t1,t0,CFG_DCMASK - srl t1,CFG_DCSHIFT - li t3,0x1000 - sll t3,t1 - - li t4,32 - and t1,t0,CFG_IB - bnez t1,1f - li t4,16 -1: - - li t5,32 - and t1,t0,CFG_DB - bnez t1,1f - li t5,16 -1: - - move t6,zero # default to no scache - move t7,zero # - - and t1,t0,CFG_C_UNCACHED # test config register - bnez t1,1f # no scache if uncached/non-coherent - - li t6,0x100000 # assume 1Mb scache <<-NOTE - and t1,t0,CFG_SBMASK - srl t1,CFG_SBSHIFT - li t7,16 - sll t7,t1 -1: j ra -END(_size_cache) - - -/* - * void config_cache() R4000 - * - * Work out size of I, D & S caches, assuming they are already initialised. - */ -LEAF(config_cache) - lw t0,icache_size - bgtz t0,8f # already known? - move v0,ra - bal _size_cache - move ra,v0 - - sw t2,icache_size - sw t3,dcache_size - sw t6,scache_size - sw t4,icache_linesize - sw t5,dcache_linesize - sw t7,scache_linesize -8: j ra -END(config_cache) - - -/* - * void _init_cache() R4000 - */ -LEAF(_init_cache) - /* - * First work out the sizes - */ - move v0,ra - bal _size_cache - move ra,v0 - - /* - * The caches may be in an indeterminate state, - * so we force good parity into them by doing an - * invalidate, load/fill, invalidate for each line. - */ - - /* disable all i/u and cache exceptions */ - mfc0 v0,C0_SR - and v1,v0,~SR_IE - or v1,SR_DE - mtc0 v1,C0_SR - - mtc0 zero,C0_TAGLO - mtc0 zero,C0_TAGHI - - /* assume bottom of RAM will generate good parity for the cache */ - li a0,PHYS_TO_K0(0) - move a2,t2 # icache_size - move a3,t4 # icache_linesize - move a1,a2 - icacheopn(a0,a1,a2,a3,121,(Index_Store_Tag_I,Fill_I)) - - li a0,PHYS_TO_K0(0) - move a2,t3 # dcache_size - move a3,t5 # dcache_linesize - move a1,a2 - icacheopn(a0,a1,a2,a3,1lw1,(Index_Store_Tag_D)) - - /* assume unified I & D in scache <<-NOTE */ - blez t6,1f - li a0,PHYS_TO_K0(0) - move a2,t6 - move a3,t7 - move a1,a2 - icacheopn(a0,a1,a2,a3,1lw1,(Index_Store_Tag_SD)) - -1: mtc0 v0,C0_SR - j ra -END(_init_cache) - - -/* - * void flush_cache (void) R4000 - * - * Flush and invalidate all caches - */ -LEAF(flush_cache) - /* secondary cacheops do all the work if present */ - lw a2,scache_size - blez a2,1f - lw a3,scache_linesize - li a0,PHYS_TO_K0(0) - move a1,a2 - icacheop(a0,a1,a2,a3,Index_Writeback_Inv_SD) - b 2f - -1: - lw a2,icache_size - blez a2,2f - lw a3,icache_linesize - li a0,PHYS_TO_K0(0) - move a1,a2 - icacheop(a0,a1,a2,a3,Index_Invalidate_I) - - lw a2,dcache_size - lw a3,dcache_linesize - li a0,PHYS_TO_K0(0) - move a1,a2 - icacheop(a0,a1,a2,a3,Index_Writeback_Inv_D) - -2: j ra -END(flush_cache) - -/* - * void flush_cache_nowrite (void) R4000 - * - * Invalidate all caches - */ -LEAF(flush_cache_nowrite) - mfc0 v0,C0_SR - and v1,v0,~SR_IE - mtc0 v1,C0_SR - - mtc0 zero,C0_TAGLO - mtc0 zero,C0_TAGHI - - lw a2,icache_size - blez a2,2f - lw a3,icache_linesize - li a0,PHYS_TO_K0(0) - move a1,a2 - icacheop(a0,a1,a2,a3,Index_Invalidate_I) - - lw a2,dcache_size - lw a3,dcache_linesize - li a0,PHYS_TO_K0(0) - move a1,a2 - icacheop(a0,a1,a2,a3,Index_Store_Tag_D) - - lw a2,scache_size - blez a2,2f - lw a3,scache_linesize - li a0,PHYS_TO_K0(0) - move a1,a2 - icacheop(a0,a1,a2,a3,Index_Store_Tag_SD) - -2: mtc0 v0,C0_SR - j ra -END(flush_cache_nowrite) - -/* - * void clean_cache (unsigned kva, size_t n) R4000 - * - * Writeback and invalidate address range in all caches - */ -LEAF(clean_cache) -XLEAF(clear_cache) - - /* secondary cacheops do all the work (if fitted) */ - lw a2,scache_size - blez a2,1f - lw a3,scache_linesize - vcacheop(a0,a1,a2,a3,Hit_Writeback_Inv_SD) - b 2f - -1: lw a2,icache_size - blez a2,2f - lw a3,icache_linesize - /* save kva & n for subsequent loop */ - move t8,a0 - move t9,a1 - vcacheop(a0,a1,a2,a3,Hit_Invalidate_I) - - lw a2,dcache_size - lw a3,dcache_linesize - /* restore kva & n */ - move a0,t8 - move a1,t9 - vcacheop(a0,a1,a2,a3,Hit_Writeback_Inv_D) - -2: j ra -END(clean_cache) - -/* - * void clean_dcache (unsigned kva, size_t n) R4000 - * - * Writeback and invalidate address range in primary data cache - */ -LEAF(clean_dcache) - lw a2,dcache_size - blez a2,2f - lw a3,dcache_linesize - - vcacheop(a0,a1,a2,a3,Hit_Writeback_Inv_D) - -2: j ra -END(clean_dcache) - -/* - * void clean_dcache_indexed (unsigned kva, size_t n) R4000 - * - * Writeback and invalidate indexed range in primary data cache - */ -LEAF(clean_dcache_indexed) - lw a2,dcache_size - blez a2,2f - lw a3,dcache_linesize - -#ifdef CPU_ORION - srl a2,1 # do one set (half cache) at a time - move t8,a0 # save kva & n - move t9,a1 - icacheop(a0,a1,a2,a3,Index_Writeback_Inv_D) - - addu a0,t8,a2 # do next set - move a1,t9 # restore n -#endif - icacheop(a0,a1,a2,a3,Index_Writeback_Inv_D) - -2: j ra -END(clean_dcache_indexed) - -/* - * void clean_dcache_nowrite (unsigned kva, size_t n) R4000 - * - * Invalidate an address range in primary data cache - */ -LEAF(clean_dcache_nowrite) - lw a2,dcache_size - blez a2,2f - lw a3,dcache_linesize - - vcacheop(a0,a1,a2,a3,Hit_Invalidate_D) - -2: j ra -END(clean_dcache_nowrite) - -/* - * void clean_dcache_nowrite_indexed (unsigned kva, size_t n) R4000 - * - * Invalidate indexed range in primary data cache - */ -LEAF(clean_dcache_nowrite_indexed) - mfc0 v0,C0_SR - and v1,v0,~SR_IE - mtc0 v1,C0_SR - - mtc0 zero,C0_TAGLO - mtc0 zero,C0_TAGHI - - lw a2,dcache_size - blez a2,2f - lw a3,dcache_linesize - -#ifdef CPU_ORION - srl a2,1 # do one set (half cache) at a time - move t8,a0 # save kva & n - move t9,a1 - icacheop(a0,a1,a2,a3,Index_Store_Tag_D) - - addu a0,t8,a2 # do next set - move a1,t9 # restore n -#endif - icacheop(a0,a1,a2,a3,Index_Store_Tag_D) - -2: mtc0 v0,C0_SR - j ra -END(clean_dcache_nowrite_indexed) - -/* - * void clean_icache (unsigned kva, size_t n) R4000 - * - * Invalidate address range in primary instruction cache - */ -LEAF(clean_icache) - lw a2,icache_size - blez a2,2f - lw a3,icache_linesize - - vcacheop(a0,a1,a2,a3,Hit_Invalidate_I) - -2: j ra -END(clean_icache) - -/* - * void clean_icache_indexed (unsigned kva, size_t n) R4000 - * - * Invalidate indexed range in primary instruction cache - */ -LEAF(clean_icache_indexed) - lw a2,icache_size - blez a2,2f - lw a3,icache_linesize - -#ifdef CPU_ORION - srl a2,1 # do one set (half cache) at a time - move t8,a0 # save kva & n - move t9,a1 - icacheop(a0,a1,a2,a3,Index_Invalidate_I) - - addu a0,t8,a2 # do next set - move a1,t9 # restore n -#endif - icacheop(a0,a1,a2,a3,Index_Invalidate_I) - -2: j ra -END(clean_icache_indexed) - - - -/* - * void clean_scache (unsigned kva, size_t n) R4000 - * - * Writeback and invalidate address range in secondary cache - */ -LEAF(clean_scache) - lw a2,scache_size - blez a2,2f - lw a3,scache_linesize - vcacheop(a0,a1,a2,a3,Hit_Writeback_Inv_SD) - -2: j ra -END(clean_scache) - -/* - * void clean_scache_indexed (unsigned kva, size_t n) R4000 - * - * Writeback and invalidate indexed range in secondary cache - */ -LEAF(clean_scache_indexed) - lw a2,scache_size - blez a2,2f - lw a3,scache_linesize - - icacheop(a0,a1,a2,a3,Index_Writeback_Inv_SD) - -2: j ra -END(clean_scache_indexed) - -/* - * void clean_scache_nowrite (unsigned kva, size_t n) R4000 - * - * Invalidate an address range in secondary cache - */ -LEAF(clean_scache_nowrite) - lw a2,scache_size - blez a2,2f - lw a3,scache_linesize - - vcacheop(a0,a1,a2,a3,Hit_Invalidate_SD) - -2: j ra -END(clean_scache_nowrite) - -/* - * void clean_scache_nowrite_indexed (unsigned kva, size_t n) R4000 - * - * Invalidate indexed range in secondary cache - */ -LEAF(clean_scache_nowrite_indexed) - mfc0 v0,C0_SR - and v1,v0,~SR_IE - mtc0 v1,C0_SR - - mtc0 zero,C0_TAGLO - mtc0 zero,C0_TAGHI - - lw a2,scache_size - blez a2,2f - lw a3,scache_linesize - - icacheop(a0,a1,a2,a3,Index_Store_Tag_SD) - -2: mtc0 v0,C0_SR - j ra -END(clean_scache_nowrite_indexed) - -/************************************************************************** -** -** get_mem_conf - get memory configuration R4000 -** -***************************************************************************/ - - -FRAME(get_mem_conf,sp,0,ra) - - lw t6, mem_size - sw t6, 0(a0) - lw t7, icache_size - sw t7, 4(a0) - lw t8, dcache_size - sw t8, 8(a0) - lw t7, scache_size - sw t7, 12(a0) - j ra - -ENDFRAME(get_mem_conf) - -#endif /* defined(CPU_R4000) */ - -/* - * void set_mem_size (mem_size) - * - * config_memory()'s memory size gets written into mem_size here. - * Now we don't need to call config_cache() with memory size - New to IDTC6.0 - */ -FRAME(set_memory_size,sp,0,ra) - sw a0, mem_size - j ra -ENDFRAME(set_memory_size) - - diff --git a/c/src/lib/libbsp/mips/p4000/startup/idttlb.S b/c/src/lib/libbsp/mips/p4000/startup/idttlb.S deleted file mode 100644 index 4aad7b1416..0000000000 --- a/c/src/lib/libbsp/mips/p4000/startup/idttlb.S +++ /dev/null @@ -1,390 +0,0 @@ -/* - -Based upon IDT provided code with the following release: - -This source code has been made available to you by IDT on an AS-IS -basis. Anyone receiving this source is licensed under IDT copyrights -to use it in any way he or she deems fit, including copying it, -modifying it, compiling it, and redistributing it either with or -without modifications. No license under IDT patents or patent -applications is to be implied by the copyright license. - -Any user of this software should understand that IDT cannot provide -technical support for this software and will not be responsible for -any consequences resulting from the use of this software. - -Any person who transfers this source code or any derivative work must -include the IDT copyright notice, this paragraph, and the preceeding -two paragraphs in the transferred software. - -COPYRIGHT IDT CORPORATION 1996 -LICENSED MATERIAL - PROGRAM PROPERTY OF IDT - - $Id$ -*/ - - -/* -** idttlb.s - fetch the registers associated with and the contents -** of the tlb. -** -*/ -/* 950308: Ketan patched a few tlb functions that would not have worked.*/ -#include <rtems/score/iregdef.h> -#include <rtems/score/idtcpu.h> -#include <rtems/score/idtmon.h> - - - .text - -#if defined(CPU_R3000) -/* -** ret_tlblo -- returns the 'entrylo' contents for the TLB -** 'c' callable - as ret_tlblo(index) - where index is the -** tlb entry to return the lo value for - if called from assembly -** language then index should be in register a0. -*/ -FRAME(ret_tlblo,sp,0,ra) - .set noreorder - mfc0 t0,C0_SR # save sr - nop - and t0,~SR_PE # dont inadvertantly clear PE - mtc0 zero,C0_SR # clear interrupts - mfc0 t1,C0_TLBHI # save pid - sll a0,TLBINX_INXSHIFT # position index - mtc0 a0,C0_INX # write to index register - nop - tlbr # put tlb entry in entrylo and hi - nop - mfc0 v0,C0_TLBLO # get the requested entry lo - mtc0 t1,C0_TLBHI # restore pid - mtc0 t0,C0_SR # restore status register - j ra - nop - .set reorder -ENDFRAME(ret_tlblo) -#endif -#if defined(CPU_R4000) -/* -** ret_tlblo[01] -- returns the 'entrylo' contents for the TLB -** 'c' callable - as ret_tlblo(index) - where index is the -** tlb entry to return the lo value for - if called from assembly -** language then index should be in register a0. -*/ -FRAME(ret_tlblo0,sp,0,ra) - mfc0 t0,C0_SR # save sr - mtc0 zero,C0_SR # clear interrupts - mfc0 t1,C0_TLBHI # save pid - mtc0 a0,C0_INX # write to index register - .set noreorder - nop; nop; nop; nop; nop; nop; nop; nop - .set reorder - tlbr # put tlb entry in entrylo and hi - .set noreorder - nop; nop; nop; nop; nop; nop; nop; nop - .set reorder - mfc0 v0,C0_TLBLO0 # get the requested entry lo - mtc0 t1,C0_TLBHI # restore pid - mtc0 t0,C0_SR # restore status register - j ra -ENDFRAME(ret_tlblo0) - -FRAME(ret_tlblo1,sp,0,ra) - mfc0 t0,C0_SR # save sr - mtc0 zero,C0_SR # clear interrupts - mfc0 t1,C0_TLBHI # save pid - mtc0 a0,C0_INX # write to index register - .set noreorder - nop; nop; nop; nop; nop; nop; nop; nop - .set reorder - tlbr # put tlb entry in entrylo and hi - .set noreorder - nop; nop; nop; nop; nop; nop; nop; nop - .set reorder - mfc0 v0,C0_TLBLO1 # get the requested entry lo - mtc0 t1,C0_TLBHI # restore pid - mtc0 t0,C0_SR # restore status register - j ra -ENDFRAME(ret_tlblo1) - -/* -** ret_pagemask(index) -- return pagemask contents of tlb entry "index" -*/ -FRAME(ret_pagemask,sp,0,ra) - mfc0 t0,C0_SR # save sr - mtc0 zero,C0_SR # disable interrupts - mfc0 t1,C0_TLBHI # save current pid - mtc0 a0,C0_INX # drop it in C0 register - .set noreorder - nop; nop; nop; nop; nop; nop; nop; nop - .set reorder - tlbr # read entry to entry hi/lo - .set noreorder - nop; nop; nop; nop; nop; nop; nop; nop - .set reorder - mfc0 v0,C0_PAGEMASK # to return value - mtc0 t1,C0_TLBHI # restore current pid - mtc0 t0,C0_SR # restore sr - j ra -ENDFRAME(ret_pagemask) - -/* -** ret_tlbwired(void) -- return wired register -*/ -FRAME(ret_tlbwired,sp,0,ra) - mfc0 v0,C0_WIRED - j ra -ENDFRAME(ret_tlbwired) -#endif - -/* -** ret_tlbhi -- return the tlb entry high content for tlb entry -** index -*/ -FRAME(ret_tlbhi,sp,0,ra) -#if defined(CPU_R3000) - .set noreorder - mfc0 t0,C0_SR # save sr - nop - and t0,~SR_PE - mtc0 zero,C0_SR # disable interrupts - mfc0 t1,C0_TLBHI # save current pid - sll a0,TLBINX_INXSHIFT # position index - mtc0 a0,C0_INX # drop it in C0 register - nop - tlbr # read entry to entry hi/lo - nop - mfc0 v0,C0_TLBHI # to return value - mtc0 t1,C0_TLBHI # restore current pid - mtc0 t0,C0_SR # restore sr - j ra - nop - .set reorder -#endif -#if defined(CPU_R4000) - mfc0 t0,C0_SR # save sr - mtc0 zero,C0_SR # disable interrupts - mfc0 t1,C0_TLBHI # save current pid - mtc0 a0,C0_INX # drop it in C0 register - .set noreorder - nop; nop; nop; nop; nop; nop; nop; nop - .set reorder - tlbr # read entry to entry hi/lo0/lo1/mask - .set noreorder - nop; nop; nop; nop; nop; nop; nop; nop - .set reorder - mfc0 v0,C0_TLBHI # to return value - mtc0 t1,C0_TLBHI # restore current pid - mtc0 t0,C0_SR # restore sr - j ra -#endif -ENDFRAME(ret_tlbhi) - -/* -** ret_tlbpid() -- return tlb pid contained in the current entry hi -*/ -FRAME(ret_tlbpid,sp,0,ra) -#if defined(CPU_R3000) - .set noreorder - mfc0 v0,C0_TLBHI # fetch tlb high - nop - and v0,TLBHI_PIDMASK # isolate and position - srl v0,TLBHI_PIDSHIFT - j ra - nop - .set reorder -#endif -#if defined(CPU_R4000) - mfc0 v0,C0_TLBHI # to return value - nop - and v0,TLBHI_PIDMASK - j ra -#endif -ENDFRAME(ret_tlbpid) - -/* -** tlbprobe(address, pid) -- probe the tlb to see if address is currently -** mapped -** a0 = vpn - virtual page numbers are 0=0 1=0x1000, 2=0x2000... -** virtual page numbers for the r3000 are in -** entry hi bits 31-12 -** a1 = pid - this is a process id ranging from 0 to 63 -** this process id is shifted left 6 bits and or'ed into -** the entry hi register -** returns an index value (0-63) if successful -1 -f not -*/ -FRAME(tlbprobe,sp,0,ra) -#if defined(CPU_R3000) - .set noreorder - mfc0 t0,C0_SR /* fetch status reg */ - and a0,TLBHI_VPNMASK /* isolate just the vpn */ - and t0,~SR_PE /* don't inadvertantly clear pe */ - mtc0 zero,C0_SR - mfc0 t1,C0_TLBHI - sll a1,TLBHI_PIDSHIFT /* possition the pid */ - and a1,TLBHI_PIDMASK - or a0,a1 /* build entry hi value */ - mtc0 a0,C0_TLBHI - nop - tlbp /* do the probe */ - nop - mfc0 v1,C0_INX - li v0,-1 - bltz v1,1f - nop - sra v0,v1,TLBINX_INXSHIFT /* get index positioned for return */ -1: - mtc0 t1,C0_TLBHI /* restore tlb hi */ - mtc0 t0,C0_SR /* restore the status reg */ - j ra - nop - .set reorder -#endif -#if defined(CPU_R4000) - mfc0 t0,C0_SR # save sr - mtc0 zero,C0_SR # disable interrupts - mfc0 t1,C0_TLBHI # save current pid - and a0,TLBHI_VPN2MASK # construct tlbhi for probe - and a1,TLBHI_PIDMASK - or a0,a1 - mtc0 a0,C0_TLBHI - .set noreorder - nop; nop; nop; nop; nop; nop; nop; nop - .set reorder - tlbp # probe entry to entry hi/lo0/lo1/mask - .set noreorder - nop; nop; nop; nop; nop; nop; nop; nop - .set reorder - mfc0 v1,C0_INX - li v0,-1 - bltz v1,1f - move v0,v1 -1: mtc0 t1,C0_TLBHI # restore current pid - mtc0 t0,C0_SR # restore sr - j ra -#endif -ENDFRAME(tlbprobe) - -/* -** resettlb(index) Invalidate the TLB entry specified by index -*/ -FRAME(resettlb,sp,0,ra) -#if defined(CPU_R3000) - .set noreorder - mfc0 t0,C0_TLBHI # fetch the current hi - mfc0 v0,C0_SR # fetch the status reg. - li t2,K0BASE&TLBHI_VPNMASK - and v0,~SR_PE # dont inadvertantly clear PE - mtc0 zero,C0_SR - mtc0 t2,C0_TLBHI # set up tlbhi - mtc0 zero,C0_TLBLO - sll a0,TLBINX_INXSHIFT - mtc0 a0,C0_INX - nop - tlbwi # do actual invalidate - nop - mtc0 t0,C0_TLBHI - mtc0 v0,C0_SR - j ra - nop - .set reorder -#endif -#if defined(CPU_R4000) - li t2,K0BASE&TLBHI_VPN2MASK - mfc0 t0,C0_TLBHI # save current TLBHI - mfc0 v0,C0_SR # save SR and disable interrupts - mtc0 zero,C0_SR - mtc0 t2,C0_TLBHI # invalidate entry - mtc0 zero,C0_TLBLO0 - mtc0 zero,C0_TLBLO1 - mtc0 a0,C0_INX - .set noreorder - nop; nop; nop; nop; nop; nop; nop; nop - .set reorder - tlbwi - .set noreorder - nop; nop; nop; nop; nop; nop; nop; nop - .set reorder - mtc0 t0,C0_TLBHI - mtc0 v0,C0_SR - j ra -#endif -ENDFRAME(resettlb) - -#if defined(CPU_R3000) -/* -** Setup TLB entry -** -** map_tlb(index, tlbhi, phypage) -** a0 = TLB entry index -** a1 = virtual page number and PID -** a2 = physical page -*/ -FRAME(map_tlb,sp,0,ra) - .set noreorder - sll a0,TLBINX_INXSHIFT - mfc0 v0,C0_SR # fetch the current status - mfc0 a3,C0_TLBHI # save the current hi - and v0,~SR_PE # dont inadvertantly clear parity - - mtc0 zero,C0_SR - mtc0 a1,C0_TLBHI # set the hi entry - mtc0 a2,C0_TLBLO # set the lo entry - mtc0 a0,C0_INX # load the index - nop - tlbwi # put the hi/lo in tlb entry indexed - nop - mtc0 a3,C0_TLBHI # put back the tlb hi reg - mtc0 v0,C0_SR # restore the status register - j ra - nop - .set reorder -ENDFRAME(map_tlb) - #endif -#if defined(CPU_R4000) -/* -** Setup R4000 TLB entry -** -** map_tlb4000(mask_index, tlbhi, pte_even, pte_odd) -** a0 = TLB entry index and page mask -** a1 = virtual page number and PID -** a2 = pte -- contents of even pte -** a3 = pte -- contents of odd pte -*/ -FRAME(map_tlb4000,sp,0,ra) - and t2,a0,TLBPGMASK_MASK - and a0,TLBINX_INXMASK - mfc0 t1,C0_TLBHI # save current TLBPID - mfc0 v0,C0_SR # save SR and disable interrupts - mtc0 zero,C0_SR - mtc0 t2,C0_PAGEMASK # set - mtc0 a1,C0_TLBHI # set VPN and TLBPID - mtc0 a2,C0_TLBLO0 # set PPN and access bits - mtc0 a3,C0_TLBLO1 # set PPN and access bits - mtc0 a0,C0_INX # set INDEX to wired entry - .set noreorder - nop; nop; nop; nop; nop; nop; nop; nop - .set reorder - tlbwi # drop it in - .set noreorder - nop; nop; nop; nop; nop; nop; nop; nop - .set reorder - mtc0 t1,C0_TLBHI # restore TLBPID - mtc0 v0,C0_SR # restore SR - j ra -ENDFRAME(map_tlb4000) -#endif - - -/* -** Set current TLBPID. This assumes PID is positioned correctly in reg. -** a0. -*/ -FRAME(set_tlbpid,sp,0,ra) - .set noreorder - mtc0 a0,C0_TLBHI - j ra - nop - .set reorder -ENDFRAME(set_tlbpid) - diff --git a/c/src/lib/libbsp/mips/p4000/startup/inittlb.c b/c/src/lib/libbsp/mips/p4000/startup/inittlb.c deleted file mode 100644 index e61f0043be..0000000000 --- a/c/src/lib/libbsp/mips/p4000/startup/inittlb.c +++ /dev/null @@ -1,16 +0,0 @@ -/* - * $Id$ - */ - -#include <rtems/score/idtcpu.h> - -extern void resettlb( int i ); - -void init_tlb(void) -{ - int i; - - for (i = 0; i < N_TLB_ENTRIES; i++ ) - resettlb(i); -} - diff --git a/c/src/lib/libbsp/mips/p4000/startup/linkcmds b/c/src/lib/libbsp/mips/p4000/startup/linkcmds deleted file mode 100644 index 47e0ba1162..0000000000 --- a/c/src/lib/libbsp/mips/p4000/startup/linkcmds +++ /dev/null @@ -1,72 +0,0 @@ -/* - * $Id$ - */ - -OUTPUT_FORMAT("elf32-bigmips") -OUTPUT_ARCH(mips) -/* Do we need any of these for elf? - __DYNAMIC = 0; */ -_DYNAMIC_LINK = 0; -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - .text 0x80030000 : /* */ -/* .text 0xa0020000 : /* */ -/* .text 0x00020000 : /* */ - { - _ftext = . ; - *(.text) - CREATE_OBJECT_SYMBOLS - _etext = .; - } - .init ALIGN(8) : { *(.init) } =0 - .fini ALIGN(8) : { *(.fini) } =0 - .ctors ALIGN(8) : { *(.ctors) } - .dtors ALIGN(8) : { *(.dtors) } - .rodata ALIGN(8) : { *(.rodata) *(.gnu.linkonce.r*) } - .rodata1 ALIGN(8) : - { - *(.rodata1) - . = ALIGN(8); - } - .reginfo . : { *(.reginfo) } - /* also: .hash .dynsym .dynstr .plt(if r/o) .rel.got */ - /* Read-write section, merged into data segment: */ - .data ALIGN(16) : - { - _fdata = . ; - *(.data) - CONSTRUCTORS - } - .data1 ALIGN(8) : { *(.data1) } - _gp = . + 0x8000; - .lit8 . : { *(.lit8) } - .lit4 . : { *(.lit4) } - /* also (before uninitialized portion): .dynamic .got .plt(if r/w) - (or does .dynamic go into its own segment?) */ - /* We want the small data sections together, so single-instruction offsets - can access them all, and initialized data all before uninitialized, so - we can shorten the on-disk segment size. */ - .sdata ALIGN(8) : { *(.sdata) } - _edata = .; - __bss_start = ALIGN(8); - _fbss = .; - .sbss ALIGN(8) : { *(.sbss) *(.scommon) } - .bss ALIGN(8) : - { - *(.bss) - *(COMMON) - _end = . ; - end = . ; - } - /* Debug sections. These should never be loadable, but they must have - zero addresses for the debuggers to work correctly. */ - .line 0 : { *(.line) } - .debug 0 : { *(.debug) } - .debug_sfnames 0 : { *(.debug_sfnames) } - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_macinfo 0 : { *(.debug_macinfo) } - .debug_pubnames 0 : { *(.debug_pubnames) } - .debug_aranges 0 : { *(.debug_aranges) } -} - diff --git a/c/src/lib/libbsp/mips/p4000/startup/setvec.c b/c/src/lib/libbsp/mips/p4000/startup/setvec.c deleted file mode 100644 index 1142eb64de..0000000000 --- a/c/src/lib/libbsp/mips/p4000/startup/setvec.c +++ /dev/null @@ -1,53 +0,0 @@ -/* set_vector - * - * This routine installs an interrupt vector on the target Board/CPU. - * This routine is allowed to be as board dependent as necessary. - * - * INPUT: - * handler - interrupt handler entry point - * vector - vector number - * type - 0 indicates raw hardware connect - * 1 indicates RTEMS interrupt connect - * - * RETURNS: - * address of previous interrupt handler - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -/* - * Rather than deleting this, it is commented out to (hopefully) help - * the submitter send updates. - * - * static char _sccsid[] = "@(#)setvec.c 04/25/96 1.2\n"; - */ - - -#include <rtems.h> -#include <bsp.h> - -mips_isr_entry set_vector( /* returns old vector */ - rtems_isr_entry handler, /* isr routine */ - rtems_vector_number vector, /* vector number */ - int type /* RTEMS or RAW intr */ -) -{ - mips_isr_entry previous_isr; - - if ( type ) - rtems_interrupt_catch( handler, vector, (rtems_isr_entry *) &previous_isr ); - else { - /* XXX: install non-RTEMS ISR as "raw" interupt */ - rtems_interrupt_catch( handler, vector, (rtems_isr_entry *) &previous_isr ); - } - return previous_isr; -} - diff --git a/c/src/lib/libbsp/mips/p4000/times b/c/src/lib/libbsp/mips/p4000/times deleted file mode 100644 index 58574229e1..0000000000 --- a/c/src/lib/libbsp/mips/p4000/times +++ /dev/null @@ -1,200 +0,0 @@ -# -# Timing Test Suite Results for the NO_BSP -# -# NOTE: This is just a template. The times are irrelevant since this BSP -# can only be compiled -- not executed. -# -# $Id$ -# -# @(#)times 08/01/96 1.4 - -NOTE: To obtain the execution time in microseconds, divide the number of - cycles by the clock speed. For example, if rtems_semaphore create - is reported to be 1164 cycles, then at 66 Mhz it takes 17.64 - microseconds or 8.75 microseconds at 133 Mhz. - -Board: Algorithmics P4000i -CPU: IDT 4650 -Clock Speed: 100MHz -Memory Configuration: SRAM, DRAM, cache, etc -Wait States: - -Times Reported in: cycles -Timer Source: on-CPU cycle counter - -Column A:RTEMS compiled with 64 bit pointers and 64 bit unsigned32 types -Column B:RTEMS compiled with 32 bit pointers and 32 bit unsigned32 types - -# DESCRIPTION A B -== ================================================================= ==== ==== - 1 rtems_semaphore_create 788 759 - rtems_semaphore_delete 903 945 - rtems_semaphore_obtain: available 119 119 - rtems_semaphore_obtain: not available -- NO_WAIT 118 118 - rtems_semaphore_release: no waiting tasks 127 127 - - 2 rtems_semaphore_obtain: not available -- caller blocks 842 840 - - 3 rtems_semaphore_release: task readied -- preempts caller 777 751 - - 4 rtems_task_restart: blocked task -- preempts caller 1611 1595 - rtems_task_restart: ready task -- preempts caller 1253 1395 - rtems_semaphore_release: task readied -- returns to caller 365 345 - rtems_task_create 798 797 - rtems_task_start 464 460 - rtems_task_restart: suspended task -- returns to caller 517 517 - rtems_task_delete: suspended task 529 595 - rtems_task_restart: ready task -- returns to caller 527 525 - rtems_task_restart: blocked task -- returns to caller 707 684 - rtems_task_delete: blocked task 609 675 - - 5 rtems_task_suspend: calling task 549 549 - rtems_task_resume: task readied -- preempts caller 702 699 - - 6 rtems_task_restart: calling task 291 291 - rtems_task_suspend: returns to caller 195 194 - rtems_task_resume: task readied -- returns to caller 198 198 - rtems_task_delete: ready task 734 736 - - 7 rtems_task_restart: suspended task -- preempts caller 1049 990 - - 8 rtems_task_set_priority: obtain current priority 94 94 - rtems_task_set_priority: returns to caller 418 355 - rtems_task_mode: obtain current mode 44 43 - rtems_task_mode: no reschedule 0 49 - rtems_task_mode: reschedule -- returns to caller 0 232 - rtems_task_mode: reschedule -- preempts caller 0 687 - rtems_task_set_note 0 101 - rtems_task_get_note 0 103 - rtems_clock_set 0 237 - rtems_clock_get 0 16 - - 9 rtems_message_queue_create 3583 3432 - rtems_message_queue_send: no waiting tasks 252 252 - rtems_message_queue_urgent: no waiting tasks 252 252 - rtems_message_queue_receive: available 207 207 - rtems_message_queue_flush: no messages flushed 95 96 - rtems_message_queue_flush: messages flushed 110 110 - rtems_message_queue_delete 1044 1111 - -10 rtems_message_queue_receive: not available -- NO_WAIT 132 131 - rtems_message_queue_receive: not available -- caller blocks 884 892 - -11 rtems_message_queue_send: task readied -- preempts caller 397 817 - -12 rtems_message_queue_send: task readied -- returns to caller 397 397 - -13 rtems_message_queue_urgent: task readied -- preempts caller 816 817 - -14 rtems_message_queue_urgent: task readied -- returns to caller 397 398 - -15 rtems_event_receive: obtain current events 5 5 - rtems_event_receive: not available -- NO_WAIT 99 99 - rtems_event_receive: not available -- caller blocks 689 689 - rtems_event_send: no task readied 123 123 - rtems_event_receive: available 326 349 - rtems_event_send: task readied -- returns to caller 333 429 - -16 rtems_event_send: task readied -- preempts caller 843 838 - -17 rtems_task_set_priority: preempts caller 1002 991 - -18 rtems_task_delete: calling task 1171 1157 - -19 rtems_signal_catch 0 1306 - rtems_signal_send: returns to caller 0 1019 - rtems_signal_send: signal to self 0 496 - exit ASR overhead: returns to calling task 0 120 - exit ASR overhead: returns to preempting task 0 73 - -20 rtems_partition_create 1293 1306 - rtems_region_create 1010 1019 - rtems_partition_get_buffer: available 481 496 - rtems_partition_get_buffer: not available 120 120 - rtems_partition_return_buffer 587 460 - rtems_partition_delete 379 320 - rtems_region_get_segment: available 179 179 - rtems_region_get_segment: not available -- NO_WAIT 349 293 - rtems_region_return_segment: no waiting tasks 335 322 - rtems_region_get_segment: not available -- caller blocks 1603 1496 - rtems_region_return_segment: task readied -- preempts caller 1616 1533 - rtems_region_return_segment: task readied -- returns to caller 940 939 - rtems_region_delete 301 348 - rtems_io_initialize 9 10 - rtems_io_open 6 6 - rtems_io_close 6 6 - rtems_io_read 6 6 - rtems_io_write 6 5 - rtems_io_control 6 6 - -21 rtems_task_ident 1057 1058 - rtems_message_queue_ident 963 963 - rtems_semaphore_ident 1137 1136 - rtems_partition_ident 962 961 - rtems_region_ident 923 924 - rtems_port_ident 918 917 - rtems_timer_ident 942 941 - rtems_rate_monotonic_ident 924 925 - -22 rtems_message_queue_broadcast: task readied -- returns to caller 1084 1095 - rtems_message_queue_broadcast: no waiting tasks 147 148 - rtems_message_queue_broadcast: task readied -- preempts caller 1305 1268 - -23 rtems_timer_create 202 201 - rtems_timer_fire_after: inactive 261 261 - rtems_timer_fire_after: active 271 269 - rtems_timer_cancel: active 142 141 - rtems_timer_cancel: inactive 122 124 - rtems_timer_reset: inactive 222 222 - rtems_timer_reset: active 246 245 - rtems_timer_fire_when: inactive 312 311 - rtems_timer_fire_when: active 358 358 - rtems_timer_delete: active 263 263 - rtems_timer_delete: inactive 247 247 - rtems_task_wake_when 833 831 - -24 rtems_task_wake_after: yield -- returns to caller 99 98 - rtems_task_wake_after: yields -- preempts caller 479 478 - -25 rtems_clock_tick 313 318 - -26 _ISR_Disable 64 57 - _ISR_Flash 51 36 - _ISR_Enable 31 18 - _Thread_Disable_dispatch 53 37 - _Thread_Enable_dispatch 260 233 - _Thread_Set_state 446 463 - _Thread_Disptach (NO FP) 839 801 - context switch: no floating point contexts 673 653 - context switch: self 156 162 - context switch: to another task 84 70 - context switch: restore 1st FP task 1030 1013 - fp context switch: save idle, restore idle 969 948 - fp context switch: save idle, restore initialized 275 267 - fp context switch: save initialized, restore initialized 319 292 - _Thread_Resume 512 480 - _Thread_Unblock 121 139 - _Thread_Ready 199 203 - _Thread_Get 27 27 - _Semaphore_Get 20 21 - _Thread_Get: invalid id 5 5 - -27 interrupt entry overhead: returns to interrupted task 0 0 - interrupt exit overhead: returns to interrupted task 27 41 - interrupt entry overhead: returns to nested interrupt 0 0 - interrupt exit overhead: returns to nested interrupt 0 0 - interrupt entry overhead: returns to preempting task 0 0 - interrupt exit overhead: returns to preempting task 0 0 - -28 rtems_port_create 574 560 - rtems_port_external_to_internal 87 87 - rtems_port_internal_to_external 86 86 - rtems_port_delete 395 353 - -29 rtems_rate_monotonic_create 621 633 - rtems_rate_monotonic_period: initiate period -- returns to caller 773 694 - rtems_rate_monotonic_period: obtain status 295 284 - rtems_rate_monotonic_cancel 408 451 - rtems_rate_monotonic_delete: inactive 453 471 - rtems_rate_monotonic_delete: active 332 336 - rtems_rate_monotonic_period: conclude periods -- caller blocks 664 686 diff --git a/c/src/lib/libbsp/mips64orion/p4000/start/Makefile.in b/c/src/lib/libbsp/mips64orion/p4000/start/Makefile.in deleted file mode 100644 index 046969120a..0000000000 --- a/c/src/lib/libbsp/mips64orion/p4000/start/Makefile.in +++ /dev/null @@ -1,54 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -# C source names, if any, go here -- minus the .c -C_PIECES= -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -# Assembly source names, if any, go here -- minus the .s -S_PIECES=idt_csu -S_FILES=$(S_PIECES:%=%.S) -S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o) - -SRCS=$(C_FILES) $(CC_FILES) $(H_FILES) $(S_FILES) -OBJS=$(C_O_FILES) $(CC_O_FILES) $(S_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -PGM=${ARCH}/idt_csu.o - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -all: ${ARCH} $(SRCS) $(OBJS) $(PGM) - $(INSTALL_VARIANT) -m 555 ${PGM} ${PROJECT_RELEASE}/lib diff --git a/c/src/lib/libbsp/mips64orion/p4000/start/start.S b/c/src/lib/libbsp/mips64orion/p4000/start/start.S deleted file mode 100644 index 8dc31c8999..0000000000 --- a/c/src/lib/libbsp/mips64orion/p4000/start/start.S +++ /dev/null @@ -1,299 +0,0 @@ -/* - -Based upon IDT provided code with the following release: - -This source code has been made available to you by IDT on an AS-IS -basis. Anyone receiving this source is licensed under IDT copyrights -to use it in any way he or she deems fit, including copying it, -modifying it, compiling it, and redistributing it either with or -without modifications. No license under IDT patents or patent -applications is to be implied by the copyright license. - -Any user of this software should understand that IDT cannot provide -technical support for this software and will not be responsible for -any consequences resulting from the use of this software. - -Any person who transfers this source code or any derivative work must -include the IDT copyright notice, this paragraph, and the preceeding -two paragraphs in the transferred software. - -COPYRIGHT IDT CORPORATION 1996 -LICENSED MATERIAL - PROGRAM PROPERTY OF IDT - - $Id$ -*/ - -/************************************************************************* -** -** Copyright 1991-95 Integrated Device Technology, Inc. -** All Rights Reserved -** -** idt_csu.S -- IDT stand alone startup code -** -**************************************************************************/ -#include <rtems/score/iregdef.h> -#include <rtems/score/idtcpu.h> -#include <rtems/score/idtmon.h> - - -.extern _fbss,4 /* this is defined by the linker */ -.extern end,4 /* this is defined by the linker */ - -.lcomm sim_mem_cfg_struct,12 - - .text - - -#define TMP_STKSIZE 1024 - -/************************************************************************** -** -** start - Typicl standalone start up code required for R3000/R4000 -** -** -** 1) Initialize the STATUS Register -** a) Clear parity error bit -** b) Set co_processor 1 usable bit ON -** c) Clear all IntMask Enables -** d) Set kernel/disabled mode -** 2) Initialize Cause Register -** a) clear software interrupt bits -** 3) Determine FPU installed or not -** if not, clear CoProcessor 1 usable bit -** 4) Clear bss area -** 5) MUST allocate temporary stack until memory size determined -** It MUST be uncached to prevent overwriting when caches are cleared -** 6) Install exception handlers -** 7) Determine memory and cache sizes -** 8) Establish permanent stack (cached or uncached as defined by bss) -** 9) Flush Instruction and Data caches -** 10) If there is a Translation Lookaside Buffer, Clear the TLB -** 11) Execute initialization code if the IDT/c library is to be used -** -** 12) Jump to user's "main()" -** 13) Jump to promexit -** -** IDT/C 5.x defines _R3000, IDT/C 6.x defines _R4000 internally. -** This is used to mark code specific to R3xxx or R4xxx processors. -** IDT/C 6.x defines __mips to be the ISA level for which we're -** generating code. This is used to make sure the stack etc. is -** double word aligned, when using -mips3 (default) or -mips2, -** when compiling with IDT/C6.x -** -***************************************************************************/ - -FRAME(start,sp,0,ra) - - .set noreorder -#ifdef _R3000 - li v0,SR_PE|SR_CU1 /* reset parity error and set */ - /* cp1 usable */ -#endif -#ifdef _R4000 -#if __mips==3 || defined(R4650) - li v0,SR_CU1|SR_DE|SR_FR /* initally clear ERL, enable FPA 64bit regs*/ - /* 4650: Need fr to be set anyway */ -#else - li v0,SR_CU1|SR_DE /* initally clear ERL, enable FPA 32bit regs*/ -#endif mips3 -#endif - - mtc0 v0,C0_SR /* clr IntMsks/ kernel/disabled mode */ - nop - mtc0 zero,C0_CAUSE /* clear software interrupts */ - nop - -#ifdef _R4000 - li v0,CFG_C_NONCOHERENT # initialise default cache mode - mtc0 v0,C0_CONFIG -#endif - -/* -** check to see if an fpu is really plugged in -*/ - li t3,0xaaaa5555 /* put a's and 5's in t3 */ - mtc1 t3,fp0 /* try to write them into fp0 */ - mtc1 zero,fp1 /* try to write zero in fp */ - mfc1 t0,fp0 - mfc1 t1,fp1 - nop - bne t0,t3,1f /* branch if no match */ - nop - bne t1,zero,1f /* double check for positive id */ - nop - /* We have a FPU. clear fcsr */ - ctc1 zero, fcr31 - j 2f /* status register already correct */ - nop -1: -#ifdef _R3000 - li v0, SR_PE /* reset parity error/NO cp1 usable */ -#endif - -#ifdef _R4000 - li v0,SR_DE /* clear ERL and disable FPA */ -#endif - - mtc0 v0, C0_SR /* reset status register */ -2: - la gp, _gp - - la v0,_fbss /* clear bss before using it */ - la v1,end /* end of bss */ -3: sw zero,0(v0) - bltu v0,v1,3b - add v0,4 - - -/************************************************************************ -** -** Temporary Stack - needed to handle stack saves until -** memory size is determined and permanent stack set -** -** MUST be uncached to avoid confusion at cache -** switching during memory sizing -** -*************************************************************************/ -#if __mips==3 - /* For MIPS 3, we need to be sure that the stack is aligned on a - * double word boundary. - */ - andi t0, v0, 0x7 - beqz t0, 11f /* Last three bits Zero, already aligned */ - nop - add v0, 4 -11: -#endif - - or v0, K1BASE /* switch to uncached */ - add v1, v0, TMP_STKSIZE /* end of bss + length of tmp stack */ - sub v1, v1, (4*4) /* overhead */ - move sp, v1 /* set sp to top of stack */ -4: sw zero, 0(v0) - bltu v0, v1, 4b /* clear out temp stack */ - add v0, 4 - - jal init_exc_vecs /* install exception handlers */ - nop /* MUST do before memory probes */ - - la v0, 5f - li v1, K1BASE /* force into uncached space */ - or v0, v1 /* during memory/cache probes */ - j v0 - nop -5: - la a0, sim_mem_cfg_struct - jal sim_mem_cfg /* Make SIM call to get mem size */ - nop - la a0, sim_mem_cfg_struct - lw a0, 0(a0) /* Get memory size from struct */ -#ifdef _R3000 - jal config_Icache - nop - jal config_Dcache /* determine size of D & I caches */ - nop -#endif -#ifdef _R4000 - jal config_cache /* determine size of D & I caches */ - nop -#endif - - move v0, a0 /* mem_size */ - -#if __mips==3 - /* For MIPS 3, we need to be sure that the stack (and hence v0 - * here) is aligned on a double word boundary. - */ - andi t0, v0, 0x7 - beqz t0, 12f /* Last three bits Zero, already aligned */ - nop - subu v0, 4 /* mem_size was not aligned on doubleword bdry????*/ -12: -#endif - - - -/************************************************************************** -** -** Permanent Stack - now know top of memory, put permanent stack there -** -***************************************************************************/ - - la t2, _fbss /* cache mode as linked */ - and t2, 0xF0000000 /* isolate segment */ - la t1, 6f - j t1 /* back to original cache mode */ - nop -6: - or v0, t2 /* stack back to original cache mode */ - addiu v0,v0,-16 /* overhead */ - move sp, v0 /* now replace count w top of memory */ - move v1, v0 - subu v1, P_STACKSIZE /* clear requested stack size */ - -7: sw zero, 0(v1) /* clear P_STACKSIZE stack */ - bltu v1,v0,7b - add v1, 4 - .set reorder - -#ifdef _R3000 - jal flush_Icache - jal flush_Dcache /* flush Data & Instruction caches */ -#endif -#ifdef _R4000 - jal flush_cache_nowrite /* flush Data & Instruction caches */ -#endif - - - -/************************************************************************** -** -** If this chip supports a Translation Lookaside Buffer, clear it -** -***************************************************************************/ - - .set noreorder - mfc0 t1, C0_SR /* look at Status Register */ - nop - .set reorder -#ifdef _R3000 - li t2, SR_TS /* TLB Shutdown bit */ - and t1,t2 /* TLB Shutdown if 1 */ - bnez t1, 8f /* skip clearing if no TLB */ -#endif - -#ifndef R4650 - jal init_tlb /* clear the tlb */ -#endif - - -/************************************************************************ -** -** Initialization required if using IDT/c or libc.a, standard C Lib -** -** can SKIP if not necessary for application -** -************************************************************************/ -8: - - jal idtsim_init_sbrk - jal idtsim_init_file -/*********************** END I/O initialization **********************/ - - - jal main - - jal idtsim_promexit - -ENDFRAME(start) - - - .globl sim_mem_cfg -sim_mem_cfg: - .set noat - .set noreorder - li AT, (0xbfc00000+((55)*8)) - jr AT - nop - .set at - .set reorder diff --git a/c/src/lib/libbsp/powerpc/dmv177/Makefile.in b/c/src/lib/libbsp/powerpc/dmv177/Makefile.in deleted file mode 100644 index 3e5ccf3e06..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/Makefile.in +++ /dev/null @@ -1,25 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/directory.cfg - -SRCS=README - -# We only build the networking device driver if HAS_NETWORKING was defined -NETWORKING_DRIVER_yes_V = sonic -NETWORKING_DRIVER = $(NETWORKING_DRIVER_$(HAS_NETWORKING)_V) - -all: $(SRCS) - -# wrapup is the one that actually builds and installs the library -# from the individual .rel files built in other directories -SUB_DIRS=include clock console startup start timer \ - scv64 tod $(NETWORKING_DRIVER) wrapup diff --git a/c/src/lib/libbsp/powerpc/dmv177/QUIRKS b/c/src/lib/libbsp/powerpc/dmv177/QUIRKS deleted file mode 100644 index e1d95e6427..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/QUIRKS +++ /dev/null @@ -1,74 +0,0 @@ -# -# Quirks in the DY-4 DMV177 -# -# $Id$ -# - -JTAG and Caching -================ -If data or code caching is enabled on certain revisions of the PPC603e, -then the JTAG emulator interface become disfunctional. You can not -debug using the emulator on these chip revisions. On certain revisions, -it is so bad that when code caching is enabled, you can not even -download code reliably to the board. - -Caching and Peripherals -======================= -When caching is enabled, care must be exercised to insure that all -peripheral addresses are still uncached. - -Exar 88681 Clock -================ -This board uses a different clock for the Exar 88681 DUART than is -documented in the Exar manual or the original MC68681 manual. This -resulted in the need for the the mc68681 libchip driver to support -BSP specific baud rate tables and the development of a DMV177 -specific baud rate table. - -In the end, this all works but you have a very limited range of -useful baud rates on the 88681 ports compared to what would have -been supported had DY-4 just followed the Exar or Motorola manual. - - -SCC Addresses -============= -The full set of SCC addresses is not documented in the DY-4 manual -and they are not ordered as one would expect. Normally the four -SCC registers are ordered Control A, Data A, Control B, and Data B. -DY-4 orders them with B first. - -This required extra time to debug. - - -SCV64 and the Foundation Firmware -================================= -DY-4 technical support did not offer code to determine which interrupt -sources were pending at the SCV64. They recommended calling into the -Foundation Firmware ROM monitor to figure this out. The Foundation -Firmware did not recognize enough interrupts on this board to be useful. - -In the end, we gave up on their technical support's recommendation -and directly manipulated the SVC64. This is what we wanted to do in -the first place but we got no information from them to aid in this. -Luckily, the manual does document enough of DY-4's mapping of the specific -interrupt sources to make this work. - - -Z85C30 SCC Clock Speed -====================== - -The Z85C30 SCC can be factory configured for 10 Mhz or 2.4616 Mhz. Code -had to be added to dynamically determine which clock was installed. - -The board we had used a 10 Mhz clock. No testing was done with a 2.4616 Mhz -clock. - - -P2 Octopus Cable -================ - -DY-4's P2 breakout is large and a bit unwieldy. It was difficult to -fight into the VME cage we used. The SCSI connector comes off the -side and is very stiff thus making it difficult to route around -anything in the back of the cage. We gave up on trying to use -it in the first few slots of OAR's cage. diff --git a/c/src/lib/libbsp/powerpc/dmv177/README b/c/src/lib/libbsp/powerpc/dmv177/README deleted file mode 100644 index 0f00873225..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/README +++ /dev/null @@ -1,49 +0,0 @@ -# -# $Id$ -# - -BSP NAME: dmv177 -BOARD: DY-4 DMV177 -BUS: VMEBus -CPU FAMILY: powerpc -CPU: PowerPC 603e -COPROCESSORS: N/A -MODE: 32 bit mode - -DEBUG MONITOR: DY-4 General Purpose Monitor (GPM) - -PERIPHERALS -=========== -TIMERS: PPC internal Timebase register - RESOLUTION: ??? -SERIAL PORTS: 2 RS-232 provided by a Exar 88681 - 2 RS-422 provided by a Zilog Z8530 -REAL-TIME CLOCK: PPC internal Decrementer register -DMA: none -RTC: Harris ICM7170 -VIDEO: none -SCSI: QLogic FAS216 SCSI-2 (unsupported) -NETWORKING: National Semiconductor SONIC DP83932B (Ethernet) - -DRIVER INFORMATION -================== -CLOCK DRIVER: PPC internal -SHMSUPP: N/A -TIMER DRIVER: PPC internal -CONSOLE DRIVER: Uses libchip drivers for Exar 88681 and Zilog Z8530. - -STDIO -===== - -These are the default settings. - -PORT: Console port 0 -ELECTRICAL: RS-232 -BAUD: 9600 -BITS PER CHARACTER: 8 -PARITY: N -STOP BITS: 1 - -Notes -===== -The console and real-time clock drivers use the libchip library. diff --git a/c/src/lib/libbsp/powerpc/dmv177/README.net b/c/src/lib/libbsp/powerpc/dmv177/README.net deleted file mode 100644 index b3ff231340..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/README.net +++ /dev/null @@ -1,44 +0,0 @@ -# -# $Id$ -# - -Setting the Ethernet Hardware Address -===================================== - -The hardware Ethernet address is not set at the factory. It is the -responsibility of the end-user to insure that it is set properly. -This file describes the standard procedure recommended by DY-4 -technical support for setting this address. This procedure is -similar to that followed by VxWorks as documented in DY-4 -Document Number #807885. - -The hardware Ethernet address and OS configuration information -must be stored in the SEEPROM non-volatile memory of the -SVME/DMV-176/177. The Foundation Firmware (FFW) reserves the -first 256 bytes of the SEEPROM for its own use and the remaining -remaining 256 bytes are available for OS specific information. - -Three bytes in the Serial EEPROM are used for the lowest three bytes -of the hardware Ethernet address These should be set to the serial -number of your SVME/DMV-176/177 card to ensure a unique Ethernet -address on your network. The three high bytes are hard coded in the -BSP and represent the vendor-specific Ethernet codes (0x00, 0x80, 0x7F). -Together these six bytes form the target's Ethernet address. - -Address is of the form ... - -NOTE: The serial number is found on the packaging (box) that the -board came in OR it is also located on the solder side of the board and -looks something like SERNO:XXXXXX. It can not be determined dynamically -by software. - -Prior to using the Ethernet controller on the SVME/DMV-176/177 for the -first time, the Ethernet address bytes must be programmed into the -Serial EEPROM on the target card. The 'emm' (EEPROM Memory Modification) -command in the General Purpose Monitor (GPM) can be used to do this. - -In this example we will assume that the serial number of the target card -is 123456. - - - diff --git a/c/src/lib/libbsp/powerpc/dmv177/STATUS b/c/src/lib/libbsp/powerpc/dmv177/STATUS deleted file mode 100644 index 394412421e..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/STATUS +++ /dev/null @@ -1,82 +0,0 @@ -# -# This is a status file for the update effort. -# - -make/custom -=========== -dmv17x.cfg - -TOP -=== -README -Makefile.in -bsp_specs - -clock -===== -clock.c -Makefile.in - -console -======= -Changed console from - duart.c - console.c -To - consolebsp.h - console.c - 85c30.c - tbl85c30.c - -Note: Check the number of serial ports and modify - tbl85c30.c values to indicate the correct values. - -Makefile.in - Modified with new file names. - -timer -======= -timer.c -Makefile.in - -include -======= -chain.h -dmv170.h -bsp.h -Makefile -Makefile.in -coverhd.h - -network -======= -Eric's problem - -startup -======= -device-tree - remove -linkcmds -setvec.c - Modified to acount for general purpose vector. -sbrk.c - Ok -rtems-ctor.cc - Ok -bspclean.s - Ok -vmeintr.c -Makefile.in - Added genpvec.c -bspstart.c - Modified with changes from vista bsp. - -Added: -genpvec.c - -Note: Need to add routine which connects the general purpose interupt with the - various interupt handlers. genpvec.c uses this routine and may need - to be modified. -wrapup -======= -wrapup/Makefile.in - -vectors -======= - -start -======= -start/Makefile.in -start/start.s - Made modifications based upon Score603e mods. diff --git a/c/src/lib/libbsp/powerpc/dmv177/bsp_specs b/c/src/lib/libbsp/powerpc/dmv177/bsp_specs deleted file mode 100644 index ab5a8ddbeb..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/bsp_specs +++ /dev/null @@ -1,23 +0,0 @@ -%rename cpp old_cpp -%rename lib old_lib -%rename endfile old_endfile -%rename startfile old_startfile -%rename link old_link - -*cpp: -%(old_cpp) %{qrtems: -D__embedded__} -Asystem(embedded) - -*lib: -%{!qrtems: %(old_lib)} %{qrtems: --start-group \ -%{!qrtems_debug: -lrtemsall} %{qrtems_debug: -lrtemsall_g} \ --lc -lgcc --end-group ecrtn%O%s \ -%{!qnolinkcmds: -T linkcmds%s}} - -*startfile: -%{!qrtems: %(old_startfile)} %{qrtems: ecrti%O%s \ -%{!qrtems_debug: start.o%s} \ -%{qrtems_debug: start_g.o%s}} - -*link: -%{!qrtems: %(old_link)} %{qrtems: -Qy -dp -Bstatic -T linkcmds%s -e _start -u __vectors} - diff --git a/c/src/lib/libbsp/powerpc/dmv177/cable.doc b/c/src/lib/libbsp/powerpc/dmv177/cable.doc deleted file mode 100644 index e77fbd9a95..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/cable.doc +++ /dev/null @@ -1,97 +0,0 @@ -# -# Cable information for the DY-4 DMV177 -# -# $Id$ -# - -Background -========== - -All serial cables described in this file were built using RJ-45 ribbon -cables which were plugged into DB-25 or DB-9 adapters wired as described. -Matching the colors of the wires in the shell is the easiest way to -make sure the cable is built properly. - -The board is configured as follows: - - - An MC68681 is the first two serial ports. These are RS-232 and may - be accessed via the front panel or the P2. The front panel connector - has both A and B serial ports on a single connector. DY-4 part number - "OBYC3ASSY901132-000 Rev-" brings these ports out to two DB-25 - female connectors. - - - The MC68681 serial ports are also accessible on the P2 connector. - DY-4 part number "OBYC3ASSY901080-004 Rev A" brings these out - to DB-9 female connectors. These were not used in this effort. - - - A Z85C30 is used for the third and fourth serial ports. These are - RS-422 and may only be accessed via the P2 connector. These are - brought out to DB-25 male connectors. An RS-422 to RS-232 converter - was used to interface with these serial ports. - -References -========== - - - Linux Serial FAQ - - http://ahmed.egypt.com/electronics/serial - - DY-4 Documentation - -RS-422 Converter -================ - -An RS-422 to RS-232 converter from B&B Electronics was used to -adapt the RS-422 signals so they could be used with a normal -RS-232 serial port. Here is the information required to purchase -one of these: - - RS-232/RS-422 Converter: Model 422LCON - Power Supply: Model 422PS - - B&B Electronics Manufacturing Company - 707 Dayton Road - PO Box 1040 - Ottawa, IL 61350 - Voice: (815) 433-5100 - FAX: (815)434-7094 - - -Front Panel RS-232 Connection to a PC -===================================== - - Board's DB-25 PC's DB-9 Color in - Channel A COM1 Shell - ============= ============ ========= - RX on pin 2 TX on pin 2 Red - TX on pin 3 RX on pin 3 Blue - GND on pin 7 GND on pin 5 Black - DTR on pin 20 DTR on pin 4 Brown - - No other signals are used. - -RS-422 Connection to a PC -========================= - -This requires two cables with the converter connecting them. - -P2 RS-422 to the RS-422/RS-232 Converter -======================================== - - Board's Converter's Color in - DB-25 RS-422 DB-25 Shell - =============== ============== ======== - TXD_A on pin 2 RDA on pin 5 Red - TXD_B on pin 14 RDB on pin 17 Blue - RX_A on pin 3 TDA on pin 2 Brown - RX_B on pin 16 TDB on pin 14 Green - GND on pin 7 GND on pin 7 Black - - - Converter's PC's DB-9 Color in - RS-232 DB-25 COM1 Shell - =============== ============== ======== - TX on pin 2 TX on pin 2 Blue - RX on pin 3 RX on pin 3 Red - GND on pin 5 GND on pin 5 Black - DTR on pin 4 DTR on pin 4 Brown - - No other signals diff --git a/c/src/lib/libbsp/powerpc/dmv177/clock/Makefile.in b/c/src/lib/libbsp/powerpc/dmv177/clock/Makefile.in deleted file mode 100644 index 7c2cfc0772..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/clock/Makefile.in +++ /dev/null @@ -1,59 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -PGM=${ARCH}/clock.rel - -# C source names, if any, go here -- minus the .c -C_PIECES=clock -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -# Assembly source names, if any, go here -- minus the .s -S_PIECES= -S_FILES=$(S_PIECES:%=%.s) -S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o) - -SRCS=$(C_FILES) $(CC_FILES) $(H_FILES) $(S_FILES) -OBJS=$(C_O_FILES) $(CC_O_FILES) $(S_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -${PGM}: ${SRCS} ${OBJS} - $(make-rel) - -all: ${ARCH} $(SRCS) $(PGM) - -# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile -install: all diff --git a/c/src/lib/libbsp/powerpc/dmv177/clock/clock.c b/c/src/lib/libbsp/powerpc/dmv177/clock/clock.c deleted file mode 100644 index 75490a3382..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/clock/clock.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Clock Tick Device Driver - * - * This routine utilizes the Decrementer Register common to the PPC family. - * - * The tick frequency is directly programmed to the configured number of - * microseconds per tick. - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may in - * the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include <stdlib.h> - -#include <bsp.h> -#include <rtems/libio.h> - -extern rtems_cpu_table Cpu_table; - -/* - * The Real Time Clock Counter Timer uses this trap type. - */ - -#define CLOCK_VECTOR PPC_IRQ_DECREMENTER - -/* - * Clock ticks since initialization - */ - -volatile rtems_unsigned32 Clock_driver_ticks; - -/* - * This is the value programmed into the count down timer. - */ - -rtems_unsigned32 Clock_Decrementer_value; - -/* - * This is the value of the old isr routine. - */ -rtems_isr_entry Old_ticker; - - -void Clock_exit( void ); - -/* - * These are set by clock driver during its init - */ - -rtems_device_major_number rtems_clock_major = ~0; -rtems_device_minor_number rtems_clock_minor; - -/*PAGE - * - * Clock_isr - * - * This is the clock tick interrupt handler. - * - * Input parameters: - * vector - vector number - * - * Output parameters: NONE - * - * Return values: NONE - * - */ - -rtems_isr Clock_isr( - rtems_vector_number vector, - CPU_Interrupt_frame *frame -) -{ - /* - * Set the decrementer. - */ - - PPC_Set_decrementer( Clock_Decrementer_value ); - - /* - * The driver has seen another tick. - */ - - Clock_driver_ticks += 1; - - /* - * Real Time Clock counter/timer is set to automatically reload. - */ - - rtems_clock_tick(); -} - -/*PAGE - * - * Install_clock - * - * This routine actually performs the hardware initialization for the clock. - * - * Input parameters: - * clock_isr - clock interrupt service routine entry point - * - * Output parameters: NONE - * - * Return values: NONE - * - */ - -extern int CLOCK_SPEED; - -void Install_clock( - rtems_isr_entry clock_isr -) -{ - Clock_driver_ticks = 0; - - if ( BSP_Configuration.ticks_per_timeslice ) { - Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 ); - - PPC_Set_decrementer( Clock_Decrementer_value ); - - atexit( Clock_exit ); - } -} - -/*PAGE - * - * Clock_exit - * - * This routine allows the clock driver to exit by masking the interrupt and - * disabling the clock's counter. - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * Return values: NONE - * - */ - -void Clock_exit( void ) -{ - if ( BSP_Configuration.ticks_per_timeslice ) { - - /* nothing to do */; - - /* do not restore old vector */ - } -} - -/*PAGE - * - * Clock_initialize - * - * This routine initializes the clock driver. - * - * Input parameters: - * major - clock device major number - * minor - clock device minor number - * parg - pointer to optional device driver arguments - * - * Output parameters: NONE - * - * Return values: - * rtems_device_driver status code - */ - -rtems_device_driver Clock_initialize( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *pargp -) -{ - Clock_Decrementer_value = Cpu_table.clicks_per_usec * - BSP_Configuration.microseconds_per_tick; - - Install_clock( Clock_isr ); - - /* - * make major/minor avail to others such as shared memory driver - */ - - rtems_clock_major = major; - rtems_clock_minor = minor; - - return RTEMS_SUCCESSFUL; -} - -/* PAGE - * - * Clock_control - * - * This routine is the clock device driver control entry point. - * - * Input parameters: - * major - clock device major number - * minor - clock device minor number - * parg - pointer to optional device driver arguments - * - * Output parameters: NONE - * - * Return values: - * rtems_device_driver status code - */ - -rtems_device_driver Clock_control( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *pargp -) -{ - rtems_unsigned32 isrlevel; - rtems_libio_ioctl_args_t *args = pargp; - - if (args == 0) - goto done; - - /* - * This is hokey, but until we get a defined interface - * to do this, it will just be this simple... - */ - - if (args->command == rtems_build_name('I', 'S', 'R', ' ')) - { - Clock_isr( CLOCK_VECTOR, pargp ); - } - else if (args->command == rtems_build_name('N', 'E', 'W', ' ')) - { - rtems_interrupt_disable( isrlevel ); - (void) set_vector( args->buffer, CLOCK_VECTOR, 1 ); - rtems_interrupt_enable( isrlevel ); - } - -done: - return RTEMS_SUCCESSFUL; -} - - - - - diff --git a/c/src/lib/libbsp/powerpc/dmv177/console/Makefile.in b/c/src/lib/libbsp/powerpc/dmv177/console/Makefile.in deleted file mode 100644 index 261eb79a82..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/console/Makefile.in +++ /dev/null @@ -1,54 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@:@srcdir@/../../../shared -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -PGM=${ARCH}/console.rel - -# C source names, if any, go here -- minus the .c -C_PIECES=config console debugio -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -SRCS=$(C_FILES) $(H_FILES) -OBJS=$(C_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -${PGM}: ${SRCS} ${OBJS} - $(make-rel) - -all: ${ARCH} $(SRCS) $(PGM) - -# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile -install: all diff --git a/c/src/lib/libbsp/powerpc/dmv177/console/config.c b/c/src/lib/libbsp/powerpc/dmv177/console/config.c deleted file mode 100644 index e3a0eb073f..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/console/config.c +++ /dev/null @@ -1,283 +0,0 @@ -/* - * This file contains the TTY driver table for the DY-4 DMV177. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994, 1997. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * $Id$ - */ - -#include <bsp.h> - -#include <libchip/serial.h> -#include <libchip/mc68681.h> -#include <libchip/z85c30.h> - -/* - * Configuration specific probe routines - * - * - * NOTE: There are no DMV177 specific configuration routines. These - * routines could be written to dynamically determine which serial - * ports are on a board. Debugging this would require access to - * multiple board models. - */ - -/* NONE CURRENTLY PROVIDED */ - -/* - * The following table configures the console drivers used in this BSP. - * - * The first entry which, when probed, is available, will be named /dev/console, - * all others being given the name indicated. - */ - -mc68681_baud_t - dmv177_mc68681_baud_table[4][RTEMS_TERMIOS_NUMBER_BAUD_RATES] = { - { /* ACR[7] = 0, X = 0 */ - MC68681_BAUD_NOT_VALID, /* B0 */ - MC68681_BAUD_NOT_VALID, /* B50 */ - 0x01, /* B75 */ - MC68681_BAUD_NOT_VALID, /* B110 */ - 0x03, /* B134 */ - MC68681_BAUD_NOT_VALID, /* B150 */ - 0x04, /* B200 */ - MC68681_BAUD_NOT_VALID, /* B300 */ - MC68681_BAUD_NOT_VALID, /* B600 */ - MC68681_BAUD_NOT_VALID, /* B1200 */ - MC68681_BAUD_NOT_VALID, /* B1800 */ - MC68681_BAUD_NOT_VALID, /* B2400 */ - 0x0A, /* B4800 */ - MC68681_BAUD_NOT_VALID, /* B9600 */ - MC68681_BAUD_NOT_VALID, /* B19200 */ - MC68681_BAUD_NOT_VALID, /* B38400 */ - MC68681_BAUD_NOT_VALID, /* B57600 */ - MC68681_BAUD_NOT_VALID, /* B115200 */ - MC68681_BAUD_NOT_VALID, /* B230400 */ - MC68681_BAUD_NOT_VALID /* B460800 */ - }, - { /* ACR[7] = 1, X = 0 */ - MC68681_BAUD_NOT_VALID, /* B0 */ - 0x00, /* B50 */ - 0x01, /* B75 */ - MC68681_BAUD_NOT_VALID, /* B110 */ - MC68681_BAUD_NOT_VALID, /* B134 */ - MC68681_BAUD_NOT_VALID, /* B150 */ - 0x04, /* B200 */ - MC68681_BAUD_NOT_VALID, /* B300 */ - MC68681_BAUD_NOT_VALID, /* B600 */ - 0x0A, /* B1200 */ - MC68681_BAUD_NOT_VALID, /* B1800 */ - MC68681_BAUD_NOT_VALID, /* B2400 */ - MC68681_BAUD_NOT_VALID, /* B4800 */ - MC68681_BAUD_NOT_VALID, /* B9600 */ - MC68681_BAUD_NOT_VALID, /* B19200 */ - MC68681_BAUD_NOT_VALID, /* B38400 */ - MC68681_BAUD_NOT_VALID, /* B57600 */ - MC68681_BAUD_NOT_VALID, /* B115200 */ - MC68681_BAUD_NOT_VALID, /* B230400 */ - MC68681_BAUD_NOT_VALID /* B460800 */ - }, - { /* ACR[7] = 0, X = 1 */ - MC68681_BAUD_NOT_VALID, /* B0 */ - 0x00, /* B50 */ - 0x01, /* B75 */ - MC68681_BAUD_NOT_VALID, /* B110 */ - MC68681_BAUD_NOT_VALID, /* B134 */ - MC68681_BAUD_NOT_VALID, /* B150 */ - MC68681_BAUD_NOT_VALID, /* B200 */ - MC68681_BAUD_NOT_VALID, /* B300 */ - MC68681_BAUD_NOT_VALID, /* B600 */ - MC68681_BAUD_NOT_VALID, /* B1200 */ - MC68681_BAUD_NOT_VALID, /* B1800 */ - 0x04, /* B2400 */ - MC68681_BAUD_NOT_VALID, /* B4800 */ - 0x05, /* B9600 */ - 0x06, /* B19200 */ - 0x07, /* B38400 */ - MC68681_BAUD_NOT_VALID, /* B57600 */ - MC68681_BAUD_NOT_VALID, /* B115200 */ - MC68681_BAUD_NOT_VALID, /* B230400 */ - MC68681_BAUD_NOT_VALID /* B460800 */ - }, - { /* ACR[7] = 1, X = 1 */ - MC68681_BAUD_NOT_VALID, /* B0 */ - MC68681_BAUD_NOT_VALID, /* B50 */ - 0x01, /* B75 */ - MC68681_BAUD_NOT_VALID, /* B110 */ - 0x03, /* B134 */ - MC68681_BAUD_NOT_VALID, /* B150 */ - MC68681_BAUD_NOT_VALID, /* B200 */ - MC68681_BAUD_NOT_VALID, /* B300 */ - MC68681_BAUD_NOT_VALID, /* B600 */ - MC68681_BAUD_NOT_VALID, /* B1200 */ - MC68681_BAUD_NOT_VALID, /* B1800 */ - 0x04, /* B2400 */ - 0x0A, /* B4800 */ - 0x05, /* B9600 */ - 0x06, /* B19200 */ - 0x07, /* B38400 */ - MC68681_BAUD_NOT_VALID, /* B57600 */ - MC68681_BAUD_NOT_VALID, /* B115200 */ - MC68681_BAUD_NOT_VALID, /* B230400 */ - MC68681_BAUD_NOT_VALID /* B460800 */ - }, -}; - -#define MC68681_PORT_CONFIG \ - (MC68681_DATA_BAUD_RATE_SET_1|MC68681_XBRG_ENABLED) - -/* - * Based on BSP configuration information decide whether to do polling IO - * or interrupt driven IO. - */ - -#if (CONSOLE_USE_INTERRUPTS) -#define MC68681_FUNCTIONS &mc68681_fns -#define Z85C30_FUNCTIONS &z85c30_fns -#else -#define MC68681_FUNCTIONS &mc68681_fns_polled -#define Z85C30_FUNCTIONS &z85c30_fns_polled -#endif - -boolean dmv177_z85c30_probe(int minor); -boolean dmv177_mc68681_probe(int minor); - -console_tbl Console_Port_Tbl[] = { - { - "/dev/com0", /* sDeviceName */ - SERIAL_MC68681, /* deviceType */ - MC68681_FUNCTIONS, /* pDeviceFns */ - dmv177_mc68681_probe, /* deviceProbe */ - NULL, /* pDeviceFlow */ - 16, /* ulMargin */ - 8, /* ulHysteresis */ - (void *)9600, /* baud rate */ /* pDeviceParams */ - MC68681_ADDR, /* ulCtrlPort1 */ - MC68681_PORT1_ADDR, /* ulCtrlPort2 */ - MC68681_PORT_CONFIG, /* ulDataPort */ - mc68681_get_register_8, /* getRegister */ - mc68681_set_register_8, /* setRegister */ - NULL, /* unused */ /* getData */ - NULL, /* unused */ /* setData */ - (unsigned32)dmv177_mc68681_baud_table, /* ulClock */ - DMV170_DUART_IRQ /* ulIntVector */ - }, - { - "/dev/com1", /* sDeviceName */ - SERIAL_MC68681, /* deviceType */ - MC68681_FUNCTIONS, /* pDeviceFns */ - dmv177_mc68681_probe, /* deviceProbe */ - NULL, /* pDeviceFlow */ - 16, /* ulMargin */ - 8, /* ulHysteresis */ - (void *)9600, /* baud rate */ /* pDeviceParams */ - MC68681_ADDR, /* ulCtrlPort1 */ - MC68681_PORT2_ADDR, /* ulCtrlPort2 */ - MC68681_PORT_CONFIG, /* ulDataPort */ - mc68681_get_register_8, /* getRegister */ - mc68681_set_register_8, /* setRegister */ - NULL, /* unused */ /* getData */ - NULL, /* unused */ /* setData */ - (unsigned32)dmv177_mc68681_baud_table, /* ulClock */ - DMV170_DUART_IRQ /* ulIntVector */ - }, - { - "/dev/com3", /* sDeviceName */ - SERIAL_Z85C30, /* deviceType */ - Z85C30_FUNCTIONS, /* pDeviceFns */ - dmv177_z85c30_probe, /* deviceProbe */ - NULL, /* pDeviceFlow */ - 16, /* ulMargin */ - 8, /* ulHysteresis */ - (void *)9600, /* baud rate */ /* pDeviceParams */ - Z85C30_CTRL_A, /* ulCtrlPort1 */ - Z85C30_CTRL_A, /* ulCtrlPort2 */ - 0, /* ulDataPort */ - z85c30_get_register, /* getRegister */ - z85c30_set_register, /* setRegister */ - NULL, /* getData */ - NULL, /* setData */ - 0, /* filled in by probe */ /* ulClock */ - DMV170_SCC_IRQ /* ulIntVector */ - }, - { - "/dev/com4", /* sDeviceName */ - SERIAL_Z85C30, /* deviceType */ - Z85C30_FUNCTIONS, /* pDeviceFns */ - dmv177_z85c30_probe, /* deviceProbe */ - NULL, /* pDeviceFlow */ - 16, /* ulMargin */ - 8, /* ulHysteresis */ - (void *)9600, /* baud rate */ /* pDeviceParams */ - Z85C30_CTRL_B, /* ulCtrlPort1 */ - Z85C30_CTRL_A, /* ulCtrlPort2 */ - 0, /* ulDataPort */ - z85c30_get_register, /* getRegister */ - z85c30_set_register, /* setRegister */ - NULL, /* getData */ - NULL, /* setData */ - 0, /* filled in by probe */ /* ulClock */ - DMV170_SCC_IRQ /* ulIntVector */ - } -}; - -/* - * Declare some information used by the console driver - */ - -#define NUM_CONSOLE_PORTS (sizeof(Console_Port_Tbl)/sizeof(console_tbl)) - -unsigned long Console_Port_Count = NUM_CONSOLE_PORTS; - -console_data Console_Port_Data[NUM_CONSOLE_PORTS]; - -rtems_device_minor_number Console_Port_Minor; - -/* - * Hopefully, by checking the card resource register, this BSP - * will be able to operate on the DMV171, DMV176, or DMV177. - */ - -boolean dmv177_z85c30_probe(int minor) -{ - volatile unsigned32 *dma_control_status_reg; - volatile unsigned16 *card_resource_reg; - unsigned16 v; - - card_resource_reg = (volatile unsigned16 *) DMV170_CARD_RESORCE_REG; - - v = *card_resource_reg & DMV170_SCC_INST_MASK; - - if ( v != DMV170_SCC_INSTALLED ) - return FALSE; - - /* - * Figure out the clock speed of the Z85C30 SCC - */ - - dma_control_status_reg = (volatile unsigned32 *)DMV170_DMA_CONTROL_STATUS_REG; - - if ( *dma_control_status_reg & DMV170_SCC_10MHZ ) - Console_Port_Tbl[minor].ulClock = Z85C30_CLOCK_10; - else - Console_Port_Tbl[minor].ulClock = Z85C30_CLOCK_2; - - return TRUE; -} - -boolean dmv177_mc68681_probe(int minor) -{ - volatile unsigned16 *card_resource_reg; - unsigned16 v; - - card_resource_reg = (volatile unsigned16 *) DMV170_CARD_RESORCE_REG; - - v = *card_resource_reg & DMV170_DUART_INST_MASK; - - if ( v == DMV170_DUART_INSTALLED ) - return TRUE; - - return FALSE; -} diff --git a/c/src/lib/libbsp/powerpc/dmv177/console/conscfg.c b/c/src/lib/libbsp/powerpc/dmv177/console/conscfg.c deleted file mode 100644 index e3a0eb073f..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/console/conscfg.c +++ /dev/null @@ -1,283 +0,0 @@ -/* - * This file contains the TTY driver table for the DY-4 DMV177. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994, 1997. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * $Id$ - */ - -#include <bsp.h> - -#include <libchip/serial.h> -#include <libchip/mc68681.h> -#include <libchip/z85c30.h> - -/* - * Configuration specific probe routines - * - * - * NOTE: There are no DMV177 specific configuration routines. These - * routines could be written to dynamically determine which serial - * ports are on a board. Debugging this would require access to - * multiple board models. - */ - -/* NONE CURRENTLY PROVIDED */ - -/* - * The following table configures the console drivers used in this BSP. - * - * The first entry which, when probed, is available, will be named /dev/console, - * all others being given the name indicated. - */ - -mc68681_baud_t - dmv177_mc68681_baud_table[4][RTEMS_TERMIOS_NUMBER_BAUD_RATES] = { - { /* ACR[7] = 0, X = 0 */ - MC68681_BAUD_NOT_VALID, /* B0 */ - MC68681_BAUD_NOT_VALID, /* B50 */ - 0x01, /* B75 */ - MC68681_BAUD_NOT_VALID, /* B110 */ - 0x03, /* B134 */ - MC68681_BAUD_NOT_VALID, /* B150 */ - 0x04, /* B200 */ - MC68681_BAUD_NOT_VALID, /* B300 */ - MC68681_BAUD_NOT_VALID, /* B600 */ - MC68681_BAUD_NOT_VALID, /* B1200 */ - MC68681_BAUD_NOT_VALID, /* B1800 */ - MC68681_BAUD_NOT_VALID, /* B2400 */ - 0x0A, /* B4800 */ - MC68681_BAUD_NOT_VALID, /* B9600 */ - MC68681_BAUD_NOT_VALID, /* B19200 */ - MC68681_BAUD_NOT_VALID, /* B38400 */ - MC68681_BAUD_NOT_VALID, /* B57600 */ - MC68681_BAUD_NOT_VALID, /* B115200 */ - MC68681_BAUD_NOT_VALID, /* B230400 */ - MC68681_BAUD_NOT_VALID /* B460800 */ - }, - { /* ACR[7] = 1, X = 0 */ - MC68681_BAUD_NOT_VALID, /* B0 */ - 0x00, /* B50 */ - 0x01, /* B75 */ - MC68681_BAUD_NOT_VALID, /* B110 */ - MC68681_BAUD_NOT_VALID, /* B134 */ - MC68681_BAUD_NOT_VALID, /* B150 */ - 0x04, /* B200 */ - MC68681_BAUD_NOT_VALID, /* B300 */ - MC68681_BAUD_NOT_VALID, /* B600 */ - 0x0A, /* B1200 */ - MC68681_BAUD_NOT_VALID, /* B1800 */ - MC68681_BAUD_NOT_VALID, /* B2400 */ - MC68681_BAUD_NOT_VALID, /* B4800 */ - MC68681_BAUD_NOT_VALID, /* B9600 */ - MC68681_BAUD_NOT_VALID, /* B19200 */ - MC68681_BAUD_NOT_VALID, /* B38400 */ - MC68681_BAUD_NOT_VALID, /* B57600 */ - MC68681_BAUD_NOT_VALID, /* B115200 */ - MC68681_BAUD_NOT_VALID, /* B230400 */ - MC68681_BAUD_NOT_VALID /* B460800 */ - }, - { /* ACR[7] = 0, X = 1 */ - MC68681_BAUD_NOT_VALID, /* B0 */ - 0x00, /* B50 */ - 0x01, /* B75 */ - MC68681_BAUD_NOT_VALID, /* B110 */ - MC68681_BAUD_NOT_VALID, /* B134 */ - MC68681_BAUD_NOT_VALID, /* B150 */ - MC68681_BAUD_NOT_VALID, /* B200 */ - MC68681_BAUD_NOT_VALID, /* B300 */ - MC68681_BAUD_NOT_VALID, /* B600 */ - MC68681_BAUD_NOT_VALID, /* B1200 */ - MC68681_BAUD_NOT_VALID, /* B1800 */ - 0x04, /* B2400 */ - MC68681_BAUD_NOT_VALID, /* B4800 */ - 0x05, /* B9600 */ - 0x06, /* B19200 */ - 0x07, /* B38400 */ - MC68681_BAUD_NOT_VALID, /* B57600 */ - MC68681_BAUD_NOT_VALID, /* B115200 */ - MC68681_BAUD_NOT_VALID, /* B230400 */ - MC68681_BAUD_NOT_VALID /* B460800 */ - }, - { /* ACR[7] = 1, X = 1 */ - MC68681_BAUD_NOT_VALID, /* B0 */ - MC68681_BAUD_NOT_VALID, /* B50 */ - 0x01, /* B75 */ - MC68681_BAUD_NOT_VALID, /* B110 */ - 0x03, /* B134 */ - MC68681_BAUD_NOT_VALID, /* B150 */ - MC68681_BAUD_NOT_VALID, /* B200 */ - MC68681_BAUD_NOT_VALID, /* B300 */ - MC68681_BAUD_NOT_VALID, /* B600 */ - MC68681_BAUD_NOT_VALID, /* B1200 */ - MC68681_BAUD_NOT_VALID, /* B1800 */ - 0x04, /* B2400 */ - 0x0A, /* B4800 */ - 0x05, /* B9600 */ - 0x06, /* B19200 */ - 0x07, /* B38400 */ - MC68681_BAUD_NOT_VALID, /* B57600 */ - MC68681_BAUD_NOT_VALID, /* B115200 */ - MC68681_BAUD_NOT_VALID, /* B230400 */ - MC68681_BAUD_NOT_VALID /* B460800 */ - }, -}; - -#define MC68681_PORT_CONFIG \ - (MC68681_DATA_BAUD_RATE_SET_1|MC68681_XBRG_ENABLED) - -/* - * Based on BSP configuration information decide whether to do polling IO - * or interrupt driven IO. - */ - -#if (CONSOLE_USE_INTERRUPTS) -#define MC68681_FUNCTIONS &mc68681_fns -#define Z85C30_FUNCTIONS &z85c30_fns -#else -#define MC68681_FUNCTIONS &mc68681_fns_polled -#define Z85C30_FUNCTIONS &z85c30_fns_polled -#endif - -boolean dmv177_z85c30_probe(int minor); -boolean dmv177_mc68681_probe(int minor); - -console_tbl Console_Port_Tbl[] = { - { - "/dev/com0", /* sDeviceName */ - SERIAL_MC68681, /* deviceType */ - MC68681_FUNCTIONS, /* pDeviceFns */ - dmv177_mc68681_probe, /* deviceProbe */ - NULL, /* pDeviceFlow */ - 16, /* ulMargin */ - 8, /* ulHysteresis */ - (void *)9600, /* baud rate */ /* pDeviceParams */ - MC68681_ADDR, /* ulCtrlPort1 */ - MC68681_PORT1_ADDR, /* ulCtrlPort2 */ - MC68681_PORT_CONFIG, /* ulDataPort */ - mc68681_get_register_8, /* getRegister */ - mc68681_set_register_8, /* setRegister */ - NULL, /* unused */ /* getData */ - NULL, /* unused */ /* setData */ - (unsigned32)dmv177_mc68681_baud_table, /* ulClock */ - DMV170_DUART_IRQ /* ulIntVector */ - }, - { - "/dev/com1", /* sDeviceName */ - SERIAL_MC68681, /* deviceType */ - MC68681_FUNCTIONS, /* pDeviceFns */ - dmv177_mc68681_probe, /* deviceProbe */ - NULL, /* pDeviceFlow */ - 16, /* ulMargin */ - 8, /* ulHysteresis */ - (void *)9600, /* baud rate */ /* pDeviceParams */ - MC68681_ADDR, /* ulCtrlPort1 */ - MC68681_PORT2_ADDR, /* ulCtrlPort2 */ - MC68681_PORT_CONFIG, /* ulDataPort */ - mc68681_get_register_8, /* getRegister */ - mc68681_set_register_8, /* setRegister */ - NULL, /* unused */ /* getData */ - NULL, /* unused */ /* setData */ - (unsigned32)dmv177_mc68681_baud_table, /* ulClock */ - DMV170_DUART_IRQ /* ulIntVector */ - }, - { - "/dev/com3", /* sDeviceName */ - SERIAL_Z85C30, /* deviceType */ - Z85C30_FUNCTIONS, /* pDeviceFns */ - dmv177_z85c30_probe, /* deviceProbe */ - NULL, /* pDeviceFlow */ - 16, /* ulMargin */ - 8, /* ulHysteresis */ - (void *)9600, /* baud rate */ /* pDeviceParams */ - Z85C30_CTRL_A, /* ulCtrlPort1 */ - Z85C30_CTRL_A, /* ulCtrlPort2 */ - 0, /* ulDataPort */ - z85c30_get_register, /* getRegister */ - z85c30_set_register, /* setRegister */ - NULL, /* getData */ - NULL, /* setData */ - 0, /* filled in by probe */ /* ulClock */ - DMV170_SCC_IRQ /* ulIntVector */ - }, - { - "/dev/com4", /* sDeviceName */ - SERIAL_Z85C30, /* deviceType */ - Z85C30_FUNCTIONS, /* pDeviceFns */ - dmv177_z85c30_probe, /* deviceProbe */ - NULL, /* pDeviceFlow */ - 16, /* ulMargin */ - 8, /* ulHysteresis */ - (void *)9600, /* baud rate */ /* pDeviceParams */ - Z85C30_CTRL_B, /* ulCtrlPort1 */ - Z85C30_CTRL_A, /* ulCtrlPort2 */ - 0, /* ulDataPort */ - z85c30_get_register, /* getRegister */ - z85c30_set_register, /* setRegister */ - NULL, /* getData */ - NULL, /* setData */ - 0, /* filled in by probe */ /* ulClock */ - DMV170_SCC_IRQ /* ulIntVector */ - } -}; - -/* - * Declare some information used by the console driver - */ - -#define NUM_CONSOLE_PORTS (sizeof(Console_Port_Tbl)/sizeof(console_tbl)) - -unsigned long Console_Port_Count = NUM_CONSOLE_PORTS; - -console_data Console_Port_Data[NUM_CONSOLE_PORTS]; - -rtems_device_minor_number Console_Port_Minor; - -/* - * Hopefully, by checking the card resource register, this BSP - * will be able to operate on the DMV171, DMV176, or DMV177. - */ - -boolean dmv177_z85c30_probe(int minor) -{ - volatile unsigned32 *dma_control_status_reg; - volatile unsigned16 *card_resource_reg; - unsigned16 v; - - card_resource_reg = (volatile unsigned16 *) DMV170_CARD_RESORCE_REG; - - v = *card_resource_reg & DMV170_SCC_INST_MASK; - - if ( v != DMV170_SCC_INSTALLED ) - return FALSE; - - /* - * Figure out the clock speed of the Z85C30 SCC - */ - - dma_control_status_reg = (volatile unsigned32 *)DMV170_DMA_CONTROL_STATUS_REG; - - if ( *dma_control_status_reg & DMV170_SCC_10MHZ ) - Console_Port_Tbl[minor].ulClock = Z85C30_CLOCK_10; - else - Console_Port_Tbl[minor].ulClock = Z85C30_CLOCK_2; - - return TRUE; -} - -boolean dmv177_mc68681_probe(int minor) -{ - volatile unsigned16 *card_resource_reg; - unsigned16 v; - - card_resource_reg = (volatile unsigned16 *) DMV170_CARD_RESORCE_REG; - - v = *card_resource_reg & DMV170_DUART_INST_MASK; - - if ( v == DMV170_DUART_INSTALLED ) - return TRUE; - - return FALSE; -} diff --git a/c/src/lib/libbsp/powerpc/dmv177/console/debugio.c b/c/src/lib/libbsp/powerpc/dmv177/console/debugio.c deleted file mode 100644 index d23df205a3..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/console/debugio.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * This file contains the debug IO support. - * - * COPYRIGHT (c) 1998 by Radstone Technology - * - * - * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY - * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK - * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. - * - * You are hereby granted permission to use, copy, modify, and distribute - * this file, provided that this notice, plus the above copyright notice - * and disclaimer, appears in all copies. Radstone Technology will provide - * no support for this code. - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include <bsp.h> -#include <rtems/libio.h> -#include <stdlib.h> -#include <assert.h> -#include <termios.h> - -#include <libchip/serial.h> - -/* - * Load configuration table - */ - -extern console_data Console_Port_Data[]; -extern rtems_device_minor_number Console_Port_Minor; - -/* PAGE - * - * DEBUG_puts - * - * This should be safe in the event of an error. It attempts to ensure - * that no TX empty interrupts occur while it is doing polled IO. Then - * it restores the state of that external interrupt. - * - * Input parameters: - * string - pointer to debug output string - * - * Output parameters: NONE - * - * Return values: NONE - */ - -void DEBUG_puts( - char *string -) -{ - char *s; - unsigned32 Irql; - - rtems_interrupt_disable(Irql); - - for ( s = string ; *s ; s++ ) { - Console_Port_Tbl[Console_Port_Minor].pDeviceFns-> - deviceWritePolled(Console_Port_Minor, *s); - } - - rtems_interrupt_enable(Irql); -} - -/* PAGE - * - * DEBUG_puth - * - * This should be safe in the event of an error. It attempts to ensure - * that no TX empty interrupts occur while it is doing polled IO. Then - * it restores the state of that external interrupt. - * - * Input parameters: - * ulHexNum - value to display - * - * Output parameters: NONE - * - * Return values: NONE - */ - -void DEBUG_puth( - unsigned32 ulHexNum -) -{ - unsigned long i,d; - unsigned32 Irql; - void (*poll)(int minor, char cChar); - - poll = Console_Port_Tbl[Console_Port_Minor].pDeviceFns->deviceWritePolled; - - rtems_interrupt_disable(Irql); - - (*poll)(Console_Port_Minor, '0'); - (*poll)(Console_Port_Minor, 'x'); - - for ( i=32 ; i ; ) { - i -= 4; - d = (ulHexNum>>i)&0xf; - (*poll)(Console_Port_Minor, (d<=9) ? d+'0' : d+'a'-0xa); - } - rtems_interrupt_enable(Irql); -} - diff --git a/c/src/lib/libbsp/powerpc/dmv177/include/Makefile.in b/c/src/lib/libbsp/powerpc/dmv177/include/Makefile.in deleted file mode 100644 index a711b3e1de..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/include/Makefile.in +++ /dev/null @@ -1,36 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -H_FILES = $(srcdir)/bsp.h $(srcdir)/coverhd.h \ - $(srcdir)/dmv170.h $(srcdir)/../../../shared/tod.h - -# -# Equate files are for including from assembly preprocessed by -# gm4 or gasp. No examples are provided except for those for -# other CPUs. The best way to generate them would be to -# provide a program which generates the constants used based -# on the C equivalents. -# -# If you add equate files, don't forget to uncomment the install line -# below. -# - -EQ_FILES = - -SRCS=$(H_FILES) $(EQ_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -all: $(SRCS) - $(INSTALL) -m 444 $(H_FILES) $(PROJECT_INCLUDE) diff --git a/c/src/lib/libbsp/powerpc/dmv177/include/bsp.h b/c/src/lib/libbsp/powerpc/dmv177/include/bsp.h deleted file mode 100644 index f99211f8d3..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/include/bsp.h +++ /dev/null @@ -1,187 +0,0 @@ -/* bsp.h - * - * This include file contains all DY-4 DMV170 board IO definitions. - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -#ifndef __DMV170_BSP_h -#define __DMV170_BSP_h - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef ASM -/* Definition of where to store registers in alignment handler */ -#define ALIGN_REGS 0x0140 - -#else -#include <rtems.h> -#include <console.h> -#include <clockdrv.h> -#include <console.h> -#include <iosupp.h> - -#include <dmv170.h> - -#if 0 -#define Enable_Debug() \ - DMV170_WRITE( 0xffffbd0c, 0 ) - -#define Debug_Entry( num ) \ - DMV170_WRITE( 0xffffbd06, num ) -#else -#define Enable_Debug() -#define Debug_Entry( num ) -#endif - -/* - * The following macro calculates the Baud constant. For the Z8530 chip. - */ -#define Z8530_Baud( _frequency, _clock_by, _baud_rate ) \ - ( (_frequency /( _clock_by * 2 * _baud_rate)) - 2) - - -/* - * Define the time limits for RTEMS Test Suite test durations. - * Long test and short test duration limits are provided. These - * values are in seconds and need to be converted to ticks for the - * application. - * - */ - -#define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */ -#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */ - - -/* - * Stuff for Time Test 27 - */ - -#define MUST_WAIT_FOR_INTERRUPT 1 - -#define Install_tm27_vector( _handler ) \ - set_vector( (_handler), PPC_IRQ_DECREMENTER, 1 ) - -#define Cause_tm27_intr() \ - do { \ - unsigned32 _clicks = 1; \ - asm volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \ - } while (0) - -#define Clear_tm27_intr() \ - do { \ - unsigned32 _clicks = 0xffffffff; \ - unsigned32 _msr = 0; \ - _ISR_Set_level( 0 ); \ - asm volatile( "mfmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \ - _msr &= ~0x8000; \ - asm volatile( "mtmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \ - asm volatile( "mtdec %0" : "=r" ((_clicks)) : "r" ((_clicks)) ); \ - } while (0) - -#define Lower_tm27_intr() \ - do { \ - unsigned32 _msr = 0; \ - _ISR_Set_level( 0 ); \ - asm volatile( "mfmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \ - _msr |= 0x8002; \ - asm volatile( "mtmsr %0 ;" : "=r" (_msr) : "r" (_msr) ); \ - } while (0) - -/* Constants */ - -/* - * Device Driver Table Entries - */ - -/* - * NOTE: Use the standard Console driver entry - */ - -/* - * NOTE: Use the standard Clock driver entry - */ - - -/* - * Information placed in the linkcmds file. - */ - -extern int RAM_START; -extern int RAM_END; -extern int RAM_SIZE; - -extern int PROM_START; -extern int PROM_END; -extern int PROM_SIZE; - -extern int CLOCK_SPEED; - -extern int end; /* last address in the program */ - -/* - * How many libio files we want - */ - -#define BSP_LIBIO_MAX_FDS 20 - -/* functions */ - -/* - * genvec.c - */ -rtems_isr_entry set_EE_vector( - rtems_isr_entry handler, /* isr routine */ - rtems_vector_number vector /* vector number */ -); -void initialize_external_exception_vector (); - -/* - * console.c - */ -void DEBUG_puts( char *string ); - -void BSP_fatal_return( void ); - - - -void bsp_start( void ); - -void bsp_cleanup( void ); - -rtems_isr_entry set_vector( /* returns old vector */ - rtems_isr_entry handler, /* isr routine */ - rtems_vector_number vector, /* vector number */ - int type /* RTEMS or RAW intr */ -); - -void BSP_fatal_return( void ); - -void bsp_spurious_initialize( void ); - -extern rtems_configuration_table BSP_Configuration; /* owned by BSP */ - -extern rtems_cpu_table Cpu_table; /* owned by BSP */ - -extern rtems_unsigned32 bsp_isr_level; - -extern int CPU_PPC_CLICKS_PER_MS; - -#endif /* ASM */ - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/c/src/lib/libbsp/powerpc/dmv177/include/coverhd.h b/c/src/lib/libbsp/powerpc/dmv177/include/coverhd.h deleted file mode 100644 index 451d13b706..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/include/coverhd.h +++ /dev/null @@ -1,134 +0,0 @@ -/* coverhd.h - * - * This include file has defines to represent the overhead associated - * with calling a particular directive from C. These are used in the - * Timing Test Suite to ignore the overhead required to pass arguments - * to directives. On some CPUs and/or target boards, this overhead - * is significant and makes it difficult to distinguish internal - * RTEMS execution time from that used to call the directive. - * This file should be updated after running the C overhead timing - * test. Once this update has been performed, the RTEMS Time Test - * Suite should be rebuilt to account for these overhead times in the - * timing results. - * - * NOTE: If these are all zero, then the times reported include - * calling overhead including passing of arguments. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - * $Id$ - */ - -/* - * - * Units are 100ns. - * - * These numbers are of questionable use, as they are developed by calling - * the routine many times, thus getting its entry veneer into the (small) - * cache on the 403GA. This in general is not true of the RTEMS timing - * tests, which usually call a routine only once, thus having no cache loaded - * advantage. - * - * Whether the directive times are useful after deducting the function call - * overhead is also questionable. The user is more interested generally - * in the total cost of a directive, not the cost if the procedure call - * is inlined! (In general this is not true). - * - * Andrew Bray 18/08/1995 - * - */ - -#ifndef __COVERHD_h -#define __COVERHD_h - -#ifdef __cplusplus -extern "C" { -#endif - -#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE 0 -#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE 0 -#define CALLING_OVERHEAD_TASK_CREATE 0 -#define CALLING_OVERHEAD_TASK_IDENT 0 -#define CALLING_OVERHEAD_TASK_START 0 -#define CALLING_OVERHEAD_TASK_RESTART 0 -#define CALLING_OVERHEAD_TASK_DELETE 0 -#define CALLING_OVERHEAD_TASK_SUSPEND 0 -#define CALLING_OVERHEAD_TASK_RESUME 0 -#define CALLING_OVERHEAD_TASK_SET_PRIORITY 0 -#define CALLING_OVERHEAD_TASK_MODE 0 -#define CALLING_OVERHEAD_TASK_GET_NOTE 0 -#define CALLING_OVERHEAD_TASK_SET_NOTE 0 -#define CALLING_OVERHEAD_TASK_WAKE_WHEN 0 -#define CALLING_OVERHEAD_TASK_WAKE_AFTER 0 -#define CALLING_OVERHEAD_INTERRUPT_CATCH 0 -#define CALLING_OVERHEAD_CLOCK_GET 0 -#define CALLING_OVERHEAD_CLOCK_SET 0 -#define CALLING_OVERHEAD_CLOCK_TICK 0 - -#define CALLING_OVERHEAD_TIMER_CREATE 0 -#define CALLING_OVERHEAD_TIMER_IDENT 0 -#define CALLING_OVERHEAD_TIMER_DELETE 0 -#define CALLING_OVERHEAD_TIMER_FIRE_AFTER 0 -#define CALLING_OVERHEAD_TIMER_FIRE_WHEN 0 -#define CALLING_OVERHEAD_TIMER_RESET 0 -#define CALLING_OVERHEAD_TIMER_CANCEL 0 -#define CALLING_OVERHEAD_SEMAPHORE_CREATE 0 -#define CALLING_OVERHEAD_SEMAPHORE_IDENT 0 -#define CALLING_OVERHEAD_SEMAPHORE_DELETE 0 -#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN 0 -#define CALLING_OVERHEAD_SEMAPHORE_RELEASE 0 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE 0 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT 0 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE 0 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND 0 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT 0 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST 0 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE 0 -#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH 0 - -#define CALLING_OVERHEAD_EVENT_SEND 0 -#define CALLING_OVERHEAD_EVENT_RECEIVE 0 -#define CALLING_OVERHEAD_SIGNAL_CATCH 0 -#define CALLING_OVERHEAD_SIGNAL_SEND 0 -#define CALLING_OVERHEAD_PARTITION_CREATE 0 -#define CALLING_OVERHEAD_PARTITION_IDENT 0 -#define CALLING_OVERHEAD_PARTITION_DELETE 0 -#define CALLING_OVERHEAD_PARTITION_GET_BUFFER 0 -#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER 0 -#define CALLING_OVERHEAD_REGION_CREATE 0 -#define CALLING_OVERHEAD_REGION_IDENT 0 -#define CALLING_OVERHEAD_REGION_DELETE 0 -#define CALLING_OVERHEAD_REGION_GET_SEGMENT 0 -#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT 0 -#define CALLING_OVERHEAD_PORT_CREATE 0 -#define CALLING_OVERHEAD_PORT_IDENT 0 -#define CALLING_OVERHEAD_PORT_DELETE 0 -#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 0 -#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 0 - -#define CALLING_OVERHEAD_IO_INITIALIZE 0 -#define CALLING_OVERHEAD_IO_OPEN 0 -#define CALLING_OVERHEAD_IO_CLOSE 0 -#define CALLING_OVERHEAD_IO_READ 0 -#define CALLING_OVERHEAD_IO_WRITE 0 -#define CALLING_OVERHEAD_IO_CONTROL 0 -#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED 0 -#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE 0 -#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT 0 -#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE 0 -#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL 0 -#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD 0 -#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE 0 - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/c/src/lib/libbsp/powerpc/dmv177/include/dmv170.h b/c/src/lib/libbsp/powerpc/dmv177/include/dmv170.h deleted file mode 100644 index b676dafe0c..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/include/dmv170.h +++ /dev/null @@ -1,290 +0,0 @@ -/* dmv170.h - * - * This include file contains information pertaining to the DMV170. - * - * NOTE: Other than where absolutely required, this version currently - * supports only the peripherals and bits used by the basic board - * support package. This includes at least significant pieces of - * the following items: - * - * + UART Channels A and B - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may in - * the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef _INCLUDE_DMV170_h -#define _INCLUDE_DMV170_h - - -/* - * DY-4 uses a non-standard clock for the Exar 88681. - */ - -#undef MC68681_BAUD_RATE_MASK_9600 -#define MC68681_BAUD_RATE_MASK_9600 - -#define DMV17x_MC68681_BAUD_RATE_MASK_9600 - -#if 0 -#define MC68681_OFFSET_MULTIPLIER 8 -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* Note: Move address defs to the linker files. XXX */ - -/* Real Time Clock Base Address */ -#define DMV170_RTC_ADDRESS 0xf2c00000 - -/* base address of the DUART (68681) */ -#define MC68681_ADDR 0xf2800000 -#define MC68681_PORT1_ADDR 0xf2800000 -#define MC68681_PORT2_ADDR 0xf2800040 - -/* - * SONIC Information - */ - -#define DMV170_SONIC_ADDR 0xf3000000 - -#define SONIC_BASE_ADDRESS DMV170_SONIC_ADDR -#define SONIC_VECTOR DMV170_ETHERNET_IRQ - -/* base address for the SCC (85C30) */ -#define Z85C30_ADDR 0xfb000010 -#define Z85C30_CTRL_A 0xfb000010 -#define Z85C30_DATA_A 0xfb000018 -#define Z85C30_CTRL_B 0xfb000000 -#define Z85C30_DATA_B 0xfb000008 -#define Z85C30_CLOCK_10 (10485760) /* 10 Mhz */ -#define Z85C30_CLOCK_2 (2581175) /* 2.4616 Mhz */ - -/* base address for the SCV64 */ -#define DMV170_SCV64_BASE_ADDRESS 0xf2000000 - -#define DMV170_LOCAL_CONTROL_STATUS_REG 0xf2400000 -#define DMV170_TIMER0_COUNT_INTERVAL_REG 0xf2400008 -#define DMV170_TIMER1_COUNT_INTERVAL_REG 0xf2400010 -#define DMV170_TIMER2_COUNT_INTERVAL_REG 0xf2400018 -#define DMV170_TIMER_CONTROL_REG 0xf2400020 -#define DMV170_CARD_RESORCE_REG 0xf2400040 - -#define DMV170_WRITE( _reg, _data ) \ - *((volatile rtems_unsigned16 *)(_reg)) = (_data) - -#define DMV170_READ( _reg, _data ) \ - (_data) = *((volatile rtems_unsigned16 *)(_reg)) - -/* - * The following defines the bits in the DMA Control and Status Register - */ - -/* XXX fill in the other bits */ - -#define DMV170_DMA_CONTROL_STATUS_REG 0xfc000090 - -#define DMV170_SCC_10MHZ 0x00010000 - -/* - * The following defines the bits in the Local Control and Status Register. - */ -#define DMV170_IPLx_MASK 0x0007 -#define DMV170_MAXPACK_SENSE_MASK 0x0008 -#define DMV170_MAXPACK_NOT_INSTALLED 0x0008 -#define DMV170_MAXPACK_INSTALLED 0x0000 - -#define DMV170_MAXPACK_RESET_MASK 0x0010 -#define DMV170_MAXPACK_RESET_NEGATE 0x0010 -#define DMV170_MAXPACK_RESET_ASSERT 0x0000 -#define DMV170_EEPROM_READ_WRITE_MASK 0x0020 -#define DMV170_EEPROM_READ 0x0020 -#define DMV170_EEPROM_WRITE 0x0000 -#define DMV170_EEPROM_CLOCK_CTRL_MASK 0x0040 -#define DMV170_EEPROM_CLOCK_ASSERT 0x0040 -#define DMV170_EEPROM_CLOCK_NEGATE 0x0000 -#define DMV170_EEPROM_DATA_MASK 0x0080 -#define DMV170_EEPROM_DATA_HIGH 0x0080 -#define DMV170_EEPROM_DATA_LOW 0x0000 - -/* Bits 8-10: 68040 Transfer Modifer Codes represent the Transfer - * Modifier to be used on MAXPack Accesses. - * - * Bit 11 : 68040 Transfer Type (TT) 0:TT are both low 1:TT are both high - */ - -#define DMV170_USER_LINK0_STATUS_MASK 0x1000 -#define DMV170_USER_LINK0_OPEN 0x1000 -#define DMV170_USER_LINK0_INSTALLED 0x0000 -#define DMV170_LOWER_STATUS_LED_CONTROL_MASK 0x2000 -#define DMV170_LOWER_STATUS_LED_IS_OFF 0x2000 -#define DMV170_LOWER_STATUS_LED_IS_ON 0x0000 -#ifdef DMV176 - /* The following are not available for the DMV171 */ -#define DMV170_RAM_TYPE_MASK 0x4000 -#define DMV170_RAM_TYPE_IS_DRAM 0x4000 -#define DMV170_RAM_TYPE_IS_SRAM 0x0000 -#define DMV170_IACK_VECTOR_AUTOVECTOR_MASK 0x8000 -#define DMV170_IACK_VECTOR_AUTOVECTOR_IS_VECTOR 0x8000 -#define DMV170_IACK_VECTOR_AUTOVECTOR_IS_NOT_VECTOR 0x0000 -#endif - -/* - * The following defines the bits in the Timer Control Register. - */ - -#define DMV170_TIMER0_ENABLE_MASK 0x0001 -#define DMV170_TIMER0_IS_ENABLED 0x0001 -#define DMV170_TIMER0_IS_DISABLED 0x0000 -#define DMV170_TIMER1_ENABLE_MASK 0x0002 -#define DMV170_TIMER1_IS_ENABLED 0x0002 -#define DMV170_TIMER1_IS_DISABLED 0x0000 -#define DMV170_TIMER2_ENABLE_MASK 0x0004 -#define DMV170_TIMER2_IS_ENABLED 0x0004 -#define DMV170_TIMER2_IS_DISABLED 0x0000 -#define DMV170_TIMER1_CLOCK_MASK 0x0008 -#define DMV170_TIMER1_CLOCK_AT_TIMER0 0x0008 -#define DMV170_TIMER1_CLOCK_AT_1MHZ 0x0000 - -#define DMV170_TIMER2_CLOCK_MASK 0x0010 -#define DMV170_TIMER2_CLOCK_AT_TIMER0 0x0010 -#define DMV170_TIMER2_CLOCK_AT_1MHZ 0x0000 -#define DMV170_TIMER0_INTERRUPT_MASK 0x0020 -#define DMV170_TIMER0_INTERRUPT_ENABLE 0x0020 -#define DMV170_TIMER0_INTERRUPT_CLEAR 0x0000 -#define DMV170_TIMER1_INTERRUPT_MASK 0x0040 -#define DMV170_TIMER1_INTERRUPT_ENABLE 0x0040 -#define DMV170_TIMER1_INTERRUPT_CLEAR 0x0000 -#define DMV170_TIMER2_INTERRUPT_MASK 0x0080 -#define DMV170_TIMER2_INTERRUPT_ENABLE 0x0080 -#define DMV170_TIMER2_INTERRUPT_CLEAR 0x0000 - -/* - * The Following define the bits for the Card Resource Register. - */ - -#define DMV170_DUART_INTERRUPT_MASK 0x0001 /* DUART Interrupt Sense Bit */ -#define DMV170_DUART_INTERRUPT_NEGATE 0x0001 -#define DMV170_DUART_INTERRUPT_ASSERT 0x0000 -#define DMV170_SONIC_INTERRUPT_MASK 0x0002 /* SONIC Interrupt Sense Bit */ -#define DMV170_SONIC_INTERRUPT_NEGATE 0x0002 -#define DMV170_SONIC_INTERRUPT_ASSERT 0x0000 -#define DMV170_SCSI_INTERRUPT_MASK 0x0004 /* SCSI Interrupt Sense Bit */ -#define DMV170_SCSI_INTERRUPT_NEGATE 0x0004 -#define DMV170_SCSI_INTERRUPT_ASSERT 0x0000 -#define DMV170_SCC_INTERRUPT_MASK 0x0008 /* SCC Interrupt Sense Bit */ -#define DMV170_SCC_INTERRUPT_NEGATE 0x0008 -#define DMV170_SCC_INTERRUPT_ASSERT 0x0000 -#define DMV170_SNOOP_ENABLE_MASK 0x0010 /* CPU Snoop Enable Bit */ -#define DMV170_SNOOP_DISABLE 0x0010 -#define DMV170_SNOOP_ENABLE 0x0000 -#define DMV170_SONIC_RESET_MASK 0x0020 /* SONIC RESET Control */ -#define DMV170_SONIC_RESET_CLEAR 0x0020 -#define DMV170_SONIC_RESET_HOLD 0x0000 -#define DMV170_NV64_WE_MASK 0x0040 /* 64-bit Non-Volital Memory */ -#define DMV170_NV64_WRITE_ENABLE 0x0040 /* Write Enable */ -#define DMV170_NV64_WRITE_DISABLE 0x0000 -#define DMV170_BOOT_NV16_MASK 0x0080 /* BOOT Device Type */ -#define DMV170_BOOT_64_BIT 0x0080 -#define DMV170_BOOT_16_BIT 0x0000 -#define DMV170_DUART_INST_MASK 0x0100 /* DUART Sense Bit */ -#define DMV170_DUART_INSTALLED 0x0100 -#define DMV170_DUART_NOT_INSTALLED 0x0000 -#define DMV170_SONIC_INST_MASK 0x0200 /* SONIC Sense Bit */ -#define DMV170_SONIC_INSTALLED 0x0200 -#define DMV170_SONIC_NOT_INSTALLED 0x0000 -#define DMV170_16M_NV64_MASK 0x0400 /* 16 Mb of 64bit Flash Sense */ -#define DMV170_16Mb_FLASH_INSTALLED 0x0400 -#define DMV170_8Mb_FLASH_INSTALLED 0x0000 -#define DMV170_SCC_INST_MASK 0x0800 /* SCC Sense Bit */ -#define DMV170_SCC_INSTALLED 0x0800 -#define DMV170_SCC_NOT_INSTALLED 0x0000 -#define DMV170_RTC_INST_MASK 0x1000 /* RTC Sense Bit */ -#define DMV170_RTC_INSTALLED 0x1000 -#define DMV170_RTC_NOT_INSTALLED 0x0000 -#define DMV170_NV64_INST_MASK 0x2000 /* 64bit Non-Volital Mem Sense*/ - -#define DMV170_64_BIT_NON_VOLITAL_MEM_INSTALLED 0x2000 -#define DMV170_64_BIT_NON_VOLITAL_MEM_NOT_INSTALLED 0x0000 - - -/* - * DUART Baud Rate Definitions. - */ - -#define DMV170_DUART_9621 MC68681_BAUD_RATE_MASK_600 /* close to 9600 */ - -#define DMV170_RTC_FREQUENCY 0x0000 - - -/* - * CPU General Purpose Interrupt definations (PPC_IRQ_EXTERNAL). - * Note: For the interrupt level read the lower 3 bits of the - * Local Control and Status Register. - */ - -#define DMV170_IRQ_FIRST ( PPC_IRQ_LAST + 1 ) - -#define DMV170_LIRQ0 ( DMV170_IRQ_FIRST + 0 ) -#define DMV170_LIRQ1 ( DMV170_IRQ_FIRST + 1 ) -#define DMV170_LIRQ2 ( DMV170_IRQ_FIRST + 2 ) -#define DMV170_LIRQ3 ( DMV170_IRQ_FIRST + 3 ) -#define DMV170_LIRQ4 ( DMV170_IRQ_FIRST + 4 ) -#define DMV170_LIRQ5 ( DMV170_IRQ_FIRST + 5 ) -#define DMV170_L7IACF ( DMV170_IRQ_FIRST + 6 ) -#define DMV170_L7ISYS ( DMV170_IRQ_FIRST + 7 ) -#define DMV170_L7IMNI ( DMV170_IRQ_FIRST + 8 ) -#define DMV170_BIMODE ( DMV170_IRQ_FIRST + 9 ) - -#define DMV170_DUART_IRQ DMV170_LIRQ5 -#define DMV170_ETHERNET_IRQ DMV170_LIRQ5 -#define DMV170_SCSI_IRQ DMV170_LIRQ5 -#define DMV170_SCC_IRQ DMV170_LIRQ5 -#define DMV170_MEZZANINE_IRQ_0 DMV170_LIRQ4 -#define DMV170_TICK_IRQ DMV170_LIRQ3 -#define DMV170_LOCATION_MON_IRQ DMV170_LIRQ2 -#define DMV170_SCV64_IRQ DMV170_LIRQ1 -#define DMV170_RTC_IRQ DMV170_LIRQ0 - -#define DMV170_ACFAIL_IRQ DMV170_L7IACF -#define DMV170_SYSFAIL_IRQ DMV170_L7ISYS -#define DMV170_WATCHDOG_IRQ DMV170_L7IMNI -#define DMV170_BI_IRQ DMV170_BIMODE -#define DMV170_RAM_PARITY_IRQ ( DMV170_IRQ_FIRST + 10) -#define DMV170_DARF_BUS_ERROR_IRQ ( DMV170_IRQ_FIRST + 11) -#define DMV170_PERIPHERAL_IRQ ( DMV170_IRQ_FIRST + 12) - -#define MAX_BOARD_IRQS DMV170_PERIPHERAL_IRQ - -#define SCV64_Is_IRQ0( _status ) (_status&0x01) -#define SCV64_Is_IRQ1( _status ) (_status&0x02) -#define SCV64_Is_IRQ2( _status ) (_status&0x04) -#define SCV64_Is_IRQ3( _status ) (_status&0x08) -#define SCV64_Is_IRQ4( _status ) (_status&0x10) -#define SCV64_Is_IRQ5( _status ) (_status&0x20) - - -/* - * scv64.c - */ - -void SCV64_Generate_DUART_Interrupts(); -rtems_unsigned32 SCV64_Get_Interrupt(); -rtems_unsigned32 SCV64_Get_Interrupt_Enable(); - -#ifdef __cplusplus -} -#endif - -#endif /* !_INCLUDE_DMV170_h */ -/* end of include file */ - diff --git a/c/src/lib/libbsp/powerpc/dmv177/scv64/Makefile.in b/c/src/lib/libbsp/powerpc/dmv177/scv64/Makefile.in deleted file mode 100644 index 14961659b3..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/scv64/Makefile.in +++ /dev/null @@ -1,60 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -PGM=${ARCH}/scv64.rel - -# C source names, if any, go here -- minus the .c -C_PIECES=$(SCV64_PIECES) -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -SRCS=$(C_FILES) $(H_FILES) -OBJS=$(C_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -# -SCV64_PIECES=scv64 - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -${PGM}: ${SRCS} ${OBJS} - $(make-rel) - -all: ${ARCH} $(SRCS) $(PGM) - -# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile -install: all - - - diff --git a/c/src/lib/libbsp/powerpc/dmv177/scv64/scv64.c b/c/src/lib/libbsp/powerpc/dmv177/scv64/scv64.c deleted file mode 100644 index 850618ad0e..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/scv64/scv64.c +++ /dev/null @@ -1,171 +0,0 @@ -/* scv64.c - * - * This set of routines control the scv64 chip on the DMV177 board. - * - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994, 1997. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * $Id$ - */ - -#include <rtems.h> -#include <bsp.h> - -typedef struct { - /* DARF Registers */ - volatile rtems_unsigned32 DMALAR; /* 0x00 */ - volatile rtems_unsigned32 DMAVAR; /* 0x04 */ - volatile rtems_unsigned32 DMATC; /* 0x08 */ - volatile rtems_unsigned32 DCSR; /* 0x0c */ - volatile rtems_unsigned32 VMEBAR; /* 0x10 */ - volatile rtems_unsigned32 RXDATA; /* 0x14 */ - volatile rtems_unsigned32 RXADDR; /* 0x18 */ - volatile rtems_unsigned32 RXCTL; /* 0x1c */ - volatile rtems_unsigned32 BUSSEL; /* 0x20 */ - volatile rtems_unsigned32 IVECT; /* 0x24 */ - volatile rtems_unsigned32 APBR; /* 0x28 */ - volatile rtems_unsigned32 TXDATA; /* 0x2c */ - volatile rtems_unsigned32 TXADDR; /* 0x30 */ - volatile rtems_unsigned32 TXCTL; /* 0x34 */ - volatile rtems_unsigned32 LMFIFO; /* 0x38 */ - volatile rtems_unsigned32 MODE; /* 0x3c */ - volatile rtems_unsigned32 SA64BAR; /* 0x40 */ - volatile rtems_unsigned32 MA64BAR; /* 0x44 */ - volatile rtems_unsigned32 LAG; /* 0x48 */ - volatile rtems_unsigned32 DMAVTC; /* 0x4c */ - - /* Reserved */ - volatile rtems_unsigned32 reserved_50_7F[12]; - - /* ACC Registers */ - volatile rtems_unsigned8 STAT0_pad[3]; /* 0x80 */ - volatile rtems_unsigned8 STAT0; - volatile rtems_unsigned8 STAT1_pad[3]; /* 0x84 */ - volatile rtems_unsigned8 STAT1; - volatile rtems_unsigned8 GENCTL_pad[3]; /* 0x88 */ - volatile rtems_unsigned8 GENCTL; - volatile rtems_unsigned8 VINT_pad[3]; /* 0x8c */ - volatile rtems_unsigned8 VINT; - volatile rtems_unsigned8 VREQ_pad[3]; /* 0x90 */ - volatile rtems_unsigned8 VREQ; - volatile rtems_unsigned8 VARB_pad[3]; /* 0x94 */ - volatile rtems_unsigned8 VARB; - volatile rtems_unsigned8 ID_pad[3]; /* 0x98 */ - volatile rtems_unsigned8 ID; - volatile rtems_unsigned8 NA_pad[3]; /* 0x9c */ - volatile rtems_unsigned8 NA; - volatile rtems_unsigned8 _7IS_pad[3]; /* 0xa0 */ - volatile rtems_unsigned8 _7IS; - volatile rtems_unsigned8 LIS_pad[3]; /* 0xa4 */ - volatile rtems_unsigned8 LIS; - volatile rtems_unsigned8 UIE_pad[3]; /* 0xa8 */ - volatile rtems_unsigned8 UIE; - volatile rtems_unsigned8 LIE_pad[3]; /* 0xac */ - volatile rtems_unsigned8 LIE; - volatile rtems_unsigned8 VIE_pad[3]; /* 0xb0 */ - volatile rtems_unsigned8 VIE; - volatile rtems_unsigned8 IC10_pad[3]; /* 0xb4 */ - volatile rtems_unsigned8 IC10; - volatile rtems_unsigned8 IC32_pad[3]; /* 0xb8 */ - volatile rtems_unsigned8 IC32; - volatile rtems_unsigned8 IC54_pad[3]; /* 0xbc */ - volatile rtems_unsigned8 IC54; - /* Utility Registers */ - volatile rtems_unsigned32 MISC; - volatile rtems_unsigned32 delay_line[3]; - volatile rtems_unsigned32 MBOX0; - volatile rtems_unsigned32 MBOX1; - volatile rtems_unsigned32 MBOX2; - volatile rtems_unsigned32 MBOX3; -} SCV64_Registers; - -/* - * LIE Register - */ -#define LOCAL_INTERRUPT_ENABLE_0 0x01 -#define LOCAL_INTERRUPT_ENABLE_1 0x02 -#define LOCAL_INTERRUPT_ENABLE_2 0x04 -#define LOCAL_INTERRUPT_ENABLE_3 0x08 -#define LOCAL_INTERRUPT_ENABLE_4 0x10 -#define LOCAL_INTERRUPT_ENABLE_5 0x20 - -/* - * IC54 Register - */ -#define AUTOVECTOR_5 0x80 - - -/* - * Set the registers pointer to the base address of the SCV64 - */ -SCV64_Registers *SCV64 = (void *)DMV170_SCV64_BASE_ADDRESS; - -/*PAGE - * - * SCV64_Initialize - * - * This routine initializes the SCV64. - */ -void SCV64_Initialize() { - SCV64->LIE = 0; -} - -/*PAGE - * - * SCV64_Generate_DUART_Interrupts - * - * This sets the SCV64 to generate duart interrupts for - * the DMV177 board. - */ -void SCV64_Generate_DUART_Interrupts() { - - rtems_unsigned8 data; - - /* - * Set Local Interrupt 5 enable - */ - data = SCV64->LIE; - data |= LOCAL_INTERRUPT_ENABLE_5; - SCV64->LIE = data; - - /* - * Set Autovector. - */ - data = SCV64->IC54; - data |= AUTOVECTOR_5; - SCV64->IC54 = data; -} - -/*PAGE - * - * SCV64_Get_Interrupt - * - * This routine returns the SCV64 status register. - */ -rtems_unsigned32 SCV64_Get_Interrupt() -{ - rtems_unsigned8 data; - - /* - * Put the LIS data into the lower byte of the result - */ - data = SCV64->LIS; - - return data; -} - -/*PAGE - * - * SCV64_Get_Interrupt_Enable - * - * This routine returns the interrupt enable mask. - */ -rtems_unsigned32 SCV64_Get_Interrupt_Enable() -{ - /* - * Return the set of interrupts enabled. - */ - return SCV64->LIE; -} diff --git a/c/src/lib/libbsp/powerpc/dmv177/sonic/Makefile.in b/c/src/lib/libbsp/powerpc/dmv177/sonic/Makefile.in deleted file mode 100644 index 35cd5ff209..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/sonic/Makefile.in +++ /dev/null @@ -1,60 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -PGM=${ARCH}/sonic.rel - -# C source names, if any, go here -- minus the .c -C_PIECES=sonic -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -# Assembly source names, if any, go here -- minus the .s -S_PIECES= -S_FILES=$(S_PIECES:%=%.s) -S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o) - -SRCS=$(C_FILES) $(CC_FILES) $(H_FILES) $(S_FILES) -OBJS=$(C_O_FILES) $(CC_O_FILES) $(S_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -D_COMPILING_BSD_KERNEL_ -DKERNEL -DINET -DNFS \ - -DDIAGNOSTIC -DBOOTP_COMPAT -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -${PGM}: ${SRCS} ${OBJS} - $(make-rel) - -all: ${ARCH} $(SRCS) $(PGM) - -# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile -install: all diff --git a/c/src/lib/libbsp/powerpc/dmv177/sonic/sonic.c b/c/src/lib/libbsp/powerpc/dmv177/sonic/sonic.c deleted file mode 100644 index 651025ee71..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/sonic/sonic.c +++ /dev/null @@ -1,1599 +0,0 @@ -void break_when_you_get_here(); -/* - ******************************************************************* - ******************************************************************* - ** ** - ** RTEMS NETWORK DRIVER FOR NATIONAL DP83932 `SONIC' ** - ** SYSTEMS-ORIENTED NETWORK INTERFACE CONTROLLER ** - ** ** - ******************************************************************* - ******************************************************************* - */ - -/* - * $Revision$ $Date$ $Author$ - * $State$ - * $Id$ - */ - -/* - * References: - * 1) DP83932C-20/25/33 MHz SONIC(TM) Systems-Oriented Network Interface - * Controller data sheet. TL/F/10492, RRD-B30M105, National Semiconductor, - * 1995. - * - * 2) Software Driver Programmer's Guide for the DP83932 SONIC(TM), - * Application Note 746, Wesley Lee and Mike Lui, TL/F/11140, - * RRD-B30M75, National Semiconductor, March, 1991. - * - * 3) SVME/DMV-171 Single Board Computer Documentation Package, #805905, - * DY 4 Systems Inc., Kanata, Ontario, September, 1996. - */ - -#include <rtems/rtems_bsdnet.h> -#include "sonic.h" - -#include <stdio.h> - -#include <errno.h> -#include <rtems/error.h> - -#include <sys/param.h> -#include <sys/mbuf.h> -#include <sys/socket.h> -#include <sys/sockio.h> -#include <sys/sockio.h> - -#include <net/if.h> - -#include <netinet/in.h> -#include <netinet/if_ether.h> - -/* - * Debug levels - * - */ - -#define SONIC_DEBUG_NONE 0x0000 -#define SONIC_DEBUG_ALL 0xFFFF -#define SONIC_DEBUG_PRINT_REGISTERS 0x0001 -#define SONIC_DEBUG_MEMORY 0x0002 -#define SONIC_DEBUG_MEMORY_ALLOCATE 0x0004 -#define SONIC_DEBUG_FRAGMENTS 0x0008 -#define SONIC_DEBUG_CAM 0x0008 -#define SONIC_DEBUG_DESCRIPTORS 0x0010 -#define SONIC_DEBUG_ERRORS 0x0020 - -#define SONIC_DEBUG (SONIC_DEBUG_ERRORS) - -/* (SONIC_DEBUG_MEMORY|SONIC_DEBUG_DESCRIPTORS) */ - -/* SONIC_DEBUG_ALL */ - - -/* - * XXX - */ - -#include <dmv170.h> - -/* - * Use the top line if you want more symbols. - */ - -#define SONIC_STATIC -/* #define SONIC_STATIC static */ - -/* - * Number of devices supported by this driver - */ -#ifndef NSONIC -# define NSONIC 1 -#endif - -/* - * Default location of device registers - */ -#ifndef SONIC_BASE_ADDRESS -# define SONIC_BASE_ADDRESS 0xF3000000 -# warning "Using default SONIC_BASE_ADDRESS." -#endif - -/* - * Default interrupt vector - */ -#ifndef SONIC_VECTOR -# define SONIC_VECTOR 1 -# warning "Using default SONIC_VECTOR." -#endif - -/* - * Default device configuration register values - * Conservative, generic values. - * DCR: - * No extended bus mode - * Unlatched bus retry - * Programmable outputs unused - * Asynchronous bus mode - * User definable pins unused - * No wait states (access time controlled by DTACK*) - * 32-bit DMA - * Empty/Fill DMA mode - * Maximum Transmit/Receive FIFO - * DC2: - * Extended programmable outputs unused - * Normal HOLD request - * Packet compress output unused - * No reject on CAM match - */ -#define SONIC_DCR \ - (DCR_DW32 | DCR_WAIT0 | DCR_PO0 | DCR_PO1 | DCR_RFT4 | DCR_TFT8) -#ifndef SONIC_DCR -# define SONIC_DCR (DCR_DW32 | DCR_TFT28) -#endif -#ifndef SONIC_DC2 -# define SONIC_DC2 (0) -#endif - -/* - * Default sizes of transmit and receive descriptor areas - */ -#define RDA_COUNT 20 -#define TDA_COUNT 100 - -/* - * - * As suggested by National Application Note 746, make the - * receive resource area bigger than the receive descriptor area. - */ -#define RRA_EXTRA_COUNT 0 - -/* - * RTEMS event used by interrupt handler to signal daemons. - */ -#define INTERRUPT_EVENT RTEMS_EVENT_1 - -/* - * RTEMS event used to start transmit daemon. - * This must not be the same as INTERRUPT_EVENT. - */ -#define START_TRANSMIT_EVENT RTEMS_EVENT_2 - -/* - * Largest Ethernet frame. - */ -#define MAXIMUM_FRAME_SIZE 1518 - -/* - * Receive buffer size. - * Allow for a pointer, plus a full ethernet frame (including Frame - * Check Sequence) rounded up to a 4-byte boundary. - */ -#define RBUF_SIZE ((sizeof (void *) + (MAXIMUM_FRAME_SIZE) + 3) & ~3) -#define RBUF_WC ((((MAXIMUM_FRAME_SIZE) + 3) & ~3) / 2) - -/* - * Macros for manipulating 32-bit pointers as 16-bit fragments - */ -#define LSW(p) ((rtems_unsigned16)((rtems_unsigned32)(p))) -#define MSW(p) ((rtems_unsigned16)((rtems_unsigned32)(p) >> 16)) -#define PTR(m,l) ((void*)(((rtems_unsigned16)(m)<<16)|(rtems_unsigned16)(l))) - -/* - * Hardware-specific storage - */ -struct sonic_softc { - /* - * Connection to networking code - * This entry *must* be the first in the sonic_softc structure. - */ - struct arpcom arpcom; - - /* - * Default location of device registers - * ===CACHE=== - * This area must be non-cacheable, guarded. - */ - void *sonic; - - /* - * Interrupt vector - */ - rtems_vector_number vector; - - /* - * Indicates configuration - */ - int acceptBroadcast; - - /* - * Task waiting for interrupts - */ - rtems_id rxDaemonTid; - rtems_id txDaemonTid; - - /* - * Receive resource area - */ - int rdaCount; - ReceiveResourcePointer_t rsa; - ReceiveResourcePointer_t rea; - CamDescriptorPointer_t cdp; - ReceiveDescriptorPointer_t rda; - ReceiveDescriptorPointer_t rdp_last; - - /* - * Transmit descriptors - */ - int tdaCount; - TransmitDescriptorPointer_t tdaHead; /* Last filled */ - TransmitDescriptorPointer_t tdaTail; /* Next to retire */ - int tdaActiveCount; - - /* - * Statistics - */ - unsigned long Interrupts; - unsigned long rxInterrupts; - unsigned long rxMissed; - unsigned long rxGiant; - unsigned long rxNonOctet; - unsigned long rxBadCRC; - unsigned long rxCollision; - - unsigned long txInterrupts; - unsigned long txSingleCollision; - unsigned long txMultipleCollision; - unsigned long txCollision; - unsigned long txDeferred; - unsigned long txUnderrun; - unsigned long txLateCollision; - unsigned long txExcessiveCollision; - unsigned long txExcessiveDeferral; - unsigned long txLostCarrier; - unsigned long txRawWait; -}; -SONIC_STATIC struct sonic_softc sonic_softc[NSONIC]; - -/* - ****************************************************************** - * * - * Support Routines * - * * - ****************************************************************** - */ - -void sonic_write_register( - void *base, - unsigned32 regno, - unsigned32 value -); - -unsigned32 sonic_read_register( - void *base, - unsigned32 regno -); - -void sonic_enable_interrupts( - void *rp, - unsigned32 mask -) -{ - rtems_interrupt_level level; - - rtems_interrupt_disable( level ); - sonic_write_register( - rp, - SONIC_REG_IMR, - sonic_read_register(rp, SONIC_REG_IMR) | mask - ); - rtems_interrupt_enable( level ); -} - -/* - * Allocate non-cacheable memory on a single 64k page. - * Very simple minded -- just keeps trying till the memory is on a single page. - */ -SONIC_STATIC void * sonic_allocate(unsigned int nbytes) -{ - void *p; - unsigned long a1, a2; - - for (;;) { - /* - * ===CACHE=== - * Change malloc to malloc_noncacheable_guarded. - */ - p = malloc( nbytes, M_MBUF, M_NOWAIT ); - memset (p, '\0', nbytes); - if (p == NULL) - rtems_panic ("No memory!"); - a1 = (unsigned long)p; - a2 = a1 + nbytes - 1; - if ((a1 >> 16) == (a2 >> 16)) - break; - } -#if (SONIC_DEBUG & SONIC_DEBUG_MEMORY_ALLOCATE) - printf( "sonic_allocate %d bytes at %p\n", nbytes, p ); -#endif - return p; -} - -/* - * Shut down the interface. - */ - -SONIC_STATIC void sonic_stop (struct sonic_softc *sc) -{ - void *rp = sc->sonic; - struct ifnet *ifp = &sc->arpcom.ac_if; - - ifp->if_flags &= ~IFF_RUNNING; - - /* - * Stop the transmitter and receiver. - */ - sonic_write_register( rp, SONIC_REG_CR, CR_HTX | CR_RXDIS ); -} - -/* - * Show interface statistics - */ -SONIC_STATIC void sonic_stats (struct sonic_softc *sc) -{ - printf (" Total Interrupts:%-8lu", sc->Interrupts); - printf (" Rx Interrupts:%-8lu", sc->rxInterrupts); - printf (" Giant:%-8lu", sc->rxGiant); - printf (" Non-octet:%-8lu\n", sc->rxNonOctet); - printf (" Bad CRC:%-8lu", sc->rxBadCRC); - printf (" Collision:%-8lu", sc->rxCollision); - printf (" Missed:%-8lu\n", sc->rxMissed); - - printf ( " Tx Interrupts:%-8lu", sc->txInterrupts); - printf ( " Deferred:%-8lu", sc->txDeferred); - printf (" Lost Carrier:%-8lu\n", sc->txLostCarrier); - printf ( "Single Collisions:%-8lu", sc->txSingleCollision); - printf ( "Multiple Collisions:%-8lu", sc->txMultipleCollision); - printf ("Excessive Collisions:%-8lu\n", sc->txExcessiveCollision); - printf ( " Total Collisions:%-8lu", sc->txCollision); - printf ( " Late Collision:%-8lu", sc->txLateCollision); - printf (" Underrun:%-8lu\n", sc->txUnderrun); - printf ( " Raw output wait:%-8lu\n", sc->txRawWait); -} - -/* - ****************************************************************** - * * - * Interrupt Handler * - * * - ****************************************************************** - */ - -SONIC_STATIC rtems_isr sonic_interrupt_handler (rtems_vector_number v) -{ - struct sonic_softc *sc = sonic_softc; - void *rp; - -#if (NSONIC > 1) - /* - * Find the device which requires service - */ - for (;;) { - if (sc->vector == v) - break; - if (++sc == &sonic[NSONIC]) - return; /* Spurious interrupt? */ - } -#endif /* NSONIC > 1 */ - - /* - * Get pointer to SONIC registers - */ - rp = sc->sonic; - - sc->Interrupts++; - - /* - * Packet received or receive buffer area exceeded? - */ - if ((sonic_read_register( rp, SONIC_REG_IMR ) & (IMR_PRXEN | IMR_RBAEEN)) && - (sonic_read_register( rp, SONIC_REG_ISR ) & (ISR_PKTRX | ISR_RBAE))) { - sonic_write_register( - rp, - SONIC_REG_IMR, - sonic_read_register( rp, SONIC_REG_IMR) & ~(IMR_PRXEN | IMR_RBAEEN) - ); - sc->rxInterrupts++; - rtems_event_send (sc->rxDaemonTid, INTERRUPT_EVENT); - } - - /* - * Packet started, transmitter done or transmitter error? - */ - if ((sonic_read_register( rp, SONIC_REG_IMR ) & (IMR_PINTEN | IMR_PTXEN | IMR_TXEREN)) - && (sonic_read_register( rp, SONIC_REG_ISR ) & (ISR_PINT | ISR_TXDN | ISR_TXER))) { - sonic_write_register( - rp, - SONIC_REG_IMR, - sonic_read_register( rp, SONIC_REG_IMR) & - ~(IMR_PINTEN | IMR_PTXEN | IMR_TXEREN) - ); - sc->txInterrupts++; - rtems_event_send (sc->txDaemonTid, INTERRUPT_EVENT); - } -} - -/* - ****************************************************************** - * * - * Transmitter Routines * - * * - ****************************************************************** - */ - -/* - * Soak up transmit descriptors that have been sent. - */ - -SONIC_STATIC void sonic_retire_tda (struct sonic_softc *sc) -{ - rtems_unsigned16 status; - unsigned int collisions; - struct mbuf *m, *n; - - /* - * Repeat for all completed transmit descriptors. - */ - while ((sc->tdaActiveCount != 0) - && ((status = sc->tdaTail->status) != 0)) { - -#if (SONIC_DEBUG & SONIC_DEBUG_DESCRIPTORS) - printf( "retire TDA %p (0x%04x)\n", sc->tdaTail, status ); -#endif - -#if (SONIC_DEBUG & SONIC_DEBUG_ERRORS) - if ( status != 0x0001 ) - printf( "ERROR: retire TDA %p (0x%04x)\n", sc->tdaTail, status ); -#endif - - /* - * Check for errors which stop the transmitter. - */ - if (status & (TDA_STATUS_EXD | - TDA_STATUS_EXC | - TDA_STATUS_FU | - TDA_STATUS_BCM)) { - /* - * Restart the transmitter if there are - * packets waiting to go. - */ - rtems_unsigned16 link; - link = *(sc->tdaTail->linkp); - - if ((link & TDA_LINK_EOL) == 0) { - void *rp = sc->sonic; - - sonic_write_register( rp, SONIC_REG_CTDA, link ); - sonic_write_register( rp, SONIC_REG_CR, CR_TXP ); - } - } - - /* - * Update network statistics - */ - collisions = (status & TDA_STATUS_COLLISION_MASK) >> TDA_STATUS_COLLISION_SHIFT; - if (collisions) { - if (collisions == 1) - sc->txSingleCollision++; - else - sc->txMultipleCollision++; - sc->txCollision += collisions; - } - if (status & TDA_STATUS_EXC) - sc->txExcessiveCollision++; - if (status & TDA_STATUS_OWC) - sc->txLateCollision++; - if (status & TDA_STATUS_EXD) - sc->txExcessiveDeferral++; - if (status & TDA_STATUS_DEF) - sc->txDeferred++; - if (status & TDA_STATUS_FU) - sc->txUnderrun++; - if (status & TDA_STATUS_CRSL) - sc->txLostCarrier++; - - /* - * Free the packet and reset a couple of fields - */ - sc->tdaActiveCount--; - m = (struct mbuf *)&sc->tdaTail->mbufp; - MFREE(m, n); - - sc->tdaTail->frag[0].frag_link = LSW(sc->tdaTail->link_pad); - sc->tdaTail->frag_count = 0; - - /* - * Move to the next transmit descriptor - */ - sc->tdaTail = sc->tdaTail->next; -#if (SONIC_DEBUG & SONIC_DEBUG_DESCRIPTORS) - printf( "next TDA %p\n", sc->tdaTail ); -#endif - } -} - -/* - * Send packet - */ -SONIC_STATIC void sonic_sendpacket (struct ifnet *ifp, struct mbuf *m) -{ - struct sonic_softc *sc = ifp->if_softc; - void *rp = sc->sonic; - struct mbuf *l = NULL; - TransmitDescriptorPointer_t tdp; - volatile struct TransmitDescriptorFragLink *fp; - unsigned int packetSize; - int i; - static char padBuf[64]; - - /* - * Free up transmit descriptors. - */ - sonic_retire_tda (sc); - - /* - * Wait for transmit descriptor to become available. - */ - if (sc->tdaActiveCount == sc->tdaCount) { -#if (SONIC_DEBUG & SONIC_DEBUG_FRAGMENTS) - puts( "Wait for more TDAs" ); -#endif - /* - * Clear old events. - */ - sonic_write_register( rp, SONIC_REG_ISR, ISR_PINT | ISR_TXDN | ISR_TXER ); - - /* - * Wait for transmit descriptor to become available. - * Note that the transmit descriptors are checked - * *before* * entering the wait loop -- this catches - * the possibility that a transmit descriptor became - * available between the `if' the started this block, - * and the clearing of the interrupt status register. - */ - sonic_retire_tda (sc); - while (sc->tdaActiveCount == sc->tdaCount) { - rtems_event_set events; - /* - * Enable transmitter interrupts. - */ - sonic_enable_interrupts( rp, (IMR_PINTEN | IMR_PTXEN | IMR_TXEREN) ); - - /* - * Wait for interrupt - */ - rtems_bsdnet_event_receive (INTERRUPT_EVENT, - RTEMS_WAIT|RTEMS_EVENT_ANY, - RTEMS_NO_TIMEOUT, - &events); - sonic_write_register( rp, SONIC_REG_ISR, ISR_PINT | ISR_TXDN | ISR_TXER ); - sonic_retire_tda (sc); - } - } - - /* - * Fill in the transmit descriptor fragment descriptors. - * ===CACHE=== - * If data cache is operating in write-back mode, flush cached - * data to memory. - */ - tdp = sc->tdaHead->next; - tdp->mbufp = m; - packetSize = 0; - fp = tdp->frag; - for (i = 0 ; i < MAXIMUM_FRAGS_PER_DESCRIPTOR ; i++, fp++) { - /* - * Throw away empty mbufs - */ - if (m->m_len) { - void *p = mtod (m, void *); - fp->frag_lsw = LSW(p); - fp->frag_msw = MSW(p); - fp->frag_size = m->m_len; - packetSize += m->m_len; - l = m; - m = m->m_next; -#if (SONIC_DEBUG & SONIC_DEBUG_FRAGMENTS) - printf( "fp %p 0x%04x%04x %d\n", - fp, fp->frag_msw, fp->frag_lsw, fp->frag_size ); -#endif - } - else { - struct mbuf *n; - MFREE (m, n); - m = n; - if (l != NULL) - l->m_next = m; - } - /* - * Break out of the loop if this mbuf is the last in the frame. - */ - if (m == NULL) - break; - } - - /* - * Pad short packets. - */ - if ((packetSize < 64) && (i < MAXIMUM_FRAGS_PER_DESCRIPTOR)) { - int padSize = 64 - packetSize; - fp++; - fp->frag_lsw = LSW(padBuf); - fp->frag_msw = MSW(padBuf); - fp->frag_size = padSize; -#if (SONIC_DEBUG & SONIC_DEBUG_FRAGMENTS) - printf( "PAD fp %p 0x%04x%04x %d\n", - fp, fp->frag_msw, fp->frag_lsw, fp->frag_size ); -#endif - packetSize += padSize; - i++; - } - - /* - * Fill Transmit Descriptor - */ - tdp->pkt_size = packetSize; - tdp->frag_count = i + 1; - tdp->status = 0; - - /* - * Chain onto list and start transmission. - */ - - tdp->linkp = &(fp+1)->frag_link; - *tdp->linkp = LSW(tdp->next) | TDA_LINK_EOL; - if ( sc->tdaHead->frag_count ) - *sc->tdaHead->linkp &= ~TDA_LINK_EOL; - sc->tdaActiveCount++; - sc->tdaHead = tdp; - - sonic_enable_interrupts( rp, (IMR_PINTEN | IMR_PTXEN | IMR_TXEREN) ); - sonic_write_register( rp, SONIC_REG_CR, CR_TXP ); -} - -/* - * Driver transmit daemon - */ -SONIC_STATIC void sonic_txDaemon (void *arg) -{ - struct sonic_softc *sc = (struct sonic_softc *)arg; - struct ifnet *ifp = &sc->arpcom.ac_if; - struct mbuf *m; - rtems_event_set events; - - for (;;) { - /* - * Wait for packet - */ - rtems_bsdnet_event_receive ( - START_TRANSMIT_EVENT, - RTEMS_EVENT_ANY | RTEMS_WAIT, - RTEMS_NO_TIMEOUT, - &events - ); - - /* - * Send packets till queue is empty - */ - for (;;) { - /* - * Get the next mbuf chain to transmit. - */ - IF_DEQUEUE(&ifp->if_snd, m); - if (!m) - break; - sonic_sendpacket (ifp, m); - } - ifp->if_flags &= ~IFF_OACTIVE; - } -} - -/* - ****************************************************************** - * * - * Receiver Routines * - * * - ****************************************************************** - */ - -/* - * Wait for SONIC to hand over a Receive Descriptor. - */ - -SONIC_STATIC void sonic_rda_wait( - struct sonic_softc *sc, - ReceiveDescriptorPointer_t rdp -) -{ - int i; - void *rp = sc->sonic; - rtems_event_set events; - - /* - * Wait for Receive Descriptor. - * The order of the tests is very important. - * The RDA is checked after RBAE is detected. This ensures that - * the driver processes all RDA entries before reusing the RRA - * entry holding the giant packet. - * The event wait is done after the RDA and RBAE checks. This - * catches the possibility that a Receive Descriptor became ready - * between the call to this function and the clearing of the - * interrupt status register bit. - */ - for (;;) { - /* - * Has a giant packet arrived? - * The National DP83932C data sheet is very vague on what - * happens under this condition. The description of the - * Interrupt Status Register (Section 4.3.6) states, - * ``Reception is aborted and the SONIC fetches the next - * available resource descriptors in the RRA. The buffer - * space is not re-used and an RDA is not setup for the - * truncated packet.'' - * I take ``Reception is aborted'' to mean that the RXEN - * bit in the Command Register is cleared and must be set - * by the driver to begin reception again. - * Unfortunately, an alternative interpretation could be - * that only reception of the current packet is aborted. - * This would be more difficult to recover from.... - */ - if (sonic_read_register( rp, SONIC_REG_ISR ) & ISR_RBAE) { - -#if (SONIC_DEBUG & SONIC_DEBUG_ERRORS) - printf( "ERROR: looks like a giant packet -- RBAE\n" ); -#endif - - /* - * One more check to soak up any Receive Descriptors - * that may already have been handed back to the driver. - */ - if (rdp->in_use == RDA_IN_USE) { -#if (SONIC_DEBUG & SONIC_DEBUG_ERRORS) - printf( "ERROR: nope just an RBAE\n" ); -#endif - break; - } - - /* - * Check my interpretation of the SONIC manual. - */ - if (sonic_read_register( rp, SONIC_REG_CR ) & CR_RXEN) - rtems_panic ("SONIC RBAE/RXEN"); - - /* - * Update statistics - */ - sc->rxGiant++; - - /* - * Reuse receive buffer. - * Again, the manual is subject to interpretation. The - * RRP register is described as, `the lower address of - * the next descriptor the SONIC will read.'' - * Since, acording to the ISR/RBAE notes, the SONIC has - * ``fetched the next available resource descriptor in - * the RRA'', I interpret this to mean that that the - * driver has to move the RRP back *two* entries to - * reuse the receive buffer holding the giant packet. - */ - for (i = 0 ; i < 2 ; i++) { - if (sonic_read_register( rp, SONIC_REG_RRP ) == - sonic_read_register( rp, SONIC_REG_RSA )) - sonic_write_register( - rp, - SONIC_REG_RRP, - sonic_read_register( rp, SONIC_REG_REA ) - ); - sonic_write_register( - rp, - SONIC_REG_RRP, - sonic_read_register(rp, SONIC_REG_RRP) - sizeof(ReceiveResource_t) - ); - } - - /* - * Restart reception - */ - sonic_write_register( rp, SONIC_REG_ISR, ISR_RBAE ); - sonic_write_register( rp, SONIC_REG_CR, CR_RXEN ); - } - - /* - * Clear old packet-received events. - */ - sonic_write_register( rp, SONIC_REG_ISR, ISR_PKTRX ); - - /* - * Has Receive Descriptor become available? - */ - if (rdp->in_use == RDA_IN_USE) - break; - - /* - * Enable interrupts. - */ - sonic_enable_interrupts( rp, (IMR_PRXEN | IMR_RBAEEN) ); - - /* - * Wait for interrupt. - */ - rtems_bsdnet_event_receive( - INTERRUPT_EVENT, - RTEMS_WAIT|RTEMS_EVENT_ANY, - RTEMS_NO_TIMEOUT, - &events - ); - } -#if (SONIC_DEBUG & SONIC_DEBUG_DESCRIPTORS) - printf( "RDA %p\n", rdp ); -#endif - -#if (SONIC_DEBUG & SONIC_DEBUG_ERRORS) - if (rdp->status & 0x000E) - printf( "ERROR: RDA %p (0x%04x)\n", rdp, rdp->status ); -#endif - -} - -/* - * SONIC reader task - */ -SONIC_STATIC void sonic_rxDaemon (void *arg) -{ - struct sonic_softc *sc = (struct sonic_softc *)arg; - struct ifnet *ifp = &sc->arpcom.ac_if; - void *rp = sc->sonic; - struct mbuf *m; - rtems_unsigned16 status; - ReceiveDescriptorPointer_t rdp; - ReceiveResourcePointer_t rwp, rea; - rtems_unsigned16 newMissedTally, oldMissedTally; - - rwp = sc->rsa; - rea = sc->rea; - rdp = sc->rda; - - /* - * Start the receiver - */ - oldMissedTally = sonic_read_register( rp, SONIC_REG_MPT ); - sonic_write_register( rp, SONIC_REG_CR, CR_RRRA ); - sonic_write_register( rp, SONIC_REG_CR, CR_RXEN ); - - /* - * Input packet handling loop - */ - for (;;) { - /* - * Wait till SONIC supplies a Receive Descriptor. - */ - if (rdp->in_use == RDA_FREE) { - sonic_rda_wait (sc, rdp); - } - -#if (SONIC_DEBUG & SONIC_DEBUG_DESCRIPTORS) - printf( "Incoming packet %p status=0x%04x\n", rdp, rdp->status ); -#endif - - /* - * Check that packet is valid - */ - status = rdp->status; - if (status & RDA_STATUS_PRX) { - struct mbuf **mp; - struct ether_header *eh; - void *p; - - /* - * Get the mbuf pointer - */ - p = PTR(rdp->pkt_msw, rdp->pkt_lsw); - mp = (struct mbuf **)p - 1; - m = *mp; - - /* - * Pass the packet up the chain. - * The mbuf count is reduced to remove - * the frame check sequence at the end - * of the packet. - * ===CACHE=== - * Invalidate cache entries for this memory. - */ - m->m_len = m->m_pkthdr.len = rdp->byte_count - - sizeof(rtems_unsigned32) - - sizeof(struct ether_header); - eh = mtod (m, struct ether_header *); - m->m_data += sizeof(struct ether_header); - ether_input (ifp, eh, m); - - /* - * Sanity check that Receive Resource Area is - * still in sync with Receive Descriptor Area - * The buffer reported in the Receive Descriptor - * should be the same as the buffer in the Receive - * Resource we are about to reuse. - */ -/* XXX figure out whether this is valid or not */ -#if 0 - if ((LSW(p) != rwp->buff_ptr_lsw) - || (MSW(p) != rwp->buff_ptr_msw)) - rtems_panic ("SONIC RDA/RRA"); -#endif - - /* - * Allocate a new mbuf. - */ - MGETHDR (m, M_WAIT, MT_DATA); - MCLGET (m, M_WAIT); - m->m_pkthdr.rcvif = ifp; - mp = mtod (m, struct mbuf **); - m->m_data += sizeof *mp; - *mp = m; - p = mtod (m, void *); - - /* - * Reuse Receive Resource. - */ - rwp->buff_ptr_lsw = LSW(p); - rwp->buff_ptr_msw = MSW(p); - rwp++; - if (rwp == rea) { -#if (SONIC_DEBUG & SONIC_DEBUG_MEMORY) - printf( "Wrapping RWP from %p to %p\n", rwp, sc->rsa ); -#endif - rwp = sc->rsa; - } - sonic_write_register( rp, SONIC_REG_RWP , LSW(rwp) ); - - /* - * Tell the SONIC to reread the RRA. - */ - if (sonic_read_register( rp, SONIC_REG_ISR ) & ISR_RBE) - sonic_write_register( rp, SONIC_REG_ISR, ISR_RBE ); - } - else { - if (status & RDA_STATUS_COL) - sc->rxCollision++; - if (status & RDA_STATUS_FAER) - sc->rxNonOctet++; - else if (status & RDA_STATUS_CRCR) - sc->rxBadCRC++; - } - - /* - * Count missed packets - */ - newMissedTally = sonic_read_register( rp, SONIC_REG_MPT ); - if (newMissedTally != oldMissedTally) { - sc->rxMissed += (newMissedTally - oldMissedTally) & 0xFFFF; - newMissedTally = oldMissedTally; - } - - /* - * Move to next receive descriptor - */ - rdp->in_use = RDA_FREE; - rdp = rdp->next; - rdp->link &= ~RDA_LINK_EOL; - } -} - -/* - ****************************************************************** - * * - * Initialization Routines * - * * - ****************************************************************** - */ - -/* - * Initialize the SONIC hardware - */ -SONIC_STATIC void sonic_initialize_hardware(struct sonic_softc *sc) -{ - void *rp = sc->sonic; - int i; - unsigned char *hwaddr; - rtems_isr_entry old_handler; - TransmitDescriptorPointer_t tdp; - ReceiveDescriptorPointer_t ordp, rdp; - ReceiveResourcePointer_t rwp; - struct mbuf *m; - void *p; - CamDescriptorPointer_t cdp; - - /* - * The Revision B SONIC has a horrible bug known as the "Zero - * Length Packet bug". The initial board used to develop this - * driver had a newer revision of the SONIC so there was no reason - * to check for this. If you have the Revision B SONIC chip, then - * you need to add some code to the RX path to handle this weirdness. - */ - - if ( sonic_read_register( rp, SONIC_REG_SR ) < SONIC_REVISION_C ) { - rtems_fatal_error_occurred( 0x0BADF00D ); /* don't eat this part :) */ - } - - /* - * Set up circular linked list in Transmit Descriptor Area. - * Use the PINT bit in the transmit configuration field to - * request an interrupt on every other transmitted packet. - * - * NOTE: sonic_allocate() zeroes all of the memory allocated. - */ - - sc->tdaActiveCount = 0; - sc->tdaTail = sonic_allocate(sc->tdaCount * sizeof *tdp); -#if (SONIC_DEBUG & SONIC_DEBUG_MEMORY) - printf( "tdaTail = %p\n", sc->tdaTail ); -#endif - tdp = sc->tdaTail; - for (i = 0 ; i < sc->tdaCount ; i++) { - /* - * status, pkt_config, pkt_size, and all fragment fields - * are set to zero by sonic_allocate. - */ - -/* XXX not used by the BSD drivers - if (i & 1) - tdp->pkt_config = TDA_CONFIG_PINT; -*/ - - tdp->frag_count = 0; - tdp->frag[0].frag_link = LSW(tdp + 1); - tdp->link_pad = LSW(tdp + 1) | TDA_LINK_EOL; - tdp->linkp = &((tdp + 1)->frag[0].frag_link); - tdp->next = (TransmitDescriptor_t *)(tdp + 1); - tdp++; - } - tdp--; - sc->tdaHead = tdp; - tdp->link_pad = LSW(sc->tdaTail) | TDA_LINK_EOL; - tdp->next = (TransmitDescriptor_t *)sc->tdaTail; - tdp->linkp = &sc->tdaTail->frag[0].frag_link; - - /* - * Set up circular linked list in Receive Descriptor Area. - * Leaves sc->rda pointing at the `beginning' of the list. - * - * NOTE: The RDA and CDP must have the same MSW for their addresses. - */ - - sc->rda = sonic_allocate( - (sc->rdaCount * sizeof(ReceiveDescriptor_t)) + - sizeof(CamDescriptor_t) ); - sc->cdp = (CamDescriptorPointer_t) ((unsigned char *)sc->rda + - (sc->rdaCount * sizeof(ReceiveDescriptor_t))); -#if (SONIC_DEBUG & SONIC_DEBUG_MEMORY) - printf( "rda area = %p\n", sc->rda ); - printf( "cdp area = %p\n", sc->cdp ); -#endif - - ordp = rdp = sc->rda; - for (i = 0 ; i < sc->rdaCount ; i++) { - /* - * status, byte_count, pkt_ptr0, pkt_ptr1, and seq_no are set - * to zero by sonic_allocate. - */ - rdp->link = LSW(rdp + 1); - rdp->in_use = RDA_FREE; - rdp->next = (ReceiveDescriptor_t *)(rdp + 1); - ordp = rdp; - rdp++; - } - /* - * Link the last desriptor to the 1st one and mark it as the end - * of the list. - */ - ordp->next = sc->rda; - ordp->link = LSW(sc->rda) | RDA_LINK_EOL; - sc->rdp_last = rdp; - - /* - * Allocate the receive resource area. - * In accordance with National Application Note 746, make the - * receive resource area bigger than the receive descriptor area. - * This has the useful side effect of making the receive resource - * area big enough to hold the CAM descriptor area. - */ - - sc->rsa = sonic_allocate((sc->rdaCount + RRA_EXTRA_COUNT) * sizeof *sc->rsa); -#if (SONIC_DEBUG & SONIC_DEBUG_MEMORY) - printf( "rsa area = %p\n", sc->rsa ); -#endif - - /* - * Set up list in Receive Resource Area. - * Allocate space for incoming packets. - */ - - rwp = sc->rsa; - for (i = 0 ; i < (sc->rdaCount + RRA_EXTRA_COUNT) ; i++, rwp++) { - struct mbuf **mp; - - /* - * Allocate memory for buffer. - * Place a pointer to the mbuf at the beginning of the buffer - * so we can find the mbuf when the SONIC returns the buffer - * to the driver. - */ - - MGETHDR (m, M_WAIT, MT_DATA); - MCLGET (m, M_WAIT); - m->m_pkthdr.rcvif = &sc->arpcom.ac_if; - mp = mtod (m, struct mbuf **); - - m->m_data += sizeof *mp; - *mp = m; - p = mtod (m, void *); - - /* - * Set up RRA entry - */ - rwp->buff_ptr_lsw = LSW(p); - rwp->buff_ptr_msw = MSW(p); - rwp->buff_wc_lsw = RBUF_WC; - rwp->buff_wc_msw = 0; - } - sc->rea = rwp; -#if (SONIC_DEBUG & SONIC_DEBUG_MEMORY) - printf( "rea area = %p\n", sc->rea ); -#endif - - - /* - * Issue a software reset. - */ - sonic_write_register( rp, SONIC_REG_CR, CR_RST | CR_STP | CR_RXDIS | CR_HTX ); - - /* - * Set up data configuration registers. - */ - sonic_write_register( rp, SONIC_REG_DCR, SONIC_DCR ); - sonic_write_register( rp, SONIC_REG_DCR2, SONIC_DC2 ); - - sonic_write_register( rp, SONIC_REG_CR, CR_STP | CR_RXDIS | CR_HTX ); - - /* - * Mask all interrupts - */ - sonic_write_register( rp, SONIC_REG_IMR, 0x3fff ); - - /* - * Clear outstanding interrupts. - */ - sonic_write_register( rp, SONIC_REG_ISR, 0x7FFF ); - - /* - * Clear the tally counters - */ - - sonic_write_register( rp, SONIC_REG_CRCT, 0xFFFF ); - sonic_write_register( rp, SONIC_REG_FAET, 0xFFFF ); - sonic_write_register( rp, SONIC_REG_MPT, 0xFFFF ); - sonic_write_register( rp, SONIC_REG_RSC, 0 ); - - /* - * Set the Receiver mode - * - * Enable/disable reception of broadcast packets - */ - - if (sc->acceptBroadcast) - sonic_write_register( rp, SONIC_REG_RCR, RCR_BRD ); - else - sonic_write_register( rp, SONIC_REG_RCR, 0 ); - - /* - * Set up Resource Area pointers - */ - - sonic_write_register( rp, SONIC_REG_URRA, MSW(sc->rsa) ); - sonic_write_register( rp, SONIC_REG_RSA, LSW(sc->rsa) ); - - sonic_write_register( rp, SONIC_REG_REA, LSW(sc->rea) ); - - sonic_write_register( rp, SONIC_REG_RRP, LSW(sc->rsa) ); - sonic_write_register( rp, SONIC_REG_RWP, LSW(sc->rsa) ); /* XXX was rea */ - - sonic_write_register( rp, SONIC_REG_URDA, MSW(sc->rda) ); - sonic_write_register( rp, SONIC_REG_CRDA, LSW(sc->rda) ); - - sonic_write_register( rp, SONIC_REG_UTDA, MSW(sc->tdaTail) ); - sonic_write_register( rp, SONIC_REG_CTDA, LSW(sc->tdaTail) ); - - /* - * Set End Of Buffer Count register to the value recommended - * in Note 1 of Section 3.4.4.4 of the SONIC data sheet. - */ - - sonic_write_register( rp, SONIC_REG_EOBC, RBUF_WC - 2 ); - - /* - * Issue the load RRA command - */ - - sonic_write_register( rp, SONIC_REG_CR, CR_RRRA ); - while (sonic_read_register( rp, SONIC_REG_CR ) & CR_RRRA) - continue; - - /* - * Remove device reset - */ - - sonic_write_register( rp, SONIC_REG_CR, 0 ); - - /* - * Set up the SONIC CAM with our hardware address. - */ - - hwaddr = sc->arpcom.ac_enaddr; - cdp = sc->cdp; - -#if (SONIC_DEBUG & SONIC_DEBUG_CAM) - printf( "hwaddr: %2x:%2x:%2x:%2x:%2x:%2x\n", - hwaddr[0], hwaddr[1], hwaddr[2], hwaddr[3], hwaddr[4], hwaddr[5] ); -#endif - - cdp->cep = 0; /* Fill first and only entry in CAM */ - cdp->cap0 = hwaddr[1] << 8 | hwaddr[0]; - cdp->cap1 = hwaddr[3] << 8 | hwaddr[2]; - cdp->cap2 = hwaddr[5] << 8 | hwaddr[4]; - cdp->ce = 0x0001; /* Enable first entry in CAM */ - - sonic_write_register( rp, SONIC_REG_CDC, 1 ); /* 1 entry in CDA */ - sonic_write_register( rp, SONIC_REG_CDP, LSW(cdp) ); - sonic_write_register( rp, SONIC_REG_CR, CR_LCAM ); /* Load the CAM */ - - while (sonic_read_register( rp, SONIC_REG_CR ) & CR_LCAM) - continue; - - /* - * Verify that CAM was properly loaded. - */ - - sonic_write_register( rp, SONIC_REG_CR, CR_RST | CR_STP | CR_RXDIS | CR_HTX ); - -#if (SONIC_DEBUG & SONIC_DEBUG_CAM) - sonic_write_register( rp, SONIC_REG_CEP, 0 ); /* Select first entry in CAM */ - printf ("Loaded Ethernet address into SONIC CAM.\n" - " Wrote %04x%04x%04x - %#x\n" - " Read %04x%04x%04x - %#x\n", - cdp->cap2, cdp->cap1, cdp->cap0, cdp->ce, - sonic_read_register( rp, SONIC_REG_CAP2 ), - sonic_read_register( rp, SONIC_REG_CAP1 ), - sonic_read_register( rp, SONIC_REG_CAP0 ), - sonic_read_register( rp, SONIC_REG_CE )); -#endif - - sonic_write_register( rp, SONIC_REG_CEP, 0 ); /* Select first entry in CAM */ - if ((sonic_read_register( rp, SONIC_REG_CAP2 ) != cdp->cap2) - || (sonic_read_register( rp, SONIC_REG_CAP1 ) != cdp->cap1) - || (sonic_read_register( rp, SONIC_REG_CAP0 ) != cdp->cap0) - || (sonic_read_register( rp, SONIC_REG_CE ) != cdp->ce)) { - printf ("Failed to load Ethernet address into SONIC CAM.\n" - " Wrote %04x%04x%04x - %#x\n" - " Read %04x%04x%04x - %#x\n", - cdp->cap2, cdp->cap1, cdp->cap0, cdp->ce, - sonic_read_register( rp, SONIC_REG_CAP2 ), - sonic_read_register( rp, SONIC_REG_CAP1 ), - sonic_read_register( rp, SONIC_REG_CAP0 ), - sonic_read_register( rp, SONIC_REG_CE )); - rtems_panic ("SONIC LCAM"); - } - - sonic_write_register(rp, SONIC_REG_CR, CR_TXP | CR_RXEN | CR_STP); - - /* - * Attach SONIC interrupt handler - */ - sonic_write_register( rp, SONIC_REG_IMR, 0 ); - old_handler = set_vector(sonic_interrupt_handler, sc->vector, 0); - - /* - * Remainder of hardware initialization is - * done by the receive and transmit daemons. - */ -} - -/* - * Send packet (caller provides header). - */ - -SONIC_STATIC void sonic_start(struct ifnet *ifp) -{ - struct sonic_softc *sc = ifp->if_softc; - - rtems_event_send(sc->txDaemonTid, START_TRANSMIT_EVENT); - ifp->if_flags |= IFF_OACTIVE; -} - -/* - * Initialize and start the device - */ - -SONIC_STATIC void sonic_init (void *arg) -{ - struct sonic_softc *sc = arg; - struct ifnet *ifp = &sc->arpcom.ac_if; - void *rp = sc->sonic; - int rcr; - - if (sc->txDaemonTid == 0) { - - /* - * Set up SONIC hardware - */ - sonic_initialize_hardware (sc); - - /* - * Start driver tasks - */ - sc->txDaemonTid = rtems_bsdnet_newproc ("SNtx", 4096, sonic_txDaemon, sc); - sc->rxDaemonTid = rtems_bsdnet_newproc ("SNrx", 4096, sonic_rxDaemon, sc); - } - - /* - * Set flags appropriately - */ - rcr = sonic_read_register( rp, SONIC_REG_RCR ); - if (ifp->if_flags & IFF_PROMISC) - rcr |= RCR_PRO; - else - rcr &= ~RCR_PRO; - sonic_write_register( rp, SONIC_REG_RCR, rcr); - - /* - * Tell the world that we're running. - */ - ifp->if_flags |= IFF_RUNNING; - - /* - * Enable receiver and transmitter - */ - sonic_write_register(rp, SONIC_REG_CR, CR_TXP | CR_RXEN); -} - -/* - * Driver ioctl handler - */ -static int -sonic_ioctl (struct ifnet *ifp, int command, caddr_t data) -{ - struct sonic_softc *sc = ifp->if_softc; - int error = 0; - - switch (command) { - case SIOCGIFADDR: - case SIOCSIFADDR: - ether_ioctl (ifp, command, data); - break; - - case SIOCSIFFLAGS: - switch (ifp->if_flags & (IFF_UP | IFF_RUNNING)) { - case IFF_RUNNING: - sonic_stop (sc); - break; - - case IFF_UP: - sonic_init (sc); - break; - - case IFF_UP | IFF_RUNNING: - sonic_stop (sc); - sonic_init (sc); - break; - - default: - break; - } - break; - - case SIO_RTEMS_SHOW_STATS: - sonic_stats (sc); - break; - - /* - * FIXME: All sorts of multicast commands need to be added here! - */ - default: - error = EINVAL; - break; - } - return error; -} - -/* - * Attach an SONIC driver to the system - * This is the only `extern' function in the driver. - */ -int -rtems_sonic_driver_attach (struct rtems_bsdnet_ifconfig *config) -{ - struct sonic_softc *sc; - struct ifnet *ifp; - int mtu; - int i; - - /* - * Find an unused entry - */ - i = 0; - sc = sonic_softc; - for (;;) { - if (sc == &sonic_softc[NSONIC]) { - printf ("No more SONIC devices.\n"); - return 0; - } - ifp = &sc->arpcom.ac_if; - if (ifp->if_softc == NULL) - break; - sc++; - i++; - } - - /* - * zero out the control structure - */ - - memset( sc, 0, sizeof(*sc) ); - - - /* - * Process options - */ - if (config->hardware_address) { - memcpy (sc->arpcom.ac_enaddr, config->hardware_address, ETHER_ADDR_LEN); - } - else { - memset (sc->arpcom.ac_enaddr, 0x08, ETHER_ADDR_LEN); - } - if (config->mtu) - mtu = config->mtu; - else - mtu = ETHERMTU; - if (config->rbuf_count) - sc->rdaCount = config->rbuf_count; - else - sc->rdaCount = RDA_COUNT; - if (config->xbuf_count) - sc->tdaCount = config->xbuf_count; - else - sc->tdaCount = TDA_COUNT; - sc->acceptBroadcast = !config->ignore_broadcast; - - /* - * Set up network interface values - */ - ifp->if_softc = sc; - ifp->if_unit = i + 1; - ifp->if_name = "sonic"; - ifp->if_mtu = mtu; - ifp->if_init = sonic_init; - ifp->if_ioctl = sonic_ioctl; - ifp->if_start = sonic_start; - ifp->if_output = ether_output; - ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX; - if (ifp->if_snd.ifq_maxlen == 0) - ifp->if_snd.ifq_maxlen = ifqmaxlen; - - /* - * Attach the interface - */ - if_attach (ifp); - ether_ifattach (ifp); - return 1; -} - -#if (SONIC_DEBUG & SONIC_DEBUG_PRINT_REGISTERS) -#include <stdio.h> - -char SONIC_Reg_name[64][6]= { - "CR", /* 0x00 */ - "DCR", /* 0x01 */ - "RCR", /* 0x02 */ - "TCR", /* 0x03 */ - "IMR", /* 0x04 */ - "ISR", /* 0x05 */ - "UTDA", /* 0x06 */ - "CTDA", /* 0x07 */ - "0x08", /* 0x08 */ - "0x09", /* 0x09 */ - "0x0A", /* 0x0A */ - "0x0B", /* 0x0B */ - "0x0C", /* 0x0C */ - "URDA", /* 0x0D */ - "CRDA", /* 0x0E */ - "0x0F", /* 0x0F */ - "0x10", /* 0x10 */ - "0x11", /* 0x11 */ - "0x12", /* 0x12 */ - "EOBC", /* 0x13 */ - "URRA", /* 0x14 */ - "RSA", /* 0x15 */ - "REA", /* 0x16 */ - "RRP", /* 0x17 */ - "RWP", /* 0x18 */ - "0x19", /* 0x19 */ - "0x1A", /* 0x1A */ - "0x1B", /* 0x1B */ - "0x1C", /* 0x1C */ - "0x0D", /* 0x1D */ - "0x1E", /* 0x1E */ - "0x1F", /* 0x1F */ - "0x20", /* 0x20 */ - "CEP", /* 0x21 */ - "CAP2", /* 0x22 */ - "CAP1", /* 0x23 */ - "CAP0", /* 0x24 */ - "CE", /* 0x25 */ - "CDP", /* 0x26 */ - "CDC", /* 0x27 */ - "SR", /* 0x28 */ - "WT0", /* 0x29 */ - "WT1", /* 0x2A */ - "RSC", /* 0x2B */ - "CRCT", /* 0x2C */ - "FAET", /* 0x2D */ - "MPT", /* 0x2E */ - "MDT", /* 0x2F */ - "0x30", /* 0x30 */ - "0x31", /* 0x31 */ - "0x32", /* 0x32 */ - "0x33", /* 0x33 */ - "0x34", /* 0x34 */ - "0x35", /* 0x35 */ - "0x36", /* 0x36 */ - "0x37", /* 0x37 */ - "0x38", /* 0x38 */ - "0x39", /* 0x39 */ - "0x3A", /* 0x3A */ - "0x3B", /* 0x3B */ - "0x3C", /* 0x3C */ - "0x3D", /* 0x3D */ - "0x3E", /* 0x3E */ - "DCR2" /* 0x3F */ -}; -#endif -void sonic_write_register( - void *base, - unsigned32 regno, - unsigned32 value -) -{ - volatile unsigned32 *p = base; - -#if (SONIC_DEBUG & SONIC_DEBUG_PRINT_REGISTERS) - printf( "%p Write 0x%04x to %s (0x%02x)\n", - &p[regno], value, SONIC_Reg_name[regno], regno ); - fflush( stdout ); -#endif - p[regno] = value; -} - -unsigned32 sonic_read_register( - void *base, - unsigned32 regno -) -{ - volatile unsigned32 *p = base; - unsigned32 value; - - value = p[regno]; -#if (SONIC_DEBUG & SONIC_DEBUG_PRINT_REGISTERS) - printf( "%p Read 0x%04x from %s (0x%02x)\n", - &p[regno], value, SONIC_Reg_name[regno], regno ); - fflush( stdout ); -#endif - return value; -} diff --git a/c/src/lib/libbsp/powerpc/dmv177/sonic/sonic.h b/c/src/lib/libbsp/powerpc/dmv177/sonic/sonic.h deleted file mode 100644 index 64aa1718f1..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/sonic/sonic.h +++ /dev/null @@ -1,372 +0,0 @@ -/*
- *******************************************************************
- *******************************************************************
- ** **
- ** DECLARATIONS FOR NATIONAL DP83932 `SONIC' **
- ** SYSTEMS-ORIENTED NETWORK INTERFACE CONTROLLER **
- ** **
- *******************************************************************
- *******************************************************************
- */
-
-/*
- * $Revision$ $Date$ $Author$
- * $State$
- * $Id$
- */
-
-#ifndef _SONIC_DP83932_
-#define _SONIC_DP83932_
-
-#include <bsp.h>
-
-/*
- ******************************************************************
- * *
- * Device Registers *
- * *
- ******************************************************************
- */
-#define SONIC_REG_CR 0x00 /* Command */
-#define SONIC_REG_DCR 0x01 /* Data configuration */
-#define SONIC_REG_RCR 0x02 /* Receive control */
-#define SONIC_REG_TCR 0x03 /* Transmit control */
-#define SONIC_REG_IMR 0x04 /* Interrupt mask */
-#define SONIC_REG_ISR 0x05 /* Interrupt status */
-#define SONIC_REG_UTDA 0x06 /* Upper transmit descriptor address */
-#define SONIC_REG_CTDA 0x07 /* Current transmit descriptor address */
-#define SONIC_REG_URDA 0x0D /* Upper receive descriptor address */
-#define SONIC_REG_CRDA 0x0E /* Current receive descriptor address */
-#define SONIC_REG_EOBC 0x13 /* End of buffer word count */
-#define SONIC_REG_URRA 0x14 /* Upper receive resource */
-#define SONIC_REG_RSA 0x15 /* Resource start address */
-#define SONIC_REG_REA 0x16 /* Resource end address */
-#define SONIC_REG_RRP 0x17 /* Resouce read pointer */
-#define SONIC_REG_RWP 0x18 /* Resouce write pointer */
-#define SONIC_REG_CEP 0x21 /* CAM entry pointer */
-#define SONIC_REG_CAP2 0x22 /* CAM address port 2 */
-#define SONIC_REG_CAP1 0x23 /* CAM address port 1 */
-#define SONIC_REG_CAP0 0x24 /* CAM address port 0 */
-#define SONIC_REG_CE 0x25 /* CAM enable */
-#define SONIC_REG_CDP 0x26 /* CAM descriptor pointer */
-#define SONIC_REG_CDC 0x27 /* CAM descriptor count */
-#define SONIC_REG_SR 0x28 /* Silicon revision */
-#define SONIC_REG_WT0 0x29 /* Watchdog timer 0 */
-#define SONIC_REG_WT1 0x2A /* Watchdog timer 1 */
-#define SONIC_REG_RSC 0x2B /* Receive sequence counter */
-#define SONIC_REG_CRCT 0x2C /* CRC error tally */
-#define SONIC_REG_FAET 0x2D /* FAE tally */
-#define SONIC_REG_MPT 0x2E /* Missed packet tally */
-#define SONIC_REG_MDT 0x2F /* TX Maximum Deferral */
-#define SONIC_REG_DCR2 0x3F /* Data configuration 2 */
-
-/*
- * Command register
- */
-#define CR_LCAM 0x0200
-#define CR_RRRA 0x0100
-#define CR_RST 0x0080
-#define CR_ST 0x0020
-#define CR_STP 0x0010
-#define CR_RXEN 0x0008
-#define CR_RXDIS 0x0004
-#define CR_TXP 0x0002
-#define CR_HTX 0x0001
-
-/*
- * Data configuration register
- */
-#define DCR_EXBUS 0x8000
-#define DCR_LBR 0x2000
-#define DCR_PO1 0x1000
-#define DCR_PO0 0x0800
-#define DCR_SBUS 0x0400
-#define DCR_USR1 0x0200
-#define DCR_USR0 0x0100
-#define DCR_WC1 0x0080
-#define DCR_WC0 0x0040
-#define DCR_DW 0x0020
-#define DCR_BMS 0x0010
-#define DCR_RFT1 0x0008
-#define DCR_RFT0 0x0004
-#define DCR_TFT1 0x0002
-#define DCR_TFT0 0x0001
-
-/* data configuration register aliases */
-#define DCR_SYNC DCR_SBUS /* synchronous (memory cycle 2 clocks) */
-#define DCR_ASYNC 0 /* asynchronous (memory cycle 3 clocks) */
-
-#define DCR_WAIT0 0 /* 0 wait states added */
-#define DCR_WAIT1 DCR_WC0 /* 1 wait state added */
-#define DCR_WAIT2 DCR_WC1 /* 2 wait states added */
-#define DCR_WAIT3 (DCR_WC1|DCR_WC0) /* 3 wait states added */
-
-#define DCR_DW16 0 /* use 16-bit DMA accesses */
-#define DCR_DW32 DCR_DW /* use 32-bit DMA accesses */
-
-#define DCR_DMAEF 0 /* DMA until TX/RX FIFO has emptied/filled */
-#define DCR_DMABLOCK DCR_BMS /* DMA until RX/TX threshold crossed */
-
-#define DCR_RFT4 0 /* receive threshold 4 bytes */
-#define DCR_RFT8 DCR_RFT0 /* receive threshold 8 bytes */
-#define DCR_RFT16 DCR_RFT1 /* receive threshold 16 bytes */
-#define DCR_RFT24 (DCR_RFT1|DCR_RFT0) /* receive threshold 24 bytes */
-
-#define DCR_TFT8 0 /* transmit threshold 8 bytes */
-#define DCR_TFT16 DCR_TFT0 /* transmit threshold 16 bytes */
-#define DCR_TFT24 DCR_TFT1 /* transmit threshold 24 bytes */
-#define DCR_TFT28 (DCR_TFT1|DCR_TFT0) /* transmit threshold 28 bytes */
-
-/*
- * Receive control register
- */
-#define RCR_ERR 0x8000
-#define RCR_RNT 0x4000
-#define RCR_BRD 0x2000
-#define RCR_PRO 0x1000
-#define RCR_AMC 0x0800
-#define RCR_LB1 0x0400
-#define RCR_LB0 0x0200
-#define RCR_MC 0x0100
-#define RCR_BC 0x0080
-#define RCR_LPKT 0x0040
-#define RCR_CRS 0x0020
-#define RCR_COL 0x0010
-#define RCR_CRCR 0x0008
-#define RCR_FAER 0x0004
-#define RCR_LBK 0x0002
-#define RCR_PRX 0x0001
-
-/*
- * Transmit control register
- */
-#define TCR_PINT 0x8000
-#define TCR_POWC 0x4000
-#define TCR_CRCI 0x2000
-#define TCR_EXDIS 0x1000
-#define TCR_EXD 0x0400
-#define TCR_DEF 0x0200
-#define TCR_NCRS 0x0100
-#define TCR_CRSL 0x0080
-#define TCR_EXC 0x0040
-#define TCR_OWC 0x0020
-#define TCR_PMB 0x0008
-#define TCR_FU 0x0004
-#define TCR_BCM 0x0002
-#define TCR_PTX 0x0001
-
-/*
- * Interrupt mask register
- */
-#define IMR_BREN 0x4000
-#define IMR_HBLEN 0x2000
-#define IMR_LCDEN 0x1000
-#define IMR_PINTEN 0x0800
-#define IMR_PRXEN 0x0400
-#define IMR_PTXEN 0x0200
-#define IMR_TXEREN 0x0100
-#define IMR_TCEN 0x0080
-#define IMR_RDEEN 0x0040
-#define IMR_RBEEN 0x0020
-#define IMR_RBAEEN 0x0010
-#define IMR_CRCEN 0x0008
-#define IMR_FAEEN 0x0004
-#define IMR_MPEN 0x0002
-#define IMR_RFOEN 0x0001
-
-/*
- * Interrupt status register
- */
-#define ISR_BR 0x4000
-#define ISR_HBL 0x2000
-#define ISR_LCD 0x1000
-#define ISR_PINT 0x0800
-#define ISR_PKTRX 0x0400
-#define ISR_TXDN 0x0200
-#define ISR_TXER 0x0100
-#define ISR_TC 0x0080
-#define ISR_RDE 0x0040
-#define ISR_RBE 0x0020
-#define ISR_RBAE 0x0010
-#define ISR_CRC 0x0008
-#define ISR_FAE 0x0004
-#define ISR_MP 0x0002
-#define ISR_RFO 0x0001
-
-/*
- * Data configuration register 2
- */
-#define DCR2_EXPO3 0x8000
-#define DCR2_EXPO2 0x4000
-#define DCR2_EXPO1 0x2000
-#define DCR2_EXPO0 0x1000
-#define DCR2_PH 0x0010
-#define DCR2_PCM 0x0004
-#define DCR2_PCNM 0x0002
-#define DCR2_RJCM 0x0001
-
-/*
- * Known values for the Silicon Revision Register
- */
-
-#define SONIC_REVISION_B 4
-#define SONIC_REVISION_C 6
-
-/*
- ******************************************************************
- * *
- * Transmit Buffer Management *
- * *
- ******************************************************************
- */
-
-/*
- * Transmit descriptor area entry.
- * There is one transmit descriptor for each packet to be transmitted.
- * Statically reserve space for up to MAXIMUM_FRAGS_PER_PACKET fragments
- * per descriptor.
- */
-#define MAXIMUM_FRAGS_PER_DESCRIPTOR 6
-struct TransmitDescriptor {
- rtems_unsigned32 status;
- rtems_unsigned32 pkt_config;
- rtems_unsigned32 pkt_size;
- rtems_unsigned32 frag_count;
-
- /*
- * Packet fragment pointers
- */
- struct TransmitDescriptorFragLink {
- rtems_unsigned32 frag_lsw; /* LSW of fragment address */
-#define frag_link frag_lsw
- rtems_unsigned32 frag_msw; /* MSW of fragment address */
- rtems_unsigned32 frag_size;
- } frag[MAXIMUM_FRAGS_PER_DESCRIPTOR];
-
- /*
- * Space for link if all fragment pointers are used.
- */
- rtems_unsigned32 link_pad;
-
- /*
- * Extra RTEMS stuff
- */
- struct TransmitDescriptor *next; /* Circularly-linked list */
- struct mbuf *mbufp; /* First mbuf in packet */
- volatile rtems_unsigned32 *linkp; /* Pointer to un[xxx].link */
-};
-typedef struct TransmitDescriptor TransmitDescriptor_t;
-typedef volatile TransmitDescriptor_t *TransmitDescriptorPointer_t;
-
-/*
- * Transmit Configuration.
- * For standard Ethernet transmission, all bits in the transmit
- * configuration field are set to 0.
- */
-#define TDA_CONFIG_PINT 0x8000
-#define TDA_CONFIG_POWC 0x4000
-#define TDA_CONFIG_CRCI 0x2000
-#define TDA_CONFIG_EXDIS 0x1000
-
-/*
- * Transmit status
- */
-#define TDA_STATUS_COLLISION_MASK 0xF800
-#define TDA_STATUS_COLLISION_SHIFT 11
-#define TDA_STATUS_EXD 0x0400
-#define TDA_STATUS_DEF 0x0200
-#define TDA_STATUS_NCRS 0x0100
-#define TDA_STATUS_CRSL 0x0080
-#define TDA_STATUS_EXC 0x0040
-#define TDA_STATUS_OWC 0x0020
-#define TDA_STATUS_PMB 0x0008
-#define TDA_STATUS_FU 0x0004
-#define TDA_STATUS_BCM 0x0002
-#define TDA_STATUS_PTX 0x0001
-
-#define TDA_LINK_EOL 0x0001
-#define TDA_LINK_EOL_MASK 0xFFFE
-
-
-
-/*
- ******************************************************************
- * *
- * Receive Buffer Management *
- * *
- ******************************************************************
- */
-
-/*
- * Receive resource area entry.
- * There is one receive resource entry for each receive buffer area (RBA).
- * This driver allows only one packet per receive buffer area, so one
- * receive resource entry corresponds to one correctly-received packet.
- */
-struct ReceiveResource {
- rtems_unsigned32 buff_ptr_lsw; /* LSW of RBA address */
- rtems_unsigned32 buff_ptr_msw; /* MSW of RBA address */
- rtems_unsigned32 buff_wc_lsw; /* LSW of RBA size (16-bit words) */
- rtems_unsigned32 buff_wc_msw; /* MSW of RBA size (16-bit words) */
-};
-typedef struct ReceiveResource ReceiveResource_t;
-typedef volatile ReceiveResource_t *ReceiveResourcePointer_t;
-
-/*
- * Receive descriptor area entry.
- * There is one receive descriptor for each packet received.
- */
-struct ReceiveDescriptor {
- rtems_unsigned32 status;
- rtems_unsigned32 byte_count;
- rtems_unsigned32 pkt_lsw; /* LSW of packet address */
- rtems_unsigned32 pkt_msw; /* MSW of packet address */
- rtems_unsigned32 seq_no;
- rtems_unsigned32 link;
- rtems_unsigned32 in_use;
-
- /*
- * Extra RTEMS stuff
- */
- volatile struct ReceiveDescriptor *next; /* Circularly-linked list */
-};
-typedef struct ReceiveDescriptor ReceiveDescriptor_t;
-typedef volatile ReceiveDescriptor_t *ReceiveDescriptorPointer_t;
-
-typedef struct {
- rtems_unsigned32 cep; /* CAM Entry Pointer */
- rtems_unsigned32 cap0; /* CAM Address Port 0 xx-xx-xx-xx-YY-YY */
- rtems_unsigned32 cap1; /* CAM Address Port 1 xx-xx-YY-YY-xxxx */
- rtems_unsigned32 cap2; /* CAM Address Port 2 YY-YY-xx-xx-xx-xx */
- rtems_unsigned32 ce;
-} CamDescriptor_t;
-
-typedef volatile CamDescriptor_t *CamDescriptorPointer_t;
-
-/*
- * Receive status
- */
-#define RDA_STATUS_ERR 0x8800
-#define RDA_STATUS_RNT 0x4000
-#define RDA_STATUS_BRD 0x2000
-#define RDA_STATUS_PRO 0x1000
-#define RDA_STATUS_AMC 0x0800
-#define RDA_STATUS_LB1 0x0400
-#define RDA_STATUS_LB0 0x0200
-#define RDA_STATUS_MC 0x0100
-#define RDA_STATUS_BC 0x0080
-#define RDA_STATUS_LPKT 0x0040
-#define RDA_STATUS_CRS 0x0020
-#define RDA_STATUS_COL 0x0010
-#define RDA_STATUS_CRCR 0x0008
-#define RDA_STATUS_FAER 0x0004
-#define RDA_STATUS_LBK 0x0002
-#define RDA_STATUS_PRX 0x0001
-
-#define RDA_LINK_EOL 0x0001
-#define RDA_LINK_EOL_MASK 0xFFFE
-#define RDA_IN_USE 0x0000 /* SONIC has finished with the packet */
- /* and the driver can process it */
-#define RDA_FREE 0xFFFF /* SONIC can use it */
-
-#endif /* _SONIC_DP83932_ */
diff --git a/c/src/lib/libbsp/powerpc/dmv177/start/Makefile.in b/c/src/lib/libbsp/powerpc/dmv177/start/Makefile.in deleted file mode 100644 index cb7d9c07ec..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/start/Makefile.in +++ /dev/null @@ -1,54 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -PGMS=${ARCH}/start.o - -# C source names, if any, go here -- minus the .c -C_PIECES= -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -# Assembly source names, if any, go here -- minus the .s -S_PIECES=start -S_FILES=$(S_PIECES:%=%.s) -S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o) - -SRCS=$(C_FILES) $(CC_FILES) $(H_FILES) $(S_FILES) -OBJS=$(C_O_FILES) $(CC_O_FILES) $(S_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -all: ${ARCH} $(SRCS) $(OBJS) $(PGM) - $(INSTALL_VARIANT) -m 555 ${PGMS} ${PROJECT_RELEASE}/lib diff --git a/c/src/lib/libbsp/powerpc/dmv177/start/start.s b/c/src/lib/libbsp/powerpc/dmv177/start/start.s deleted file mode 100644 index f8e4e4e614..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/start/start.s +++ /dev/null @@ -1,117 +0,0 @@ -/* - * This is based on the mvme-crt0.S file from libgloss/rs6000. - * crt0.S -- startup file for PowerPC systems. - * - * Copyright (c) 1995 Cygnus Support - * - * The authors hereby grant permission to use, copy, modify, distribute, - * and license this software and its documentation for any purpose, provided - * that existing copyright notices are retained in all copies and that this - * notice is included verbatim in any distributions. No written agreement, - * license, or royalty fee is required for any of the authorized uses. - * Modifications to this software may be copyrighted by their authors - * and need not follow the licensing terms described here, provided that - * the new terms are clearly indicated on the first page of each file where - * they apply. - * - * $Id$ - */ - -#include <rtems/score/targopts.h> -#include "ppc-asm.h" - - .file "start.s" - .section ".got2","aw" - .align 2 - -.LCTOC1 = .+32768 - - .extern FUNC_NAME(atexit) - .globl FUNC_NAME(__atexit) - .section ".sdata","aw" - .align 2 -FUNC_NAME(__atexit): /* tell C's eabi-ctor's we have an atexit function */ - .long FUNC_NAME(atexit)@fixup /* and that it is to register __do_global_dtors */ - - .section ".fixup","aw" - .align 2 - .long FUNC_NAME(__atexit) - - .section ".got2","aw" -.Ltable = .-.LCTOC1 - .long .LCTOC1 /* address we think .LCTOC1 is loaded at */ - -.Lbss_start = .-.LCTOC1 - .long __bss_start - -.Lend = .-.LCTOC1 - .long _end - -.Lstack = .-.LCTOC1 /* stack address if set by user */ - .long __stack - - .text -.Lptr: - .long .LCTOC1-.Laddr - - .globl _start - .type _start,@function -_start: - lis r5,0 - mr r4,r5 - ori r4,r4,0x0000 /* 0x2030 */ - mtmsr r4 - -/* Add special purpose register initialization based upon the console driver - * initialization of these registers XXXXX - */ - - bl .Laddr /* get current address */ - -.Laddr: - mflr r4 /* real address of .Laddr */ - lwz r5,(.Lptr-.Laddr)(r4) /* linker generated address of .LCTOC1 */ - add r5,r5,r4 /* correct to real pointer */ - lwz r4,.Ltable(r5) /* get linker's idea of where .Laddr is */ - subf r4,r4,r5 /* calculate difference between where linked and current */ - - /* clear bss */ - lwz r6,.Lbss_start(r5) /* calculate beginning of the BSS */ - lwz r7,.Lend(r5) /* calculate end of the BSS */ - add r6,r6,r4 /* adjust pointers */ - add r7,r7,r4 - - cmplw 1,r6,r7 - bc 4,4,.Ldone - - subf r8,r6,r7 /* number of bytes to zero */ - srwi r9,r8,2 /* number of words to zero */ - mtctr r9 - li r0,0 /* zero to clear memory */ - addi r6,r6,-4 /* adjust so we can use stwu */ -.Lloop: - stwu r0,4(r6) /* zero bss */ - bdnz .Lloop - -.Ldone: - - lwz r0,.Lstack(r5) /* stack address or 0 */ - cmplwi 1,r0,0 /* equal to 0? */ - bc 12,6,.Lnostack /* use default stack if == 0 */ - mr sp,r0 /* use user defined stack */ - -.Lnostack: - /* set up initial stack frame */ - addi sp,sp,-4 /* make sure we don't overwrite debug mem */ - lis r0,0 - stw r0,0(sp) /* clear back chain */ - stwu sp,-56(sp) /* push another stack frame */ - - /* Let her rip */ - bl FUNC_NAME(boot_card) - - /* return value from boot_card is argument to exit */ - /* bl FUNC_NAME(exit) */ - trap -.Lstart: - .size _start,.Lstart-_start diff --git a/c/src/lib/libbsp/powerpc/dmv177/startup/Makefile.in b/c/src/lib/libbsp/powerpc/dmv177/startup/Makefile.in deleted file mode 100644 index 0877918685..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/startup/Makefile.in +++ /dev/null @@ -1,57 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@:@srcdir@/../../../shared -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -PGM=${ARCH}/startup.rel - -# C source names, if any, go here -- minus the .c -C_PIECES=bspclean bsplibc bsppost bspstart main sbrk setvec genpvec vmeintr -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -# Assembly source names, if any, go here -- minus the .s -S_PIECES= -S_FILES=$(S_PIECES:%=%.s) -S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o) - -SRCS=linkcmds $(C_FILES) $(CC_FILES) $(H_FILES) $(S_FILES) -OBJS=$(C_O_FILES) $(S_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -${PGM}: ${SRCS} ${OBJS} - $(make-rel) - -all: ${ARCH} $(SRCS) $(INSTALLED_O_FILES) $(PGM) - $(INSTALL) $(srcdir)/linkcmds ${PROJECT_RELEASE}/lib diff --git a/c/src/lib/libbsp/powerpc/dmv177/startup/bspclean.c b/c/src/lib/libbsp/powerpc/dmv177/startup/bspclean.c deleted file mode 100644 index 5e354f9387..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/startup/bspclean.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -void bsp_cleanup( void ) -{ -#if 0 - asm volatile( "li 10,99" ); /* 0x63 */ - asm volatile( "sc" ); -#endif -} diff --git a/c/src/lib/libbsp/powerpc/dmv177/startup/bspstart.c b/c/src/lib/libbsp/powerpc/dmv177/startup/bspstart.c deleted file mode 100644 index 07a5bf1473..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/startup/bspstart.c +++ /dev/null @@ -1,134 +0,0 @@ -/* bspstart.c - * - * This set of routines starts the application. It includes application, - * board, and monitor specific initialization and configuration. - * The generic CPU dependent initialization has been performed - * before any of these are invoked. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994, 1997. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * $Id$ - */ - -#include <bsp.h> -#include <rtems/libio.h> - -#include <libcsupport.h> - -#include <string.h> - -/* - * The original table from the application and our copy of it with - * some changes. - */ - -extern rtems_configuration_table Configuration; -rtems_configuration_table BSP_Configuration; -rtems_cpu_table Cpu_table; -rtems_unsigned32 bsp_isr_level; - -/* - * Use the shared implementations of the following routines - */ - -void bsp_postdriver_hook(void); -void bsp_libc_init( void *, unsigned32, int ); - -/*PAGE - * - * bsp_pretasking_hook - * - * BSP pretasking hook. Called just before drivers are initialized. - * Used to setup libc and install any BSP extensions. - */ - -void bsp_pretasking_hook(void) -{ - extern int end; - rtems_unsigned32 heap_start; - rtems_unsigned32 heap_size; - - heap_start = (rtems_unsigned32) &end; - if (heap_start & (CPU_ALIGNMENT-1)) - heap_start = (heap_start + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - heap_size = BSP_Configuration.work_space_start - (void *)&end; - heap_size &= 0xfffffff0; /* keep it as a multiple of 16 bytes */ - - bsp_libc_init((void *) heap_start, heap_size, 0); - -#ifdef RTEMS_DEBUG - rtems_debug_enable( RTEMS_DEBUG_ALL_MASK ); -#endif -} - -/* PAGE - * - * bsp_predriver_hook - * - * Initialization before drivers are setup. - */ - -void bsp_predriver_hook(void) -{ - initialize_external_exception_vector(); -} - -/*PAGE - * - * bsp_start - * - * This routine does the bulk of the system initialization. - */ - -void bsp_start( void ) -{ - unsigned char *work_space_start; - unsigned int msr_value = 0x2030; - - /* - * Set BSP to initial value. Note: This value is a guess - * check how the real board comes up. This is critical to - * getting the source to work with the debugger. - */ - - _CPU_MSR_SET( msr_value ); - - /* - * Need to "allocate" the memory for the RTEMS Workspace and - * tell the RTEMS configuration where it is. This memory is - * not malloc'ed. It is just "pulled from the air". - */ - - work_space_start = - (unsigned char *)&RAM_END - BSP_Configuration.work_space_size; - - if ( work_space_start <= (unsigned char *)&end ) { - DEBUG_puts( "bspstart: Not enough RAM!!!\n" ); - bsp_cleanup(); - } - - BSP_Configuration.work_space_start = work_space_start; - - /* - * Account for the console's resources - */ - - console_reserve_resources( &BSP_Configuration ); - - /* - * initialize the CPU table for this BSP - */ - - Cpu_table.exceptions_in_RAM = TRUE; - Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */ - Cpu_table.predriver_hook = bsp_predriver_hook; - Cpu_table.postdriver_hook = bsp_postdriver_hook; - /* Cpu_table.clicks_per_usec = 66666667 / 4000000; */ - Cpu_table.clicks_per_usec = 66666667 / 4000000 / 2; - - Cpu_table.do_zero_of_workspace = TRUE; - Cpu_table.interrupt_stack_size = (12 * 1024); -} diff --git a/c/src/lib/libbsp/powerpc/dmv177/startup/genpvec.c b/c/src/lib/libbsp/powerpc/dmv177/startup/genpvec.c deleted file mode 100644 index 2faa40ed9a..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/startup/genpvec.c +++ /dev/null @@ -1,239 +0,0 @@ -/* genpvec.c - * - * These routines handle the external exception. Multiple ISRs occur off - * of this one interrupt. This method will allow multiple ISRs to be - * called using the same IRQ index. However, removing the ISR routines is - * presently not supported. - * - * The external exception vector numbers begin with DMV170_IRQ_FIRST. - * DMV170_IRQ_FIRST is defined to be one greater than the last processor - * interrupt. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may in - * the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include <bsp.h> -#include "chain.h" -#include <assert.h> - -#define NUM_LIRQ_HANDLERS 20 -#define NUM_LIRQ ( MAX_BOARD_IRQS - PPC_IRQ_LAST ) - -/* - * Structure to for one of possible multiple interrupt handlers for - * a given interrupt. - */ -typedef struct -{ - Chain_Node Node; - rtems_isr_entry handler; /* isr routine */ - rtems_vector_number vector; /* vector number */ -} EE_ISR_Type; - -/* - * Note: The following will not work if we add a method to remove - * handlers at a later time. - */ -EE_ISR_Type ISR_Nodes [NUM_LIRQ_HANDLERS]; -rtems_unsigned16 Nodes_Used; -Chain_Control ISR_Array [NUM_LIRQ]; - -/*PAGE - * - * external_exception_ISR - * - * This interrupt service routine is called for an External Exception. - * - * Input parameters: - * vector - vector number representing the external exception vector. - * - * Output parameters: NONE - * - * Return values: - */ - -rtems_isr external_exception_ISR ( - rtems_vector_number vector /* IN */ -) -{ - rtems_unsigned16 index; - rtems_boolean is_active=FALSE; - rtems_unsigned32 scv64_status; - rtems_vector_number chained_vector; - Chain_Node *node; - EE_ISR_Type *ee_isr; - - - /* - * Get all active interrupts. - */ - scv64_status = SCV64_Get_Interrupt(); - scv64_status &= SCV64_Get_Interrupt_Enable(); - - /* - * Process any set interrupts. - */ - for (index = 0; index <= 5; index++) { - switch(index) { - case 0: - is_active = SCV64_Is_IRQ0( scv64_status ); - break; - case 1: - is_active = SCV64_Is_IRQ1( scv64_status ); - break; - case 2: - is_active = SCV64_Is_IRQ2( scv64_status ); - break; - case 3: - is_active = SCV64_Is_IRQ3( scv64_status ); - break; - case 4: - is_active = SCV64_Is_IRQ4( scv64_status ); - break; - case 5: - is_active = SCV64_Is_IRQ5( scv64_status ); - break; - } - - if (is_active) { - /* - * Read vector. - */ - node = ISR_Array[ index ].first; - while ( !_Chain_Is_tail( &ISR_Array[ index ], node ) ) { - ee_isr = (EE_ISR_Type *) node; - (*ee_isr->handler)( ee_isr->vector ); - node = node->next; - } - } - } -} - - -/*PAGE - * - * initialize_external_exception_vector - * - * This routine initializes the external exception vector - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * Return values: NONE - */ - -void initialize_external_exception_vector () -{ - int i; - rtems_isr_entry previous_isr; - rtems_status_code status; - - Nodes_Used = 0; - - /* - * Initialize the SCV64 chip - */ - SCV64_Initialize(); - - for (i=0; i <NUM_LIRQ; i++) - Chain_Initialize_empty( &ISR_Array[i] ); - - /* - * Install external_exception_ISR () as the handler for - * the General Purpose Interrupt. - */ - - status = rtems_interrupt_catch( external_exception_ISR, - PPC_IRQ_EXTERNAL , (rtems_isr_entry *) &previous_isr ); - -} - -/*PAGE - * - * set_EE_vector - * - * This routine installs one of multiple ISRs for the general purpose - * inerrupt. - * - * Input parameters: - * handler - handler to call at exception - * vector - vector number associated with this handler. - * - * Output parameters: NONE - * - * Return values: - */ - -rtems_isr_entry set_EE_vector( - rtems_isr_entry handler, /* isr routine */ - rtems_vector_number vector /* vector number */ -) -{ - rtems_unsigned16 vec_idx = vector - DMV170_IRQ_FIRST; - rtems_unsigned32 index; - - /* - * Verify that all of the nodes have not been used. - */ - assert (Nodes_Used < NUM_LIRQ_HANDLERS); - - /* - * If we have already installed this handler for this vector, then - * just reset it. - */ - - for ( index=0 ; index <= Nodes_Used ; index++ ) { - if ( ISR_Nodes[index].vector == vector && - ISR_Nodes[index].handler == handler ) - return 0; - } - - /* - * Increment the number of nedes used and set the index for the node - * array. - */ - - Nodes_Used++; - index = Nodes_Used - 1; - - /* - * Write the values of the handler and the vector to this node. - */ - ISR_Nodes[index].handler = handler; - ISR_Nodes[index].vector = vector; - - /* - * Connect this node to the chain at the location of the - * vector index. - */ - Chain_Append( &ISR_Array[vec_idx], &ISR_Nodes[index].Node ); - - /* - * Enable the LIRQ interrupt. - */ - SCV64_Generate_DUART_Interrupts(); - - /* - * No interrupt service routine was removed so return 0 - */ - return 0; -} - - - - - - - - - - diff --git a/c/src/lib/libbsp/powerpc/dmv177/startup/linkcmds b/c/src/lib/libbsp/powerpc/dmv177/startup/linkcmds deleted file mode 100644 index 52e379d8a4..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/startup/linkcmds +++ /dev/null @@ -1,183 +0,0 @@ -OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", - "elf32-powerpc") -OUTPUT_ARCH(powerpc) -ENTRY(_start) - -/* - * Number of Decrementer countdowns per millisecond - * - * Calculated by: (66.67 Mhz * 1000) / 4 cycles per click - * - -PROVIDE(CPU_PPC_CLICKS_PER_MS = 16667); -*/ - -MEMORY - { - RAM : ORIGIN = 0x41000, LENGTH = 32M - EPROM : ORIGIN = 0xFFF00000, LENGTH = 0x20000 - } - -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - /* . = 0x40000 + SIZEOF_HEADERS; */ - /* . = 0x1000000;*/ - . = 0x41000; - .interp : { *(.interp) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .rela.text : { *(.rela.text) } - .rela.data : { *(.rela.data) } - .rela.rodata : { *(.rela.rodata) } - .rela.got : { *(.rela.got) } - .rela.got1 : { *(.rela.got1) } - .rela.got2 : { *(.rela.got2) } - .rela.ctors : { *(.rela.ctors) } - .rela.dtors : { *(.rela.dtors) } - .rela.init : { *(.rela.init) } - .rela.fini : { *(.rela.fini) } - .rela.bss : { *(.rela.bss) } - .rela.plt : { *(.rela.plt) } - .rela.sdata : { *(.rela.sdata2) } - .rela.sbss : { *(.rela.sbss2) } - .rela.sdata2 : { *(.rela.sdata2) } - .rela.sbss2 : { *(.rela.sbss2) } - .plt : { *(.plt) } - .text : - { - *(.text) - *(.descriptors) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - } >RAM - .init : { *(.init) } >RAM - .fini : { *(.fini) } >RAM - .rodata : { *(.rodata) } >RAM - .rodata1 : { *(.rodata1) } >RAM - _etext = .; - PROVIDE (etext = .); - PROVIDE (__SDATA2_START__ = .); - .sdata2 : { *(.sdata2) } >RAM - .sbss2 : { *(.sbss2) } >RAM - PROVIDE (__SBSS2_END__ = .); - /* Adjust the address for the data segment. We want to adjust up to - the same address within the page on the next page up. It would - be more correct to do this: - . = ALIGN(0x40000) + (ALIGN(8) & (0x40000 - 1)); - The current expression does not correctly handle the case of a - text segment ending precisely at the end of a page; it causes the - data segment to skip a page. The above expression does not have - this problem, but it will currently (2/95) cause BFD to allocate - a single segment, combining both text and data, for this case. - This will prevent the text segment from being shared among - multiple executions of the program; I think that is more - important than losing a page of the virtual address space (note - that no actual memory is lost; the page which is skipped can not - be referenced). */ - . = ALIGN(8) + 0x40000; - PROVIDE (sdata = .); - .data : - { - *(.data) - CONSTRUCTORS - } >RAM - PROVIDE (__EXCEPT_START__ = .); - .gcc_except_table : { *(.gcc_except_table) } >RAM - PROVIDE (__EXCEPT_END__ = .); - - .data1 : { *(.data1) } >RAM - .got1 : { *(.got1) } >RAM - .dynamic : { *(.dynamic) } >RAM - /* Put .ctors and .dtors next to the .got2 section, so that the pointers - get relocated with -mrelocatable. Also put in the .fixup pointers. - The current compiler no longer needs this, but keep it around for 2.7.2 */ - PROVIDE (_GOT2_START_ = .); - PROVIDE (__GOT2_START__ = .); - .got2 : { *(.got2) } >RAM - PROVIDE (_GOT2_END_ = .); - PROVIDE (__GOT2_END__ = .); - - PROVIDE (__CTOR_LIST__ = .); - .ctors : { *(.ctors) } >RAM - PROVIDE (__CTOR_END__ = .); - - PROVIDE (__DTOR_LIST__ = .); - .dtors : { *(.dtors) } >RAM - PROVIDE (__DTOR_END__ = .); - - PROVIDE (_FIXUP_START_ = .); - PROVIDE (__FIXUP_START__ = .); - .fixup : { *(.fixup) } >RAM - PROVIDE (_FIXUP_END_ = .); - PROVIDE (__FIXUP_END__ = .); - - PROVIDE (_GOT2_END_ = .); - PROVIDE (_GOT_START_ = .); - s.got = .; - .got : { *(.got) } >RAM - .got.plt : { *(.got.plt) } >RAM - PROVIDE (_GOT_END_ = .); - PROVIDE (__GOT_END__ = .); - - /* We want the small data sections together, so single-instruction offsets - can access them all, and initialized data all before uninitialized, so - we can shorten the on-disk segment size. */ - PROVIDE (__SDATA_START__ = .); - .sdata : { *(.sdata) } >RAM - _edata = .; - PROVIDE (edata = .); - - PROVIDE (RAM_END = 4M); - .sbss : - { - PROVIDE (__sbss_start = .); - *(.sbss) - *(.scommon) - PROVIDE (__sbss_end = .); - } >RAM - PROVIDE (__SBSS_END__ = .); - .bss : - { - PROVIDE (__bss_start = .); - *(.dynbss) - *(.bss) - *(COMMON) - } >RAM - . = ALIGN(8) + 0x8000; - PROVIDE (__stack = .); - _end = . ; - PROVIDE (end = .); - - /* These are needed for ELF backends which have not yet been - converted to the new style linker. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - /* DWARF debug sections. - Symbols in the DWARF debugging sections are relative to the beginning - of the section so we begin them at 0. */ - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - /* SGI/MIPS DWARF 2 extensions */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } - /* These must appear regardless of . */ -} diff --git a/c/src/lib/libbsp/powerpc/dmv177/startup/setvec.c b/c/src/lib/libbsp/powerpc/dmv177/startup/setvec.c deleted file mode 100644 index cf385569d0..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/startup/setvec.c +++ /dev/null @@ -1,58 +0,0 @@ -/* set_vector - * - * This routine installs an interrupt vector on the target Board/CPU. - * This routine is allowed to be as board dependent as necessary. - * - * INPUT: - * handler - interrupt handler entry point - * vector - vector number - * type - 0 indicates raw hardware connect - * 1 indicates RTEMS interrupt connect - * - * RETURNS: - * address of previous interrupt handler - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may in - * the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include <rtems.h> -#include <bsp.h> - -/*PAGE - * - * set_vector - * - * This routine installs an interrupt handler for vector. - */ - -rtems_isr_entry set_vector( /* returns old vector */ - rtems_isr_entry handler, /* isr routine */ - rtems_vector_number vector, /* vector number */ - int type /* RTEMS or RAW intr */ -) -{ - rtems_isr_entry previous_isr; - rtems_status_code status; - - /* - * vectors greater than PPC603e_IRQ_LAST are handled by the General purpose - * interupt handler. - */ - if ( vector > PPC_IRQ_LAST ) { - set_EE_vector ( handler, vector ); - } - else { - status = rtems_interrupt_catch( - handler, vector, (rtems_isr_entry *) &previous_isr ); - } - return previous_isr; -} - diff --git a/c/src/lib/libbsp/powerpc/dmv177/startup/vmeintr.c b/c/src/lib/libbsp/powerpc/dmv177/startup/vmeintr.c deleted file mode 100644 index 212d7eb938..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/startup/vmeintr.c +++ /dev/null @@ -1,84 +0,0 @@ -/* vmeintr.c - * - * VMEbus support routines for the DMV170. - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may in - * the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include <rtems.h> -#include <bsp.h> -#include <vmeintr.h> - -/* PAGE - * - * VME_interrupt_Disable - * - * This routine disables vme interupts - * - * Input parameters: - * mask - interupt mask - * - * Output parameters: NONE - * - * Return values: NONE - */ - -void VME_interrupt_Disable ( - VME_interrupt_Mask mask /* IN */ -) -{ - volatile rtems_unsigned8 *VME_interrupt_enable; - rtems_unsigned8 value; - -#if 0 - VME_interrupt_enable = ACC_VIE; -#else - VME_interrupt_enable = 0; -#endif - value = *VME_interrupt_enable; - - value &= ~mask; /* turn off interrupts for all levels in mask */ - - *VME_interrupt_enable = value; -} - -/* PAGE - * - * VME_interrupt_Enable - * - * This routine enables vme interupts - * - * Input parameters: - * mask - interupt mask - * - * Output parameters: NONE - * - * Return values: - */ - -void VME_interrupt_Enable ( - VME_interrupt_Mask mask /* IN */ -) -{ - volatile rtems_unsigned8 *VME_interrupt_enable; - rtems_unsigned8 value; - -#if 0 - VME_interrupt_enable = ACC_VIE; -#else - VME_interrupt_enable = 0; -#endif - value = *VME_interrupt_enable; - - value |= mask; /* turn on interrupts for all levels in mask */ - - *VME_interrupt_enable = value; -} diff --git a/c/src/lib/libbsp/powerpc/dmv177/timer/Makefile.in b/c/src/lib/libbsp/powerpc/dmv177/timer/Makefile.in deleted file mode 100644 index 16665e4de9..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/timer/Makefile.in +++ /dev/null @@ -1,59 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -PGM=${ARCH}/timer.rel - -# C source names, if any, go here -- minus the .c -C_PIECES=timer -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -# Assembly source names, if any, go here -- minus the .s -S_PIECES= -S_FILES=$(S_PIECES:%=%.s) -S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o) - -SRCS=$(C_FILES) $(CC_FILES) $(H_FILES) $(S_FILES) -OBJS=$(C_O_FILES) $(CC_O_FILES) $(S_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -${PGM}: ${SRCS} ${OBJS} - $(make-rel) - -all: ${ARCH} $(SRCS) $(PGM) - -# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile -install: all diff --git a/c/src/lib/libbsp/powerpc/dmv177/timer/timer.c b/c/src/lib/libbsp/powerpc/dmv177/timer/timer.c deleted file mode 100644 index 674e2cf5a8..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/timer/timer.c +++ /dev/null @@ -1,132 +0,0 @@ -/* timer.c - * - * This file implements a benchmark timer using the General Purpose Timer on - * the MEC. - * - * The license and distribution terms for this file are in - * the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include <assert.h> - -#include <bsp.h> - -rtems_unsigned64 Timer_driver_Start_time; - -rtems_boolean Timer_driver_Find_average_overhead; - -/*PAGE - * - * Timer_initialize - * - * This routine initializes the timer. - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * Return values: NONE - * - */ - -void Timer_initialize() -{ - /* - * Timer runs long and accurate enough not to require an interrupt. - */ - - - Timer_driver_Start_time = PPC_Get_timebase_register(); - - -} - -#define AVG_OVERHEAD 24 /* It typically takes 24 instructions */ - /* to start/stop the timer. */ -#define LEAST_VALID 1 /* Don't trust a value lower than this */ - -/* PAGE - * - * Read_timer - * - * This routine reads the timer. - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * Return values: timer in ms units - * - */ - -int Read_timer() -{ - rtems_unsigned64 clicks; - rtems_unsigned64 total64; - rtems_unsigned32 total; - - /* approximately CLOCK_SPEED clicks per microsecond */ - - clicks = PPC_Get_timebase_register(); - - assert( clicks > Timer_driver_Start_time ); - - total64 = clicks - Timer_driver_Start_time; - - assert( total64 <= 0xffffffff ); /* fits into a unsigned32 */ - - total = (rtems_unsigned32) total64; - - if ( Timer_driver_Find_average_overhead == 1 ) - return total; /* in one microsecond units */ - - if ( total < LEAST_VALID ) - return 0; /* below timer resolution */ - - return total - AVG_OVERHEAD; -} - -/* PAGE - * - * Empty_function - * - * This routine is called during the idle loop. - * - * Input parameters: NONE - * - * Output parameters: - * status code of successful - * - * Return values: NONE - * - */ - -rtems_status_code Empty_function( void ) -{ - return RTEMS_SUCCESSFUL; -} - -/* PAGE - * - * Set_find_average_overhead - * - * This routine sets a global boolean to the value passed in. - * - * Input parameters: - * find_flag - flag to indicate to find the average overhead. - * - * Output parameters: NONE - * - * Return values: NONE - * - */ - -void Set_find_average_overhead( - rtems_boolean find_flag -) -{ - Timer_driver_Find_average_overhead = find_flag; -} diff --git a/c/src/lib/libbsp/powerpc/dmv177/times b/c/src/lib/libbsp/powerpc/dmv177/times deleted file mode 100644 index 2a18eae92a..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/times +++ /dev/null @@ -1,191 +0,0 @@ -# -# Timing Test Suite Results for the DY-4 DMV177 -# -# $Id$ -# - -Board: DY-4 DMV177 -CPU: PPC 603e -Clock Speed: 100 Mhz -Memory Configuration: 32 Mbyte DRAM -Wait States: XXX - -Times Reported in: cycles -Timer Source: on-CPU General Purpose Count Down Timer - -Column A: 4.0.0-lmco -Column B: unused - -# DESCRIPTION A B -== ================================================================= ==== ==== - 1 rtems_semaphore_create 571 - rtems_semaphore_delete 575 - rtems_semaphore_obtain: available 414 - rtems_semaphore_obtain: not available -- NO_WAIT 414 - rtems_semaphore_release: no waiting tasks 501 - - 2 rtems_semaphore_obtain: not available -- caller blocks 1254 - - 3 rtems_semaphore_release: task readied -- preempts caller 982 - - 4 rtems_task_restart: blocked task -- preempts caller 1640 - rtems_task_restart: ready task -- preempts caller 1601 - rtems_semaphore_release: task readied -- returns to caller 636 - rtems_task_create 2301 - rtems_task_start 794 - rtems_task_restart: suspended task -- returns to caller 906 - rtems_task_delete: suspended task 1555 - rtems_task_restart: ready task -- returns to caller 928 - rtems_task_restart: blocked task -- returns to caller 1102 - rtems_task_delete: blocked task 1609 - - 5 rtems_task_suspend: calling task 960 - rtems_task_resume: task readied -- preempts caller 803 - - 6 rtems_task_restart: calling task 1137 - rtems_task_suspend: returns to caller 433 - rtems_task_resume: task readied -- returns to caller 451 - rtems_task_delete: ready task 1620 - - 7 rtems_task_restart: suspended task -- preempts caller 1483 - - 8 rtems_task_set_priority: obtain current priority 368 - rtems_task_set_priority: returns to caller 633 - rtems_task_mode: obtain current mode 184 - rtems_task_mode: no reschedule 213 - rtems_task_mode: reschedule -- returns to caller 247 - rtems_task_mode: reschedule -- preempts caller 919 - rtems_task_set_note 383 - rtems_task_get_note 382 - rtems_clock_set 792 - rtems_clock_get 78 - - 9 rtems_message_queue_create 2270 - rtems_message_queue_send: no waiting tasks 923 - rtems_message_queue_urgent: no waiting tasks 919 - rtems_message_queue_receive: available 755 - rtems_message_queue_flush: no messages flushed 369 - rtems_message_queue_flush: messages flushed 431 - rtems_message_queue_delete 708 - -10 rtems_message_queue_receive: not available -- NO_WAIT 467 - rtems_message_queue_receive: not available -- caller blocks 1283 - -11 rtems_message_queue_send: task readied -- preempts caller 1322 - -12 rtems_message_queue_send: task readied -- returns to caller 955 - -13 rtems_message_queue_urgent: task readied -- preempts caller 1322 - -14 rtems_message_queue_urgent: task readied -- returns to caller 955 - -15 rtems_event_receive: obtain current events 43 - rtems_event_receive: not available -- NO_WAIT 331 - rtems_event_receive: not available -- caller blocks 1043 - rtems_event_send: no task readied 354 - rtems_event_receive: available 357 - rtems_event_send: task readied -- returns to caller 571 - -16 rtems_event_send: task readied -- preempts caller 946 - -17 rtems_task_set_priority: preempts caller 1211 - -18 rtems_task_delete: calling task 2117 - -19 rtems_signal_catch 267 - rtems_signal_send: returns to caller 408 - rtems_signal_send: signal to self 607 - exit ASR overhead: returns to calling task 464 - exit ASR overhead: returns to preempting task 752 - -20 rtems_partition_create 762 - rtems_region_create 614 - rtems_partition_get_buffer: available 394 - rtems_partition_get_buffer: not available 376 - rtems_partition_return_buffer 420 - rtems_partition_delete 426 - rtems_region_get_segment: available 515 - rtems_region_get_segment: not available -- NO_WAIT 472 - rtems_region_return_segment: no waiting tasks 544 - rtems_region_get_segment: not available -- caller blocks 1345 - rtems_region_return_segment: task readied -- preempts caller 1296 - rtems_region_return_segment: task readied -- returns to caller 935 - rtems_region_delete 425 - rtems_io_initialize 52 - rtems_io_open 42 - rtems_io_close 44 - rtems_io_read 42 - rtems_io_write 44 - rtems_io_control 42 - -21 rtems_task_ident 2900 - rtems_message_queue_ident 2828 - rtems_semaphore_ident 3243 - rtems_partition_ident 2828 - rtems_region_ident 2878 - rtems_port_ident 2828 - rtems_timer_ident 2828 - rtems_rate_monotonic_ident 2826 - -22 rtems_message_queue_broadcast: task readied -- returns to caller 1079 - rtems_message_queue_broadcast: no waiting tasks 589 - rtems_message_queue_broadcast: task readied -- preempts caller 1435 - -23 rtems_timer_create 357 - rtems_timer_fire_after: inactive 607 - rtems_timer_fire_after: active 646 - rtems_timer_cancel: active 378 - rtems_timer_cancel: inactive 339 - rtems_timer_reset: inactive 552 - rtems_timer_reset: active 591 - rtems_timer_fire_when: inactive 766 - rtems_timer_fire_when: active 764 - rtems_timer_delete: active 471 - rtems_timer_delete: inactive 432 - rtems_task_wake_when 1275 - -24 rtems_task_wake_after: yield -- returns to caller 245 - rtems_task_wake_after: yields -- preempts caller 851 - -25 rtems_clock_tick 214 - -26 _ISR_Disable 24 - _ISR_Flash 21 - _ISR_Enable 19 - _Thread_Disable_dispatch 27 - _Thread_Enable_dispatch 211 - _Thread_Set_state 177 - _Thread_Disptach (NO FP) 761 - context switch: no floating point contexts 585 - context switch: self 230 - context switch: to another task 236 - context switch: restore 1st FP task 730 - fp context switch: save idle, restore idle 478 - fp context switch: save idle, restore initialized 828 - fp context switch: save initialized, restore initialized 478 - _Thread_Resume 143 - _Thread_Unblock 143 - _Thread_Ready 147 - _Thread_Get 93 - _Semaphore_Get 77 - _Thread_Get: invalid id 20 - -27 interrupt entry overhead: returns to interrupted task 206 - interrupt exit overhead: returns to interrupted task 213 - interrupt entry overhead: returns to nested interrupt 201 - interrupt exit overhead: returns to nested interrupt 186 - interrupt entry overhead: returns to preempting task 202 - interrupt exit overhead: returns to preempting task 857 - -28 rtems_port_create 428 - rtems_port_external_to_internal 339 - rtems_port_internal_to_external 339 - rtems_port_delete 421 - -29 rtems_rate_monotonic_create 388 - rtems_rate_monotonic_period: initiate period -- returns to caller 556 - rtems_rate_monotonic_period: obtain status 377 - rtems_rate_monotonic_cancel 427 - rtems_rate_monotonic_delete: inactive 465 - rtems_rate_monotonic_delete: active 519 - rtems_rate_monotonic_period: conclude periods -- caller blocks 843 diff --git a/c/src/lib/libbsp/powerpc/dmv177/tod/Makefile.in b/c/src/lib/libbsp/powerpc/dmv177/tod/Makefile.in deleted file mode 100644 index f2af5cc8fb..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/tod/Makefile.in +++ /dev/null @@ -1,57 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@:@srcdir@/../../../shared -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -PGM=${ARCH}/tod.rel - -# C source names, if any, go here -- minus the .c -C_PIECES=config tod -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -SRCS=$(C_FILES) $(H_FILES) -OBJS=$(C_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -# First and second generation use different RTC chips :( -TOD_PIECES=tod - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -${PGM}: ${SRCS} ${OBJS} - $(make-rel) - -all: ${ARCH} $(SRCS) $(PGM) - -# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile -install: all diff --git a/c/src/lib/libbsp/powerpc/dmv177/tod/config.c b/c/src/lib/libbsp/powerpc/dmv177/tod/config.c deleted file mode 100644 index aa44aa66bf..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/tod/config.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * This file contains the RTC driver table for the DY-4 DMV177. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994, 1997. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * $Id$ - */ - -#include <bsp.h> - -#include <libchip/rtc.h> -#include <libchip/icm7170.h> - -/* - * Configuration specific probe routines - * - * NOTE: There are no DMV177 specific configuration routines. These - * routines could be written to dynamically determine what type - * of real-time clock is on this board. This would be useful for - * a BSP supporting multiple board models. - */ - -/* NONE CURRENTLY PROVIDED */ - -/* - * The following table configures the RTC drivers used in this BSP. - * - * The first entry which, when probed, is available, will be named /dev/rtc, - * all others being given the name indicated. - */ - -boolean dmv177_icm7170_probe(int minor); - -rtc_tbl RTC_Table[] = { - { - "/dev/rtc0", /* sDeviceName */ - RTC_ICM7170, /* deviceType */ - &icm7170_fns, /* pDeviceFns */ - dmv177_icm7170_probe, /* deviceProbe */ - (void *) ICM7170_AT_1_MHZ, /* pDeviceParams */ - DMV170_RTC_ADDRESS, /* ulCtrlPort1 */ - NULL, /* ulDataPort */ - icm7170_get_register_8, /* getRegister */ - icm7170_set_register_8, /* setRegister */ - } -}; - -/* - * Declare some information used by the RTC driver - */ - -#define NUM_RTCS (sizeof(RTC_Table)/sizeof(rtc_tbl)) - -unsigned long RTC_Count = NUM_RTCS; - -rtems_device_minor_number RTC_Minor; - -/* - * Hopefully, by checking the card resource register, this BSP - * will be able to operate on the DMV171, DMV176, or DMV177. - */ - -boolean dmv177_icm7170_probe(int minor) -{ - volatile unsigned16 *card_resource_reg; - unsigned16 v; - - card_resource_reg = (volatile unsigned16 *) DMV170_CARD_RESORCE_REG; - - v = *card_resource_reg & DMV170_RTC_INST_MASK; - - if ( v == DMV170_RTC_INSTALLED ) - return TRUE; - - return FALSE; -} - diff --git a/c/src/lib/libbsp/powerpc/dmv177/tod/todcfg.c b/c/src/lib/libbsp/powerpc/dmv177/tod/todcfg.c deleted file mode 100644 index aa44aa66bf..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/tod/todcfg.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * This file contains the RTC driver table for the DY-4 DMV177. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994, 1997. - * On-Line Applications Research Corporation (OAR). - * All rights assigned to U.S. Government, 1994. - * - * $Id$ - */ - -#include <bsp.h> - -#include <libchip/rtc.h> -#include <libchip/icm7170.h> - -/* - * Configuration specific probe routines - * - * NOTE: There are no DMV177 specific configuration routines. These - * routines could be written to dynamically determine what type - * of real-time clock is on this board. This would be useful for - * a BSP supporting multiple board models. - */ - -/* NONE CURRENTLY PROVIDED */ - -/* - * The following table configures the RTC drivers used in this BSP. - * - * The first entry which, when probed, is available, will be named /dev/rtc, - * all others being given the name indicated. - */ - -boolean dmv177_icm7170_probe(int minor); - -rtc_tbl RTC_Table[] = { - { - "/dev/rtc0", /* sDeviceName */ - RTC_ICM7170, /* deviceType */ - &icm7170_fns, /* pDeviceFns */ - dmv177_icm7170_probe, /* deviceProbe */ - (void *) ICM7170_AT_1_MHZ, /* pDeviceParams */ - DMV170_RTC_ADDRESS, /* ulCtrlPort1 */ - NULL, /* ulDataPort */ - icm7170_get_register_8, /* getRegister */ - icm7170_set_register_8, /* setRegister */ - } -}; - -/* - * Declare some information used by the RTC driver - */ - -#define NUM_RTCS (sizeof(RTC_Table)/sizeof(rtc_tbl)) - -unsigned long RTC_Count = NUM_RTCS; - -rtems_device_minor_number RTC_Minor; - -/* - * Hopefully, by checking the card resource register, this BSP - * will be able to operate on the DMV171, DMV176, or DMV177. - */ - -boolean dmv177_icm7170_probe(int minor) -{ - volatile unsigned16 *card_resource_reg; - unsigned16 v; - - card_resource_reg = (volatile unsigned16 *) DMV170_CARD_RESORCE_REG; - - v = *card_resource_reg & DMV170_RTC_INST_MASK; - - if ( v == DMV170_RTC_INSTALLED ) - return TRUE; - - return FALSE; -} - diff --git a/c/src/lib/libbsp/powerpc/dmv177/wrapup/Makefile.in b/c/src/lib/libbsp/powerpc/dmv177/wrapup/Makefile.in deleted file mode 100644 index 7119536c6a..0000000000 --- a/c/src/lib/libbsp/powerpc/dmv177/wrapup/Makefile.in +++ /dev/null @@ -1,62 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -# We only build the networking device driver if HAS_NETWORKING was defined -NETWORKING_DRIVER_yes_V = sonic -NETWORKING_DRIVER = $(NETWORKING_DRIVER_$(HAS_NETWORKING)_V) - -# pieces specific to this BSP -BSP_PIECES=startup clock console scv64 timer tod $(NETWORKING_DRIVER) - -# pieces to pick up out of libcpu/$(RTEMS_CPU) -CPU_PIECES= - -# shared pieces -GENERIC_PIECES= - -# bummer; have to use $foreach since % pattern subst rules only replace 1x -OBJS=$(foreach piece, $(BSP_PIECES), ../$(piece)/$(ARCH)/$(piece).rel) \ - $(foreach piece, $(CPU_PIECES), \ - ../../../../libcpu/$(RTEMS_CPU)/$(piece)/$(ARCH)/$(piece).rel) \ - $(foreach piece, $(GENERIC_PIECES), \ - ../../../$(piece)/$(ARCH)/$(piece).rel) -LIB=$(ARCH)/libbsp.a - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/lib.cfg - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -$(LIB): ${OBJS} - $(make-library) - -all: ${ARCH} $(SRCS) $(LIB) - $(INSTALL_VARIANT) -m 644 $(LIB) ${PROJECT_RELEASE}/lib - diff --git a/c/src/lib/libbsp/powerpc/psim/start/Makefile.in b/c/src/lib/libbsp/powerpc/psim/start/Makefile.in deleted file mode 100644 index 35377e94f1..0000000000 --- a/c/src/lib/libbsp/powerpc/psim/start/Makefile.in +++ /dev/null @@ -1,54 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -PGMS=${ARCH}/startsim.o - -# C source names, if any, go here -- minus the .c -C_PIECES= -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -# Assembly source names, if any, go here -- minus the .s -S_PIECES=startsim -S_FILES=$(S_PIECES:%=%.s) -S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o) - -SRCS=$(C_FILES) $(CC_FILES) $(H_FILES) $(S_FILES) -OBJS=$(C_O_FILES) $(CC_O_FILES) $(S_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -all: ${ARCH} $(SRCS) $(OBJS) $(PGM) - $(INSTALL_VARIANT) -m 555 ${PGMS} ${PROJECT_RELEASE}/lib diff --git a/c/src/lib/libbsp/powerpc/psim/start/startsim.s b/c/src/lib/libbsp/powerpc/psim/start/startsim.s deleted file mode 100644 index f94a3ca330..0000000000 --- a/c/src/lib/libbsp/powerpc/psim/start/startsim.s +++ /dev/null @@ -1,106 +0,0 @@ -/* - * This is based on the mvme-crt0.S file from libgloss/rs6000. - * crt0.S -- startup file for PowerPC systems. - * - * Copyright (c) 1995 Cygnus Support - * - * The authors hereby grant permission to use, copy, modify, distribute, - * and license this software and its documentation for any purpose, provided - * that existing copyright notices are retained in all copies and that this - * notice is included verbatim in any distributions. No written agreement, - * license, or royalty fee is required for any of the authorized uses. - * Modifications to this software may be copyrighted by their authors - * and need not follow the licensing terms described here, provided that - * the new terms are clearly indicated on the first page of each file where - * they apply. - * - * $Id$ - */ - -#include "ppc-asm.h" - - .file "startsim.s" - .section ".got2","aw" - .align 2 - -.LCTOC1 = .+32768 - - .extern FUNC_NAME(atexit) - .globl FUNC_NAME(__atexit) - .section ".sdata","aw" - .align 2 -FUNC_NAME(__atexit): /* tell C's eabi-ctor's we have an atexit function */ - .long FUNC_NAME(atexit)@fixup /* and that it is to register __do_global_dtors */ - - .section ".fixup","aw" - .align 2 - .long FUNC_NAME(__atexit) - - .section ".got2","aw" -.Ltable = .-.LCTOC1 - .long .LCTOC1 /* address we think .LCTOC1 is loaded at */ - -.Lbss_start = .-.LCTOC1 - .long __bss_start - -.Lend = .-.LCTOC1 - .long _end - -.Lstack = .-.LCTOC1 /* stack address if set by user */ - .long __stack - - .text -.Lptr: - .long .LCTOC1-.Laddr - - .globl _start - .type _start,@function -_start: - bl .Laddr /* get current address */ -.Laddr: - mflr r4 /* real address of .Laddr */ - lwz r5,(.Lptr-.Laddr)(r4) /* linker generated address of .LCTOC1 */ - add r5,r5,r4 /* correct to real pointer */ - lwz r4,.Ltable(r5) /* get linker's idea of where .Laddr is */ - subf r4,r4,r5 /* calculate difference between where linked and current */ - - /* clear bss */ - lwz r6,.Lbss_start(r5) /* calculate beginning of the BSS */ - lwz r7,.Lend(r5) /* calculate end of the BSS */ - add r6,r6,r4 /* adjust pointers */ - add r7,r7,r4 - - cmplw 1,r6,r7 - bc 4,4,.Ldone - - subf r8,r6,r7 /* number of bytes to zero */ - srwi r9,r8,2 /* number of words to zero */ - mtctr r9 - li r0,0 /* zero to clear memory */ - addi r6,r6,-4 /* adjust so we can use stwu */ -.Lloop: - stwu r0,4(r6) /* zero bss */ - bdnz .Lloop - -.Ldone: - - lwz r0,.Lstack(r5) /* stack address or 0 */ - cmplwi 1,r0,0 /* equal to 0? */ - bc 12,6,.Lnostack /* use default stack if == 0 */ - mr sp,r0 /* use user defined stack */ - -.Lnostack: - /* set up initial stack frame */ - addi sp,sp,-4 /* make sure we don't overwrite debug mem */ - lis r0,0 - stw r0,0(sp) /* clear back chain */ - stwu sp,-56(sp) /* push another stack frame */ - - /* Let her rip */ - bl FUNC_NAME(boot_card) - - /* return value from boot_card is argument to exit */ - bl FUNC_NAME(exit) - trap -.Lstart: - .size _start,.Lstart-_start diff --git a/c/src/lib/libbsp/sh/gensh1/start/Makefile.in b/c/src/lib/libbsp/sh/gensh1/start/Makefile.in deleted file mode 100644 index b5d382a468..0000000000 --- a/c/src/lib/libbsp/sh/gensh1/start/Makefile.in +++ /dev/null @@ -1,59 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH=@srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -PGMS=${ARCH}/start.o - -# C source names, if any, go here -- minus the .c -C_PIECES= -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -# Assembly source names, if any, go here -- minus the .s -S_PIECES=start -S_FILES=$(S_PIECES:%=%.s) -S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o) - -SRCS=$(C_FILES) $(H_FILES) $(S_FILES) -OBJS=$(C_O_FILES) $(S_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# force optimization, unless start.o will not work -# CFLAGS_PROFILE= -# CFLAGS_DEBUG=-O3 -# CFLAGS_OPTIMIZE=-O3 - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -all: ${ARCH} $(SRCS) $(OBJS) $(PGM) - $(INSTALL_VARIANT) -m 555 ${PGMS} ${PROJECT_RELEASE}/lib diff --git a/c/src/lib/libbsp/shared/console.c b/c/src/lib/libbsp/shared/console.c deleted file mode 100644 index 60ced47ddf..0000000000 --- a/c/src/lib/libbsp/shared/console.c +++ /dev/null @@ -1,291 +0,0 @@ -/* - * This file contains the TTY driver for the PPCn_60x - * - * This driver uses the termios pseudo driver. - * - * COPYRIGHT (c) 1998 by Radstone Technology - * - * - * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY - * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK - * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. - * - * You are hereby granted permission to use, copy, modify, and distribute - * this file, provided that this notice, plus the above copyright notice - * and disclaimer, appears in all copies. Radstone Technology will provide - * no support for this code. - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include <bsp.h> -#include <rtems/libio.h> -#include <stdlib.h> -#include <assert.h> -#include <termios.h> - -#include <libchip/serial.h> - -/* - * Configuration Information - */ - -extern console_data Console_Port_Data[]; -extern unsigned long Console_Port_Count; -extern rtems_device_minor_number Console_Port_Minor; - -/*PAGE - * - * console_open - * - * open a port as a termios console. - * - */ - -rtems_device_driver console_open( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -) -{ - rtems_status_code status; - rtems_libio_open_close_args_t *args = arg; - rtems_libio_ioctl_args_t IoctlArgs; - struct termios Termios; - rtems_termios_callbacks Callbacks; - console_tbl *cptr; - - /* - * Verify the port number is valid. - */ - if ( minor > Console_Port_Count ) { - return RTEMS_INVALID_NUMBER; - } - - /* - * Open the port as a termios console driver. - */ - - cptr = &Console_Port_Tbl[minor]; - Callbacks.firstOpen = cptr->pDeviceFns->deviceFirstOpen; - Callbacks.lastClose = cptr->pDeviceFns->deviceLastClose; - Callbacks.pollRead = cptr->pDeviceFns->deviceRead; - Callbacks.write = cptr->pDeviceFns->deviceWrite; - Callbacks.setAttributes = cptr->pDeviceFns->deviceSetAttributes; - Callbacks.stopRemoteTx = cptr->pDeviceFlow->deviceStopRemoteTx; - Callbacks.startRemoteTx = cptr->pDeviceFlow->deviceStartRemoteTx; - Callbacks.outputUsesInterrupts = cptr->pDeviceFns->deviceOutputUsesInterrupts; - - /* XXX what about - * Console_Port_Tbl[minor].ulMargin, - * Console_Port_Tbl[minor].ulHysteresis); - */ - - status = rtems_termios_open ( major, minor, arg, &Callbacks ); - Console_Port_Data[minor].termios_data = args->iop->data1; - - if (minor!=Console_Port_Minor) { - /* - * If this is not the console we do not want ECHO and - * so forth - */ - IoctlArgs.iop=args->iop; - IoctlArgs.command=RTEMS_IO_GET_ATTRIBUTES; - IoctlArgs.buffer=&Termios; - rtems_termios_ioctl(&IoctlArgs); - Termios.c_lflag=ICANON; - IoctlArgs.command=RTEMS_IO_SET_ATTRIBUTES; - rtems_termios_ioctl(&IoctlArgs); - } - - if ( (args->iop->flags&LIBIO_FLAGS_READ) && - Console_Port_Tbl[minor].pDeviceFlow && - Console_Port_Tbl[minor].pDeviceFlow->deviceStartRemoteTx) { - Console_Port_Tbl[minor].pDeviceFlow->deviceStartRemoteTx(minor); - } - - return status; -} - -/*PAGE - * - * console_reserve_resources - * - * This routine uses the termios driver to reserve resources. - */ - -void console_reserve_resources( - rtems_configuration_table *configuration -) -{ - rtems_termios_reserve_resources( configuration, 4 ); -} - - -/*PAGE - * - * console_close - * - * This routine closes a port that has been opened as console. - */ - -rtems_device_driver console_close( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -) -{ - rtems_libio_open_close_args_t *args = arg; - - if ( (args->iop->flags&LIBIO_FLAGS_READ) && - Console_Port_Tbl[minor].pDeviceFlow && - Console_Port_Tbl[minor].pDeviceFlow->deviceStopRemoteTx) { - Console_Port_Tbl[minor].pDeviceFlow->deviceStopRemoteTx(minor); - } - - return rtems_termios_close (arg); -} - -/*PAGE - * - * console_read - * - * This routine uses the termios driver to read a character. - */ - -rtems_device_driver console_read( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -) -{ - return rtems_termios_read (arg); -} - -/*PAGE - * - * console_write - * - * this routine uses the termios driver to write a character. - */ - -rtems_device_driver console_write( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -) -{ - return rtems_termios_write (arg); -} - -/*PAGE - * - * console_control - * - * this routine uses the termios driver to process io - */ - -rtems_device_driver console_control( - rtems_device_major_number major, - rtems_device_minor_number minor, - void * arg -) -{ - return rtems_termios_ioctl (arg); -} - -/*PAGE - * - * console_initialize - * - * Routine called to initialize the console device driver. - */ - -rtems_device_driver console_initialize( - rtems_device_major_number major, - rtems_device_minor_number minor_arg, - void *arg -) -{ - rtems_status_code status; - rtems_device_minor_number minor; - - /* - * initialize the termio interface. - */ - - rtems_termios_initialize(); - - for (minor=0; minor < Console_Port_Count ; minor++) { - /* - * First perform the configuration dependent probe, then the - * device dependent probe - */ - - if ((!Console_Port_Tbl[minor].deviceProbe || - Console_Port_Tbl[minor].deviceProbe(minor)) && - Console_Port_Tbl[minor].pDeviceFns->deviceProbe(minor)) { - /* - * Use this device for the console - */ - break; - } - } - if ( minor == Console_Port_Count ) { - /* - * Failed to find a working device - */ - rtems_fatal_error_occurred(RTEMS_IO_ERROR); - } - - Console_Port_Minor=minor; - - /* - * Register Device Names - */ - status = rtems_io_register_name("/dev/console", major, Console_Port_Minor ); - if (status != RTEMS_SUCCESSFUL) { - rtems_fatal_error_occurred(status); - } - Console_Port_Tbl[minor].pDeviceFns->deviceInitialize(Console_Port_Minor); - - for (minor++;minor<Console_Port_Count;minor++) { - /* - * First perform the configuration dependent probe, then the - * device dependent probe - */ - - if ( (!Console_Port_Tbl[minor].deviceProbe || - Console_Port_Tbl[minor].deviceProbe(minor)) && - Console_Port_Tbl[minor].pDeviceFns->deviceProbe(minor)) { - status = rtems_io_register_name( - Console_Port_Tbl[minor].sDeviceName, - major, - minor ); - if (status != RTEMS_SUCCESSFUL) { - rtems_fatal_error_occurred(status); - } - - /* - * Initialize the hardware device. - */ - - Console_Port_Tbl[minor].pDeviceFns->deviceInitialize(minor); - - } - } - - return RTEMS_SUCCESSFUL; -} - - - diff --git a/c/src/lib/libbsp/shared/tod.c b/c/src/lib/libbsp/shared/tod.c deleted file mode 100644 index b43c7c1c04..0000000000 --- a/c/src/lib/libbsp/shared/tod.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Real Time Clock Driver Wrapper for Libchip - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include <rtems.h> -#include <libchip/rtc.h> - -/* - * Configuration Information - */ - -extern unsigned long RTC_Count; -extern rtems_device_minor_number RTC_Minor; - -int RTC_Present; - -/* - * rtc_initialize - * - * Initialize the RTC driver - */ - -rtems_device_driver rtc_initialize( - rtems_device_major_number major, - rtems_device_minor_number minor_arg, - void *arg -) -{ - rtems_device_minor_number minor; - rtems_status_code status; - - for (minor=0; minor < RTC_Count ; minor++) { - /* - * First perform the configuration dependent probe, then the - * device dependent probe - */ - - if (RTC_Table[minor].deviceProbe && RTC_Table[minor].deviceProbe(minor)) { - /* - * Use this device as the primary RTC - */ - RTC_Minor = minor; - RTC_Present = 1; - break; - } - } - - if ( !RTC_Present ) { - /* - * Failed to find an RTC -- this is not a fatal error. - */ - - return RTEMS_INVALID_NUMBER; - } - - /* - * Register and initialize the primary RTC's - */ - - status = rtems_io_register_name( "/dev/rtc", major, RTC_Minor ); - if (status != RTEMS_SUCCESSFUL) { - rtems_fatal_error_occurred(status); - } - - RTC_Table[minor].pDeviceFns->deviceInitialize( RTC_Minor ); - - /* - * Now initialize any secondary RTC's - */ - - for ( minor++ ; minor<RTC_Count ; minor++) { - /* - * First perform the configuration dependent probe, then the - * device dependent probe - */ - - if (RTC_Table[minor].deviceProbe && RTC_Table[minor].deviceProbe(minor)) { - status = rtems_io_register_name( - RTC_Table[minor].sDeviceName, - major, - minor ); - if (status != RTEMS_SUCCESSFUL) { - rtems_fatal_error_occurred(status); - } - - /* - * Initialize the hardware device. - */ - - RTC_Table[minor].pDeviceFns->deviceInitialize(minor); - - } - } - - return RTEMS_SUCCESSFUL; -} - - -/*PAGE - * - * This routine copies the time from the real time clock to RTEMS - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * Return values: NONE - */ - -void setRealTimeToRTEMS() -{ - rtems_time_of_day rtc_tod; - - if (!RTC_Present) - return; - - RTC_Table[RTC_Minor].pDeviceFns->deviceGetTime(RTC_Minor, &rtc_tod); - rtems_clock_set( &rtc_tod ); -} - -/*PAGE - * - * setRealTimeFromRTEMS - * - * This routine copies the time from RTEMS to the real time clock - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * Return values: NONE - */ - -void setRealTimeFromRTEMS() -{ - rtems_time_of_day rtems_tod; - - if (!RTC_Present) - return; - - rtems_clock_get( RTEMS_CLOCK_GET_TOD, &rtems_tod ); - RTC_Table[RTC_Minor].pDeviceFns->deviceSetTime(RTC_Minor, &rtems_tod); -} - -/*PAGE - * - * getRealTime - * - * This routine reads the current time from the RTC. - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * Return values: NONE - */ - -void getRealTime( - rtems_time_of_day *tod -) -{ - - if (!RTC_Present) - return; - - RTC_Table[RTC_Minor].pDeviceFns->deviceGetTime(RTC_Minor, tod); -} - -/*PAGE - * - * setRealTime - * - * This routine sets the RTC. - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * Return values: NONE - */ - -/* XXX this routine should be part of the public RTEMS interface */ -rtems_boolean _TOD_Validate( rtems_time_of_day *tod ); - -int setRealTime( - rtems_time_of_day *tod -) -{ - - if (!RTC_Present) - return -1; - - if ( !_TOD_Validate(tod) ) - return -1; - - RTC_Table[RTC_Minor].pDeviceFns->deviceSetTime(RTC_Minor, tod); - return 0; -} - - -/*PAGE - * - * checkRealTime - * - * This routine reads the returns the variance betweent the real time and - * rtems time. - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * Return values: - * int The differance between the real time clock and rtems time. - */ - -/* XXX this routine should be part of the public RTEMS interface */ -unsigned32 _TOD_To_seconds( rtems_time_of_day *tod ); - -int checkRealTime() -{ - rtems_time_of_day rtems_tod; - rtems_time_of_day rtc_tod; - unsigned32 rtems_time; - unsigned32 rtc_time; - - if (!RTC_Present) - return -1; - - rtems_clock_get( RTEMS_CLOCK_GET_TOD, &rtems_tod ); - RTC_Table[RTC_Minor].pDeviceFns->deviceGetTime(RTC_Minor, &rtc_tod); - - rtems_time = _TOD_To_seconds( &rtems_tod ); - rtc_time = _TOD_To_seconds( &rtc_tod ); - - return rtems_time - rtc_time; -} - diff --git a/c/src/lib/libbsp/shared/tod.h b/c/src/lib/libbsp/shared/tod.h deleted file mode 100644 index 725211e082..0000000000 --- a/c/src/lib/libbsp/shared/tod.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Real Time Clock (MK48T08) for RTEMS on Score603e - * - * Based on MVME162 TOD by: - * COPYRIGHT (C) 1997 - * by Katsutoshi Shibuya - BU Denken Co.,Ltd. - Sapporo - JAPAN - * ALL RIGHTS RESERVED - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - - -#ifndef TOD_H -#define TOD_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Set the RTC. - */ - -int setRealTime( - rtems_time_of_day *tod -); - -/* - * Get the time from the RTC. - */ - -void getRealTime( - rtems_time_of_day *tod -); - -/* - * Read real time from RTC and set it to RTEMS' clock manager - */ - -void setRealTimeToRTEMS(); - -/* - * Read time from RTEMS' clock manager and set it to RTC - */ - -void setRealTimeFromRTEMS(); - -/* - * Return the difference between RTC and RTEMS' clock manager time in minutes. - * If the difference is greater than 1 day, this returns 9999. - */ - -int checkRealTime(); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/c/src/lib/libbsp/shmdr/shm_driver.h b/c/src/lib/libbsp/shmdr/shm_driver.h deleted file mode 100644 index 8875525983..0000000000 --- a/c/src/lib/libbsp/shmdr/shm_driver.h +++ /dev/null @@ -1,542 +0,0 @@ -/* shm.h - * - * This include file contains all the constants, structures, - * and global variables for this RTEMS based shared memory - * communications interface driver. - * - * Processor board dependencies are in other files. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __SHM_h -#define __SHM_h - -#include <clockdrv.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* The information contained in the Node Status, Locked Queue, and - * Envelope Control Blocks must be maintained in a NEUTRAL format. - * Currently the neutral format may be selected as big or little - * endian by simply defining either NEUTRAL_BIG or NEUTRAL_LITTLE. - * - * It is CRITICAL to note that the neutral format can ONLY be - * changed by modifying this file and recompiling the ENTIRE - * SHM driver including ALL target specific support files. - * - * The following table details the memory contents for the endian - * field of the Node Status Control Block in the various - * data format configurations (data is in hexadecimal): - * - * NEUTRAL NATIVE BYTE 0 BYTE 1 BYTE 2 BYTE 3 - * ======= ====== ====== ====== ====== ====== - * BIG BIG 00 00 00 01 - * BIG LITTLE 10 00 00 00 - * LITTLE BIG 01 00 00 00 - * LITTLE LITTLE 00 00 00 10 - * - * - * NOTE: XXX - * PORTABILITY OF LOCKING INSTRUCTIONS - * =================================== - * The locking mechanism described below is not - * general enough. Where the hardware supports - * it we should use "atomic swap" instructions - * so the values in the lock can be tailored to - * support a CPU with only weak atomic memory - * instructions. There are combinations of - * CPUs with inflexible atomic memory instructions - * which appear to be incompatible. For example, - * the SPARClite instruction uses a byte which is - * 0xFF when locked. The PA-RISC uses 1 to indicate - * locked and 0 when unlocked. These CPUs appear to - * have incompatible lock instructions. But - * they could be used in a heterogenous system - * with does not mix SPARCs and PA-RISCs. For - * example, the i386 and SPARC or i386 and SPARC - * could work together. The bottom line is that - * not every CPU will work together using this - * locking scheme. There are supposed to be - * algorithms to do this without hardware assist - * and one of these should be incorporated into - * the shared memory driver. - * - * The most flexible scheme using the instructions - * of the various CPUs for efficiency would be to use - * "atomic swaps" wherever possible. Make the lock - * and unlock configurable much like BIG vs LITTLE - * endian use of shared memory is now. The values - * of the lock could then reflect the "worst" - * CPU in a system. This still results in mixes - * of CPUs which are incompatible. - * - * The current locking mechanism is based upon the MC68020 - * "tas" instruction which is atomic. All ports to other CPUs - * comply with the restrictive placement of lock bit by this - * instruction. The lock bit is the most significant bit in a - * big-endian rtems_unsigned32. On other processors, the lock is - * typically implemented via an atomic swap or atomic modify - * bits type instruction. - */ - -#define NEUTRAL_BIG - -#ifdef NEUTRAL_BIG -#define SHM_BIG 0x00000001 -#define SHM_LITTLE 0x10000000 -#endif - -#ifdef NEUTRAL_LITTLE -#define SHM_BIG 0x01000000 -#define SHM_LITTLE 0x00000010 -#endif - -/* - * The following are the values used to fill in the lock field. Some CPUs - * are able to write only a single value into field. By making the - * lock and unlock values configurable, CPUs which support "atomic swap" - * instructions can generally be made to work in any heterogeneous - * configuration. However, it is possible for two CPUs to be incompatible - * in regards to the lock field values. This occurs when two CPUs - * which write only a single value to the field are used in a system - * but the two CPUs write different incompatible values. - * - * NOTE: The following is a first attempt at defining values which - * have a chance at working together. The m68k should use - * chk2 instead of tas to be less restrictive. Target endian - * problems (like the Force CPU386 which has (broken) big endian - * view of the VMEbus address space) are not addressed yet. - */ - -#if defined(__i960__) -#define SHM_LOCK_VALUE 0x00000080 -#define SHM_UNLOCK_VALUE 0 -#elif defined(__mc68000__) -#define SHM_LOCK_VALUE 0x80000000 -#define SHM_UNLOCK_VALUE 0 -#define SHM_LOCK_VALUE 0x80000000 -#define SHM_UNLOCK_VALUE 0 -#elif defined(__i386__) -#define SHM_LOCK_VALUE 0x80000000 -#define SHM_UNLOCK_VALUE 0 -#elif defined(__mips__) -#define SHM_LOCK_VALUE 0x80000000 -#define SHM_UNLOCK_VALUE 0 -#elif defined(__hppa__) -#define SHM_LOCK_VALUE 0 -#define SHM_UNLOCK_VALUE 1 -#elif defined(__PPC__) -#define SHM_LOCK_VALUE 1 -#define SHM_UNLOCK_VALUE 0 -#elif defined(__unix__) -#define SHM_LOCK_VALUE 0 -#define SHM_UNLOCK_VALUE 1 -#elif defined(no_cpu) /* for this values are irrelevant */ -#define SHM_LOCK_VALUE 1 -#define SHM_UNLOCK_VALUE 0 -#else -#error "shm.h - no SHM_LOCK_VALUE defined for this CPU architecture" -#endif - -#define Shm_Convert( value ) \ - ((Shm_Configuration->convert) ? \ - (*Shm_Configuration->convert)(value) : (value)) - -/* constants */ - -#define SHM_MASTER 1 /* master initialization node */ -#define SHM_FIRST_NODE 1 - -/* size constants */ - -#define KILOBYTE (1024) -#define MEGABYTE (1024*1024) - -/* inter-node interrupt values */ - -#define NO_INTERRUPT 0 /* used for polled nodes */ -#define BYTE 1 -#define WORD 2 -#define LONG 4 - -/* operational mode constants -- used in SHM Configuration Table */ -#define POLLED_MODE 0 -#define INTR_MODE 1 - -/* error codes */ - -#define NO_ERROR 0 -#define SHM_NO_FREE_PKTS 0xf0000 - -/* null pointers of different types */ - -#define NULL_ENV_CB ((Shm_Envelope_control *) 0) -#define NULL_CONVERT 0 - -/* - * size of stuff before preamble in envelope. - * It must be a constant since we will use it to generate MAX_PACKET_SIZE - */ - -#define SHM_ENVELOPE_PREFIX_OVERHEAD (4 * sizeof(vol_u32)) - -/* - * The following is adjusted so envelopes are MAX_ENVELOPE_SIZE bytes long. - * It must be >= RTEMS_MINIMUM_PACKET_SIZE in mppkt.h. - */ - -#ifndef MAX_ENVELOPE_SIZE -#define MAX_ENVELOPE_SIZE 0x180 -#endif - -#define MAX_PACKET_SIZE (MAX_ENVELOPE_SIZE - \ - SHM_ENVELOPE_PREFIX_OVERHEAD + \ - sizeof(Shm_Envelope_preamble) + \ - sizeof(Shm_Envelope_postamble)) - - -/* constants pertinent to Locked Queue routines */ - -#define LQ_UNLOCKED SHM_UNLOCK_VALUE -#define LQ_LOCKED SHM_LOCK_VALUE - -/* constants related to the Free Envelope Pool */ - -#define FREE_ENV_POOL 0 -#define FREE_ENV_CB (&Shm_Locked_queues[ FREE_ENV_POOL ]) - -/* The following are important when dealing with - * the shared memory communications interface area. - * - * NOTE: The starting address and length of the shared memory - * is defined in a system dependent file. - */ - -#define START_NS_CBS ((void *)Shm_Configuration->base) -#define START_LQ_CBS ((START_NS_CBS) + \ - ( (sizeof (Shm_Node_status_control)) * (Shm_Maximum_nodes + 1) ) ) -#define START_ENVELOPES ( ((void *) START_LQ_CBS) + \ - ( (sizeof (Shm_Locked_queue_Control)) * (Shm_Maximum_nodes + 1) ) ) -#define END_SHMCI_AREA ( (void *) START_ENVELOPES + \ - ( (sizeof (Shm_Envelope_control)) * Shm_Maximum_envelopes ) ) -#define END_SHARED_MEM (START_NS_CBS+Shm_Configuration->length) - -/* macros */ - -#define Shm_Is_master_node() \ - ( SHM_MASTER == Shm_Local_node ) - -#define Shm_Free_envelope( ecb ) \ - Shm_Locked_queue_Add( FREE_ENV_CB, (ecb) ) -#define Shm_Allocate_envelope() \ - Shm_Locked_queue_Get(FREE_ENV_CB) - -#define Shm_Initialize_receive_queue(node) \ - Shm_Locked_queue_Initialize( &Shm_Locked_queues[node], node ) - -#define Shm_Append_to_receive_queue(node, ecb) \ - Shm_Locked_queue_Add( &Shm_Locked_queues[node], (ecb) ) - -#define Shm_Envelope_control_to_packet_prefix_pointer(ecb) \ - ((void *)(ecb)->packet) - -#define Shm_Packet_prefix_to_envelope_control_pointer( pkt ) \ - ((Shm_Envelope_control *)((rtems_unsigned8 *)(pkt) - \ - (sizeof(Shm_Envelope_preamble) + SHM_ENVELOPE_PREFIX_OVERHEAD))) - -#define Shm_Build_preamble(ecb, node) \ - (ecb)->Preamble.endian = Shm_Configuration->format - -#define Shm_Build_postamble( ecb ) - -/* volatile types */ - -typedef volatile rtems_unsigned8 vol_u8; -typedef volatile rtems_unsigned32 vol_u32; - -/* shm control information */ - -struct shm_info { - vol_u32 not_currently_used_0; - vol_u32 not_currently_used_1; - vol_u32 not_currently_used_2; - vol_u32 not_currently_used_3; -}; - -typedef struct { - /*byte start_of_text;*/ - vol_u32 endian; - vol_u32 not_currently_used_0; - vol_u32 not_currently_used_1; - vol_u32 not_currently_used_2; -} Shm_Envelope_preamble; - -typedef struct { -} Shm_Envelope_postamble; - -/* WARNING! If you change this structure, don't forget to change - * SHM_ENVELOPE_PREFIX_OVERHEAD and - * Shm_Packet_prefix_to_envelope_control_pointer() above. - */ - -/* This comment block describes the contents of each field - * of the Envelope Control Block: - * - * next - The index of the next envelope on this queue. - * queue - The index of the queue this envelope is on. - * index - The index of this envelope. - * Preamble - Generic packet preamble. One day this structure - * could be enhanced to contain routing information. - * packet - RTEMS MPCI packet. Untouched by SHM Driver - * other than copying and format conversion as - * documented in the RTEMS User's Guide. - * Postamble - Generic packet postamble. One day this structure - * could be enhanced to contain checksum information. - */ - -typedef struct { - vol_u32 next; /* next envelope on queue */ - vol_u32 queue; /* queue on which this resides */ - vol_u32 index; /* index into array of envelopes*/ - vol_u32 pad0; /* insure the next one is aligned */ - Shm_Envelope_preamble Preamble; /* header information */ - vol_u8 packet[MAX_PACKET_SIZE]; /* RTEMS INFO */ - Shm_Envelope_postamble Postamble;/* trailer information */ -} Shm_Envelope_control; - -/* This comment block describes the contents of each field - * of the Locked Queue Control Block: - * - * lock - Lock used to insure mutually exclusive access. - * front - Index of first envelope on queue. This field - * is used to remove head of queue (receive). - * rear - Index of last envelope on queue. This field - * is used to add evelope to queue (send). - * owner - The node number of the recipient (owning) node. - * RTEMS does not use the node number zero (0). - * The zero node is used by the SHM Driver for the - * Free Envelope Queue shared by all nodes. - */ - -typedef struct { - vol_u32 lock; /* lock field for this queue */ - vol_u32 front; /* first envelope on queue */ - vol_u32 rear; /* last envelope on queue */ - vol_u32 owner; /* receiving (i.e. owning) node */ -} Shm_Locked_queue_Control; - -/* This comment block describes the contents of each field - * of the Node Status Control Block: - * - * status - Node status. Current values are Pending Initialization, - * Initialization Complete, and Active Node. Other values - * could be added to enhance fault tolerance. - * error - Zero if the node has not failed. Otherwise, - * this field contains a status indicating the - * failure reason. - * int_address, int_value, and int_length - * - These field are the Interrupt Information table - * for this node in neutral format. This is how - * each node knows how to generate interrupts. - */ - -typedef struct { - vol_u32 status; /* node status information */ - vol_u32 error; /* fatal error code */ - vol_u32 int_address; /* write here for interrupt */ - vol_u32 int_value; /* this value causes interrupt */ - vol_u32 int_length; /* for this length (0,1,2,4) */ - vol_u32 not_currently_used_0; - vol_u32 not_currently_used_1; - vol_u32 not_currently_used_2; -} Shm_Node_status_control; - -/* This comment block describes the contents of each field - * of the Interrupt Information Table. This table describes - * how another node can generate an interrupt to this node. - * This information is target board dependent. If the - * SHM Driver is in POLLED_MODE, then all fields should - * be initialized to NO_INTERRUPT. - * - * address - The address to which another node should - * write to cause an interrupt. - * value - The value which must be written - * length - The size of the value to write. Valid - * values are BYTE, WORD, and LONG. - * - * NOTE: The Node Status Control Block contains this - * information in neutral format and not in a - * structure to avoid potential alignment problems. - */ - -typedef struct { - vol_u32 *address; /* write here for interrupt */ - vol_u32 value; /* this value causes interrupt */ - vol_u32 length; /* for this length (0,1,2,4) */ -} Shm_Interrupt_information; - -/* SHM Configuration Table - * - * This comment block describes the contents of each field - * of the SHM Configuration Table. - * - * base - The base address of the shared memory. This - * address may be specific to this node. - * length - The length of the shared memory in bytes. - * format - The natural format for rtems_unsigned32's in the - * shared memory. Valid values are currently - * only SHM_LITTLE and SHM_BIG. - * convert - The address of the routine which converts - * between neutral and local format. - * poll_intr - The operational mode of the driver. Some - * target boards may not provide hardware for - * an interprocessor interrupt. If POLLED_MODE - * is selected, the SHM driver will install a - * wrapper around the Clock_isr() to poll for - * incoming packets. Throughput is dependent - * on the time between clock interrupts. - * Valid values are POLLED_MODE and INTR_MODE. - * cause_intr - This is the address of the routine used to - * write to a particular address and cause an - * interrupt on another node. This routine - * may need to be target dependent if something - * other than a normal write from C does not work. - * Intr - This structure describes the operation required - * to cause an interrupt to this node. The actual - * contents of this structure are described above. - */ - -struct shm_config_info { - vol_u32 *base; /* base address of SHM */ - vol_u32 length; /* length (in bytes) of SHM */ - vol_u32 format; /* SHM is big or little endian */ - vol_u32 (*convert)();/* neutral conversion routine */ - vol_u32 poll_intr;/* POLLED or INTR driven mode */ - void (*cause_intr)( rtems_unsigned32 ); - Shm_Interrupt_information Intr; /* cause intr information */ -}; - -typedef struct shm_config_info shm_config_table; - -/* global variables */ - -#ifdef _SHM_INIT -#define SHM_EXTERN -#else -#define SHM_EXTERN extern -#endif - -SHM_EXTERN shm_config_table *Shm_Configuration; -SHM_EXTERN Shm_Interrupt_information *Shm_Interrupt_table; -SHM_EXTERN Shm_Node_status_control *Shm_Node_statuses; -SHM_EXTERN Shm_Locked_queue_Control *Shm_Locked_queues; -SHM_EXTERN Shm_Envelope_control *Shm_Envelopes; -SHM_EXTERN rtems_configuration_table *Shm_RTEMS_Configuration; -SHM_EXTERN rtems_multiprocessing_table *Shm_RTEMS_MP_Configuration; -SHM_EXTERN rtems_unsigned32 Shm_Receive_message_count; -SHM_EXTERN rtems_unsigned32 Shm_Null_message_count; -SHM_EXTERN rtems_unsigned32 Shm_Interrupt_count; -SHM_EXTERN rtems_unsigned32 Shm_Local_node; -SHM_EXTERN Shm_Locked_queue_Control *Shm_Local_receive_queue; -SHM_EXTERN Shm_Node_status_control *Shm_Local_node_status; -SHM_EXTERN rtems_unsigned32 Shm_isrstat; - /* reported by shmdr */ - -SHM_EXTERN rtems_unsigned32 Shm_Pending_initialization; -SHM_EXTERN rtems_unsigned32 Shm_Initialization_complete; -SHM_EXTERN rtems_unsigned32 Shm_Active_node; - -SHM_EXTERN rtems_unsigned32 Shm_Maximum_nodes; -SHM_EXTERN rtems_unsigned32 Shm_Maximum_envelopes; - -SHM_EXTERN rtems_unsigned32 Shm_Locked_queue_End_of_list; -SHM_EXTERN rtems_unsigned32 Shm_Locked_queue_Not_on_list; - -/* functions */ - -/* locked queue routines */ -void Shm_Locked_queue_Add( - Shm_Locked_queue_Control *, Shm_Envelope_control * ); -Shm_Envelope_control *Shm_Locked_queue_Get( Shm_Locked_queue_Control * ); -void Shm_Locked_queue_Initialize( - Shm_Locked_queue_Control *, rtems_unsigned32 ); - /* Shm_Initialize_lock is CPU dependent */ - /* Shm_Lock is CPU dependent */ - /* Shm_Unlock is CPU dependent */ - -/* portable routines */ -void Init_env_pool(); -void Shm_Print_statistics( void ); -void MPCI_Fatal( Internal_errors_Source, boolean, rtems_unsigned32 ); -rtems_task Shm_Cause_interrupt( rtems_unsigned32 ); -void Shm_Poll(); -void Shm_setclockvec(); -void Shm_Convert_packet( rtems_packet_prefix * ); - -/* CPU specific routines are inlined in shmcpu.h */ - -/* target specific routines */ -void *Shm_Convert_address( void * ); -void Shm_Get_configuration( rtems_unsigned32, shm_config_table ** ); -void Shm_isr(); -void Shm_setvec( void ); - -void Shm_Initialize_lock( Shm_Locked_queue_Control * ); -void Shm_Lock( Shm_Locked_queue_Control * ); -void Shm_Unlock( Shm_Locked_queue_Control * ); - -/* MPCI entry points */ -rtems_mpci_entry Shm_Get_packet( - rtems_packet_prefix ** -); - -rtems_mpci_entry Shm_Initialization( void ); - -rtems_mpci_entry Shm_Receive_packet( - rtems_packet_prefix ** -); - -rtems_mpci_entry Shm_Return_packet( - rtems_packet_prefix * -); - -rtems_mpci_entry Shm_Send_packet( - rtems_unsigned32, - rtems_packet_prefix * -); - -extern rtems_mpci_table MPCI_table; - -#ifdef _SHM_INIT - -/* multiprocessor communications interface (MPCI) table */ - -rtems_mpci_table MPCI_table = { - 100000, /* default timeout value in ticks */ - MAX_PACKET_SIZE, /* maximum packet size */ - Shm_Initialization, /* initialization procedure */ - Shm_Get_packet, /* get packet procedure */ - Shm_Return_packet, /* return packet procedure */ - Shm_Send_packet, /* packet send procedure */ - Shm_Receive_packet /* packet receive procedure */ -}; - -#endif - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/c/src/lib/libbsp/sparc/erc32/start/Makefile.in b/c/src/lib/libbsp/sparc/erc32/start/Makefile.in deleted file mode 100644 index dbc9cea9e3..0000000000 --- a/c/src/lib/libbsp/sparc/erc32/start/Makefile.in +++ /dev/null @@ -1,54 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -PGMS=${ARCH}/startsis.o - -# C source names, if any, go here -- minus the .c -C_PIECES= -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -H_FILES= - -# Assembly source names, if any, go here -- minus the .s -S_PIECES=startsis -S_FILES=$(S_PIECES:%=%.s) -S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o) - -SRCS=$(C_FILES) $(CC_FILES) $(H_FILES) $(S_FILES) -OBJS=$(C_O_FILES) $(CC_O_FILES) $(S_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/leaf.cfg - -# -# (OPTIONAL) Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += - -LD_PATHS += -LD_LIBS += -LDFLAGS += - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += -CLOBBER_ADDITIONS += - -all: ${ARCH} $(SRCS) $(OBJS) $(PGM) - $(INSTALL_VARIANT) -m 555 ${PGMS} ${PROJECT_RELEASE}/lib diff --git a/c/src/lib/libbsp/sparc/erc32/start/startsis.s b/c/src/lib/libbsp/sparc/erc32/start/startsis.s deleted file mode 100644 index 6097c4ab36..0000000000 --- a/c/src/lib/libbsp/sparc/erc32/start/startsis.s +++ /dev/null @@ -1,309 +0,0 @@ -/* - * startsis.s - * - * Start code for the ERC32. - * - * This is based on the file srt0.s provided with the binary - * distribution of the SPARC Instruction Simulator (SIS) found - * at ftp://ftp.estec.esa.nl/pub/ws/wsd/erc32. - * - * $Id$ - */ - -#include <asm.h> -#include <erc32.h> - -/* - * Unexpected trap will halt the processor by forcing it to error state - */ - -#define BAD_TRAP \ - ta 0; \ - nop; \ - nop; \ - nop; - -/* - * Software trap. Treat as BAD_TRAP for the time being... - */ - -#define SOFT_TRAP BAD_TRAP - - - .seg "text" - PUBLIC(start) - .global start - -SYM(start): -start: - -/* - * The trap table has to be the first code in a boot PROM. But because - * the Memory Configuration comes up thinking we only have 4K of PROM, we - * cannot have a full trap table and still have room left over to - * reprogram the Memory Configuration register correctly. This file - * uses an abbreviated trap which has every entry which might be used - * before RTEMS installs its own trap table. - */ - - - PUBLIC(trap_table) -SYM(trap_table): - - RTRAP( 0, SYM(hard_reset) ); ! 00 reset trap - BAD_TRAP; ! 01 instruction access - ! exception - BAD_TRAP; ! 02 illegal instruction - BAD_TRAP; ! 03 privileged instruction - BAD_TRAP; ! 04 fp disabled - TRAP( 5, SYM(window_overflow_trap_handler) ); ! 05 window overflow - TRAP( 6, SYM(window_underflow_trap_handler) );! 06 window underflow - BAD_TRAP; ! 07 memory address not aligned - BAD_TRAP; ! 08 fp exception - BAD_TRAP; ! 09 data access exception - BAD_TRAP; ! 0A tag overflow - BAD_TRAP; ! 0B undefined - BAD_TRAP; ! 0C undefined - BAD_TRAP; ! 0D undefined - BAD_TRAP; ! 0E undefined - BAD_TRAP; ! 0F undefined - BAD_TRAP; ! 10 undefined - - /* - * ERC32 defined traps - */ - - BAD_TRAP; ! 11 masked errors - BAD_TRAP; ! 12 external 1 - BAD_TRAP; ! 13 external 2 - BAD_TRAP; ! 14 UART A RX/TX - BAD_TRAP; ! 15 UART B RX/TX - BAD_TRAP; ! 16 correctable memory error - BAD_TRAP; ! 17 UART error - BAD_TRAP; ! 18 DMA access error - BAD_TRAP; ! 19 DMA timeout - BAD_TRAP; ! 1A external 3 - BAD_TRAP; ! 1B external 4 - BAD_TRAP; ! 1C general purpose timer - BAD_TRAP; ! 1D real time clock - BAD_TRAP; ! 1E external 5 - BAD_TRAP; ! 1F watchdog timeout - - - BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 20 - 23 undefined - BAD_TRAP; ! 24 cp_disabled - BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 25 - 27 undefined - BAD_TRAP; ! 28 cp_exception - BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 29 - 2B undefined - BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 2C - 2F undefined - BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 30 - 33 undefined - BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 34 - 37 undefined - BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 38 - 3B undefined - BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 3C - 3F undefined - BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 40 - 43 undefined - BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 44 - 47 undefined - BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 48 - 4B undefined - BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 4C - 4F undefined - BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 50 - 53 undefined - BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 54 - 57 undefined - BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 58 - 5B undefined - BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 5C - 5F undefined - BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 60 - 63 undefined - BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 64 - 67 undefined - BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 68 - 6B undefined - BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 6C - 6F undefined - BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 70 - 73 undefined - BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 74 - 77 undefined - BAD_TRAP; BAD_TRAP; BAD_TRAP; BAD_TRAP; ! 78 - 7B undefined - -/* - This is a sad patch to make sure that we know where the - MEC timer control register mirror is so we can stop the timers - from an external debugger. It is needed because the control - register is write-only. Trap 0x7C cannot occure in ERC32... - - We also use this location to store the last location of the - usable RAM in order not to overwrite the remote debugger with - the RTEMS work-space area. - -*/ - - .global __ERC32_MEC_Timer_Control_Mirror, _rdb_start, _CLOCK_SPEED - -_rdb_start: -__ERC32_MEC_Timer_Control_Mirror: - - BAD_TRAP; BAD_TRAP; ! 7C - 7D undefined - -_CLOCK_SPEED: - BAD_TRAP; BAD_TRAP; ! BAD_TRAP; BAD_TRAP; ! 7E - 7F undefined - - /* - * Software traps - * - * NOTE: At the risk of being redundant... this is not a full - * table. The setjmp on the SPARC requires a window flush trap - * handler and RTEMS will preserve the entries that were - * installed before. - */ - - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! 80 - 82 - TRAP( 0x83, SYM(window_flush_trap_handler) ); ! 83 flush windows SW trap - - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! 84 - 87 - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! 88 - 8B - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! 8C - 8F - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! 90 - 93 - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! 94 - 97 - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! 98 - 9B - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! 9C - 9F - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! A0 - A3 - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! A4 - A7 - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! A8 - AB - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! AC - AF - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! B0 - B3 - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! B4 - B7 - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! B8 - BB - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! BC - BF - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! C0 - C3 - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! C4 - C7 - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! C8 - CB - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! CC - CF - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! D0 - D3 - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! D4 - D7 - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! D8 - DB - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! DC - DF - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! E0 - E3 - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! E4 - E7 - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! E8 - EB - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! EC - EF - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! F0 - F3 - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! F4 - F7 - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! F8 - FB - SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; SOFT_TRAP; ! FC - FF - -/* - * This is the hard reset code. - */ - -#define PSR_INIT 0x10c0 /* Disable traps, set s and ps */ -#define WIM_INIT 2 -#define STACK_SIZE 16 * 1024 - - PUBLIC(hard_reset) -SYM(hard_reset): - - set _trap_table, %g1 ! Initialize TBR - mov %g1, %tbr - - set (SYM(rdb_start)), %g6 ! End of work-space area - st %sp, [%g6] - - -/* Check if MEC is initialised. If not, this means that we are - running on the simulator. Initiate some of the parameters - that are done by the boot-prom otherwise. -*/ - - set SYM(ERC32_MEC), %g3 ! g3 = base address of peripherals - ld [%g3], %g2 - set 0xfe080000, %g1 - andcc %g1, %g2, %g0 - bne 1f - set 0x00101000, %g1 ! 2M ROM, 4M RAM - ! set the Memory Configuration - st %g1, [ %g3 + ERC32_MEC_MEMORY_CONFIGURATION_OFFSET ] - - set SYM(RAM_END), %sp ! End of work-space area - st %sp, [%g6] - - set _CLOCK_SPEED, %g6 ! Use 14 MHz in simulator - set 14, %g1 - st %g1, [%g6] - -/* Common initialisation */ -1: - set WIM_INIT, %g1 ! Initialize WIM - mov %g1, %wim - - set PSR_INIT, %g1 - wr %g1, 0x20, %psr ! enable traps - - nop - nop - nop - - sethi %hi(stack_space + STACK_SIZE), %g1 - or %g1,%lo(stack_space + STACK_SIZE),%g1 - ! g1 = top of stack - mov %g1, %sp ! Set stack pointer - mov %sp, %fp ! Set frame pointer - nop - - /* - * Copy the initialized data to RAM - * - * FROM: _endtext - * TO: _data_start - * LENGTH: (__bss_start - _data_start) bytes - */ - - - sethi %hi(_endtext),%g2 - or %g2,%lo(_endtext),%g2 ! g2 = start of initialized data in ROM - - sethi %hi(_data_start),%g3 - or %g3,%lo(_data_start),%g3 ! g3 = start of initialized data in RAM - - sethi %hi(__bss_start),%g4 - or %g4,%lo(__bss_start),%g4 ! g4 = end of initialized data in RAM - - cmp %g2, %g3 - be 1f - nop - -copy_data: - ldd [ %g2 ], %g6 - std %g6 , [ %g3 ] ! copy this double word - add %g3, 8, %g3 ! bump the destination pointer - add %g2, 8, %g2 ! bump the source pointer - cmp %g3, %g4 ! Is the pointer past the end of dest? - bl copy_data - nop - - /* clear the bss */ -1: - - sethi %hi(_edata),%g2 - or %g2,%lo(_edata),%g2 ! g2 = start of bss - sethi %hi(_end),%g3 - or %g3,%lo(_end),%g3 ! g3 = end of bss - mov %g0,%g1 ! so std has two zeros -zerobss: - std %g0,[%g2] - add %g2,8,%g2 - cmp %g2,%g3 - bleu,a zerobss - nop - - mov %0, %o2 ! environ - mov %0, %o1 ! argv - mov %0, %o0 ! argc - call SYM(boot_card) - sub %sp, 0x60, %sp ! room for boot_card to save args - nop - - PUBLIC(BSP_fatal_return) -SYM(BSP_fatal_return): - ta 0 ! Halt if _main returns ... - nop - - /* - * There does not seem to be a way to get this aligned AND - * in the BSS. - */ - - .align 32 - .comm stack_space, STACK_SIZE - -/* end of file */ diff --git a/c/src/lib/libc/assoc.c b/c/src/lib/libc/assoc.c deleted file mode 100644 index 74387a8c5b..0000000000 --- a/c/src/lib/libc/assoc.c +++ /dev/null @@ -1,260 +0,0 @@ -/* - * assoc.c - * rtems assoc routines - * - * $Id$ - */ - -#include <rtems.h> -#include "assoc.h" - -#include <stdio.h> /* sprintf */ -#include <string.h> /* strcat, strcmp */ - -#define STREQ(a,b) (strcmp((a), (b)) == 0) -#define rtems_assoc_is_default(ap) ((ap)->name && STREQ(ap->name, RTEMS_ASSOC_DEFAULT_NAME)) - -const rtems_assoc_t * -rtems_assoc_ptr_by_name( - const rtems_assoc_t *ap, - const char *name - ) -{ - const rtems_assoc_t *default_ap = 0; - - if (rtems_assoc_is_default(ap)) - default_ap = ap++; - - for ( ; ap->name; ap++) - if (strcmp(ap->name, name) == 0) - return ap; - - return default_ap; -} - -const rtems_assoc_t * -rtems_assoc_ptr_by_local( - const rtems_assoc_t *ap, - unsigned32 local_value - ) -{ - const rtems_assoc_t *default_ap = 0; - - if (rtems_assoc_is_default(ap)) - default_ap = ap++; - - for ( ; ap->name; ap++) - if (ap->local_value == local_value) - return ap; - - return default_ap; -} - - -const rtems_assoc_t * -rtems_assoc_ptr_by_remote( - const rtems_assoc_t *ap, - unsigned32 remote_value - ) -{ - const rtems_assoc_t *default_ap = 0; - - if (rtems_assoc_is_default(ap)) - default_ap = ap++; - - for ( ; ap->name; ap++) - if (ap->remote_value == remote_value) - return ap; - - return default_ap; -} - - -/* - * Get values - */ - -unsigned32 -rtems_assoc_remote_by_local( - const rtems_assoc_t *ap, - unsigned32 local_value - ) -{ - const rtems_assoc_t *nap; - nap = rtems_assoc_ptr_by_local(ap, local_value); - if (nap) - return nap->remote_value; - - return 0; -} - -unsigned32 -rtems_assoc_local_by_remote( - const rtems_assoc_t *ap, - unsigned32 remote_value - ) -{ - const rtems_assoc_t *nap; - nap = rtems_assoc_ptr_by_remote(ap, remote_value); - if (nap) - return nap->local_value; - - return 0; -} - -unsigned32 -rtems_assoc_remote_by_name( - const rtems_assoc_t *ap, - const char *name - ) -{ - const rtems_assoc_t *nap; - nap = rtems_assoc_ptr_by_name(ap, name); - if (nap) - return nap->remote_value; - - return 0; -} - -unsigned32 -rtems_assoc_local_by_name( - const rtems_assoc_t *ap, - const char *name - ) -{ - const rtems_assoc_t *nap; - nap = rtems_assoc_ptr_by_name(ap, name); - if (nap) - return nap->local_value; - - return 0; -} - -/* - * what to return if a value is not found - * this is not reentrant, but it really shouldn't be invoked anyway - */ - -const char * -rtems_assoc_name_bad( - unsigned32 bad_value -) -{ -#ifdef RTEMS_DEBUG - static char bad_buffer[32]; - - sprintf(bad_buffer, "< %d [0x%x] >", bad_value, bad_value); -#else - static char bad_buffer[32] = "<assoc.c: BAD NAME>"; -#endif - return bad_buffer; -} - - -const char * -rtems_assoc_name_by_local( - const rtems_assoc_t *ap, - unsigned32 local_value - ) -{ - const rtems_assoc_t *nap; - nap = rtems_assoc_ptr_by_local(ap, local_value); - if (nap) - return nap->name; - - return rtems_assoc_name_bad(local_value); -} - -const char * -rtems_assoc_name_by_remote( - const rtems_assoc_t *ap, - unsigned32 remote_value - ) -{ - const rtems_assoc_t *nap; - nap = rtems_assoc_ptr_by_remote(ap, remote_value); - if (nap) - return nap->name; - - return rtems_assoc_name_bad(remote_value); -} - -/* - * Bitfield functions assume just 1 bit set in each of remote and local - * entries; they do not check for this. - */ - -unsigned32 rtems_assoc_remote_by_local_bitfield( - const rtems_assoc_t *ap, - unsigned32 local_value - ) -{ - unsigned32 b; - unsigned32 remote_value = 0; - - for (b = 1; b; b <<= 1) - if (b & local_value) - remote_value |= rtems_assoc_remote_by_local(ap, b); - - return remote_value; -} - - -unsigned32 rtems_assoc_local_by_remote_bitfield( - const rtems_assoc_t *ap, - unsigned32 remote_value - ) -{ - unsigned32 b; - unsigned32 local_value = 0; - - for (b = 1; b; b <<= 1) - if (b & remote_value) - local_value |= rtems_assoc_local_by_remote(ap, b); - - return local_value; -} - -char * -rtems_assoc_name_by_remote_bitfield( - const rtems_assoc_t *ap, - unsigned32 value, - char *buffer - ) -{ - unsigned32 b; - - *buffer = 0; - - for (b = 1; b; b <<= 1) - if (b & value) - { - if (*buffer) - strcat(buffer, " "); - strcat(buffer, rtems_assoc_name_by_remote(ap, b)); - } - - return buffer; -} - -char * -rtems_assoc_name_by_local_bitfield( - const rtems_assoc_t *ap, - unsigned32 value, - char *buffer - ) -{ - unsigned32 b; - - *buffer = 0; - - for (b = 1; b; b <<= 1) - if (b & value) - { - if (*buffer) - strcat(buffer, " "); - strcat(buffer, rtems_assoc_name_by_local(ap, b)); - } - - return buffer; -} diff --git a/c/src/lib/libc/assoc.h b/c/src/lib/libc/assoc.h deleted file mode 100644 index 1982d654ac..0000000000 --- a/c/src/lib/libc/assoc.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * - * Rtems associativity routines. Mainly used to convert a value from - * one space to another (eg: our errno's to host errno's and v.v) - * - * - * $Id$ - */ - -#ifndef _INCLUDE_ASSOC_H -#define _INCLUDE_ASSOC_H - -typedef struct { - const char *name; - unsigned32 local_value; - unsigned32 remote_value; -} rtems_assoc_t; - -/* - * Flag/marker for optional default value in each table - */ - -#define RTEMS_ASSOC_DEFAULT_NAME "(default)" - -const rtems_assoc_t *rtems_assoc_ptr_by_name(const rtems_assoc_t *, const char *); -const rtems_assoc_t *rtems_assoc_ptr_by_value(const rtems_assoc_t *, unsigned32); -const rtems_assoc_t *rtems_assoc_ptr_by_remote(const rtems_assoc_t *, unsigned32); - -unsigned32 rtems_assoc_remote_by_local(const rtems_assoc_t *, unsigned32); -unsigned32 rtems_assoc_local_by_remote(const rtems_assoc_t *, unsigned32); -unsigned32 rtems_assoc_remote_by_name(const rtems_assoc_t *, const char *); -unsigned32 rtems_assoc_local_by_name(const rtems_assoc_t *, const char *); -const char *rtems_assoc_name_by_local(const rtems_assoc_t *, unsigned32); -const char *rtems_assoc_name_by_remote(const rtems_assoc_t *, unsigned32); - -unsigned32 rtems_assoc_remote_by_local_bitfield(const rtems_assoc_t *, unsigned32); -char *rtems_assoc_name_by_local_bitfield(const rtems_assoc_t *, unsigned32, char *); -char *rtems_assoc_name_by_remote_bitfield(const rtems_assoc_t *, unsigned32, char *); -unsigned32 rtems_assoc_local_by_remote_bitfield(const rtems_assoc_t *, unsigned32); - - -#endif /* ! _INCLUDE_ASSOC_H */ diff --git a/c/src/lib/libc/error.c b/c/src/lib/libc/error.c deleted file mode 100644 index dd32fb8b66..0000000000 --- a/c/src/lib/libc/error.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - * report errors and panics to RTEMS' stderr. - * Currently just used by RTEMS monitor. - * - * $Id$ - */ - - -/* - * These routines provide general purpose error reporting. - * rtems_error reports an error to stderr and allows use of - * printf style formatting. A newline is appended to all messages. - * - * error_flag can be specified as any of the following: - * - * RTEMS_ERROR_ERRNO -- include errno text in output - * RTEMS_ERROR_PANIC -- halts local system after output - * RTEMS_ERROR_ABORT -- abort after output - * - * It can also include a rtems_status value which can be OR'd - * with the above flags. * - * - * EXAMPLE - * #include <rtems.h> - * #include <rtems/error.h> - * rtems_error(0, "stray interrupt %d", intr); - * - * EXAMPLE - * if ((status = rtems_task_create(...)) != RTEMS_SUCCCESSFUL) - * { - * rtems_error(status | RTEMS_ERROR_ABORT, - * "could not create task"); - * } - * - * EXAMPLE - * if ((fd = open(pathname, O_RDNLY)) < 0) - * { - * rtems_error(RTEMS_ERROR_ERRNO, "open of '%s' failed", pathname); - * goto failed; - * } - */ - -#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ -#include <rtems.h> - -#include "error.h" -#include <rtems/assoc.h> - -#include <stdio.h> -#include <stdarg.h> -#include <errno.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> /* _exit() */ - -/* bug in hpux <errno.h>: no prototypes unless you are C++ */ -#ifdef hpux9 -char *strerror(int); -#endif - -extern char *rtems_progname; -int rtems_panic_in_progress; - -rtems_assoc_t rtems_status_assoc[] = { - { "successful completion", RTEMS_SUCCESSFUL, }, - { "returned from a thread", RTEMS_TASK_EXITTED, }, - { "multiprocessing not configured", RTEMS_MP_NOT_CONFIGURED, }, - { "invalid object name", RTEMS_INVALID_NAME, }, - { "invalid object id", RTEMS_INVALID_ID, }, - { "too many", RTEMS_TOO_MANY, }, - { "timed out waiting", RTEMS_TIMEOUT, }, - { "object deleted while waiting", RTEMS_OBJECT_WAS_DELETED, }, - { "specified size was invalid", RTEMS_INVALID_SIZE, }, - { "address specified is invalid", RTEMS_INVALID_ADDRESS, }, - { "number was invalid", RTEMS_INVALID_NUMBER, }, - { "item has not been initialized", RTEMS_NOT_DEFINED, }, - { "resources still outstanding", RTEMS_RESOURCE_IN_USE, }, - { "request not satisfied", RTEMS_UNSATISFIED, }, - { "thread is in wrong state", RTEMS_INCORRECT_STATE, }, - { "thread already in state", RTEMS_ALREADY_SUSPENDED, }, - { "illegal on calling thread", RTEMS_ILLEGAL_ON_SELF, }, - { "illegal for remote object", RTEMS_ILLEGAL_ON_REMOTE_OBJECT, }, - { "called from wrong environment", RTEMS_CALLED_FROM_ISR, }, - { "invalid thread priority", RTEMS_INVALID_PRIORITY, }, - { "invalid date/time", RTEMS_INVALID_CLOCK, }, - { "invalid node id", RTEMS_INVALID_NODE, }, - { "directive not configured", RTEMS_NOT_CONFIGURED, }, - { "not owner of resource", RTEMS_NOT_OWNER_OF_RESOURCE , }, - { "directive not implemented", RTEMS_NOT_IMPLEMENTED, }, - { "RTEMS inconsistency detected", RTEMS_INTERNAL_ERROR, }, - { "could not get enough memory", RTEMS_NO_MEMORY, }, - { "internal multiprocessing only", THREAD_STATUS_PROXY_BLOCKING, }, - { 0, 0, 0 }, -}; - - -const char * -rtems_status_text( - rtems_status_code status -) -{ - return rtems_assoc_name_by_local(rtems_status_assoc, status); -} - - -static int rtems_verror( - unsigned32 error_flag, - const char *printf_format, - va_list arglist -) -{ - int local_errno = 0; - int chars_written = 0; - rtems_status_code status; - - if (error_flag & RTEMS_ERROR_PANIC) - { - if (rtems_panic_in_progress++) - _Thread_Disable_dispatch(); /* disable task switches */ - - /* don't aggravate things */ - if (rtems_panic_in_progress > 2) - return 0; - } - - (void) fflush(stdout); /* in case stdout/stderr same */ - - status = error_flag & ~RTEMS_ERROR_MASK; - if (error_flag & RTEMS_ERROR_ERRNO) /* include errno? */ - local_errno = errno; - - if (_System_state_Is_multiprocessing) - fprintf(stderr, "[%d] ", _Configuration_MP_table->node); - - if (rtems_progname && *rtems_progname) - chars_written += fprintf(stderr, "%s: ", rtems_progname); - chars_written += vfprintf(stderr, printf_format, arglist); - - if (status) - chars_written += fprintf(stderr, " (status: %s)", rtems_status_text(status)); - - if (local_errno) - { - if ((local_errno > 0) && *strerror(local_errno)) - chars_written += fprintf(stderr, " (errno: %s)", strerror(local_errno)); - else - chars_written += fprintf(stderr, " (unknown errno=%d)", local_errno); - } - - chars_written += fprintf(stderr, "\n"); - - (void) fflush(stderr); - - if (error_flag & (RTEMS_ERROR_PANIC | RTEMS_ERROR_ABORT)) - { - if (error_flag & RTEMS_ERROR_PANIC) - { - rtems_error(0, "fatal error, exiting"); - _exit(local_errno); - } - else - { - rtems_error(0, "fatal error, aborting"); - abort(); - } - } - return chars_written; -} - - -/* - * Report an error. - * error_flag is as above; printf_format is a normal - * printf(3) format string, with its concommitant arguments. - * - * Returns the number of characters written. - */ - -int rtems_error( - int error_flag, - const char *printf_format, - ... - ) -{ - va_list arglist; - int chars_written; - - va_start(arglist, printf_format); - chars_written = rtems_verror(error_flag, printf_format, arglist); - va_end(arglist); - - return chars_written; -} - -/* - * rtems_panic is shorthand for rtems_error(RTEMS_ERROR_PANIC, ...) - */ - -void rtems_panic( - const char *printf_format, - ... - ) -{ - va_list arglist; - - va_start(arglist, printf_format); - (void) rtems_verror(RTEMS_ERROR_PANIC, printf_format, arglist); - va_end(arglist); -} diff --git a/c/src/lib/libc/error.h b/c/src/lib/libc/error.h deleted file mode 100644 index a0698afb5d..0000000000 --- a/c/src/lib/libc/error.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Defines and externs for rtems error reporting - * - * $Id$ - */ - -#ifndef __RTEMS_ERROR_h -#define __RTEMS_ERROR_h - -/* - * rtems_error() and rtems_panic() support - */ - -#define RTEMS_ERROR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */ -#define RTEMS_ERROR_PANIC (RTEMS_ERROR_ERRNO / 2) /* err fatal; no return */ -#define RTEMS_ERROR_ABORT (RTEMS_ERROR_ERRNO / 4) /* err is fatal; panic */ - -#define RTEMS_ERROR_MASK (RTEMS_ERROR_ERRNO | RTEMS_ERROR_ABORT | \ - RTEMS_ERROR_PANIC) /* all */ - -const char *rtems_status_text(rtems_status_code); -int rtems_error(int error_code, const char *printf_format, ...); -#ifdef __GNUC__ -void rtems_panic(const char *printf_format, ...); -/* - * We should be able to use this attribute but gcc complains that - * rtems_panic does in fact return. :( - * - * __attribute__ ((__noreturn__)); - */ -#else -void rtems_panic(const char *printf_format, ...); -#endif - -extern int rtems_panic_in_progress; - -#endif -/* end of include file */ diff --git a/c/src/lib/libc/utsname.c b/c/src/lib/libc/utsname.c deleted file mode 100644 index 7fba3d610f..0000000000 --- a/c/src/lib/libc/utsname.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * $Id$ - */ - -#include <stdio.h> -#include <string.h> - -#include <sys/utsname.h> - -#include <rtems/system.h> -#include <rtems/score/system.h> -#include <rtems/score/object.h> - -/*PAGE - * - * 4.4.1 Get System Name, P1003.1b-1993, p. 90 - */ - -int uname( - struct utsname *name -) -{ - /* XXX: Here is what Solaris returns... - sysname = SunOS - nodename = node_name - release = 5.3 - version = Generic_101318-12 - machine = sun4m - */ - - strcpy( name->sysname, "RTEMS" ); - - sprintf( name->nodename, "Node %d\n", _Objects_Local_node ); - - /* XXX release string is in BAD format for this routine!!! */ - strcpy( name->release, "3.2.0" ); - - /* XXX does this have any meaning for RTEMS */ - - strcpy( name->release, "" ); - - sprintf( name->machine, "%s/%s", CPU_NAME, CPU_MODEL_NAME ); - - return 0; -} - -/*PAGE - * - * 4.5.2 Get Process Times, P1003.1b-1993, p. 92 - */ - -clock_t times( - struct tms *buffer -) -{ - return POSIX_NOT_IMPLEMENTED(); -} diff --git a/c/src/lib/libchip/Makefile.in b/c/src/lib/libchip/Makefile.in deleted file mode 100644 index a5144ec02d..0000000000 --- a/c/src/lib/libchip/Makefile.in +++ /dev/null @@ -1,14 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/directory.cfg - -SUB_DIRS=rtc serial diff --git a/c/src/lib/libchip/rtc/Makefile.in b/c/src/lib/libchip/rtc/Makefile.in deleted file mode 100644 index 724a1af380..0000000000 --- a/c/src/lib/libchip/rtc/Makefile.in +++ /dev/null @@ -1,60 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -LIBNAME=librtcio.a -LIB=${ARCH}/${LIBNAME} - -C_PIECES=\ - rtcprobe \ - icm7170 icm7170_reg icm7170_reg2 icm7170_reg4 icm7170_reg8 \ - m48t08 m48t08_reg m48t08_reg2 m48t08_reg4 m48t08_reg8 - -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -INSTALLED_H_FILES=$(srcdir)/rtc.h \ - $(srcdir)/icm7170.h $(srcdir)/m48t08.h - -SRCS=$(C_FILES) $(H_FILES) $(SYS_H_FILES) $(RTEMS_H_FILES) $(PRIVATE_H_FILES) -OBJS=$(C_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/lib.cfg - -# -# Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += $(LIBC_DEFINES) - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += $(LIB) -CLOBBER_ADDITIONS += - -all: ${ARCH} preinstall $(LIB) - $(INSTALL_VARIANT) -m 644 ${LIB} ${PROJECT_RELEASE}/lib - -$(LIB): $(SRCS) ${OBJS} - $(make-library) - -# Install the library, appending _g or _p as appropriate. -# for include files, just use $(INSTALL) -preinstall: - $(INSTALL) -m 444 $(INSTALLED_H_FILES) $(PROJECT_INCLUDE)/libchip - - diff --git a/c/src/lib/libchip/rtc/README.ds1643 b/c/src/lib/libchip/rtc/README.ds1643 deleted file mode 100644 index 4fab5b62c6..0000000000 --- a/c/src/lib/libchip/rtc/README.ds1643 +++ /dev/null @@ -1,7 +0,0 @@ -# -# $Id$ -# - -The Mostek M48T08 is compatible with the Dallas Semiconductor DS1643. Please -use that driver. - diff --git a/c/src/lib/libchip/rtc/README.icm7170 b/c/src/lib/libchip/rtc/README.icm7170 deleted file mode 100644 index de2199339d..0000000000 --- a/c/src/lib/libchip/rtc/README.icm7170 +++ /dev/null @@ -1,52 +0,0 @@ -# -# $Id$ -# - - -Configuration Table Use -======================= - -sDeviceName - - The name of this device. - -deviceType - - This field must be RTC_ICM7170. - -pDeviceFns - - The device interface control table. This must be icm7170_fns. - -deviceProbe - - This is the address of the routine which probes to see if the device - is present. - -pDeviceParams - - This field specifies the clock frequency. It may be one of the - following: - ICM7170_AT_32_KHZ - ICM7170_AT_1_MHZ - ICM7170_AT_2_MHZ - ICM7170_AT_4_MHZ - -ulCtrlPort1 - - This field is the base address of the RTC area of the chip. - -ulCtrlPort2 - - This field is ignored. - -ulDataPort - - This field is ignored. - - -getRegister -setRegister - - These follow standard conventions. - diff --git a/c/src/lib/libchip/rtc/README.m48t08 b/c/src/lib/libchip/rtc/README.m48t08 deleted file mode 100644 index d792d7957e..0000000000 --- a/c/src/lib/libchip/rtc/README.m48t08 +++ /dev/null @@ -1,48 +0,0 @@ -# -# $Id$ -# - - -Configuration Table Use -======================= - -sDeviceName - - The name of this device. - -deviceType - - This field must be RTC_M48T08. - -pDeviceFns - - The device interface control table. This must be m48t08_fns. - -deviceProbe - - This is the address of the routine which probes to see if the device - is present. - -pDeviceParams - - This is ignored and should be NULL. - -ulCtrlPort1 - - This field is the base address of the RTC area of the chip. The - NVRAM portion of the chip is ignored. - -ulCtrlPort2 - - This field is ignored. - -ulDataPort - - This field is ignored. - - -getRegister -setRegister - - These follow standard conventions. - diff --git a/c/src/lib/libchip/rtc/README.m48t18 b/c/src/lib/libchip/rtc/README.m48t18 deleted file mode 100644 index 85fe918f23..0000000000 --- a/c/src/lib/libchip/rtc/README.m48t18 +++ /dev/null @@ -1,5 +0,0 @@ -# -# $Id$ -# - -This is supported by the m48t08 driver. diff --git a/c/src/lib/libchip/rtc/STATUS b/c/src/lib/libchip/rtc/STATUS deleted file mode 100644 index e95a924ae9..0000000000 --- a/c/src/lib/libchip/rtc/STATUS +++ /dev/null @@ -1,37 +0,0 @@ -# -# $Id$ -# - -General -======= - -+ It would be nice to utilize the interrupt capabilities of some - RTC parts. This could be used to trigger checking the software - clock against the hardware clock. - -+ The periodic capability of most RTCs is not suitable for use - as a general purpose flexible clock tick source. For example, - many RTCs generate only a handful of periods with 100 Hz being the - most frequent. - -+ The tick field is not set on get. Anything smaller than a second - is ignored on set and get operations. - -+ Day of week is ignored since RTEMS does not set it internally. - -+ There is no attempt in RTEMS to know about time zones. - -Harris ICM7170 -============== - -+ Tested on a DMV177. - -+ Interrupt capabilities are ignored. - -Mostek 48T08 -============ - -+ Untested. - -+ NVRAM is ignored. - diff --git a/c/src/lib/libchip/rtc/icm7170.c b/c/src/lib/libchip/rtc/icm7170.c deleted file mode 100644 index f3cf513d2e..0000000000 --- a/c/src/lib/libchip/rtc/icm7170.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * This file interfaces with the real-time clock found in - * a Harris ICM7170 - * - * Year 2K Notes: - * - * This chip only uses a two digit field to store the year. This - * code uses the RTEMS Epoch as a pivot year. This lets us map the - * two digit year field as follows: - * - * + two digit years 0-87 are mapped to 2000-2087. - * + two digit years 88-99 are mapped to 1988-1999. - * - * This is less than the time span supported by RTEMS. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include <rtems.h> -#include <libchip/rtc.h> -#include <libchip/icm7170.h> - -/* - * Control register bits - */ - -/* XXX */ - -/* - * icm7170_initialize - */ - -void icm7170_initialize( - int minor -) -{ - unsigned32 icm7170; - setRegister_f setReg; - unsigned32 clock; - - icm7170 = RTC_Table[ minor ].ulCtrlPort1; - setReg = RTC_Table[ minor ].setRegister; - - /* - * Initialize the RTC with the proper clock frequency - */ - - clock = (unsigned32) RTC_Table[ minor ].pDeviceParams; - (*setReg)( icm7170, ICM7170_CONTROL, 0x0c | clock ); -} - -/* - * icm7170_get_time - */ - -int icm7170_get_time( - int minor, - rtems_time_of_day *time -) -{ - unsigned32 icm7170; - getRegister_f getReg; - setRegister_f setReg; - unsigned32 year; - - icm7170 = RTC_Table[ minor ].ulCtrlPort1; - getReg = RTC_Table[ minor ].getRegister; - setReg = RTC_Table[ minor ].setRegister; - - /* - * Put the RTC into read mode - */ - - (void) (*getReg)( icm7170, ICM7170_COUNTER_HUNDREDTHS ); - - /* - * Now get the time - */ - - - year = (*getReg)( icm7170, ICM7170_YEAR ); - if ( year < 88 ) - year += 2000; - else - year += 1900; - - time->year = year; - time->month = (*getReg)( icm7170, ICM7170_MONTH ); - time->day = (*getReg)( icm7170, ICM7170_DATE ); - time->hour = (*getReg)( icm7170, ICM7170_HOUR ); - time->minute = (*getReg)( icm7170, ICM7170_MINUTE ); - time->second = (*getReg)( icm7170, ICM7170_SECOND ); - - time->ticks = 0; - - /* - * Put the RTC back into normal mode. - */ - - (void) (*getReg)( icm7170, ICM7170_COUNTER_HUNDREDTHS ); - - return 0; -} - -/* - * icm7170_set_time - */ - -int icm7170_set_time( - int minor, - rtems_time_of_day *time -) -{ - unsigned32 icm7170; - getRegister_f getReg; - setRegister_f setReg; - unsigned32 year; - unsigned32 clock; - - icm7170 = RTC_Table[ minor ].ulCtrlPort1; - getReg = RTC_Table[ minor ].getRegister; - setReg = RTC_Table[ minor ].setRegister; - clock = (unsigned32) RTC_Table[ minor ].pDeviceParams; - - year = time->year; - - if ( year >= 2088 ) - rtems_fatal_error_occurred( RTEMS_INVALID_NUMBER ); - - if ( year >= 2000 ) - year -= 2000; - else - year -= 1900; - - (*setReg)( icm7170, ICM7170_CONTROL, 0x04 | clock ); - - (*setReg)( icm7170, ICM7170_YEAR, year ); - (*setReg)( icm7170, ICM7170_MONTH, time->month ); - (*setReg)( icm7170, ICM7170_DATE, time->day ); - (*setReg)( icm7170, ICM7170_HOUR, time->hour ); - (*setReg)( icm7170, ICM7170_MINUTE, time->minute ); - (*setReg)( icm7170, ICM7170_SECOND, time->second ); - - /* - * This is not really right. - */ - - (*setReg)( icm7170, ICM7170_DAY_OF_WEEK, 1 ); - - /* - * Put the RTC back into normal mode. - */ - - (*setReg)( icm7170, ICM7170_CONTROL, 0x0c | clock ); - - return 0; -} - -/* - * Driver function table - */ - -rtc_fns icm7170_fns = { - icm7170_initialize, - icm7170_get_time, - icm7170_set_time -}; - diff --git a/c/src/lib/libchip/rtc/icm7170.h b/c/src/lib/libchip/rtc/icm7170.h deleted file mode 100644 index 5bf9fd065c..0000000000 --- a/c/src/lib/libchip/rtc/icm7170.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * This file contains the definitions for the following real-time clocks: - * - * + Harris Semiconduction ICM7170 - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __LIBCHIP_ICM7170_h -#define __LIBCHIP_ICM7170_h - -/* - * Register indices - */ - -#define ICM7170_CONTROL 0x11 - - -#define ICM7170_COUNTER_HUNDREDTHS 0x00 -#define ICM7170_HOUR 0x01 -#define ICM7170_MINUTE 0x02 -#define ICM7170_SECOND 0x03 -#define ICM7170_MONTH 0x04 -#define ICM7170_DATE 0x05 -#define ICM7170_YEAR 0x06 -#define ICM7170_DAY_OF_WEEK 0x07 - -/* - * Configuration information in the parameters field - */ - -#define ICM7170_AT_32_KHZ 0x00 -#define ICM7170_AT_1_MHZ 0x01 -#define ICM7170_AT_2_MHZ 0x02 -#define ICM7170_AT_4_MHZ 0x03 - -/* - * Driver function table - */ - -extern rtc_fns icm7170_fns; - -/* - * Default register access routines - */ - -unsigned32 icm7170_get_register( /* registers are at 1 byte boundaries */ - unsigned32 ulCtrlPort, /* and accessed as bytes */ - unsigned8 ucRegNum -); - -void icm7170_set_register( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned32 ucData -); - -unsigned32 icm7170_get_register_2( /* registers are at 2 byte boundaries */ - unsigned32 ulCtrlPort, /* and accessed as bytes */ - unsigned8 ucRegNum -); - -void icm7170_set_register_2( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned32 ucData -); - -unsigned32 icm7170_get_register_4( /* registers are at 4 byte boundaries */ - unsigned32 ulCtrlPort, /* and accessed as bytes */ - unsigned8 ucRegNum -); - -void icm7170_set_register_4( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned32 ucData -); - -unsigned32 icm7170_get_register_8( /* registers are at 8 byte boundaries */ - unsigned32 ulCtrlPort, /* and accessed as bytes */ - unsigned8 ucRegNum -); - -void icm7170_set_register_8( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned32 ucData -); - -#endif -/* end of include file */ diff --git a/c/src/lib/libchip/rtc/icm7170_reg.c b/c/src/lib/libchip/rtc/icm7170_reg.c deleted file mode 100644 index b6961824b6..0000000000 --- a/c/src/lib/libchip/rtc/icm7170_reg.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file contains a typical set of register access routines which may be - * used with the icm7170 chip if accesses to the chip are as follows: - * - * + registers are accessed as bytes - * + registers are only byte-aligned (no address gaps) - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include <rtems.h> - -#ifndef _ICM7170_MULTIPLIER -#define _ICM7170_MULTIPLIER 1 -#define _ICM7170_NAME(_X) _X -#define _ICM7170_TYPE unsigned8 -#endif - -#define CALCULATE_REGISTER_ADDRESS( _base, _reg ) \ - (_ICM7170_TYPE *)((_base) + ((_reg) * _ICM7170_MULTIPLIER )) - -/* - * ICM7170 Get Register Routine - */ - -unsigned32 _ICM7170_NAME(icm7170_get_register)( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum -) -{ - _ICM7170_TYPE *port; - - port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum ); - - return *port; -} - -/* - * ICM7170 Set Register Routine - */ - -void _ICM7170_NAME(icm7170_set_register)( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned32 ucData -) -{ - _ICM7170_TYPE *port; - - port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum ); - - *port = ucData; -} diff --git a/c/src/lib/libchip/rtc/icm7170_reg2.c b/c/src/lib/libchip/rtc/icm7170_reg2.c deleted file mode 100644 index bab92697bf..0000000000 --- a/c/src/lib/libchip/rtc/icm7170_reg2.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This file contains a typical set of register access routines which may be - * used with the icm7170 chip if accesses to the chip are as follows: - * - * + registers are accessed as bytes - * + registers are on 16-bit boundaries - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#define _ICM7170_MULTIPLIER 2 -#define _ICM7170_NAME(_X) _X##_2 -#define _ICM7170_TYPE unsigned8 - -#include "icm7170_reg.c" - diff --git a/c/src/lib/libchip/rtc/icm7170_reg4.c b/c/src/lib/libchip/rtc/icm7170_reg4.c deleted file mode 100644 index 896e0cbc0b..0000000000 --- a/c/src/lib/libchip/rtc/icm7170_reg4.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This file contains a typical set of register access routines which may be - * used with the icm7170 chip if accesses to the chip are as follows: - * - * + registers are accessed as bytes - * + registers are on 32-bit boundaries - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#define _ICM7170_MULTIPLIER 4 -#define _ICM7170_NAME(_X) _X##_4 -#define _ICM7170_TYPE unsigned8 - -#include "icm7170_reg.c" - diff --git a/c/src/lib/libchip/rtc/icm7170_reg8.c b/c/src/lib/libchip/rtc/icm7170_reg8.c deleted file mode 100644 index d2ed2844ac..0000000000 --- a/c/src/lib/libchip/rtc/icm7170_reg8.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This file contains a typical set of register access routines which may be - * used with the icm7170 chip if accesses to the chip are as follows: - * - * + registers are accessed as bytes - * + registers are on 64-bit boundaries - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#define _ICM7170_MULTIPLIER 8 -#define _ICM7170_NAME(_X) _X##_8 -#define _ICM7170_TYPE unsigned8 - -#include "icm7170_reg.c" - diff --git a/c/src/lib/libchip/rtc/m48t08.c b/c/src/lib/libchip/rtc/m48t08.c deleted file mode 100644 index b3d0dcb0de..0000000000 --- a/c/src/lib/libchip/rtc/m48t08.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * This file interfaces with the real-time clock found in - * a Mostek M48T08 or M48T18 or compatibles. - * - * Year 2K Notes: - * - * This chip only uses a two digit field to store the year. This - * code uses the RTEMS Epoch as a pivot year. This lets us map the - * two digit year field as follows: - * - * + two digit years 0-87 are mapped to 2000-2087. - * + two digit years 88-99 are mapped to 1988-1999. - * - * This is less than the time span supported by RTEMS. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include <rtems.h> -#include <libchip/rtc.h> -#include <libchip/m48t08.h> - -/* - * Control register bits - */ - -#define M48T08_CONTROL_WRITE 0x80 -#define M48T08_CONTROL_READ 0x40 -#define M48T08_CONTROL_SIGN 0x20 - -/* - * m48t08_initialize - */ - -void m48t08_initialize( - int minor -) -{ -} - -/* - * m48t08_get_time - */ - -#define From_BCD( _x ) ((((_x) >> 4) * 10) + ((_x) & 0x0F)) -#define To_BCD( _x ) ((((_x) / 10) << 4) + ((_x) % 10)) - -int m48t08_get_time( - int minor, - rtems_time_of_day *time -) -{ - unsigned32 m48t08; - getRegister_f getReg; - setRegister_f setReg; - unsigned8 controlReg; - unsigned32 value1; - unsigned32 value2; - - m48t08 = RTC_Table[ minor ].ulCtrlPort1; - getReg = RTC_Table[ minor ].getRegister; - setReg = RTC_Table[ minor ].setRegister; - - /* - * Put the RTC into read mode - */ - - controlReg = (*getReg)( m48t08, M48T08_CONTROL ); - (*setReg)( m48t08, M48T08_CONTROL, controlReg | M48T08_CONTROL_READ ); - - value1 = (*getReg)( m48t08, M48T08_YEAR ); - value2 = From_BCD( value1 ); - if ( value2 < 88 ) - time->year = 2000 + value2; - else - time->year = 1900 + value2; - - value1 = (*getReg)( m48t08, M48T08_MONTH ); - time->month = From_BCD( value1 ); - - value1 = (*getReg)( m48t08, M48T08_DATE ); - time->day = From_BCD( value1 ); - - value1 = (*getReg)( m48t08, M48T08_HOUR ); - time->hour = From_BCD( value1 ); - - value1 = (*getReg)( m48t08, M48T08_MINUTE ); - time->minute = From_BCD( value1 ); - - value1 = (*getReg)( m48t08, M48T08_SECOND ); - time->second = From_BCD( value1 ); - - time->ticks = 0; - - /* - * Put the RTC back into normal mode. - */ - - (*setReg)( m48t08, M48T08_CONTROL, controlReg ); - - return 0; -} - -/* - * m48t08_set_time - */ - -int m48t08_set_time( - int minor, - rtems_time_of_day *time -) -{ - unsigned32 m48t08; - getRegister_f getReg; - setRegister_f setReg; - unsigned8 controlReg; - - m48t08 = RTC_Table[ minor ].ulCtrlPort1; - getReg = RTC_Table[ minor ].getRegister; - setReg = RTC_Table[ minor ].setRegister; - - /* - * Put the RTC into read mode - */ - - controlReg = (*getReg)( m48t08, M48T08_CONTROL ); - (*setReg)( m48t08, M48T08_CONTROL, controlReg | M48T08_CONTROL_WRITE ); - - if ( time->year >= 2088 ) - rtems_fatal_error_occurred( RTEMS_INVALID_NUMBER ); - - (*setReg)( m48t08, M48T08_YEAR, To_BCD(time->year % 100) ); - (*setReg)( m48t08, M48T08_MONTH, To_BCD(time->month) ); - (*setReg)( m48t08, M48T08_DATE, To_BCD(time->day) ); - (*setReg)( m48t08, M48T08_HOUR, To_BCD(time->hour) ); - (*setReg)( m48t08, M48T08_MINUTE, To_BCD(time->minute) ); - (*setReg)( m48t08, M48T08_SECOND, To_BCD(time->second) ); - - /* - * Put the RTC back into normal mode. - */ - - (*setReg)( m48t08, M48T08_CONTROL, controlReg ); - - return 0; -} - -/* - * Driver function table - */ - -rtc_fns m48t08_fns = { - m48t08_initialize, - m48t08_get_time, - m48t08_set_time -}; - diff --git a/c/src/lib/libchip/rtc/m48t08.h b/c/src/lib/libchip/rtc/m48t08.h deleted file mode 100644 index 7d27215e1e..0000000000 --- a/c/src/lib/libchip/rtc/m48t08.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * This file contains the definitions for the following real-time clocks: - * - * + Mostek M48T08 - * + Mostek M48T18 - * + Dallas Semiconductor DS1643 - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __LIBCHIP_M48T08_h -#define __LIBCHIP_M48T08_h - -/* - * Register indices - */ - -#define M48T08_CONTROL 0 -#define M48T08_SECOND 1 -#define M48T08_MINUTE 2 -#define M48T08_HOUR 3 -#define M48T08_DAY_OF_WEEK 4 -#define M48T08_DATE 5 -#define M48T08_MONTH 6 -#define M48T08_YEAR 7 - -/* - * Driver function table - */ - -extern rtc_fns m48t08_fns; - -/* - * Default register access routines - */ - -unsigned32 m48t08_get_register( /* registers are at 1 byte boundaries */ - unsigned32 ulCtrlPort, /* and accessed as bytes */ - unsigned8 ucRegNum -); - -void m48t08_set_register( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned32 ucData -); - -unsigned32 m48t08_get_register_2( /* registers are at 2 byte boundaries */ - unsigned32 ulCtrlPort, /* and accessed as bytes */ - unsigned8 ucRegNum -); - -void m48t08_set_register_2( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned32 ucData -); - -unsigned32 m48t08_get_register_4( /* registers are at 4 byte boundaries */ - unsigned32 ulCtrlPort, /* and accessed as bytes */ - unsigned8 ucRegNum -); - -void m48t08_set_register_4( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned32 ucData -); - -unsigned32 m48t08_get_register_8( /* registers are at 8 byte boundaries */ - unsigned32 ulCtrlPort, /* and accessed as bytes */ - unsigned8 ucRegNum -); - -void m48t08_set_register_8( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned32 ucData -); - -#endif -/* end of include file */ diff --git a/c/src/lib/libchip/rtc/m48t08_reg.c b/c/src/lib/libchip/rtc/m48t08_reg.c deleted file mode 100644 index abb37c628c..0000000000 --- a/c/src/lib/libchip/rtc/m48t08_reg.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file contains a typical set of register access routines which may be - * used with the m48t08 chip if accesses to the chip are as follows: - * - * + registers are accessed as bytes - * + registers are only byte-aligned (no address gaps) - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include <rtems.h> - -#ifndef _M48T08_MULTIPLIER -#define _M48T08_MULTIPLIER 1 -#define _M48T08_NAME(_X) _X -#define _M48T08_TYPE unsigned8 -#endif - -#define CALCULATE_REGISTER_ADDRESS( _base, _reg ) \ - (_M48T08_TYPE *)((_base) + ((_reg) * _M48T08_MULTIPLIER )) - -/* - * M48T08 Get Register Routine - */ - -unsigned32 _M48T08_NAME(m48t08_get_register)( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum -) -{ - _M48T08_TYPE *port; - - port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum ); - - return *port; -} - -/* - * M48T08 Set Register Routine - */ - -void _M48T08_NAME(m48t08_set_register)( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned32 ucData -) -{ - _M48T08_TYPE *port; - - port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum ); - - *port = ucData; -} diff --git a/c/src/lib/libchip/rtc/m48t08_reg2.c b/c/src/lib/libchip/rtc/m48t08_reg2.c deleted file mode 100644 index a6f294a3f7..0000000000 --- a/c/src/lib/libchip/rtc/m48t08_reg2.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This file contains a typical set of register access routines which may be - * used with the m48t08 chip if accesses to the chip are as follows: - * - * + registers are accessed as bytes - * + registers are on 16-bit boundaries - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#define _M48T08_MULTIPLIER 2 -#define _M48T08_NAME(_X) _X##_2 -#define _M48T08_TYPE unsigned8 - -#include "m48t08_reg.c" - diff --git a/c/src/lib/libchip/rtc/m48t08_reg4.c b/c/src/lib/libchip/rtc/m48t08_reg4.c deleted file mode 100644 index a84b988a34..0000000000 --- a/c/src/lib/libchip/rtc/m48t08_reg4.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This file contains a typical set of register access routines which may be - * used with the m48t08 chip if accesses to the chip are as follows: - * - * + registers are accessed as bytes - * + registers are on 32-bit boundaries - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#define _M48T08_MULTIPLIER 4 -#define _M48T08_NAME(_X) _X##_4 -#define _M48T08_TYPE unsigned8 - -#include "m48t08_reg.c" - diff --git a/c/src/lib/libchip/rtc/m48t08_reg8.c b/c/src/lib/libchip/rtc/m48t08_reg8.c deleted file mode 100644 index dcc2a9b39b..0000000000 --- a/c/src/lib/libchip/rtc/m48t08_reg8.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This file contains a typical set of register access routines which may be - * used with the m48t08 chip if accesses to the chip are as follows: - * - * + registers are accessed as bytes - * + registers are on 64-bit boundaries - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#define _M48T08_MULTIPLIER 8 -#define _M48T08_NAME(_X) _X##_8 -#define _M48T08_TYPE unsigned8 - -#include "m48t08_reg.c" - diff --git a/c/src/lib/libchip/rtc/rtc.h b/c/src/lib/libchip/rtc/rtc.h deleted file mode 100644 index 94b42e3f34..0000000000 --- a/c/src/lib/libchip/rtc/rtc.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * This file contains the Real-Time Clock definitions. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * - * $Id$ - */ - -#ifndef __LIBCHIP_RTC_h -#define __LIBCHIP_RTC_h - -/* - * Types for get and set register routines - */ - -typedef unsigned32 (*getRegister_f)(unsigned32 port, unsigned8 register); -typedef void (*setRegister_f)( - unsigned32 port, unsigned8 reg, unsigned32 value); - -typedef struct _rtc_fns { - void (*deviceInitialize)(int minor); - int (*deviceGetTime)(int minor, rtems_time_of_day *time); - int (*deviceSetTime)(int minor, rtems_time_of_day *time); -} rtc_fns; - -typedef enum { - RTC_M48T08, /* SGS-Thomsom M48T08 or M48T18 */ - RTC_ICM7170, /* Harris ICM-7170 */ - RTC_CUSTOM /* BSP specific driver */ -} rtc_devs; - -/* - * Each field is interpreted thus: - * - * sDeviceName This is the name of the device. - * - * deviceType This indicates the chip type. - * - * pDeviceFns This is a pointer to the set of driver routines to use. - * - * pDeviceParams This contains either device specific data or a pointer to a - * device specific information table. - * - * ulCtrlPort1 This is the primary control port number for the device. - * - * ulCtrlPort2 This is the secondary control port number. - * - * ulDataPort This is the port number for the data port of the device - * - * getRegister This is the routine used to read register values. - * - * setRegister This is the routine used to write register values. - */ - -typedef struct _rtc_tbl { - char *sDeviceName; - rtc_devs deviceType; - rtc_fns *pDeviceFns; - boolean (*deviceProbe)(int minor); - void *pDeviceParams; - unsigned32 ulCtrlPort1; - unsigned32 ulDataPort; - getRegister_f getRegister; - setRegister_f setRegister; -} rtc_tbl; - -extern rtc_tbl RTC_Table[]; -extern unsigned long RTC_Count; - - -boolean rtc_probe( int minor ); - -#endif -/* end of include file */ diff --git a/c/src/lib/libchip/rtc/rtcprobe.c b/c/src/lib/libchip/rtc/rtcprobe.c deleted file mode 100644 index 6aaad89486..0000000000 --- a/c/src/lib/libchip/rtc/rtcprobe.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This file contains the default Real-Time Clock probe routine. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include <rtems.h> -#include <libchip/rtc.h> - - -boolean rtc_probe( - int minor -) -{ - return TRUE; -} diff --git a/c/src/lib/libchip/serial/Makefile.in b/c/src/lib/libchip/serial/Makefile.in deleted file mode 100644 index d9c78faf97..0000000000 --- a/c/src/lib/libchip/serial/Makefile.in +++ /dev/null @@ -1,60 +0,0 @@ -# -# $Id$ -# - -@SET_MAKE@ -srcdir = @srcdir@ -VPATH = @srcdir@ -RTEMS_ROOT = @top_srcdir@ -PROJECT_ROOT = @PROJECT_ROOT@ - -LIBNAME=libserialio.a -LIB=${ARCH}/${LIBNAME} - -C_PIECES=\ - mc68681 mc68681_baud mc68681_reg mc68681_reg2 mc68681_reg4 mc68681_reg8 \ - ns16550 \ - z85c30 z85c30_reg \ - serprobe termios_baud2index termios_baud2num - -C_FILES=$(C_PIECES:%=%.c) -C_O_FILES=$(C_PIECES:%=${ARCH}/%.o) - -INSTALLED_H_FILES=$(srcdir)/mc68681.h $(srcdir)/ns16550.h $(srcdir)/z85c30.h \ - $(srcdir)/serial.h -SRCS=$(C_FILES) $(H_FILES) $(SYS_H_FILES) $(RTEMS_H_FILES) $(PRIVATE_H_FILES) -OBJS=$(C_O_FILES) - -include $(RTEMS_ROOT)/make/custom/$(RTEMS_BSP).cfg -include $(RTEMS_ROOT)/make/lib.cfg - -# -# Add local stuff here using += -# - -DEFINES += -CPPFLAGS += -CFLAGS += $(LIBC_DEFINES) - -# -# Add your list of files to delete here. The config files -# already know how to delete some stuff, so you may want -# to just run 'make clean' first to see what gets missed. -# 'make clobber' already includes 'make clean' -# - -CLEAN_ADDITIONS += $(LIB) -CLOBBER_ADDITIONS += - -all: ${ARCH} preinstall $(LIB) - $(INSTALL_VARIANT) -m 644 ${LIB} ${PROJECT_RELEASE}/lib - -$(LIB): $(SRCS) ${OBJS} - $(make-library) - -# Install the library, appending _g or _p as appropriate. -# for include files, just use $(INSTALL) -preinstall: - $(INSTALL) -m 444 $(INSTALLED_H_FILES) $(PROJECT_INCLUDE)/libchip - - diff --git a/c/src/lib/libchip/serial/README b/c/src/lib/libchip/serial/README deleted file mode 100644 index 3a1013b45b..0000000000 --- a/c/src/lib/libchip/serial/README +++ /dev/null @@ -1,17 +0,0 @@ -# -# $Id$ -# - -This is the serial controller portion of the libchip library. This -directory contains the source code for reusable console driver -support code. Each individual driver is configured using the -console_tbl data structure. This structure is defined and explained -in the console.h file. - -The reusable chip drivers do not directly access the serial controller. -They access the registers on the controller via a set of up to four -functions which are provided by the BSP. These functins set and get -general registers and data buffers. Some chips can access the data -buffers as general registers and thus the driver may not require -those interface routines. - diff --git a/c/src/lib/libchip/serial/README.mc68681 b/c/src/lib/libchip/serial/README.mc68681 deleted file mode 100644 index 240faf759b..0000000000 --- a/c/src/lib/libchip/serial/README.mc68681 +++ /dev/null @@ -1,87 +0,0 @@ -# -# $Id$ -# - -Configuration Table Use -======================= - -sDeviceName - - The name of this device. - -deviceType - - This field must be SERIAL_MC68681. - -pDeviceFns - - The device interface control table. This may be: - + mc68681_fns for interrupt driven IO - + mc68681_fns_polled for polled IO - -deviceProbe - - This is the address of the routine which probes to see if the device - is present. - -pDeviceFlow - - This field is ignored as hardware flow control is not currently supported. - -ulMargin - - This is currently unused. - -ulHysteresis - - This is currently unused. - -pDeviceParams - - This is set to the default settings. - -ulCtrlPort1 - - This field is the base address of the entire DUART. - -ulCtrlPort2 - - This field is the base address of the port specific registers. - -ulDataPort - - This field is bit mapped as follows: - bit 0: baud rate set a or b - bit 1-2: BRG selection ("Select Extend bit") - - Note: If both ports on single DUART are not configured for the same - baud rate set, then unexpected results will occur. - - Note: On the Exar 88c681, if a standard clock of 3.6864 Mhz is used - and the "Select Extend bit" is 0 (disabled), then the default - MC68681 baud rate table is selected. - -getRegister -setRegister - - These follow standard conventions. - -getData -setData - - These are unused since the TX and RX data registers can be accessed - as regular registers. - -ulClock - - This is a pointer to a baud rate mapping table. If set to - mc68681_baud_rate_table, then the CSR/ACR/X bit mappings shown - in the 68681 and 88681 manuals are used. Otherwise, the board - specific baud rate mapping is used. - - NULL is not a valid value. - -ulIntVector - - This is the interrupt vector number associated with this chip. - diff --git a/c/src/lib/libchip/serial/README.ns16550 b/c/src/lib/libchip/serial/README.ns16550 deleted file mode 100644 index 2956173b1b..0000000000 --- a/c/src/lib/libchip/serial/README.ns16550 +++ /dev/null @@ -1,5 +0,0 @@ -# -# $Id$ -# - -This driver needs to be debugged before this is written. diff --git a/c/src/lib/libchip/serial/README.xr88681 b/c/src/lib/libchip/serial/README.xr88681 deleted file mode 100644 index 37364aaec6..0000000000 --- a/c/src/lib/libchip/serial/README.xr88681 +++ /dev/null @@ -1,6 +0,0 @@ -# -# $Id$ -# - -The Exar XR88681 is an enhanced version of the Motorola MC68681 and is -supported by the mc68681 driver. diff --git a/c/src/lib/libchip/serial/README.z85c30 b/c/src/lib/libchip/serial/README.z85c30 deleted file mode 100644 index 4442b5ef40..0000000000 --- a/c/src/lib/libchip/serial/README.z85c30 +++ /dev/null @@ -1,78 +0,0 @@ -# -# $Id$ -# - -Configuration Table Use -======================= - -sDeviceName - - The name of this device. - -deviceType - - This field must be SERIAL_Z85C30. - -pDeviceFns - - The device interface control table. This may be: - + z85c30_fns for interrupt driven IO - + z85c30_fns_polled for polled IO - -deviceProbe - - This is the address of the routine which probes to see if the device - is present. - -pDeviceFlow - - This field is set to one of the following values: - + NULL for no hardware flow control - + z85c30_flow_RTSCTS for RTS/CTS based flow control - + z85c30_flow_DTRCTS for DTR/CTS based flow control - -ulMargin - - This is currently unused. - -ulHysteresis - - This is currently unused. - -pDeviceParams - - This is set to the default settings. - -ulCtrlPort1 - - This field is the address of the control register for this port. - -ulCtrlPort2 - - This field is the address of the control register for chip. - -ulDataPort - - This field is the address of the data register for this port. - -getRegister -setRegister - - These follow standard conventions. - -getData -setData - - These follow standard conventions. - -ulClock - - This is the clock speed of the baud rate clock. - NULL, then the CSR/ACR/X bit mappings shown in the 68681 and 88681 - manuals are used. Otherwise, the board specific baud rate mapping - is used. - -ulIntVector - - This is the interrupt vector number associated with this chip. - diff --git a/c/src/lib/libchip/serial/STATUS b/c/src/lib/libchip/serial/STATUS deleted file mode 100644 index 6eb7fa4171..0000000000 --- a/c/src/lib/libchip/serial/STATUS +++ /dev/null @@ -1,58 +0,0 @@ -# -# $Id$ -# - -General -======= - -+ Hardware flow control is not currently supported. Some of the chip - drivers (in particular the z8530) have support for hardware flow control - but this has not been tested in the libchip context. There will need - to be a way to totally disabled hardware flow control which is not - currently in this. - -+ "ulClockSpeed" configuration item field to become a pointer to a table - of chip specific information. For example, the z8530 should specify - clock speed and clock divisor setting. - -+ A termios structure should be included to specify the initial settings. - Right now all drivers default to 9600, 8N1. - -+ Need to switch to passing pointers rather than a minor number to - functions which are strictly internal to each chip driver. This - should be a performance win. - -+ Need a test which prompts you for termios settings and tests them. Until - this happens, testing for the variety of settings possible will be limited. - This test should be able to test any serial port while prompts come to the - console. - -MC68681 -======= - -+ Works interrupt and polled. - -+ Hardware flow control not included. - -NS16650 -======= - -+ Not tested in libchip context. Based on Radstone PPC2 driver which worked - well. - -+ Interrupt code has been reworked to not use ring buffer and may be broken - as it has not been tested since this was done. - -+ ns16550_set-attributes function is untested. - -+ Hardware flow control included but is currently disabled in ISR. - -Z85C30 -====== - -+ Works polled and interrupt. - -+ Hardware flow control included but is currently disabled in ISR. - -+ Needs to support mode where more specific vectors are generated. - diff --git a/c/src/lib/libchip/serial/mc68681.c b/c/src/lib/libchip/serial/mc68681.c deleted file mode 100644 index a41a00d1ae..0000000000 --- a/c/src/lib/libchip/serial/mc68681.c +++ /dev/null @@ -1,756 +0,0 @@ -/* - * This file contains the termios TTY driver for the Motorola MC68681. - * - * This part is available from a number of secondary sources. - * In particular, we know about the following: - * - * + Exar 88c681 and 68c681 - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include <rtems.h> -#include <rtems/libio.h> -#include <stdlib.h> - -#include <libchip/serial.h> -#include <libchip/mc68681.h> -#include "sersupp.h" -#include "mc68681_p.h" - -/* - * Flow control is only supported when using interrupts - */ - -console_fns mc68681_fns = -{ - libchip_serial_default_probe, /* deviceProbe */ - mc68681_open, /* deviceFirstOpen */ - NULL, /* deviceLastClose */ - NULL, /* deviceRead */ - mc68681_write_support_int, /* deviceWrite */ - mc68681_initialize_interrupts, /* deviceInitialize */ - mc68681_write_polled, /* deviceWritePolled */ - mc68681_set_attributes, /* deviceSetAttributes */ - TRUE /* deviceOutputUsesInterrupts */ -}; - -console_fns mc68681_fns_polled = -{ - libchip_serial_default_probe, /* deviceProbe */ - mc68681_open, /* deviceFirstOpen */ - mc68681_close, /* deviceLastClose */ - mc68681_inbyte_nonblocking_polled, /* deviceRead */ - mc68681_write_support_polled, /* deviceWrite */ - mc68681_init, /* deviceInitialize */ - mc68681_write_polled, /* deviceWritePolled */ - mc68681_set_attributes, /* deviceSetAttributes */ - FALSE, /* deviceOutputUsesInterrupts */ -}; - -extern void set_vector( rtems_isr_entry, rtems_vector_number, int ); - -/* - * Console Device Driver Entry Points - */ - -/* - * mc68681_baud_rate - * - * This routine returns the proper ACR bit and baud rate field values - * based on the requested baud rate. The baud rate set to be used - * must be configured by the user. - */ - -MC68681_STATIC int mc68681_baud_rate( - int minor, - int baud, - unsigned int *baud_mask_p, - unsigned int *acr_bit_p, - unsigned int *command -); - -/* - * mc68681_set_attributes - * - * This function sets the DUART channel to reflect the requested termios - * port settings. - */ - -MC68681_STATIC int mc68681_set_attributes( - int minor, - const struct termios *t -) -{ - unsigned32 pMC68681_port; - unsigned32 pMC68681; - unsigned int mode1; - unsigned int mode2; - unsigned int baud_mask; - unsigned int acr_bit; - unsigned int cmd; - setRegister_f setReg; - rtems_interrupt_level Irql; - - pMC68681 = Console_Port_Tbl[minor].ulCtrlPort1; - pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2; - setReg = Console_Port_Tbl[minor].setRegister; - - /* - * Set the baud rate - */ - - if (mc68681_baud_rate( minor, t->c_cflag, &baud_mask, &acr_bit, &cmd ) == -1) - return -1; - - baud_mask |= baud_mask << 4; - acr_bit <<= 7; - - /* - * Parity - */ - - mode1 = 0; - mode2 = 0; - - if (t->c_cflag & PARENB) { - if (t->c_cflag & PARODD) - mode1 |= 0x04; - else - mode1 |= 0x04; - } else { - mode1 |= 0x10; - } - - /* - * Character Size - */ - - if (t->c_cflag & CSIZE) { - switch (t->c_cflag & CSIZE) { - case CS5: break; - case CS6: mode1 |= 0x01; break; - case CS7: mode1 |= 0x02; break; - case CS8: mode1 |= 0x03; break; - } - } else { - mode1 |= 0x03; /* default to 9600,8,N,1 */ - } - - /* - * Stop Bits - */ - - if (t->c_cflag & CSTOPB) { - mode2 |= 0x07; /* 2 stop bits */ - } else { - if ((t->c_cflag & CSIZE) == CS5) /* CS5 and 2 stop bits not supported */ - return -1; - mode2 |= 0x0F; /* 1 stop bit */ - } - - rtems_interrupt_disable(Irql); - (*setReg)( pMC68681, MC68681_AUX_CTRL_REG, acr_bit ); - (*setReg)( pMC68681_port, MC68681_CLOCK_SELECT, baud_mask ); - if ( cmd ) { - (*setReg)( pMC68681_port, MC68681_COMMAND, cmd ); /* RX */ - (*setReg)( pMC68681_port, MC68681_COMMAND, cmd | 0x20 ); /* TX */ - } - (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_RESET_MR_PTR ); - (*setReg)( pMC68681_port, MC68681_MODE, mode1 ); - (*setReg)( pMC68681_port, MC68681_MODE, mode2 ); - rtems_interrupt_enable(Irql); - return 0; -} - -/* - * mc68681_initialize_context - * - * This function sets the default values of the per port context structure. - */ - -MC68681_STATIC void mc68681_initialize_context( - int minor, - mc68681_context *pmc68681Context -) -{ - int port; - unsigned int pMC68681; - unsigned int pMC68681_port; - - pMC68681 = Console_Port_Tbl[minor].ulCtrlPort1; - pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2; - - pmc68681Context->mate = -1; - - for (port=0 ; port<Console_Port_Count ; port++ ) { - if ( Console_Port_Tbl[port].ulCtrlPort1 == pMC68681 && - Console_Port_Tbl[port].ulCtrlPort2 != pMC68681_port ) { - pmc68681Context->mate = port; - pmc68681Context->imr = 0; - break; - } - } - -} - -/* - * mc68681_init - * - * This function initializes the DUART to a quiecsent state. - */ - -MC68681_STATIC void mc68681_init(int minor) -{ - unsigned32 pMC68681_port; - unsigned32 pMC68681; - mc68681_context *pmc68681Context; - setRegister_f setReg; - getRegister_f getReg; - - pmc68681Context = (mc68681_context *) malloc(sizeof(mc68681_context)); - - Console_Port_Data[minor].pDeviceContext = (void *)pmc68681Context; - - mc68681_initialize_context( minor, pmc68681Context ); - - pMC68681 = Console_Port_Tbl[minor].ulCtrlPort1; - pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2; - setReg = Console_Port_Tbl[minor].setRegister; - getReg = Console_Port_Tbl[minor].getRegister; - - /* - * Reset everything and leave this port disabled. - */ - - (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_RESET_RX ); - (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_RESET_TX ); - (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_RESET_ERROR ); - (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_RESET_BREAK ); - (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_STOP_BREAK ); - (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_DISABLE_TX ); - (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_DISABLE_RX ); - - - (*setReg)( pMC68681_port, MC68681_MODE_REG_1A, 0x00 ); - (*setReg)( pMC68681_port, MC68681_MODE_REG_2A, 0x02 ); - - /* - * Disable interrupts on RX and TX for this port - */ - - mc68681_enable_interrupts( minor, MC68681_IMR_DISABLE_ALL ); -} - -/* - * mc68681_open - * - * This function opens a port for communication. - * - * Default state is 9600 baud, 8 bits, No parity, and 1 stop bit. - */ - -MC68681_STATIC int mc68681_open( - int major, - int minor, - void *arg -) -{ - unsigned32 pMC68681; - unsigned32 pMC68681_port; - unsigned int baud; - unsigned int acr; - unsigned int vector; - unsigned int command; - rtems_interrupt_level Irql; - setRegister_f setReg; - - pMC68681 = Console_Port_Tbl[minor].ulCtrlPort1; - pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2; - setReg = Console_Port_Tbl[minor].setRegister; - vector = Console_Port_Tbl[minor].ulIntVector; - - /* XXX default baud rate should be from configuration table */ - - (void) mc68681_baud_rate( minor, B9600, &baud, &acr, &command ); - - /* - * Set the DUART channel to a default useable state - */ - - rtems_interrupt_disable(Irql); - (*setReg)( pMC68681, MC68681_AUX_CTRL_REG, acr ); - (*setReg)( pMC68681_port, MC68681_CLOCK_SELECT, baud ); - if ( command ) { - (*setReg)( pMC68681_port, MC68681_COMMAND, command ); /* RX */ - (*setReg)( pMC68681_port, MC68681_COMMAND, command | 0x20 ); /* TX */ - } - (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_RESET_MR_PTR ); - (*setReg)( pMC68681_port, MC68681_MODE, 0x13 ); - (*setReg)( pMC68681_port, MC68681_MODE, 0x07 ); - rtems_interrupt_enable(Irql); - - (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_ENABLE_TX ); - (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_ENABLE_RX ); - - (*setReg)( pMC68681, MC68681_INTERRUPT_VECTOR_REG, vector ); - - return RTEMS_SUCCESSFUL; -} - -/* - * mc68681_close - * - * This function shuts down the requested port. - */ - -MC68681_STATIC int mc68681_close( - int major, - int minor, - void *arg -) -{ - unsigned32 pMC68681; - unsigned32 pMC68681_port; - setRegister_f setReg; - - pMC68681 = Console_Port_Tbl[minor].ulCtrlPort1; - pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2; - setReg = Console_Port_Tbl[minor].setRegister; - - /* - * Disable interrupts from this channel and then disable it totally. - */ - -#if 0 - (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_DISABLE_TX ); - (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_DISABLE_RX ); -#endif - - return(RTEMS_SUCCESSFUL); -} - -/* - * mc68681_write_polled - * - * This routine polls out the requested character. - */ - -MC68681_STATIC void mc68681_write_polled( - int minor, - char cChar -) -{ - unsigned32 pMC68681_port; - unsigned char ucLineStatus; - int iTimeout; - getRegister_f getReg; - setRegister_f setReg; - - pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2; - getReg = Console_Port_Tbl[minor].getRegister; - setReg = Console_Port_Tbl[minor].setRegister; - - /* - * wait for transmitter holding register to be empty - */ - iTimeout = 1000; - ucLineStatus = (*getReg)(pMC68681_port, MC68681_STATUS); - while ((ucLineStatus & (MC68681_TX_READY|MC68681_TX_EMPTY)) == 0) { - - if ((ucLineStatus & 0xF0)) - (*setReg)( pMC68681_port, MC68681_COMMAND, MC68681_MODE_REG_RESET_ERROR ); - - /* - * Yield while we wait - */ - -#if 0 - if(_System_state_Is_up(_System_state_Get())) { - rtems_task_wake_after(RTEMS_YIELD_PROCESSOR); - } -#endif - ucLineStatus = (*getReg)(pMC68681_port, MC68681_STATUS); - if(!--iTimeout) { - break; - } - } - - /* - * transmit character - */ - - (*setReg)(pMC68681_port, MC68681_TX_BUFFER, cChar); -} - -/* - * mc68681_isr - * - * This is the single interrupt entry point which parcels interrupts - * out to the various ports. - */ - -MC68681_STATIC rtems_isr mc68681_isr( - rtems_vector_number vector -) -{ - int minor; - - for(minor=0 ; minor<Console_Port_Count ; minor++) { - if(Console_Port_Tbl[minor].ulIntVector == vector && - Console_Port_Tbl[minor].deviceType == SERIAL_MC68681 ) { - mc68681_process(minor); - } - } -} - -/* - * mc68681_initialize_interrupts - * - * This routine initializes the console's receive and transmit - * ring buffers and loads the appropriate vectors to handle the interrupts. - */ - -MC68681_STATIC void mc68681_initialize_interrupts(int minor) -{ - mc68681_init(minor); - - Console_Port_Data[minor].bActive = FALSE; - - set_vector(mc68681_isr, Console_Port_Tbl[minor].ulIntVector, 1); - - mc68681_enable_interrupts(minor,MC68681_IMR_ENABLE_ALL_EXCEPT_TX); -} - -/* - * mc68681_write_support_int - * - * Console Termios output entry point when using interrupt driven output. - */ - -MC68681_STATIC int mc68681_write_support_int( - int minor, - const char *buf, - int len -) -{ - unsigned32 Irql; - unsigned32 pMC68681_port; - setRegister_f setReg; - - pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2; - setReg = Console_Port_Tbl[minor].setRegister; - - /* - * We are using interrupt driven output and termios only sends us - * one character at a time. - */ - - if ( !len ) - return 0; - - /* - * Put the character out and enable interrupts if necessary. - */ - - rtems_interrupt_disable(Irql); - if ( Console_Port_Data[minor].bActive == FALSE ) { - Console_Port_Data[minor].bActive = TRUE; - mc68681_enable_interrupts(minor, MC68681_IMR_ENABLE_ALL); - } - (*setReg)(pMC68681_port, MC68681_TX_BUFFER, *buf); - rtems_interrupt_enable(Irql); - - return 1; -} - -/* - * mc68681_write_support_polled - * - * Console Termios output entry point when using polled output. - * - */ - -MC68681_STATIC int mc68681_write_support_polled( - int minor, - const char *buf, - int len -) -{ - int nwrite = 0; - - /* - * poll each byte in the string out of the port. - */ - while (nwrite < len) { - /* - * transmit character - */ - mc68681_write_polled(minor, *buf++); - nwrite++; - } - - /* - * return the number of bytes written. - */ - return nwrite; -} - -/* - * mc68681_inbyte_nonblocking_polled - * - * Console Termios polling input entry point. - */ - -MC68681_STATIC int mc68681_inbyte_nonblocking_polled( - int minor -) -{ - unsigned32 pMC68681_port; - unsigned char ucLineStatus; - unsigned char cChar; - getRegister_f getReg; - - pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2; - getReg = Console_Port_Tbl[minor].getRegister; - - ucLineStatus = (*getReg)(pMC68681_port, MC68681_STATUS); - if(ucLineStatus & MC68681_RX_READY) { - cChar = (*getReg)(pMC68681_port, MC68681_RX_BUFFER); - return (int)cChar; - } else { - return -1; - } -} - -/* - * mc68681_baud_rate - */ - -MC68681_STATIC int mc68681_baud_rate( - int minor, - int baud, - unsigned int *baud_mask_p, - unsigned int *acr_bit_p, - unsigned int *command -) -{ - unsigned int baud_mask; - unsigned int acr_bit; - int status; - int is_extended; - int baud_requested; - mc68681_baud_table_t *baud_tbl; - - baud_mask = 0; - acr_bit = 0; - status = 0; - - if ( !(Console_Port_Tbl[minor].ulDataPort & MC68681_DATA_BAUD_RATE_SET_1) ) - acr_bit = 1; - - is_extended = 0; - - switch (Console_Port_Tbl[minor].ulDataPort & MC68681_XBRG_MASK) { - case MC68681_XBRG_IGNORED: - *command = 0x00; - break; - case MC68681_XBRG_ENABLED: - *command = 0x80; - is_extended = 1; - break; - case MC68681_XBRG_DISABLED: - *command = 0x90; - break; - } - - baud_requested = baud & CBAUD; - if (!baud_requested) - baud_requested = B9600; /* default to 9600 baud */ - - baud_requested = termios_baud_to_index( baud_requested ); - - baud_tbl = (mc68681_baud_table_t *) Console_Port_Tbl[minor].ulClock; - if (!baud_tbl) - rtems_fatal_error_occurred(RTEMS_INVALID_ADDRESS); - - if ( is_extended ) - baud_mask = (unsigned int)baud_tbl[ acr_bit + 2 ][ baud_requested ]; - else - baud_mask = baud_tbl[ acr_bit ][ baud_requested ]; - - if ( baud_mask == MC68681_BAUD_NOT_VALID ) - status = -1; - - /* - * upper nibble is receiver and lower nibble is transmitter - */ - - *baud_mask_p = (baud_mask << 4) | baud_mask; - *acr_bit_p = acr_bit; - return status; -} - -/* - * mc68681_process - * - * This routine is the per port console interrupt handler. - */ - -MC68681_STATIC void mc68681_process( - int minor -) -{ - unsigned32 pMC68681; - unsigned32 pMC68681_port; - volatile unsigned8 ucLineStatus; - unsigned char cChar; - getRegister_f getReg; - setRegister_f setReg; - - pMC68681 = Console_Port_Tbl[minor].ulCtrlPort1; - pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2; - getReg = Console_Port_Tbl[minor].getRegister; - setReg = Console_Port_Tbl[minor].setRegister; - - /* - * Deal with any received characters - */ - while(TRUE) { - ucLineStatus = (*getReg)(pMC68681_port, MC68681_STATUS); - if(!(ucLineStatus & MC68681_RX_READY)) { - break; - } - /* - * If there is a RX error, then dump all the data. - */ - if ( ucLineStatus & MC68681_RX_ERRORS ) { - do { - cChar = (*getReg)(pMC68681_port, MC68681_RX_BUFFER); - ucLineStatus = (*getReg)(pMC68681_port, MC68681_STATUS); - } while ( ucLineStatus & MC68681_RX_READY ); - continue; - } - cChar = (*getReg)(pMC68681_port, MC68681_RX_BUFFER); - rtems_termios_enqueue_raw_characters( - Console_Port_Data[minor].termios_data, - &cChar, - 1 - ); - } - - /* - * Deal with the transmitter - */ - - ucLineStatus = (*getReg)(pMC68681, MC68681_INTERRUPT_STATUS_REG); - if (pMC68681 != pMC68681_port) - ucLineStatus >>= 4; - - if(ucLineStatus & MC68681_IR_TX_READY) { - rtems_termios_dequeue_characters(Console_Port_Data[minor].termios_data, 1); - if (rtems_termios_is_more_to_tx( Console_Port_Data[minor].termios_data )) { - Console_Port_Data[minor].bActive = FALSE; - mc68681_enable_interrupts(minor, MC68681_IMR_ENABLE_ALL_EXCEPT_TX); - } - } - -} - -/* - * mc68681_build_imr - * - * This function returns the value for the interrupt mask register for this - * DUART. Since this is a shared register, we must look at the other port - * on this chip to determine whether or not it is using interrupts. - */ - -MC68681_STATIC unsigned int mc68681_build_imr( - int minor, - int enable_flag -) -{ - int mate; - int is_a; - unsigned int mask; - unsigned int mate_mask; - unsigned int pMC68681; - unsigned int pMC68681_port; - mc68681_context *pmc68681Context; - mc68681_context *mateContext; - - pMC68681 = Console_Port_Tbl[minor].ulCtrlPort1; - pMC68681_port = Console_Port_Tbl[minor].ulCtrlPort2; - pmc68681Context = (mc68681_context *) Console_Port_Data[minor].pDeviceContext; - mate = pmc68681Context->mate; - - mask = 0; - mate_mask = 0; - - is_a = (pMC68681 == pMC68681_port); - - /* - * If there is a mate for this port, get its IMR mask. - */ - - if ( mate != -1 ) { - mateContext = Console_Port_Data[mate].pDeviceContext; - - if (mateContext) - mate_mask = mateContext->imr; - } - - /* - * Calculate this port's IMR mask and save it in the context area. - */ - - if ( Console_Port_Tbl[minor].pDeviceFns->deviceOutputUsesInterrupts ) - mask = enable_flag; - - pmc68681Context->imr = mask; - - /* - * Now return the full IMR value - */ - - if (is_a) - return (mate_mask << 4) | mask; - - return (mask << 4) | mate_mask; -} - -/* - * mc68681_enable_interrupts - * - * This function enables specific interrupt sources on the DUART. - */ - -MC68681_STATIC void mc68681_enable_interrupts( - int minor, - int imr_mask -) -{ - unsigned32 pMC68681; - setRegister_f setReg; - - pMC68681 = Console_Port_Tbl[minor].ulCtrlPort1; - setReg = Console_Port_Tbl[minor].setRegister; - - /* - * Enable interrupts on RX and TX -- not break - */ - - (*setReg)( - pMC68681, - MC68681_INTERRUPT_MASK_REG, - mc68681_build_imr(minor, imr_mask) - ); -} diff --git a/c/src/lib/libchip/serial/mc68681.h b/c/src/lib/libchip/serial/mc68681.h deleted file mode 100644 index 57713e3eff..0000000000 --- a/c/src/lib/libchip/serial/mc68681.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef _MC68681_H_ -#define _MC68681_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * These are just used in the interface between this driver and - * the read/write register routines when accessing the first - * control port. - */ - -#define MC68681_STATUS 1 -#define MC68681_RX_BUFFER 3 - -#define MC68681_MODE 0 -#define MC68681_CLOCK_SELECT 1 -#define MC68681_COMMAND 2 -#define MC68681_TX_BUFFER 3 - -/* - * Data Port bit map configuration - * - * D0 : Baud Rate Set Selection - * D1 - D2 : Extended Baud Rate Setting - */ - -#define MC68681_DATA_BAUD_RATE_SET_1 0 /* ACR[7] = 0 */ -#define MC68681_DATA_BAUD_RATE_SET_2 1 /* ACR[7] = 1 */ - -#define MC68681_XBRG_IGNORED (0 << 1) -#define MC68681_XBRG_ENABLED (1 << 1) -#define MC68681_XBRG_DISABLED (2 << 1) -#define MC68681_XBRG_MASK (3 << 1) - -/* - * Custom baud rate table information - */ - -typedef unsigned char mc68681_baud_t; -typedef mc68681_baud_t mc68681_baud_table_t[RTEMS_TERMIOS_NUMBER_BAUD_RATES]; - -#define MC68681_BAUD_NOT_VALID 0xFF - -extern mc68681_baud_t - mc68681_baud_rate_table[4][RTEMS_TERMIOS_NUMBER_BAUD_RATES]; - - -/* - * Driver function table - */ - -extern console_fns mc68681_fns; -extern console_fns mc68681_fns_polled; - -/* - * Default register access routines - */ - -unsigned8 mc68681_get_register( /* registers are at 1 byte boundaries */ - unsigned32 ulCtrlPort, /* and accessed as bytes */ - unsigned8 ucRegNum -); - -void mc68681_set_register( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned8 ucData -); - -unsigned8 mc68681_get_register_2( /* registers are at 2 byte boundaries */ - unsigned32 ulCtrlPort, /* and accessed as bytes */ - unsigned8 ucRegNum -); - -void mc68681_set_register_2( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned8 ucData -); - -unsigned8 mc68681_get_register_4( /* registers are at 4 byte boundaries */ - unsigned32 ulCtrlPort, /* and accessed as bytes */ - unsigned8 ucRegNum -); - -void mc68681_set_register_4( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned8 ucData -); - -unsigned8 mc68681_get_register_8( /* registers are at 8 byte boundaries */ - unsigned32 ulCtrlPort, /* and accessed as bytes */ - unsigned8 ucRegNum -); - -void mc68681_set_register_8( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned8 ucData -); - - -#ifdef __cplusplus -} -#endif - -#endif /* _MC68681_H_ */ diff --git a/c/src/lib/libchip/serial/mc68681_baud.c b/c/src/lib/libchip/serial/mc68681_baud.c deleted file mode 100644 index d91774e501..0000000000 --- a/c/src/lib/libchip/serial/mc68681_baud.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * MC68681 Default Baud Rate Table - * - * $Id$ - */ - -#include <rtems.h> -#include <libchip/serial.h> -#include <libchip/mc68681.h> - -/* major index of 0 : ACR[7] = 0, X = 0 -- 68c681 only has these */ -/* major index of 1 : ACR[7] = 1, X = 0 -- 68c681 only has these */ -/* major index of 2 : ACR[7] = 0, X = 1 */ -/* major index of 3 : ACR[7] = 1, X = 1 */ - -/* mc68681_baud_table_t mc68681_baud_rate_table[4] = { */ -mc68681_baud_t mc68681_baud_rate_table[4][RTEMS_TERMIOS_NUMBER_BAUD_RATES] = { - { /* ACR[7] = 0, X = 0 */ - MC68681_BAUD_NOT_VALID, /* B0 */ - 0x00, /* B50 */ - MC68681_BAUD_NOT_VALID, /* B75 */ - 0x01, /* B110 */ - 0x02, /* B134 */ - MC68681_BAUD_NOT_VALID, /* B150 */ - 0x03, /* B200 */ - 0x04, /* B300 */ - 0x05, /* B600 */ - 0x06, /* B1200 */ - MC68681_BAUD_NOT_VALID, /* B1800 */ - 0x08, /* B2400 */ - 0x09, /* B4800 */ - 0x0B, /* B9600 */ - MC68681_BAUD_NOT_VALID, /* B19200 */ - 0x0C, /* B38400 */ - MC68681_BAUD_NOT_VALID, /* B57600 */ - MC68681_BAUD_NOT_VALID, /* B115200 */ - MC68681_BAUD_NOT_VALID, /* B230400 */ - MC68681_BAUD_NOT_VALID /* B460800 */ - }, - { /* ACR[7] = 1, X = 0 */ - MC68681_BAUD_NOT_VALID, /* B0 */ - MC68681_BAUD_NOT_VALID, /* B50 */ - 0x00, /* B75 */ - 0x01, /* B110 */ - 0x02, /* B134 */ - 0x03, /* B150 */ - MC68681_BAUD_NOT_VALID, /* B200 */ - 0x04, /* B300 */ - 0x05, /* B600 */ - 0x06, /* B1200 */ - 0x0A, /* B1800 */ - 0x08, /* B2400 */ - 0x09, /* B4800 */ - 0x0B, /* B9600 */ - 0x0C, /* B19200 */ - MC68681_BAUD_NOT_VALID, /* B38400 */ - MC68681_BAUD_NOT_VALID, /* B57600 */ - MC68681_BAUD_NOT_VALID, /* B115200 */ - MC68681_BAUD_NOT_VALID, /* B230400 */ - MC68681_BAUD_NOT_VALID /* B460800 */ - }, - { /* ACR[7] = 0, X = 1 */ - MC68681_BAUD_NOT_VALID, /* B0 */ - MC68681_BAUD_NOT_VALID, /* B50 */ - 0x00, /* B75 */ - 0x01, /* B110 */ - 0x02, /* B134 */ - 0x03, /* B150 */ - MC68681_BAUD_NOT_VALID, /* B200 */ - MC68681_BAUD_NOT_VALID, /* B300 */ - MC68681_BAUD_NOT_VALID, /* B600 */ - MC68681_BAUD_NOT_VALID, /* B1200 */ - 0x0A, /* B1800 */ - MC68681_BAUD_NOT_VALID, /* B2400 */ - 0x08, /* B4800 */ - 0x0B, /* B9600 */ - 0x0C, /* B19200 */ - MC68681_BAUD_NOT_VALID, /* B38400 */ - 0x07, /* B57600 */ - 0x08, /* B115200 */ - MC68681_BAUD_NOT_VALID, /* B230400 */ - MC68681_BAUD_NOT_VALID /* B460800 */ - }, - { /* ACR[7] = 1, X = 1 */ - MC68681_BAUD_NOT_VALID, /* B0 */ - 0x00, /* B50 */ - MC68681_BAUD_NOT_VALID, /* B75 */ - 0x01, /* B110 */ - 0x02, /* B134 */ - MC68681_BAUD_NOT_VALID, /* B150 */ - 0x03, /* B200 */ - MC68681_BAUD_NOT_VALID, /* B300 */ - MC68681_BAUD_NOT_VALID, /* B600 */ - MC68681_BAUD_NOT_VALID, /* B1200 */ - MC68681_BAUD_NOT_VALID, /* B1800 */ - MC68681_BAUD_NOT_VALID, /* B2400 */ - 0x09, /* B4800 */ - 0x0B, /* B9600 */ - MC68681_BAUD_NOT_VALID, /* B19200 */ - 0x0C, /* B38400 */ - 0x07, /* B57600 */ - 0x08, /* B115200 */ - MC68681_BAUD_NOT_VALID, /* B230400 */ - MC68681_BAUD_NOT_VALID /* B460800 */ - }, -}; - diff --git a/c/src/lib/libchip/serial/mc68681_p.h b/c/src/lib/libchip/serial/mc68681_p.h deleted file mode 100644 index 471b0ae42e..0000000000 --- a/c/src/lib/libchip/serial/mc68681_p.h +++ /dev/null @@ -1,317 +0,0 @@ -/* - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef _MC68681_P_H_ -#define _MC68681_P_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Define MC68681_STATIC to nothing while debugging so the entry points - * will show up in the symbol table. - */ - -#define MC68681_STATIC - -/* #define MC68681_STATIC static */ - -/* - * mc68681 register offsets Read/Write Addresses - */ - -#define MC68681_MODE_REG_1A 0 /* MR1A-MR Prior to Read */ -#define MC68681_MODE_REG_2A 0 /* MR2A-MR After Read */ - -#define MC68681_COUNT_MODE_CURRENT_MSB 6 /* CTU */ -#define MC68681_COUNTER_TIMER_UPPER_REG 6 /* CTU */ -#define MC68681_COUNT_MODE_CURRENT_LSB 7 /* CTL */ -#define MC68681_COUNTER_TIMER_LOWER_REG 7 /* CTL */ -#define MC68681_INTERRUPT_VECTOR_REG 12 /* IVR */ - -#define MC68681_MODE_REG_1B 8 /* MR1B-MR Prior to Read */ -#define MC68681_MODE_REG_2B 8 /* MR2BA-MR After Read */ - -/* - * mc68681 register offsets Read Only Addresses - */ - -#define MC68681_STATUS_REG_A 1 /* SRA */ -#define MC68681_MASK_ISR_REG 2 /* MISR */ -#define MC68681_RECEIVE_BUFFER_A 3 /* RHRA */ -#define MC68681_INPUT_PORT_CHANGE_REG 4 /* IPCR */ -#define MC68681_INTERRUPT_STATUS_REG 5 /* ISR */ -#define MC68681_STATUS_REG_B 9 /* SRB */ -#define MC68681_RECEIVE_BUFFER_B 11 /* RHRB */ -#define MC68681_INPUT_PORT 13 /* IP */ -#define MC68681_START_COUNT_CMD 14 /* SCC */ -#define MC68681_STOP_COUNT_CMD 15 /* STC */ - -/* - * mc68681 register offsets Write Only Addresses - */ - -#define MC68681_CLOCK_SELECT_REG_A 1 /* CSRA */ -#define MC68681_COMMAND_REG_A 2 /* CRA */ -#define MC68681_TRANSMIT_BUFFER_A 3 /* THRA */ -#define MC68681_AUX_CTRL_REG 4 /* ACR */ -#define MC68681_INTERRUPT_MASK_REG 5 /* IMR */ -#define MC68681_CLOCK_SELECT_REG_B 9 /* CSRB */ -#define MC68681_COMMAND_REG_B 10 /* CRB */ -#define MC68681_TRANSMIT_BUFFER_B 11 /* THRB */ -#define MC68681_OUTPUT_PORT_CONFIG_REG 13 /* OPCR */ -#define MC68681_OUTPUT_PORT_SET_REG 14 /* SOPBC */ -#define MC68681_OUTPUT_PORT_RESET_BITS 15 /* COPBC */ - -/* - * DUART Command Register Definitions: - * - * MC68681_COMMAND_REG_A,MC68681_COMMAND_REG_B - */ - -#define MC68681_MODE_REG_ENABLE_RX 0x01 -#define MC68681_MODE_REG_DISABLE_RX 0x02 -#define MC68681_MODE_REG_ENABLE_TX 0x04 -#define MC68681_MODE_REG_DISABLE_TX 0x08 -#define MC68681_MODE_REG_RESET_MR_PTR 0x10 -#define MC68681_MODE_REG_RESET_RX 0x20 -#define MC68681_MODE_REG_RESET_TX 0x30 -#define MC68681_MODE_REG_RESET_ERROR 0x40 -#define MC68681_MODE_REG_RESET_BREAK 0x50 -#define MC68681_MODE_REG_START_BREAK 0x60 -#define MC68681_MODE_REG_STOP_BREAK 0x70 -#define MC68681_MODE_REG_SET_RX_BRG 0x80 -#define MC68681_MODE_REG_CLEAR_RX_BRG 0x90 -#define MC68681_MODE_REG_SET_TX_BRG 0xa0 -#define MC68681_MODE_REG_CLEAR_TX_BRG 0xb0 -#define MC68681_MODE_REG_SET_STANDBY 0xc0 -#define MC68681_MODE_REG_SET_ACTIVE 0xd0 - -/* - * Mode Register Definitions - * - * MC68681_MODE_REG_1A - * MC68681_MODE_REG_1B - */ - -#define MC68681_5BIT_CHARS 0x00 -#define MC68681_6BIT_CHARS 0x01 -#define MC68681_7BIT_CHARS 0x02 -#define MC68681_8BIT_CHARS 0x03 - -#define MC68681_ODD_PARITY 0x00 -#define MC68681_EVEN_PARITY 0x04 - -#define MC68681_WITH_PARITY 0x00 -#define MC68681_FORCE_PARITY 0x08 -#define MC68681_NO_PARITY 0x10 -#define MC68681_MULTI_DROP 0x18 - -#define MC68681_ERR_MODE_CHAR 0x00 -#define MC68681_ERR_MODE_BLOCK 0x20 - -#define MC68681_RX_INTR_RX_READY 0x00 -#define MC68681_RX_INTR_FFULL 0x40 - -#define MC68681_NO_RX_RTS_CTL 0x00 -#define MC68681_RX_RTS_CTRL 0x80 - -/* - * Mode Register Definitions - * - * MC68681_MODE_REG_2A - * MC68681_MODE_REG_2B - */ - -#define MC68681_STOP_BIT_LENGTH__563 0x00 -#define MC68681_STOP_BIT_LENGTH__625 0x01 -#define MC68681_STOP_BIT_LENGTH__688 0x02 -#define MC68681_STOP_BIT_LENGTH__75 0x03 -#define MC68681_STOP_BIT_LENGTH__813 0x04 -#define MC68681_STOP_BIT_LENGTH__875 0x05 -#define MC68681_STOP_BIT_LENGTH__938 0x06 -#define MC68681_STOP_BIT_LENGTH_1 0x07 -#define MC68681_STOP_BIT_LENGTH_1_563 0x08 -#define MC68681_STOP_BIT_LENGTH_1_625 0x09 -#define MC68681_STOP_BIT_LENGTH_1_688 0x0a -#define MC68681_STOP_BIT_LENGTH_1_75 0x0b -#define MC68681_STOP_BIT_LENGTH_1_813 0x0c -#define MC68681_STOP_BIT_LENGTH_1_875 0x0d -#define MC68681_STOP_BIT_LENGTH_1_938 0x0e -#define MC68681_STOP_BIT_LENGTH_2 0x0f - -#define MC68681_CTS_ENABLE_TX 0x10 -#define MC68681_TX_RTS_CTRL 0x20 - -#define MC68681_CHANNEL_MODE_NORMAL 0x00 -#define MC68681_CHANNEL_MODE_ECHO 0x40 -#define MC68681_CHANNEL_MODE_LOCAL_LOOP 0x80 -#define MC68681_CHANNEL_MODE_REMOTE_LOOP 0xc0 - -/* - * Status Register Definitions - * - * MC68681_STATUS_REG_A, MC68681_STATUS_REG_B - */ - -#define MC68681_RX_READY 0x01 -#define MC68681_FFULL 0x02 -#define MC68681_TX_READY 0x04 -#define MC68681_TX_EMPTY 0x08 -#define MC68681_OVERRUN_ERROR 0x10 -#define MC68681_PARITY_ERROR 0x20 -#define MC68681_FRAMING_ERROR 0x40 -#define MC68681_RECEIVED_BREAK 0x80 - -#define MC68681_RX_ERRORS \ - (MC68681_OVERRUN_ERROR|MC68681_PARITY_ERROR| \ - MC68681_FRAMING_ERROR|MC68681_RECEIVED_BREAK) - -/* - * Interupt Status Register Definitions. - * - * MC68681_INTERRUPT_STATUS_REG - */ - -/* - * Interupt Mask Register Definitions - * - * MC68681_INTERRUPT_MASK_REG - */ - -/* These are passed to mc68681_build_imr */ -#define MC68681_IR_TX_READY 0x01 -#define MC68681_IR_RX_READY 0x02 -#define MC68681_IR_BREAK 0x04 -#define MC68681_IMR_ENABLE_ALL 0x07 -#define MC68681_IMR_DISABLE_ALL 0x00 -#define MC68681_IMR_ENABLE_ALL_EXCEPT_TX 0x06 - -#define MC68681_IR_TX_READY_A 0x01 -#define MC68681_IR_RX_READY_A 0x02 -#define MC68681_IR_BREAK_A 0x04 -#define MC68681_IR_COUNTER_READY 0x08 -#define MC68681_IR_TX_READY_B 0x10 -#define MC68681_IR_RX_READY_B 0x20 -#define MC68681_IR_BREAK_B 0x40 -#define MC68681_IR_INPUT_PORT_CHANGE 0x80 - -/* - * Status Register Definitions. - * - * MC68681_STATUS_REG_A,MC68681_STATUS_REG_B - */ - -#define MC68681_STATUS_RXRDY 0x01 -#define MC68681_STATUS_FFULL 0x02 -#define MC68681_STATUS_TXRDY 0x04 -#define MC68681_STATUS_TXEMT 0x08 -#define MC68681_STATUS_OVERRUN_ERROR 0x10 -#define MC68681_STATUS_PARITY_ERROR 0x20 -#define MC68681_STATUS_FRAMING_ERROR 0x40 -#define MC68681_STATUS_RECEIVED_BREAK 0x80 - -/* - * Definitions for the Interrupt Vector Register: - * - * MC68681_INTERRUPT_VECTOR_REG - */ - -#define MC68681_INTERRUPT_VECTOR_INIT 0x0f - -/* - * Definitions for the Auxiliary Control Register - * - * MC68681_AUX_CTRL_REG - */ - -#define MC68681_AUX_BRG_SET1 0x00 -#define MC68681_AUX_BRG_SET2 0x80 - -/* - * Per chip context control - */ - -typedef struct _mc68681_context -{ - int mate; - unsigned char imr; -} mc68681_context; - -/* - * Driver functions - */ -MC68681_STATIC boolean mc68681_probe(int minor); - -MC68681_STATIC int mc68681_set_attributes( - int minor, - const struct termios *t -); - -MC68681_STATIC void mc68681_init(int minor); - -MC68681_STATIC int mc68681_open( - int major, - int minor, - void * arg -); - -MC68681_STATIC int mc68681_close( - int major, - int minor, - void * arg -); - -MC68681_STATIC void mc68681_write_polled( - int minor, - char cChar -); - -MC68681_STATIC void mc68681_initialize_interrupts(int minor); - -MC68681_STATIC int mc68681_write_support_int( - int minor, - const char *buf, - int len -); - -MC68681_STATIC int mc68681_write_support_polled( - int minor, - const char *buf, - int len - ); - -MC68681_STATIC int mc68681_inbyte_nonblocking_polled( - int minor -); - -MC68681_STATIC unsigned int mc68681_build_imr( - int minor, - int enable_flag -); - -MC68681_STATIC void mc68681_process( - int minor -); - -MC68681_STATIC void mc68681_enable_interrupts( - int minor, - int imr_mask -); - -#ifdef __cplusplus -} -#endif - -#endif /* _MC68681_P_H_ */ diff --git a/c/src/lib/libchip/serial/mc68681_reg.c b/c/src/lib/libchip/serial/mc68681_reg.c deleted file mode 100644 index 115bafdfe8..0000000000 --- a/c/src/lib/libchip/serial/mc68681_reg.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file contains a typical set of register access routines which may be - * used with the mc68681 chip if accesses to the chip are as follows: - * - * + registers are accessed as bytes - * + registers are only byte-aligned (no address gaps) - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include <rtems.h> - -#ifndef _MC68681_MULTIPLIER -#define _MC68681_MULTIPLIER 1 -#define _MC68681_NAME(_X) _X -#define _MC68681_TYPE unsigned8 -#endif - -#define CALCULATE_REGISTER_ADDRESS( _base, _reg ) \ - (_MC68681_TYPE *)((_base) + ((_reg) * _MC68681_MULTIPLIER )) - -/* - * MC68681 Get Register Routine - */ - -unsigned8 _MC68681_NAME(mc68681_get_register)( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum -) -{ - _MC68681_TYPE *port; - - port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum ); - - return *port; -} - -/* - * MC68681 Set Register Routine - */ - -void _MC68681_NAME(mc68681_set_register)( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned8 ucData -) -{ - _MC68681_TYPE *port; - - port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum ); - - *port = ucData; -} diff --git a/c/src/lib/libchip/serial/mc68681_reg2.c b/c/src/lib/libchip/serial/mc68681_reg2.c deleted file mode 100644 index f786ab5df5..0000000000 --- a/c/src/lib/libchip/serial/mc68681_reg2.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This file contains a typical set of register access routines which may be - * used with the mc68681 chip if accesses to the chip are as follows: - * - * + registers are accessed as bytes - * + registers are on 16-bit boundaries - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#define _MC68681_MULTIPLIER 2 -#define _MC68681_NAME(_X) _X##_2 -#define _MC68681_TYPE unsigned8 - -#include "mc68681_reg.c" - diff --git a/c/src/lib/libchip/serial/mc68681_reg4.c b/c/src/lib/libchip/serial/mc68681_reg4.c deleted file mode 100644 index 075a9b2564..0000000000 --- a/c/src/lib/libchip/serial/mc68681_reg4.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This file contains a typical set of register access routines which may be - * used with the mc68681 chip if accesses to the chip are as follows: - * - * + registers are accessed as bytes - * + registers are on 32-bit boundaries - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#define _MC68681_MULTIPLIER 4 -#define _MC68681_NAME(_X) _X##_4 -#define _MC68681_TYPE unsigned8 - -#include "mc68681_reg.c" - diff --git a/c/src/lib/libchip/serial/mc68681_reg8.c b/c/src/lib/libchip/serial/mc68681_reg8.c deleted file mode 100644 index b83ccd2b46..0000000000 --- a/c/src/lib/libchip/serial/mc68681_reg8.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * This file contains a typical set of register access routines which may be - * used with the mc68681 chip if accesses to the chip are as follows: - * - * + registers are accessed as bytes - * + registers are on 64-bit boundaries - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#define _MC68681_MULTIPLIER 8 -#define _MC68681_NAME(_X) _X##_8 -#define _MC68681_TYPE unsigned8 - -#include "mc68681_reg.c" - diff --git a/c/src/lib/libchip/serial/ns16550.c b/c/src/lib/libchip/serial/ns16550.c deleted file mode 100644 index 6f8c3f759f..0000000000 --- a/c/src/lib/libchip/serial/ns16550.c +++ /dev/null @@ -1,659 +0,0 @@ -/* - * This file contains the TTY driver for the National Semiconductor NS16550. - * - * This part is widely cloned and second sourced. It is found in a number - * of "Super IO" controllers. - * - * COPYRIGHT (c) 1998 by Radstone Technology - * - * - * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY - * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK - * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. - * - * You are hereby granted permission to use, copy, modify, and distribute - * this file, provided that this notice, plus the above copyright notice - * and disclaimer, appears in all copies. Radstone Technology will provide - * no support for this code. - * - * This driver uses the termios pseudo driver. - */ - -#include <rtems.h> -#include <rtems/libio.h> -#include <stdlib.h> -#include <ringbuf.h> - -#include <libchip/serial.h> -#include "ns16550_p.h" -#include "sersupp.h" - -/* - * Flow control is only supported when using interrupts - */ - -console_flow ns16550_flow_RTSCTS = { - ns16550_negate_RTS, /* deviceStopRemoteTx */ - ns16550_assert_RTS /* deviceStartRemoteTx */ -}; - -console_flow ns16550_flow_DTRCTS = { - ns16550_negate_DTR, /* deviceStopRemoteTx */ - ns16550_assert_DTR /* deviceStartRemoteTx */ -}; - -console_fns ns16550_fns = { - libchip_serial_default_probe, /* deviceProbe */ - ns16550_open, /* deviceFirstOpen */ - NULL, /* deviceLastClose */ - NULL, /* deviceRead */ - ns16550_write_support_int, /* deviceWrite */ - ns16550_initialize_interrupts, /* deviceInitialize */ - ns16550_write_polled, /* deviceWritePolled */ - ns16550_set_attributes, /* deviceSetAttributes */ - TRUE /* deviceOutputUsesInterrupts */ -}; - -console_fns ns16550_fns_polled = { - libchip_serial_default_probe, /* deviceProbe */ - ns16550_open, /* deviceFirstOpen */ - ns16550_close, /* deviceLastClose */ - ns16550_inbyte_nonblocking_polled, /* deviceRead */ - ns16550_write_support_polled, /* deviceWrite */ - ns16550_init, /* deviceInitialize */ - ns16550_write_polled, /* deviceWritePolled */ - ns16550_set_attributes, /* deviceSetAttributes */ - FALSE /* deviceOutputUsesInterrupts */ -}; - -extern void set_vector( rtems_isr_entry, rtems_vector_number, int ); - -/* - * ns16550_init - */ - -NS16550_STATIC void ns16550_init(int minor) -{ - unsigned32 pNS16550; - unsigned8 ucTrash; - unsigned8 ucDataByte; - unsigned32 ulBaudDivisor; - ns16550_context *pns16550Context; - setRegister_f setReg; - getRegister_f getReg; - - pns16550Context=(ns16550_context *)malloc(sizeof(ns16550_context)); - - Console_Port_Data[minor].pDeviceContext=(void *)pns16550Context; - pns16550Context->ucModemCtrl=SP_MODEM_IRQ; - - pNS16550 = Console_Port_Tbl[minor].ulCtrlPort1; - setReg = Console_Port_Tbl[minor].setRegister; - getReg = Console_Port_Tbl[minor].getRegister; - - /* Clear the divisor latch, clear all interrupt enables, - * and reset and - * disable the FIFO's. - */ - - (*setReg)(pNS16550, NS16550_LINE_CONTROL, 0x0); - ns16550_enable_interrupts(minor, NS16550_DISABLE_ALL_INTR); - - /* Set the divisor latch and set the baud rate. */ - - ulBaudDivisor=NS16550_Baud((unsigned32)Console_Port_Tbl[minor].pDeviceParams); - ucDataByte = SP_LINE_DLAB; - (*setReg)(pNS16550, NS16550_LINE_CONTROL, ucDataByte); - - /* XXX */ - (*setReg)(pNS16550, NS16550_TRANSMIT_BUFFER, ulBaudDivisor&0xff); - (*setReg)(pNS16550, NS16550_INTERRUPT_ENABLE, (ulBaudDivisor>>8)&0xff); - - /* Clear the divisor latch and set the character size to eight bits */ - /* with one stop bit and no parity checking. */ - ucDataByte = EIGHT_BITS; - (*setReg)(pNS16550, NS16550_LINE_CONTROL, ucDataByte); - - /* Enable and reset transmit and receive FIFOs. TJA */ - ucDataByte = SP_FIFO_ENABLE; - (*setReg)(pNS16550, NS16550_FIFO_CONTROL, ucDataByte); - - ucDataByte = SP_FIFO_ENABLE | SP_FIFO_RXRST | SP_FIFO_TXRST; - (*setReg)(pNS16550, NS16550_FIFO_CONTROL, ucDataByte); - - ns16550_enable_interrupts(minor, NS16550_DISABLE_ALL_INTR); - - /* Set data terminal ready. */ - /* And open interrupt tristate line */ - (*setReg)(pNS16550, NS16550_MODEM_CONTROL,pns16550Context->ucModemCtrl); - - ucTrash = (*getReg)(pNS16550, NS16550_LINE_STATUS ); - ucTrash = (*getReg)(pNS16550, NS16550_RECEIVE_BUFFER ); -} - -/* - * ns16550_open - */ - -NS16550_STATIC int ns16550_open( - int major, - int minor, - void * arg -) -{ - /* - * Assert DTR - */ - - if(Console_Port_Tbl[minor].pDeviceFlow != &ns16550_flow_DTRCTS) { - ns16550_assert_DTR(minor); - } - - return(RTEMS_SUCCESSFUL); -} - -/* - * ns16550_close - */ - -NS16550_STATIC int ns16550_close( - int major, - int minor, - void * arg -) -{ - /* - * Negate DTR - */ - if(Console_Port_Tbl[minor].pDeviceFlow != &ns16550_flow_DTRCTS) { - ns16550_negate_DTR(minor); - } - - return(RTEMS_SUCCESSFUL); -} - -/* - * ns16550_write_polled - */ - -NS16550_STATIC void ns16550_write_polled( - int minor, - char cChar -) -{ - unsigned32 pNS16550; - unsigned char ucLineStatus; - int iTimeout; - getRegister_f getReg; - setRegister_f setReg; - - pNS16550 = Console_Port_Tbl[minor].ulCtrlPort1; - getReg = Console_Port_Tbl[minor].getRegister; - setReg = Console_Port_Tbl[minor].setRegister; - - /* - * wait for transmitter holding register to be empty - */ - iTimeout=1000; - ucLineStatus = (*getReg)(pNS16550, NS16550_LINE_STATUS); - while ((ucLineStatus & SP_LSR_THOLD) == 0) { - /* - * Yield while we wait - */ -#if 0 - if(_System_state_Is_up(_System_state_Get())) { - rtems_task_wake_after(RTEMS_YIELD_PROCESSOR); - } -#endif - ucLineStatus = (*getReg)(pNS16550, NS16550_LINE_STATUS); - if(!--iTimeout) { - break; - } - } - - /* - * transmit character - */ - (*setReg)(pNS16550, NS16550_TRANSMIT_BUFFER, cChar); -} - -/* - * These routines provide control of the RTS and DTR lines - */ - -/* - * ns16550_assert_RTS - */ - -NS16550_STATIC int ns16550_assert_RTS(int minor) -{ - unsigned32 pNS16550; - unsigned32 Irql; - ns16550_context *pns16550Context; - setRegister_f setReg; - - pns16550Context=(ns16550_context *) Console_Port_Data[minor].pDeviceContext; - - pNS16550 = Console_Port_Tbl[minor].ulCtrlPort1; - setReg = Console_Port_Tbl[minor].setRegister; - - /* - * Assert RTS - */ - rtems_interrupt_disable(Irql); - pns16550Context->ucModemCtrl|=SP_MODEM_RTS; - (*setReg)(pNS16550, NS16550_MODEM_CONTROL, pns16550Context->ucModemCtrl); - rtems_interrupt_enable(Irql); - return 0; -} - -/* - * ns16550_negate_RTS - */ - -NS16550_STATIC int ns16550_negate_RTS(int minor) -{ - unsigned32 pNS16550; - unsigned32 Irql; - ns16550_context *pns16550Context; - setRegister_f setReg; - - pns16550Context=(ns16550_context *) Console_Port_Data[minor].pDeviceContext; - - pNS16550 = Console_Port_Tbl[minor].ulCtrlPort1; - setReg = Console_Port_Tbl[minor].setRegister; - - /* - * Negate RTS - */ - rtems_interrupt_disable(Irql); - pns16550Context->ucModemCtrl&=~SP_MODEM_RTS; - (*setReg)(pNS16550, NS16550_MODEM_CONTROL, pns16550Context->ucModemCtrl); - rtems_interrupt_enable(Irql); - return 0; -} - -/* - * These flow control routines utilise a connection from the local DTR - * line to the remote CTS line - */ - -/* - * ns16550_assert_DTR - */ - -NS16550_STATIC int ns16550_assert_DTR(int minor) -{ - unsigned32 pNS16550; - unsigned32 Irql; - ns16550_context *pns16550Context; - setRegister_f setReg; - - pns16550Context=(ns16550_context *) Console_Port_Data[minor].pDeviceContext; - - pNS16550 = Console_Port_Tbl[minor].ulCtrlPort1; - setReg = Console_Port_Tbl[minor].setRegister; - - /* - * Assert DTR - */ - rtems_interrupt_disable(Irql); - pns16550Context->ucModemCtrl|=SP_MODEM_DTR; - (*setReg)(pNS16550, NS16550_MODEM_CONTROL, pns16550Context->ucModemCtrl); - rtems_interrupt_enable(Irql); - return 0; -} - -/* - * ns16550_negate_DTR - */ - -NS16550_STATIC int ns16550_negate_DTR(int minor) -{ - unsigned32 pNS16550; - unsigned32 Irql; - ns16550_context *pns16550Context; - setRegister_f setReg; - - pns16550Context=(ns16550_context *) Console_Port_Data[minor].pDeviceContext; - - pNS16550 = Console_Port_Tbl[minor].ulCtrlPort1; - setReg = Console_Port_Tbl[minor].setRegister; - - /* - * Negate DTR - */ - rtems_interrupt_disable(Irql); - pns16550Context->ucModemCtrl&=~SP_MODEM_DTR; - (*setReg)(pNS16550, NS16550_MODEM_CONTROL,pns16550Context->ucModemCtrl); - rtems_interrupt_enable(Irql); - return 0; -} - -/* - * ns16550_set_attributes - * - * This function sets the channel to reflect the requested termios - * port settings. - */ - -NS16550_STATIC int ns16550_set_attributes( - int minor, - const struct termios *t -) -{ - unsigned32 pNS16550; - unsigned32 ulBaudDivisor; - unsigned8 ucLineControl; - unsigned32 baud_requested; - setRegister_f setReg; - getRegister_f getReg; - unsigned32 Irql; - - pNS16550 = Console_Port_Tbl[minor].ulCtrlPort1; - setReg = Console_Port_Tbl[minor].setRegister; - getReg = Console_Port_Tbl[minor].getRegister; - - /* - * Calculate the baud rate divisor - */ - - baud_requested = t->c_cflag & CBAUD; - if (!baud_requested) - baud_requested = B9600; /* default to 9600 baud */ - - ulBaudDivisor = termios_baud_to_number(baud_requested); - - ucLineControl = 0; - - /* - * Parity - */ - - if (t->c_cflag & PARENB) { - ucLineControl |= SP_LINE_PAR; - if (!(t->c_cflag & PARODD)) - ucLineControl |= SP_LINE_ODD; - } - - /* - * Character Size - */ - - if (t->c_cflag & CSIZE) { - switch (t->c_cflag & CSIZE) { - case CS5: ucLineControl |= FIVE_BITS; break; - case CS6: ucLineControl |= SIX_BITS; break; - case CS7: ucLineControl |= SEVEN_BITS; break; - case CS8: ucLineControl |= EIGHT_BITS; break; - } - } else { - ucLineControl |= EIGHT_BITS; /* default to 9600,8,N,1 */ - } - - /* - * Stop Bits - */ - - if (t->c_cflag & CSTOPB) { - ucLineControl |= SP_LINE_STOP; /* 2 stop bits */ - } else { - ; /* 1 stop bit */ - } - - /* - * Now actually set the chip - */ - - rtems_interrupt_disable(Irql); - - /* - * Set the baud rate - */ - - (*setReg)(pNS16550, NS16550_LINE_CONTROL, SP_LINE_DLAB); - /* XXX are these registers right? */ - (*setReg)(pNS16550, NS16550_TRANSMIT_BUFFER, ulBaudDivisor&0xff); - (*setReg)(pNS16550, NS16550_INTERRUPT_ENABLE, (ulBaudDivisor>>8)&0xff); - - /* - * Now write the line control - */ - (*setReg)(pNS16550, NS16550_LINE_CONTROL, ucLineControl ); - - rtems_interrupt_enable(Irql); - -} - -/* - * ns16550_process - * - * This routine is the console interrupt handler for A port. - */ - -NS16550_STATIC void ns16550_process( - int minor -) -{ - unsigned32 pNS16550; - volatile unsigned8 ucLineStatus; - volatile unsigned8 ucInterruptId; - unsigned char cChar; - getRegister_f getReg; - setRegister_f setReg; - - pNS16550 = Console_Port_Tbl[minor].ulCtrlPort1; - getReg = Console_Port_Tbl[minor].getRegister; - setReg = Console_Port_Tbl[minor].setRegister; - - do { - /* - * Deal with any received characters - */ - while(TRUE) { - ucLineStatus = (*getReg)(pNS16550, NS16550_LINE_STATUS); - if(~ucLineStatus & SP_LSR_RDY) { - break; - } - cChar = (*getReg)(pNS16550, NS16550_RECEIVE_BUFFER); - rtems_termios_enqueue_raw_characters( - Console_Port_Data[minor].termios_data, - &cChar, - 1 - ); - } - - /* - * TX all the characters we can - */ - - while(TRUE) { - ucLineStatus = (*getReg)(pNS16550, NS16550_LINE_STATUS); - if(~ucLineStatus & SP_LSR_THOLD) { - /* - * We'll get another interrupt when - * the transmitter holding reg. becomes - * free again - */ - break; - } - -#if 0 - /* XXX flow control not completely supported in libchip */ - - if(Console_Port_Tbl[minor].pDeviceFlow != &ns16550_flow_RTSCTS) { - ns16550_negate_RTS(minor); - } -#endif - - rtems_termios_dequeue_characters(Console_Port_Data[minor].termios_data, 1); - if (rtems_termios_is_more_to_tx( Console_Port_Data[minor].termios_data )) { - if (Console_Port_Tbl[minor].pDeviceFlow != &ns16550_flow_RTSCTS) { - ns16550_negate_RTS(minor); - } - Console_Port_Data[minor].bActive = FALSE; - ns16550_enable_interrupts(minor, NS16550_ENABLE_ALL_INTR_EXCEPT_TX); - break; - } - - ucInterruptId = (*getReg)(pNS16550, NS16550_INTERRUPT_ID); - } - } while((ucInterruptId&0xf)!=0x1); -} - -/* - * ns16550_isr - */ - -NS16550_STATIC rtems_isr ns16550_isr( - rtems_vector_number vector -) -{ - int minor; - - for(minor=0;minor<Console_Port_Count;minor++) { - if(Console_Port_Tbl[minor].ulIntVector == vector && - Console_Port_Tbl[minor].deviceType == SERIAL_NS16550 ) { - ns16550_process(minor); - } - } -} - -/* - * ns16550_enable_interrupts - * - * This routine initializes the port to have the specified interrupts masked. - */ - -NS16550_STATIC void ns16550_enable_interrupts( - int minor, - int mask -) -{ - unsigned32 pNS16550; - setRegister_f setReg; - - pNS16550 = Console_Port_Tbl[minor].ulCtrlPort1; - setReg = Console_Port_Tbl[minor].setRegister; - - (*setReg)(pNS16550, NS16550_INTERRUPT_ENABLE, mask); -} - -/* - * ns16550_initialize_interrupts - * - * This routine initializes the port to operate in interrupt driver mode. - */ - -NS16550_STATIC void ns16550_initialize_interrupts(int minor) -{ - ns16550_init(minor); - - Console_Port_Data[minor].bActive = FALSE; - - set_vector(ns16550_isr, Console_Port_Tbl[minor].ulIntVector, 1); - - ns16550_enable_interrupts(minor, NS16550_ENABLE_ALL_INTR); -} - -/* - * ns16550_write_support_int - * - * Console Termios output entry point. - */ - -NS16550_STATIC int ns16550_write_support_int( - int minor, - const char *buf, - int len -) -{ - unsigned32 Irql; - unsigned32 pNS16550; - setRegister_f setReg; - - setReg = Console_Port_Tbl[minor].setRegister; - pNS16550 = Console_Port_Tbl[minor].ulCtrlPort1; - - /* - * We are using interrupt driven output and termios only sends us - * one character at a time. - */ - - if ( !len ) - return 0; - - if(Console_Port_Tbl[minor].pDeviceFlow != &ns16550_flow_RTSCTS) { - ns16550_assert_RTS(minor); - } - - rtems_interrupt_disable(Irql); - if ( Console_Port_Data[minor].bActive == FALSE) { - Console_Port_Data[minor].bActive = TRUE; - ns16550_enable_interrupts(minor, NS16550_ENABLE_ALL_INTR); - } - (*setReg)(pNS16550, NS16550_TRANSMIT_BUFFER, *buf); - rtems_interrupt_enable(Irql); - - return 1; -} - -/* - * ns16550_write_support_polled - * - * Console Termios output entry point. - * - */ - -NS16550_STATIC int ns16550_write_support_polled( - int minor, - const char *buf, - int len -) -{ - int nwrite = 0; - - /* - * poll each byte in the string out of the port. - */ - while (nwrite < len) { - /* - * transmit character - */ - ns16550_write_polled(minor, *buf++); - nwrite++; - } - - /* - * return the number of bytes written. - */ - return nwrite; -} - -/* - * ns16550_inbyte_nonblocking_polled - * - * Console Termios polling input entry point. - */ - -NS16550_STATIC int ns16550_inbyte_nonblocking_polled( - int minor -) -{ - unsigned32 pNS16550; - unsigned char ucLineStatus; - char cChar; - getRegister_f getReg; - - pNS16550 = Console_Port_Tbl[minor].ulCtrlPort1; - getReg = Console_Port_Tbl[minor].getRegister; - - ucLineStatus = (*getReg)(pNS16550, NS16550_LINE_STATUS); - if(ucLineStatus & SP_LSR_RDY) { - cChar = (*getReg)(pNS16550, NS16550_RECEIVE_BUFFER); - return (int)cChar; - } else { - return -1; - } -} diff --git a/c/src/lib/libchip/serial/ns16550.h b/c/src/lib/libchip/serial/ns16550.h deleted file mode 100644 index cb01d20a85..0000000000 --- a/c/src/lib/libchip/serial/ns16550.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * COPYRIGHT (c) 1998 by Radstone Technology - * - * - * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY - * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK - * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. - * - * You are hereby granted permission to use, copy, modify, and distribute - * this file, provided that this notice, plus the above copyright notice - * and disclaimer, appears in all copies. Radstone Technology will provide - * no support for this code. - * - */ - -#ifndef _NS16550_H_ -#define _NS16550_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Driver function table - */ - -extern console_fns ns16550_fns; -extern console_fns ns16550_fns_polled; - -/* - * Flow control function tables - */ - -extern console_flow ns16550_flow_RTSCTS; -extern console_flow ns16550_flow_DTRCTS; - -#ifdef __cplusplus -} -#endif - -#endif /* _NS16550_H_ */ diff --git a/c/src/lib/libchip/serial/ns16550_p.h b/c/src/lib/libchip/serial/ns16550_p.h deleted file mode 100644 index 27c3502a0d..0000000000 --- a/c/src/lib/libchip/serial/ns16550_p.h +++ /dev/null @@ -1,238 +0,0 @@ -/* - * COPYRIGHT (c) 1998 by Radstone Technology - * - * - * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY - * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK - * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. - * - * You are hereby granted permission to use, copy, modify, and distribute - * this file, provided that this notice, plus the above copyright notice - * and disclaimer, appears in all copies. Radstone Technology will provide - * no support for this code. - * - * $Id$ - */ - -#ifndef _NS16550_P_H_ -#define _NS16550_P_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Define NS16550_STATIC to nothing while debugging so the entry points - * will show up in the symbol table. - */ - -#define NS16550_STATIC - -/* #define NS16550_STATIC static */ - -/* - * Define serial port read registers structure. - */ - -typedef volatile struct _SP_READ_REGISTERS { - unsigned char ReceiveBuffer; - unsigned char InterruptEnable; - unsigned char InterruptId; - unsigned char LineControl; - unsigned char ModemControl; - unsigned char LineStatus; - unsigned char ModemStatus; - unsigned char ScratchPad; -} SP_READ_REGISTERS, *PSP_READ_REGISTERS; - -#define NS16550_RECEIVE_BUFFER 0 -#define NS16550_INTERRUPT_ENABLE 1 -#define NS16550_INTERRUPT_ID 2 -#define NS16550_LINE_CONTROL 3 -#define NS16550_MODEM_CONTROL 4 -#define NS16550_LINE_STATUS 5 -#define NS16550_MODEM_STATUS 6 -#define NS16550_SCRATCH_PAD 7 - -/* - * Define serial port write registers structure. - */ - -typedef volatile struct _SP_WRITE_REGISTERS { - unsigned char TransmitBuffer; - unsigned char InterruptEnable; - unsigned char FifoControl; - unsigned char LineControl; - unsigned char ModemControl; - unsigned char Reserved1; - unsigned char ModemStatus; - unsigned char ScratchPad; -} SP_WRITE_REGISTERS, *PSP_WRITE_REGISTERS; - -#define NS16550_TRANSMIT_BUFFER 0 -#define NS16550_FIFO_CONTROL 2 - -/* - * Define serial port interrupt enable register structure. - */ - -#define SP_INT_RX_ENABLE 0x01 -#define SP_INT_TX_ENABLE 0x02 -#define SP_INT_LS_ENABLE 0x04 -#define SP_INT_MS_ENABLE 0x08 - -#define NS16550_ENABLE_ALL_INTR (SP_INT_RX_ENABLE | SP_INT_TX_ENABLE) -#define NS16550_DISABLE_ALL_INTR 0x00 -#define NS16550_ENABLE_ALL_INTR_EXCEPT_TX (SP_INT_RX_ENABLE) - -/* - * Define serial port interrupt id register structure. - */ - -typedef struct _SP_INTERRUPT_ID { - unsigned char InterruptPending : 1; - unsigned char Identification : 3; - unsigned char Reserved1 : 2; - unsigned char FifoEnabled : 2; -} SP_INTERRUPT_ID, *PSP_INTERRUPT_ID; - -/* - * Define serial port fifo control register structure. - */ - -#define SP_FIFO_ENABLE 0x01 -#define SP_FIFO_RXRST 0x02 -#define SP_FIFO_TXRST 0x04 -#define SP_FIFO_DMA 0x08 -#define SP_FIFO_RXLEVEL 0xc0 - -/* - * Define serial port line control register structure. - */ - -#define SP_LINE_SIZE 0x03 -#define SP_LINE_STOP 0x04 -#define SP_LINE_PAR 0x08 -#define SP_LINE_ODD 0x10 -#define SP_LINE_STICK 0x20 -#define SP_LINE_BREAK 0x40 -#define SP_LINE_DLAB 0x80 - -/* - * Line status register character size definitions. - */ - -#define FIVE_BITS 0x0 /* five bits per character */ -#define SIX_BITS 0x1 /* six bits per character */ -#define SEVEN_BITS 0x2 /* seven bits per character */ -#define EIGHT_BITS 0x3 /* eight bits per character */ - -/* - * Line speed divisor definition. - */ - -#define NS16550_Baud(baud_rate) (115200/baud_rate) - -/* - * Define serial port modem control register structure. - */ - -#define SP_MODEM_DTR 0x01 -#define SP_MODEM_RTS 0x02 -#define SP_MODEM_IRQ 0x08 -#define SP_MODEM_LOOP 0x10 -#define SP_MODEM_DIV4 0x80 - -/* - * Define serial port line status register structure. - */ - -#define SP_LSR_RDY 0x01 -#define SP_LSR_EOVRUN 0x02 -#define SP_LSR_EPAR 0x04 -#define SP_LSR_EFRAME 0x08 -#define SP_LSR_BREAK 0x10 -#define SP_LSR_THOLD 0x20 -#define SP_LSR_TX 0x40 -#define SP_LSR_EFIFO 0x80 - -typedef struct _ns16550_context -{ - unsigned8 ucModemCtrl; -} ns16550_context; - -/* - * Driver functions - */ - -NS16550_STATIC boolean ns16550_probe(int minor); - -NS16550_STATIC void ns16550_init(int minor); - -NS16550_STATIC int ns16550_open( - int major, - int minor, - void * arg -); - -NS16550_STATIC int ns16550_close( - int major, - int minor, - void * arg -); - -NS16550_STATIC void ns16550_write_polled( - int minor, - char cChar -); - -NS16550_STATIC int ns16550_assert_RTS( - int minor -); - -NS16550_STATIC int ns16550_negate_RTS( - int minor -); - -NS16550_STATIC int ns16550_assert_DTR( - int minor -); - -NS16550_STATIC int ns16550_negate_DTR( - int minor -); - -NS16550_STATIC void ns16550_initialize_interrupts(int minor); - -NS16550_STATIC int ns16550_write_support_int( - int minor, - const char *buf, - int len -); - -NS16550_STATIC int ns16550_write_support_polled( - int minor, - const char *buf, - int len - ); - -NS16550_STATIC int ns16550_inbyte_nonblocking_polled( - int minor -); - -NS16550_STATIC void ns16550_enable_interrupts( - int minor, - int mask -); - -NS16550_STATIC int ns16550_set_attributes( - int minor, - const struct termios *t -); - -#ifdef __cplusplus -} -#endif - -#endif /* _NS16550_P_H_ */ diff --git a/c/src/lib/libchip/serial/serial.h b/c/src/lib/libchip/serial/serial.h deleted file mode 100644 index aa0e7f58aa..0000000000 --- a/c/src/lib/libchip/serial/serial.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * This file contains the TTY driver table definition - * - * This driver uses the termios pseudo driver. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __LIBCHIP_SERIAL_h -#define __LIBCHIP_SERIAL_h - -#include <termios.h> - -/* - * Types for get and set register routines - */ - -typedef unsigned8 (*getRegister_f)(unsigned32 port, unsigned8 register); -typedef void (*setRegister_f)( - unsigned32 port, unsigned8 reg, unsigned8 value); -typedef unsigned8 (*getData_f)(unsigned32 port); -typedef void (*setData_f)(unsigned32 port, unsigned8 value); - -typedef struct _console_fns { - boolean (*deviceProbe)(int minor); - int (*deviceFirstOpen)(int major, int minor, void *arg); - int (*deviceLastClose)(int major, int minor, void *arg); - int (*deviceRead)(int minor); - int (*deviceWrite)(int minor, const char *buf, int len); - void (*deviceInitialize)(int minor); - void (*deviceWritePolled)(int minor, char cChar); - int (*deviceSetAttributes)(int minor, const struct termios *t); - int deviceOutputUsesInterrupts; -} console_fns; - -typedef struct _console_flow { - int (*deviceStopRemoteTx)(int minor); - int (*deviceStartRemoteTx)(int minor); -} console_flow; - -typedef enum { - SERIAL_MC68681, /* Motorola MC68681 or Exar 88681 */ - SERIAL_NS16550, /* National Semiconductor NS16550 */ - SERIAL_Z85C30, /* Zilog Z85C30 */ - SERIAL_CUSTOM /* BSP specific driver */ -} console_devs; - -/* - * Each field is interpreted thus: - * - * sDeviceName This is the name of the device. - * - * deviceType This indicates the chip type. It is especially important when - * multiple devices share the same interrupt vector and must be - * distinguished. - * - * pDeviceFns This is a pointer to the set of driver routines to use. - * - * pDeviceFlow This is a pointer to the set of flow control routines to - * use. Serial device drivers will typically supply RTSCTS - * and DTRCTS handshake routines for DCE to DCE communication, - * however for DCE to DTE communication, no such routines - * should be necessary as RTS will be driven automatically - * when the transmitter is active. - * - * ulMargin The high water mark in the input buffer is set to the buffer - * size less ulMargin. Once this level is reached, the driver's - * flow control routine used to stop the remote transmitter will - * be called. This figure should be greater than or equal to - * the number of stages of FIFO between the transmitter and - * receiver. - * - * NOTE: At the current time, this parameter is hard coded - * in termios and this number is ignored. - * - * ulHysteresis After the high water mark specified by ulMargin has been - * reached, the driver's routine to re-start the remote - * transmitter will be called once the level in the input - * buffer has fallen by ulHysteresis bytes. - * - * NOTE: At the current time, this parameter is hard coded - * in termios and this number is ignored. - * - * pDeviceParams This contains either device specific data or a pointer to a - * device specific structure containing additional information - * not provided in this table. - * - * ulCtrlPort1 This is the primary control port number for the device. This - * may be used to specify different instances of the same device - * type. - * - * ulCtrlPort2 This is the secondary control port number, of use when a given - * device has more than one available channel. - * - * ulDataPort This is the port number for the data port of the device - * - * getRegister This is the routine used to read register values. - * - * setRegister This is the routine used to write register values. - * - * getData This is the routine used to read the data register (RX). - * - * setData This is the routine used to write the data register (TX). - * - * ulClock This is the baud rate clock speed. - * - * ulIntVector This encodes the interrupt vector of the device. - */ - -typedef struct _console_tbl { - char *sDeviceName; - console_devs deviceType; - console_fns *pDeviceFns; - boolean (*deviceProbe)(int minor); - console_flow *pDeviceFlow; - unsigned32 ulMargin; - unsigned32 ulHysteresis; - void *pDeviceParams; - unsigned32 ulCtrlPort1; - unsigned32 ulCtrlPort2; - unsigned32 ulDataPort; - getRegister_f getRegister; - setRegister_f setRegister; - getData_f getData; - setData_f setData; - unsigned32 ulClock; - unsigned int ulIntVector; -} console_tbl; - -typedef struct _console_data { - void *termios_data; - volatile boolean bActive; - /* - * This field may be used for any purpose required by the driver - */ - void *pDeviceContext; -} console_data; - -extern console_tbl Console_Port_Tbl[]; -extern console_data Console_Port_Data[]; -extern unsigned long Console_Port_Count; - -#endif -/* end of include file */ diff --git a/c/src/lib/libchip/serial/serprobe.c b/c/src/lib/libchip/serial/serprobe.c deleted file mode 100644 index b76bbebe3c..0000000000 --- a/c/src/lib/libchip/serial/serprobe.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * $Id$ - */ - -#include <rtems.h> -#include <libchip/serial.h> -#include "sersupp.h" - -boolean libchip_serial_default_probe(int minor) -{ - /* - * If the configuration dependent probe has located the device then - * assume it is there - */ - - return TRUE; -} - - - diff --git a/c/src/lib/libchip/serial/sersupp.h b/c/src/lib/libchip/serial/sersupp.h deleted file mode 100644 index a996d53c7c..0000000000 --- a/c/src/lib/libchip/serial/sersupp.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * $Id$ - */ - -#ifndef __LIBCHIP_SERIAL_SUPPORT_h -#define __LIBCHIP_SERIAL_SUPPORT_h - -int termios_baud_to_index( - int termios_baud -); - -int termios_baud_to_number( - int termios_baud -); - -boolean libchip_serial_default_probe( - int minor -); - - -#endif -/* end of include file */ diff --git a/c/src/lib/libchip/serial/termios_baud2index.c b/c/src/lib/libchip/serial/termios_baud2index.c deleted file mode 100644 index b4bf3623a2..0000000000 --- a/c/src/lib/libchip/serial/termios_baud2index.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * $Id$ - */ - -#include <sys/termios.h> - -int termios_baud_to_index( - int termios_baud -) -{ - int baud_index; - - switch (termios_baud) { - case B0: baud_index = 0; break; - case B50: baud_index = 1; break; - case B75: baud_index = 2; break; - case B110: baud_index = 3; break; - case B134: baud_index = 4; break; - case B150: baud_index = 5; break; - case B200: baud_index = 6; break; - case B300: baud_index = 7; break; - case B600: baud_index = 8; break; - case B1200: baud_index = 9; break; - case B1800: baud_index = 10; break; - case B2400: baud_index = 11; break; - case B4800: baud_index = 12; break; - case B9600: baud_index = 13; break; - case B19200: baud_index = 14; break; - case B38400: baud_index = 15; break; - case B57600: baud_index = 16; break; - case B115200: baud_index = 17; break; - case B230400: baud_index = 18; break; - case B460800: baud_index = 19; break; - default: baud_index = -1; break; - } - - return baud_index; -} - diff --git a/c/src/lib/libchip/serial/termios_baud2num.c b/c/src/lib/libchip/serial/termios_baud2num.c deleted file mode 100644 index 9c2ddc047e..0000000000 --- a/c/src/lib/libchip/serial/termios_baud2num.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * $Id$ - */ - -#include <sys/termios.h> - -int termios_baud_to_number( - int termios_baud -) -{ - int baud; - - switch (termios_baud) { - case B0: baud = 0; break; - case B50: baud = 50; break; - case B75: baud = 75; break; - case B110: baud = 110; break; - case B134: baud = 135; break; - case B150: baud = 150; break; - case B200: baud = 200; break; - case B300: baud = 300; break; - case B600: baud = 600; break; - case B1200: baud = 1200; break; - case B1800: baud = 1800; break; - case B2400: baud = 2400; break; - case B4800: baud = 4800; break; - case B9600: baud = 9600; break; - case B19200: baud = 19200; break; - case B38400: baud = 38400; break; - case B57600: baud = 57600; break; - case B115200: baud = 115200; break; - case B230400: baud = 230400; break; - case B460800: baud = 460800; break; - default: baud = -1; break; - } - - return baud; -} - diff --git a/c/src/lib/libchip/serial/z85c30.c b/c/src/lib/libchip/serial/z85c30.c deleted file mode 100644 index a4f3aaceee..0000000000 --- a/c/src/lib/libchip/serial/z85c30.c +++ /dev/null @@ -1,888 +0,0 @@ -/* - * This file contains the console driver chip level routines for the - * Zilog z85c30 chip. - * - * The Zilog Z8530 is also available as: - * - * + Intel 82530 - * + AMD ??? - * - * COPYRIGHT (c) 1998 by Radstone Technology - * - * - * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY - * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK - * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. - * - * You are hereby granted permission to use, copy, modify, and distribute - * this file, provided that this notice, plus the above copyright notice - * and disclaimer, appears in all copies. Radstone Technology will provide - * no support for this code. - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include <rtems.h> -#include <rtems/libio.h> -#include <stdlib.h> - -#include <libchip/serial.h> -#include "z85c30_p.h" -#include "sersupp.h" - -/* - * Flow control is only supported when using interrupts - */ - -console_flow z85c30_flow_RTSCTS = { - z85c30_negate_RTS, /* deviceStopRemoteTx */ - z85c30_assert_RTS /* deviceStartRemoteTx */ -}; - -console_flow z85c30_flow_DTRCTS = { - z85c30_negate_DTR, /* deviceStopRemoteTx */ - z85c30_assert_DTR /* deviceStartRemoteTx */ -}; - -/* - * Exported driver function table - */ - -console_fns z85c30_fns = { - libchip_serial_default_probe, /* deviceProbe */ - z85c30_open, /* deviceFirstOpen */ - NULL, /* deviceLastClose */ - NULL, /* deviceRead */ - z85c30_write_support_int, /* deviceWrite */ - z85c30_initialize_interrupts, /* deviceInitialize */ - z85c30_write_polled, /* deviceWritePolled */ - NULL, /* deviceSetAttributes */ - TRUE /* deviceOutputUsesInterrupts */ -}; - -console_fns z85c30_fns_polled = { - libchip_serial_default_probe, /* deviceProbe */ - z85c30_open, /* deviceFirstOpen */ - z85c30_close, /* deviceLastClose */ - z85c30_inbyte_nonblocking_polled, /* deviceRead */ - z85c30_write_support_polled, /* deviceWrite */ - z85c30_init, /* deviceInitialize */ - z85c30_write_polled, /* deviceWritePolled */ - NULL, /* deviceSetAttributes */ - FALSE /* deviceOutputUsesInterrupts */ -}; - -extern void set_vector( rtems_isr_entry, rtems_vector_number, int ); - -/* - * z85c30_initialize_port - * - * initialize a z85c30 Port - */ - -Z85C30_STATIC void z85c30_initialize_port( - int minor -) -{ - unsigned32 ulCtrlPort; - unsigned32 ulBaudDivisor; - setRegister_f setReg; - - ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1; - setReg = Console_Port_Tbl[minor].setRegister; - - /* - * Using register 4 - * Set up the clock rate is 16 times the data - * rate, 8 bit sync char, 1 stop bit, no parity - */ - - (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR4, SCC_WR4_1_STOP | SCC_WR4_16_CLOCK ); - - /* - * Set up for 8 bits/character on receive with - * receiver disable via register 3 - */ - (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR3, SCC_WR3_RX_8_BITS ); - - /* - * Set up for 8 bits/character on transmit - * with transmitter disable via register 5 - */ - (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR5, SCC_WR5_TX_8_BITS ); - - /* - * Clear misc control bits - */ - (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR10, 0x00 ); - - /* - * Setup the source of the receive and xmit - * clock as BRG output and the transmit clock - * as the output source for TRxC pin via register 11 - */ - (*setReg)( - ulCtrlPort, - SCC_WR0_SEL_WR11, - SCC_WR11_OUT_BR_GEN | SCC_WR11_TRXC_OI | - SCC_WR11_TX_BR_GEN | SCC_WR11_RX_BR_GEN - ); - - ulBaudDivisor = Z85C30_Baud( - (unsigned32) Console_Port_Tbl[minor].ulClock, - (unsigned32) Console_Port_Tbl[minor].pDeviceParams - ); - - /* - * Setup the lower 8 bits time constants=1E. - * If the time constans=1E, then the desire - * baud rate will be equilvalent to 9600, via register 12. - */ - (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR12, ulBaudDivisor & 0xff ); - - /* - * using register 13 - * Setup the upper 8 bits time constant - */ - (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR13, (ulBaudDivisor>>8) & 0xff ); - - /* - * Enable the baud rate generator enable with clock from the - * SCC's PCLK input via register 14. - */ - (*setReg)( - ulCtrlPort, - SCC_WR0_SEL_WR14, - SCC_WR14_BR_EN | SCC_WR14_BR_SRC | SCC_WR14_NULL - ); - - /* - * We are only interested in CTS state changes - */ - (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR15, SCC_WR15_CTS_IE ); - - /* - * Reset errors - */ - (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR0, SCC_WR0_RST_INT ); - - (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR0, SCC_WR0_ERR_RST ); - - /* - * Enable the receiver via register 3 - */ - (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR3, SCC_WR3_RX_8_BITS | SCC_WR3_RX_EN ); - - /* - * Enable the transmitter pins set via register 5. - */ - (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR5, SCC_WR5_TX_8_BITS | SCC_WR5_TX_EN ); - - /* - * Disable interrupts - */ - (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR1, 0 ); - - /* - * Reset TX CRC - */ - (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR0, SCC_WR0_RST_TX_CRC ); - - /* - * Reset interrupts - */ - (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR0, SCC_WR0_RST_INT ); -} - -/* - * z85c30_open - */ - -Z85C30_STATIC int z85c30_open( - int major, - int minor, - void *arg -) -{ - - z85c30_initialize_port(minor); - - /* - * Assert DTR - */ - - if (Console_Port_Tbl[minor].pDeviceFlow !=&z85c30_flow_DTRCTS) { - z85c30_assert_DTR(minor); - } - - return(RTEMS_SUCCESSFUL); -} - -/* - * z85c30_close - */ - -Z85C30_STATIC int z85c30_close( - int major, - int minor, - void *arg -) -{ - /* - * Negate DTR - */ - - if (Console_Port_Tbl[minor].pDeviceFlow !=&z85c30_flow_DTRCTS) { - z85c30_negate_DTR(minor); - } - - return(RTEMS_SUCCESSFUL); -} - -/* - * z85c30_init - */ - -Z85C30_STATIC void z85c30_init(int minor) -{ - unsigned32 ulCtrlPort; - unsigned8 dummy; - z85c30_context *pz85c30Context; - setRegister_f setReg; - getRegister_f getReg; - - setReg = Console_Port_Tbl[minor].setRegister; - getReg = Console_Port_Tbl[minor].getRegister; - - pz85c30Context = (z85c30_context *)malloc(sizeof(z85c30_context)); - - Console_Port_Data[minor].pDeviceContext = (void *)pz85c30Context; - - pz85c30Context->ucModemCtrl = SCC_WR5_TX_8_BITS | SCC_WR5_TX_EN; - - ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1; - if ( ulCtrlPort == Console_Port_Tbl[minor].ulCtrlPort2 ) { - /* - * This is channel A - */ - /* - * Ensure port state machine is reset - */ - dummy = (*getReg)(ulCtrlPort, SCC_WR0_SEL_RD0); - - (*setReg)(ulCtrlPort, SCC_WR0_SEL_WR9, SCC_WR9_CH_A_RST); - - } else { - /* - * This is channel B - */ - /* - * Ensure port state machine is reset - */ - dummy = (*getReg)(ulCtrlPort, SCC_WR0_SEL_RD0); - - (*setReg)(ulCtrlPort, SCC_WR0_SEL_WR9, SCC_WR9_CH_B_RST); - } -} - -/* - * These routines provide control of the RTS and DTR lines - */ - -/* - * z85c30_assert_RTS - */ - -Z85C30_STATIC int z85c30_assert_RTS(int minor) -{ - rtems_interrupt_level Irql; - z85c30_context *pz85c30Context; - setRegister_f setReg; - - setReg = Console_Port_Tbl[minor].setRegister; - - pz85c30Context = (z85c30_context *) Console_Port_Data[minor].pDeviceContext; - - /* - * Assert RTS - */ - - rtems_interrupt_disable(Irql); - pz85c30Context->ucModemCtrl|=SCC_WR5_RTS; - (*setReg)( - Console_Port_Tbl[minor].ulCtrlPort1, - SCC_WR0_SEL_WR5, - pz85c30Context->ucModemCtrl - ); - rtems_interrupt_enable(Irql); - return 0; -} - -/* - * z85c30_negate_RTS - */ - -Z85C30_STATIC int z85c30_negate_RTS(int minor) -{ - rtems_interrupt_level Irql; - z85c30_context *pz85c30Context; - setRegister_f setReg; - - setReg = Console_Port_Tbl[minor].setRegister; - - pz85c30Context = (z85c30_context *) Console_Port_Data[minor].pDeviceContext; - - /* - * Negate RTS - */ - - rtems_interrupt_disable(Irql); - pz85c30Context->ucModemCtrl&=~SCC_WR5_RTS; - (*setReg)( - Console_Port_Tbl[minor].ulCtrlPort1, - SCC_WR0_SEL_WR5, - pz85c30Context->ucModemCtrl - ); - rtems_interrupt_enable(Irql); - return 0; -} - -/* - * These flow control routines utilise a connection from the local DTR - * line to the remote CTS line - */ - -/* - * z85c30_assert_DTR - */ - -Z85C30_STATIC int z85c30_assert_DTR(int minor) -{ - rtems_interrupt_level Irql; - z85c30_context *pz85c30Context; - setRegister_f setReg; - - setReg = Console_Port_Tbl[minor].setRegister; - - pz85c30Context = (z85c30_context *) Console_Port_Data[minor].pDeviceContext; - - /* - * Assert DTR - */ - - rtems_interrupt_disable(Irql); - pz85c30Context->ucModemCtrl|=SCC_WR5_DTR; - (*setReg)( - Console_Port_Tbl[minor].ulCtrlPort1, - SCC_WR0_SEL_WR5, - pz85c30Context->ucModemCtrl - ); - rtems_interrupt_enable(Irql); - return 0; -} - -/* - * z85c30_negate_DTR - */ - -Z85C30_STATIC int z85c30_negate_DTR(int minor) -{ - rtems_interrupt_level Irql; - z85c30_context *pz85c30Context; - setRegister_f setReg; - - setReg = Console_Port_Tbl[minor].setRegister; - - pz85c30Context = (z85c30_context *) Console_Port_Data[minor].pDeviceContext; - - /* - * Negate DTR - */ - - rtems_interrupt_disable(Irql); - pz85c30Context->ucModemCtrl&=~SCC_WR5_DTR; - (*setReg)( - Console_Port_Tbl[minor].ulCtrlPort1, - SCC_WR0_SEL_WR5, - pz85c30Context->ucModemCtrl - ); - rtems_interrupt_enable(Irql); - return 0; -} - -/* - * z85c30_set_attributes - * - * This function sets the SCC channel to reflect the requested termios - * port settings. - */ - -Z85C30_STATIC int z85c30_set_attributes( - int minor, - const struct termios *t -) -{ - unsigned32 ulCtrlPort; - unsigned32 ulBaudDivisor; - unsigned32 wr3; - unsigned32 wr4; - unsigned32 wr5; - int baud_requested; - setRegister_f setReg; - rtems_interrupt_level Irql; - - ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1; - setReg = Console_Port_Tbl[minor].setRegister; - - /* - * Calculate the baud rate divisor - */ - - baud_requested = t->c_cflag & CBAUD; - if (!baud_requested) - baud_requested = B9600; /* default to 9600 baud */ - - ulBaudDivisor = Z85C30_Baud( - (unsigned32) Console_Port_Tbl[minor].ulClock, - (unsigned32) termios_baud_to_number( baud_requested ) - ); - - wr3 = SCC_WR3_RX_EN; - wr4 = SCC_WR4_16_CLOCK; - wr5 = SCC_WR5_TX_EN; - - /* - * Parity - */ - - if (t->c_cflag & PARENB) { - wr4 |= SCC_WR4_PAR_EN; - if (!(t->c_cflag & PARODD)) - wr4 |= SCC_WR4_PAR_EVEN; - } - - /* - * Character Size - */ - - if (t->c_cflag & CSIZE) { - switch (t->c_cflag & CSIZE) { - case CS5: break; - case CS6: wr3 |= SCC_WR3_RX_6_BITS; wr5 |= SCC_WR5_TX_6_BITS; break; - case CS7: wr3 |= SCC_WR3_RX_7_BITS; wr5 |= SCC_WR5_TX_7_BITS; break; - case CS8: wr3 |= SCC_WR3_RX_8_BITS; wr5 |= SCC_WR5_TX_8_BITS; break; - } - } else { - wr3 |= SCC_WR3_RX_8_BITS; /* default to 9600,8,N,1 */ - wr5 |= SCC_WR5_TX_8_BITS; /* default to 9600,8,N,1 */ - } - - /* - * Stop Bits - */ - - if (t->c_cflag & CSTOPB) { - wr4 |= SCC_WR4_2_STOP; /* 2 stop bits */ - } else { - wr4 |= SCC_WR4_1_STOP; /* 1 stop bits */ - } - - /* - * Now actually set the chip - */ - - rtems_interrupt_disable(Irql); - (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR4, wr4 ); - (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR3, wr3 ); - (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR5, wr5 ); - - /* - * Setup the lower 8 bits time constants=1E. - * If the time constans=1E, then the desire - * baud rate will be equilvalent to 9600, via register 12. - */ - - (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR12, ulBaudDivisor & 0xff ); - - /* - * using register 13 - * Setup the upper 8 bits time constant - */ - - (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR13, (ulBaudDivisor>>8) & 0xff ); - - rtems_interrupt_enable(Irql); - - return 0; -} - -/* - * z85c30_process - * - * This is the per port ISR handler. - */ - -Z85C30_STATIC void z85c30_process( - int minor, - unsigned8 ucIntPend -) -{ - unsigned32 ulCtrlPort; - volatile unsigned8 z85c30_status; - unsigned char cChar; - setRegister_f setReg; - getRegister_f getReg; - - ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1; - setReg = Console_Port_Tbl[minor].setRegister; - getReg = Console_Port_Tbl[minor].getRegister; - - /* - * Deal with any received characters - */ - - while (ucIntPend&SCC_RR3_B_RX_IP) - { - z85c30_status = (*getReg)(ulCtrlPort, SCC_WR0_SEL_RD0); - if (!Z85C30_Status_Is_RX_character_available(z85c30_status)) { - break; - } - - /* - * Return the character read. - */ - - cChar = (*getReg)(ulCtrlPort, SCC_WR0_SEL_RD8); - - rtems_termios_enqueue_raw_characters( - Console_Port_Data[minor].termios_data, - &cChar, - 1 - ); - } - - /* - * There could be a race condition here if there is not yet a TX - * interrupt pending but the buffer is empty. This condition has - * been seen before on other z8530 drivers but has not been seen - * with this one. The typical solution is to use "vector includes - * status" or to only look at the interrupts actually pending - * in RR3. - */ - - while (TRUE) { - z85c30_status = (*getReg)(ulCtrlPort, SCC_WR0_SEL_RD0); - if (!Z85C30_Status_Is_TX_buffer_empty(z85c30_status)) { - /* - * We'll get another interrupt when - * the transmitter holding reg. becomes - * free again and we are clear to send - */ - break; - } - -#if 0 - if (!Z85C30_Status_Is_CTS_asserted(z85c30_status)) { - /* - * We can't transmit yet - */ - (*setReg)(ulCtrlPort, SCC_WR0_SEL_WR0, SCC_WR0_RST_TX_INT); - /* - * The next state change of CTS will wake us up - */ - break; - } -#endif - - rtems_termios_dequeue_characters(Console_Port_Data[minor].termios_data, 1); - if (rtems_termios_is_more_to_tx( Console_Port_Data[minor].termios_data )) { - if (Console_Port_Tbl[minor].pDeviceFlow != &z85c30_flow_RTSCTS) { - z85c30_negate_RTS(minor); - } - Console_Port_Data[minor].bActive = FALSE; - z85c30_enable_interrupts(minor, SCC_ENABLE_ALL_INTR_EXCEPT_TX); - (*setReg)(ulCtrlPort, SCC_WR0_SEL_WR0, SCC_WR0_RST_TX_INT); - break; - } - - } - - if (ucIntPend & SCC_RR3_B_EXT_IP) { - /* - * Clear the external status interrupt - */ - (*setReg)(ulCtrlPort, SCC_WR0_SEL_WR0, SCC_WR0_RST_INT); - z85c30_status = (*getReg)(ulCtrlPort, SCC_WR0_SEL_RD0); - } - - /* - * Reset interrupts - */ - (*setReg)(ulCtrlPort, SCC_WR0_SEL_WR0, SCC_WR0_RST_HI_IUS); -} - -/* - * z85c30_isr - * - * This is the ISR handler for each Z8530. - */ - -Z85C30_STATIC rtems_isr z85c30_isr( - rtems_vector_number vector -) -{ - int minor; - unsigned32 ulCtrlPort; - volatile unsigned8 ucIntPend; - volatile unsigned8 ucIntPendPort; - getRegister_f getReg; - - for (minor=0;minor<Console_Port_Count;minor++) { - if(Console_Port_Tbl[minor].ulIntVector == vector && - Console_Port_Tbl[minor].deviceType == SERIAL_Z85C30 ) { - ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort2; - getReg = Console_Port_Tbl[minor].getRegister; - do { - ucIntPend = (*getReg)(ulCtrlPort, SCC_WR0_SEL_RD3); - - /* - * If this is channel A select channel A status - */ - - if (ulCtrlPort == Console_Port_Tbl[minor].ulCtrlPort1) { - ucIntPendPort = ucIntPend>>3; - ucIntPendPort = ucIntPendPort&=7; - } else { - ucIntPendPort = ucIntPend &= 7; - } - - if (ucIntPendPort) { - z85c30_process(minor, ucIntPendPort); - } - } while (ucIntPendPort); - } - } -} - -/* - * z85c30_enable_interrupts - * - * This routine enables the specified interrupts for this minor. - */ - -Z85C30_STATIC void z85c30_enable_interrupts( - int minor, - int interrupt_mask -) -{ - unsigned32 ulCtrlPort; - setRegister_f setReg; - - ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1; - setReg = Console_Port_Tbl[minor].setRegister; - - (*setReg)(ulCtrlPort, SCC_WR0_SEL_WR1, interrupt_mask); -} - -/* - * z85c30_initialize_interrupts - * - * This routine initializes the port to use interrupts. - */ - -Z85C30_STATIC void z85c30_initialize_interrupts( - int minor -) -{ - unsigned32 ulCtrlPort1; - unsigned32 ulCtrlPort2; - setRegister_f setReg; - - ulCtrlPort1 = Console_Port_Tbl[minor].ulCtrlPort1; - ulCtrlPort2 = Console_Port_Tbl[minor].ulCtrlPort2; - setReg = Console_Port_Tbl[minor].setRegister; - - - z85c30_init(minor); - - Console_Port_Data[minor].bActive=FALSE; - - z85c30_initialize_port( minor ); - - if (Console_Port_Tbl[minor].pDeviceFlow != &z85c30_flow_RTSCTS) { - z85c30_negate_RTS(minor); - } - - set_vector(z85c30_isr, Console_Port_Tbl[minor].ulIntVector, 1); - - z85c30_enable_interrupts(minor, SCC_ENABLE_ALL_INTR_EXCEPT_TX); - - (*setReg)(ulCtrlPort1, SCC_WR0_SEL_WR2, 0); /* XXX vector */ - (*setReg)(ulCtrlPort1, SCC_WR0_SEL_WR9, SCC_WR9_MIE); - - /* - * Reset interrupts - */ - - (*setReg)(ulCtrlPort1, SCC_WR0_SEL_WR0, SCC_WR0_RST_INT); -} - -/* - * z85c30_write_support_int - * - * Console Termios output entry point. - * - */ - -Z85C30_STATIC int z85c30_write_support_int( - int minor, - const char *buf, - int len) -{ - unsigned32 Irql; - unsigned32 ulCtrlPort; - setRegister_f setReg; - - ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1; - setReg = Console_Port_Tbl[minor].setRegister; - - /* - * We are using interrupt driven output and termios only sends us - * one character at a time. - */ - - if ( !len ) - return 0; - - /* - * Put the character out and enable interrupts if necessary. - */ - - if (Console_Port_Tbl[minor].pDeviceFlow != &z85c30_flow_RTSCTS) { - z85c30_assert_RTS(minor); - } - rtems_interrupt_disable(Irql); - if ( Console_Port_Data[minor].bActive == FALSE) { - Console_Port_Data[minor].bActive = TRUE; - z85c30_enable_interrupts(minor, SCC_ENABLE_ALL_INTR); - } - (*setReg)(ulCtrlPort, SCC_WR0_SEL_WR8, *buf); - rtems_interrupt_enable(Irql); - - return 1; -} - -/* - * z85c30_inbyte_nonblocking_polled - * - * This routine polls for a character. - */ - -Z85C30_STATIC int z85c30_inbyte_nonblocking_polled( - int minor -) -{ - volatile unsigned8 z85c30_status; - unsigned32 ulCtrlPort; - getRegister_f getReg; - - ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1; - getReg = Console_Port_Tbl[minor].getRegister; - - /* - * return -1 if a character is not available. - */ - z85c30_status = (*getReg)(ulCtrlPort, SCC_WR0_SEL_RD0); - if (!Z85C30_Status_Is_RX_character_available(z85c30_status)) { - return -1; - } - - /* - * Return the character read. - */ - - return (*getReg)(ulCtrlPort, SCC_WR0_SEL_RD8); -} - -/* - * z85c30_write_support_polled - * - * Console Termios output entry point. - * - */ - -Z85C30_STATIC int z85c30_write_support_polled( - int minor, - const char *buf, - int len) -{ - int nwrite=0; - - /* - * poll each byte in the string out of the port. - */ - while (nwrite < len) { - z85c30_write_polled(minor, *buf++); - nwrite++; - } - - /* - * return the number of bytes written. - */ - return nwrite; -} - -/* - * z85c30_write_polled - * - * This routine transmits a character using polling. - */ - -Z85C30_STATIC void z85c30_write_polled( - int minor, - char cChar -) -{ - volatile unsigned8 z85c30_status; - unsigned32 ulCtrlPort; - getRegister_f getReg; - setRegister_f setReg; - - ulCtrlPort = Console_Port_Tbl[minor].ulCtrlPort1; - getReg = Console_Port_Tbl[minor].getRegister; - setReg = Console_Port_Tbl[minor].setRegister; - - /* - * Wait for the Transmit buffer to indicate that it is empty. - */ - - z85c30_status = (*getReg)( ulCtrlPort, SCC_WR0_SEL_RD0 ); - - while (!Z85C30_Status_Is_TX_buffer_empty(z85c30_status)) { - /* - * Yield while we wait - */ -#if 0 - if (_System_state_Is_up(_System_state_Get())) { - rtems_task_wake_after(RTEMS_YIELD_PROCESSOR); - } -#endif - z85c30_status = (*getReg)(ulCtrlPort, SCC_WR0_SEL_RD0); - } - - /* - * Write the character. - */ - - (*setReg)( ulCtrlPort, SCC_WR0_SEL_WR8, cChar ); -} - diff --git a/c/src/lib/libchip/serial/z85c30.h b/c/src/lib/libchip/serial/z85c30.h deleted file mode 100644 index f1beeef5e0..0000000000 --- a/c/src/lib/libchip/serial/z85c30.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * This include file contains all console driver definitions for the - * Zilog z85c30. - * - * COPYRIGHT (c) 1998 by Radstone Technology - * - * - * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY - * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK - * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. - * - * You are hereby granted permission to use, copy, modify, and distribute - * this file, provided that this notice, plus the above copyright notice - * and disclaimer, appears in all copies. Radstone Technology will provide - * no support for this code. - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may in - * the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id: - */ - -#ifndef __Z85C30_H -#define __Z85C30_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Driver function table - */ - -extern console_fns z85c30_fns; -extern console_fns z85c30_fns_polled; - -/* - * Flow control function tables - */ - -extern console_flow z85c30_flow_RTSCTS; -extern console_flow z85c30_flow_DTRCTS; - -/* - * Default register access routines - */ - -unsigned8 z85c30_get_register( /* registers are byte-wide */ - unsigned32 ulCtrlPort, - unsigned8 ucRegNum -); - -void z85c30_set_register( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned8 ucData -); - -unsigned8 z85c30_get_data( - unsigned32 ulDataPort -); - -void z85c30_set_data( - unsigned32 ulDataPort, - unsigned8 ucData -); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/c/src/lib/libchip/serial/z85c30_p.h b/c/src/lib/libchip/serial/z85c30_p.h deleted file mode 100644 index 0076fbeaef..0000000000 --- a/c/src/lib/libchip/serial/z85c30_p.h +++ /dev/null @@ -1,410 +0,0 @@ -/* - * This include file contains all private driver definitions for the - * Zilog z85c30. - * - * COPYRIGHT (c) 1998 by Radstone Technology - * - * - * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY - * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK - * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. - * - * You are hereby granted permission to use, copy, modify, and distribute - * this file, provided that this notice, plus the above copyright notice - * and disclaimer, appears in all copies. Radstone Technology will provide - * no support for this code. - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may in - * the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __Z85C30_P_H -#define __Z85C30_P_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Define Z85C30_STATIC to nothing while debugging so the entry points - * will show up in the symbol table. - */ - -#define Z85C30_STATIC - -/* #define Z85C30_STATIC static */ - -/* bit values for write register 0 */ -/* command register */ - -#define SCC_WR0_SEL_WR0 0x00 -#define SCC_WR0_SEL_WR1 0x01 -#define SCC_WR0_SEL_WR2 0x02 -#define SCC_WR0_SEL_WR3 0x03 -#define SCC_WR0_SEL_WR4 0x04 -#define SCC_WR0_SEL_WR5 0x05 -#define SCC_WR0_SEL_WR6 0x06 -#define SCC_WR0_SEL_WR7 0x07 -#define SCC_WR0_SEL_WR8 0x08 -#define SCC_WR0_SEL_WR9 0x09 -#define SCC_WR0_SEL_WR10 0x0a -#define SCC_WR0_SEL_WR11 0x0b -#define SCC_WR0_SEL_WR12 0x0c -#define SCC_WR0_SEL_WR13 0x0d -#define SCC_WR0_SEL_WR14 0x0e -#define SCC_WR0_SEL_WR15 0x0f -#define SCC_WR0_SEL_RD0 0x00 -#define SCC_WR0_SEL_RD1 0x01 -#define SCC_WR0_SEL_RD2 0x02 -#define SCC_WR0_SEL_RD3 0x03 -#define SCC_WR0_SEL_RD4 0x04 -#define SCC_WR0_SEL_RD5 0x05 -#define SCC_WR0_SEL_RD6 0x06 -#define SCC_WR0_SEL_RD7 0x07 -#define SCC_WR0_SEL_RD8 0x08 -#define SCC_WR0_SEL_RD9 0x09 -#define SCC_WR0_SEL_RD10 0x0a -#define SCC_WR0_SEL_RD11 0x0b -#define SCC_WR0_SEL_RD12 0x0c -#define SCC_WR0_SEL_RD13 0x0d -#define SCC_WR0_SEL_RD14 0x0e -#define SCC_WR0_SEL_RD15 0x0f -#define SCC_WR0_NULL_CODE 0x00 -#define SCC_WR0_RST_INT 0x10 -#define SCC_WR0_SEND_ABORT 0x18 -#define SCC_WR0_EN_INT_RX 0x20 -#define SCC_WR0_RST_TX_INT 0x28 -#define SCC_WR0_ERR_RST 0x30 -#define SCC_WR0_RST_HI_IUS 0x38 -#define SCC_WR0_RST_RX_CRC 0x40 -#define SCC_WR0_RST_TX_CRC 0x80 -#define SCC_WR0_RST_TX_UND 0xc0 - -/* write register 2 */ -/* interrupt vector */ - -/* bit values for write register 1 */ -/* tx/rx interrupt and data transfer mode definition */ - -#define SCC_WR1_EXT_INT_EN 0x01 -#define SCC_WR1_TX_INT_EN 0x02 -#define SCC_WR1_PARITY 0x04 -#define SCC_WR1_RX_INT_DIS 0x00 -#define SCC_WR1_RX_INT_FIR 0x08 -#define SCC_WR1_INT_ALL_RX 0x10 -#define SCC_WR1_RX_INT_SPE 0x18 -#define SCC_WR1_RDMA_RECTR 0x20 -#define SCC_WR1_RDMA_FUNC 0x40 -#define SCC_WR1_RDMA_EN 0x80 - -#define SCC_ENABLE_ALL_INTR \ - (SCC_WR1_EXT_INT_EN | SCC_WR1_TX_INT_EN | SCC_WR1_INT_ALL_RX) - -#define SCC_DISABLE_ALL_INTR 0x00 - -#define SCC_ENABLE_ALL_INTR_EXCEPT_TX \ - (SCC_WR1_EXT_INT_EN | SCC_WR1_INT_ALL_RX) - -/* bit values for write register 3 */ -/* receive parameters and control */ - -#define SCC_WR3_RX_EN 0x01 -#define SCC_WR3_SYNC_CHAR 0x02 -#define SCC_WR3_ADR_SEARCH 0x04 -#define SCC_WR3_RX_CRC_EN 0x08 -#define SCC_WR3_ENTER_HUNT 0x10 -#define SCC_WR3_AUTO_EN 0x20 -#define SCC_WR3_RX_5_BITS 0x00 -#define SCC_WR3_RX_7_BITS 0x40 -#define SCC_WR3_RX_6_BITS 0x80 -#define SCC_WR3_RX_8_BITS 0xc0 - -/* bit values for write register 4 */ -/* tx/rx misc parameters and modes */ - -#define SCC_WR4_PAR_EN 0x01 -#define SCC_WR4_PAR_EVEN 0x02 -#define SCC_WR4_SYNC_EN 0x00 -#define SCC_WR4_1_STOP 0x04 -#define SCC_WR4_2_STOP 0x0c -#define SCC_WR4_8_SYNC 0x00 -#define SCC_WR4_16_SYNC 0x10 -#define SCC_WR4_SDLC 0x20 -#define SCC_WR4_EXT_SYNC 0x30 -#define SCC_WR4_1_CLOCK 0x00 -#define SCC_WR4_16_CLOCK 0x40 -#define SCC_WR4_32_CLOCK 0x80 -#define SCC_WR4_64_CLOCK 0xc0 - -/* bit values for write register 5 */ -/* transmit parameter and controls */ - -#define SCC_WR5_TX_CRC_EN 0x01 -#define SCC_WR5_RTS 0x02 -#define SCC_WR5_SDLC 0x04 -#define SCC_WR5_TX_EN 0x08 -#define SCC_WR5_SEND_BRK 0x10 - -#define SCC_WR5_TX_5_BITS 0x00 -#define SCC_WR5_TX_7_BITS 0x20 -#define SCC_WR5_TX_6_BITS 0x40 -#define SCC_WR5_TX_8_BITS 0x60 -#define SCC_WR5_DTR 0x80 - -/* write register 6 */ -/* sync chars or sdlc address field */ - -/* write register 7 */ -/* sync char or sdlc flag */ - -/* write register 8 */ -/* transmit buffer */ - -/* bit values for write register 9 */ -/* master interrupt control */ - -#define SCC_WR9_VIS 0x01 -#define SCC_WR9_NV 0x02 -#define SCC_WR9_DLC 0x04 -#define SCC_WR9_MIE 0x08 -#define SCC_WR9_STATUS_HI 0x10 -#define SCC_WR9_NO_RST 0x00 -#define SCC_WR9_CH_B_RST 0x40 -#define SCC_WR9_CH_A_RST 0x80 -#define SCC_WR9_HDWR_RST 0xc0 - -/* bit values for write register 10 */ -/* misc tx/rx control bits */ - -#define SCC_WR10_6_BIT_SYNC 0x01 -#define SCC_WR10_LOOP_MODE 0x02 -#define SCC_WR10_ABORT_UND 0x04 -#define SCC_WR10_MARK_IDLE 0x08 -#define SCC_WR10_ACT_POLL 0x10 -#define SCC_WR10_NRZ 0x00 -#define SCC_WR10_NRZI 0x20 -#define SCC_WR10_FM1 0x40 -#define SCC_WR10_FM0 0x60 -#define SCC_WR10_CRC_PRESET 0x80 - -/* bit values for write register 11 */ -/* clock mode control */ - -#define SCC_WR11_OUT_XTAL 0x00 -#define SCC_WR11_OUT_TX_CLK 0x01 -#define SCC_WR11_OUT_BR_GEN 0x02 -#define SCC_WR11_OUT_DPLL 0x03 -#define SCC_WR11_TRXC_OI 0x04 -#define SCC_WR11_TX_RTXC 0x00 -#define SCC_WR11_TX_TRXC 0x08 -#define SCC_WR11_TX_BR_GEN 0x10 -#define SCC_WR11_TX_DPLL 0x18 -#define SCC_WR11_RX_RTXC 0x00 -#define SCC_WR11_RX_TRXC 0x20 -#define SCC_WR11_RX_BR_GEN 0x40 -#define SCC_WR11_RX_DPLL 0x60 -#define SCC_WR11_RTXC_XTAL 0x80 - -/* write register 12 */ -/* lower byte of baud rate generator time constant */ - -/* write register 13 */ -/* upper byte of baud rate generator time constant */ - -/* bit values for write register 14 */ -/* misc control bits */ - -#define SCC_WR14_BR_EN 0x01 -#define SCC_WR14_BR_SRC 0x02 -#define SCC_WR14_DTR_FUNC 0x04 -#define SCC_WR14_AUTO_ECHO 0x08 -#define SCC_WR14_LCL_LOOP 0x10 -#define SCC_WR14_NULL 0x00 -#define SCC_WR14_SEARCH 0x20 -#define SCC_WR14_RST_CLK 0x40 -#define SCC_WR14_DIS_DPLL 0x60 -#define SCC_WR14_SRC_BR 0x80 -#define SCC_WR14_SRC_RTXC 0xa0 -#define SCC_WR14_FM_MODE 0xc0 -#define SCC_WR14_NRZI 0xe0 - -/* bit values for write register 15 */ -/* external/status interrupt control */ - -#define SCC_WR15_ZERO_CNT 0x02 -#define SCC_WR15_CD_IE 0x08 -#define SCC_WR15_SYNC_IE 0x10 -#define SCC_WR15_CTS_IE 0x20 -#define SCC_WR15_TX_UND_IE 0x40 -#define SCC_WR15_BREAK_IE 0x80 - -/* bit values for read register 0 */ -/* tx/rx buffer status and external status */ - -#define SCC_RR0_RX_AVAIL 0x01 -#define SCC_RR0_ZERO_CNT 0x02 -#define SCC_RR0_TX_EMPTY 0x04 -#define SCC_RR0_CD 0x08 -#define SCC_RR0_SYNC 0x10 -#define SCC_RR0_CTS 0x20 -#define SCC_RR0_TX_UND 0x40 -#define SCC_RR0_BREAK 0x80 - -/* bit values for read register 1 */ - -#define SCC_RR1_ALL_SENT 0x01 -#define SCC_RR1_RES_CD_2 0x02 -#define SCC_RR1_RES_CD_1 0x01 -#define SCC_RR1_RES_CD_0 0x08 -#define SCC_RR1_PAR_ERR 0x10 -#define SCC_RR1_RX_OV_ERR 0x20 -#define SCC_RR1_CRC_ERR 0x40 -#define SCC_RR1_END_FRAME 0x80 - -/* read register 2 */ -/* interrupt vector */ - -/* bit values for read register 3 */ -/* interrupt pending register */ - -#define SCC_RR3_B_EXT_IP 0x01 -#define SCC_RR3_B_TX_IP 0x02 -#define SCC_RR3_B_RX_IP 0x04 -#define SCC_RR3_A_EXT_IP 0x08 -#define SCC_RR3_A_TX_IP 0x10 -#define SCC_RR3_A_RX_IP 0x20 - -/* read register 8 */ -/* receive data register */ - -/* bit values for read register 10 */ -/* misc status bits */ - -#define SCC_RR10_ON_LOOP 0x02 -#define SCC_RR10_LOOP_SEND 0x10 -#define SCC_RR10_2_CLK_MIS 0x40 -#define SCC_RR10_1_CLK_MIS 0x80 - -/* read register 12 */ -/* lower byte of time constant */ - -/* read register 13 */ -/* upper byte of time constant */ - -/* bit values for read register 15 */ -/* external/status ie bits */ - -#define SCC_RR15_ZERO_CNT 0x02 -#define SCC_RR15_CD_IE 0x08 -#define SCC_RR15_SYNC_IE 0x10 -#define SCC_RR15_CTS_IE 0x20 -#define SCC_RR15_TX_UND_IE 0x40 -#define SCC_RR15_BREAK_IE 0x80 - -typedef struct _z85c30_context -{ - unsigned8 ucModemCtrl; -} z85c30_context; - -/* - * The following macro calculates the Baud constant. For the Z85C30 chip. - * - * Note: baud constant = ((clock frequency / Clock_X) / (2 * Baud Rate)) - 2 - * eg ((10,000,000 / 16) / (2 * Baud Rate)) - 2 - */ - -#define Z85C30_Baud( _clock, _baud_rate ) \ - ( ((_clock) /( 16 * 2 * _baud_rate)) - 2) - -#define Z85C30_Status_Is_RX_character_available(_status) \ - ((_status) & SCC_RR0_RX_AVAIL) - -#define Z85C30_Status_Is_TX_buffer_empty(_status) \ - ((_status) & SCC_RR0_TX_EMPTY) - -#define Z85C30_Status_Is_CTS_asserted(_status) \ - ((_status) & SCC_RR0_CTS) - -#define Z85C30_Status_Is_break_abort(_status) \ - ((_status) & SCC_RR0_BREAK) - -/* - * Private routines - */ - -Z85C30_STATIC void z85c30_init(int minor); - -Z85C30_STATIC int z85c30_set_attributes( - int minor, - const struct termios *t -); - -Z85C30_STATIC int z85c30_open( - int major, - int minor, - void * arg -); - -Z85C30_STATIC int z85c30_close( - int major, - int minor, - void * arg -); - -Z85C30_STATIC void z85c30_write_polled( - int minor, - char cChar -); - -Z85C30_STATIC int z85c30_assert_RTS( - int minor -); - -Z85C30_STATIC int z85c30_negate_RTS( - int minor -); - -Z85C30_STATIC int z85c30_assert_DTR( - int minor -); - -Z85C30_STATIC int z85c30_negate_DTR( - int minor -); - -Z85C30_STATIC void z85c30_initialize_interrupts(int minor); - -Z85C30_STATIC int z85c30_write_support_int( - int minor, - const char *buf, - int len -); - -Z85C30_STATIC int z85c30_write_support_polled( - int minor, - const char *buf, - int len -); - -Z85C30_STATIC int z85c30_inbyte_nonblocking_polled( - int minor -); - -Z85C30_STATIC void z85c30_enable_interrupts( - int minor, - int interrupt_mask -); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/c/src/lib/libchip/serial/z85c30_reg.c b/c/src/lib/libchip/serial/z85c30_reg.c deleted file mode 100644 index 889dad4530..0000000000 --- a/c/src/lib/libchip/serial/z85c30_reg.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * This file contains a typical set of register access routines which may be - * used with the z85c30 chip if accesses to the chip are as follows: - * - * + registers are accessed as bytes - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include <rtems.h> - -#ifndef _Z85C30_MULTIPLIER -#define _Z85C30_MULTIPLIER 1 -#define _Z85C30_NAME(_X) _X -#define _Z85C30_TYPE unsigned8 -#endif - -/* - * Z85C30 Get Register Routine - */ - -unsigned8 _Z85C30_NAME(z85c30_get_register)( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum -) -{ - _Z85C30_TYPE *port; - unsigned8 data; - rtems_interrupt_level level; - - port = (_Z85C30_TYPE *)ulCtrlPort; - - rtems_interrupt_disable(level); - - if(ucRegNum) { - *port = ucRegNum; - } - data = *port; - rtems_interrupt_enable(level); - - return data; -} - -/* - * Z85C30 Set Register Routine - */ - -void _Z85C30_NAME(z85c30_set_register)( - unsigned32 ulCtrlPort, - unsigned8 ucRegNum, - unsigned8 ucData -) -{ - _Z85C30_TYPE *port; - rtems_interrupt_level level; - - port = (_Z85C30_TYPE *)ulCtrlPort; - - rtems_interrupt_disable(level); - if(ucRegNum) { - *port = ucRegNum; - } - *port = ucData; - rtems_interrupt_enable(level); -} diff --git a/c/src/lib/libcpu/i386/idt.c b/c/src/lib/libcpu/i386/idt.c deleted file mode 100644 index 5f44bd0d2b..0000000000 --- a/c/src/lib/libcpu/i386/idt.c +++ /dev/null @@ -1,288 +0,0 @@ -/* - * cpu.c - This file contains implementation of C function to - * Instanciate IDT entries. More detailled information can be found - * on Intel site and more precisely in the following book : - * - * Pentium Processor familly - * Developper's Manual - * - * Volume 3 : Architecture and Programming Manual - * - * Copyright (C) 1998 Eric Valette (valette@crf.canon.fr) - * Canon Centre Recherche France. - * - * The license and distribution terms for this file may be - * found in found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include <libcpu/cpu.h> -#include <irq.h> - -static rtems_raw_irq_connect_data* raw_irq_table; -static rtems_raw_irq_connect_data default_raw_irq_entry; -static interrupt_gate_descriptor default_idt_entry; -static rtems_raw_irq_global_settings* local_settings; - -void create_interrupt_gate_descriptor (interrupt_gate_descriptor* idtEntry, - rtems_raw_irq_hdl hdl) -{ - idtEntry->low_offsets_bits = (((unsigned) hdl) & 0xffff); - idtEntry->segment_selector = i386_get_cs(); - idtEntry->fixed_value_bits = 0; - idtEntry->gate_type = 0xe; - idtEntry->privilege = 0; - idtEntry->present = 1; - idtEntry->high_offsets_bits = ((((unsigned) hdl) >> 16) & 0xffff); -} - -rtems_raw_irq_hdl get_hdl_from_vector(rtems_vector_offset index) -{ - rtems_raw_irq_hdl hdl; - interrupt_gate_descriptor* idt_entry_tbl; - unsigned limit; - - i386_get_info_from_IDTR (&idt_entry_tbl, &limit); - - /* Convert limit into number of entries */ - limit = (limit + 1) / sizeof(interrupt_gate_descriptor); - - if(index >= limit) { - return 0; - } - - * ((unsigned int*) &hdl) = (idt_entry_tbl[index].low_offsets_bits | - (idt_entry_tbl[index].high_offsets_bits << 16)); - return hdl; -} - -int i386_set_idt_entry (const rtems_raw_irq_connect_data* irq) -{ - interrupt_gate_descriptor* idt_entry_tbl; - unsigned limit; - unsigned int level; - - - i386_get_info_from_IDTR (&idt_entry_tbl, &limit); - - /* Convert limit into number of entries */ - limit = (limit + 1) / sizeof(interrupt_gate_descriptor); - - if (irq->idtIndex >= limit) { - return 0; - } - /* - * Check if default handler is actually connected. If not issue an error. - * You must first get the current handler via i386_get_current_idt_entry - * and then disconnect it using i386_delete_idt_entry. - * RATIONALE : to always have the same transition by forcing the user - * to get the previous handler before accepting to disconnect. - */ - if (get_hdl_from_vector(irq->idtIndex) != default_raw_irq_entry.hdl) { - return 0; - } - - _CPU_ISR_Disable(level); - - raw_irq_table [irq->idtIndex] = *irq; - create_interrupt_gate_descriptor (&idt_entry_tbl[irq->idtIndex], irq->hdl); - irq->on(irq); - - _CPU_ISR_Enable(level); - return 1; -} - -void _CPU_ISR_install_vector (unsigned vector, - void* hdl, - void** oldHdl) -{ - interrupt_gate_descriptor* idt_entry_tbl; - unsigned limit; - interrupt_gate_descriptor new; - unsigned int level; - - i386_get_info_from_IDTR (&idt_entry_tbl, &limit); - - /* Convert limit into number of entries */ - limit = (limit + 1) / sizeof(interrupt_gate_descriptor); - - if (vector >= limit) { - return; - } - _CPU_ISR_Disable(level) - * ((unsigned int *) oldHdl) = idt_entry_tbl[vector].low_offsets_bits | - (idt_entry_tbl[vector].high_offsets_bits << 16); - - create_interrupt_gate_descriptor(&new, hdl); - idt_entry_tbl[vector] = new; - - _CPU_ISR_Enable(level); -} - -int i386_get_current_idt_entry (rtems_raw_irq_connect_data* irq) -{ - interrupt_gate_descriptor* idt_entry_tbl; - unsigned limit; - - i386_get_info_from_IDTR (&idt_entry_tbl, &limit); - - /* Convert limit into number of entries */ - limit = (limit + 1) / sizeof(interrupt_gate_descriptor); - - if (irq->idtIndex >= limit) { - return 0; - } - raw_irq_table [irq->idtIndex].hdl = get_hdl_from_vector(irq->idtIndex); - - *irq = raw_irq_table [irq->idtIndex]; - - return 1; -} - -int i386_delete_idt_entry (const rtems_raw_irq_connect_data* irq) -{ - interrupt_gate_descriptor* idt_entry_tbl; - unsigned limit; - unsigned int level; - - i386_get_info_from_IDTR (&idt_entry_tbl, &limit); - - /* Convert limit into number of entries */ - limit = (limit + 1) / sizeof(interrupt_gate_descriptor); - - if (irq->idtIndex >= limit) { - return 0; - } - /* - * Check if handler passed is actually connected. If not issue an error. - * You must first get the current handler via i386_get_current_idt_entry - * and then disconnect it using i386_delete_idt_entry. - * RATIONALE : to always have the same transition by forcing the user - * to get the previous handler before accepting to disconnect. - */ - if (get_hdl_from_vector(irq->idtIndex) != irq->hdl){ - return 0; - } - _CPU_ISR_Disable(level); - - idt_entry_tbl[irq->idtIndex] = default_idt_entry; - - irq->off(irq); - - raw_irq_table[irq->idtIndex] = default_raw_irq_entry; - raw_irq_table[irq->idtIndex].idtIndex = irq->idtIndex; - - _CPU_ISR_Enable(level); - - return 1; -} - -/* - * Caution this function assumes the IDTR has been already set. - */ -int i386_init_idt (rtems_raw_irq_global_settings* config) -{ - unsigned limit; - unsigned i; - unsigned level; - interrupt_gate_descriptor* idt_entry_tbl; - - i386_get_info_from_IDTR (&idt_entry_tbl, &limit); - - /* Convert limit into number of entries */ - limit = (limit + 1) / sizeof(interrupt_gate_descriptor); - - if (config->idtSize != limit) { - return 0; - } - /* - * store various accelarators - */ - raw_irq_table = config->rawIrqHdlTbl; - local_settings = config; - default_raw_irq_entry = config->defaultRawEntry; - - _CPU_ISR_Disable(level); - - create_interrupt_gate_descriptor (&default_idt_entry, default_raw_irq_entry.hdl); - - for (i=0; i < limit; i++) { - interrupt_gate_descriptor new; - create_interrupt_gate_descriptor (&new, raw_irq_table[i].hdl); - idt_entry_tbl[i] = new; - if (raw_irq_table[i].hdl != default_raw_irq_entry.hdl) { - raw_irq_table[i].on(&raw_irq_table[i]); - } - else { - raw_irq_table[i].off(&raw_irq_table[i]); - } - } - _CPU_ISR_Enable(level); - - return 1; -} - -int i386_get_idt_config (rtems_raw_irq_global_settings** config) -{ - *config = local_settings; - return 1; -} - -/* - * Caution this function assumes the GDTR has been already set. - */ -int i386_set_gdt_entry (unsigned short segment_selector, unsigned base, - unsigned limit) -{ - unsigned gdt_limit; - unsigned short tmp_segment = 0; - unsigned int limit_adjusted; - segment_descriptors* gdt_entry_tbl; - - - i386_get_info_from_GDTR (&gdt_entry_tbl, &gdt_limit); - - if (segment_selector > limit) { - return 0; - } - /* - * set up limit first - */ - limit_adjusted = limit; - if ( limit > 4095 ) { - gdt_entry_tbl[segment_selector].granularity = 1; - limit_adjusted /= 4096; - } - gdt_entry_tbl[segment_selector].limit_15_0 = limit_adjusted & 0xffff; - gdt_entry_tbl[segment_selector].limit_19_16 = (limit_adjusted >> 16) & 0xf; - /* - * set up base - */ - gdt_entry_tbl[segment_selector].base_address_15_0 = base & 0xffff; - gdt_entry_tbl[segment_selector].base_address_23_16 = (base >> 16) & 0xff; - gdt_entry_tbl[segment_selector].base_address_31_24 = (base >> 24) & 0xff; - /* - * set up descriptor type (this may well becomes a parameter if needed) - */ - gdt_entry_tbl[segment_selector].type = 2; /* Data R/W */ - gdt_entry_tbl[segment_selector].descriptor_type = 1; /* Code or Data */ - gdt_entry_tbl[segment_selector].privilege = 0; /* ring 0 */ - gdt_entry_tbl[segment_selector].present = 1; /* not present */ - - /* - * Now, reload all segment registers so the limit takes effect. - */ - - asm volatile( "movw %%ds,%0 ; movw %0,%%ds - movw %%es,%0 ; movw %0,%%es - movw %%fs,%0 ; movw %0,%%fs - movw %%gs,%0 ; movw %0,%%gs - movw %%ss,%0 ; movw %0,%%ss" - : "=r" (tmp_segment) - : "0" (tmp_segment) - ); - - return 1; -} diff --git a/c/src/lib/libcpu/m68k/shared/misc/memcpy.c b/c/src/lib/libcpu/m68k/shared/misc/memcpy.c deleted file mode 100644 index 3948411f4b..0000000000 --- a/c/src/lib/libcpu/m68k/shared/misc/memcpy.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * C library memcpy routine - * - * This routine has code to optimize performance on the CPU32+ - * and another version for other 68k machines. - * - * It could be optimized more for machines with MOVE16 instructions. - * - * The routine is placed in this source directory to ensure that it - * is picked up by all applications. - * - * W. Eric Norum - * Saskatchewan Accelerator Laboratory - * University of Saskatchewan - * Saskatoon, Saskatchewan, CANADA - * eric@skatter.usask.ca - */ - -#include <string.h> -#include <rtems/score/m68k.h> - -#if defined(__mcpu32__) -#define COPYSETUP(n) n-- -#define COPY(to,from,n,size) \ - asm volatile ("1:\n" \ - "\tmove." size " (%0)+,(%1)+\n" \ - "\tdbf %2,1b\n" \ - "\tsub.l #0x10000,%2\n" \ - "\tbpl.b 1b\n" : \ - "=a" (from), "=a" (to), "=d" (n) :\ - "0" (from), "1" (to), "2" (n) : \ - "cc", "memory") -#else -#define COPYSETUP(n) -#define COPY(to,from,n,size) \ - asm volatile ("1:\n" \ - "\tmove." size " (%0)+,(%1)+\n" \ - "\tsubq.l #1,%2\n\tbne.b 1b\n" : \ - "=a" (from), "=a" (to), "=d" (n) :\ - "0" (from), "1" (to), "2" (n) : \ - "cc", "memory") -#endif - -void * -memcpy(void *s1, const void *s2, size_t n) -{ - char *p1 = s1; - const char *p2 = s2; - - if (n) { - if (n < 16) { - COPYSETUP (n); - COPY (p1, p2, n, "b"); - } - else { - int nbyte; - int nl; - nbyte = (int)p1 & 0x3; - if (nbyte) { - nbyte = 4 - nbyte; - n -= nbyte; - COPYSETUP (nbyte); - COPY (p1, p2, nbyte, "b"); - } -#if (M68K_HAS_MISALIGNED == 0) - /* - * Take care of machines that can't - * handle misaligned references. - */ - if ((int)p2 & 0x1) { - COPYSETUP (n); - COPY (p1, p2, n, "b"); - return s1; - } -#endif - nl = (unsigned int)n >> 2; - COPYSETUP (nl); - COPY (p1, p2, nl, "l"); - nbyte = (int)n & 0x3; - if (nbyte) { - COPYSETUP (nbyte); - COPY (p1, p2, nbyte, "b"); - } - } - } - return s1; -} diff --git a/c/src/lib/libcpu/mips/clock/ckinit.c b/c/src/lib/libcpu/mips/clock/ckinit.c deleted file mode 100644 index 60b3187223..0000000000 --- a/c/src/lib/libcpu/mips/clock/ckinit.c +++ /dev/null @@ -1,249 +0,0 @@ - -/* ckinit.c - * - * This file contains the clock driver initialization for the IDT 4650. - * - * Author: Craig Lebakken <craigl@transition.com> - * - * COPYRIGHT (c) 1996 by Transition Networks Inc. - * - * To anyone who acknowledges that this file is provided "AS IS" - * without any express or implied warranty: - * permission to use, copy, modify, and distribute this file - * for any purpose is hereby granted without fee, provided that - * the above copyright notice and this notice appears in all - * copies, and that the name of Transition Networks not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * Transition Networks makes no representations about the suitability - * of this software for any purpose. - * - * Derived from c/src/lib/libbsp/no_cpu/no_bsp/clock/ckinit.c: - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -/* - * Rather than deleting this, it is commented out to (hopefully) help - * the submitter send updates. - * - * static char _sccsid[] = "@(#)ckinit.c 08/20/96 1.3\n"; - */ - - -#include <stdlib.h> - -#include <rtems.h> -#include <rtems/libio.h> -#include <bsp.h> - -#define EXT_INT5 0x8000 /* external interrupt 5 */ - -#include "clock.h" - -#define CLOCKS_PER_MICROSECOND ( CPU_CLOCK_RATE_MHZ ) /* equivalent to CPU clock speed in MHz */ - -void Clock_exit( void ); -rtems_isr Clock_isr( rtems_vector_number vector ); - - -/* - * The interrupt vector number associated with the clock tick device - * driver. - */ - -#define CLOCK_VECTOR_MASK EXT_INT5 -#define CLOCK_VECTOR 0x7 - -/* - * Clock_driver_ticks is a monotonically increasing counter of the - * number of clock ticks since the driver was initialized. - */ - -volatile rtems_unsigned32 Clock_driver_ticks; - -/* - * Clock_isrs is the number of clock ISRs until the next invocation of - * the RTEMS clock tick routine. The clock tick device driver - * gets an interrupt once a millisecond and counts down until the - * length of time between the user configured microseconds per tick - * has passed. - */ - -rtems_unsigned32 Clock_isrs; /* ISRs until next tick */ - -/* - * These are set by clock driver during its init - */ - -rtems_device_major_number rtems_clock_major = ~0; -rtems_device_minor_number rtems_clock_minor; - -/* - * The previous ISR on this clock tick interrupt vector. - */ - -rtems_isr_entry Old_ticker; - -void Clock_exit( void ); - -static unsigned32 mips_timer_rate = 0; - -/* - * Isr Handler - */ - -rtems_isr Clock_isr( - rtems_vector_number vector -) -{ -/* - * bump the number of clock driver ticks since initialization - * - * determine if it is time to announce the passing of tick as configured - * to RTEMS through the rtems_clock_tick directive - * - * perform any timer dependent tasks - */ - - /* refresh the internal CPU timer */ - mips_set_timer( mips_timer_rate ); - - Clock_driver_ticks += 1; - - rtems_clock_tick(); -} - -/* User callback shell (set from Clock_Control) */ -static void (*user_callback)(void); - -rtems_isr User_Clock_isr( - rtems_vector_number vector -) -{ - /* refresh the internal CPU timer */ - mips_set_timer( mips_timer_rate ); - - if (user_callback) - user_callback(); -} - -/* - * Install_clock - * - * Install a clock tick handleR and reprograms the chip. This - * is used to initially establish the clock tick. - */ - -void Install_clock( - rtems_isr_entry clock_isr -) -{ - /* - * Initialize the clock tick device driver variables - */ - - Clock_driver_ticks = 0; - Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000; - - /* - * If ticks_per_timeslice is configured as non-zero, then the user - * wants a clock tick. - */ - - if ( BSP_Configuration.ticks_per_timeslice ) { - Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 ); - /* - * Hardware specific initialize goes here - */ - - mips_timer_rate = BSP_Configuration.microseconds_per_tick * CLOCKS_PER_MICROSECOND; - mips_set_timer( mips_timer_rate ); - enable_int(CLOCK_VECTOR_MASK); - } - - /* - * Schedule the clock cleanup routine to execute if the application exits. - */ - - atexit( Clock_exit ); -} - -/* - * Clean up before the application exits - */ - -void Clock_exit( void ) -{ - if ( BSP_Configuration.ticks_per_timeslice ) { - - /* mips: turn off the timer interrupts */ - disable_int(CLOCK_VECTOR_MASK); - - } -} - -/* - * Clock_initialize - * - * Device driver entry point for clock tick driver initialization. - */ - -rtems_device_driver Clock_initialize( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *pargp -) -{ - Install_clock( Clock_isr ); - - /* - * make major/minor avail to others such as shared memory driver - */ - - rtems_clock_major = major; - rtems_clock_minor = minor; - - return RTEMS_SUCCESSFUL; -} - -rtems_device_driver Clock_control( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *pargp -) -{ - rtems_unsigned32 isrlevel; - rtems_libio_ioctl_args_t *args = pargp; - - if (args == 0) - goto done; - - /* - * This is hokey, but until we get a defined interface - * to do this, it will just be this simple... - */ - - if (args->command == rtems_build_name('I', 'S', 'R', ' ')) - { - Clock_isr(CLOCK_VECTOR); - } - else if (args->command == rtems_build_name('N', 'E', 'W', ' ')) - { - rtems_interrupt_disable( isrlevel ); - user_callback = (void (*)(void))args->buffer; - (void) set_vector( User_Clock_isr, CLOCK_VECTOR, 1 ); - rtems_interrupt_enable( isrlevel ); - } - -done: - return RTEMS_SUCCESSFUL; -} diff --git a/c/src/lib/libcpu/mips/clock/clock.S b/c/src/lib/libcpu/mips/clock/clock.S deleted file mode 100644 index ec0280f494..0000000000 --- a/c/src/lib/libcpu/mips/clock/clock.S +++ /dev/null @@ -1,45 +0,0 @@ -/* clock.s - * - * This file contains the assembly code for the IDT 4650 clock driver. - * - * Author: Craig Lebakken <craigl@transition.com> - * - * COPYRIGHT (c) 1996 by Transition Networks Inc. - * - * To anyone who acknowledges that this file is provided "AS IS" - * without any express or implied warranty: - * permission to use, copy, modify, and distribute this file - * for any purpose is hereby granted without fee, provided that - * the above copyright notice and this notice appears in all - * copies, and that the name of Transition Networks not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * Transition Networks makes no representations about the suitability - * of this software for any purpose. - * - * $Id$ - */ -/* @(#)clock.S 08/20/96 1.2 */ - -#include <rtems/score/iregdef.h> -#include <rtems/score/idtcpu.h> -#include <rtems/score/idtmon.h> - -FRAME(mips_set_timer,sp,0,ra) - .set noreorder - mfc0 t0,C0_COUNT - nop - addu t0,a0,t0 - mtc0 t0,C0_COMPARE - nop - j ra - .set reorder -ENDFRAME(mips_set_timer) - -FRAME(mips_get_timer,sp,0,ra) - .set noreorder - mfc0 v0,C0_COUNT - nop - j ra - .set reorder -ENDFRAME(mips_get_timer) diff --git a/c/src/lib/libcpu/mips/clock/clock.h b/c/src/lib/libcpu/mips/clock/clock.h deleted file mode 100644 index a14304f668..0000000000 --- a/c/src/lib/libcpu/mips/clock/clock.h +++ /dev/null @@ -1,25 +0,0 @@ -/* clock.s - * - * This file contains the assembly code for the IDT 4650 clock driver. - * - * Author: Craig Lebakken <craigl@transition.com> - * - * COPYRIGHT (c) 1996 by Transition Networks Inc. - * - * To anyone who acknowledges that this file is provided "AS IS" - * without any express or implied warranty: - * permission to use, copy, modify, and distribute this file - * for any purpose is hereby granted without fee, provided that - * the above copyright notice and this notice appears in all - * copies, and that the name of Transition Networks not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * Transition Networks makes no representations about the suitability - * of this software for any purpose. - * - * $Id$ - */ - -/* @(#)clock.h 08/20/96 1.2 */ - -extern void mips_set_timer( unsigned32 timer_clock_interval ); diff --git a/c/src/lib/libcpu/mips/timer/gettime.S b/c/src/lib/libcpu/mips/timer/gettime.S deleted file mode 100644 index a00f2d5819..0000000000 --- a/c/src/lib/libcpu/mips/timer/gettime.S +++ /dev/null @@ -1,35 +0,0 @@ -/* gettime.s - * - * This file contains the assembly code for the IDT 4650 timer driver. - * - * Author: Craig Lebakken <craigl@transition.com> - * - * COPYRIGHT (c) 1996 by Transition Networks Inc. - * - * To anyone who acknowledges that this file is provided "AS IS" - * without any express or implied warranty: - * permission to use, copy, modify, and distribute this file - * for any purpose is hereby granted without fee, provided that - * the above copyright notice and this notice appears in all - * copies, and that the name of Transition Networks not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * Transition Networks makes no representations about the suitability - * of this software for any purpose. - * - * $Id$ - */ - -/* @(#)gettime.S 08/20/96 1.2 */ - -#include <rtems/score/iregdef.h> -#include <rtems/score/idtcpu.h> -#include <rtems/score/idtmon.h> - -FRAME(mips_read_timer,sp,0,ra) - .set noreorder - mfc0 v0,C0_COUNT - nop - j ra - .set reorder -ENDFRAME(mips_read_timer) diff --git a/c/src/lib/libcpu/mips/timer/timer.c b/c/src/lib/libcpu/mips/timer/timer.c deleted file mode 100644 index 167a9b3804..0000000000 --- a/c/src/lib/libcpu/mips/timer/timer.c +++ /dev/null @@ -1,140 +0,0 @@ -/* timer.c - * - * This file contains the initialization code for the IDT 4650 timer driver. - * - * Author: Craig Lebakken <craigl@transition.com> - * - * COPYRIGHT (c) 1996 by Transition Networks Inc. - * - * To anyone who acknowledges that this file is provided "AS IS" - * without any express or implied warranty: - * permission to use, copy, modify, and distribute this file - * for any purpose is hereby granted without fee, provided that - * the above copyright notice and this notice appears in all - * copies, and that the name of Transition Networks not be used in - * advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * Transition Networks makes no representations about the suitability - * of this software for any purpose. - * - * derived from src/lib/libbsp/no_cpu/no_bsp/timer/timer.c - * - * This file manages the benchmark timer used by the RTEMS Timing Test - * Suite. Each measured time period is demarcated by calls to - * Timer_initialize() and Read_timer(). Read_timer() usually returns - * the number of microseconds since Timer_initialize() exitted. - * - * NOTE: It is important that the timer start/stop overhead be - * determined when porting or modifying this code. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -/* - * Rather than deleting this, it is commented out to (hopefully) help - * the submitter send updates. - * - * static char _sccsid[] = "@(#)timer.c 08/20/96 1.5\n"; - */ - - -#include <rtems.h> -#include <bsp.h> - -#define CLOCKS_PER_MICROSECOND ( CPU_CLOCK_RATE_MHZ ) -#define TIMER_MAX_VALUE 0xffffffff - -extern unsigned32 mips_read_timer( void ); - -static rtems_boolean Timer_driver_Find_average_overhead; -static unsigned32 Timer_initial_value = 0; - -void Timer_initialize( void ) -{ - Timer_initial_value = mips_read_timer(); - /* - * Somehow start the timer - */ - - /* Timer on 4650 is always running */ -} - -/* - * The following controls the behavior of Read_timer(). - * - * AVG_OVEREHAD is the overhead for starting and stopping the timer. It - * is usually deducted from the number returned. - * - * LEAST_VALID is the lowest number this routine should trust. Numbers - * below this are "noise" and zero is returned. - */ - -#define AVG_OVERHEAD 8 /* It typically takes X.X microseconds */ - /* (Y countdowns) to start/stop the timer. */ - /* This value is in cycles. */ -#define LEAST_VALID 1 /* Don't trust a clicks value lower than this */ - -int Read_timer( void ) -{ - unsigned64 clicks; - unsigned32 total; - - /* - * Read the timer and see how many clicks it has been since we started. - */ - - clicks = mips_read_timer(); /* XXX: read some HW here */ - if (clicks < Timer_initial_value) - { - clicks += TIMER_MAX_VALUE; - } - clicks -= Timer_initial_value; - - /* - * Total is calculated by taking into account the number of timer overflow - * interrupts since the timer was initialized and clicks since the last - * interrupts. - */ -#if 0 /* leave total in number of cycles */ - total = clicks / CLOCKS_PER_MICROSECOND; -#else - total = clicks; -#endif - - if ( Timer_driver_Find_average_overhead == 1 ) - return total; /* in # cycles units */ - else { - if ( total < LEAST_VALID ) - return 0; /* below timer resolution */ - /* - * leave total in cycles - */ - return (total - AVG_OVERHEAD); - } -} - -/* - * Empty function call used in loops to measure basic cost of looping - * in Timing Test Suite. - */ - -rtems_status_code Empty_function( void ) -{ - return RTEMS_SUCCESSFUL; -} - -void Set_find_average_overhead( - rtems_boolean find_flag -) -{ - Timer_driver_Find_average_overhead = find_flag; -} - diff --git a/c/src/lib/libcpu/sh/sh7032/score/cpu_asm.c b/c/src/lib/libcpu/sh/sh7032/score/cpu_asm.c deleted file mode 100644 index 42764f6eb1..0000000000 --- a/c/src/lib/libcpu/sh/sh7032/score/cpu_asm.c +++ /dev/null @@ -1,311 +0,0 @@ -/* - * This file contains the basic algorithms for all assembly code used - * in an specific CPU port of RTEMS. These algorithms must be implemented - * in assembly language - * - * NOTE: This port uses a C file with inline assembler instructions - * - * Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and - * Bernd Becker (becker@faw.uni-ulm.de) - * - * COPYRIGHT (c) 1997-1998, FAW Ulm, Germany - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * - * COPYRIGHT (c) 1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - */ - -/* - * This is supposed to be an assembly file. This means that system.h - * and cpu.h should not be included in a "real" cpu_asm file. An - * implementation in assembly should include "cpu_asm.h" - */ - -#include <rtems/system.h> -#include <rtems/score/cpu.h> -#include <rtems/score/isr.h> -#include <rtems/score/thread.h> -#include <rtems/score/cpu_isps.h> -#include <rtems/score/sh_io.h> -#include <rtems/score/sh.h> -#include <rtems/score/iosh7030.h> - -/* from cpu_isps.c */ -extern proc_ptr _Hardware_isr_Table[]; - -#if( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE) - unsigned long *_old_stack_ptr; -#endif - -register unsigned long *stack_ptr asm("r15"); - -/* - * sh_set_irq_priority - * - * this function sets the interrupt level of the specified interrupt - * - * parameters: - * - irq : interrupt number - * - prio: priority to set for this interrupt number - * - * returns: 0 if ok - * -1 on error - */ - -unsigned int sh_set_irq_priority( - unsigned int irq, - unsigned int prio ) -{ - unsigned32 shiftcount; - unsigned32 prioreg; - unsigned16 temp16; - unsigned32 level; - - /* - * first check for valid interrupt - */ - if(( irq > 113) || (_Hardware_isr_Table[irq] == _dummy_isp)) - return -1; - /* - * check for valid irq priority - */ - if( prio > 15 ) - return -1; - - /* - * look up appropriate interrupt priority register - */ - if( irq > 71) - { - irq = irq - 72; - shiftcount = 12 - ((irq & ~0x03) % 16); - - switch( irq / 16) - { - case 0: { prioreg = INTC_IPRC; break;} - case 1: { prioreg = INTC_IPRD; break;} - case 2: { prioreg = INTC_IPRE; break;} - default: return -1; - } - } - else - { - shiftcount = 12 - 4 * ( irq % 4); - if( irq > 67) - prioreg = INTC_IPRB; - else - prioreg = INTC_IPRA; - } - - /* - * Set the interrupt priority register - */ - _CPU_ISR_Disable( level ); - - temp16 = read16( prioreg); - temp16 &= ~( 15 << shiftcount); - temp16 |= prio << shiftcount; - write16( temp16, prioreg); - - _CPU_ISR_Enable( level ); - - return 0; -} - -/* - * _CPU_Context_save_fp_context - * - * This routine is responsible for saving the FP context - * at *fp_context_ptr. If the point to load the FP context - * from is changed then the pointer is modified by this routine. - * - * Sometimes a macro implementation of this is in cpu.h which dereferences - * the ** and a similarly named routine in this file is passed something - * like a (Context_Control_fp *). The general rule on making this decision - * is to avoid writing assembly language. - */ - -void _CPU_Context_save_fp( - void **fp_context_ptr -) -{ -} - -/* - * _CPU_Context_restore_fp_context - * - * This routine is responsible for restoring the FP context - * at *fp_context_ptr. If the point to load the FP context - * from is changed then the pointer is modified by this routine. - * - * Sometimes a macro implementation of this is in cpu.h which dereferences - * the ** and a similarly named routine in this file is passed something - * like a (Context_Control_fp *). The general rule on making this decision - * is to avoid writing assembly language. - */ - -void _CPU_Context_restore_fp( - void **fp_context_ptr -) -{ -} - -/* _CPU_Context_switch - * - * This routine performs a normal non-FP context switch. - */ - -/* within __CPU_Context_switch: - * _CPU_Context_switch - * _CPU_Context_restore - * - * This routine is generally used only to restart self in an - * efficient manner. It may simply be a label in _CPU_Context_switch. - * - * NOTE: It should be safe not to store r4, r5 - * - * NOTE: It is doubtful if r0 is really needed to be stored - * - * NOTE: gbr is added, but should not be necessary, as it is - * only used globally in this port. - */ - -/* - * FIXME: This is an ugly hack, but we wanted to avoid recalculating - * the offset each time Context_Control is changed - */ -void __CPU_Context_switch( - Context_Control *run, /* r4 */ - Context_Control *heir /* r5 */ -) -{ - -asm volatile(" - .global __CPU_Context_switch -__CPU_Context_switch: - - add %0,r4 - - stc.l sr,@-r4 - stc.l gbr,@-r4 - mov.l r0,@-r4 - mov.l r1,@-r4 - mov.l r2,@-r4 - mov.l r3,@-r4 - - mov.l r6,@-r4 - mov.l r7,@-r4 - mov.l r8,@-r4 - mov.l r9,@-r4 - mov.l r10,@-r4 - mov.l r11,@-r4 - mov.l r12,@-r4 - mov.l r13,@-r4 - mov.l r14,@-r4 - sts.l pr,@-r4 - sts.l mach,@-r4 - sts.l macl,@-r4 - mov.l r15,@-r4 - - mov r5, r4" - :: "I" (sizeof(Context_Control)) - ); - - asm volatile(" - .global __CPU_Context_restore -__CPU_Context_restore: - mov.l @r4+,r15 - lds.l @r4+,macl - lds.l @r4+,mach - lds.l @r4+,pr - mov.l @r4+,r14 - mov.l @r4+,r13 - mov.l @r4+,r12 - mov.l @r4+,r11 - mov.l @r4+,r10 - mov.l @r4+,r9 - mov.l @r4+,r8 - mov.l @r4+,r7 - mov.l @r4+,r6 - - mov.l @r4+,r3 - mov.l @r4+,r2 - mov.l @r4+,r1 - mov.l @r4+,r0 - ldc.l @r4+,gbr - ldc.l @r4+,sr - - rts - nop" ); -} - -/* - * This routine provides the RTEMS interrupt management. - */ - -void __ISR_Handler( unsigned32 vector) -{ - register unsigned32 level; - - _CPU_ISR_Disable( level ); - - _Thread_Dispatch_disable_level++; - -#if( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE) - if( _ISR_Nest_level == 0 ) - { - /* Install irq stack */ - _old_stack_ptr = stack_ptr; - stack_ptr = _CPU_Interrupt_stack_high; - } - -#endif - - _ISR_Nest_level++; - - _CPU_ISR_Enable( level ); - - /* call isp */ - if( _ISR_Vector_table[ vector]) - (*_ISR_Vector_table[ vector ])( vector ); - - _CPU_ISR_Disable( level ); - - _ISR_Nest_level--; - -#if( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE) - - if( _ISR_Nest_level == 0 ) - /* restore old stack pointer */ - stack_ptr = _old_stack_ptr; -#endif - - _Thread_Dispatch_disable_level--; - - _CPU_ISR_Enable( level ); - - if ( _Thread_Dispatch_disable_level == 0 ) - { - if(( _Context_Switch_necessary) || (! _ISR_Signals_to_thread_executing)) - { - _ISR_Signals_to_thread_executing = FALSE; - _Thread_Dispatch(); - } - } -} diff --git a/c/src/lib/libcpu/sh/sh7032/score/ispsh7032.c b/c/src/lib/libcpu/sh/sh7032/score/ispsh7032.c deleted file mode 100644 index 3ef3c32465..0000000000 --- a/c/src/lib/libcpu/sh/sh7032/score/ispsh7032.c +++ /dev/null @@ -1,252 +0,0 @@ -/* - * This file contains the isp frames for the user interrupts. - * From these procedures __ISR_Handler is called with the vector number - * as argument. - * - * __ISR_Handler is kept in a separate file (cpu_asm.c), because a bug in - * some releases of gcc doesn't properly handle #pragma interrupt, if a - * file contains both isrs and normal functions. - * - * Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and - * Bernd Becker (becker@faw.uni-ulm.de) - * - * COPYRIGHT (c) 1997-1998, FAW Ulm, Germany - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE - * - * - * COPYRIGHT (c) 1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include <rtems/system.h> -#include <rtems/score/shtypes.h> -#include <rtems/score/cpu_isps.h> - -/* - * This is a exception vector table - * - * It has the same structure like the actual vector table (vectab) - */ -proc_ptr _Hardware_isr_Table[256]={ -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, -_nmi_isp, _usb_isp, -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, -/* trapa 0 -31 */ -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -_dummy_isp, _dummy_isp, _dummy_isp, _dummy_isp, -/* irq 64 ... */ -_irq0_isp, _irq1_isp, _irq2_isp, _irq3_isp, -_irq4_isp, _irq5_isp, _irq6_isp, _irq7_isp, -_dma0_isp, _dummy_isp, _dma1_isp, _dummy_isp, -_dma2_isp, _dummy_isp, _dma3_isp, _dummy_isp, -_imia0_isp, _imib0_isp, _ovi0_isp, _dummy_isp, -_imia1_isp, _imib1_isp, _ovi1_isp, _dummy_isp, -_imia2_isp, _imib2_isp, _ovi2_isp, _dummy_isp, -_imia3_isp, _imib3_isp, _ovi3_isp, _dummy_isp, -_imia4_isp, _imib4_isp, _ovi4_isp, _dummy_isp, -_eri0_isp, _rxi0_isp, _txi0_isp, _tei0_isp, -_eri1_isp, _rxi1_isp, _txi1_isp, _tei1_isp, -_prt_isp, _adu_isp, _dummy_isp, _dummy_isp, -_wdt_isp, -/* 113 */ _dref_isp -}; - -#define Str(a)#a - -/* - * Some versions of gcc and all version of egcs at least until egcs-1.1b - * are not able to handle #pragma interrupt correctly if more than 1 isr is - * contained in a file and when optimizing. - * We try to work around this problem by using the macro below. - */ -#define isp( name, number, func)\ -asm (".global _"Str(name)"\n\t" \ - "_"Str(name)": \n\t" \ - " mov.l r0,@-r15 \n\t" \ - " mov.l r1,@-r15 \n\t" \ - " mov.l r2,@-r15 \n\t" \ - " mov.l r3,@-r15 \n\t" \ - " mov.l r4,@-r15 \n\t" \ - " mov.l r5,@-r15 \n\t" \ - " mov.l r6,@-r15 \n\t" \ - " mov.l r7,@-r15 \n\t" \ - " mov.l r14,@-r15 \n\t" \ - " sts.l pr,@-r15 \n\t" \ - " sts.l mach,@-r15 \n\t" \ - " sts.l macl,@-r15 \n\t" \ - " mov r15,r14 \n\t" \ - " mov.l "Str(name)"_k, r1\n\t" \ - " jsr @r1 \n\t" \ - " mov #"Str(number)", r4\n\t" \ - " mov r14,r15 \n\t" \ - " lds.l @r15+,macl \n\t" \ - " lds.l @r15+,mach \n\t" \ - " lds.l @r15+,pr \n\t" \ - " mov.l @r15+,r14 \n\t" \ - " mov.l @r15+,r7 \n\t" \ - " mov.l @r15+,r6 \n\t" \ - " mov.l @r15+,r5 \n\t" \ - " mov.l @r15+,r4 \n\t" \ - " mov.l @r15+,r3 \n\t" \ - " mov.l @r15+,r2 \n\t" \ - " mov.l @r15+,r1 \n\t" \ - " mov.l @r15+,r0 \n\t" \ - " rte \n\t" \ - " nop \n\t" \ - " .align 2 \n\t" \ - #name"_k: \n\t" \ - ".long "Str(func)); - -/************************************************ - * Dummy interrupt service procedure for - * interrupts being not allowed --> Trap 34 - ************************************************/ -asm(" .section .text -.global __dummy_isp -__dummy_isp: - mov.l r14,@-r15 - mov r15, r14 - trapa #34 - mov.l @r15+,r14 - rte - nop"); - -/***************************** - * Non maskable interrupt - *****************************/ -isp( _nmi_isp, NMI_ISP_V, ___ISR_Handler); - -/***************************** - * User break controller - *****************************/ -isp( _usb_isp, USB_ISP_V, ___ISR_Handler); - -/***************************** - * External interrupts 0-7 - *****************************/ -isp( _irq0_isp, IRQ0_ISP_V, ___ISR_Handler); -isp( _irq1_isp, IRQ1_ISP_V, ___ISR_Handler); -isp( _irq2_isp, IRQ2_ISP_V, ___ISR_Handler); -isp( _irq3_isp, IRQ3_ISP_V, ___ISR_Handler); -isp( _irq4_isp, IRQ4_ISP_V, ___ISR_Handler); -isp( _irq5_isp, IRQ5_ISP_V, ___ISR_Handler); -isp( _irq6_isp, IRQ6_ISP_V, ___ISR_Handler); -isp( _irq7_isp, IRQ7_ISP_V, ___ISR_Handler); - -/***************************** - * DMA - controller - *****************************/ -isp( _dma0_isp, DMA0_ISP_V, ___ISR_Handler); -isp( _dma1_isp, DMA1_ISP_V, ___ISR_Handler); -isp( _dma2_isp, DMA2_ISP_V, ___ISR_Handler); -isp( _dma3_isp, DMA3_ISP_V, ___ISR_Handler); - - -/***************************** - * Interrupt timer unit - *****************************/ - -/***************************** - * Timer 0 - *****************************/ -isp( _imia0_isp, IMIA0_ISP_V, ___ISR_Handler); -isp( _imib0_isp, IMIB0_ISP_V, ___ISR_Handler); -isp( _ovi0_isp, OVI0_ISP_V, ___ISR_Handler); - -/***************************** - * Timer 1 - *****************************/ -isp( _imia1_isp, IMIA1_ISP_V, ___ISR_Handler); -isp( _imib1_isp, IMIB1_ISP_V, ___ISR_Handler); -isp( _ovi1_isp, OVI1_ISP_V, ___ISR_Handler); - -/***************************** - * Timer 2 - *****************************/ -isp( _imia2_isp, IMIA2_ISP_V, ___ISR_Handler); -isp( _imib2_isp, IMIB2_ISP_V, ___ISR_Handler); -isp( _ovi2_isp, OVI2_ISP_V, ___ISR_Handler); - -/***************************** - * Timer 3 - *****************************/ -isp( _imia3_isp, IMIA3_ISP_V, ___ISR_Handler); -isp( _imib3_isp, IMIB3_ISP_V, ___ISR_Handler); -isp( _ovi3_isp, OVI3_ISP_V, ___ISR_Handler); - -/***************************** - * Timer 4 - *****************************/ -isp( _imia4_isp, IMIA4_ISP_V, ___ISR_Handler); -isp( _imib4_isp, IMIB4_ISP_V, ___ISR_Handler); -isp( _ovi4_isp, OVI4_ISP_V, ___ISR_Handler); - - -/***************************** - * Serial interfaces - *****************************/ - -/***************************** - * Serial interface 0 - *****************************/ -isp( _eri0_isp, ERI0_ISP_V, ___ISR_Handler); -isp( _rxi0_isp, RXI0_ISP_V, ___ISR_Handler); -isp( _txi0_isp, TXI0_ISP_V, ___ISR_Handler); -isp( _tei0_isp, TEI0_ISP_V, ___ISR_Handler); - -/***************************** - * Serial interface 1 - *****************************/ -isp( _eri1_isp, ERI1_ISP_V, ___ISR_Handler); -isp( _rxi1_isp, RXI1_ISP_V, ___ISR_Handler); -isp( _txi1_isp, TXI1_ISP_V, ___ISR_Handler); -isp( _tei1_isp, TEI1_ISP_V, ___ISR_Handler); - - -/***************************** - * Parity control unit of - * the bus state controller - *****************************/ -isp( _prt_isp, PRT_ISP_V, ___ISR_Handler); - - -/****************************** - * Analog digital converter - * ADC - ******************************/ -isp( _adu_isp, ADU_ISP_V, ___ISR_Handler); - - -/****************************** - * Watchdog timer - ******************************/ -isp( _wdt_isp, WDT_ISP_V, ___ISR_Handler); - - -/****************************** - * DRAM refresh control unit - * of bus state controller - ******************************/ -isp( _dref_isp, DREF_ISP_V, ___ISR_Handler); diff --git a/c/src/lib/libcpu/sh/sh7045/score/cpu_asm.c b/c/src/lib/libcpu/sh/sh7045/score/cpu_asm.c deleted file mode 100644 index 42764f6eb1..0000000000 --- a/c/src/lib/libcpu/sh/sh7045/score/cpu_asm.c +++ /dev/null @@ -1,311 +0,0 @@ -/* - * This file contains the basic algorithms for all assembly code used - * in an specific CPU port of RTEMS. These algorithms must be implemented - * in assembly language - * - * NOTE: This port uses a C file with inline assembler instructions - * - * Authors: Ralf Corsepius (corsepiu@faw.uni-ulm.de) and - * Bernd Becker (becker@faw.uni-ulm.de) - * - * COPYRIGHT (c) 1997-1998, FAW Ulm, Germany - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * - * - * COPYRIGHT (c) 1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - * - * This material may be reproduced by or for the U.S. Government pursuant - * to the copyright license under the clause at DFARS 252.227-7013. This - * notice must appear in all copies of this file and its derivatives. - * - */ - -/* - * This is supposed to be an assembly file. This means that system.h - * and cpu.h should not be included in a "real" cpu_asm file. An - * implementation in assembly should include "cpu_asm.h" - */ - -#include <rtems/system.h> -#include <rtems/score/cpu.h> -#include <rtems/score/isr.h> -#include <rtems/score/thread.h> -#include <rtems/score/cpu_isps.h> -#include <rtems/score/sh_io.h> -#include <rtems/score/sh.h> -#include <rtems/score/iosh7030.h> - -/* from cpu_isps.c */ -extern proc_ptr _Hardware_isr_Table[]; - -#if( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE) - unsigned long *_old_stack_ptr; -#endif - -register unsigned long *stack_ptr asm("r15"); - -/* - * sh_set_irq_priority - * - * this function sets the interrupt level of the specified interrupt - * - * parameters: - * - irq : interrupt number - * - prio: priority to set for this interrupt number - * - * returns: 0 if ok - * -1 on error - */ - -unsigned int sh_set_irq_priority( - unsigned int irq, - unsigned int prio ) -{ - unsigned32 shiftcount; - unsigned32 prioreg; - unsigned16 temp16; - unsigned32 level; - - /* - * first check for valid interrupt - */ - if(( irq > 113) || (_Hardware_isr_Table[irq] == _dummy_isp)) - return -1; - /* - * check for valid irq priority - */ - if( prio > 15 ) - return -1; - - /* - * look up appropriate interrupt priority register - */ - if( irq > 71) - { - irq = irq - 72; - shiftcount = 12 - ((irq & ~0x03) % 16); - - switch( irq / 16) - { - case 0: { prioreg = INTC_IPRC; break;} - case 1: { prioreg = INTC_IPRD; break;} - case 2: { prioreg = INTC_IPRE; break;} - default: return -1; - } - } - else - { - shiftcount = 12 - 4 * ( irq % 4); - if( irq > 67) - prioreg = INTC_IPRB; - else - prioreg = INTC_IPRA; - } - - /* - * Set the interrupt priority register - */ - _CPU_ISR_Disable( level ); - - temp16 = read16( prioreg); - temp16 &= ~( 15 << shiftcount); - temp16 |= prio << shiftcount; - write16( temp16, prioreg); - - _CPU_ISR_Enable( level ); - - return 0; -} - -/* - * _CPU_Context_save_fp_context - * - * This routine is responsible for saving the FP context - * at *fp_context_ptr. If the point to load the FP context - * from is changed then the pointer is modified by this routine. - * - * Sometimes a macro implementation of this is in cpu.h which dereferences - * the ** and a similarly named routine in this file is passed something - * like a (Context_Control_fp *). The general rule on making this decision - * is to avoid writing assembly language. - */ - -void _CPU_Context_save_fp( - void **fp_context_ptr -) -{ -} - -/* - * _CPU_Context_restore_fp_context - * - * This routine is responsible for restoring the FP context - * at *fp_context_ptr. If the point to load the FP context - * from is changed then the pointer is modified by this routine. - * - * Sometimes a macro implementation of this is in cpu.h which dereferences - * the ** and a similarly named routine in this file is passed something - * like a (Context_Control_fp *). The general rule on making this decision - * is to avoid writing assembly language. - */ - -void _CPU_Context_restore_fp( - void **fp_context_ptr -) -{ -} - -/* _CPU_Context_switch - * - * This routine performs a normal non-FP context switch. - */ - -/* within __CPU_Context_switch: - * _CPU_Context_switch - * _CPU_Context_restore - * - * This routine is generally used only to restart self in an - * efficient manner. It may simply be a label in _CPU_Context_switch. - * - * NOTE: It should be safe not to store r4, r5 - * - * NOTE: It is doubtful if r0 is really needed to be stored - * - * NOTE: gbr is added, but should not be necessary, as it is - * only used globally in this port. - */ - -/* - * FIXME: This is an ugly hack, but we wanted to avoid recalculating - * the offset each time Context_Control is changed - */ -void __CPU_Context_switch( - Context_Control *run, /* r4 */ - Context_Control *heir /* r5 */ -) -{ - -asm volatile(" - .global __CPU_Context_switch -__CPU_Context_switch: - - add %0,r4 - - stc.l sr,@-r4 - stc.l gbr,@-r4 - mov.l r0,@-r4 - mov.l r1,@-r4 - mov.l r2,@-r4 - mov.l r3,@-r4 - - mov.l r6,@-r4 - mov.l r7,@-r4 - mov.l r8,@-r4 - mov.l r9,@-r4 - mov.l r10,@-r4 - mov.l r11,@-r4 - mov.l r12,@-r4 - mov.l r13,@-r4 - mov.l r14,@-r4 - sts.l pr,@-r4 - sts.l mach,@-r4 - sts.l macl,@-r4 - mov.l r15,@-r4 - - mov r5, r4" - :: "I" (sizeof(Context_Control)) - ); - - asm volatile(" - .global __CPU_Context_restore -__CPU_Context_restore: - mov.l @r4+,r15 - lds.l @r4+,macl - lds.l @r4+,mach - lds.l @r4+,pr - mov.l @r4+,r14 - mov.l @r4+,r13 - mov.l @r4+,r12 - mov.l @r4+,r11 - mov.l @r4+,r10 - mov.l @r4+,r9 - mov.l @r4+,r8 - mov.l @r4+,r7 - mov.l @r4+,r6 - - mov.l @r4+,r3 - mov.l @r4+,r2 - mov.l @r4+,r1 - mov.l @r4+,r0 - ldc.l @r4+,gbr - ldc.l @r4+,sr - - rts - nop" ); -} - -/* - * This routine provides the RTEMS interrupt management. - */ - -void __ISR_Handler( unsigned32 vector) -{ - register unsigned32 level; - - _CPU_ISR_Disable( level ); - - _Thread_Dispatch_disable_level++; - -#if( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE) - if( _ISR_Nest_level == 0 ) - { - /* Install irq stack */ - _old_stack_ptr = stack_ptr; - stack_ptr = _CPU_Interrupt_stack_high; - } - -#endif - - _ISR_Nest_level++; - - _CPU_ISR_Enable( level ); - - /* call isp */ - if( _ISR_Vector_table[ vector]) - (*_ISR_Vector_table[ vector ])( vector ); - - _CPU_ISR_Disable( level ); - - _ISR_Nest_level--; - -#if( CPU_HAS_SOFTWARE_INTERRUPT_STACK == TRUE) - - if( _ISR_Nest_level == 0 ) - /* restore old stack pointer */ - stack_ptr = _old_stack_ptr; -#endif - - _Thread_Dispatch_disable_level--; - - _CPU_ISR_Enable( level ); - - if ( _Thread_Dispatch_disable_level == 0 ) - { - if(( _Context_Switch_necessary) || (! _ISR_Signals_to_thread_executing)) - { - _ISR_Signals_to_thread_executing = FALSE; - _Thread_Dispatch(); - } - } -} diff --git a/c/src/lib/libcpu/sparc/include/erc32.h b/c/src/lib/libcpu/sparc/include/erc32.h deleted file mode 100644 index 50df21267f..0000000000 --- a/c/src/lib/libcpu/sparc/include/erc32.h +++ /dev/null @@ -1,521 +0,0 @@ -/* erc32.h - * - * This include file contains information pertaining to the ERC32. - * The ERC32 is a custom SPARC V7 implementation based on the Cypress - * 601/602 chipset. This CPU has a number of on-board peripherals and - * was developed by the European Space Agency to target space applications. - * - * NOTE: Other than where absolutely required, this version currently - * supports only the peripherals and bits used by the basic board - * support package. This includes at least significant pieces of - * the following items: - * - * + UART Channels A and B - * + General Purpose Timer - * + Real Time Clock - * + Watchdog Timer (so it can be disabled) - * + Control Register (so powerdown mode can be enabled) - * + Memory Control Register - * + Interrupt Control - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * Ported to ERC32 implementation of the SPARC by On-Line Applications - * Research Corporation (OAR) under contract to the European Space - * Agency (ESA). - * - * ERC32 modifications of respective RTEMS file: COPYRIGHT (c) 1995. - * European Space Agency. - * - * $Id$ - */ - -#ifndef _INCLUDE_ERC32_h -#define _INCLUDE_ERC32_h - -#include <rtems/score/sparc.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Interrupt Sources - * - * The interrupt source numbers directly map to the trap type and to - * the bits used in the Interrupt Clear, Interrupt Force, Interrupt Mask, - * and the Interrupt Pending Registers. - */ - -#define ERC32_INTERRUPT_MASKED_ERRORS 1 -#define ERC32_INTERRUPT_EXTERNAL_1 2 -#define ERC32_INTERRUPT_EXTERNAL_2 3 -#define ERC32_INTERRUPT_UART_A_RX_TX 4 -#define ERC32_INTERRUPT_UART_B_RX_TX 5 -#define ERC32_INTERRUPT_CORRECTABLE_MEMORY_ERROR 6 -#define ERC32_INTERRUPT_UART_ERROR 7 -#define ERC32_INTERRUPT_DMA_ACCESS_ERROR 8 -#define ERC32_INTERRUPT_DMA_TIMEOUT 9 -#define ERC32_INTERRUPT_EXTERNAL_3 10 -#define ERC32_INTERRUPT_EXTERNAL_4 11 -#define ERC32_INTERRUPT_GENERAL_PURPOSE_TIMER 12 -#define ERC32_INTERRUPT_REAL_TIME_CLOCK 13 -#define ERC32_INTERRUPT_EXTERNAL_5 14 -#define ERC32_INTERRUPT_WATCHDOG_TIMEOUT 15 - -#ifndef ASM - -/* - * Trap Types for on-chip peripherals - * - * Source: Table 8 - Interrupt Trap Type and Default Priority Assignments - * - * NOTE: The priority level for each source corresponds to the least - * significant nibble of the trap type. - */ - -#define ERC32_TRAP_TYPE( _source ) SPARC_ASYNCHRONOUS_TRAP((_source) + 0x10) - -#define ERC32_TRAP_SOURCE( _trap ) ((_trap) - 0x10) - -#define ERC32_Is_MEC_Trap( _trap ) \ - ( (_trap) >= ERC32_TRAP_TYPE( ERC32_INTERRUPT_MASKED_ERRORS ) && \ - (_trap) <= ERC32_TRAP_TYPE( ERC32_INTERRUPT_WATCHDOG_TIMEOUT ) ) - -/* - * Structure for ERC32 memory mapped registers. - * - * Source: Section 3.25.2 - Register Address Map - * - * NOTE: There is only one of these structures per CPU, its base address - * is 0x01f80000, and the variable MEC is placed there by the - * linkcmds file. - */ - -typedef struct { - volatile unsigned32 Control; /* offset 0x00 */ - volatile unsigned32 Software_Reset; /* offset 0x04 */ - volatile unsigned32 Power_Down; /* offset 0x08 */ - volatile unsigned32 Unimplemented_0; /* offset 0x0c */ - volatile unsigned32 Memory_Configuration; /* offset 0x10 */ - volatile unsigned32 IO_Configuration; /* offset 0x14 */ - volatile unsigned32 Wait_State_Configuration; /* offset 0x18 */ - volatile unsigned32 Unimplemented_1; /* offset 0x1c */ - volatile unsigned32 Memory_Access_0; /* offset 0x20 */ - volatile unsigned32 Memory_Access_1; /* offset 0x24 */ - volatile unsigned32 Unimplemented_2[ 7 ]; /* offset 0x28 */ - volatile unsigned32 Interrupt_Shape; /* offset 0x44 */ - volatile unsigned32 Interrupt_Pending; /* offset 0x48 */ - volatile unsigned32 Interrupt_Mask; /* offset 0x4c */ - volatile unsigned32 Interrupt_Clear; /* offset 0x50 */ - volatile unsigned32 Interrupt_Force; /* offset 0x54 */ - volatile unsigned32 Unimplemented_3[ 2 ]; /* offset 0x58 */ - /* offset 0x60 */ - volatile unsigned32 Watchdog_Program_and_Timeout_Acknowledge; - volatile unsigned32 Watchdog_Trap_Door_Set; /* offset 0x64 */ - volatile unsigned32 Unimplemented_4[ 6 ]; /* offset 0x68 */ - volatile unsigned32 Real_Time_Clock_Counter; /* offset 0x80 */ - volatile unsigned32 Real_Time_Clock_Scalar; /* offset 0x84 */ - volatile unsigned32 General_Purpose_Timer_Counter; /* offset 0x88 */ - volatile unsigned32 General_Purpose_Timer_Scalar; /* offset 0x8c */ - volatile unsigned32 Unimplemented_5[ 2 ]; /* offset 0x90 */ - volatile unsigned32 Timer_Control; /* offset 0x98 */ - volatile unsigned32 Unimplemented_6; /* offset 0x9c */ - volatile unsigned32 System_Fault_Status; /* offset 0xa0 */ - volatile unsigned32 First_Failing_Address; /* offset 0xa4 */ - volatile unsigned32 First_Failing_Data; /* offset 0xa8 */ - volatile unsigned32 First_Failing_Syndrome_and_Check_Bits;/* offset 0xac */ - volatile unsigned32 Error_and_Reset_Status; /* offset 0xb0 */ - volatile unsigned32 Error_Mask; /* offset 0xb4 */ - volatile unsigned32 Unimplemented_7[ 2 ]; /* offset 0xb8 */ - volatile unsigned32 Debug_Control; /* offset 0xc0 */ - volatile unsigned32 Breakpoint; /* offset 0xc4 */ - volatile unsigned32 Watchpoint; /* offset 0xc8 */ - volatile unsigned32 Unimplemented_8; /* offset 0xcc */ - volatile unsigned32 Test_Control; /* offset 0xd0 */ - volatile unsigned32 Test_Data; /* offset 0xd4 */ - volatile unsigned32 Unimplemented_9[ 2 ]; /* offset 0xd8 */ - volatile unsigned32 UART_Channel_A; /* offset 0xe0 */ - volatile unsigned32 UART_Channel_B; /* offset 0xe4 */ - volatile unsigned32 UART_Status; /* offset 0xe8 */ -} ERC32_Register_Map; - -#endif - -/* - * The following constants are intended to be used ONLY in assembly - * language files. - * - * NOTE: The intended style of usage is to load the address of MEC - * into a register and then use these as displacements from - * that register. - */ - -#ifdef ASM - -#define ERC32_MEC_CONTROL_OFFSET 0x00 -#define ERC32_MEC_SOFTWARE_RESET_OFFSET 0x04 -#define ERC32_MEC_POWER_DOWN_OFFSET 0x08 -#define ERC32_MEC_UNIMPLEMENTED_0_OFFSET 0x0C -#define ERC32_MEC_MEMORY_CONFIGURATION_OFFSET 0x10 -#define ERC32_MEC_IO_CONFIGURATION_OFFSET 0x14 -#define ERC32_MEC_WAIT_STATE_CONFIGURATION_OFFSET 0x18 -#define ERC32_MEC_UNIMPLEMENTED_1_OFFSET 0x1C -#define ERC32_MEC_MEMORY_ACCESS_0_OFFSET 0x20 -#define ERC32_MEC_MEMORY_ACCESS_1_OFFSET 0x24 -#define ERC32_MEC_UNIMPLEMENTED_2_OFFSET 0x28 -#define ERC32_MEC_INTERRUPT_SHAPE_OFFSET 0x44 -#define ERC32_MEC_INTERRUPT_PENDING_OFFSET 0x48 -#define ERC32_MEC_INTERRUPT_MASK_OFFSET 0x4C -#define ERC32_MEC_INTERRUPT_CLEAR_OFFSET 0x50 -#define ERC32_MEC_INTERRUPT_FORCE_OFFSET 0x54 -#define ERC32_MEC_UNIMPLEMENTED_3_OFFSET 0x58 -#define ERC32_MEC_WATCHDOG_PROGRAM_AND_TIMEOUT_ACKNOWLEDGE_OFFSET 0x60 -#define ERC32_MEC_WATCHDOG_TRAP_DOOR_SET_OFFSET 0x64 -#define ERC32_MEC_UNIMPLEMENTED_4_OFFSET 0x6C -#define ERC32_MEC_REAL_TIME_CLOCK_COUNTER_OFFSET 0x80 -#define ERC32_MEC_REAL_TIME_CLOCK_SCALAR_OFFSET 0x84 -#define ERC32_MEC_GENERAL_PURPOSE_TIMER_COUNTER_OFFSET 0x88 -#define ERC32_MEC_GENERAL_PURPOSE_TIMER_SCALAR_OFFSET 0x8C -#define ERC32_MEC_UNIMPLEMENTED_5_OFFSET 0x90 -#define ERC32_MEC_TIMER_CONTROL_OFFSET 0x98 -#define ERC32_MEC_UNIMPLEMENTED_6_OFFSET 0x9C -#define ERC32_MEC_SYSTEM_FAULT_STATUS_OFFSET 0xA0 -#define ERC32_MEC_FIRST_FAILING_ADDRESS_OFFSET 0xA4 -#define ERC32_MEC_FIRST_FAILING_DATA_OFFSET 0xA8 -#define ERC32_MEC_FIRST_FAILING_SYNDROME_AND_CHECK_BITS_OFFSET 0xAC -#define ERC32_MEC_ERROR_AND_RESET_STATUS_OFFSET 0xB0 -#define ERC32_MEC_ERROR_MASK_OFFSET 0xB4 -#define ERC32_MEC_UNIMPLEMENTED_7_OFFSET 0xB8 -#define ERC32_MEC_DEBUG_CONTROL_OFFSET 0xC0 -#define ERC32_MEC_BREAKPOINT_OFFSET 0xC4 -#define ERC32_MEC_WATCHPOINT_OFFSET 0xC8 -#define ERC32_MEC_UNIMPLEMENTED_8_OFFSET 0xCC -#define ERC32_MEC_TEST_CONTROL_OFFSET 0xD0 -#define ERC32_MEC_TEST_DATA_OFFSET 0xD4 -#define ERC32_MEC_UNIMPLEMENTED_9_OFFSET 0xD8 -#define ERC32_MEC_UART_CHANNEL_A_OFFSET 0xE0 -#define ERC32_MEC_UART_CHANNEL_B_OFFSET 0xE4 -#define ERC32_MEC_UART_STATUS_OFFSET 0xE8 - -#endif - -/* - * The following defines the bits in the Configuration Register. - */ - -#define ERC32_CONFIGURATION_POWER_DOWN_MASK 0x00000001 -#define ERC32_CONFIGURATION_POWER_DOWN_ALLOWED 0x00000001 -#define ERC32_CONFIGURATION_POWER_DOWN_DISABLED 0x00000000 - -#define ERC32_CONFIGURATION_SOFTWARE_RESET_MASK 0x00000002 -#define ERC32_CONFIGURATION_SOFTWARE_RESET_ALLOWED 0x00000002 -#define ERC32_CONFIGURATION_SOFTWARE_RESET_DISABLED 0x00000000 - -#define ERC32_CONFIGURATION_BUS_TIMEOUT_MASK 0x00000004 -#define ERC32_CONFIGURATION_BUS_TIMEOUT_ENABLED 0x00000004 -#define ERC32_CONFIGURATION_BUS_TIMEOUT_DISABLED 0x00000000 - -#define ERC32_CONFIGURATION_ACCESS_PROTECTION_MASK 0x00000008 -#define ERC32_CONFIGURATION_ACCESS_PROTECTION_ENABLED 0x00000008 -#define ERC32_CONFIGURATION_ACCESS_PROTECTION_DISABLED 0x00000000 - - -/* - * The following defines the bits in the Memory Configuration Register. - */ - -#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_MASK 0x00001C00 -#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_256K ( 0 << 10 ) -#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_512K ( 1 << 10 ) -#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_1MB ( 2 << 10 ) -#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_2MB ( 3 << 10 ) -#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_4MB ( 4 << 10 ) -#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_8MB ( 5 << 10 ) -#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_16MB ( 6 << 10 ) -#define ERC32_MEMORY_CONFIGURATION_RAM_SIZE_32MB ( 7 << 10 ) - -#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_MASK 0x001C0000 -#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_128K ( 0 << 18 ) -#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_256K ( 1 << 18 ) -#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_512K ( 2 << 18 ) -#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_1M ( 3 << 18 ) -#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_2M ( 4 << 18 ) -#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_4M ( 5 << 18 ) -#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_8M ( 6 << 18 ) -#define ERC32_MEMORY_CONFIGURATION_PROM_SIZE_16M ( 7 << 18 ) - -/* - * The following defines the bits in the Timer Control Register. - */ - -#define ERC32_MEC_TIMER_CONTROL_GCR 0x00000001 /* 1 = reload at 0 */ - /* 0 = stop at 0 */ -#define ERC32_MEC_TIMER_CONTROL_GCL 0x00000002 /* 1 = load and start */ - /* 0 = no function */ -#define ERC32_MEC_TIMER_CONTROL_GSE 0x00000004 /* 1 = enable counting */ - /* 0 = hold scalar and counter */ -#define ERC32_MEC_TIMER_CONTROL_GSL 0x00000008 /* 1 = load scalar and start */ - /* 0 = no function */ - -#define ERC32_MEC_TIMER_CONTROL_RTCCR 0x00000100 /* 1 = reload at 0 */ - /* 0 = stop at 0 */ -#define ERC32_MEC_TIMER_CONTROL_RTCCL 0x00000200 /* 1 = load and start */ - /* 0 = no function */ -#define ERC32_MEC_TIMER_CONTROL_RTCSE 0x00000400 /* 1 = enable counting */ - /* 0 = hold scalar and counter */ -#define ERC32_MEC_TIMER_CONTROL_RTCSL 0x00000800 /* 1 = load scalar and start */ - /* 0 = no function */ - -/* - * The following defines the bits in the UART Control Registers. - * - */ - -#define ERC32_MEC_UART_CONTROL_RTD 0x000000FF /* RX/TX data */ - -/* - * The following defines the bits in the MEC UART Control Registers. - */ - -#define ERC32_MEC_UART_STATUS_DR 0x00000001 /* Data Ready */ -#define ERC32_MEC_UART_STATUS_TSE 0x00000002 /* TX Send Register Empty */ -#define ERC32_MEC_UART_STATUS_THE 0x00000004 /* TX Hold Register Empty */ -#define ERC32_MEC_UART_STATUS_FE 0x00000010 /* RX Framing Error */ -#define ERC32_MEC_UART_STATUS_PE 0x00000020 /* RX Parity Error */ -#define ERC32_MEC_UART_STATUS_OE 0x00000040 /* RX Overrun Error */ -#define ERC32_MEC_UART_STATUS_CU 0x00000080 /* Clear Errors */ -#define ERC32_MEC_UART_STATUS_TXE 0x00000006 /* TX Empty */ -#define ERC32_MEC_UART_STATUS_CLRA 0x00000080 /* Clear UART A */ -#define ERC32_MEC_UART_STATUS_CLRB 0x00800000 /* Clear UART B */ -#define ERC32_MEC_UART_STATUS_ERRA 0x00000070 /* Error in UART A */ -#define ERC32_MEC_UART_STATUS_ERRB 0x00700000 /* Error in UART B */ - -#define ERC32_MEC_UART_STATUS_DRA (ERC32_MEC_UART_STATUS_DR << 0) -#define ERC32_MEC_UART_STATUS_TSEA (ERC32_MEC_UART_STATUS_TSE << 0) -#define ERC32_MEC_UART_STATUS_THEA (ERC32_MEC_UART_STATUS_THE << 0) -#define ERC32_MEC_UART_STATUS_FEA (ERC32_MEC_UART_STATUS_FE << 0) -#define ERC32_MEC_UART_STATUS_PEA (ERC32_MEC_UART_STATUS_PE << 0) -#define ERC32_MEC_UART_STATUS_OEA (ERC32_MEC_UART_STATUS_OE << 0) -#define ERC32_MEC_UART_STATUS_CUA (ERC32_MEC_UART_STATUS_CU << 0) -#define ERC32_MEC_UART_STATUS_TXEA (ERC32_MEC_UART_STATUS_TXE << 0) - -#define ERC32_MEC_UART_STATUS_DRB (ERC32_MEC_UART_STATUS_DR << 16) -#define ERC32_MEC_UART_STATUS_TSEB (ERC32_MEC_UART_STATUS_TSE << 16) -#define ERC32_MEC_UART_STATUS_THEB (ERC32_MEC_UART_STATUS_THE << 16) -#define ERC32_MEC_UART_STATUS_FEB (ERC32_MEC_UART_STATUS_FE << 16) -#define ERC32_MEC_UART_STATUS_PEB (ERC32_MEC_UART_STATUS_PE << 16) -#define ERC32_MEC_UART_STATUS_OEB (ERC32_MEC_UART_STATUS_OE << 16) -#define ERC32_MEC_UART_STATUS_CUB (ERC32_MEC_UART_STATUS_CU << 16) -#define ERC32_MEC_UART_STATUS_TXEB (ERC32_MEC_UART_STATUS_TXE << 16) - -#ifndef ASM - -/* - * This is used to manipulate the on-chip registers. - * - * The following symbol must be defined in the linkcmds file and point - * to the correct location. - */ - -extern ERC32_Register_Map ERC32_MEC; - -/* - * Macros to manipulate the Interrupt Clear, Interrupt Force, Interrupt Mask, - * and the Interrupt Pending Registers. - * - * NOTE: For operations which are not atomic, this code disables interrupts - * to guarantee there are no intervening accesses to the same register. - * The operations which read the register, modify the value and then - * store the result back are vulnerable. - */ - -#define ERC32_Clear_interrupt( _source ) \ - do { \ - ERC32_MEC.Interrupt_Clear = (1 << (_source)); \ - } while (0) - -#define ERC32_Force_interrupt( _source ) \ - do { \ - unsigned32 _level; \ - \ - sparc_disable_interrupts( _level ); \ - ERC32_MEC.Test_Control = ERC32_MEC.Test_Control | 0x80000; \ - ERC32_MEC.Interrupt_Force = (1 << (_source)); \ - sparc_enable_interrupts( _level ); \ - } while (0) - -#define ERC32_Is_interrupt_pending( _source ) \ - (ERC32_MEC.Interrupt_Pending & (1 << (_source))) - -#define ERC32_Is_interrupt_masked( _source ) \ - (ERC32_MEC.Interrupt_Masked & (1 << (_source))) - -#define ERC32_Mask_interrupt( _source ) \ - do { \ - unsigned32 _level; \ - \ - sparc_disable_interrupts( _level ); \ - ERC32_MEC.Interrupt_Mask |= (1 << (_source)); \ - sparc_enable_interrupts( _level ); \ - } while (0) - -#define ERC32_Unmask_interrupt( _source ) \ - do { \ - unsigned32 _level; \ - \ - sparc_disable_interrupts( _level ); \ - ERC32_MEC.Interrupt_Mask &= ~(1 << (_source)); \ - sparc_enable_interrupts( _level ); \ - } while (0) - -#define ERC32_Disable_interrupt( _source, _previous ) \ - do { \ - unsigned32 _level; \ - unsigned32 _mask = 1 << (_source); \ - \ - sparc_disable_interrupts( _level ); \ - (_previous) = ERC32_MEC.Interrupt_Mask; \ - ERC32_MEC.Interrupt_Mask = _previous | _mask; \ - sparc_enable_interrupts( _level ); \ - (_previous) &= ~_mask; \ - } while (0) - -#define ERC32_Restore_interrupt( _source, _previous ) \ - do { \ - unsigned32 _level; \ - unsigned32 _mask = 1 << (_source); \ - \ - sparc_disable_interrupts( _level ); \ - ERC32_MEC.Interrupt_Mask = \ - (ERC32_MEC.Interrupt_Mask & ~_mask) | (_previous); \ - sparc_enable_interrupts( _level ); \ - } while (0) - -/* - * The following macros attempt to hide the fact that the General Purpose - * Timer and Real Time Clock Timer share the Timer Control Register. Because - * the Timer Control Register is write only, we must mirror it in software - * and insure that writes to one timer do not alter the current settings - * and status of the other timer. - * - * This code promotes the view that the two timers are completely independent. - * By exclusively using the routines below to access the Timer Control - * Register, the application can view the system as having a General Purpose - * Timer Control Register and a Real Time Clock Timer Control Register - * rather than the single shared value. - * - * Each logical timer control register is organized as follows: - * - * D0 - Counter Reload - * 1 = reload counter at zero and restart - * 0 = stop counter at zero - * - * D1 - Counter Load - * 1 = load counter with preset value and restart - * 0 = no function - * - * D2 - Enable - * 1 = enable counting - * 0 = hold scaler and counter - * - * D3 - Scaler Load - * 1 = load scalar with preset value and restart - * 0 = no function - * - * To insure the management of the mirror is atomic, we disable interrupts - * around updates. - */ - -#define ERC32_MEC_TIMER_COUNTER_RELOAD_AT_ZERO 0x00000001 -#define ERC32_MEC_TIMER_COUNTER_STOP_AT_ZERO 0x00000000 - -#define ERC32_MEC_TIMER_COUNTER_LOAD_COUNTER 0x00000002 - -#define ERC32_MEC_TIMER_COUNTER_ENABLE_COUNTING 0x00000004 -#define ERC32_MEC_TIMER_COUNTER_DISABLE_COUNTING 0x00000000 - -#define ERC32_MEC_TIMER_COUNTER_LOAD_SCALER 0x00000008 - -#define ERC32_MEC_TIMER_COUNTER_RELOAD_MASK 0x00000001 -#define ERC32_MEC_TIMER_COUNTER_ENABLE_MASK 0x00000004 - -#define ERC32_MEC_TIMER_COUNTER_DEFINED_MASK 0x0000000F -#define ERC32_MEC_TIMER_COUNTER_CURRENT_MODE_MASK 0x00000005 - -extern unsigned32 _ERC32_MEC_Timer_Control_Mirror; - -/* - * This macros manipulate the General Purpose Timer portion of the - * Timer Control register and promote the view that there are actually - * two independent Timer Control Registers. - */ - -#define ERC32_MEC_Set_General_Purpose_Timer_Control( _value ) \ - do { \ - unsigned32 _level; \ - unsigned32 _control; \ - unsigned32 __value; \ - \ - __value = ((_value) & 0x0f); \ - sparc_disable_interrupts( _level ); \ - _control = _ERC32_MEC_Timer_Control_Mirror; \ - _control &= ERC32_MEC_TIMER_COUNTER_DEFINED_MASK << 8; \ - _ERC32_MEC_Timer_Control_Mirror = _control | _value; \ - _control &= (ERC32_MEC_TIMER_COUNTER_CURRENT_MODE_MASK << 8); \ - _control |= __value; \ - /* printf( "GPT 0x%x 0x%x 0x%x\n", _value, __value, _control ); */ \ - ERC32_MEC.Timer_Control = _control; \ - sparc_enable_interrupts( _level ); \ - } while ( 0 ) - -#define ERC32_MEC_Get_General_Purpose_Timer_Control( _value ) \ - do { \ - (_value) = _ERC32_MEC_Timer_Control_Mirror & 0xf; \ - } while ( 0 ) - -/* - * This macros manipulate the Real Timer Clock Timer portion of the - * Timer Control register and promote the view that there are actually - * two independent Timer Control Registers. - */ - -#define ERC32_MEC_Set_Real_Time_Clock_Timer_Control( _value ) \ - do { \ - unsigned32 _level; \ - unsigned32 _control; \ - unsigned32 __value; \ - \ - __value = ((_value) & 0x0f) << 8; \ - sparc_disable_interrupts( _level ); \ - _control = _ERC32_MEC_Timer_Control_Mirror; \ - _control &= ERC32_MEC_TIMER_COUNTER_DEFINED_MASK; \ - _ERC32_MEC_Timer_Control_Mirror = _control | __value; \ - _control &= ERC32_MEC_TIMER_COUNTER_CURRENT_MODE_MASK; \ - _control |= __value; \ - /* printf( "RTC 0x%x 0x%x 0x%x\n", _value, __value, _control ); */ \ - ERC32_MEC.Timer_Control = _control; \ - sparc_enable_interrupts( _level ); \ - } while ( 0 ) - -#define ERC32_MEC_Get_Real_Time_Clock_Timer_Control( _value ) \ - do { \ - (_value) = (_ERC32_MEC_Timer_Control_Mirror >> 8) & 0xf; \ - } while ( 0 ) - - -#endif /* !ASM */ - -#ifdef __cplusplus -} -#endif - -#endif /* !_INCLUDE_ERC32_h */ -/* end of include file */ - |