summaryrefslogtreecommitdiff
path: root/examples/readline
diff options
context:
space:
mode:
Diffstat (limited to 'examples/readline')
-rw-r--r--examples/readline/.gdbinit1
-rw-r--r--examples/readline/Makefile70
-rw-r--r--examples/readline/init.c51
-rw-r--r--examples/readline/rlgeneric.c30
4 files changed, 152 insertions, 0 deletions
diff --git a/examples/readline/.gdbinit b/examples/readline/.gdbinit
new file mode 100644
index 0000000..f198616
--- /dev/null
+++ b/examples/readline/.gdbinit
@@ -0,0 +1 @@
+directory ../../readline
diff --git a/examples/readline/Makefile b/examples/readline/Makefile
new file mode 100644
index 0000000..0b67968
--- /dev/null
+++ b/examples/readline/Makefile
@@ -0,0 +1,70 @@
+#
+# $Id$
+#
+# Templates/Makefile.leaf
+# Template leaf node Makefile
+#
+
+# C source names, if any, go here -- minus the .c
+C_PIECES= init rlgeneric
+C_FILES=$(C_PIECES:%=%.c)
+C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
+
+# C++ source names, if any, go here -- minus the .cc
+CC_PIECES=
+CC_FILES=$(CC_PIECES:%=%.cc)
+CC_O_FILES=$(CC_PIECES:%=${ARCH}/%.o)
+
+H_FILES=
+
+# Assembly source names, if any, go here -- minus the .s
+S_PIECES=
+S_FILES=$(S_PIECES:%=%.s)
+S_O_FILES=$(S_FILES:%.s=${ARCH}/%.o)
+
+SRCS=$(C_FILES) $(CC_FILES) $(H_FILES) $(S_FILES)
+OBJS=$(C_O_FILES) $(CC_O_FILES) $(S_O_FILES)
+
+PGMS=${ARCH}/rlchk
+
+#
+# RTEMS managers go here
+#
+MANAGERS=io event message semaphore
+
+include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
+include $(RTEMS_CUSTOM)
+include $(PROJECT_ROOT)/make/leaf.cfg
+
+#
+# (OPTIONAL) Add local stuff here using +=
+#
+
+DEFINES +=
+CPPFLAGS += -Dmain=rlchk
+CFLAGS +=
+
+LD_PATHS +=
+LD_LIBS += -lreadline -lncurses
+CFLAGS_LD += -Wl,--defsym -Wl,HeapSize=0x200000 # network needs more space
+CFLAGS_DEBUG_V += -DSTACK_CHECKER_ON
+
+#
+# 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 +=
+CLOBBER_ADDITIONS +=
+
+all: ${ARCH} $(SRCS) $(PGMS)
+
+${ARCH}/rlchk: ${OBJS} ${LINK_FILES}
+ $(make-exe)
+
+# Install the program(s), appending _g or _p as appropriate.
+# for include files, just use $(INSTALL)
+install: all
+ $(INSTALL_VARIANT) -m 555 ${PGMS} /usr/local/tftpboot/bootfiles/m68360/
diff --git a/examples/readline/init.c b/examples/readline/init.c
new file mode 100644
index 0000000..1336cfe
--- /dev/null
+++ b/examples/readline/init.c
@@ -0,0 +1,51 @@
+/*
+ * Root task
+ *
+ * $Revision$ $Date$ $Author$
+ */
+#include <bsp.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/*
+ ***********************************************************************
+ * RTEMS CONFIGURATION *
+ ***********************************************************************
+ */
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_MAXIMUM_TASKS 20
+#define CONFIGURE_MAXIMUM_SEMAPHORES 10
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 10
+
+#define CONFIGURE_MICROSECONDS_PER_TICK 52489
+
+#define CONFIGURE_INIT
+#define CONFIGURE_INIT_TASK_INITIAL_MODES (RTEMS_PREEMPT | \
+ RTEMS_NO_TIMESLICE | \
+ RTEMS_NO_ASR | \
+ RTEMS_INTERRUPT_LEVEL(0))
+#define CONFIGURE_INIT_TASK_STACK_SIZE (10*1024)
+#define CONFIGURE_INIT_TASK_PRIORITY 100
+rtems_task Init (rtems_task_argument argument);
+
+#define CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE
+rtems_driver_address_table Device_drivers[] = {
+ CONSOLE_DRIVER_TABLE_ENTRY,
+ CLOCK_DRIVER_TABLE_ENTRY,
+};
+
+#include <confdefs.h>
+
+extern int main (int argc, char **argv);
+
+/*
+ * RTEMS Startup Task
+ */
+rtems_task
+Init (rtems_task_argument ignored)
+{
+ putenv ("TERM=xterm");
+ main (0, NULL);
+ rtems_task_suspend (RTEMS_SELF);
+}
diff --git a/examples/readline/rlgeneric.c b/examples/readline/rlgeneric.c
new file mode 100644
index 0000000..2bb5da4
--- /dev/null
+++ b/examples/readline/rlgeneric.c
@@ -0,0 +1,30 @@
+/*
+ * Host version of readline test program.
+ * Works as RTEMS version when included in rlchk.c
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <malloc.h>
+#include <readline/readline.h>
+#include <readline/history.h>
+
+int
+main (int argc, char **argv)
+{
+ char *line;
+
+ rl_bind_key ('\t', rl_insert);
+ stifle_history (10);
+ for (;;) {
+ line = readline ("Enter a line: ");
+ if (line && *line)
+ add_history (line);
+ printf ("Line: `%s'\n", line);
+ if (line && !strcmp (line, "dump")) {
+ rl_dump_variables (0,0);
+ rl_dump_functions (0,0);
+ }
+ free (line);
+ }
+ return 0;
+}