diff options
Diffstat (limited to 'cpukit/libcsupport')
45 files changed, 0 insertions, 5571 deletions
diff --git a/cpukit/libcsupport/include/chain.h b/cpukit/libcsupport/include/chain.h deleted file mode 100644 index 98cf2b1a86..0000000000 --- a/cpukit/libcsupport/include/chain.h +++ /dev/null @@ -1,362 +0,0 @@ -/* chain.h - * - * This include file contains all the constants and structures associated - * with doubly linked chains. This file actually just provides an - * interface to the chain object in rtems. - * - * COPYRIGHT (c) 1989-1997. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may in - * the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $ld: - */ - -#ifndef __CHAIN_h -#define __CHAIN_h - -#include <rtems.h> - -/* - * Chain_Initialize - * - * This routine initializes the_chain structure to manage the - * contiguous array of number_nodes nodes which starts at - * starting_address. Each node is of node_size bytes. - * - * Chain_Control *the_chain, * IN * - * void *starting_address, * IN * - * rtems_unsigned32 number_nodes, * IN * - * rtems_unsigned32 node_size * IN * - */ - -#define Chain_Initialize( the_chain, starting_address, \ - number_nodes, node_size ) \ - _Chain_Initialize( the_chain, starting_address, \ - number_nodes, node_size ) \ - - -/* - * Chain_Initialize_empty - * - * This routine initializes the specified chain to contain zero nodes. - * - * Chain_Control *the_chain * IN * - */ - -#define Chain_Initialize_empty( the_chain ) \ - _Chain_Initialize_empty( the_chain ) - - -/* - * Chain_Are_nodes_equal - * - * This function returns TRUE if LEFT and RIGHT are equal, - * and FALSE otherwise. - * - * Chain_Node *left, * IN * - * Chain_Node *right * IN * - */ - -#define Chain_Are_nodes_equal( left, right ) \ - _Chain_Are_nodes_equal( left, right ) - - -/* - * Chain_Extract_unprotected - * - * This routine extracts the_node from the chain on which it resides. - * It does NOT disable interrupts to insure the atomicity of the - * extract operation. - * - * Chain_Node *the_node * IN * - */ - -#define Chain_Extract_unprotected( the_node ) \ - _Chain_Extract_unprotected( the_node ) - - -/* - * Chain_Extract - * - * This routine extracts the_node from the chain on which it resides. - * It disables interrupts to insure the atomicity of the - * extract operation. - * - * Chain_Node *the_node * IN * - */ - -#define Chain_Extract( the_node ) \ - _Chain_Extract( the_node ) - - -/* - * Chain_Get_unprotected - * - * This function removes the first node from the_chain and returns - * a pointer to that node. If the_chain is empty, then NULL is returned. - * It does NOT disable interrupts to insure the atomicity of the - * get operation. - * - * Chain_Control *the_chain * IN * - */ - -#define Chain_Get_unprotected( the_chain ) \ - _Chain_Get_unprotected( the_chain ) - - -/* - * Chain_Get - * - * This function removes the first node from the_chain and returns - * a pointer to that node. If the_chain is empty, then NULL is returned. - * It disables interrupts to insure the atomicity of the - * get operation. - * - * Chain_Control *the_chain * IN * - */ - -#define Chain_Get( the_chain ) \ - _Chain_Get( the_chain ) - - -/* - * Chain_Get_first_unprotected - * - * This function removes the first node from the_chain and returns - * a pointer to that node. It does NOT disable interrupts to insure - * the atomicity of the get operation. - * - * Chain_Control *the_chain * IN * - */ - -#define Chain_Get_first_unprotected( the_chain ) \ - _Chain_Get_first_unprotected( the_chain ) - - -/* - * Chain_Insert_unprotected - * - * This routine inserts the_node on a chain immediately following - * after_node. It does NOT disable interrupts to insure the atomicity - * of the extract operation. - * - * Chain_Node *after_node, * IN * - * Chain_Node *the_node * IN * - */ - -#define Chain_Insert_unprotected( after_node, the_node ) \ - _Chain_Insert_unprotected( after_node, the_node ) - - -/* - * Chain_Insert - * - * This routine inserts the_node on a chain immediately following - * after_node. It disables interrupts to insure the atomicity - * of the extract operation. - * - * Chain_Node *after_node, * IN * - * Chain_Node *the_node * IN * - */ - -#define Chain_Insert( after_node, the_node ) \ - _Chain_Insert( after_node, the_node ) - - -/* - * Chain_Append_unprotected - * - * This routine appends the_node onto the end of the_chain. - * It does NOT disable interrupts to insure the atomicity of the - * append operation. - * - * Chain_Control *the_chain, * IN * - * Chain_Node *the_node * IN * - */ - -#define Chain_Append_unprotected( the_chain, the_node ) \ - _Chain_Append_unprotected( the_chain, the_node ) - - -/* - * Chain_Append - * - * This routine appends the_node onto the end of the_chain. - * It disables interrupts to insure the atomicity of the - * append operation. - * - * Chain_Control *the_chain, * IN * - * Chain_Node *the_node * IN * - */ - -#define Chain_Append( the_chain, the_node ) \ - _Chain_Append( the_chain, the_node ) - - -/* - * Chain_Prepend_unprotected - * - * This routine prepends the_node onto the front of the_chain. - * It does NOT disable interrupts to insure the atomicity of the - * prepend operation. - * - * Chain_Control *the_chain, * IN * - * Chain_Node *the_node * IN * - */ - -#define Chain_Prepend_unprotected( the_chain, the_node ) \ - _Chain_Prepend_unprotected( the_chain, the_node ) - - -/* - * Chain_Prepend - * - * This routine prepends the_node onto the front of the_chain. - * It disables interrupts to insure the atomicity of the - * prepend operation. - * - * Chain_Control *the_chain, * IN * - * Chain_Node *the_node * IN * - */ - -#define Chain_Prepend( the_chain, the_node ) \ - _Chain_Prepend( the_chain, the_node ) - - -/* - * Chain_Head - * - * This function returns a pointer to the first node on the chain. - * - * Chain_Control *the_chain * IN * - */ - -#define Chain_Head( the_chain ) \ - _Chain_Head( the_chain ) - - -/* - * Chain_Tail - * - * This function returns a pointer to the last node on the chain. - * - * Chain_Control *the_chain * IN * - */ - -#define Chain_Tail( the_chain ) \ - _Chain_Tail( the_chain ) - - -/* - * Chain_Is_head - * - * This function returns TRUE if the_node is the head of the_chain and - * FALSE otherwise. - * - * Chain_Control *the_chain, * IN * - * Chain_Node *the_node * IN * - */ - -#define Chain_Is_head( the_chain, the_node ) \ - _Chain_Is_head( the_chain, the_node ) - - -/* - * Chain_Is_tail - * - * This function returns TRUE if the_node is the tail of the_chain and - * FALSE otherwise. - * - * Chain_Control *the_chain, * IN * - * Chain_Node *the_node * IN * - */ - -#define Chain_Is_tail( the_chain, the_node ) \ - _Chain_Is_tail( the_chain, the_node ) - - -/* - * Chain_Is_first - * - * This function returns TRUE if the_node is the first node on a chain and - * FALSE otherwise. - * - * Chain_Node *the_node * IN * - */ - -#define Chain_Is_first( the_node ) \ - _Chain_Is_first( the_node ) - - -/* - * Chain_Is_last - * - * This function returns TRUE if the_node is the last node on a chain and - * FALSE otherwise. - * - * Chain_Node *the_node * IN * - */ - -#define Chain_Is_last( the_node ) \ - _Chain_Is_last( the_node ) - - -/* - * Chain_Is_empty - * - * This function returns TRUE if there are no nodes on the_chain and - * FALSE otherwise. - * - * Chain_Control *the_chain * IN * - */ - -#define Chain_Is_empty( the_chain ) \ - _Chain_Is_empty( the_chain ) - - -/* - * Chain_Has_only_one_node - * - * This function returns TRUE if there is only one node on the_chain and - * FALSE otherwise. - * - * Chain_Control *the_chain * IN * - */ - -#define Chain_Has_only_one_node( the_chain ) \ - _Chain_Has_only_one_node( the_chain ) - - -/* - * Chain_Is_null - * - * This function returns TRUE if the_chain is NULL and FALSE otherwise. - * - * Chain_Control *the_chain * IN * - */ - -#define Chain_Is_null( the_chain ) \ - _Chain_Is_null( the_chain ) - - -/* - * Chain_Is_null_node - * - * This function returns TRUE if the_node is NULL and FALSE otherwise. - * - * Chain_Node *the_node * IN * - */ - -#define Chain_Is_null_node( the_node ) \ - _Chain_Is_null_node( the_node ) - - -#undef __RTEMS_APPLICATION__ -#include <rtems/score/chain.inl> -#define __RTEMS_APPLICATION__ -#endif -/* end of include file */ diff --git a/cpukit/libcsupport/include/clockdrv.h b/cpukit/libcsupport/include/clockdrv.h deleted file mode 100644 index 74c9d5e9f7..0000000000 --- a/cpukit/libcsupport/include/clockdrv.h +++ /dev/null @@ -1,51 +0,0 @@ -/* clock.h - * - * This file describes the Clock Driver for all boards. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __CLOCK_DRIVER_h -#define __CLOCK_DRIVER_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* variables */ - -extern volatile rtems_unsigned32 Clock_driver_ticks; -extern rtems_device_major_number rtems_clock_major; -extern rtems_device_minor_number rtems_clock_minor; - -/* default clock driver entry */ - -#define CLOCK_DRIVER_TABLE_ENTRY \ - { Clock_initialize, NULL, NULL, NULL, NULL, Clock_control } - -rtems_device_driver Clock_initialize( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -rtems_device_driver Clock_control( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *pargp -); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/libcsupport/include/console.h b/cpukit/libcsupport/include/console.h deleted file mode 100644 index 2f5173d757..0000000000 --- a/cpukit/libcsupport/include/console.h +++ /dev/null @@ -1,73 +0,0 @@ -/* console.h - * - * This file describes the Console Device Driver for all boards. - * This driver provides support for the standard C Library. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef _CONSOLE_DRIVER_h -#define _CONSOLE_DRIVER_h - -#ifdef __cplusplus -extern "C" { -#endif - -#define CONSOLE_DRIVER_TABLE_ENTRY \ - { console_initialize, console_open, console_close, \ - console_read, console_write, console_control } - -void console_reserve_resources( - rtems_configuration_table *configuration -); - -rtems_device_driver console_initialize( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -rtems_device_driver console_open( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -rtems_device_driver console_close( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -rtems_device_driver console_read( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -rtems_device_driver console_write( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -rtems_device_driver console_control( - rtems_device_major_number, - rtems_device_minor_number, - void * -); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/libcsupport/include/iosupp.h b/cpukit/libcsupport/include/iosupp.h deleted file mode 100644 index 97175e0a7b..0000000000 --- a/cpukit/libcsupport/include/iosupp.h +++ /dev/null @@ -1,44 +0,0 @@ -/* iosupp.h - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __IOSUPP_h -#define __IOSUPP_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* character constants */ - -#define BS 0x08 /* backspace */ -#define LF 0x0a /* line feed */ -#define CR 0x0d /* carriage return */ -#define XON 0x11 /* control-Q */ -#define XOFF 0x13 /* control-S */ - -/* structures */ - -#ifdef IOSUPP_INIT -#define IOSUPP_EXTERN -#else -#undef IOSUPP_EXTERN -#define IOSUPP_EXTERN extern -#endif - -/* functions */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/cpukit/libcsupport/include/motorola/mc68230.h b/cpukit/libcsupport/include/motorola/mc68230.h deleted file mode 100644 index bde00c4cdd..0000000000 --- a/cpukit/libcsupport/include/motorola/mc68230.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * mc68230.h -- Low level support code for the Motorola 68230 Parallel - * Interface/Timer (PIT) - * - * Modified by Doug McBride, Colorado Space Grant College - * - * Format taken partly from RTEMS code and mostly from Motorola IDP user's - * manual. RTEMS copyright information below. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __MC68230_H__ -#define __MC68230_H__ - -/* Some Motorola IDP User manual defines: */ -#define PIT_ADDR 0x00c01003 /* base address of the PIT */ -#define REGOFF 0x04 /* Difference between addresses */ -#define VECT 64 -#define H1VECT 0x00 -#define H2VECT 0x01 -#define H3VECT 0x02 -#define H4VECT 0x03 - -/* - * mc68230 register offsets - */ -#define PGCR 0x00 -#define PSRR 1*REGOFF -#define PADDR 2*REGOFF -#define PBDDR 3*REGOFF -#define PCDDR 4*REGOFF -#define PIVR 5*REGOFF -#define PACR 6*REGOFF -#define PBCR 7*REGOFF -#define PADR 8*REGOFF -#define PBDR 9*REGOFF -#define PAAR 10*REGOFF -#define PBAR 11*REGOFF -#define PCDR 12*REGOFF -#define PITSR 13*REGOFF -#define TCR 16*REGOFF -#define TIVR 17*REGOFF -#define CPRH 19*REGOFF -#define CPRM 20*REGOFF -#define CPRL 21*REGOFF -#define CNTRH 23*REGOFF -#define CNTRM 24*REGOFF -#define CNTRL 25*REGOFF -#define TSR 26*REGOFF - -/* Some RTEMS style defines: */ -#ifndef VOL8 -#define VOL8( ptr ) ((volatile rtems_unsigned8 *)(ptr)) -#endif - -#define MC68230_WRITE( reg, data ) \ - *(VOL8(PIT_ADDR+reg)) = (data) - -#define MC68230_READ( reg, data ) \ - (data) = *(VOL8(PIT_ADDR+reg)) - -#endif diff --git a/cpukit/libcsupport/include/motorola/mc68681.h b/cpukit/libcsupport/include/motorola/mc68681.h deleted file mode 100644 index 7602097fd8..0000000000 --- a/cpukit/libcsupport/include/motorola/mc68681.h +++ /dev/null @@ -1,306 +0,0 @@ -/* - * mc68681-duart.h -- Low level support code for the Motorola mc68681 - * DUART. - * - * Originally written by rob@cygnus.com (Rob Savoye) for the libgloss - * IDP support. - * - * $Id$ - */ - -#ifndef __MC68681_H__ -#define __MC68681_H__ - -/* - * In the dark ages when this controller was designed, it was actually - * possible to access data on unaligned byte boundaries with no penalty. - * Now we find this chip in configurations in which the registers are - * at 16-bit, 32-bit, and 64-bit boundaries at the whim of the board - * designer. If the registers are not at byte addresses, then - * set this multiplier before including this file to correct the offsets. - */ - -#ifndef MC68681_OFFSET_MULTIPLIER -#define MC68681_OFFSET_MULTIPLIER 1 -#endif - -#define __MC68681_REG(_R) ((_R) * MC68681_OFFSET_MULTIPLIER) - -/* - * mc68681 register offsets Read/Write Addresses - */ -#define MC68681_MODE_REG_1A __MC68681_REG(0) /* MR1A-MR Prior to Read */ -#define MC68681_MODE_REG_2A __MC68681_REG(0) /* MR2A-MR After Read */ - -#define MC68681_COUNT_MODE_CURRENT_MSB __MC68681_REG(6) /* CTU */ -#define MC68681_COUNTER_TIMER_UPPER_REG __MC68681_REG(6) /* CTU */ -#define MC68681_COUNT_MODE_CURRENT_LSB __MC68681_REG(7) /* CTL */ -#define MC68681_COUNTER_TIMER_LOWER_REG __MC68681_REG(7) /* CTL */ -#define MC68681_INTERRUPT_VECTOR_REG __MC68681_REG(12) /* IVR */ - -#define MC68681_MODE_REG_1B __MC68681_REG(8) /* MR1B-MR Prior to Read */ -#define MC68681_MODE_REG_2B __MC68681_REG(8) /* MR2BA-MR After Read */ - -/* - * mc68681 register offsets Read Only Addresses - */ -#define MC68681_STATUS_REG_A __MC68681_REG(1) /* SRA */ -#define MC68681_MASK_ISR_REG __MC68681_REG(2) /* MISR */ -#define MC68681_RECEIVE_BUFFER_A __MC68681_REG(3) /* RHRA */ -#define MC68681_INPUT_PORT_CHANGE_REG __MC68681_REG(4) /* IPCR */ -#define MC68681_INTERRUPT_STATUS_REG __MC68681_REG(5) /* ISR */ -#define MC68681_STATUS_REG_B __MC68681_REG(9) /* SRB */ -#define MC68681_RECEIVE_BUFFER_B __MC68681_REG(11) /* RHRB */ -#define MC68681_INPUT_PORT __MC68681_REG(13) /* IP */ -#define MC68681_START_COUNT_CMD __MC68681_REG(14) /* SCC */ -#define MC68681_STOP_COUNT_CMD __MC68681_REG(15) /* STC */ - -/* - * mc68681 register offsets Write Only Addresses - */ -#define MC68681_CLOCK_SELECT_REG_A __MC68681_REG(1) /* CSRA */ -#define MC68681_COMMAND_REG_A __MC68681_REG(2) /* CRA */ -#define MC68681_TRANSMIT_BUFFER_A __MC68681_REG(3) /* THRA */ -#define MC68681_AUX_CTRL_REG __MC68681_REG(4) /* ACR */ -#define MC68681_INTERRUPT_MASK_REG __MC68681_REG(5) /* IMR */ -#define MC68681_CLOCK_SELECT_REG_B __MC68681_REG(9) /* CSRB */ -#define MC68681_COMMAND_REG_B __MC68681_REG(10) /* CRB */ -#define MC68681_TRANSMIT_BUFFER_B __MC68681_REG(11) /* THRB */ -#define MC68681_OUTPUT_PORT_CONFIG_REG __MC68681_REG(13) /* OPCR */ -#define MC68681_OUTPUT_PORT_SET_REG __MC68681_REG(14) /* SOPBC */ -#define MC68681_OUTPUT_PORT_RESET_BITS __MC68681_REG(15) /* COPBC */ - - -#ifndef MC6681_VOL -#define MC6681_VOL( ptr ) ((volatile unsigned char *)(ptr)) -#endif - -#define MC68681_WRITE( _base, _reg, _data ) \ - *((volatile unsigned char *)_base+_reg) = (_data) - -#define MC68681_READ( _base, _reg ) \ - *(((volatile unsigned char *)_base+_reg)) - - - -#define MC68681_CLEAR 0x00 - -#define MC68681_PORT_A 0 -#define MC68681_PORT_B 1 - -/* - * DUART Command Register Definitions: - * - * MC68681_COMMAND_REG_A,MC68681_COMMAND_REG_B - */ -#define MC68681_MODE_REG_ENABLE_RX 0x01 -#define MC68681_MODE_REG_DISABLE_RX 0x02 -#define MC68681_MODE_REG_ENABLE_TX 0x04 -#define MC68681_MODE_REG_DISABLE_TX 0x08 -#define MC68681_MODE_REG_RESET_MR_PTR 0x10 -#define MC68681_MODE_REG_RESET_RX 0x20 -#define MC68681_MODE_REG_RESET_TX 0x30 -#define MC68681_MODE_REG_RESET_ERROR 0x40 -#define MC68681_MODE_REG_RESET_BREAK 0x50 -#define MC68681_MODE_REG_START_BREAK 0x60 -#define MC68681_MODE_REG_STOP_BREAK 0x70 -#define MC68681_MODE_REG_SET_RX_BRG 0x80 -#define MC68681_MODE_REG_CLEAR_RX_BRG 0x90 -#define MC68681_MODE_REG_SET_TX_BRG 0xa0 -#define MC68681_MODE_REG_CLEAR_TX_BRG 0xb0 -#define MC68681_MODE_REG_SET_STANDBY 0xc0 -#define MC68681_MODE_REG_SET_ACTIVE 0xd0 - -/* - * Mode Register Definitions - * - * MC68681_MODE_REG_1A - * MC68681_MODE_REG_1B - */ -#define MC68681_5BIT_CHARS 0x00 -#define MC68681_6BIT_CHARS 0x01 -#define MC68681_7BIT_CHARS 0x02 -#define MC68681_8BIT_CHARS 0x03 - -#define MC68681_ODD_PARITY 0x00 -#define MC68681_EVEN_PARITY 0x04 - -#define MC68681_WITH_PARITY 0x00 -#define MC68681_FORCE_PARITY 0x08 -#define MC68681_NO_PARITY 0x10 -#define MC68681_MULTI_DROP 0x18 - -#define MC68681_ERR_MODE_CHAR 0x00 -#define MC68681_ERR_MODE_BLOCK 0x20 - -#define MC68681_RX_INTR_RX_READY 0x00 -#define MC68681_RX_INTR_FFULL 0x40 - -#define MC68681_NO_RX_RTS_CTL 0x00 -#define MC68681_RX_RTS_CTRL 0x80 - - -/* - * Mode Register Definitions - * - * MC68681_MODE_REG_2A - * MC68681_MODE_REG_2B - */ -#define MC68681_STOP_BIT_LENGTH__563 0x00 -#define MC68681_STOP_BIT_LENGTH__625 0x01 -#define MC68681_STOP_BIT_LENGTH__688 0x02 -#define MC68681_STOP_BIT_LENGTH__75 0x03 -#define MC68681_STOP_BIT_LENGTH__813 0x04 -#define MC68681_STOP_BIT_LENGTH__875 0x05 -#define MC68681_STOP_BIT_LENGTH__938 0x06 -#define MC68681_STOP_BIT_LENGTH_1 0x07 -#define MC68681_STOP_BIT_LENGTH_1_563 0x08 -#define MC68681_STOP_BIT_LENGTH_1_625 0x09 -#define MC68681_STOP_BIT_LENGTH_1_688 0x0a -#define MC68681_STOP_BIT_LENGTH_1_75 0x0b -#define MC68681_STOP_BIT_LENGTH_1_813 0x0c -#define MC68681_STOP_BIT_LENGTH_1_875 0x0d -#define MC68681_STOP_BIT_LENGTH_1_938 0x0e -#define MC68681_STOP_BIT_LENGTH_2 0x0f - -#define MC68681_CTS_ENABLE_TX 0x10 -#define MC68681_TX_RTS_CTRL 0x20 - -#define MC68681_CHANNEL_MODE_NORMAL 0x00 -#define MC68681_CHANNEL_MODE_ECHO 0x40 -#define MC68681_CHANNEL_MODE_LOCAL_LOOP 0x80 -#define MC68681_CHANNEL_MODE_REMOTE_LOOP 0xc0 - -/* - * Status Register Definitions - * - * MC68681_STATUS_REG_A, MC68681_STATUS_REG_B - */ -#define MC68681_RX_READY 0x01 -#define MC68681_FFULL 0x02 -#define MC68681_TX_READY 0x04 -#define MC68681_TX_EMPTY 0x08 -#define MC68681_OVERRUN_ERROR 0x10 -#define MC68681_PARITY_ERROR 0x20 -#define MC68681_FRAMING_ERROR 0x40 -#define MC68681_RECEIVED_BREAK 0x80 - - -/* - * Interupt Status Register Definitions. - * - * MC68681_INTERRUPT_STATUS_REG - */ - - -/* - * Interupt Mask Register Definitions - * - * MC68681_INTERRUPT_MASK_REG - */ -#define MC68681_IR_TX_READY_A 0x01 -#define MC68681_IR_RX_READY_A 0x02 -#define MC68681_IR_BREAK_A 0x04 -#define MC68681_IR_COUNTER_READY 0x08 -#define MC68681_IR_TX_READY_B 0x10 -#define MC68681_IR_RX_READY_B 0x20 -#define MC68681_IR_BREAK_B 0x40 -#define MC68681_IR_INPUT_PORT_CHANGE 0x80 - -/* - * Status Register Definitions. - * - * MC68681_STATUS_REG_A,MC68681_STATUS_REG_B - */ -#define MC68681_STATUS_RXRDY 0x01 -#define MC68681_STATUS_FFULL 0x02 -#define MC68681_STATUS_TXRDY 0x04 -#define MC68681_STATUS_TXEMT 0x08 -#define MC68681_STATUS_OVERRUN_ERROR 0x10 -#define MC68681_STATUS_PARITY_ERROR 0x20 -#define MC68681_STATUS_FRAMING_ERROR 0x40 -#define MC68681_STATUS_RECEIVED_BREAK 0x80 - -/* - * Definitions for the Interrupt Vector Register: - * - * MC68681_INTERRUPT_VECTOR_REG - */ -#define MC68681_INTERRUPT_VECTOR_INIT 0x0f - -/* - * Definitions for the Auxiliary Control Register - * - * MC68681_AUX_CTRL_REG - */ -#define MC68681_AUX_BRG_SET1 0x00 -#define MC68681_AUX_BRG_SET2 0x80 - - -/* - * The following Baud rates assume the X1 clock pin is driven with a - * 3.6864 MHz signal. If a different frequency is used the DUART channel - * is running at the follwoing baud rate: - * ((Table Baud Rate)*frequency)/3.6864 MHz - */ - -/* - * Definitions for the Clock Select Register: - * - * MC68681_CLOCK_SELECT_REG_A,MC68681_CLOCK_SELECT_REG_A - * - * Note: ACR[7] is the MSB of the Auxiliary Control register - * X is the extend bit. - * CRA - 0x08 Set Rx BRG Select Extend Bit (X=1) - * CRA - 0x09 Clear Rx BRG Select Extend Bit (X=0) - * CRB - 0x0a Set Tx BRG Select Extend Bit (X=1) - * CRB - 0x0b Clear Tx BRG Select Extend Bit (x=1) - */ -#define MC68681_BAUD_RATE_MASK_50 0x00 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_75 0x00 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_110 0x01 -#define MC68681_BAUD_RATE_MASK_134_5 0x02 -#define MC68681_BAUD_RATE_MASK_150 0x03 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_200 0x03 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_300 0x04 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_600 0x05 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_1050 0x07 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_1200 0x06 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_1800 0x0a /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_2400 0x08 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_3600 0x04 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_4800 0x09 -#define MC68681_BAUD_RATE_MASK_7200 0x0a /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_9600 0xbb - -#define MC68681_BAUD_RATE_MASK_14_4K 0x05 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_19_2K 0xcc /* ACR[7]=1,X=0 */ - /* ARC[7]=0,X=1 */ -#define MC68681_BAUD_RATE_MASK_28_8K 0x06 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_38_4K 0xcc /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_57_6K 0x07 /* ACR[7]=0,X=0 */ - /* ARC[7]=1,X=1 */ -#define MC68681_BAUD_RATE_MASK_115_5K 0x08 -#define MC68681_BAUD_RATE_MASK_TIMER 0xdd -#define MC68681_BAUD_RATE_MASK_TIMER_16X 0xee -#define MC68681_BAUD_RATE_MASK_TIMER_1X 0xff - -#endif - - - diff --git a/cpukit/libcsupport/include/ringbuf.h b/cpukit/libcsupport/include/ringbuf.h deleted file mode 100644 index 8c80aaf9c8..0000000000 --- a/cpukit/libcsupport/include/ringbuf.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * ringbuf.h - * - * This file provides simple ring buffer functionality. - * - * $Id$ - */ - -#ifndef __RINGBUF_H__ -#define __RINGBUF_H__ - -#ifndef RINGBUF_QUEUE_LENGTH -#define RINGBUF_QUEUE_LENGTH 128 -#endif - -typedef struct { - char buffer[RINGBUF_QUEUE_LENGTH]; - volatile int head; - volatile int tail; -} Ring_buffer_t; - -#define Ring_buffer_Initialize( _buffer ) \ - do { \ - (_buffer)->head = (_buffer)->tail = 0; \ - } while ( 0 ) - -#define Ring_buffer_Is_empty( _buffer ) \ - ( (_buffer)->head == (_buffer)->tail ) - -#define Ring_buffer_Is_full( _buffer ) \ - ( (_buffer)->head == ((_buffer)->tail + 1) % RINGBUF_QUEUE_LENGTH ) - -#define Ring_buffer_Add_character( _buffer, _ch ) \ - do { \ - rtems_unsigned32 isrlevel; \ - \ - rtems_interrupt_disable( isrlevel ); \ - (_buffer)->tail = ((_buffer)->tail+1) % RINGBUF_QUEUE_LENGTH; \ - (_buffer)->buffer[ (_buffer)->tail ] = (_ch); \ - rtems_interrupt_enable( isrlevel ); \ - } while ( 0 ) - -#define Ring_buffer_Remove_character( _buffer, _ch ) \ - do { \ - rtems_unsigned32 isrlevel; \ - \ - rtems_interrupt_disable( isrlevel ); \ - (_buffer)->head = ((_buffer)->head+1) % RINGBUF_QUEUE_LENGTH; \ - (_ch) = (_buffer)->buffer[ (_buffer)->head ]; \ - rtems_interrupt_enable( isrlevel ); \ - } while ( 0 ) - -#endif diff --git a/cpukit/libcsupport/include/rtems/assoc.h b/cpukit/libcsupport/include/rtems/assoc.h deleted file mode 100644 index 1982d654ac..0000000000 --- a/cpukit/libcsupport/include/rtems/assoc.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * - * 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 { - const 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)" - -const rtems_assoc_t *rtems_assoc_ptr_by_name(const rtems_assoc_t *, const char *); -const rtems_assoc_t *rtems_assoc_ptr_by_value(const rtems_assoc_t *, unsigned32); -const rtems_assoc_t *rtems_assoc_ptr_by_remote(const rtems_assoc_t *, unsigned32); - -unsigned32 rtems_assoc_remote_by_local(const rtems_assoc_t *, unsigned32); -unsigned32 rtems_assoc_local_by_remote(const rtems_assoc_t *, unsigned32); -unsigned32 rtems_assoc_remote_by_name(const rtems_assoc_t *, const char *); -unsigned32 rtems_assoc_local_by_name(const rtems_assoc_t *, const char *); -const char *rtems_assoc_name_by_local(const rtems_assoc_t *, unsigned32); -const char *rtems_assoc_name_by_remote(const rtems_assoc_t *, unsigned32); - -unsigned32 rtems_assoc_remote_by_local_bitfield(const rtems_assoc_t *, unsigned32); -char *rtems_assoc_name_by_local_bitfield(const rtems_assoc_t *, unsigned32, char *); -char *rtems_assoc_name_by_remote_bitfield(const rtems_assoc_t *, unsigned32, char *); -unsigned32 rtems_assoc_local_by_remote_bitfield(const rtems_assoc_t *, unsigned32); - - -#endif /* ! _INCLUDE_ASSOC_H */ diff --git a/cpukit/libcsupport/include/rtems/error.h b/cpukit/libcsupport/include/rtems/error.h deleted file mode 100644 index a0698afb5d..0000000000 --- a/cpukit/libcsupport/include/rtems/error.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Defines and externs for rtems error reporting - * - * $Id$ - */ - -#ifndef __RTEMS_ERROR_h -#define __RTEMS_ERROR_h - -/* - * 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 */ - -const char *rtems_status_text(rtems_status_code); -int rtems_error(int error_code, const char *printf_format, ...); -#ifdef __GNUC__ -void rtems_panic(const char *printf_format, ...); -/* - * We should be able to use this attribute but gcc complains that - * rtems_panic does in fact return. :( - * - * __attribute__ ((__noreturn__)); - */ -#else -void rtems_panic(const char *printf_format, ...); -#endif - -extern int rtems_panic_in_progress; - -#endif -/* end of include file */ diff --git a/cpukit/libcsupport/include/rtems/libcsupport.h b/cpukit/libcsupport/include/rtems/libcsupport.h deleted file mode 100644 index d007784526..0000000000 --- a/cpukit/libcsupport/include/rtems/libcsupport.h +++ /dev/null @@ -1,43 +0,0 @@ -/* libcsupport.h - * - * This include file contains the information regarding the - * RTEMS specific support for the standard C library. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __LIBC_SUPPORT_h -#define __LIBC_SUPPORT_h - -#ifdef __cplusplus -extern "C" { -#endif - -#include <sys/types.h> - -void RTEMS_Malloc_Initialize( - void *start, - size_t length, - size_t sbrk_amount -); - -extern void malloc_dump(void); -extern void malloc_walk(size_t source, size_t printf_enabled); -extern void libc_init(int reentrant); -extern int host_errno(void); -extern void fix_syscall_errno(void); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/libcsupport/include/rtems/libio.h b/cpukit/libcsupport/include/rtems/libio.h deleted file mode 100644 index dcdda85aec..0000000000 --- a/cpukit/libcsupport/include/rtems/libio.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - * 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 - -#include <sys/stat.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" */ - void *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_init(void); - -int __rtems_open(const char *pathname, unsigned32 flag, unsigned32 mode); -int __rtems_close(int fd); -int __rtems_read(int fd, void *buffer, unsigned32 count); -int __rtems_write(int fd, const void *buffer, unsigned32 count); -int __rtems_ioctl(int fd, unsigned32 command, void *buffer); -int __rtems_lseek(int fd, rtems_libio_offset_t offset, int whence); -int __rtems_fstat(int _fd, struct stat* _sbuf); - -/* - * External I/O handlers - */ -typedef struct { - 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); -} rtems_libio_handler_t; - -void rtems_register_libio_handler(int handler_flag, - const rtems_libio_handler_t *handler); - -#define RTEMS_FILE_DESCRIPTOR_TYPE_FILE 0x0000 -#define RTEMS_FILE_DESCRIPTOR_TYPE_SOCKET 0x1000 -#define rtems_make_file_descriptor(fd,flags) ((fd)|(flags)) -#define rtems_file_descriptor_base(fd) ((fd) & 0x0FFF) -#define rtems_file_descriptor_type(fd) ((fd) & 0xF000) -#define rtems_file_descriptor_type_index(fd) ((((fd) & 0xF000) >> 12) - 1) - -/* - * IOCTL values - */ - -#define RTEMS_IO_GET_ATTRIBUTES 1 -#define RTEMS_IO_SET_ATTRIBUTES 2 -#define RTEMS_IO_TCDRAIN 3 - -/* - * Callbacks from TERMIOS routines to device-dependent code - */ -#include <termios.h> -typedef struct rtems_termios_callbacks { - int (*firstOpen)(int major, int minor, void *arg); - int (*lastClose)(int major, int minor, void *arg); - int (*pollRead)(int minor); - int (*write)(int minor, const char *buf, int len); - int (*setAttributes)(int minor, const struct termios *t); - int (*stopRemoteTx)(int minor); - int (*startRemoteTx)(int minor); - int outputUsesInterrupts; -} rtems_termios_callbacks; - -/* - * Device-independent TERMIOS routines - */ -void rtems_termios_initialize (void); -rtems_status_code rtems_termios_open ( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg, - const rtems_termios_callbacks *callbacks - ); -rtems_status_code rtems_termios_close (void *arg); -rtems_status_code rtems_termios_read (void *arg); -rtems_status_code rtems_termios_write (void *arg); -rtems_status_code rtems_termios_ioctl (void *arg); -int rtems_termios_enqueue_raw_characters (void *ttyp, char *buf, int len); -int rtems_termios_dequeue_characters (void *ttyp, int len); -void rtems_termios_reserve_resources( - rtems_configuration_table *configuration, - rtems_unsigned32 number_of_devices -); - -#endif /* _RTEMS_LIBIO_H */ diff --git a/cpukit/libcsupport/include/spurious.h b/cpukit/libcsupport/include/spurious.h deleted file mode 100644 index 36fcaba904..0000000000 --- a/cpukit/libcsupport/include/spurious.h +++ /dev/null @@ -1,38 +0,0 @@ -/* spurious.h - * - * This file describes the Spurious Interrupt Driver for all boards. - * - * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __SPURIOUS_h -#define __SPURIOUS_h - -#ifdef __cplusplus -extern "C" { -#endif - -#define SPURIOUS_DRIVER_TABLE_ENTRY \ - { Spurious_Initialize, NULL, NULL, NULL, NULL, NULL } - -rtems_device_driver Spurious_Initialize( - rtems_device_major_number, - rtems_device_minor_number, - void *, - rtems_id, - rtems_unsigned32 * -); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/libcsupport/include/sys/filio.h b/cpukit/libcsupport/include/sys/filio.h deleted file mode 100644 index b82a649c0f..0000000000 --- a/cpukit/libcsupport/include/sys/filio.h +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1990, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)filio.h 8.1 (Berkeley) 3/28/94 - * $Id$ - */ - -#ifndef _SYS_FILIO_H_ -#define _SYS_FILIO_H_ - -#include <sys/ioccom.h> - -/* Generic file-descriptor ioctl's. */ -#define FIOCLEX _IO('f', 1) /* set close on exec on fd */ -#define FIONCLEX _IO('f', 2) /* remove close on exec */ -#define FIONREAD _IOR('f', 127, int) /* get # bytes to read */ -#define FIONBIO _IOW('f', 126, int) /* set/clear non-blocking i/o */ -#define FIOASYNC _IOW('f', 125, int) /* set/clear async i/o */ -#define FIOSETOWN _IOW('f', 124, int) /* set owner */ -#define FIOGETOWN _IOR('f', 123, int) /* get owner */ - -#endif /* !_SYS_FILIO_H_ */ diff --git a/cpukit/libcsupport/include/sys/ioctl.h b/cpukit/libcsupport/include/sys/ioctl.h deleted file mode 100644 index e3a69a5a7f..0000000000 --- a/cpukit/libcsupport/include/sys/ioctl.h +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1990, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)ioctl.h 8.6 (Berkeley) 3/28/94 - * $Id$ - */ - -#ifndef _SYS_IOCTL_H_ -#define _SYS_IOCTL_H_ - -#include <sys/ttycom.h> - -/* - * Pun for SunOS prior to 3.2. SunOS 3.2 and later support TIOCGWINSZ - * and TIOCSWINSZ (yes, even 3.2-3.5, the fact that it wasn't documented - * notwithstanding). - */ -struct ttysize { - unsigned short ts_lines; - unsigned short ts_cols; - unsigned short ts_xxx; - unsigned short ts_yyy; -}; -#define TIOCGSIZE TIOCGWINSZ -#define TIOCSSIZE TIOCSWINSZ - -#include <sys/ioccom.h> - -#include <sys/filio.h> -#include <sys/sockio.h> - -#endif /* !_SYS_IOCTL_H_ */ - -/* - * Keep outside _SYS_IOCTL_H_ - * Compatibility with old terminal driver - * - * Source level -> #define USE_OLD_TTY - * Kernel level -> options COMPAT_43 or COMPAT_SUNOS - */ -#if defined(USE_OLD_TTY) || defined(COMPAT_43) || defined(COMPAT_SUNOS) -#include <sys/ioctl_compat.h> -#endif diff --git a/cpukit/libcsupport/include/sys/sockio.h b/cpukit/libcsupport/include/sys/sockio.h deleted file mode 100644 index 020061170f..0000000000 --- a/cpukit/libcsupport/include/sys/sockio.h +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * Copyright (c) 1982, 1986, 1990, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)sockio.h 8.1 (Berkeley) 3/28/94 - * $Id$ - */ - -#ifndef _SYS_SOCKIO_H_ -#define _SYS_SOCKIO_H_ - -#include <sys/ioccom.h> - -/* Socket ioctl's. */ -#define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */ -#define SIOCGHIWAT _IOR('s', 1, int) /* get high watermark */ -#define SIOCSLOWAT _IOW('s', 2, int) /* set low watermark */ -#define SIOCGLOWAT _IOR('s', 3, int) /* get low watermark */ -#define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */ -#define SIOCSPGRP _IOW('s', 8, int) /* set process group */ -#define SIOCGPGRP _IOR('s', 9, int) /* get process group */ - -#define SIOCADDRT _IOW('r', 10, struct ortentry) /* add route */ -#define SIOCDELRT _IOW('r', 11, struct ortentry) /* delete route */ -#define SIOCGETVIFCNT _IOWR('r', 15, struct sioc_vif_req)/* get vif pkt cnt */ -#define SIOCGETSGCNT _IOWR('r', 16, struct sioc_sg_req) /* get s,g pkt cnt */ - -#define SIOCSIFADDR _IOW('i', 12, struct ifreq) /* set ifnet address */ -#define OSIOCGIFADDR _IOWR('i', 13, struct ifreq) /* get ifnet address */ -#define SIOCGIFADDR _IOWR('i', 33, struct ifreq) /* get ifnet address */ -#define SIOCSIFDSTADDR _IOW('i', 14, struct ifreq) /* set p-p address */ -#define OSIOCGIFDSTADDR _IOWR('i', 15, struct ifreq) /* get p-p address */ -#define SIOCGIFDSTADDR _IOWR('i', 34, struct ifreq) /* get p-p address */ -#define SIOCSIFFLAGS _IOW('i', 16, struct ifreq) /* set ifnet flags */ -#define SIOCGIFFLAGS _IOWR('i', 17, struct ifreq) /* get ifnet flags */ -#define OSIOCGIFBRDADDR _IOWR('i', 18, struct ifreq) /* get broadcast addr */ -#define SIOCGIFBRDADDR _IOWR('i', 35, struct ifreq) /* get broadcast addr */ -#define SIOCSIFBRDADDR _IOW('i', 19, struct ifreq) /* set broadcast addr */ -#define OSIOCGIFCONF _IOWR('i', 20, struct ifconf) /* get ifnet list */ -#define SIOCGIFCONF _IOWR('i', 36, struct ifconf) /* get ifnet list */ -#define OSIOCGIFNETMASK _IOWR('i', 21, struct ifreq) /* get net addr mask */ -#define SIOCGIFNETMASK _IOWR('i', 37, struct ifreq) /* get net addr mask */ -#define SIOCSIFNETMASK _IOW('i', 22, struct ifreq) /* set net addr mask */ -#define SIOCGIFMETRIC _IOWR('i', 23, struct ifreq) /* get IF metric */ -#define SIOCSIFMETRIC _IOW('i', 24, struct ifreq) /* set IF metric */ -#define SIOCDIFADDR _IOW('i', 25, struct ifreq) /* delete IF addr */ -#define SIOCAIFADDR _IOW('i', 26, struct ifaliasreq)/* add/chg IF alias */ - -#define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* add m'cast addr */ -#define SIOCDELMULTI _IOW('i', 50, struct ifreq) /* del m'cast addr */ -#define SIOCGIFMTU _IOWR('i', 51, struct ifreq) /* get IF mtu */ -#define SIOCSIFMTU _IOW('i', 52, struct ifreq) /* set IF mtu */ -#define SIOCGIFPHYS _IOWR('i', 53, struct ifreq) /* get IF wire */ -#define SIOCSIFPHYS _IOW('i', 54, struct ifreq) /* set IF wire */ -#define SIOCSIFMEDIA _IOWR('i', 55, struct ifreq) /* set net media */ -#define SIOCGIFMEDIA _IOWR('i', 56, struct ifmediareq) /* get net media */ - -#endif /* !_SYS_SOCKIO_H_ */ diff --git a/cpukit/libcsupport/include/sys/termios.h b/cpukit/libcsupport/include/sys/termios.h deleted file mode 100644 index 1112ec4f5e..0000000000 --- a/cpukit/libcsupport/include/sys/termios.h +++ /dev/null @@ -1,188 +0,0 @@ -/* - * POSIX termios implementation for RTEMS console device driver. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef TERMIOS_H -#define TERMIOS_H - -#ifdef __cplusplus -extern "C" { -#endif - -typedef unsigned char cc_t; -typedef unsigned int speed_t; -typedef unsigned int tcflag_t; - -#define NCCS 19 -struct termios { - tcflag_t c_iflag; /* input mode flags */ - tcflag_t c_oflag; /* output mode flags */ - tcflag_t c_cflag; /* control mode flags */ - tcflag_t c_lflag; /* local mode flags */ - cc_t c_line; /* line discipline */ - cc_t c_cc[NCCS]; /* control characters */ -}; - -/* c_cc characters */ -#define VINTR 0 -#define VQUIT 1 -#define VERASE 2 -#define VKILL 3 -#define VEOF 4 -#define VTIME 5 -#define VMIN 6 -#define VSWTC 7 -#define VSTART 8 -#define VSTOP 9 -#define VSUSP 10 -#define VEOL 11 -#define VREPRINT 12 -#define VDISCARD 13 -#define VWERASE 14 -#define VLNEXT 15 -#define VEOL2 16 - -/* c_iflag bits */ -#define IGNBRK 0000001 -#define BRKINT 0000002 -#define IGNPAR 0000004 -#define PARMRK 0000010 -#define INPCK 0000020 -#define ISTRIP 0000040 -#define INLCR 0000100 -#define IGNCR 0000200 -#define ICRNL 0000400 -#define IUCLC 0001000 -#define IXON 0002000 -#define IXANY 0004000 -#define IXOFF 0010000 -#define IMAXBEL 0020000 - -/* c_oflag bits */ -#define OPOST 0000001 -#define OLCUC 0000002 -#define ONLCR 0000004 -#define OCRNL 0000010 -#define ONOCR 0000020 -#define ONLRET 0000040 -#define OFILL 0000100 -#define OFDEL 0000200 -#define NLDLY 0000400 -#define NL0 0000000 -#define NL1 0000400 -#define CRDLY 0003000 -#define CR0 0000000 -#define CR1 0001000 -#define CR2 0002000 -#define CR3 0003000 -#define TABDLY 0014000 -#define TAB0 0000000 -#define TAB1 0004000 -#define TAB2 0010000 -#define TAB3 0014000 -#define XTABS 0014000 -#define BSDLY 0020000 -#define BS0 0000000 -#define BS1 0020000 -#define VTDLY 0040000 -#define VT0 0000000 -#define VT1 0040000 -#define FFDLY 0100000 -#define FF0 0000000 -#define FF1 0100000 - -/* c_cflag bit meaning */ -#define CBAUD 0010017 -#define B0 0000000 /* hang up */ -#define B50 0000001 -#define B75 0000002 -#define B110 0000003 -#define B134 0000004 -#define B150 0000005 -#define B200 0000006 -#define B300 0000007 -#define B600 0000010 -#define B1200 0000011 -#define B1800 0000012 -#define B2400 0000013 -#define B4800 0000014 -#define B9600 0000015 -#define B19200 0000016 -#define B38400 0000017 -#define EXTA B19200 -#define EXTB B38400 -#define CSIZE 0000060 -#define CS5 0000000 -#define CS6 0000020 -#define CS7 0000040 -#define CS8 0000060 -#define CSTOPB 0000100 -#define CREAD 0000200 -#define PARENB 0000400 -#define PARODD 0001000 -#define HUPCL 0002000 -#define CLOCAL 0004000 -#define CBAUDEX 0010000 -#define B57600 0010001 -#define B115200 0010002 -#define B230400 0010003 -#define B460800 0010004 -#define CIBAUD 002003600000 /* input baud rate (not used) */ -#define CRTSCTS 020000000000 /* flow control */ - -/* c_lflag bits */ -#define ISIG 0000001 -#define ICANON 0000002 -#define XCASE 0000004 -#define ECHO 0000010 -#define ECHOE 0000020 -#define ECHOK 0000040 -#define ECHONL 0000100 -#define NOFLSH 0000200 -#define TOSTOP 0000400 -#define ECHOCTL 0001000 -#define ECHOPRT 0002000 -#define ECHOKE 0004000 -#define FLUSHO 0010000 -#define PENDIN 0040000 -#define IEXTEN 0100000 - -/* tcflow() and TCXONC use these */ -#define TCOOFF 0 -#define TCOON 1 -#define TCIOFF 2 -#define TCION 3 - -/* tcflush() and TCFLSH use these */ -#define TCIFLUSH 0 -#define TCOFLUSH 1 -#define TCIOFLUSH 2 - -/* tcsetattr uses these */ -#define TCSANOW 0 -#define TCSADRAIN 1 -#define TCSAFLUSH 2 - -int tcgetattr(int, struct termios *); -int tcsetattr(int, int, struct termios *); -int tcdrain(int); -speed_t cfgetospeed(const struct termios *tp); -int cfsetospeed(struct termios *tp, speed_t speed); -speed_t cfgetispeed(const struct termios *tp); -int cfsetispeed(struct termios *tp, speed_t speed); - -#ifdef __cplusplus -} -#endif - -#endif /* TERMIOS_H */ diff --git a/cpukit/libcsupport/include/sys/utsname.h b/cpukit/libcsupport/include/sys/utsname.h deleted file mode 100644 index ca15230d40..0000000000 --- a/cpukit/libcsupport/include/sys/utsname.h +++ /dev/null @@ -1,49 +0,0 @@ -/* sys/utsname.h - * - * $Id$ - */ - -#ifndef __POSIX_SYS_UTSNAME_h -#define __POSIX_SYS_UTSNAME_h - -#include <sys/times.h> -#include <sys/types.h> - -/* - * 4.4.1 Get System Name (Table 4-1), P1003.1b-1993, p. 90 - * - * NOTE: The lengths of the strings in this structure are - * just long enough to reliably contain the RTEMS information. - * For example, the fields are not long enough to support - * Internet hostnames. - */ - -struct utsname { - char sysname[ 32 ]; /* Name of this implementation of the operating system */ - char nodename[ 32 ]; /* Name of this node within an implementation */ - /* specified communication network */ - char release[ 32 ]; /* Current release level of this implementation */ - char version[ 32 ]; /* Current version level of this release */ - char machine[ 32 ]; /* Name of the hardware type on which the system */ - /* is running */ -}; - -/* - * 4.4.1 Get System Name, P1003.1b-1993, p. 90 - */ - -int uname( - struct utsname *name -); - -/* - * 4.5.2 Get Process Times, P1003.1b-1993, p. 92 - */ - -clock_t times( - struct tms *buffer -); - -#endif -/* end of include file */ - diff --git a/cpukit/libcsupport/include/timerdrv.h b/cpukit/libcsupport/include/timerdrv.h deleted file mode 100644 index ed1ce2b9a2..0000000000 --- a/cpukit/libcsupport/include/timerdrv.h +++ /dev/null @@ -1,40 +0,0 @@ -/* timerdrv.h - * - * This file describes the Timer Driver for all boards. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __TIMER_DRIVER_h -#define __TIMER_DRIVER_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* functions */ - -void Timer_initialize( void ); - -rtems_unsigned32 Read_timer( void ); - -rtems_status_code Empty_function( void ); - -void Set_find_average_overhead( - rtems_boolean find_flag -); - -#ifdef __cplusplus -} -#endif - -#endif -/* end of include file */ diff --git a/cpukit/libcsupport/include/vmeintr.h b/cpukit/libcsupport/include/vmeintr.h deleted file mode 100644 index 6593ba12a5..0000000000 --- a/cpukit/libcsupport/include/vmeintr.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * vmeintr.h - * - * This file is the specification for the VMEbus interface library - * which should be provided by all BSPs for VMEbus Single Board - * Computers but currently only a few do so. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __VME_INTERRUPT_h -#define __VME_INTERRUPT_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * This defines the mask which is used to determine which - * interrupt levels are affected by a call to this package. - * The LSB corresponds to VME interrupt 0 and the MSB - * to VME interrupt 7. - * - */ - -typedef rtems_unsigned8 VME_interrupt_Mask; - -/* - * VME_interrupt_Disable - * - */ - -void VME_interrupt_Disable ( - VME_interrupt_Mask mask /* IN */ -); - -/* - * VME_interrupt_Disable - * - */ - -void VME_interrupt_Enable ( - VME_interrupt_Mask mask /* IN */ -); - -#ifdef __cplusplus -} -#endif - -#endif /* end of include file */ diff --git a/cpukit/libcsupport/include/zilog/z8036.h b/cpukit/libcsupport/include/zilog/z8036.h deleted file mode 100644 index 1c53c8afac..0000000000 --- a/cpukit/libcsupport/include/zilog/z8036.h +++ /dev/null @@ -1,109 +0,0 @@ -/* z8036.h - * - * This include file defines information related to a Zilog Z8036 - * Counter/Timer/IO Chip. It is a memory mapped part. - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * NOTE: This file shares as much as possible with the include - * file for the Z8536 via z8x36.h. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __Z8036_h -#define __Z8036_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* macros */ - -#define Z8036( ptr ) ((volatile struct z8036_map *)(ptr)) - -#define Z8x36_STATE0 ( z8036 ) \ - { /*char *garbage = *(Z8036(z8036))->???; */ } - - -#define Z8x36_WRITE( z8036, reg, data ) \ - (Z8036(z8036))->reg = (data) - - -#define Z8x36_READ( z8036, reg, data ) \ - (Z8036(z8036))->reg = (data) - -/* structures */ - -struct z8036_map { -/* MAIN CONTROL REGISTERS (0x00-0x07) */ - rtems_unsigned8 MASTER_INTR; /* Master Interrupt Ctl Reg */ - rtems_unsigned8 MASTER_CFG; /* Master Configuration Ctl Reg */ - rtems_unsigned8 PORTA_VECTOR; /* Port A - Interrupt Vector */ - rtems_unsigned8 PORTB_VECTOR; /* Port B - Interrupt Vector */ - rtems_unsigned8 CNT_TMR_VECTOR; /* Counter/Timer Interrupt Vector */ - rtems_unsigned8 PORTC_DATA_POLARITY; /* Port C - Data Path Polarity */ - rtems_unsigned8 PORTC_DIRECTION; /* Port C - Data Direction */ - rtems_unsigned8 PORTC_SPECIAL_IO_CTL; /* Port C - Special IO Control */ -/* MOST OFTEN ACCESSED REGISTERS (0x08 - 0x0f) */ - rtems_unsigned8 PORTA_CMD_STATUS; /* Port A - Command Status Reg */ - rtems_unsigned8 PORTB_CMD_STATUS; /* Port B - Command Status Reg */ - rtems_unsigned8 CT1_CMD_STATUS; /* Ctr/Timer 1 - Command Status Reg */ - rtems_unsigned8 CT2_CMD_STATUS; /* Ctr/Timer 2 - Command Status Reg */ - rtems_unsigned8 CT3_CMD_STATUS; /* Ctr/Timer 3 - Command Status Reg */ - rtems_unsigned8 PORTA_DATA; /* Port A - Data */ - rtems_unsigned8 PORTB_DATA; /* Port B - Data */ - rtems_unsigned8 PORTC_DATA; /* Port C - Data */ -/* COUNTER/TIMER RELATED REGISTERS (0x10-0x1f) */ - rtems_unsigned8 CT1_CUR_CNT_MSB; /* Ctr/Timer 1 - Current Count (MSB) */ - rtems_unsigned8 CT1_CUR_CNT_LSB; /* Ctr/Timer 1 - Current Count (LSB) */ - rtems_unsigned8 CT2_CUR_CNT_MSB; /* Ctr/Timer 2 - Current Count (MSB) */ - rtems_unsigned8 CT2_CUR_CNT_LSB; /* Ctr/Timer 2 - Current Count (LSB) */ - rtems_unsigned8 CT3_CUR_CNT_MSB; /* Ctr/Timer 3 - Current Count (MSB) */ - rtems_unsigned8 CT3_CUR_CNT_LSB; /* Ctr/Timer 3 - Current Count (LSB) */ - rtems_unsigned8 CT1_TIME_CONST_MSB; /* Ctr/Timer 1 - Time Constant (MSB) */ - rtems_unsigned8 CT1_TIME_CONST_LSB; /* Ctr/Timer 1 - Time Constant (LSB) */ - rtems_unsigned8 CT2_TIME_CONST_MSB; /* Ctr/Timer 2 - Time Constant (MSB) */ - rtems_unsigned8 CT2_TIME_CONST_LSB; /* Ctr/Timer 2 - Time Constant (LSB) */ - rtems_unsigned8 CT3_TIME_CONST_MSB; /* Ctr/Timer 3 - Time Constant (MSB) */ - rtems_unsigned8 CT3_TIME_CONST_LSB; /* Ctr/Timer 3 - Time Constant (LSB) */ - rtems_unsigned8 CT1_MODE_SPEC; /* Ctr/Timer 1 - Mode Specification */ - rtems_unsigned8 CT2_MODE_SPEC; /* Ctr/Timer 2 - Mode Specification */ - rtems_unsigned8 CT3_MODE_SPEC; /* Ctr/Timer 3 - Mode Specification */ - rtems_unsigned8 CURRENT_VECTOR; /* Current Vector */ -/* PORT A SPECIFICATION REGISTERS (0x20 -0x27) */ - rtems_unsigned8 PORTA_MODE; /* Port A - Mode Specification */ - rtems_unsigned8 PORTA_HANDSHAKE; /* Port A - Handshake Specification */ - rtems_unsigned8 PORTA_DATA_POLARITY; /* Port A - Data Path Polarity */ - rtems_unsigned8 PORTA_DIRECTION; /* Port A - Data Direction */ - rtems_unsigned8 PORTA_SPECIAL_IO_CTL; /* Port A - Special IO Control */ - rtems_unsigned8 PORTA_PATT_POLARITY; /* Port A - Pattern Polarity */ - rtems_unsigned8 PORTA_PATT_TRANS; /* Port A - Pattern Transition */ - rtems_unsigned8 PORTA_PATT_MASK; /* Port A - Pattern Mask */ -/* PORT B SPECIFICATION REGISTERS (0x28-0x2f) */ - rtems_unsigned8 PORTB_MODE; /* Port B - Mode Specification */ - rtems_unsigned8 PORTB_HANDSHAKE; /* Port B - Handshake Specification */ - rtems_unsigned8 PORTB_DATA_POLARITY; /* Port B - Data Path Polarity */ - rtems_unsigned8 PORTB_DIRECTION; /* Port B - Data Direction */ - rtems_unsigned8 PORTB_SPECIAL_IO_CTL; /* Port B - Special IO Control */ - rtems_unsigned8 PORTB_PATT_POLARITY; /* Port B - Pattern Polarity */ - rtems_unsigned8 PORTB_PATT_TRANS; /* Port B - Pattern Transition */ - rtems_unsigned8 PORTB_PATT_MASK; /* Port B - Pattern Mask */ -}; - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/cpukit/libcsupport/include/zilog/z8530.h b/cpukit/libcsupport/include/zilog/z8530.h deleted file mode 100644 index 60a3e3b771..0000000000 --- a/cpukit/libcsupport/include/zilog/z8530.h +++ /dev/null @@ -1,99 +0,0 @@ -/* z8530.h - * - * This include file defines information related to a Zilog Z8530 - * SCC Chip. It is a IO mapped part. - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __Z8530_h -#define __Z8530_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* macros */ - -#define VOL8( ptr ) ((volatile rtems_unsigned8 *)(ptr)) - -#define Z8x30_STATE0 ( z8530 ) \ - { char *garbage; \ - (garbage) = *(VOL8(z8530)) \ - } - -#define Z8x30_WRITE_CONTROL( z8530, reg, data ) \ - *(VOL8(z8530)) = (reg); \ - *(VOL8(z8530)) = (data) - -#define Z8x30_READ_CONTROL( z8530, reg, data ) \ - *(VOL8(z8530)) = (reg); \ - (data) = *(VOL8(z8530)) - -#define Z8x30_WRITE_DATA( z8530, data ) \ - *(VOL8(z8530)) = (data); - -#define Z8x30_READ_DATA( z8530, data ) \ - (data) = *(VOL8(z8530)); - - -/* RR_0 Bit Definitions */ - -#define RR_0_TX_BUFFER_EMPTY 0x04 -#define RR_0_RX_DATA_AVAILABLE 0x01 - -/* read registers */ - -#define RR_0 0x00 -#define RR_1 0x01 -#define RR_2 0x02 -#define RR_3 0x03 -#define RR_4 0x04 -#define RR_5 0x05 -#define RR_6 0x06 -#define RR_7 0x07 -#define RR_8 0x08 -#define RR_9 0x09 -#define RR_10 0x0A -#define RR_11 0x0B -#define RR_12 0x0C -#define RR_13 0x0D -#define RR_14 0x0E -#define RR_15 0x0F - -/* write registers */ - -#define WR_0 0x00 -#define WR_1 0x01 -#define WR_2 0x02 -#define WR_3 0x03 -#define WR_4 0x04 -#define WR_5 0x05 -#define WR_6 0x06 -#define WR_7 0x07 -#define WR_8 0x08 -#define WR_9 0x09 -#define WR_10 0x0A -#define WR_11 0x0B -#define WR_12 0x0C -#define WR_13 0x0D -#define WR_14 0x0E -#define WR_15 0x0F - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/cpukit/libcsupport/include/zilog/z8536.h b/cpukit/libcsupport/include/zilog/z8536.h deleted file mode 100644 index 0f0b5641e7..0000000000 --- a/cpukit/libcsupport/include/zilog/z8536.h +++ /dev/null @@ -1,112 +0,0 @@ -/* z8536.h - * - * This include file defines information related to a Zilog Z8536 - * Counter/Timer/IO Chip. It is a IO mapped part. - * - * Input parameters: NONE - * - * Output parameters: NONE - * - * NOTE: This file shares as much as possible with the include - * file for the Z8036 via z8x36.h. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifndef __Z8536_h -#define __Z8536_h - -#ifdef __cplusplus -extern "C" { -#endif - -/* macros */ - -#define VOL8( ptr ) ((volatile rtems_unsigned8 *)(ptr)) - -#define Z8x36_STATE0 ( z8536 ) \ - { char *garbage; \ - (garbage) = *(VOL8(z8536+0xC)) \ - } - -#define Z8x36_WRITE( z8536, reg, data ) \ - *(VOL8(z8536+0xC)) = (reg); \ - *(VOL8(z8536+0xC)) = (data) - -#define Z8x36_READ( z8536, reg, data ) \ - *(VOL8(z8536+0xC)) = (reg); \ - (data) = *(VOL8(z8536+0xC)) - -/* structures */ - -/* MAIN CONTROL REGISTERS (0x00-0x07) */ -#define MASTER_INTR 0x00 /* Master Interrupt Ctl Reg */ -#define MASTER_CFG 0x01 /* Master Configuration Ctl Reg */ -#define PORTA_VECTOR 0x02 /* Port A - Interrupt Vector */ -#define PORTB_VECTOR 0x03 /* Port B - Interrupt Vector */ -#define CNT_TMR_VECTOR 0x04 /* Counter/Timer Interrupt Vector */ -#define PORTC_DATA_POLARITY 0x05 /* Port C - Data Path Polarity */ -#define PORTC_DIRECTION 0x06 /* Port C - Data Direction */ -#define PORTC_SPECIAL_IO_CTL 0x07 /* Port C - Special IO Control */ - -/* MOST OFTEN ACCESSED REGISTERS (0x08 - 0x0f) */ -#define PORTA_CMD_STATUS 0x08 /* Port A - Command Status Reg */ -#define PORTB_CMD_STATUS 0x09 /* Port B - Command Status Reg */ -#define CT1_CMD_STATUS 0x0a /* Ctr/Timer 1 - Command Status Reg */ -#define CT2_CMD_STATUS 0x0b /* Ctr/Timer 2 - Command Status Reg */ -#define CT3_CMD_STATUS 0x0c /* Ctr/Timer 3 - Command Status Reg */ -#define PORTA_DATA 0x0d /* Port A - Data */ -#define PORTB_DATA 0x0e /* Port B - Data */ -#define PORTC_DATA 0x0f /* Port C - Data */ - -/* COUNTER/TIMER RELATED REGISTERS (0x10-0x1f) */ -#define CT1_CUR_CNT_MSB 0x10 /* Ctr/Timer 1 - Current Count (MSB) */ -#define CT1_CUR_CNT_LSB 0x11 /* Ctr/Timer 1 - Current Count (LSB) */ -#define CT2_CUR_CNT_MSB 0x12 /* Ctr/Timer 2 - Current Count (MSB) */ -#define CT2_CUR_CNT_LSB 0x13 /* Ctr/Timer 2 - Current Count (LSB) */ -#define CT3_CUR_CNT_MSB 0x14 /* Ctr/Timer 3 - Current Count (MSB) */ -#define CT3_CUR_CNT_LSB 0x15 /* Ctr/Timer 3 - Current Count (LSB) */ -#define CT1_TIME_CONST_MSB 0x16 /* Ctr/Timer 1 - Time Constant (MSB) */ -#define CT1_TIME_CONST_LSB 0x17 /* Ctr/Timer 1 - Time Constant (LSB) */ -#define CT2_TIME_CONST_MSB 0x18 /* Ctr/Timer 2 - Time Constant (MSB) */ -#define CT2_TIME_CONST_LSB 0x19 /* Ctr/Timer 2 - Time Constant (LSB) */ -#define CT3_TIME_CONST_MSB 0x1a /* Ctr/Timer 3 - Time Constant (MSB) */ -#define CT3_TIME_CONST_LSB 0x1b /* Ctr/Timer 3 - Time Constant (LSB) */ -#define CT1_MODE_SPEC 0x1c /* Ctr/Timer 1 - Mode Specification */ -#define CT2_MODE_SPEC 0x1d /* Ctr/Timer 2 - Mode Specification */ -#define CT3_MODE_SPEC 0x1e /* Ctr/Timer 3 - Mode Specification */ -#define CURRENT_VECTOR 0x1f /* Current Vector */ - -/* PORT A SPECIFICATION REGISTERS (0x20 -0x27) */ -#define PORTA_MODE 0x20 /* Port A - Mode Specification */ -#define PORTA_HANDSHAKE 0x21 /* Port A - Handshake Specification */ -#define PORTA_DATA_POLARITY 0x22 /* Port A - Data Path Polarity */ -#define PORTA_DIRECTION 0x23 /* Port A - Data Direction */ -#define PORTA_SPECIAL_IO_CTL 0x24 /* Port A - Special IO Control */ -#define PORTA_PATT_POLARITY 0x25 /* Port A - Pattern Polarity */ -#define PORTA_PATT_TRANS 0x26 /* Port A - Pattern Transition */ -#define PORTA_PATT_MASK 0x27 /* Port A - Pattern Mask */ - -/* PORT B SPECIFICATION REGISTERS (0x28-0x2f) */ -#define PORTB_MODE 0x28 /* Port B - Mode Specification */ -#define PORTB_HANDSHAKE 0x29 /* Port B - Handshake Specification */ -#define PORTB_DATA_POLARITY 0x2a /* Port B - Data Path Polarity */ -#define PORTB_DIRECTION 0x2b /* Port B - Data Direction */ -#define PORTB_SPECIAL_IO_CTL 0x2c /* Port B - Special IO Control */ -#define PORTB_PATT_POLARITY 0x2d /* Port B - Pattern Polarity */ -#define PORTB_PATT_TRANS 0x2e /* Port B - Pattern Transition */ -#define PORTB_PATT_MASK 0x2f /* Port B - Pattern Mask */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/cpukit/libcsupport/src/README b/cpukit/libcsupport/src/README deleted file mode 100644 index ee7a90501e..0000000000 --- a/cpukit/libcsupport/src/README +++ /dev/null @@ -1,37 +0,0 @@ --- --- $Id$ --- - -Overview of newlib support (newlib is from CYGNUS) - Each task can have its own libc state including: - open stdio files - strtok - multi precision arithmetic state - etc. - - This is implemented by a reentrancy data structure for each task. - - When a task is "started" (in RTEMS sense) the reentrancy structure - is allocated. Its address is stored in notepad[NOTEPAD_LAST]. - - When task is switched to, the value of global variable _impure_ptr - is changed to the value of the new tasks reentrancy structure. - - When a task is deleted - atexit() processing (for that task) happens - task's stdio buffers are flushed - - When exit(3) is called - calling task's atexit processing done - global libc state atexit processing done - (this will include any atexit routines installed by drivers) - executive is shutdown - causes a context switch back to bsp land - - -NOTE: - libc extension are installed by bsp_libc_init() - iff we are using clock interrupts. - This hack is necessary to allow the tmtests to avoid - timing the extensions. - diff --git a/cpukit/libcsupport/src/__brk.c b/cpukit/libcsupport/src/__brk.c deleted file mode 100644 index 4dab22c729..0000000000 --- a/cpukit/libcsupport/src/__brk.c +++ /dev/null @@ -1,44 +0,0 @@ -#if !defined(RTEMS_UNIX) - -/* - * RTEMS "Broken" __brk/__sbrk Implementation - * - * NOTE: sbrk is BSP provided. - * - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include <rtems.h> - -#include <signal.h> -#include <errno.h> -#include <sys/types.h> -#ifdef RTEMS_NEWLIB -#include <reent.h> -#endif -#include <unistd.h> - -/* we use RTEMS for memory management. We don't need sbrk */ - -void * __sbrk(int incr) -{ - errno = EINVAL; - return (void *)0; -} - -int __brk( const void *endds ) -{ - errno = EINVAL; - return -1; -} - -#endif diff --git a/cpukit/libcsupport/src/__gettod.c b/cpukit/libcsupport/src/__gettod.c deleted file mode 100644 index dc83c47ce4..0000000000 --- a/cpukit/libcsupport/src/__gettod.c +++ /dev/null @@ -1,118 +0,0 @@ -#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ - -#include <rtems.h> - -#if !defined(RTEMS_UNIX) -/* - * RTEMS gettimeofday Implementation - * - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#ifdef RTEMS_NEWLIB -#include <sys/reent.h> -#endif - -#include <sys/time.h> -#include <time.h> - -#include <errno.h> -#include <assert.h> - -/* - * Seconds from January 1, 1970 to January 1, 1988. Used to account for - * differences between POSIX API and RTEMS core. - */ - -#define POSIX_TIME_SECONDS_1970_THROUGH_1988 \ - (((1987 - 1970 + 1) * TOD_SECONDS_PER_NON_LEAP_YEAR) + \ - (4 * TOD_SECONDS_PER_DAY)) - -/* - * NOTE: The solaris gettimeofday does not have a second parameter. - */ - -int gettimeofday( - struct timeval *tp, - struct timezone *tzp -) -{ - rtems_interrupt_level level; - rtems_unsigned32 seconds; - rtems_unsigned32 microseconds; - - if ( !tp ) { - errno = EFAULT; - return -1; - } - - /* - * POSIX does not seem to allow for not having a TOD so we just - * grab the time of day. - * - * NOTE: XXX this routine should really be in the executive proper. - */ - - rtems_interrupt_disable(level); - seconds = _TOD_Seconds_since_epoch; - microseconds = _TOD_Current.ticks; - rtems_interrupt_enable(level); - - tp->tv_sec = seconds + POSIX_TIME_SECONDS_1970_THROUGH_1988; - tp->tv_usec = microseconds * _TOD_Microseconds_per_tick; - - /* - * newlib does not have timezone and daylight savings time - * yet. When it does this needs to be fixed. - */ - -#if 0 - if ( tzp ) { - tzp->tz_minuteswest = 0; /* at UTC */ - tzp->tz_dsttime = 0; /* no daylight savings */ - tzp->minuteswest = timezone / 60; /* from seconds to minutes */ - tzp->dsttime = daylight; - } -#endif - return 0; -} - -#if defined(RTEMS_NEWLIB) - -/* - * "Reentrant" version - */ - -int _gettimeofday_r( - struct _reent *ignored_reentrancy_stuff, - struct timeval *tp, - struct timezone *tzp -) -{ - return gettimeofday( tp, tzp ); -} - -/* - * "System call" version - */ - -int _gettimeofday( - struct timeval *tp, - struct timezone *tzp -) -{ - return gettimeofday( tp, tzp ); -} - -#endif /* defined(RTEMS_NEWLIB) */ - -#endif diff --git a/cpukit/libcsupport/src/__times.c b/cpukit/libcsupport/src/__times.c deleted file mode 100644 index 635bf8e062..0000000000 --- a/cpukit/libcsupport/src/__times.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * RTEMS _times Implementation - * - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include <rtems.h> - -#include <sys/times.h> -#include <time.h> -#include <sys/time.h> -#include <errno.h> -#include <assert.h> - -clock_t _times( - struct tms *ptms -) -{ - rtems_status_code status; - rtems_interval ticks_since_boot; - - if ( !ptms ) { - errno = EFAULT; - return -1; - } - - /* "POSIX" does not seem to allow for not having a TOD */ - status = rtems_clock_get( - RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, - &ticks_since_boot - ); - if ( status != RTEMS_SUCCESSFUL ) { - assert( 0 ); - return -1; - } - - /* - * RTEMS has no notion of system versus user time and does - * not (as of 3.2.0) keep track of CPU usage on a per task basis. - */ - - ptms->tms_utime = ticks_since_boot; - ptms->tms_stime = 0; - ptms->tms_cutime = 0; - ptms->tms_cstime = 0; - - return 0; -} - -clock_t times( - struct tms *ptms -) -{ - return _times( ptms ); -} - -#if defined(RTEMS_NEWLIB) -clock_t _times_r( - struct _reent *ptr, - struct tms *ptms -) -{ - return _times(ptms); -} -#endif diff --git a/cpukit/libcsupport/src/assoc.c b/cpukit/libcsupport/src/assoc.c deleted file mode 100644 index 74387a8c5b..0000000000 --- a/cpukit/libcsupport/src/assoc.c +++ /dev/null @@ -1,260 +0,0 @@ -/* - * assoc.c - * rtems assoc routines - * - * $Id$ - */ - -#include <rtems.h> -#include "assoc.h" - -#include <stdio.h> /* sprintf */ -#include <string.h> /* strcat, strcmp */ - -#define STREQ(a,b) (strcmp((a), (b)) == 0) -#define rtems_assoc_is_default(ap) ((ap)->name && STREQ(ap->name, RTEMS_ASSOC_DEFAULT_NAME)) - -const rtems_assoc_t * -rtems_assoc_ptr_by_name( - const rtems_assoc_t *ap, - const char *name - ) -{ - const rtems_assoc_t *default_ap = 0; - - if (rtems_assoc_is_default(ap)) - default_ap = ap++; - - for ( ; ap->name; ap++) - if (strcmp(ap->name, name) == 0) - return ap; - - return default_ap; -} - -const rtems_assoc_t * -rtems_assoc_ptr_by_local( - const rtems_assoc_t *ap, - unsigned32 local_value - ) -{ - const rtems_assoc_t *default_ap = 0; - - if (rtems_assoc_is_default(ap)) - default_ap = ap++; - - for ( ; ap->name; ap++) - if (ap->local_value == local_value) - return ap; - - return default_ap; -} - - -const rtems_assoc_t * -rtems_assoc_ptr_by_remote( - const rtems_assoc_t *ap, - unsigned32 remote_value - ) -{ - const rtems_assoc_t *default_ap = 0; - - if (rtems_assoc_is_default(ap)) - default_ap = ap++; - - for ( ; ap->name; ap++) - if (ap->remote_value == remote_value) - return ap; - - return default_ap; -} - - -/* - * Get values - */ - -unsigned32 -rtems_assoc_remote_by_local( - const rtems_assoc_t *ap, - unsigned32 local_value - ) -{ - const rtems_assoc_t *nap; - nap = rtems_assoc_ptr_by_local(ap, local_value); - if (nap) - return nap->remote_value; - - return 0; -} - -unsigned32 -rtems_assoc_local_by_remote( - const rtems_assoc_t *ap, - unsigned32 remote_value - ) -{ - const rtems_assoc_t *nap; - nap = rtems_assoc_ptr_by_remote(ap, remote_value); - if (nap) - return nap->local_value; - - return 0; -} - -unsigned32 -rtems_assoc_remote_by_name( - const rtems_assoc_t *ap, - const char *name - ) -{ - const rtems_assoc_t *nap; - nap = rtems_assoc_ptr_by_name(ap, name); - if (nap) - return nap->remote_value; - - return 0; -} - -unsigned32 -rtems_assoc_local_by_name( - const rtems_assoc_t *ap, - const char *name - ) -{ - const rtems_assoc_t *nap; - nap = rtems_assoc_ptr_by_name(ap, name); - if (nap) - return nap->local_value; - - return 0; -} - -/* - * what to return if a value is not found - * this is not reentrant, but it really shouldn't be invoked anyway - */ - -const char * -rtems_assoc_name_bad( - unsigned32 bad_value -) -{ -#ifdef RTEMS_DEBUG - static char bad_buffer[32]; - - sprintf(bad_buffer, "< %d [0x%x] >", bad_value, bad_value); -#else - static char bad_buffer[32] = "<assoc.c: BAD NAME>"; -#endif - return bad_buffer; -} - - -const char * -rtems_assoc_name_by_local( - const rtems_assoc_t *ap, - unsigned32 local_value - ) -{ - const rtems_assoc_t *nap; - nap = rtems_assoc_ptr_by_local(ap, local_value); - if (nap) - return nap->name; - - return rtems_assoc_name_bad(local_value); -} - -const char * -rtems_assoc_name_by_remote( - const rtems_assoc_t *ap, - unsigned32 remote_value - ) -{ - const rtems_assoc_t *nap; - nap = rtems_assoc_ptr_by_remote(ap, remote_value); - if (nap) - return nap->name; - - return rtems_assoc_name_bad(remote_value); -} - -/* - * Bitfield functions assume just 1 bit set in each of remote and local - * entries; they do not check for this. - */ - -unsigned32 rtems_assoc_remote_by_local_bitfield( - const rtems_assoc_t *ap, - unsigned32 local_value - ) -{ - unsigned32 b; - unsigned32 remote_value = 0; - - for (b = 1; b; b <<= 1) - if (b & local_value) - remote_value |= rtems_assoc_remote_by_local(ap, b); - - return remote_value; -} - - -unsigned32 rtems_assoc_local_by_remote_bitfield( - const rtems_assoc_t *ap, - unsigned32 remote_value - ) -{ - unsigned32 b; - unsigned32 local_value = 0; - - for (b = 1; b; b <<= 1) - if (b & remote_value) - local_value |= rtems_assoc_local_by_remote(ap, b); - - return local_value; -} - -char * -rtems_assoc_name_by_remote_bitfield( - const rtems_assoc_t *ap, - unsigned32 value, - char *buffer - ) -{ - unsigned32 b; - - *buffer = 0; - - for (b = 1; b; b <<= 1) - if (b & value) - { - if (*buffer) - strcat(buffer, " "); - strcat(buffer, rtems_assoc_name_by_remote(ap, b)); - } - - return buffer; -} - -char * -rtems_assoc_name_by_local_bitfield( - const rtems_assoc_t *ap, - unsigned32 value, - char *buffer - ) -{ - unsigned32 b; - - *buffer = 0; - - for (b = 1; b; b <<= 1) - if (b & value) - { - if (*buffer) - strcat(buffer, " "); - strcat(buffer, rtems_assoc_name_by_local(ap, b)); - } - - return buffer; -} diff --git a/cpukit/libcsupport/src/closedir.c b/cpukit/libcsupport/src/closedir.c deleted file mode 100644 index 5edb3499e6..0000000000 --- a/cpukit/libcsupport/src/closedir.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * closedir() - POSIX 1003.1b - XXX - * - * $Id$ - */ - - -#include <sys/types.h> -#include <dirent.h> -#include <stdlib.h> -#include <unistd.h> -#include <errno.h> - -int closedir( - register DIR *dirp -) -{ - errno = ENOSYS; - return -1; -} diff --git a/cpukit/libcsupport/src/error.c b/cpukit/libcsupport/src/error.c deleted file mode 100644 index dd32fb8b66..0000000000 --- a/cpukit/libcsupport/src/error.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - * report errors and panics to RTEMS' stderr. - * Currently just used by RTEMS monitor. - * - * $Id$ - */ - - -/* - * These routines provide general purpose error reporting. - * rtems_error reports an error to stderr and allows use of - * printf style formatting. A newline is appended to all messages. - * - * error_flag can be specified as any of the following: - * - * RTEMS_ERROR_ERRNO -- include errno text in output - * RTEMS_ERROR_PANIC -- halts local system after output - * RTEMS_ERROR_ABORT -- abort after output - * - * It can also include a rtems_status value which can be OR'd - * with the above flags. * - * - * EXAMPLE - * #include <rtems.h> - * #include <rtems/error.h> - * rtems_error(0, "stray interrupt %d", intr); - * - * EXAMPLE - * if ((status = rtems_task_create(...)) != RTEMS_SUCCCESSFUL) - * { - * rtems_error(status | RTEMS_ERROR_ABORT, - * "could not create task"); - * } - * - * EXAMPLE - * if ((fd = open(pathname, O_RDNLY)) < 0) - * { - * rtems_error(RTEMS_ERROR_ERRNO, "open of '%s' failed", pathname); - * goto failed; - * } - */ - -#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ -#include <rtems.h> - -#include "error.h" -#include <rtems/assoc.h> - -#include <stdio.h> -#include <stdarg.h> -#include <errno.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> /* _exit() */ - -/* bug in hpux <errno.h>: no prototypes unless you are C++ */ -#ifdef hpux9 -char *strerror(int); -#endif - -extern char *rtems_progname; -int rtems_panic_in_progress; - -rtems_assoc_t rtems_status_assoc[] = { - { "successful completion", RTEMS_SUCCESSFUL, }, - { "returned from a thread", RTEMS_TASK_EXITTED, }, - { "multiprocessing not configured", RTEMS_MP_NOT_CONFIGURED, }, - { "invalid object name", RTEMS_INVALID_NAME, }, - { "invalid object id", RTEMS_INVALID_ID, }, - { "too many", RTEMS_TOO_MANY, }, - { "timed out waiting", RTEMS_TIMEOUT, }, - { "object deleted while waiting", RTEMS_OBJECT_WAS_DELETED, }, - { "specified size was invalid", RTEMS_INVALID_SIZE, }, - { "address specified is invalid", RTEMS_INVALID_ADDRESS, }, - { "number was invalid", RTEMS_INVALID_NUMBER, }, - { "item has not been initialized", RTEMS_NOT_DEFINED, }, - { "resources still outstanding", RTEMS_RESOURCE_IN_USE, }, - { "request not satisfied", RTEMS_UNSATISFIED, }, - { "thread is in wrong state", RTEMS_INCORRECT_STATE, }, - { "thread already in state", RTEMS_ALREADY_SUSPENDED, }, - { "illegal on calling thread", RTEMS_ILLEGAL_ON_SELF, }, - { "illegal for remote object", RTEMS_ILLEGAL_ON_REMOTE_OBJECT, }, - { "called from wrong environment", RTEMS_CALLED_FROM_ISR, }, - { "invalid thread priority", RTEMS_INVALID_PRIORITY, }, - { "invalid date/time", RTEMS_INVALID_CLOCK, }, - { "invalid node id", RTEMS_INVALID_NODE, }, - { "directive not configured", RTEMS_NOT_CONFIGURED, }, - { "not owner of resource", RTEMS_NOT_OWNER_OF_RESOURCE , }, - { "directive not implemented", RTEMS_NOT_IMPLEMENTED, }, - { "RTEMS inconsistency detected", RTEMS_INTERNAL_ERROR, }, - { "could not get enough memory", RTEMS_NO_MEMORY, }, - { "internal multiprocessing only", THREAD_STATUS_PROXY_BLOCKING, }, - { 0, 0, 0 }, -}; - - -const char * -rtems_status_text( - rtems_status_code status -) -{ - return rtems_assoc_name_by_local(rtems_status_assoc, status); -} - - -static int rtems_verror( - unsigned32 error_flag, - const char *printf_format, - va_list arglist -) -{ - int local_errno = 0; - int chars_written = 0; - rtems_status_code status; - - if (error_flag & RTEMS_ERROR_PANIC) - { - if (rtems_panic_in_progress++) - _Thread_Disable_dispatch(); /* disable task switches */ - - /* don't aggravate things */ - if (rtems_panic_in_progress > 2) - return 0; - } - - (void) fflush(stdout); /* in case stdout/stderr same */ - - status = error_flag & ~RTEMS_ERROR_MASK; - if (error_flag & RTEMS_ERROR_ERRNO) /* include errno? */ - local_errno = errno; - - if (_System_state_Is_multiprocessing) - fprintf(stderr, "[%d] ", _Configuration_MP_table->node); - - if (rtems_progname && *rtems_progname) - chars_written += fprintf(stderr, "%s: ", rtems_progname); - chars_written += vfprintf(stderr, printf_format, arglist); - - if (status) - chars_written += fprintf(stderr, " (status: %s)", rtems_status_text(status)); - - if (local_errno) - { - if ((local_errno > 0) && *strerror(local_errno)) - chars_written += fprintf(stderr, " (errno: %s)", strerror(local_errno)); - else - chars_written += fprintf(stderr, " (unknown errno=%d)", local_errno); - } - - chars_written += fprintf(stderr, "\n"); - - (void) fflush(stderr); - - if (error_flag & (RTEMS_ERROR_PANIC | RTEMS_ERROR_ABORT)) - { - if (error_flag & RTEMS_ERROR_PANIC) - { - rtems_error(0, "fatal error, exiting"); - _exit(local_errno); - } - else - { - rtems_error(0, "fatal error, aborting"); - abort(); - } - } - return chars_written; -} - - -/* - * Report an error. - * error_flag is as above; printf_format is a normal - * printf(3) format string, with its concommitant arguments. - * - * Returns the number of characters written. - */ - -int rtems_error( - int error_flag, - const char *printf_format, - ... - ) -{ - va_list arglist; - int chars_written; - - va_start(arglist, printf_format); - chars_written = rtems_verror(error_flag, printf_format, arglist); - va_end(arglist); - - return chars_written; -} - -/* - * rtems_panic is shorthand for rtems_error(RTEMS_ERROR_PANIC, ...) - */ - -void rtems_panic( - const char *printf_format, - ... - ) -{ - va_list arglist; - - va_start(arglist, printf_format); - (void) rtems_verror(RTEMS_ERROR_PANIC, printf_format, arglist); - va_end(arglist); -} diff --git a/cpukit/libcsupport/src/getdents.c b/cpukit/libcsupport/src/getdents.c deleted file mode 100644 index 9b16d82409..0000000000 --- a/cpukit/libcsupport/src/getdents.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Just enough to make newlib return an error. - * - * $Id$ - */ - -int getdents( - int fd, - void *buf, - int len -) -{ - return -1; -} diff --git a/cpukit/libcsupport/src/hosterr.c b/cpukit/libcsupport/src/hosterr.c deleted file mode 100644 index a55e4a7e84..0000000000 --- a/cpukit/libcsupport/src/hosterr.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Routines to access a host errno - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include <rtems.h> -#include <errno.h> - -int host_errno(void); - -/* - * copy host errno, if any to thread aware errno, if any - */ - -void fix_syscall_errno(void) -{ - errno = host_errno(); -} - -/* - * Get the host system errno, if any - * When using newlib (or possibly other libc's) on top of UNIX - * the errno returned by system calls may be unavailable due - * to trickery of making errno thread aware. - * This provides a kludge of getting at it. - */ - -#undef errno -extern int errno; -int host_errno(void) -{ - return errno; -} - diff --git a/cpukit/libcsupport/src/libio.c b/cpukit/libcsupport/src/libio.c deleted file mode 100644 index 12682c1190..0000000000 --- a/cpukit/libcsupport/src/libio.c +++ /dev/null @@ -1,524 +0,0 @@ -/* - * Provide UNIX/POSIX-like io system calls for RTEMS using the - * RTEMS IO manager - * - * $Id$ - */ - -#include <rtems.h> -#include <rtems/assoc.h> /* assoc.h not included by rtems.h */ - -#include <stdio.h> /* O_RDONLY, et.al. */ -#include <fcntl.h> /* O_RDONLY, et.al. */ -#include <assert.h> - -#if ! defined(O_NDELAY) -# if defined(solaris2) -# define O_NDELAY O_NONBLOCK -# elif defined(RTEMS_NEWLIB) -# define O_NDELAY _FNBIO -# endif -#endif - - -#include <errno.h> -#include <string.h> /* strcmp */ -#include <unistd.h> -#include <stdlib.h> /* calloc() */ - -#include "libio.h" /* libio.h not pulled in by rtems */ - -/* - * Semaphore to protect the io table - */ - -Objects_Id rtems_libio_semaphore; - -#define RTEMS_LIBIO_SEM rtems_build_name('L', 'B', 'I', 'O') -#define RTEMS_LIBIO_IOP_SEM(n) rtems_build_name('L', 'B', 'I', n) - -extern unsigned32 rtems_libio_number_iops; -rtems_libio_t *rtems_libio_iops; -rtems_libio_t *rtems_libio_last_iop; - -#define rtems_libio_iop(fd) ((((unsigned32)(fd)) < rtems_libio_number_iops) ? \ - &rtems_libio_iops[fd] : 0) - -#define rtems_libio_check_fd(fd) \ - do { \ - if ((unsigned32) (fd) >= rtems_libio_number_iops) \ - { \ - errno = EBADF; \ - return -1; \ - } \ - } while (0) - -#define rtems_libio_check_buffer(buffer) \ - do { \ - if ((buffer) == 0) \ - { \ - errno = EINVAL; \ - return -1; \ - } \ - } while (0) - -#define rtems_libio_check_count(count) \ - do { \ - if ((count) == 0) \ - { \ - return 0; \ - } \ - } while (0) - -#define rtems_libio_check_permissions(iop, flag) \ - do { \ - if (((iop)->flags & (flag)) == 0) \ - { \ - errno = EINVAL; \ - return -1; \ - } \ - } while (0) - -/* - * External I/O handlers - * - * Space for all possible handlers is preallocated - * to speed up dispatch to external handlers. - */ - -static rtems_libio_handler_t handlers[15]; - -void -rtems_register_libio_handler( - int handler_flag, - const rtems_libio_handler_t *handler -) -{ - int handler_index = rtems_file_descriptor_type_index(handler_flag); - - if ((handler_index < 0) || (handler_index >= 15)) - rtems_fatal_error_occurred( RTEMS_INVALID_NUMBER ); - handlers[handler_index] = *handler; -} - -/* - * Called by bsp startup code to init the libio area. - */ - -void -rtems_libio_init(void) -{ - rtems_status_code rc; - - if (rtems_libio_number_iops > 0) - { - rtems_libio_iops = (rtems_libio_t *) calloc(rtems_libio_number_iops, - sizeof(rtems_libio_t)); - if (rtems_libio_iops == NULL) - rtems_fatal_error_occurred(RTEMS_NO_MEMORY); - - rtems_libio_last_iop = rtems_libio_iops + (rtems_libio_number_iops - 1); - } - - rc = rtems_semaphore_create( - RTEMS_LIBIO_SEM, - 1, - RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY, - RTEMS_NO_PRIORITY, - &rtems_libio_semaphore - ); - if (rc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred(rc); -} - -/* - * Convert RTEMS status to a UNIX errno - */ - -rtems_assoc_t errno_assoc[] = { - { "OK", RTEMS_SUCCESSFUL, 0 }, - { "BUSY", RTEMS_RESOURCE_IN_USE, EBUSY }, - { "INVALID NAME", RTEMS_INVALID_NAME, EINVAL }, - { "NOT IMPLEMENTED", RTEMS_NOT_IMPLEMENTED, ENOSYS }, - { "TIMEOUT", RTEMS_TIMEOUT, ETIMEDOUT }, - { "NO MEMORY", RTEMS_NO_MEMORY, ENOMEM }, - { "NO DEVICE", RTEMS_UNSATISFIED, ENODEV }, - { "INVALID NUMBER", RTEMS_INVALID_NUMBER, EBADF}, - { "NOT RESOURCE OWNER", RTEMS_NOT_OWNER_OF_RESOURCE, EPERM}, - { "IO ERROR", RTEMS_IO_ERROR, EIO}, - { 0, 0, 0 }, -}; - -static unsigned32 -rtems_libio_errno(rtems_status_code code) -{ - int rc; - - if ((rc = rtems_assoc_remote_by_local(errno_assoc, (unsigned32) code))) - { - errno = rc; - return -1; - } - return -1; -} - -/* - * Convert UNIX fnctl(2) flags to ones that RTEMS drivers understand - */ - -rtems_assoc_t access_modes_assoc[] = { - { "READ", LIBIO_FLAGS_READ, O_RDONLY }, - { "WRITE", LIBIO_FLAGS_WRITE, O_WRONLY }, - { "READ/WRITE", LIBIO_FLAGS_READ_WRITE, O_RDWR }, - { 0, 0, 0 }, -}; - -rtems_assoc_t status_flags_assoc[] = { - { "NO DELAY", LIBIO_FLAGS_NO_DELAY, O_NDELAY }, - { "APPEND", LIBIO_FLAGS_APPEND, O_APPEND }, - { "CREATE", LIBIO_FLAGS_CREATE, O_CREAT }, - { 0, 0, 0 }, -}; - -static unsigned32 -rtems_libio_fcntl_flags(unsigned32 fcntl_flags) -{ - unsigned32 flags = 0; - unsigned32 access_modes; - - /* - * Access mode is a small integer - */ - - access_modes = fcntl_flags & O_ACCMODE; - fcntl_flags &= ~O_ACCMODE; - flags = rtems_assoc_local_by_remote(access_modes_assoc, access_modes); - - /* - * Everything else is single bits - */ - - flags |= rtems_assoc_local_by_remote_bitfield(status_flags_assoc, fcntl_flags); - return flags; -} - - -static rtems_libio_t * -rtems_libio_allocate(void) -{ - rtems_libio_t *iop; - rtems_status_code rc; - - rtems_semaphore_obtain(rtems_libio_semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - - for (iop = rtems_libio_iops; iop <= rtems_libio_last_iop; iop++) - if ((iop->flags & LIBIO_FLAGS_OPEN) == 0) - { - /* - * Got one; create a semaphore for it - */ - - rc = rtems_semaphore_create( - RTEMS_LIBIO_IOP_SEM(iop - rtems_libio_iops), - 1, - RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY, - RTEMS_NO_PRIORITY, - &iop->sem - ); - if (rc != RTEMS_SUCCESSFUL) - goto failed; - - iop->flags = LIBIO_FLAGS_OPEN; - goto done; - } - -failed: - iop = 0; - -done: - rtems_semaphore_release(rtems_libio_semaphore); - return iop; -} - -static void -rtems_libio_free(rtems_libio_t *iop) -{ - rtems_semaphore_obtain(rtems_libio_semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - - if (iop->sem) - rtems_semaphore_delete(iop->sem); - (void) memset(iop, 0, sizeof(*iop)); - - rtems_semaphore_release(rtems_libio_semaphore); -} - -int -__rtems_open( - const char *pathname, - unsigned32 flag, - unsigned32 mode) -{ - rtems_status_code rc; - rtems_libio_t *iop = 0; - rtems_driver_name_t *np; - rtems_libio_open_close_args_t args; - - /* - * Additional external I/O handlers would be supported by - * adding code to pick apart the pathname appropriately. - * The networking code does not require changes here since - * network file descriptors are obtained using socket(), not - * open(). - */ - - if ((rc = rtems_io_lookup_name(pathname, &np)) != RTEMS_SUCCESSFUL) - goto done; - - iop = rtems_libio_allocate(); - if (iop == 0) - { - rc = RTEMS_TOO_MANY; - goto done; - } - - iop->driver = np; - iop->pathname = (char *) pathname; - iop->flags |= rtems_libio_fcntl_flags(flag); - - args.iop = iop; - args.flags = iop->flags; - args.mode = mode; - - rc = rtems_io_open(np->major, np->minor, (void *) &args); - -done: - - if (rc != RTEMS_SUCCESSFUL) - { - if (iop) - rtems_libio_free(iop); - return rtems_libio_errno(rc); - } - - return iop - rtems_libio_iops; -} - -int -__rtems_close( - int fd - ) -{ - rtems_status_code rc; - rtems_driver_name_t *np; - rtems_libio_t *iop; - rtems_libio_open_close_args_t args; - int status; - - if (rtems_file_descriptor_type(fd)) { - int (*fp)(int fd); - - fp = handlers[rtems_file_descriptor_type_index(fd)].close; - if (fp == NULL) { - errno = EBADF; - return -1; - } - status = (*fp)(fd); - return status; - } - iop = rtems_libio_iop(fd); - rtems_libio_check_fd(fd); - - np = iop->driver; - - args.iop = iop; - args.flags = 0; - args.mode = 0; - - rc = rtems_io_close(np->major, np->minor, (void *) &args); - - rtems_libio_free(iop); - - if (rc != RTEMS_SUCCESSFUL) - return rtems_libio_errno(rc); - return 0; -} - -int -__rtems_read( - int fd, - void * buffer, - unsigned32 count - ) -{ - rtems_status_code rc; - rtems_driver_name_t *np; - rtems_libio_t *iop; - rtems_libio_rw_args_t args; - - if (rtems_file_descriptor_type(fd)) { - int (*fp)(int fd, void *buffer, unsigned32 count); - - fp = handlers[rtems_file_descriptor_type_index(fd)].read; - if (fp == NULL) { - errno = EBADF; - return -1; - } - return (*fp)(fd, buffer, count); - } - iop = rtems_libio_iop(fd); - rtems_libio_check_fd(fd); - rtems_libio_check_buffer(buffer); - rtems_libio_check_count(count); - rtems_libio_check_permissions(iop, LIBIO_FLAGS_READ); - - np = iop->driver; - - args.iop = iop; - args.offset = iop->offset; - args.buffer = buffer; - args.count = count; - args.flags = iop->flags; - args.bytes_moved = 0; - - rc = rtems_io_read(np->major, np->minor, (void *) &args); - - iop->offset += args.bytes_moved; - - if (rc != RTEMS_SUCCESSFUL) - return rtems_libio_errno(rc); - - return args.bytes_moved; -} - -int -__rtems_write( - int fd, - const void *buffer, - unsigned32 count - ) -{ - rtems_status_code rc; - rtems_driver_name_t *np; - rtems_libio_t *iop; - rtems_libio_rw_args_t args; - - if (rtems_file_descriptor_type(fd)) { - int (*fp)(int fd, const void *buffer, unsigned32 count); - - fp = handlers[rtems_file_descriptor_type_index(fd)].write; - if (fp == NULL) { - errno = EBADF; - return -1; - } - return (*fp)(fd, buffer, count); - } - iop = rtems_libio_iop(fd); - rtems_libio_check_fd(fd); - rtems_libio_check_buffer(buffer); - rtems_libio_check_count(count); - rtems_libio_check_permissions(iop, LIBIO_FLAGS_WRITE); - - np = iop->driver; - - args.iop = iop; - args.offset = iop->offset; - args.buffer = (void *) buffer; - args.count = count; - args.flags = iop->flags; - args.bytes_moved = 0; - - rc = rtems_io_write(np->major, np->minor, (void *) &args); - - iop->offset += args.bytes_moved; - - if (rc != RTEMS_SUCCESSFUL) - return rtems_libio_errno(rc); - - return args.bytes_moved; -} - -int -__rtems_ioctl( - int fd, - unsigned32 command, - void * buffer) -{ - rtems_status_code rc; - rtems_driver_name_t *np; - rtems_libio_t *iop; - rtems_libio_ioctl_args_t args; - - if (rtems_file_descriptor_type(fd)) { - int (*fp)(int fd, unsigned32 command, void *buffer); - - fp = handlers[rtems_file_descriptor_type_index(fd)].ioctl; - if (fp == NULL) { - errno = EBADF; - return -1; - } - return (*fp)(fd, command, buffer); - } - iop = rtems_libio_iop(fd); - rtems_libio_check_fd(fd); - - np = iop->driver; - - args.iop = iop; - args.command = command; - args.buffer = buffer; - - rc = rtems_io_control(np->major, np->minor, (void *) &args); - - if (rc != RTEMS_SUCCESSFUL) - return rtems_libio_errno(rc); - - return args.ioctl_return; -} - -/* - * internal only?? - */ - - -int -__rtems_lseek( - int fd, - rtems_libio_offset_t offset, - int whence - ) -{ - rtems_libio_t *iop; - - if (rtems_file_descriptor_type(fd)) { - int (*fp)(int fd, rtems_libio_offset_t offset, int whence); - - fp = handlers[rtems_file_descriptor_type_index(fd)].lseek; - if (fp == NULL) { - errno = EBADF; - return -1; - } - return (*fp)(fd, offset, whence); - } - iop = rtems_libio_iop(fd); - rtems_libio_check_fd(fd); - - switch (whence) - { - case SEEK_SET: - iop->offset = offset; - break; - - case SEEK_CUR: - iop->offset += offset; - break; - - case SEEK_END: - iop->offset = iop->size - offset; - break; - - default: - errno = EINVAL; - return -1; - } - return 0; -} diff --git a/cpukit/libcsupport/src/malloc.c b/cpukit/libcsupport/src/malloc.c deleted file mode 100644 index fac38585a7..0000000000 --- a/cpukit/libcsupport/src/malloc.c +++ /dev/null @@ -1,424 +0,0 @@ -/* - * RTEMS Malloc Family Implementation - * - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ -#include <rtems.h> -#include "libcsupport.h" -#ifdef RTEMS_NEWLIB -#include <sys/reent.h> -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <sys/types.h> -#include <assert.h> -#include <errno.h> -#include <string.h> - -/* for sbrk prototype in linux */ -#if defined(__linux__) -#define __USE_MISC -#endif -#include <unistd.h> /* sbrk(2) */ - -rtems_id RTEMS_Malloc_Heap; -size_t RTEMS_Malloc_Sbrk_amount; - -extern rtems_cpu_table Cpu_table; -#ifdef RTEMS_DEBUG -#define MALLOC_STATS -#define MALLOC_DIRTY -#endif - -#ifdef MALLOC_STATS -#define MSBUMP(f,n) rtems_malloc_stats.f += (n) - -struct { - unsigned32 space_available; /* current size of malloc area */ - unsigned32 malloc_calls; /* # calls to malloc */ - unsigned32 free_calls; - unsigned32 realloc_calls; - unsigned32 calloc_calls; - unsigned32 max_depth; /* most ever malloc'd at 1 time */ - unsigned64 lifetime_allocated; - unsigned64 lifetime_freed; -} rtems_malloc_stats; - -#else /* No rtems_malloc_stats */ -#define MSBUMP(f,n) -#endif - -void RTEMS_Malloc_Initialize( - void *start, - size_t length, - size_t sbrk_amount -) -{ - rtems_status_code status; - void *starting_address; - rtems_unsigned32 old_address; - rtems_unsigned32 u32_address; - - /* - * If the starting address is 0 then we are to attempt to - * get length worth of memory using sbrk. Make sure we - * align the address that we get back. - */ - - starting_address = start; - RTEMS_Malloc_Sbrk_amount = sbrk_amount; - - if (!starting_address) { - u32_address = (unsigned int)sbrk(length); - - if (u32_address == (rtems_unsigned32) -1) { - rtems_fatal_error_occurred( RTEMS_NO_MEMORY ); - /* DOES NOT RETURN!!! */ - } - - if (u32_address & (CPU_ALIGNMENT-1)) { - old_address = u32_address; - u32_address = (u32_address + CPU_ALIGNMENT) & ~(CPU_ALIGNMENT-1); - - /* - * adjust the length by whatever we aligned by - */ - - length -= u32_address - old_address; - } - - starting_address = (void *)u32_address; - } - - /* - * If the BSP is not clearing out the workspace, then it is most likely - * not clearing out the initial memory for the heap. There is no - * standard supporting zeroing out the heap memory. But much code - * with UNIX history seems to assume that memory malloc'ed during - * initialization (before any free's) is zero'ed. This is true most - * of the time under UNIX because zero'ing memory when it is first - * given to a process eliminates the chance of a process seeing data - * left over from another process. This would be a security violation. - */ - - if ( Cpu_table.do_zero_of_workspace ) - memset( starting_address, 0, length ); - - /* - * Unfortunately we cannot use assert if this fails because if this - * has failed we do not have a heap and if we do not have a heap - * STDIO cannot work because there will be no buffers. - */ - - status = rtems_region_create( - rtems_build_name( 'H', 'E', 'A', 'P' ), - starting_address, - length, - CPU_ALIGNMENT, - RTEMS_DEFAULT_ATTRIBUTES, - &RTEMS_Malloc_Heap - ); - if ( status != RTEMS_SUCCESSFUL ) - rtems_fatal_error_occurred( status ); - -#ifdef MALLOC_STATS - /* zero all the stats */ - (void) memset(&rtems_malloc_stats, 0, sizeof(rtems_malloc_stats)); -#endif - - MSBUMP(space_available, length); -} - -#ifdef RTEMS_NEWLIB -void *malloc( - size_t size -) -{ - void *return_this; - void *starting_address; - rtems_unsigned32 the_size; - rtems_unsigned32 sbrk_amount; - rtems_status_code status; - - MSBUMP(malloc_calls, 1); - - if ( !size ) - return (void *) 0; - - /* - * Try to give a segment in the current region if there is not - * enough space then try to grow the region using rtems_region_extend(). - * If this fails then return a NULL pointer. - */ - - status = rtems_region_get_segment( - RTEMS_Malloc_Heap, - size, - RTEMS_NO_WAIT, - RTEMS_NO_TIMEOUT, - &return_this - ); - - if ( status != RTEMS_SUCCESSFUL ) { - /* - * Round to the "requested sbrk amount" so hopefully we won't have - * to grow again for a while. This effectively does sbrk() calls - * in "page" amounts. - */ - - sbrk_amount = RTEMS_Malloc_Sbrk_amount; - - if ( sbrk_amount == 0 ) - return (void *) 0; - - the_size = ((size + sbrk_amount) / sbrk_amount * sbrk_amount); - - if (((rtems_unsigned32)starting_address = (void *)sbrk(the_size)) - == (rtems_unsigned32) -1) - return (void *) 0; - - status = rtems_region_extend( - RTEMS_Malloc_Heap, - starting_address, - the_size - ); - if ( status != RTEMS_SUCCESSFUL ) { - sbrk(-the_size); - errno = ENOMEM; - return (void *) 0; - } - - MSBUMP(space_available, the_size); - - status = rtems_region_get_segment( - RTEMS_Malloc_Heap, - size, - RTEMS_NO_WAIT, - RTEMS_NO_TIMEOUT, - &return_this - ); - if ( status != RTEMS_SUCCESSFUL ) { - errno = ENOMEM; - return (void *) 0; - } - } - -#ifdef MALLOC_STATS - if (return_this) - { - unsigned32 actual_size; - unsigned32 current_depth; - status = rtems_region_get_segment_size(RTEMS_Malloc_Heap, return_this, &actual_size); - MSBUMP(lifetime_allocated, actual_size); - current_depth = rtems_malloc_stats.lifetime_allocated - rtems_malloc_stats.lifetime_freed; - if (current_depth > rtems_malloc_stats.max_depth) - rtems_malloc_stats.max_depth = current_depth; - } -#endif - -#ifdef MALLOC_DIRTY - (void) memset(return_this, 0xCF, size); -#endif - - return return_this; -} - -void *calloc( - size_t nelem, - size_t elsize -) -{ - register char *cptr; - int length; - - MSBUMP(calloc_calls, 1); - - length = nelem * elsize; - cptr = malloc( length ); - if ( cptr ) - memset( cptr, '\0', length ); - - MSBUMP(malloc_calls, -1); /* subtract off the malloc */ - - return cptr; -} - -void *realloc( - void *ptr, - size_t size -) -{ - rtems_unsigned32 old_size; - rtems_status_code status; - char *new_area; - - MSBUMP(realloc_calls, 1); - - if ( !ptr ) - return malloc( size ); - - if ( !size ) { - free( ptr ); - return (void *) 0; - } - - new_area = malloc( size ); - - MSBUMP(malloc_calls, -1); /* subtract off the malloc */ - - if ( !new_area ) { - free( ptr ); - return (void *) 0; - } - - status = rtems_region_get_segment_size( RTEMS_Malloc_Heap, ptr, &old_size ); - if ( status != RTEMS_SUCCESSFUL ) { - errno = EINVAL; - return (void *) 0; - } - - memcpy( new_area, ptr, (size < old_size) ? size : old_size ); - free( ptr ); - - return new_area; - -} - -void free( - void *ptr -) -{ - rtems_status_code status; - - MSBUMP(free_calls, 1); - - if ( !ptr ) - return; - -#ifdef MALLOC_STATS - { - unsigned32 size; - status = rtems_region_get_segment_size( RTEMS_Malloc_Heap, ptr, &size ); - if ( status == RTEMS_SUCCESSFUL ) { - MSBUMP(lifetime_freed, size); - } - } -#endif - - status = rtems_region_return_segment( RTEMS_Malloc_Heap, ptr ); - if ( status != RTEMS_SUCCESSFUL ) { - errno = EINVAL; - assert( 0 ); - } -} -/* end if RTEMS_NEWLIB */ -#endif - -#ifdef MALLOC_STATS -/* - * Dump the malloc statistics - * May be called via atexit() (installable by our bsp) or - * at any time by user - */ - -void malloc_dump(void) -{ - unsigned32 allocated = rtems_malloc_stats.lifetime_allocated - rtems_malloc_stats.lifetime_freed; - - printf("Malloc stats\n"); - printf(" avail:%uk allocated:%uk (%d%%) max:%uk (%d%%) lifetime:%Luk freed:%Luk\n", - (unsigned int) rtems_malloc_stats.space_available / 1024, - (unsigned int) allocated / 1024, - /* avoid float! */ - (allocated * 100) / rtems_malloc_stats.space_available, - (unsigned int) rtems_malloc_stats.max_depth / 1024, - (rtems_malloc_stats.max_depth * 100) / rtems_malloc_stats.space_available, - (unsigned64) rtems_malloc_stats.lifetime_allocated / 1024, - (unsigned64) rtems_malloc_stats.lifetime_freed / 1024); - printf(" Call counts: malloc:%d free:%d realloc:%d calloc:%d\n", - rtems_malloc_stats.malloc_calls, - rtems_malloc_stats.free_calls, - rtems_malloc_stats.realloc_calls, - rtems_malloc_stats.calloc_calls); -} - - -void malloc_walk(size_t source, size_t printf_enabled) -{ - register Region_Control *the_region; - Objects_Locations location; - - the_region = _Region_Get( RTEMS_Malloc_Heap, &location ); - if ( location == OBJECTS_LOCAL ) - { - _Heap_Walk( &the_region->Memory, source, printf_enabled ); - _Thread_Enable_dispatch(); - } -} - -#else - -void malloc_dump(void) -{ - return; -} - -void malloc_walk(size_t source, size_t printf_enabled) -{ - return; -} - -#endif - -/* - * "Reentrant" versions of the above routines implemented above. - */ - -#ifdef RTEMS_NEWLIB -void *_malloc_r( - struct _reent *ignored, - size_t size -) -{ - return malloc( size ); -} - -void *_calloc_r( - struct _reent *ignored, - size_t nelem, - size_t elsize -) -{ - return calloc( nelem, elsize ); -} - -void *_realloc_r( - struct _reent *ignored, - void *ptr, - size_t size -) -{ - return realloc( ptr, size ); -} - -void _free_r( - struct _reent *ignored, - void *ptr -) -{ - free( ptr ); -} -#endif - diff --git a/cpukit/libcsupport/src/newlibc.c b/cpukit/libcsupport/src/newlibc.c deleted file mode 100644 index a6acc1c8d7..0000000000 --- a/cpukit/libcsupport/src/newlibc.c +++ /dev/null @@ -1,429 +0,0 @@ - -/* - * COPYRIGHT (c) 1994 by Division Incorporated - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * Description: - * Implementation of hooks for the CYGNUS newlib libc - * These hooks set things up so that: - * '_REENT' is switched at task switch time. - * - * - * TODO: - * - * NOTE: - * - * $Id$ - * - */ - -#define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ -#include <rtems.h> - -#if defined(RTEMS_NEWLIB) -#include <libcsupport.h> -#include <stdlib.h> /* for free() */ -#include <string.h> /* for memset() */ - -#include <sys/reent.h> /* for extern of _REENT (aka _impure_ptr) */ -#include <errno.h> - -/* - * NOTE: - * There is some problem with doing this on the hpux version - * of the UNIX simulator (symptom is printf core dumps), so - * we just don't for now. - * Not sure if this is a problem with hpux, newlib, or something else. - */ - -#if defined(RTEMS_UNIX) && !defined(hpux) -#define NEED_SETVBUF -#endif - -#ifdef NEED_SETVBUF -#include <stdio.h> -#endif - -#include "internal.h" - -#define LIBC_NOTEPAD RTEMS_NOTEPAD_LAST - - -int libc_reentrant; /* do we think we are reentrant? */ -struct _reent libc_global_reent = _REENT_INIT(libc_global_reent); - -/* - * CYGNUS newlib routine that does atexit() processing and flushes - * stdio streams - * undocumented - */ - -extern void _wrapup_reent(struct _reent *); -extern void _reclaim_reent(struct _reent *); - -#include <stdio.h> - -void -libc_wrapup(void) -{ - /* - * In case RTEMS is already down, don't do this. It could be - * dangerous. - */ - - if (!_System_state_Is_up(_System_state_Get())) - return; - - _wrapup_reent(0); - if (_REENT != &libc_global_reent) - { - _wrapup_reent(&libc_global_reent); -#if 0 - /* don't reclaim this one, just in case we do printfs */ - /* on our way out to ROM */ - _reclaim_reent(&libc_global_reent); -#endif - _REENT = &libc_global_reent; - } - - /* - * Try to drain output buffers. - * - * Should this be changed to do *all* file streams? - * _fwalk (_REENT, fclose); - */ - fclose (stdin); - fclose (stdout); - fclose (stderr); -} - - -rtems_boolean -libc_create_hook(rtems_tcb *current_task, - rtems_tcb *creating_task) -{ - MY_task_set_note(creating_task, LIBC_NOTEPAD, 0); - return TRUE; -} - -/* - * Called for all user TASKS (system tasks are MPCI Receive Server and IDLE) - */ - -rtems_extension -libc_start_hook(rtems_tcb *current_task, - rtems_tcb *starting_task) -{ - struct _reent *ptr; - - /* NOTE: our malloc is reentrant without a reent ptr since - * it is based on region manager - */ - - ptr = (struct _reent *) calloc(1, sizeof(struct _reent)); - - if (!ptr) - rtems_fatal_error_occurred(RTEMS_NO_MEMORY); - -#ifdef __GNUC__ - /* GCC extension: structure constants */ - *ptr = (struct _reent) _REENT_INIT((*ptr)); -#else - /* - * Warning: THIS IS VERY DEPENDENT ON NEWLIB!!! WRITTEN FOR 1.7.0 - */ - ptr->_errno=0; - ptr->_stdin=&ptr->__sf[0]; - ptr->_stdout=&ptr->__sf[1]; - ptr->_stderr=&ptr->__sf[2]; - ptr->_scanpoint=0; - ptr->_asctime[0]=0; - ptr->_next=1; - ptr->__sdidinit=0; -#endif - - MY_task_set_note(starting_task, LIBC_NOTEPAD, (rtems_unsigned32) ptr); -} - -/* - * Called for all user TASKS (system tasks are MPCI Receive Server and IDLE) - */ - -#ifdef NEED_SETVBUF -rtems_extension -libc_begin_hook(rtems_tcb *current_task) -{ - setvbuf( stdout, NULL, _IOLBF, BUFSIZ ); -} -#endif - -rtems_extension -libc_switch_hook(rtems_tcb *current_task, - rtems_tcb *heir_task) -{ - rtems_unsigned32 impure_value; - - /* XXX We can't use rtems_task_set_note() here since SYSI task has a - * tid of 0, which is treated specially (optimized, actually) - * by rtems_task_set_note - * - * NOTE: The above comment is no longer true and we need to use - * the extension data areas added about the same time. - */ - - /* - * Don't touch the outgoing task if it has been deleted. - */ - - if ( !_States_Is_transient( current_task->current_state ) ) { - impure_value = (rtems_unsigned32) _REENT; - MY_task_set_note(current_task, LIBC_NOTEPAD, impure_value); - } - - _REENT = (struct _reent *) MY_task_get_note(heir_task, LIBC_NOTEPAD); - -} - -/* - * Function: libc_delete_hook - * Created: 94/12/10 - * - * Description: - * Called when a task is deleted. - * Must restore the new lib reentrancy state for the new current - * task. - * - * Parameters: - * - * - * Returns: - * - * - * Side Effects: - * - * Notes: - * - * - * Deficiencies/ToDo: - * - * - */ -rtems_extension -libc_delete_hook(rtems_tcb *current_task, - rtems_tcb *deleted_task) -{ - struct _reent *ptr; - - /* - * The reentrancy structure was allocated by newlib using malloc() - */ - - if (current_task == deleted_task) - { - ptr = _REENT; - } - else - { - ptr = (struct _reent *) MY_task_get_note(deleted_task, LIBC_NOTEPAD); - } - - /* if (ptr) */ - if (ptr && ptr != &libc_global_reent) - { - _wrapup_reent(ptr); - _reclaim_reent(ptr); - free(ptr); - } - - MY_task_set_note(deleted_task, LIBC_NOTEPAD, 0); - - /* - * Require the switch back to another task to install its own - */ - - if (current_task == deleted_task) - { - _REENT = 0; - } -} - -/* - * Function: libc_init - * Created: 94/12/10 - * - * Description: - * Init libc for CYGNUS newlib - * Set up _REENT to use our global libc_global_reent. - * (newlib provides a global of its own, but we prefer our - * own name for it) - * - * If reentrancy is desired (which it should be), then - * we install the task extension hooks to maintain the - * newlib reentrancy global variable _REENT on task - * create, delete, switch, exit, etc. - * - * Parameters: - * reentrant non-zero if reentrant library desired. - * - * Returns: - * - * Side Effects: - * installs libc extensions if reentrant. - * - * Notes: - * - * - * Deficiencies/ToDo: - * - */ - -void -libc_init(int reentrant) -{ - rtems_extensions_table libc_extension; - rtems_id extension_id; - rtems_status_code rc; - - _REENT = &libc_global_reent; - - if (reentrant) - { - memset(&libc_extension, 0, sizeof(libc_extension)); - - libc_extension.thread_create = libc_create_hook; - libc_extension.thread_start = libc_start_hook; -#ifdef NEED_SETVBUF - libc_extension.thread_begin = libc_begin_hook; -#endif - libc_extension.thread_switch = libc_switch_hook; - libc_extension.thread_delete = libc_delete_hook; - - rc = rtems_extension_create(rtems_build_name('L', 'I', 'B', 'C'), - &libc_extension, &extension_id); - if (rc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred(rc); - - libc_reentrant = reentrant; - } -} - -#if 0 -/* - * Routines required by the gnat runtime. - */ - -int get_errno() -{ - return errno; -} -#endif - -/* - * Function: _exit - * Created: 94/12/10 - * - * Description: - * Called from exit() after it does atexit() processing and stdio fflush's - * - * called from bottom of exit() to really delete the task. - * If we are using reentrant libc, then let the delete extension - * do all the work, otherwise if a shutdown is in progress, - * then just do it. - * - * Parameters: - * exit status - * - * Returns: - * does not return - * - * Side Effects: - * - * Notes: - * - * - * Deficiencies/ToDo: - * - * - */ - -#include <stdio.h> - -/* #if !defined(RTEMS_UNIX) && !defined(__GO32__) && !defined(_AM29K) */ -#if !defined(RTEMS_UNIX) && !defined(_AM29K) -void _exit(int status) -{ - libc_wrapup(); /* Why? XXX */ - rtems_shutdown_executive(status); -} -#else - -void exit(int status) -{ - libc_wrapup(); - rtems_shutdown_executive(status); -} -#endif - - -/* - * These are directly supported (and completely correct) in the posix api. - */ - -pid_t __getpid(void) -{ - return getpid(); -} - -/* #if !defined(RTEMS_POSIX_API) || defined(__GO32__) */ -#if !defined(RTEMS_POSIX_API) -pid_t getpid(void) -{ - return (0); -} -#endif - -/* #if !defined(RTEMS_POSIX_API) || defined(__GO32__) */ -#if !defined(RTEMS_POSIX_API) -int kill( pid_t pid, int sig ) -{ - return 0; -} -#endif - -int __kill( pid_t pid, int sig ) -{ - return 0; -} - -#if !defined(RTEMS_POSIX_API) -unsigned int sleep( - unsigned int seconds -) -{ - rtems_status_code status; - rtems_interval ticks_per_second; - rtems_interval ticks; - - status = rtems_clock_get( - RTEMS_CLOCK_GET_TICKS_PER_SECOND, - &ticks_per_second - ); - - ticks = seconds * ticks_per_second; - - status = rtems_task_wake_after( ticks ); - - /* - * Returns the "unslept" amount of time. In RTEMS signals are not - * interruptable, so tasks really sleep all of the requested time. - */ - - return 0; -} -#endif - - -#endif diff --git a/cpukit/libcsupport/src/no_libc.c b/cpukit/libcsupport/src/no_libc.c deleted file mode 100644 index 5a58ba761c..0000000000 --- a/cpukit/libcsupport/src/no_libc.c +++ /dev/null @@ -1,55 +0,0 @@ - -/* no_libc.h - * - * This file contains stubs for the reentrancy hooks when - * an unknown C library is used. - * - * COPYRIGHT (c) 1989-1998. - * On-Line Applications Research Corporation (OAR). - * Copyright assigned to U.S. Government, 1994. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - - -#include <rtems.h> -#if !defined(RTEMS_NEWLIB) && !defined(RTEMS_UNIX) - -#include "libcsupport.h" -#include "internal.h" - -#include <stdlib.h> /* for free() */ - -void -libc_init(int reentrant) -{ -} - -void libc_suspend_main(void) -{ -} - - -void libc_global_exit(rtems_unsigned32 code) -{ -} - -void _exit(int status) -{ -} - -#else - -/* remove ANSI errors. - * A program must contain at least one external-declaration - * (X3.159-1989 p.82,L3). - */ -void no_libc_dummy_function( void ) -{ -} - -#endif diff --git a/cpukit/libcsupport/src/opendir.c b/cpukit/libcsupport/src/opendir.c deleted file mode 100644 index e303eb28e5..0000000000 --- a/cpukit/libcsupport/src/opendir.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * opendir() - POSIX 1003.1b - XXX - * - * $Id$ - */ - -#include <dirent.h> -#include <fcntl.h> -#include <stdlib.h> -#include <unistd.h> - -DIR *opendir( - const char *name -) -{ - return NULL; -} diff --git a/cpukit/libcsupport/src/readdir.c b/cpukit/libcsupport/src/readdir.c deleted file mode 100644 index d592a62b99..0000000000 --- a/cpukit/libcsupport/src/readdir.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * readdir() - POSIX 1003.1b - XXX - * - * $Id$ - */ - -#include <dirent.h> - -struct dirent *readdir( - register DIR *dirp -) -{ - return NULL; -} diff --git a/cpukit/libcsupport/src/rewinddir.c b/cpukit/libcsupport/src/rewinddir.c deleted file mode 100644 index c85e6fd4d0..0000000000 --- a/cpukit/libcsupport/src/rewinddir.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * rewinddir() - POSIX 1003.1b - XXX - * - * $Id$ - */ - -#include <sys/types.h> -#include <assert.h> -#include <dirent.h> -#include <stdio.h> -#include <errno.h> -#include <unistd.h> - -void rewinddir( - DIR *dirp -) -{ - errno = ENOSYS; - return -1; -} diff --git a/cpukit/libcsupport/src/scandir.c b/cpukit/libcsupport/src/scandir.c deleted file mode 100644 index 380415dd97..0000000000 --- a/cpukit/libcsupport/src/scandir.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * scandir() - POSIX 1003.1b - XXX - * - * $Id$ - */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <dirent.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> - -int scandir( - const char *dirname, - struct dirent ***namelist, - int (*select)(struct dirent *), - int (*dcomp)(const void *, const void *) -) -{ - errno = ENOSYS; - return -1; -} diff --git a/cpukit/libcsupport/src/seekdir.c b/cpukit/libcsupport/src/seekdir.c deleted file mode 100644 index e591adbb9f..0000000000 --- a/cpukit/libcsupport/src/seekdir.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * seekdir() - POSIX 1003.1b - XXX - * - * $Id$ - */ - -#include <sys/param.h> -#include <assert.h> -#include <dirent.h> -#include <stdio.h> -#include <unistd.h> -#include <errno.h> - -void seekdir( - DIR *dirp, - long loc -) -{ - errno = ENOSYS; - return -1; -} diff --git a/cpukit/libcsupport/src/tcdrain.c b/cpukit/libcsupport/src/tcdrain.c deleted file mode 100644 index 585871cc90..0000000000 --- a/cpukit/libcsupport/src/tcdrain.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * This file contains the RTEMS implementation of the POSIX API - * routines tcdrain. - * - * $Id$ - * - */ - -#include <rtems.h> -#if defined(RTEMS_NEWLIB) - -#include <sys/types.h> -#include <sys/stat.h> -#include <errno.h> -#include <termios.h> - -#include "internal.h" -#include "libio.h" - -int -tcdrain(int fd) -{ - return __rtems_ioctl(fd,RTEMS_IO_TCDRAIN,0); -} - -#endif diff --git a/cpukit/libcsupport/src/telldir.c b/cpukit/libcsupport/src/telldir.c deleted file mode 100644 index eee8d925ec..0000000000 --- a/cpukit/libcsupport/src/telldir.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * telldir() - XXX - * - * $Id$ - */ - -#include <sys/param.h> -#include <assert.h> -#include <dirent.h> -#include <stdlib.h> -#include <unistd.h> -#include <errno.h> - -#include <rtems.h> -#include "libio.h" - -long telldir( - DIR *dirp -) -{ - errno = ENOSYS; - return -1; -} diff --git a/cpukit/libcsupport/src/termios.c b/cpukit/libcsupport/src/termios.c deleted file mode 100644 index c2a43c7707..0000000000 --- a/cpukit/libcsupport/src/termios.c +++ /dev/null @@ -1,935 +0,0 @@ -/* - * TERMIOS serial line support - * - * Author: - * W. Eric Norum - * Saskatchewan Accelerator Laboratory - * University of Saskatchewan - * Saskatoon, Saskatchewan, CANADA - * eric@skatter.usask.ca - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.OARcorp.com/rtems/license.html. - * - * $Id$ - */ - -#include <rtems.h> -#include <rtems/libio.h> -#include <ctype.h> -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <termios.h> -#include <unistd.h> - -/* - * FreeBSD does not support a full POSIX termios so we have to help it out - */ - - -#if defined(__FreeBSD__) -#define XTABS 0 -#define ONLRET 0 -#define ONOCR 0 -#define TABDLY 0 -#define OLCUC 0 -#define ILCUC 0 -#define OCRNL 0 -#define IUCLC 0 -#endif - -/* - * The size of the cooked buffer - */ -#define CBUFSIZE 256 - -/* - * The sizes of the raw message buffers. - * On most architectures it is quite a bit more - * efficient if these are powers of two. - */ -#define RAW_INPUT_BUFFER_SIZE 128 -#define RAW_OUTPUT_BUFFER_SIZE 64 - -/* - * Variables associated with each termios instance. - * One structure for each hardware I/O device. - */ -struct rtems_termios_tty { - /* - * Linked-list of active TERMIOS devices - */ - struct rtems_termios_tty *forw; - struct rtems_termios_tty *back; - - /* - * How many times has this device been opened - */ - int refcount; - - /* - * This device - */ - rtems_device_major_number major; - rtems_device_major_number minor; - - /* - * Mutual-exclusion semaphores - */ - rtems_id isem; - rtems_id osem; - - /* - * The canonical (cooked) character buffer - */ - char cbuf[CBUFSIZE]; - int ccount; - int cindex; - - /* - * Keep track of cursor (printhead) position - */ - int column; - int read_start_column; - - /* - * The ioctl settings - */ - struct termios termios; - rtems_interval vtimeTicks; - - /* - * Raw input character buffer - */ - volatile char rawInBuf[RAW_INPUT_BUFFER_SIZE]; - volatile unsigned int rawInBufHead; - volatile unsigned int rawInBufTail; - rtems_id rawInBufSemaphore; - rtems_unsigned32 rawInBufSemaphoreOptions; - rtems_interval rawInBufSemaphoreTimeout; - rtems_interval rawInBufSemaphoreFirstTimeout; - unsigned int rawInBufDropped; /* Statistics */ - - /* - * Raw output character buffer - */ - volatile char rawOutBuf[RAW_OUTPUT_BUFFER_SIZE]; - volatile unsigned int rawOutBufHead; - volatile unsigned int rawOutBufTail; - rtems_id rawOutBufSemaphore; - enum {rob_idle, rob_busy, rob_wait } rawOutBufState; - - /* - * Callbacks to device-specific routines - */ - rtems_termios_callbacks device; -}; - -static struct rtems_termios_tty *ttyHead, *ttyTail; -static rtems_id ttyMutex; - -/* - * Reserve enough resources to open every physical device once. - */ - -static int first_time; /* assumed to be zeroed by BSS initialization */ - -void -rtems_termios_reserve_resources ( - rtems_configuration_table *configuration, - rtems_unsigned32 number_of_devices - ) -{ - rtems_api_configuration_table *rtems_config; - - if (!configuration) - rtems_fatal_error_occurred (0xFFF0F001); - rtems_config = configuration->RTEMS_api_configuration; - if (!rtems_config) - rtems_fatal_error_occurred (0xFFF0F002); - if (!first_time) - rtems_config->maximum_semaphores += 1; - first_time = 1; - rtems_config->maximum_semaphores += (4 * number_of_devices); -} - -void -rtems_termios_initialize (void) -{ - rtems_status_code sc; - - /* - * Create the mutex semaphore for the tty list - */ - if (!ttyMutex) { - sc = rtems_semaphore_create ( - rtems_build_name ('T', 'R', 'm', 'i'), - 1, - RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY, - RTEMS_NO_PRIORITY, - &ttyMutex); - if (sc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred (sc); - } -} - -/* - * Open a termios device - */ -rtems_status_code -rtems_termios_open ( - rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg, - const rtems_termios_callbacks *callbacks - ) -{ - rtems_status_code sc; - rtems_libio_open_close_args_t *args = arg; - struct rtems_termios_tty *tty; - - /* - * See if the device has already been opened - */ - sc = rtems_semaphore_obtain (ttyMutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - return sc; - for (tty = ttyHead ; tty != NULL ; tty = tty->forw) { - if ((tty->major == major) && (tty->minor == minor)) - break; - } - if (tty == NULL) { - static char c = 'a'; - - /* - * Create a new device - */ - tty = calloc (1, sizeof (struct rtems_termios_tty)); - if (tty == NULL) { - rtems_semaphore_release (ttyMutex); - return RTEMS_NO_MEMORY; - } - tty->forw = ttyHead; - ttyHead = tty; - if (ttyTail == NULL) - ttyTail = tty; - - tty->minor = minor; - tty->major = major; - - /* - * Set up mutex semaphores - */ - sc = rtems_semaphore_create ( - rtems_build_name ('T', 'R', 'i', c), - 1, - RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY, - RTEMS_NO_PRIORITY, - &tty->isem); - if (sc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred (sc); - sc = rtems_semaphore_create ( - rtems_build_name ('T', 'R', 'o', c), - 1, - RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_PRIORITY, - RTEMS_NO_PRIORITY, - &tty->osem); - if (sc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred (sc); - sc = rtems_semaphore_create ( - rtems_build_name ('T', 'R', 'x', c), - 0, - RTEMS_COUNTING_SEMAPHORE | RTEMS_PRIORITY, - RTEMS_NO_PRIORITY, - &tty->rawOutBufSemaphore); - if (sc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred (sc); - tty->rawOutBufState = rob_idle; - - /* - * Set callbacks - */ - tty->device = *callbacks; - if (!tty->device.pollRead) { - sc = rtems_semaphore_create ( - rtems_build_name ('T', 'R', 'r', c), - 0, - RTEMS_COUNTING_SEMAPHORE | RTEMS_PRIORITY, - RTEMS_NO_PRIORITY, - &tty->rawInBufSemaphore); - if (sc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred (sc); - } - - /* - * Set default parameters - */ - tty->termios.c_iflag = BRKINT | ICRNL | IXON | IMAXBEL; - tty->termios.c_oflag = OPOST | ONLCR | XTABS; - tty->termios.c_cflag = B9600 | CS8 | CREAD; - tty->termios.c_lflag = ISIG | ICANON | IEXTEN | ECHO | ECHOK | ECHOE | ECHOCTL; - tty->termios.c_cc[VINTR] = '\003'; - tty->termios.c_cc[VQUIT] = '\034'; - tty->termios.c_cc[VERASE] = '\177'; - tty->termios.c_cc[VKILL] = '\025'; - tty->termios.c_cc[VEOF] = '\004'; - tty->termios.c_cc[VEOL] = '\000'; - tty->termios.c_cc[VEOL2] = '\000'; - tty->termios.c_cc[VSTART] = '\021'; - tty->termios.c_cc[VSTOP] = '\023'; - tty->termios.c_cc[VSUSP] = '\032'; - tty->termios.c_cc[VREPRINT] = '\022'; - tty->termios.c_cc[VDISCARD] = '\017'; - tty->termios.c_cc[VWERASE] = '\027'; - tty->termios.c_cc[VLNEXT] = '\026'; - - /* - * Bump name characer - */ - if (c++ == 'z') - c = 'a'; - } - args->iop->data1 = tty; - if (!tty->refcount++ && tty->device.firstOpen) - (*tty->device.firstOpen)(major, minor, arg); - rtems_semaphore_release (ttyMutex); - return RTEMS_SUCCESSFUL; -} - -/* - * Drain output queue - */ -static void -drainOutput (struct rtems_termios_tty *tty) -{ - rtems_interrupt_level level; - rtems_status_code sc; - - if (tty->device.outputUsesInterrupts) { - rtems_interrupt_disable (level); - while (tty->rawOutBufTail != tty->rawOutBufHead) { - tty->rawOutBufState = rob_wait; - rtems_interrupt_enable (level); - sc = rtems_semaphore_obtain (tty->rawOutBufSemaphore, - RTEMS_WAIT, - RTEMS_NO_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred (sc); - rtems_interrupt_disable (level); - } - rtems_interrupt_enable (level); - } -} - -rtems_status_code -rtems_termios_close (void *arg) -{ - rtems_libio_open_close_args_t *args = arg; - struct rtems_termios_tty *tty = args->iop->data1; - rtems_status_code sc; - - sc = rtems_semaphore_obtain (ttyMutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred (sc); - if (--tty->refcount == 0) { - drainOutput (tty); - if (tty->device.lastClose) - (*tty->device.lastClose)(tty->major, tty->minor, arg); - if (tty->forw == NULL) - ttyTail = tty->back; - else - tty->forw->back = tty->back; - if (tty->back == NULL) - ttyHead = tty->forw; - else - tty->back->forw = tty->forw; - rtems_semaphore_delete (tty->isem); - rtems_semaphore_delete (tty->osem); - rtems_semaphore_delete (tty->rawOutBufSemaphore); - if (!tty->device.pollRead) - rtems_semaphore_delete (tty->rawInBufSemaphore); - free (tty); - } - rtems_semaphore_release (ttyMutex); - return RTEMS_SUCCESSFUL; -} - -rtems_status_code -rtems_termios_ioctl (void *arg) -{ - rtems_libio_ioctl_args_t *args = arg; - struct rtems_termios_tty *tty = args->iop->data1; - rtems_status_code sc; - - args->ioctl_return = 0; - sc = rtems_semaphore_obtain (tty->osem, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) { - args->ioctl_return = sc; - return sc; - } - switch (args->command) { - default: - sc = RTEMS_INVALID_NUMBER; - break; - - case RTEMS_IO_GET_ATTRIBUTES: - *(struct termios *)args->buffer = tty->termios; - break; - - case RTEMS_IO_SET_ATTRIBUTES: - tty->termios = *(struct termios *)args->buffer; - if (tty->termios.c_lflag & ICANON) { - tty->rawInBufSemaphoreOptions = RTEMS_WAIT; - tty->rawInBufSemaphoreTimeout = RTEMS_NO_TIMEOUT; - tty->rawInBufSemaphoreFirstTimeout = RTEMS_NO_TIMEOUT; - } - else { - rtems_interval ticksPerSecond; - rtems_clock_get (RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticksPerSecond); - tty->vtimeTicks = tty->termios.c_cc[VTIME] * ticksPerSecond / 10; - if (tty->termios.c_cc[VTIME]) { - tty->rawInBufSemaphoreOptions = RTEMS_WAIT; - tty->rawInBufSemaphoreTimeout = tty->vtimeTicks; - if (tty->termios.c_cc[VMIN]) - tty->rawInBufSemaphoreFirstTimeout = RTEMS_NO_TIMEOUT; - else - tty->rawInBufSemaphoreFirstTimeout = tty->vtimeTicks; - } - else { - if (tty->termios.c_cc[VMIN]) { - tty->rawInBufSemaphoreOptions = RTEMS_WAIT; - tty->rawInBufSemaphoreTimeout = RTEMS_NO_TIMEOUT; - tty->rawInBufSemaphoreFirstTimeout = RTEMS_NO_TIMEOUT; - } - else { - tty->rawInBufSemaphoreOptions = RTEMS_NO_WAIT; - } - } - } - if (tty->device.setAttributes) - (*tty->device.setAttributes)(tty->minor, &tty->termios); - break; - - case RTEMS_IO_TCDRAIN: - drainOutput (tty); - break; - } - rtems_semaphore_release (tty->osem); - args->ioctl_return = sc; - return sc; -} - -/* - * Send characters to device-specific code - */ -static void -osend (const char *buf, int len, struct rtems_termios_tty *tty) -{ - unsigned int newHead; - rtems_interrupt_level level; - rtems_status_code sc; - - if (!tty->device.outputUsesInterrupts) { - (*tty->device.write)(tty->minor, buf, len); - return; - } - newHead = tty->rawOutBufHead; - while (len) { - /* - * Performance improvement could be made here. - * Copy multiple bytes to raw buffer: - * if (len > 1) && (space to buffer end, or tail > 1) - * ncopy = MIN (len, space to buffer end or tail) - * memcpy (raw buffer, buf, ncopy) - * buf += ncopy - * len -= ncopy - * - * To minimize latency, the memcpy should be done - * with interrupts enabled. - */ - newHead = (newHead + 1) % RAW_OUTPUT_BUFFER_SIZE; - rtems_interrupt_disable (level); - while (newHead == tty->rawOutBufTail) { - tty->rawOutBufState = rob_wait; - rtems_interrupt_enable (level); - sc = rtems_semaphore_obtain (tty->rawOutBufSemaphore, - RTEMS_WAIT, - RTEMS_NO_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - rtems_fatal_error_occurred (sc); - rtems_interrupt_disable (level); - } - tty->rawOutBuf[tty->rawOutBufHead] = *buf++; - tty->rawOutBufHead = newHead; - if (tty->rawOutBufState == rob_idle) { - (*tty->device.write)(tty->minor, - (char *)&tty->rawOutBuf[tty->rawOutBufTail], 1); - tty->rawOutBufState = rob_busy; - } - rtems_interrupt_enable (level); - len--; - } -} - -/* - * Handle output processing - */ -static void -oproc (unsigned char c, struct rtems_termios_tty *tty) -{ - int i; - - if (tty->termios.c_oflag & OPOST) { - switch (c) { - case '\n': - if (tty->termios.c_oflag & ONLRET) - tty->column = 0; - if (tty->termios.c_oflag & ONLCR) { - osend ("\r", 1, tty); - tty->column = 0; - } - break; - - case '\r': - if ((tty->termios.c_oflag & ONOCR) && (tty->column == 0)) - return; - if (tty->termios.c_oflag & OCRNL) { - c = '\n'; - if (tty->termios.c_oflag & ONLRET) - tty->column = 0; - break; - } - tty->column = 0; - break; - - case '\t': - i = 8 - (tty->column & 7); - if ((tty->termios.c_oflag & TABDLY) == XTABS) { - tty->column += i; - osend ( " ", i, tty); - return; - } - tty->column += i; - break; - - case '\b': - if (tty->column > 0) - tty->column--; - break; - - default: - if (tty->termios.c_oflag & OLCUC) - c = toupper(c); - if (!iscntrl(c)) - tty->column++; - break; - } - } - osend (&c, 1, tty); -} - -rtems_status_code -rtems_termios_write (void *arg) -{ - rtems_libio_rw_args_t *args = arg; - struct rtems_termios_tty *tty = args->iop->data1; - rtems_status_code sc; - - sc = rtems_semaphore_obtain (tty->osem, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - return sc; - if (tty->termios.c_oflag & OPOST) { - unsigned32 count = args->count; - unsigned8 *buffer = args->buffer; - while (count--) - oproc (*buffer++, tty); - args->bytes_moved = args->count; - } - else { - osend (args->buffer, args->count, tty); - args->bytes_moved = args->count; - } - rtems_semaphore_release (tty->osem); - return sc; -} - -/* - * Echo a typed character - */ -static void -echo (unsigned char c, struct rtems_termios_tty *tty) -{ - if ((tty->termios.c_lflag & ECHOCTL) && iscntrl(c) && (c != '\t') && (c != '\n')) { - char echobuf[2]; - - echobuf[0] = '^'; - echobuf[1] = c ^ 0x40; - osend (echobuf, 2, tty); - tty->column += 2; - } - else { - oproc (c, tty); - } -} - -/* - * Erase a character or line - * FIXME: Needs support for WERASE and ECHOPRT. - * FIXME: Some of the tests should check for IEXTEN, too. - */ -static void -erase (struct rtems_termios_tty *tty, int lineFlag) -{ - if (tty->ccount == 0) - return; - if (lineFlag) { - if (!(tty->termios.c_lflag & ECHO)) { - tty->ccount = 0; - return; - } - if (!(tty->termios.c_lflag & ECHOE)) { - tty->ccount = 0; - echo (tty->termios.c_cc[VKILL], tty); - if (tty->termios.c_lflag & ECHOK) - echo ('\n', tty); - return; - } - } - while (tty->ccount) { - unsigned char c = tty->cbuf[--tty->ccount]; - - if (tty->termios.c_lflag & ECHO) { - if (!lineFlag && !(tty->termios.c_lflag & ECHOE)) { - echo (tty->termios.c_cc[VERASE], tty); - } - else if (c == '\t') { - int col = tty->read_start_column; - int i = 0; - - /* - * Find the character before the tab - */ - while (i != tty->ccount) { - c = tty->cbuf[i++]; - if (c == '\t') { - col = (col | 7) + 1; - } - else if (iscntrl (c)) { - if (tty->termios.c_lflag & ECHOCTL) - col += 2; - } - else { - col++; - } - } - - /* - * Back up over the tab - */ - while (tty->column > col) { - osend ("\b", 1, tty); - tty->column--; - } - } - else { - if (iscntrl (c) && (tty->termios.c_lflag & ECHOCTL)) { - osend ("\b \b", 3, tty); - if (tty->column) - tty->column--; - } - if (!iscntrl (c) || (tty->termios.c_lflag & ECHOCTL)) { - osend ("\b \b", 3, tty); - if (tty->column) - tty->column--; - } - } - } - if (!lineFlag) - break; - } -} - -/* - * Process a single input character - */ -static int -iproc (unsigned char c, struct rtems_termios_tty *tty) -{ - if (tty->termios.c_iflag & ISTRIP) - c &= 0x7f; - if (tty->termios.c_iflag & IUCLC) - c = tolower (c); - if (c == '\r') { - if (tty->termios.c_iflag & IGNCR) - return 0; - if (tty->termios.c_iflag & ICRNL) - c = '\n'; - } - else if ((c == '\n') && (tty->termios.c_iflag & INLCR)) { - c = '\r'; - } - if ((c != '\0') && (tty->termios.c_lflag & ICANON)) { - if (c == tty->termios.c_cc[VERASE]) { - erase (tty, 0); - return 0; - } - else if (c == tty->termios.c_cc[VKILL]) { - erase (tty, 1); - return 0; - } - else if (c == tty->termios.c_cc[VEOF]) { - return 1; - } - else if (c == '\n') { - if (tty->termios.c_lflag & (ECHO | ECHONL)) - echo (c, tty); - tty->cbuf[tty->ccount++] = c; - return 1; - } - else if ((c == tty->termios.c_cc[VEOL]) - || (c == tty->termios.c_cc[VEOL2])) { - if (tty->termios.c_lflag & ECHO) - echo (c, tty); - tty->cbuf[tty->ccount++] = c; - return 1; - } - } - - /* - * FIXME: Should do IMAXBEL handling somehow - */ - if (tty->ccount < (CBUFSIZE-1)) { - if (tty->termios.c_lflag & ECHO) - echo (c, tty); - tty->cbuf[tty->ccount++] = c; - } - return 0; -} - -/* - * Process input character, with semaphore. - */ -static int -siproc (unsigned char c, struct rtems_termios_tty *tty) -{ - int i; - - /* - * Obtain output semaphore if character will be echoed - */ - if (tty->termios.c_lflag & (ECHO|ECHOE|ECHOK|ECHONL|ECHOPRT|ECHOCTL|ECHOKE)) { - rtems_semaphore_obtain (tty->osem, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - i = iproc (c, tty); - rtems_semaphore_release (tty->osem); - } - else { - i = iproc (c, tty); - } - return i; -} - -/* - * Fill the input buffer by polling the device - */ -static rtems_status_code -fillBufferPoll (struct rtems_termios_tty *tty) -{ - int n; - - if (tty->termios.c_lflag & ICANON) { - for (;;) { - n = (*tty->device.pollRead)(tty->minor); - if (n < 0) { - rtems_task_wake_after (1); - } - else { - if (siproc (n, tty)) - break; - } - } - } - else { - rtems_interval then, now; - if (!tty->termios.c_cc[VMIN] && tty->termios.c_cc[VTIME]) - rtems_clock_get (RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &then); - for (;;) { - n = (*tty->device.pollRead)(tty->minor); - if (n < 0) { - if (tty->termios.c_cc[VMIN]) { - if (tty->termios.c_cc[VTIME] && tty->ccount) { - rtems_clock_get (RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now); - if ((now - then) > tty->vtimeTicks) { - break; - } - } - } - else { - if (!tty->termios.c_cc[VTIME]) - break; - rtems_clock_get (RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now); - if ((now - then) > tty->vtimeTicks) { - break; - } - } - rtems_task_wake_after (1); - } - else { - siproc (n, tty); - if (tty->ccount >= tty->termios.c_cc[VMIN]) - break; - if (tty->termios.c_cc[VMIN] && tty->termios.c_cc[VTIME]) - rtems_clock_get (RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &then); - } - } - } - return RTEMS_SUCCESSFUL; -} - -/* - * Fill the input buffer from the raw input queue - */ -static rtems_status_code -fillBufferQueue (struct rtems_termios_tty *tty) -{ - rtems_interval timeout = tty->rawInBufSemaphoreFirstTimeout; - rtems_status_code sc; - - for (;;) { - /* - * Process characters read from raw queue - */ - while (tty->rawInBufHead != tty->rawInBufTail) { - unsigned char c; - unsigned int newHead; - - newHead = (tty->rawInBufHead + 1) % RAW_INPUT_BUFFER_SIZE; - c = tty->rawInBuf[newHead]; - tty->rawInBufHead = newHead; - if (tty->termios.c_lflag & ICANON) { - if (siproc (c, tty)) - return RTEMS_SUCCESSFUL; - } - else { - siproc (c, tty); - if (tty->ccount >= tty->termios.c_cc[VMIN]) - return RTEMS_SUCCESSFUL; - } - timeout = tty->rawInBufSemaphoreTimeout; - } - - /* - * Wait for characters - */ - sc = rtems_semaphore_obtain (tty->rawInBufSemaphore, - tty->rawInBufSemaphoreOptions, - timeout); - if (sc != RTEMS_SUCCESSFUL) - break; - } - return RTEMS_SUCCESSFUL; -} - -rtems_status_code -rtems_termios_read (void *arg) -{ - rtems_libio_rw_args_t *args = arg; - struct rtems_termios_tty *tty = args->iop->data1; - unsigned32 count = args->count; - unsigned8 *buffer = args->buffer; - rtems_status_code sc; - - sc = rtems_semaphore_obtain (tty->isem, RTEMS_WAIT, RTEMS_NO_TIMEOUT); - if (sc != RTEMS_SUCCESSFUL) - return sc; - if (tty->cindex == tty->ccount) { - tty->cindex = tty->ccount = 0; - tty->read_start_column = tty->column; - if (tty->device.pollRead) - sc = fillBufferPoll (tty); - else - sc = fillBufferQueue (tty); - if (sc != RTEMS_SUCCESSFUL) - tty->cindex = tty->ccount = 0; - } - while (count && (tty->cindex < tty->ccount)) { - *buffer++ = tty->cbuf[tty->cindex++]; - count--; - } - args->bytes_moved = args->count - count; - rtems_semaphore_release (tty->isem); - return sc; -} - -/* - * Place characters on raw queue. - * NOTE: This routine runs in the context of the - * device receive interrupt handler. - * Returns the number of characters dropped because of overlow. - */ -int -rtems_termios_enqueue_raw_characters (void *ttyp, char *buf, int len) -{ - struct rtems_termios_tty *tty = ttyp; - unsigned int newTail; - - while (len) { - newTail = (tty->rawInBufTail + 1) % RAW_INPUT_BUFFER_SIZE; - if (newTail == tty->rawInBufHead) { - tty->rawInBufDropped += len; - break; - } - tty->rawInBuf[newTail] = *buf++; - len--; - tty->rawInBufTail = newTail; - } - rtems_semaphore_release (tty->rawInBufSemaphore); - return len; -} - -/* - * Characters have been transmitted - * NOTE: This routine runs in the context of the - * device transmit interrupt handler. - * The second argument is the number of characters transmitted so far. - * This value will always be 1 for devices which generate an interrupt - * for each transmitted character. - * It returns number of characters left to transmit - */ -int -rtems_termios_dequeue_characters (void *ttyp, int len) -{ - struct rtems_termios_tty *tty = ttyp; - unsigned int newTail; - int nToSend; - - if (tty->rawOutBufState == rob_wait) - rtems_semaphore_release (tty->rawOutBufSemaphore); - if ( tty->rawOutBufHead == tty->rawOutBufTail ) - return 0; - newTail = (tty->rawOutBufTail + len) % RAW_OUTPUT_BUFFER_SIZE; - if (newTail == tty->rawOutBufHead) { - /* - * Buffer empty - */ - tty->rawOutBufState = rob_idle; - nToSend = 0; - } - else { - /* - * Buffer not empty, start tranmitter - */ - if (newTail > tty->rawOutBufHead) - nToSend = RAW_OUTPUT_BUFFER_SIZE - newTail; - else - nToSend = tty->rawOutBufHead - newTail; - (*tty->device.write)(tty->minor, (char *)&tty->rawOutBuf[newTail], nToSend); - tty->rawOutBufState = rob_busy; - } - tty->rawOutBufTail = newTail; - - return nToSend; -} - - diff --git a/cpukit/libcsupport/src/unixlibc.c b/cpukit/libcsupport/src/unixlibc.c deleted file mode 100644 index 3e757e313d..0000000000 --- a/cpukit/libcsupport/src/unixlibc.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * $Id$ - */ - -#include <rtems.h> - -#if defined(RTEMS_UNIXLIB) - -void libc_init(int reentrant) -{ -} - -#else - -/* remove ANSI errors. - * A program must contain at least one external-declaration - * (X3.159-1989 p.82,L3). - */ -void unixlibc_dummy_function( void ) -{ -} - -#endif diff --git a/cpukit/libcsupport/src/utsname.c b/cpukit/libcsupport/src/utsname.c deleted file mode 100644 index 7fba3d610f..0000000000 --- a/cpukit/libcsupport/src/utsname.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * $Id$ - */ - -#include <stdio.h> -#include <string.h> - -#include <sys/utsname.h> - -#include <rtems/system.h> -#include <rtems/score/system.h> -#include <rtems/score/object.h> - -/*PAGE - * - * 4.4.1 Get System Name, P1003.1b-1993, p. 90 - */ - -int uname( - struct utsname *name -) -{ - /* XXX: Here is what Solaris returns... - sysname = SunOS - nodename = node_name - release = 5.3 - version = Generic_101318-12 - machine = sun4m - */ - - strcpy( name->sysname, "RTEMS" ); - - sprintf( name->nodename, "Node %d\n", _Objects_Local_node ); - - /* XXX release string is in BAD format for this routine!!! */ - strcpy( name->release, "3.2.0" ); - - /* XXX does this have any meaning for RTEMS */ - - strcpy( name->release, "" ); - - sprintf( name->machine, "%s/%s", CPU_NAME, CPU_MODEL_NAME ); - - return 0; -} - -/*PAGE - * - * 4.5.2 Get Process Times, P1003.1b-1993, p. 92 - */ - -clock_t times( - struct tms *buffer -) -{ - return POSIX_NOT_IMPLEMENTED(); -} |