2004-01-28 Ralf Corsepius <corsepiu@faw.uni-ulm.de>

PR 563/bsps
	* consolex/consolex.c, consolex/consolex.h, consolex/cTest.c,
	consolex/Makefile.am, consolex/README:
	Remove (Abandoned).
This commit is contained in:
Ralf Corsepius
2004-01-28 02:43:14 +00:00
parent 964c8322e4
commit 3da271f601
7 changed files with 7 additions and 1108 deletions
+7
View File
@@ -1,3 +1,10 @@
2004-01-28 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
PR 563/bsps
* consolex/consolex.c, consolex/consolex.h, consolex/cTest.c,
consolex/Makefile.am, consolex/README:
Remove (Abandoned).
2004-01-21 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* Makefile.am: Add PREINSTALL_DIRS.
@@ -1,2 +0,0 @@
Makefile
Makefile.in
@@ -1,45 +0,0 @@
##
## $Id$
##
PGM = $(ARCH)/consolex.rel
C_FILES = consolex.c
C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.$(OBJEXT))
include_HEADERS = consolex.h
OBJS = $(C_O_FILES)
include $(top_srcdir)/../../../../automake/compile.am
include $(top_srcdir)/../../../../automake/lib.am
#
# (OPTIONAL) Add local stuff here using +=
#
$(PGM): $(OBJS)
$(make-rel)
all-local: $(OBJS) $(PGM) $(TMPINSTALL_FILES)
.PRECIOUS: $(PGM)
EXTRA_DIST = README cTest.c consolex.c consolex.h
PREINSTALL_DIRS =
PREINSTALL_FILES =
$(PROJECT_INCLUDE)/$(dirstamp):
@$(mkdir_p) $(PROJECT_INCLUDE)
@: > $(PROJECT_INCLUDE)/$(dirstamp)
PREINSTALL_DIRS += $(PROJECT_INCLUDE)/$(dirstamp)
$(PROJECT_INCLUDE)/consolex.h: consolex.h $(PROJECT_INCLUDE)/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/consolex.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/consolex.h
CLEANFILES = $(PREINSTALL_FILES)
DISTCLEANFILES = $(PREINSTALL_DIRS)
include $(top_srcdir)/../../../../automake/local.am
@@ -1,97 +0,0 @@
#
# $Id$
#
This driver was submitted by Katsutoshi Shibuya <shibuya@mxb.meshnet.or.jp>.
Configuration
-------------
The application can choose this driver by using "CONSOLEX_DRIVER_TABLE_ENTRY"
in the driver table definition, in place of "CONSOLE_DRIVER_TABLE_ENTRY".
See consolex/cTest.c for an example and consolex/README for more information.
Programmatic Usage
------------------
- You can open 9 devices; console tty00, tty01, tty02, tty03,
rtty00, rtty01, rtty02, rtty03
tty00, rtty00 and console correspond to port#1 of MVME162LX,
tty01 and rtty01 correspond to port#2, and so on.
- tty0x are "cooked" devices. They support following flags on termios
definition;
ISTRIP, INLCR, IGNCR, ICRNL, IUCLC, OLCUC, ONLCR, OCRNL, ICANON, ECHO,
CBAUD, B38400, B19200, B9600, CSIZE, CS8, CS7, PARENB, PARODD, CSTOPB,
- rtty0x are "raw" devices. They support following flags on termios
definition;
CBAUD, B38400, B19200, B9600, CSIZE, CS8, CS7, PARENB, PARODD, CSTOPB,
- The default parameter is;
B38400, CS8, ICRNL, ONLCR, ICANON, ECHO
(but all flags except B38400 and CS8 will be ignored on raw device.)
- All devices support O_NDELAY (non blocking read/write) mode operation.
(Non-blocking cooked mode output is valid, but will not work fine.)
(Non-blocking cooked mode input with ECHO flag may be blocked while sending
echoed character.)
- All devices support hardware flow control by CTS/RTS.
(There is no way to disable it. There are no supports for soft flow control.)
- The application can use tcgetattr or ioctl to obtain the parameters of the
device into struct termios.
- The application can use tcsetattr or ioctl to set the parameters of the
device within the struct temios. The action argument (2nd arg) of the
tcsetattr must be TCSANOW.
- On opening the device, the driver activate DTR line. On closing the device,
the driver deactivate DTR line.
If 2 or more device opening occures at the same time on the same port, only
the first open procedure activates DTR line, and only the last close
procedure deactivate it.
- There are no device locking mechanisms. Application can open same device
several times.
But 2 simultanious reading operation on the same port will cause unexpected
result.
Porting Notes
-------------
- This code can be used for any Zilog SCC based board.
Change the time constant parameters and SCC register base addresses.
- This code is well separated into "device depended part" and "device
independed part".
They can use device independed part for any other board. The device
independed part requires following functions;
void SCCInitialize();
Initialize hardware.
rtems_boolean SCCGetOne(int port, char *ch);
Get one character from port. If no character is in the receiver buffer,
this function returns FALSE, otherwise TRUE.
char SCCGetOneBlocked(int port);
Get one character from port. If no character is in the receiver buffer,
wait it passing the CPU to the other task.
rtems_boolean SCCSendOne(int port, char ch);
Send one character via port. If the transmitter is not ready, this function
returns FALSE, otherwise TRUE.
void SCCSendOneBlocked(int port, char ch);
Send one character via port. Wait until the transmitter is ready, passing
the CPU to the other task.
unsigned32 SCCSetAttributes(int port, struct termios *tm);
Set device attribute according to the information in the struct termios.
c_cflags parameter (baud, parity, stopbits and code size) will be checked.
On the successful completion, this function should return 0.
unsigned32 SCCGetAttributes(int port, struct termios *tm);
Get device attribute according into the struct termios.
c_cflags parameter (baud, parity, stopbits and code size) will be set.
On the successful completion, this function should return 0.
void SCCSetDTR(port);
Activate DTR line.
void SCCResetDTR(port);
Deactivate DTR line.
void SCCSetRTS(port);
Activate RTS line.
void SCCResetRTS(port);
Deactivate RTS line.
int SCCGetCTS(port);
Return non zero when CTS line is activated.
- If you don't want console port, undefine "CONSOLEPORT".
- This code does not use ESCC feature; i.e. does not read register #4/#5/#14
@@ -1,74 +0,0 @@
/*
* Test program for consolex.
*
* NOTE: This program must be put together as an executable. :)
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include <rtems.h>
#include <rtems/libio.h>
#include <consolex.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <termios.h>
#if ! defined(O_NDELAY)
# if defined(solaris2)
# define O_NDELAY O_NONBLOCK
# elif defined(RTEMS_NEWLIB)
# define O_NDELAY _FNBIO
# endif
#endif
rtems_driver_address_table Device_drivers[] = {
CONSOLEX_DRIVER_TABLE_ENTRY
};
rtems_task Init(rtems_task_argument arg)
{
char buf[128];
int fd;
struct termios t;
printf("Console test.\n");
if((fd = open("/dev/tty00",O_RDWR)) < 0){
printf("Can't open device.\n");
return;
}
tcgetattr(fd,&t);
t.c_cflag = B9600|CS8;
tcsetattr(fd,TCSANOW,&t);
printf("iflag=%07o, oflag=%07o, cflag=%07o, lflag=%07o\n",
t.c_iflag,t.c_oflag,t.c_cflag,t.c_lflag);
do{
write(fd,"Your name? ",11);
read(fd,buf,sizeof(buf));
write(fd,"Hi ",3);
write(fd,buf,strlen(buf));
}while(*buf != '!');
close(fd);
printf("Done.\n");
exit(0);
}
#define CONFIGURE_INIT
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE
#include <confdefs.h>
File diff suppressed because it is too large Load Diff
@@ -1,93 +0,0 @@
/* consolex.h
*
* This file describes the Extended Console Device Driver
* This driver provides support for the standard C Library.
*
* This file was created originally by
* On-Line Applications Research Corporation (OAR)
* and modified by:
*
* Katsutoshi Shibuya - BU-Denken Co.,Ltd. - Sapporo, JAPAN
*
* featuring support of:
*
* - Multi-SCC chip handling
* - Non-blocking I/O (O_NDELAY flag in libc)
* - Raw mode device (no CR/LF detection)
* - RTS/CTS flow control
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#ifndef _CONSOLEX_DRIVER_h
#define _CONSOLEX_DRIVER_h
#include <rtems.h>
#include <termios.h>
#ifdef __cplusplus
extern "C" {
#endif
#define CONSOLEX_DRIVER_TABLE_ENTRY \
{ consolex_initialize, consolex_open, consolex_close, \
consolex_read, consolex_write, consolex_control }
rtems_device_driver consolex_initialize(
rtems_device_major_number,
rtems_device_minor_number,
void *
);
rtems_device_driver consolex_open(
rtems_device_major_number,
rtems_device_minor_number,
void *
);
rtems_device_driver consolex_close(
rtems_device_major_number,
rtems_device_minor_number,
void *
);
rtems_device_driver consolex_read(
rtems_device_major_number,
rtems_device_minor_number,
void *
);
rtems_device_driver consolex_write(
rtems_device_major_number,
rtems_device_minor_number,
void *
);
rtems_device_driver consolex_control(
rtems_device_major_number,
rtems_device_minor_number,
void *
);
/* Low level IO functions */
void SCCInitialize();
rtems_boolean SCCGetOne(int port, char *ch);
char SCCGetOneBlocked(int port);
rtems_boolean SCCSendOne(int port, char ch);
void SCCSendOneBlocked(int port, char ch);
unsigned32 SCCSetAttributes(int port, struct termios *t);
unsigned32 SCCGetAttributes(int port, struct termios *t);
#ifdef __cplusplus
}
#endif
#endif
/* end of include file */