← Back to team overview

t-kernel team mailing list archive

[PATCH] ports-r4: add new dummy sio driver

 

From: Du Huanpeng <u74147@xxxxxxxxx>

replace sio driver with new dummy acd2 driver, the t-monitor
initial the sio in file `config.c'.

Signed-off-by: Du Huanpeng <u74147@xxxxxxxxx>
---
 tkernel_source/monitor/Makefile.obj                |  2 +-
 tkernel_source/monitor/Makefile.src                |  2 +-
 tkernel_source/monitor/driver/sio/sio-acd2.c       | 93 ++++++++++++++++++++++
 .../monitor/hwdepend/arm/mach-acd2/config.c        |  4 +-
 4 files changed, 97 insertions(+), 4 deletions(-)
 create mode 100644 tkernel_source/monitor/driver/sio/sio-acd2.c

diff --git a/tkernel_source/monitor/Makefile.obj b/tkernel_source/monitor/Makefile.obj
index edbd88b..1c7450f 100644
--- a/tkernel_source/monitor/Makefile.obj
+++ b/tkernel_source/monitor/Makefile.obj
@@ -29,7 +29,7 @@ OBJ += hwdepend/arm/cpu/disassemble.o
 OBJ += hwdepend/arm/misc.o
 OBJ += hwdepend/arm/cpu/step.o
 OBJ += cmdsvc/wrkbuf.o
-OBJ += driver/sio/ns16550.o
+OBJ += driver/sio/sio-acd2.o
 OBJ += driver/flash/main.o
 OBJ += driver/flash/setup-em1d.o
 OBJ += driver/flash/reset-em1d.o
diff --git a/tkernel_source/monitor/Makefile.src b/tkernel_source/monitor/Makefile.src
index 94e52d4..4dc0f87 100644
--- a/tkernel_source/monitor/Makefile.src
+++ b/tkernel_source/monitor/Makefile.src
@@ -29,7 +29,7 @@ SRC += hwdepend/arm/cpu/disassemble.c
 SRC += hwdepend/arm/misc.c
 SRC += hwdepend/arm/cpu/step.c
 SRC += cmdsvc/wrkbuf.c
-SRC += driver/sio/ns16550.c
+SRC += driver/sio/sio-acd2.c
 SRC += driver/flash/main.c
 SRC += driver/flash/setup-em1d.c
 SRC += driver/flash/reset-em1d.c
diff --git a/tkernel_source/monitor/driver/sio/sio-acd2.c b/tkernel_source/monitor/driver/sio/sio-acd2.c
new file mode 100644
index 0000000..1c8f600
--- /dev/null
+++ b/tkernel_source/monitor/driver/sio/sio-acd2.c
@@ -0,0 +1,93 @@
+/*
+ *----------------------------------------------------------------------
+ *    T-Kernel 2.0 Software Package
+ *
+ *    Copyright 2011 by Ken Sakamura.
+ *    This software is distributed under the latest version of T-License 2.x.
+ *----------------------------------------------------------------------
+ *
+ *    Released by T-Engine Forum(http://www.t-engine.org/) at 2011/05/17.
+ *    Modified by T-Engine Forum at 2013/02/28.
+ *    Modified by TRON Forum(http://www.tron.org/) at 2015/06/01.
+ *
+ *----------------------------------------------------------------------
+ *	Copyright (C) 2014, 2015, 2016 Du Huanpeng<u74147@xxxxxxxxx>
+ */
+
+/*
+ *	base on monitor/driver/sio/src/ns16550.c
+ *	sio-acd2.c
+ *
+ *       serial port I/O
+ */
+
+#include <tmonitor.h>
+#include <mach/em1d512.h>
+
+/*
+ * serial port hardware configuration definition
+ */
+typedef struct {
+	UW	iob;		/* I/O base address */
+} DEFSIO;
+
+LOCAL const DEFSIO	DefSIO[] = {
+	{ 0 },
+};
+
+/* ------------------------------------------------------------------------ */
+
+/*
+ * serial port I/O
+ */
+LOCAL void putSIO_acd2( SIOCB *scb, UB c )
+{
+	return;
+}
+
+/*
+ * serial port input
+ *       tmo     timeout (milliseconds)
+ *              You can not wait forever.
+ *       return value       >= 0 : character code
+ *                 -1 : timeout
+ *       input data using buffer.
+ *       receive error is ignored.
+ */
+LOCAL W getSIO_acd2(SIOCB *scb, W tmo )
+{
+	if(tmo) return -1;
+	else return 'S';
+}
+
+/* ------------------------------------------------------------------------ */
+
+/*
+ * initialize serial port
+ *       serial port that is supported by the initialization of CFGSIO
+ *       speed   communication speed (bps)
+ *       initialize the serial port according to the specified parameters and set SIOCB
+ *       SIOCB is given in 0-cleared state initially.
+ *       Subsequent I/O operations uses the SIOCB.
+ *
+ *       Only for PC/AT version
+ *      if speed = 0, we use the value in biosp->siomode.
+ *       But we use only the transmission speed and other settings are ignored.
+ *       Efforts were made to be compatible B-right/V, but because of the ignorance of no-speed settings such as data length and stop bit length,
+ *       we have reduced functionality.
+ */
+EXPORT ER initSIO_acd2(SIOCB *scb, const CFGSIO *csio, W speed)
+{
+
+	if ( csio->info>1 ) return E_PAR;
+
+        /* select the target port */
+	scb->info = DefSIO[csio->info].iob;
+
+
+        /* I/O function default */
+	scb->put = putSIO_acd2;
+	scb->get = getSIO_acd2;
+
+	return E_OK;
+}
diff --git a/tkernel_source/monitor/hwdepend/arm/mach-acd2/config.c b/tkernel_source/monitor/hwdepend/arm/mach-acd2/config.c
index 5b96651..9884000 100644
--- a/tkernel_source/monitor/hwdepend/arm/mach-acd2/config.c
+++ b/tkernel_source/monitor/hwdepend/arm/mach-acd2/config.c
@@ -25,7 +25,7 @@
 #include <mach/em1d512.h>
 
 /* used device driver */
-IMPORT	ER	initSIO_ns16550(SIOCB *, const CFGSIO *, W speed);
+IMPORT	ER	initSIO_acd2(SIOCB *, const CFGSIO *, W speed);
 IMPORT	ER	initMemDisk(DISKCB *, const CFGDISK *);
 
 /* memory region definition */
@@ -66,7 +66,7 @@ EXPORT	W	N_NoMemSeg = sizeof(NoMemSeg) / sizeof(MEMSEG);
  *       list in the order of port number
  */
 EXPORT	const	CFGSIO	ConfigSIO[] = {
-	{initSIO_ns16550, 0},
+	{initSIO_acd2, 0},
 };
 
 EXPORT	const W	N_ConfigSIO = sizeof(ConfigSIO) / sizeof(CFGSIO);
-- 
1.9.1




References