]> rtime.felk.cvut.cz Git - sysless.git/commitdiff
cmdprocio library moved here from sysless-common repository.
authorMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 26 Mar 2008 17:03:39 +0000 (18:03 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 26 Mar 2008 17:03:39 +0000 (18:03 +0100)
The implementation is specific to h8s/263x processor and it has no sense
to compile it for other architectures.

arch/h8300/generic/libs/Makefile.omk
arch/h8300/generic/libs/cmdprocio/Makefile [new file with mode: 0644]
arch/h8300/generic/libs/cmdprocio/Makefile.omk [new file with mode: 0644]
arch/h8300/generic/libs/cmdprocio/cmdio_bth.c [new file with mode: 0644]
arch/h8300/generic/libs/cmdprocio/cmdio_bth_line.c [new file with mode: 0644]
arch/h8300/generic/libs/cmdprocio/cmdio_rs232.c [new file with mode: 0644]
arch/h8300/generic/libs/cmdprocio/cmdio_rs232_line.c [new file with mode: 0644]

index 5f6caa85a03bfe015484a565ae490cce2fe06183..a309598fc4dad866425acd4cdf01ec55a1681c32 100644 (file)
@@ -1,3 +1,3 @@
 # -*- makefile -*-
 
-SUBDIRS = boot misc
+SUBDIRS = boot misc cmdprocio
diff --git a/arch/h8300/generic/libs/cmdprocio/Makefile b/arch/h8300/generic/libs/cmdprocio/Makefile
new file mode 100644 (file)
index 0000000..f595272
--- /dev/null
@@ -0,0 +1,14 @@
+# Generic directory or leaf node makefile for OCERA make framework
+
+ifndef MAKERULES_DIR
+MAKERULES_DIR := $(shell ( old_pwd="" ;  while [ ! -e Makefile.rules ] ; do if [ "$$old_pwd" == `pwd`  ] ; then exit 1 ; else old_pwd=`pwd` ; cd -L .. 2>/dev/null ; fi ; done ; pwd ) )
+endif
+
+ifeq ($(MAKERULES_DIR),)
+all : default
+.DEFAULT::
+       @echo -e "\nThe Makefile.rules has not been found in this or partent directory\n"
+else   
+include $(MAKERULES_DIR)/Makefile.rules
+endif
+
diff --git a/arch/h8300/generic/libs/cmdprocio/Makefile.omk b/arch/h8300/generic/libs/cmdprocio/Makefile.omk
new file mode 100644 (file)
index 0000000..3868f55
--- /dev/null
@@ -0,0 +1,7 @@
+lib_LIBRARIES = cmdprocio
+
+cmdprocio_SOURCES += cmdio_rs232.c cmdio_rs232_line.c
+
+ifeq ($(CONFIG_BLUETOOTH),y)
+cmdprocio_SOURCES += cmdio_bth.c cmdio_bth_line.c
+endif
diff --git a/arch/h8300/generic/libs/cmdprocio/cmdio_bth.c b/arch/h8300/generic/libs/cmdprocio/cmdio_bth.c
new file mode 100644 (file)
index 0000000..bd7bb3b
--- /dev/null
@@ -0,0 +1,70 @@
+/*******************************************************************
+  Components for embedded applications builded for
+  laboratory and medical instruments firmware  
+  cmd_bth.c - interconnection of text command processor
+                with RS-232 line
+  Copyright (C) 2001 by Pavel Pisa pisa@cmp.felk.cvut.cz
+            (C) 2002 by PiKRON Ltd. http://www.pikron.com
+
+ *******************************************************************/
+
+#include <cmd_proc.h>
+#include <bth_inface.h>
+
+#define ED_LINE_CHARS 80
+
+/* cmd_io_t cmd_io_bth_dev; */
+
+/* char ed_line_chars_bth_in[ED_LINE_CHARS+1]; */
+/* char ed_line_chars_bth_out[ED_LINE_CHARS+1]; */
+
+/* ed_line_buf_t ed_line_buf_bth_in={ */
+/*   flg:FL_ELB_ECHO, */
+/*   inbuf:0, */
+/*   alloc:sizeof(ed_line_chars_bth_in), */
+/*   maxlen:0, */
+/*   lastch:0, */
+/*   buf:ed_line_chars_bth_in */
+/* }; */
+
+/* ed_line_buf_t ed_line_buf_bth_out={ */
+/*   flg:FL_ELB_NOCRLF, */
+/*   inbuf:0, */
+/*   alloc:sizeof(ed_line_chars_bth_out), */
+/*   maxlen:0, */
+/*   lastch:0, */
+/*   buf:ed_line_chars_bth_out */
+/* }; */
+
+/* cmd_io_t cmd_io_bth={ */
+/*   putc:cmd_io_putc_ed_line, */
+/*   getc:NULL, */
+/*   write:cmd_io_write_bychar, */
+/*   read:NULL, */
+/*   priv:{ */
+/*     ed_line:{ */
+/*       in: &ed_line_buf_bth_in, */
+/*       out:&ed_line_buf_bth_out, */
+/*       io_stack:&cmd_io_bth_dev */
+/*     } */
+/*   } */
+/* }; */
+
+int cmd_io_putc_bth(struct cmd_io *cmd_io,int ch)
+{ 
+  return bth_inface_sendch(ch,0); //=0; //sci_bth_sendch(ch,IMPLIC_NUM_SERIAL_PORT);;
+}
+
+int cmd_io_getc_bth(struct cmd_io *cmd_io)
+{ 
+  return bth_inface_recch(0);//=-1; //sci_bth_recch(IMPLIC_NUM_SERIAL_PORT);
+}
+
+cmd_io_t cmd_io_bth={
+  putc:cmd_io_putc_bth,
+  getc:cmd_io_getc_bth,
+  write:cmd_io_write_bychar,
+  read:cmd_io_read_bychar
+};
diff --git a/arch/h8300/generic/libs/cmdprocio/cmdio_bth_line.c b/arch/h8300/generic/libs/cmdprocio/cmdio_bth_line.c
new file mode 100644 (file)
index 0000000..dd17e0e
--- /dev/null
@@ -0,0 +1,41 @@
+#include <cmd_proc.h>
+#include <string.h>
+
+#define ED_LINE_CHARS 80
+
+char ed_line_in_bth[ED_LINE_CHARS+1];
+char ed_line_out_bth[ED_LINE_CHARS+1];
+
+
+ed_line_buf_t ed_line_buf_in_bth={
+    flg:FL_ELB_ECHO,
+    inbuf:0,
+    alloc:sizeof(ed_line_in_bth),
+    maxlen:0,
+    lastch:0,
+    buf:ed_line_in_bth
+};
+
+ed_line_buf_t ed_line_buf_out_bth={
+    flg:FL_ELB_NOCRLF,
+    inbuf:0,
+    alloc:sizeof(ed_line_out_bth),
+    maxlen:0,
+    lastch:0,
+    buf:ed_line_out_bth
+};
+
+extern cmd_io_t cmd_io_bth;
+const cmd_io_t cmd_io_bth_line={
+    putc:cmd_io_line_putc,
+    getc:NULL,
+    write:cmd_io_write_bychar,
+    read:NULL,
+    priv:{
+        ed_line:{
+            in: &ed_line_buf_in_bth,
+            out:&ed_line_buf_out_bth,
+            io_stack:&cmd_io_bth
+        }
+    }
+};
diff --git a/arch/h8300/generic/libs/cmdprocio/cmdio_rs232.c b/arch/h8300/generic/libs/cmdprocio/cmdio_rs232.c
new file mode 100644 (file)
index 0000000..a1d284a
--- /dev/null
@@ -0,0 +1,38 @@
+/*******************************************************************
+  Components for embedded applications builded for
+  laboratory and medical instruments firmware  
+  cmd_rs232.c - interconnection of text command processor
+                with RS-232 line
+  Copyright (C) 2001 by Pavel Pisa pisa@cmp.felk.cvut.cz
+            (C) 2002 by PiKRON Ltd. http://www.pikron.com
+
+  This file can be used and copied according to next
+  license alternatives
+   - MPL - Mozilla Public License
+   - GPL - GNU Public License
+   - other license provided by project originators
+
+ *******************************************************************/
+
+#include <cmd_proc.h>
+#include <periph/sci_rs232.h>
+
+static int cmd_io_putc_rs232(struct cmd_io *cmd_io,int ch)
+{ 
+  return sci_rs232_sendch(ch, sci_rs232_chan_default);
+}
+
+static int cmd_io_getc_rs232(struct cmd_io *cmd_io)
+{ 
+  return sci_rs232_recch(sci_rs232_chan_default);
+}
+
+cmd_io_t cmd_io_rs232={
+  putc:cmd_io_putc_rs232,
+  getc:cmd_io_getc_rs232,
+  write:cmd_io_write_bychar,
+  read:cmd_io_read_bychar
+};
+
diff --git a/arch/h8300/generic/libs/cmdprocio/cmdio_rs232_line.c b/arch/h8300/generic/libs/cmdprocio/cmdio_rs232_line.c
new file mode 100644 (file)
index 0000000..c32cbc2
--- /dev/null
@@ -0,0 +1,41 @@
+#include <cmd_proc.h>
+#include <string.h>
+
+#define ED_LINE_CHARS 80
+
+char ed_line_in_rs232[ED_LINE_CHARS+1];
+char ed_line_out_rs232[ED_LINE_CHARS+1];
+
+
+ed_line_buf_t ed_line_buf_in_rs232={
+    flg:FL_ELB_ECHO,
+    inbuf:0,
+    alloc:sizeof(ed_line_in_rs232),
+    maxlen:0,
+    lastch:0,
+    buf:ed_line_in_rs232
+};
+
+ed_line_buf_t ed_line_buf_out_rs232={
+    flg:FL_ELB_NOCRLF,
+    inbuf:0,
+    alloc:sizeof(ed_line_out_rs232),
+    maxlen:0,
+    lastch:0,
+    buf:ed_line_out_rs232
+};
+
+extern cmd_io_t cmd_io_rs232;
+const cmd_io_t cmd_io_rs232_line={
+    putc:cmd_io_line_putc,
+    getc:NULL,
+    write:cmd_io_write_bychar,
+    read:NULL,
+    priv:{
+        ed_line:{
+            in: &ed_line_buf_in_rs232,
+            out:&ed_line_buf_out_rs232,
+            io_stack:&cmd_io_rs232
+        }
+    }
+};