summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/unix
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1995-09-11 19:35:39 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1995-09-11 19:35:39 +0000
commit3a4ae6c210bcc37754767966f1128ae23c77b6af (patch)
tree8804983e5b92bec788d548df13db7513118d351d /c/src/lib/libbsp/unix
parentnew file -- split from inlines (diff)
downloadrtems-3a4ae6c210bcc37754767966f1128ae23c77b6af.tar.bz2
The word "RTEMS" almost completely removed from the core.
Configuration Table Template file added and all tests modified to use this. All gvar.h and conftbl.h files removed from test directories. Configuration parameter maximum_devices added. Core semaphore and mutex handlers added and RTEMS API Semaphore Manager updated to reflect this. Initialization sequence changed to invoke API specific initialization routines. Initialization tasks table now owned by RTEMS Tasks Manager. Added user extension for post-switch. Utilized user extensions to implement API specific functionality like signal dispatching. Added extensions to the System Initialization Thread so that an API can register a function to be invoked while the system is being initialized. These are largely equivalent to the pre-driver and post-driver hooks. Added the Modules file oar-go32_p5, modified oar-go32, and modified the file make/custom/go32.cfg to look at an environment varable which determines what CPU model is being used. All BSPs updated to reflect named devices and clock driver's IOCTL used by the Shared Memory Driver. Also merged clock isr into main file and removed ckisr.c where possible. Updated spsize to reflect new and moved variables. Makefiles for the executive source and include files updated to show break down of files into Core, RTEMS API, and Neither. Header and inline files installed into subdirectory based on whether logically in the Core or a part of the RTEMS API.
Diffstat (limited to 'c/src/lib/libbsp/unix')
-rw-r--r--c/src/lib/libbsp/unix/posix/console/console.c69
-rw-r--r--c/src/lib/libbsp/unix/posix/include/bsp.h19
-rw-r--r--c/src/lib/libbsp/unix/posix/startup/bspstart.c74
3 files changed, 139 insertions, 23 deletions
diff --git a/c/src/lib/libbsp/unix/posix/console/console.c b/c/src/lib/libbsp/unix/posix/console/console.c
index 07cb033958..61bbe08c78 100644
--- a/c/src/lib/libbsp/unix/posix/console/console.c
+++ b/c/src/lib/libbsp/unix/posix/console/console.c
@@ -3,6 +3,8 @@
*
* These provide UNIX-like read and write calls for the C library.
*
+ * NOTE: For the most part, this is just a space holder.
+ *
* COPYRIGHT (c) 1994 by Division Incorporated
*
* To anyone who acknowledges that this file is provided "AS IS"
@@ -31,6 +33,71 @@ console_initialize(rtems_device_major_number major,
void * arg
)
{
- return RTEMS_SUCCESSFUL;
+ return 0;
+}
+
+
+/*
+ * Open entry point
+ */
+
+rtems_device_driver console_open(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
}
+
+/*
+ * Close entry point
+ */
+
+rtems_device_driver console_close(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * read bytes from the serial port. We only have stdin.
+ */
+rtems_device_driver console_read(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_UNSATISFIED;
+}
+
+/*
+ * write bytes to the serial port. Stdout and stderr are the same.
+ */
+
+rtems_device_driver console_write(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return -1;
+}
+
+/*
+ * IO Control entry point
+ */
+
+rtems_device_driver console_control(
+ rtems_device_major_number major,
+ rtems_device_minor_number minor,
+ void * arg
+)
+{
+ return RTEMS_SUCCESSFUL;
+}
diff --git a/c/src/lib/libbsp/unix/posix/include/bsp.h b/c/src/lib/libbsp/unix/posix/include/bsp.h
index 3bf43ca0c8..6ebec41276 100644
--- a/c/src/lib/libbsp/unix/posix/include/bsp.h
+++ b/c/src/lib/libbsp/unix/posix/include/bsp.h
@@ -22,6 +22,7 @@ extern "C" {
#include <rtems.h>
#include <clockdrv.h>
+#include <console.h>
#include <iosupp.h>
#include <libcsupport.h>
#include <signal.h>
@@ -80,19 +81,23 @@ extern rtems_configuration_table BSP_Configuration;
/* #define INTERRUPT_EXTERNAL_MPCI SIGUSR1 */
/*
- * Console driver init
+ * Device Driver Table Entries
+ */
+
+/*
+ * NOTE: Use the standard Console driver entry
*/
-
-rtems_device_driver console_initialize(
- rtems_device_major_number, rtems_device_minor_number minor, void *);
-
-#define CONSOLE_DRIVER_TABLE_ENTRY \
- { console_initialize, NULL, NULL, NULL, NULL, NULL }
/*
* NOTE: Use the standard Clock driver entry
*/
+/*
+ * How many libio files we want
+ */
+
+#define BSP_LIBIO_MAX_FDS 20
+
/* functions */
rtems_isr_entry set_vector(rtems_isr_entry, rtems_vector_number, int);
diff --git a/c/src/lib/libbsp/unix/posix/startup/bspstart.c b/c/src/lib/libbsp/unix/posix/startup/bspstart.c
index d4279c5818..ed687f7319 100644
--- a/c/src/lib/libbsp/unix/posix/startup/bspstart.c
+++ b/c/src/lib/libbsp/unix/posix/startup/bspstart.c
@@ -37,6 +37,8 @@
#include <bsp.h>
#include <libcsupport.h>
+#include <rtems/libio.h>
+
#ifdef STACK_CHECKER_ON
#include <stackchk.h>
#endif
@@ -112,6 +114,14 @@ bsp_libc_init(void)
RTEMS_Malloc_Initialize((void *)heap_start, Heap_size, 1024 * 1024);
+ /*
+ * Init the RTEMS libio facility to provide UNIX-like system
+ * calls for use by newlib (ie: provide __open, __close, etc)
+ * Uses malloc() to get area for the iops, so must be after malloc init
+ */
+
+ rtems_libio_init();
+
libc_init(1);
}
@@ -162,6 +172,34 @@ bsp_pretasking_hook(void)
}
/*
+ * After drivers are setup, register some "filenames"
+ * and open stdin, stdout, stderr files
+ *
+ * Newlib will automatically associate the files with these
+ * (it hardcodes the numbers)
+ */
+
+void
+bsp_postdriver_hook(void)
+{
+#if 0
+ int stdin_fd, stdout_fd, stderr_fd;
+
+ if ((stdin_fd = __open("/dev/console", O_RDONLY, 0)) == -1)
+ rtems_fatal_error_occurred('STD0');
+
+ if ((stdout_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred('STD1');
+
+ if ((stderr_fd = __open("/dev/console", O_WRONLY, 0)) == -1)
+ rtems_fatal_error_occurred('STD2');
+
+ if ((stdin_fd != 0) || (stdout_fd != 1) || (stderr_fd != 2))
+ rtems_fatal_error_occurred('STIO');
+#endif
+}
+
+/*
* Function: bsp_start
* Created: 94/12/6
*
@@ -261,7 +299,7 @@ bsp_start(void)
Cpu_table.predriver_hook = NULL;
- Cpu_table.postdriver_hook = NULL;
+ Cpu_table.postdriver_hook = bsp_postdriver_hook;
Cpu_table.idle_task = NULL; /* do not override system IDLE task */
@@ -301,22 +339,28 @@ bsp_start(void)
BSP_Configuration.maximum_extensions++;
#endif
- /*
- * Add 1 extension for MPCI_fatal
- */
+ /*
+ * Tell libio how many fd's we want and allow it to tweak config
+ */
- if (BSP_Configuration.User_multiprocessing_table)
- BSP_Configuration.maximum_extensions++;
+ rtems_libio_config(&BSP_Configuration, BSP_LIBIO_MAX_FDS);
- CPU_CLICKS_PER_TICK = 1;
+ /*
+ * Add 1 extension for MPCI_fatal
+ */
- /*
- * Start most of RTEMS
- * main() will start the rest
- */
+ if (BSP_Configuration.User_multiprocessing_table)
+ BSP_Configuration.maximum_extensions++;
+
+ CPU_CLICKS_PER_TICK = 1;
+
+ /*
+ * Start most of RTEMS
+ * main() will start the rest
+ */
- bsp_isr_level = rtems_initialize_executive_early(
- &BSP_Configuration,
- &Cpu_table
- );
+ bsp_isr_level = rtems_initialize_executive_early(
+ &BSP_Configuration,
+ &Cpu_table
+ );
}