# -*- makefile -*-
-SUBDIRS = boot misc
+SUBDIRS = boot misc cmdprocio
--- /dev/null
+# 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
+
--- /dev/null
+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
--- /dev/null
+/*******************************************************************
+ 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
+};
--- /dev/null
+#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
+ }
+ }
+};
--- /dev/null
+/*******************************************************************
+ 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
+};
+
--- /dev/null
+#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
+ }
+ }
+};