diff options
Diffstat (limited to 'c/src/libchip')
65 files changed, 0 insertions, 6981 deletions
diff --git a/c/src/libchip/rtc/Makefile.in b/c/src/libchip/rtc/Makefile.in deleted file mode 100644 index 724a1af380..0000000000 --- a/c/src/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/libchip/rtc/README.ds1643 b/c/src/libchip/rtc/README.ds1643 deleted file mode 100644 index 4fab5b62c6..0000000000 --- a/c/src/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/libchip/rtc/README.icm7170 b/c/src/libchip/rtc/README.icm7170 deleted file mode 100644 index de2199339d..0000000000 --- a/c/src/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/libchip/rtc/README.m48t08 b/c/src/libchip/rtc/README.m48t08 deleted file mode 100644 index d792d7957e..0000000000 --- a/c/src/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/libchip/rtc/README.m48t18 b/c/src/libchip/rtc/README.m48t18 deleted file mode 100644 index 85fe918f23..0000000000 --- a/c/src/libchip/rtc/README.m48t18 +++ /dev/null @@ -1,5 +0,0 @@ -# -# $Id$ -# - -This is supported by the m48t08 driver. diff --git a/c/src/libchip/rtc/STATUS b/c/src/libchip/rtc/STATUS deleted file mode 100644 index e95a924ae9..0000000000 --- a/c/src/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/libchip/rtc/icm7170.c b/c/src/libchip/rtc/icm7170.c deleted file mode 100644 index f3cf513d2e..0000000000 --- a/c/src/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/libchip/rtc/icm7170.h b/c/src/libchip/rtc/icm7170.h deleted file mode 100644 index 5bf9fd065c..0000000000 --- a/c/src/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/libchip/rtc/icm7170_reg.c b/c/src/libchip/rtc/icm7170_reg.c deleted file mode 100644 index b6961824b6..0000000000 --- a/c/src/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/libchip/rtc/icm7170_reg2.c b/c/src/libchip/rtc/icm7170_reg2.c deleted file mode 100644 index bab92697bf..0000000000 --- a/c/src/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/libchip/rtc/icm7170_reg4.c b/c/src/libchip/rtc/icm7170_reg4.c deleted file mode 100644 index 896e0cbc0b..0000000000 --- a/c/src/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/libchip/rtc/icm7170_reg8.c b/c/src/libchip/rtc/icm7170_reg8.c deleted file mode 100644 index d2ed2844ac..0000000000 --- a/c/src/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/libchip/rtc/m48t08.c b/c/src/libchip/rtc/m48t08.c deleted file mode 100644 index b3d0dcb0de..0000000000 --- a/c/src/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/libchip/rtc/m48t08.h b/c/src/libchip/rtc/m48t08.h deleted file mode 100644 index 7d27215e1e..0000000000 --- a/c/src/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/libchip/rtc/m48t08_reg.c b/c/src/libchip/rtc/m48t08_reg.c deleted file mode 100644 index abb37c628c..0000000000 --- a/c/src/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/libchip/rtc/m48t08_reg2.c b/c/src/libchip/rtc/m48t08_reg2.c deleted file mode 100644 index a6f294a3f7..0000000000 --- a/c/src/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/libchip/rtc/m48t08_reg4.c b/c/src/libchip/rtc/m48t08_reg4.c deleted file mode 100644 index a84b988a34..0000000000 --- a/c/src/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/libchip/rtc/m48t08_reg8.c b/c/src/libchip/rtc/m48t08_reg8.c deleted file mode 100644 index dcc2a9b39b..0000000000 --- a/c/src/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/libchip/rtc/rtc.h b/c/src/libchip/rtc/rtc.h deleted file mode 100644 index 94b42e3f34..0000000000 --- a/c/src/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/libchip/rtc/rtcprobe.c b/c/src/libchip/rtc/rtcprobe.c deleted file mode 100644 index 6aaad89486..0000000000 --- a/c/src/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/libchip/serial/Makefile.in b/c/src/libchip/serial/Makefile.in deleted file mode 100644 index d9c78faf97..0000000000 --- a/c/src/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/libchip/serial/README b/c/src/libchip/serial/README deleted file mode 100644 index 3a1013b45b..0000000000 --- a/c/src/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/libchip/serial/README.mc68681 b/c/src/libchip/serial/README.mc68681 deleted file mode 100644 index 240faf759b..0000000000 --- a/c/src/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/libchip/serial/README.ns16550 b/c/src/libchip/serial/README.ns16550 deleted file mode 100644 index 2956173b1b..0000000000 --- a/c/src/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/libchip/serial/README.xr88681 b/c/src/libchip/serial/README.xr88681 deleted file mode 100644 index 37364aaec6..0000000000 --- a/c/src/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/libchip/serial/README.z85c30 b/c/src/libchip/serial/README.z85c30 deleted file mode 100644 index 4442b5ef40..0000000000 --- a/c/src/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/libchip/serial/STATUS b/c/src/libchip/serial/STATUS deleted file mode 100644 index 6eb7fa4171..0000000000 --- a/c/src/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/libchip/serial/mc68681.c b/c/src/libchip/serial/mc68681.c deleted file mode 100644 index a41a00d1ae..0000000000 --- a/c/src/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/libchip/serial/mc68681.h b/c/src/libchip/serial/mc68681.h deleted file mode 100644 index 57713e3eff..0000000000 --- a/c/src/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/libchip/serial/mc68681_baud.c b/c/src/libchip/serial/mc68681_baud.c deleted file mode 100644 index d91774e501..0000000000 --- a/c/src/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/libchip/serial/mc68681_p.h b/c/src/libchip/serial/mc68681_p.h deleted file mode 100644 index 471b0ae42e..0000000000 --- a/c/src/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/libchip/serial/mc68681_reg.c b/c/src/libchip/serial/mc68681_reg.c deleted file mode 100644 index 115bafdfe8..0000000000 --- a/c/src/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/libchip/serial/mc68681_reg2.c b/c/src/libchip/serial/mc68681_reg2.c deleted file mode 100644 index f786ab5df5..0000000000 --- a/c/src/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/libchip/serial/mc68681_reg4.c b/c/src/libchip/serial/mc68681_reg4.c deleted file mode 100644 index 075a9b2564..0000000000 --- a/c/src/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/libchip/serial/mc68681_reg8.c b/c/src/libchip/serial/mc68681_reg8.c deleted file mode 100644 index b83ccd2b46..0000000000 --- a/c/src/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/libchip/serial/ns16550.c b/c/src/libchip/serial/ns16550.c deleted file mode 100644 index 6f8c3f759f..0000000000 --- a/c/src/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/libchip/serial/ns16550.h b/c/src/libchip/serial/ns16550.h deleted file mode 100644 index cb01d20a85..0000000000 --- a/c/src/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/libchip/serial/ns16550_p.h b/c/src/libchip/serial/ns16550_p.h deleted file mode 100644 index 27c3502a0d..0000000000 --- a/c/src/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/libchip/serial/serial.h b/c/src/libchip/serial/serial.h deleted file mode 100644 index aa0e7f58aa..0000000000 --- a/c/src/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/libchip/serial/serprobe.c b/c/src/libchip/serial/serprobe.c deleted file mode 100644 index b76bbebe3c..0000000000 --- a/c/src/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/libchip/serial/sersupp.h b/c/src/libchip/serial/sersupp.h deleted file mode 100644 index a996d53c7c..0000000000 --- a/c/src/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/libchip/serial/termios_baud2index.c b/c/src/libchip/serial/termios_baud2index.c deleted file mode 100644 index b4bf3623a2..0000000000 --- a/c/src/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/libchip/serial/termios_baud2num.c b/c/src/libchip/serial/termios_baud2num.c deleted file mode 100644 index 9c2ddc047e..0000000000 --- a/c/src/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/libchip/serial/z85c30.c b/c/src/libchip/serial/z85c30.c deleted file mode 100644 index a4f3aaceee..0000000000 --- a/c/src/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/libchip/serial/z85c30.h b/c/src/libchip/serial/z85c30.h deleted file mode 100644 index f1beeef5e0..0000000000 --- a/c/src/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/libchip/serial/z85c30_p.h b/c/src/libchip/serial/z85c30_p.h deleted file mode 100644 index 0076fbeaef..0000000000 --- a/c/src/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/libchip/serial/z85c30_reg.c b/c/src/libchip/serial/z85c30_reg.c deleted file mode 100644 index 889dad4530..0000000000 --- a/c/src/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/libchip/shmdr/README b/c/src/libchip/shmdr/README deleted file mode 100644 index 5ed9e861b0..0000000000 --- a/c/src/libchip/shmdr/README +++ /dev/null @@ -1,9 +0,0 @@ -# -# $Id$ -# - -The mpci.h file provided in here is too simple for an MPCI with -multiple ways to get to a node. - -This version of the shm driver needs to be reorganized to follow -the better model of the Ada version. diff --git a/c/src/libchip/shmdr/addlq.c b/c/src/libchip/shmdr/addlq.c deleted file mode 100644 index 2eace43e4d..0000000000 --- a/c/src/libchip/shmdr/addlq.c +++ /dev/null @@ -1,43 +0,0 @@ -/* void Shm_Locked_queue_Add( lq_cb, ecb ) - * - * This routine adds an envelope control block to a shared memory queue. - * - * Input parameters: - * lq_cb - pointer to a locked queue control block - * ecb - pointer to an envelope control block - * - * Output parameters: 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$ - */ - -#include <rtems.h> -#include "shm.h" - -void Shm_Locked_queue_Add( - Shm_Locked_queue_Control *lq_cb, - Shm_Envelope_control *ecb -) -{ - rtems_unsigned32 index; - - ecb->next = Shm_Locked_queue_End_of_list; - ecb->queue = lq_cb->owner; - index = ecb->index; - - Shm_Lock( lq_cb ); - if ( Shm_Convert(lq_cb->front) != Shm_Locked_queue_End_of_list ) - Shm_Envelopes[ Shm_Convert(lq_cb->rear) ].next = index; - else - lq_cb->front = index; - lq_cb->rear = index; - Shm_Unlock( lq_cb ); -} diff --git a/c/src/libchip/shmdr/cnvpkt.c b/c/src/libchip/shmdr/cnvpkt.c deleted file mode 100644 index 4a9a4006db..0000000000 --- a/c/src/libchip/shmdr/cnvpkt.c +++ /dev/null @@ -1,42 +0,0 @@ -/* void Shm_Convert_packet( &packet ) - * - * This routine is the shared memory locked queue MPCI driver routine - * used to convert the RTEMS's information in a packet from non-native - * format to processor native format. - * - * Input parameters: - * packet - pointer to a packet - * - * Output parameters: - * *packet - packet in native format - * - * NOTE: Message buffers are not manipulated. - * Endian conversion is currently the only conversion. - * - * 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 "shm.h" - -void Shm_Convert_packet( - rtems_packet_prefix *packet -) -{ - rtems_unsigned32 *pkt, i; - - pkt = (rtems_unsigned32 *) packet; - for ( i=RTEMS_MINIMUN_HETERO_CONVERSION ; i ; i--, pkt++ ) - *pkt = CPU_swap_u32( *pkt ); - - for ( i=packet->to_convert ; i ; i--, pkt++ ) - *pkt = CPU_swap_u32( *pkt ); -} diff --git a/c/src/libchip/shmdr/dump.c b/c/src/libchip/shmdr/dump.c deleted file mode 100644 index 6cd4e2129f..0000000000 --- a/c/src/libchip/shmdr/dump.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This routine is invoked following a reset to report the statistics - * gathered during the previous execution. - * - * Input parameters: NONE - * - * Output parameters: 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$ - */ - -#include <rtems.h> -#include <stdio.h> - -#include "shm.h" - -void -Shm_Print_statistics(void) -{ - rtems_unsigned32 ticks; - rtems_unsigned32 ticks_per_second; - rtems_unsigned32 seconds; - int packets_per_second; - - (void) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &ticks ); - (void) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second ); - - seconds = ticks / ticks_per_second; - if ( seconds == 0 ) - seconds = 1; - - packets_per_second = Shm_Receive_message_count / seconds; - if ( (Shm_Receive_message_count % seconds) >= (seconds / 2) ) - packets_per_second++; - - printf( "\n\nSHMDR STATISTICS (NODE %d)\n", Shm_Local_node ); - printf( "TICKS SINCE BOOT = %d\n", ticks ); - printf( "TICKS PER SECOND = %d\n", ticks_per_second ); - printf( "ISRs=%d\n", Shm_Interrupt_count ); - printf( "RECV=%d\n", Shm_Receive_message_count ); - printf( "NULL=%d\n", Shm_Null_message_count ); - printf( "PKTS/SEC=%d\n", packets_per_second ); -} diff --git a/c/src/libchip/shmdr/fatal.c b/c/src/libchip/shmdr/fatal.c deleted file mode 100644 index b0558c92f0..0000000000 --- a/c/src/libchip/shmdr/fatal.c +++ /dev/null @@ -1,39 +0,0 @@ -/* void MPCI_Fatal( error ) - * - * This routine is the shared memory driver fatal error handler. - * - * Input parameters: - * error - fatal error code - * - * Output parameters: NEVER RETURNS - * - * 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 "shm.h" - -void MPCI_Fatal( - Internal_errors_Source source, - boolean is_internal, - rtems_unsigned32 error -) -{ - /* Eventually need to attempt to broadcast a K_FATAL message - * without checking for all possible errors (do not want to - * recurse). - * - * Also need to avoid using Shm_Node_statuses if the driver has not been - * initialized. - */ - - Shm_Local_node_status->error = Shm_Convert(error); -} diff --git a/c/src/libchip/shmdr/getlq.c b/c/src/libchip/shmdr/getlq.c deleted file mode 100644 index 7b525b2d92..0000000000 --- a/c/src/libchip/shmdr/getlq.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Shm_Envelope_control *Shm_Locked_queue_Get( lq_cb ) - * - * This routine returns an envelope control block from a shared - * memory queue. - * - * Input parameters: - * lq_cb - pointer to a locked queue control block - * - * Output parameters: - * returns - pointer to an envelope control block - * - NULL if no envelopes on specified queue - * - * 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 <shm.h> - -Shm_Envelope_control *Shm_Locked_queue_Get( - Shm_Locked_queue_Control *lq_cb -) -{ - Shm_Envelope_control *tmp_ecb; - rtems_unsigned32 tmpfront; - - tmp_ecb = NULL; - Shm_Lock( lq_cb ); - - tmpfront = Shm_Convert(lq_cb->front); - if ( tmpfront != Shm_Locked_queue_End_of_list ) { - tmp_ecb = &Shm_Envelopes[ tmpfront ]; - lq_cb->front = tmp_ecb->next; - if ( tmp_ecb->next == Shm_Locked_queue_End_of_list ) - lq_cb->rear = Shm_Locked_queue_End_of_list; - tmp_ecb->next = Shm_Locked_queue_Not_on_list; - } - - Shm_Unlock( lq_cb ); - return( tmp_ecb ); -} diff --git a/c/src/libchip/shmdr/getpkt.c b/c/src/libchip/shmdr/getpkt.c deleted file mode 100644 index 03971ea022..0000000000 --- a/c/src/libchip/shmdr/getpkt.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Shm_Get_packet - * - * This routine is the shared memory locked queue MPCI driver - * routine used to obtain an empty message packet. - * - * Input parameters: - * packet - address of pointer to packet - * - * Output parameters: - * *(cpb->get_packet) - address of allocated packet - * - * 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 "shm.h" - -rtems_mpci_entry Shm_Get_packet( - rtems_packet_prefix **packet -) -{ - Shm_Envelope_control *ecb; - - ecb = Shm_Allocate_envelope(); - if ( !ecb ) - rtems_fatal_error_occurred ( SHM_NO_FREE_PKTS ); - *packet = Shm_Envelope_control_to_packet_prefix_pointer( ecb ); -} diff --git a/c/src/libchip/shmdr/init.c b/c/src/libchip/shmdr/init.c deleted file mode 100644 index 4e1df20be0..0000000000 --- a/c/src/libchip/shmdr/init.c +++ /dev/null @@ -1,254 +0,0 @@ -/* Shm_Initialization - * - * This routine is the shared memory communications initerface - * driver initialization routine. - * - * Input parameters: NONE - * - * Output parameters: 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$ - */ - -#define _SHM_INIT - -#include <rtems.h> -#include <shm.h> - -#include <string.h> /* memset() */ -#include <stdlib.h> /* malloc() */ -#include <assert.h> - -/* - * User extension to install MPCI_Fatal as a fatal error - * handler extension - */ - -rtems_extensions_table MPCI_Shm_extensions; - -rtems_mpci_entry Shm_Initialization( void ) - -{ - rtems_unsigned32 i, all_initialized; - rtems_unsigned32 interrupt_cause, interrupt_value; - void *interrupt_address; - Shm_Node_status_control *nscb; - rtems_unsigned32 extension_id; /* for installation of MPCI_Fatal */ - rtems_unsigned32 remaining_memory; -/* XXX these should use "public" methods to set their values.... */ - rtems_configuration_table *configuration = _Configuration_Table; - rtems_multiprocessing_table *mp_configuration = _Configuration_MP_table; - - Shm_RTEMS_Configuration = configuration; - Shm_RTEMS_MP_Configuration = mp_configuration; - - Shm_Local_node = Shm_RTEMS_MP_Configuration->node; - Shm_Maximum_nodes = Shm_RTEMS_MP_Configuration->maximum_nodes; - - Shm_Get_configuration( Shm_Local_node, &Shm_Configuration ); - - Shm_Interrupt_table = (Shm_Interrupt_information *) malloc( - sizeof(Shm_Interrupt_information) * (Shm_Maximum_nodes + 1) - ); - - assert( Shm_Interrupt_table ); - - - Shm_Receive_message_count = 0; - Shm_Null_message_count = 0; - Shm_Interrupt_count = 0; - - /* - * Set the Node Status indicators - */ - - Shm_Pending_initialization = - Shm_Convert(rtems_build_name( 'P', 'E', 'N', 'D' )); - Shm_Initialization_complete = - Shm_Convert(rtems_build_name( 'C', 'O', 'M', 'P' )); - Shm_Active_node = - Shm_Convert(rtems_build_name( 'A', 'C', 'T', 'V' )); - - /* - * Initialize the constants used by the Locked Queue code. - */ - - Shm_Locked_queue_End_of_list = Shm_Convert( 0xffffffff ); - Shm_Locked_queue_Not_on_list = Shm_Convert( 0xfffffffe ); - - /* - * Set the base addresses for the: - * + Node Status Table - * + Free Pool and Receive Queues - * + Envelopes - */ - - Shm_Node_statuses = (Shm_Node_status_control *) START_NS_CBS; - Shm_Locked_queues = (Shm_Locked_queue_Control *) START_LQ_CBS; - Shm_Envelopes = (Shm_Envelope_control *) START_ENVELOPES; - - /* - * Calculate the maximum number of envelopes which can be - * placed the remaining shared memory. - */ - - remaining_memory = - ((void *)Shm_Configuration->base + Shm_Configuration->length) - - ((void *)Shm_Envelopes); - - Shm_Maximum_envelopes = remaining_memory / sizeof( Shm_Envelope_control ); - Shm_Maximum_envelopes -= 1; - - /* - * Set the pointer to the receive queue for the local node. - * When we receive a node, we will get it from here before - * processing it. - */ - - Shm_Local_receive_queue = &Shm_Locked_queues[ Shm_Local_node ]; - Shm_Local_node_status = &Shm_Node_statuses[ Shm_Local_node ]; - - /* - * Convert local interrupt cause information into the - * neutral format so other nodes will be able to - * understand it. - */ - - interrupt_address = - (void *) Shm_Convert( (rtems_unsigned32)Shm_Configuration->Intr.address ); - interrupt_value = Shm_Convert( Shm_Configuration->Intr.value ); - interrupt_cause = Shm_Convert( Shm_Configuration->Intr.length ); - - if ( Shm_Configuration->poll_intr == POLLED_MODE ) Shm_setclockvec(); - else Shm_setvec(); - - if ( Shm_Is_master_node() ) { - - /* - * Zero out the shared memory area. - */ - - (void) memset( - (void *) Shm_Configuration->base, - 0, - Shm_Configuration->length - ); - - /* - * Initialize all of the locked queues (the free envelope - * pool and a receive queue per node) and set all of the - * node's status so they will be waiting to initialization - * to complete. - */ - - Shm_Locked_queue_Initialize( FREE_ENV_CB, FREE_ENV_POOL ); - - for ( i=SHM_FIRST_NODE ; i<=Shm_Maximum_nodes ; i++ ) { - Shm_Initialize_receive_queue( i ); - - Shm_Node_statuses[ i ].status = Shm_Pending_initialization; - Shm_Node_statuses[ i ].error = 0; - } - - /* - * Initialize all of the envelopes and place them in the - * free pool. - */ - - for ( i=0 ; i<Shm_Maximum_envelopes ; i++ ) { - Shm_Envelopes[ i ].index = Shm_Convert(i); - Shm_Free_envelope( &Shm_Envelopes[ i ] ); - } - - /* - * Initialize this node's interrupt information in the - * shared area so other nodes can interrupt us. - */ - - Shm_Local_node_status->int_address = (rtems_unsigned32) interrupt_address; - Shm_Local_node_status->int_value = interrupt_value; - Shm_Local_node_status->int_length = interrupt_cause; - - Shm_Local_node_status->status = Shm_Initialization_complete; - - /* - * Loop until all nodes have completed initialization. - */ - - do { - all_initialized = 1; - - for ( i = SHM_FIRST_NODE ; i <= Shm_Maximum_nodes ; i++ ) - if ( Shm_Node_statuses[ i ].status != Shm_Initialization_complete ) - all_initialized = 0; - - } while ( all_initialized == 0 ); - - /* - * Tell the other nodes we think that the system is up. - */ - - for ( i = SHM_FIRST_NODE ; i <= Shm_Maximum_nodes ; i++ ) - Shm_Node_statuses[ i ].status = Shm_Active_node; - - } else { /* is not MASTER node */ - - /* - * Initialize the node status for the non-master nodes. - * Because the master node zeroes out memory, it is - * necessary for them to keep putting their values in - * the node status area until the master says they - * should become active. - */ - - Shm_Local_node_status->status = Shm_Pending_initialization; - - do { - - if ( Shm_Local_node_status->status == Shm_Pending_initialization ) { - - /* - * Initialize this node's interrupt information in the - * shared area so other nodes can interrupt us. - */ - - Shm_Local_node_status->int_address = - (rtems_unsigned32) interrupt_address; - Shm_Local_node_status->int_value = interrupt_value; - Shm_Local_node_status->int_length = interrupt_cause; - - Shm_Local_node_status->status = Shm_Initialization_complete; - } - } while ( Shm_Local_node_status->status != Shm_Active_node ) ; - } - - /* - * Initialize the Interrupt Information Table - */ - - for ( i = SHM_FIRST_NODE ; i <= Shm_Maximum_nodes ; i++ ) { - nscb = &Shm_Node_statuses[ i ]; - - Shm_Interrupt_table[i].address = Shm_Convert_address( - (void *)Shm_Convert(((vol_u32) nscb->int_address)) - ); - Shm_Interrupt_table[i].value = Shm_Convert( nscb->int_value ); - Shm_Interrupt_table[i].length = Shm_Convert( nscb->int_length ); - } - - MPCI_Shm_extensions.fatal = MPCI_Fatal; - - (void) rtems_extension_create( - rtems_build_name( 'M', 'P', 'E', 'X' ), - &MPCI_Shm_extensions, - &extension_id - ); -} diff --git a/c/src/libchip/shmdr/initlq.c b/c/src/libchip/shmdr/initlq.c deleted file mode 100644 index f876d4b43d..0000000000 --- a/c/src/libchip/shmdr/initlq.c +++ /dev/null @@ -1,35 +0,0 @@ -/* void Shm_Locked_queue_Initialize( lq_cb, owner ) - * - * This routine initializes a shared memory locked queue. - * - * Input parameters: - * lq_cb - pointer to the control block of the queue - * to be initialized - * owner - unique idenitifier of who owns this queue. - * - * Output parameters: 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$ - */ - -#include <rtems.h> -#include "shm.h" - -void Shm_Locked_queue_Initialize( - Shm_Locked_queue_Control *lq_cb, - rtems_unsigned32 owner -) -{ - Shm_Initialize_lock( lq_cb ); - lq_cb->front = Shm_Locked_queue_End_of_list; - lq_cb->rear = Shm_Locked_queue_End_of_list; - lq_cb->owner = Shm_Convert(owner); -} diff --git a/c/src/libchip/shmdr/intr.c b/c/src/libchip/shmdr/intr.c deleted file mode 100644 index 1483cd3afe..0000000000 --- a/c/src/libchip/shmdr/intr.c +++ /dev/null @@ -1,58 +0,0 @@ -/* void Shm_Cause_interrupt( node ) - * - * This routine is the shared memory driver routine which - * generates interrupts to other CPUs. - * - * It uses the information placed in the node status control - * block by each node. For example, when used with the Motorola - * MVME136 board, the MPCSR is used. - * - * Input parameters: - * node - destination of this packet (0 = broadcast) - * - * Output parameters: 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$ - */ - -#include <rtems.h> -#include "shm.h" - -void Shm_Cause_interrupt( - rtems_unsigned32 node -) -{ - Shm_Interrupt_information *intr; - rtems_unsigned8 *u8; - rtems_unsigned16 *u16; - rtems_unsigned32 *u32; - rtems_unsigned32 value; - - intr = &Shm_Interrupt_table[node]; - value = intr->value; - - switch ( intr->length ) { - case NO_INTERRUPT: - break; - case BYTE: - u8 = (rtems_unsigned8 *)intr->address; - *u8 = (rtems_unsigned8) value; - break; - case WORD: - u16 = (rtems_unsigned16 *)intr->address; - *u16 = (rtems_unsigned16) value; - break; - case LONG: - u32 = (rtems_unsigned32 *)intr->address; - *u32 = (rtems_unsigned32) value; - break; - } -} diff --git a/c/src/libchip/shmdr/mpci.h b/c/src/libchip/shmdr/mpci.h deleted file mode 100644 index 5e08cc4ec4..0000000000 --- a/c/src/libchip/shmdr/mpci.h +++ /dev/null @@ -1,59 +0,0 @@ -/* mpci.h - * - * This include file contains all the renaming necessary to - * have an application use the Shared Memory Driver as its - * sole mechanism for MPCI. - * - * 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_MPCI_h -#define __SHM_MPCI_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include <shm.h> - -#define MPCI_Initialization( _configuration ) \ - Shm_Initialization( _configuration ) - -#define MPCI_Get_packet( _the_packet ) \ - Shm_Get_packet( _the_packet ) - -#define MPCI_Return_packet( _the_packet ) \ - Shm_Return_packet( _the_packet ) - -#define MPCI_Receive_packet( _the_packet ) \ - Shm_Receive_packet( _the_packet ) - -#define MPCI_Send_packet( _destination, _the_packet ) \ - Shm_Send_packet( _destination, _the_packet ) - -/* Unnecessary... mapped in shm.h -#define MPCI_Fatal( _the_error ) \ - Shm_Fatal( _the_error ) -*/ - -#define MPCI_Enable_statistics() - -#define MPCI_Print_statistics() \ - Shm_Print_statistics() - -/* no need to rename the MPCI_Table either */ - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/c/src/libchip/shmdr/mpisr.c b/c/src/libchip/shmdr/mpisr.c deleted file mode 100644 index 573a4ebd21..0000000000 --- a/c/src/libchip/shmdr/mpisr.c +++ /dev/null @@ -1,23 +0,0 @@ -/* _Shm_isr() - * - * 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 "shm.h" - -rtems_isr Shm_isr( - rtems_vector_number vector -) -{ - Shm_Interrupt_count += 1; - rtems_multiprocessing_announce(); -} diff --git a/c/src/libchip/shmdr/poll.c b/c/src/libchip/shmdr/poll.c deleted file mode 100644 index 22dc116435..0000000000 --- a/c/src/libchip/shmdr/poll.c +++ /dev/null @@ -1,53 +0,0 @@ -/* void Shm_Poll() - * - * This routine polls to see if a packet has arrived. If one - * has it informs the executive. It is typically called from - * the clock tick interrupt service routine. - * - * Input parameters: NONE - * - * Output parameters: 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$ - */ - -#include <rtems.h> -#include <rtems/score/sysstate.h> -#include <rtems/libio.h> - -#include "shm.h" - -void Shm_Poll() -{ - rtems_unsigned32 tmpfront; - rtems_libio_ioctl_args_t args; - - /* invoke clock isr */ - args.iop = 0; - args.command = rtems_build_name('I', 'S', 'R', ' '); - (void) rtems_io_control(rtems_clock_major, rtems_clock_minor, &args); - - /* - * Check for msgs only if we are "up" - * This avoids a race condition where we may get a clock - * interrupt before MPCI has completed its init - */ - - if (_System_state_Is_up(_System_state_Get())) - { - tmpfront = Shm_Local_receive_queue->front; - if ( Shm_Convert(tmpfront) != Shm_Locked_queue_End_of_list ) - { - rtems_multiprocessing_announce(); - Shm_Interrupt_count++; - } - } -} diff --git a/c/src/libchip/shmdr/receive.c b/c/src/libchip/shmdr/receive.c deleted file mode 100644 index 98fd23b29d..0000000000 --- a/c/src/libchip/shmdr/receive.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Shm_Receive_packet - * - * This routine is the shared memory locked queue MPCI driver routine - * used to obtain a packet containing a message from this node's - * receive queue. - * - * Input parameters: - * packet - address of a pointer to a packet - * - * Output parameters: - * *(rpb->packet) - pointer to packet - * NULL if no packet currently available - * - * 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 "shm.h" - -rtems_mpci_entry Shm_Receive_packet( - rtems_packet_prefix **packet -) -{ - Shm_Envelope_control *ecb; - - ecb = Shm_Locked_queue_Get( Shm_Local_receive_queue ); - if ( ecb ) { - *(packet) = Shm_Envelope_control_to_packet_prefix_pointer( ecb ); - if ( ecb->Preamble.endian != Shm_Configuration->format ) - Shm_Convert_packet( *packet ); - Shm_Receive_message_count++; - } else { - *(packet) = NULL; - Shm_Null_message_count++; - } -} diff --git a/c/src/libchip/shmdr/retpkt.c b/c/src/libchip/shmdr/retpkt.c deleted file mode 100644 index d14b6e26e1..0000000000 --- a/c/src/libchip/shmdr/retpkt.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Shm_Return_packet - * - * This routine is the shared memory locked queue MPCI driver - * routine used to return a message packet to a free envelope - * pool accessible by this node. - * - * Input parameters: - * packet - address of pointer to packet - * - * Output parameters: 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$ - */ - -#include <rtems.h> -#include "shm.h" - -rtems_mpci_entry Shm_Return_packet( - rtems_packet_prefix *packet -) -{ - Shm_Free_envelope( Shm_Packet_prefix_to_envelope_control_pointer(packet) ); -} - diff --git a/c/src/libchip/shmdr/send.c b/c/src/libchip/shmdr/send.c deleted file mode 100644 index f26445cb42..0000000000 --- a/c/src/libchip/shmdr/send.c +++ /dev/null @@ -1,61 +0,0 @@ -/* Shm_Send_packet - * - * This routine is the shared memory driver locked queue write - * MPCI driver routine. This routine sends the specified packet - * to the destination specified by "node". A "node" value of - * zero designates that this packet is to be broadcasted. - * - * Input parameters: - * node - destination of this packet (0 = broadcast) - * packet - address of packet - * - * Output parameters: 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$ - */ - -#include <rtems.h> -#include "shm.h" - -struct pkt_cpy { - rtems_unsigned32 packet[MAX_PACKET_SIZE/4]; -}; - -rtems_mpci_entry Shm_Send_packet( - rtems_unsigned32 node, - rtems_packet_prefix *packet -) -{ - Shm_Envelope_control *ecb, *tmp_ecb; - rtems_unsigned32 nnum; - - ecb = Shm_Packet_prefix_to_envelope_control_pointer( packet ); - if ( node ) { - Shm_Build_preamble( ecb, node ); - Shm_Build_postamble( ecb ); - Shm_Append_to_receive_queue( node, ecb ); - (*Shm_Configuration->cause_intr)( node ); - } - else { - for( nnum = SHM_FIRST_NODE ; nnum <= Shm_Maximum_nodes ; nnum++ ) - if ( Shm_Local_node != nnum ) { - tmp_ecb = Shm_Allocate_envelope(); - if ( !tmp_ecb ) - rtems_fatal_error_occurred( SHM_NO_FREE_PKTS ); - Shm_Build_preamble( tmp_ecb, nnum ); - *((struct pkt_cpy *)tmp_ecb->packet) = *((struct pkt_cpy *)packet); - Shm_Build_postamble( tmp_ecb ); - Shm_Append_to_receive_queue( nnum, tmp_ecb ); - (*Shm_Configuration->cause_intr)( nnum ); - } - Shm_Free_envelope( ecb ); - } -} diff --git a/c/src/libchip/shmdr/setckvec.c b/c/src/libchip/shmdr/setckvec.c deleted file mode 100644 index 1e56e5737b..0000000000 --- a/c/src/libchip/shmdr/setckvec.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Shm_setclockvec - * - * This routines installs the shared memory clock interrupt handler - * used when the driver is used in polling mode. - * - * INPUT PARAMETERS: NONE - * - * OUTPUT PARAMETERS: 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$ - */ - -#include <rtems.h> -#include <rtems/libio.h> - -#include "shm.h" - -rtems_isr Shm_setclockvec() -{ - rtems_libio_ioctl_args_t args; - args.iop = 0; - args.command = rtems_build_name('N', 'E', 'W', ' '); - args.buffer = (void *) Shm_Poll; - - (void) rtems_io_control(rtems_clock_major, rtems_clock_minor, &args); -} diff --git a/c/src/libchip/shmdr/shm_driver.h b/c/src/libchip/shmdr/shm_driver.h deleted file mode 100644 index 8875525983..0000000000 --- a/c/src/libchip/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 */ |