From b06e68ef1f6df69cc86d72356c3a002054a35fad Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 17 Aug 1995 19:51:51 +0000 Subject: Numerous miscellaneous features incorporated from Tony Bennett (tbennett@divnc.com) including the following major additions: + variable length messages + named devices + debug monitor + association tables/variables --- c/src/exec/libcsupport/include/clockdrv.h | 31 ++++---- c/src/exec/libcsupport/include/rtems/assoc.h | 44 ++++++++++++ c/src/exec/libcsupport/include/rtems/error.h | 26 +++++++ c/src/exec/libcsupport/include/rtems/libio.h | 101 +++++++++++++++++++++++++++ 4 files changed, 183 insertions(+), 19 deletions(-) create mode 100644 c/src/exec/libcsupport/include/rtems/assoc.h create mode 100644 c/src/exec/libcsupport/include/rtems/error.h create mode 100644 c/src/exec/libcsupport/include/rtems/libio.h (limited to 'c/src/exec/libcsupport/include') diff --git a/c/src/exec/libcsupport/include/clockdrv.h b/c/src/exec/libcsupport/include/clockdrv.h index aad9bd6d3b..258c590e0d 100644 --- a/c/src/exec/libcsupport/include/clockdrv.h +++ b/c/src/exec/libcsupport/include/clockdrv.h @@ -23,31 +23,24 @@ extern "C" { /* variables */ extern volatile rtems_unsigned32 Clock_driver_ticks; +extern rtems_device_major_number rtems_clock_major; +extern rtems_device_minor_number rtems_clock_minor; -/* functions */ - -rtems_task Exit_task(); -void exit_task_init(); - -void Install_clock( rtems_isr_entry ); -void ReInstall_clock( rtems_isr_entry ); -void Clock_exit(); - -rtems_isr Clock_isr( - rtems_vector_number -); - -/* driver entries */ +/* default clock driver entry */ #define CLOCK_DRIVER_TABLE_ENTRY \ - { Clock_initialize, NULL, NULL, NULL, NULL, NULL } - + { Clock_initialize, NULL, NULL, NULL, NULL, Clock_control } + rtems_device_driver Clock_initialize( rtems_device_major_number, rtems_device_minor_number, - void *, - rtems_id, - rtems_unsigned32 * + void * +); + +rtems_device_driver Clock_control( + rtems_device_major_number major, + rtems_device_minor_number minor, + void *pargp ); #ifdef __cplusplus diff --git a/c/src/exec/libcsupport/include/rtems/assoc.h b/c/src/exec/libcsupport/include/rtems/assoc.h new file mode 100644 index 0000000000..c820cfa973 --- /dev/null +++ b/c/src/exec/libcsupport/include/rtems/assoc.h @@ -0,0 +1,44 @@ +/* + * @(#)assoc.h 1.2 - 95/06/28 + * + * + * Rtems associativity routines. Mainly used to convert a value from + * one space to another (eg: our errno's to host errno's and v.v) + * + * + * $Id$ + */ + +#ifndef _INCLUDE_ASSOC_H +#define _INCLUDE_ASSOC_H + +typedef struct { + char *name; + unsigned32 local_value; + unsigned32 remote_value; +} rtems_assoc_t; + +/* + * Flag/marker for optional default value in each table + */ + +#define RTEMS_ASSOC_DEFAULT_NAME "(default)" + +rtems_assoc_t *rtems_assoc_ptr_by_name(rtems_assoc_t *, char *); +rtems_assoc_t *rtems_assoc_ptr_by_value(rtems_assoc_t *, unsigned32); +rtems_assoc_t *rtems_assoc_ptr_by_remote(rtems_assoc_t *, unsigned32); + +unsigned32 rtems_assoc_remote_by_local(rtems_assoc_t *, unsigned32); +unsigned32 rtems_assoc_local_by_remote(rtems_assoc_t *, unsigned32); +unsigned32 rtems_assoc_remote_by_name(rtems_assoc_t *, char *); +unsigned32 rtems_assoc_local_by_name(rtems_assoc_t *, char *); +char *rtems_assoc_name_by_local(rtems_assoc_t *, unsigned32); +char *rtems_assoc_name_by_remote(rtems_assoc_t *, unsigned32); + +unsigned32 rtems_assoc_remote_by_local_bitfield(rtems_assoc_t *, unsigned32); +char *rtems_assoc_name_by_local_bitfield(rtems_assoc_t *, unsigned32, char *); +char *rtems_assoc_name_by_remote_bitfield(rtems_assoc_t *, unsigned32, char *); +unsigned32 rtems_assoc_local_by_remote_bitfield(rtems_assoc_t *ap, unsigned32); + + +#endif /* ! _INCLUDE_ASSOC_H */ diff --git a/c/src/exec/libcsupport/include/rtems/error.h b/c/src/exec/libcsupport/include/rtems/error.h new file mode 100644 index 0000000000..a41f0aa534 --- /dev/null +++ b/c/src/exec/libcsupport/include/rtems/error.h @@ -0,0 +1,26 @@ +/* + * @(#)error.h 1.1 - 95/08/02 + * + * + * Defines and externs for rtems error reporting + * + * $Id$ + */ + +/* + * rtems_error() and rtems_panic() support + */ + +#define RTEMS_ERROR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */ +#define RTEMS_ERROR_PANIC (RTEMS_ERROR_ERRNO / 2) /* err fatal; no return */ +#define RTEMS_ERROR_ABORT (RTEMS_ERROR_ERRNO / 4) /* err is fatal; panic */ + +#define RTEMS_ERROR_MASK (RTEMS_ERROR_ERRNO | RTEMS_ERROR_ABORT | \ + RTEMS_ERROR_PANIC) /* all */ + +char *rtems_status_text(rtems_status_code); +int rtems_error(int error_code, char *printf_format, ...); +void rtems_panic(char *printf_format, ...); + +extern int rtems_panic_in_progress; + diff --git a/c/src/exec/libcsupport/include/rtems/libio.h b/c/src/exec/libcsupport/include/rtems/libio.h new file mode 100644 index 0000000000..f80a1954a3 --- /dev/null +++ b/c/src/exec/libcsupport/include/rtems/libio.h @@ -0,0 +1,101 @@ +/* + * @(#)libio.h 1.1 - 95/06/02 + * + * + * General purpose communication channel for RTEMS to allow UNIX/POSIX + * system call behavior on top of RTEMS IO devices. + * + * TODO + * stat(2) + * unlink(2) + * rename(2) + * + * $Id$ + */ + +#ifndef _RTEMS_LIBIO_H +#define _RTEMS_LIBIO_H + +typedef unsigned32 rtems_libio_offset_t; + +/* + * An open file data structure, indexed by 'fd' + * TODO: + * should really have a separate per/file data structure that this + * points to (eg: size, offset, driver, pathname should be in that) + */ + +typedef struct { + rtems_driver_name_t *driver; + rtems_libio_offset_t size; /* size of file */ + rtems_libio_offset_t offset; /* current offset into the file */ + unsigned32 flags; + char *pathname; /* opened pathname */ + Objects_Id sem; + unsigned32 data0; /* private to "driver" */ + unsigned32 data1; /* ... */ +} rtems_libio_t; + + +/* + * param block for read/write + * Note: it must include 'offset' instead of using iop's offset since + * we can have multiple outstanding i/o's on a device. + */ + +typedef struct { + rtems_libio_t *iop; + rtems_libio_offset_t offset; + unsigned8 *buffer; + unsigned32 count; + unsigned32 flags; + unsigned32 bytes_moved; +} rtems_libio_rw_args_t; + +/* + * param block for open/close + */ + +typedef struct { + rtems_libio_t *iop; + unsigned32 flags; + unsigned32 mode; +} rtems_libio_open_close_args_t; + +/* + * param block for ioctl + */ + +typedef struct { + rtems_libio_t *iop; + unsigned32 command; + void *buffer; + unsigned32 ioctl_return; +} rtems_libio_ioctl_args_t; + + +/* + * Values for 'flag' + */ + +#define LIBIO_FLAGS_NO_DELAY 0x0001 /* return immediately if no data */ +#define LIBIO_FLAGS_READ 0x0002 /* reading */ +#define LIBIO_FLAGS_WRITE 0x0004 /* writing */ +#define LIBIO_FLAGS_LINE_BUFFERED 0x0008 /* line buffered io (^h, ^u, etc) */ +#define LIBIO_FLAGS_OPEN 0x0100 /* device is open */ +#define LIBIO_FLAGS_APPEND 0x0200 /* all writes append */ +#define LIBIO_FLAGS_CREATE 0x0400 /* create file */ + +#define LIBIO_FLAGS_READ_WRITE (LIBIO_FLAGS_READ | LIBIO_FLAGS_WRITE) + +void rtems_libio_config(rtems_configuration_table *config, unsigned32 max_fds); +void rtems_libio_init(void); + +int __open(const char *pathname, unsigned32 flag, unsigned32 mode); +int __close(int fd); +int __read(int fd, void *buffer, unsigned32 count); +int __write(int fd, const void *buffer, unsigned32 count); +int __ioctl(int fd, unsigned32 command, void *buffer); +int __lseek(int fd, rtems_libio_offset_t offset, int whence); + +#endif /* _RTEMS_LIBIO_H */ -- cgit v1.2.3