OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /openrisc/trunk/rtos/rtems/c/src/lib/libbsp/unix
    from Rev 30 to Rev 173
    Reverse comparison

Rev 30 → Rev 173

/posix/shmsupp/getcfg.c
0,0 → 1,74
/* void Shm_get_config( localnode, &shmcfg )
*
* This routine initializes, if necessary, and returns a pointer
* to the Shared Memory Configuration Table for the UNIX
* simulator.
*
* INPUT PARAMETERS:
* localnode - local node number
* shmcfg - address of pointer to SHM Config Table
*
* OUTPUT PARAMETERS:
* *shmcfg - pointer to SHM Config Table
*
* NOTES: This driver is capable of supporting a practically unlimited
* number of nodes.
*
* COPYRIGHT (c) 1989-1999.
* 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: getcfg.c,v 1.2 2001-09-27 12:01:15 chris Exp $
*/
 
#include <bsp.h>
#include <shm_driver.h>
#include <sys/types.h> /* pid_t */
 
shm_config_table BSP_shm_cfgtbl;
 
int semid;
 
void Shm_Cause_interrupt_unix(
rtems_unsigned32 node
);
 
void Shm_Get_configuration(
rtems_unsigned32 localnode,
shm_config_table **shmcfg
)
{
_CPU_SHM_Init(
Shm_Maximum_nodes,
Shm_Is_master_node(),
(void **)&BSP_shm_cfgtbl.base,
(unsigned32 *)&BSP_shm_cfgtbl.length
);
 
BSP_shm_cfgtbl.format = SHM_BIG;
 
BSP_shm_cfgtbl.cause_intr = Shm_Cause_interrupt_unix;
 
#ifdef NEUTRAL_BIG
BSP_shm_cfgtbl.convert = NULL_CONVERT;
#else
BSP_shm_cfgtbl.convert = CPU_swap_u32;
#endif
 
if ( _CPU_SHM_Get_vector() ) {
BSP_shm_cfgtbl.poll_intr = INTR_MODE;
BSP_shm_cfgtbl.Intr.address = (vol_u32 *) _CPU_Get_pid(); /* process id */
BSP_shm_cfgtbl.Intr.value = _CPU_SHM_Get_vector(); /* signal to send */
BSP_shm_cfgtbl.Intr.length = LONG;
} else {
BSP_shm_cfgtbl.poll_intr = POLLED_MODE;
BSP_shm_cfgtbl.Intr.address = NO_INTERRUPT;
BSP_shm_cfgtbl.Intr.value = NO_INTERRUPT;
BSP_shm_cfgtbl.Intr.length = NO_INTERRUPT;
}
 
*shmcfg = &BSP_shm_cfgtbl;
}
/posix/shmsupp/addrconv.c
0,0 → 1,29
/* addrconv.v
*
* No address range conversion is required.
*
* Input parameters:
* addr - address to convert
*
* Output parameters:
* returns - converted address
*
* COPYRIGHT (c) 1989-1999.
* 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: addrconv.c,v 1.2 2001-09-27 12:01:15 chris Exp $
*/
 
#include <bsp.h>
#include <shm_driver.h>
 
void *Shm_Convert_address(
void *addr
)
{
return ( addr );
}
/posix/shmsupp/Makefile.am
0,0 → 1,34
##
## $Id: Makefile.am,v 1.2 2001-09-27 12:01:15 chris Exp $
##
 
AUTOMAKE_OPTIONS = foreign 1.4
 
PGM = $(ARCH)/shmsupp.rel
 
C_FILES = addrconv.c getcfg.c cause_intr.c lock.c mpisr.c
C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
 
OBJS = $(C_O_FILES)
 
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../../../../../../automake/lib.am
 
#
# (OPTIONAL) Add local stuff here using +=
#
 
$(PGM): $(OBJS)
$(make-rel)
 
if HAS_MP
all-local: $(ARCH) $(OBJS) $(PGM)
endif
 
# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
 
.PRECIOUS: $(PGM)
 
EXTRA_DIST = README addrconv.c cause_intr.c getcfg.c lock.c mpisr.c
 
include $(top_srcdir)/../../../../../../automake/local.am
/posix/shmsupp/lock.c
0,0 → 1,71
/* Shared Memory Lock Routines
*
* This shared memory locked queue support routine need to be
* able to lock the specified locked queue. Interrupts are
* disabled while the queue is locked to prevent preemption
* and deadlock when two tasks poll for the same lock.
* previous level.
*
* COPYRIGHT (c) 1989-1999.
* 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: lock.c,v 1.2 2001-09-27 12:01:15 chris Exp $
*/
 
#include <bsp.h>
#include <shm_driver.h>
 
/*
* Shm_Initialize_lock
*
* Initialize the lock for the specified locked queue.
*/
 
void Shm_Initialize_lock(
Shm_Locked_queue_Control *lq_cb
)
{
lq_cb->lock = lq_cb - Shm_Locked_queues;
}
 
/* Shm_Lock( &lq_cb )
*
* This shared memory locked queue support routine locks the
* specified locked queue. It disables interrupts to prevent
* a deadlock condition.
*/
 
void Shm_Lock(
Shm_Locked_queue_Control *lq_cb
)
{
rtems_unsigned32 isr_level;
 
rtems_interrupt_disable( isr_level );
 
Shm_isrstat = isr_level;
 
_CPU_SHM_Lock( lq_cb->lock );
}
 
/*
* Shm_Unlock
*
* Unlock the lock for the specified locked queue.
*/
 
void Shm_Unlock(
Shm_Locked_queue_Control *lq_cb
)
{
rtems_unsigned32 isr_level;
 
_CPU_SHM_Unlock( lq_cb->lock );
 
isr_level = Shm_isrstat;
rtems_interrupt_enable( isr_level );
}
/posix/shmsupp/mpisr.c
0,0 → 1,31
/* Shm_setvec
*
* This driver routine sets the SHM interrupt vector to point to the
* driver's SHM interrupt service routine.
*
* Input parameters: NONE
*
* Output parameters: NONE
*
* COPYRIGHT (c) 1989-1999.
* 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: mpisr.c,v 1.2 2001-09-27 12:01:15 chris Exp $
*/
 
#include <bsp.h>
#include <shm_driver.h>
 
void Shm_setvec( void )
{
int vector;
 
vector = _CPU_SHM_Get_vector();
 
if ( vector )
set_vector( Shm_isr, vector, 1 );
}
/posix/shmsupp/README
0,0 → 1,9
#
# $Id: README,v 1.2 2001-09-27 12:01:15 chris Exp $
#
 
This directory contains the SHM driver support files for
System V/POSIX derived UNIX flavors.
 
WARNING: The interrupt support in this directory currently will
only work in a homogeneous system.
/posix/shmsupp/cause_intr.c
0,0 → 1,33
/* void Shm_interrupt_unix( node )
*
* This routine is the shared memory driver routine which
* generates interrupts to other CPUs.
*
* Input parameters:
* node - destination of this packet (0 = broadcast)
*
* Output parameters: NONE
*
* COPYRIGHT (c) 1989-1999.
* 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: cause_intr.c,v 1.2 2001-09-27 12:01:15 chris Exp $
*/
 
#include <bsp.h>
#include <shm_driver.h>
#include <sys/types.h> /* pid_t */
 
void Shm_Cause_interrupt_unix(
rtems_unsigned32 node
)
{
Shm_Interrupt_information *intr;
intr = &Shm_Interrupt_table[node];
_CPU_SHM_Send_interrupt( (pid_t) intr->address, intr->value );
}
/posix/timer/timer.c
0,0 → 1,70
/* timer.c
*
* This file manages the interval timer on the PA-RISC.
*
* NOTE: It is important that the timer start/stop overhead be
* determined when porting or modifying this code.
*
* COPYRIGHT (c) 1989-1999.
* 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: timer.c,v 1.2 2001-09-27 12:01:15 chris Exp $
*/
 
#include <bsp.h>
#include <time.h>
#include <sys/time.h>
 
struct timeval Timer_start;
struct timeval Timer_stop;
struct timezone Time_zone;
 
rtems_boolean Timer_driver_Find_average_overhead;
 
void Timer_initialize()
{
gettimeofday( &Timer_start, &Time_zone );
}
 
#define AVG_OVERHEAD 0 /* It typically takes xxx microseconds */
/* (XX countdowns) to start/stop the timer. */
#define LEAST_VALID 10 /* Don't trust a value lower than this */
 
int Read_timer()
{
int total;
 
gettimeofday( &Timer_stop, &Time_zone );
 
if ( Timer_stop.tv_sec == Timer_start.tv_sec )
total = Timer_stop.tv_usec - Timer_start.tv_usec;
else {
total = 1000000 - Timer_start.tv_usec;
total += (Timer_stop.tv_sec - Timer_start.tv_sec - 1) * 1000000;
total += Timer_stop.tv_usec;
}
 
if ( Timer_driver_Find_average_overhead == 1 )
return total; /* in countdown units */
else {
if ( total < LEAST_VALID )
return 0; /* below timer resolution */
return total - AVG_OVERHEAD;
}
}
 
rtems_status_code Empty_function( void )
{
return RTEMS_SUCCESSFUL;
}
 
void Set_find_average_overhead(
rtems_boolean find_flag
)
{
Timer_driver_Find_average_overhead = find_flag;
}
/posix/timer/Makefile.am
0,0 → 1,33
##
## $Id: Makefile.am,v 1.2 2001-09-27 12:01:15 chris Exp $
##
 
AUTOMAKE_OPTIONS = foreign 1.4
 
PGM = $(ARCH)/timer.rel
 
C_FILES = timer.c
C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
 
OBJS = $(C_O_FILES)
 
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../../../../../../automake/lib.am
 
#
# (OPTIONAL) Add local stuff here using +=
#
 
$(PGM): $(OBJS)
$(make-rel)
 
# the .rel file built here will be put into libbsp.a by
# ../wrapup/Makefile
 
all-local: $(ARCH) $(OBJS) $(PGM)
 
.PRECIOUS: $(PGM)
 
EXTRA_DIST = timer.c
 
include $(top_srcdir)/../../../../../../automake/local.am
/posix/tools/semdump.in
0,0 → 1,59
#!@PERL@
#
# $Id: semdump.in,v 1.2 2001-09-27 12:01:15 chris Exp $
#
eval "exec @PERL@ -S $0 $*"
if $running_under_some_shell;
 
# dump semaphore array values tony@divnc.com
 
require 'sys/sem.ph';
require 'getopts.pl';
&Getopts("vhi:k:"); # verbose, help, id, key
 
if ($opt_h || ($opt_i && $opt_k))
{
print STDERR <<NO_MORE_HELP;
semdump
 
Dump info about specified semaphore.
 
Usage: $0 [-v] { -i semid | -k semkey }
 
-v -- possibly more verbose
-i semid -- semaphore id
-k semkey -- semaphore key
-h -- help
 
anything else == this help message
NO_MORE_HELP
exit 1;
}
 
$verbose = $opt_v;
$id = $opt_i;
$key = $opt_k;
 
if ($key)
{
$key = oct($key) if $key =~ /^0/;
die "Could not convert key to id; $!" unless $id = semget($key, 1, 0);
}
 
# I don't know to find out how many sem's are attached to the id
# so just keep reading them until we get an error.
 
printf("KEY: 0x%X (%d) ", $key, $key) if $key;
print "ID: $id\n";
 
semlist:
for ($semnum=0; $semnum < 10; $semnum++)
{
$val = semctl($id, $semnum, &GETVAL, 0);
$val || ($val = -1);
 
last semlist if ($val == -1);
 
printf " %d: %d\n", $semnum, $val;
}
 
/posix/tools/shmdump.in
0,0 → 1,134
#!@PERL@
#
# $Id: shmdump.in,v 1.2 2001-09-27 12:01:15 chris Exp $
#
eval "exec @PERL@ -S $0 $*"
if $running_under_some_shell;
 
# dump shared memory segment tony@divnc.com
 
require 'sys/shm.ph';
require 'getopts.pl';
&Getopts("vhi:k:f:l:b:w"); # verbose, help, id, key, first, length, word, base
 
if ($opt_h || ($opt_i && $opt_k))
{
print STDERR <<NO_MORE_HELP;
shmdump
 
Dump contents of specifed shared memory segment.
 
Usage: $0 [options]
 
-h -- help
-v -- possibly more verbose
-i shmid -- shm id
-k shmkey -- shm key
-f first -- start of partial dump
-l length -- length of partial dump
-w -- dump as 4byte words instead of bytes
-b base -- use 'base' as base address for output
 
anything else == this help message
NO_MORE_HELP
exit 1;
}
 
$verbose = $opt_v;
$id = $opt_i;
$key = $opt_k;
$offset = $opt_f;
$print_length = $opt_l;
$base = $opt_b;
$word_dump = $opt_w;
 
if ($key)
{
# ensure key is an integer
$key = oct($key) if $key =~ /^0/;
die "Could not convert key to id; $!" unless $id = shmget($key, 1, 0);
}
 
# ensure integerhood in case of leading '0x'
$base = oct($base) if $base =~ /^0/;
$offset = oct($offset) if $offset =~ /^0/;
$print_length = oct($print_length) if $print_length =~ /^0/;
 
if ( ! shmctl($id, &IPC_STAT, $shmid_ds))
{
die "shmctl(2) for id $id failed -- (I was trying to get size): $!";
}
 
# Pick the length out.
# It is at byte offset 0x30 on hpux9 and probably hpux10
# Also get the key if we don't have it already. Don't need it tho...
$length = unpack("I", substr($shmid_ds, 0x30, 4));
$key = unpack("I", substr($shmid_ds, 0x14, 4)) if ! $key;
 
# poke around looking for length and key
# print "I guess: length: $length, key: $key\n";
# print "****$shmid_ds****\n"; die "";
 
# make sure offset and print length make sense
$print_length = $length if ! $print_length;
if (($offset + $print_length) > $length)
{
die "offset ($offset) and length ($print_length) go beyond end of segment ($length bytes)";
}
 
printf("KEY: 0x%X (%d) ", $key, $key) if ($key);
printf "ID: $id\n";
printf " %d bytes (0x%X), %d words, logical base is 0x%X\n",
$length, $length, $length / 4, $base;
if ($offset || ($print_length != $length))
{
printf " printing %X (%d) bytes starting at offset 0x%X (%d)\n",
$print_length, $print_length, $offset, $offset;
}
printf "\n";
 
if ( ! shmread($id, $shm_data, $offset, $print_length))
{
die "could not attach and read from shmid $id: $!";
}
 
# the dump code below derived from "Real Perl Programs" example "xdump"
# from Camel book
 
$base += $offset;
$offset = 0;
for ($len = $print_length; $len >= 16; )
{
$data = substr($shm_data, $offset, 16);
 
@array = unpack('N4', $data);
$data =~ tr/\0-\37\177-\377/./;
printf "%8.8lX %8.8lX %8.8lX %8.8lX %8.8lX |%s|\n",
$base, @array, $data;
 
$offset += 16;
$base += 16;
$len -= 16;
}
 
# Now finish up the end a byte at a time
 
if ($len)
{
$data = substr($shm_data, $offset, $len);
@array = unpack('C*', $data);
for (@array)
{
$_ = sprintf('%2.2X', $_);
}
 
push(@array, ' ') while $len++ < 16;
 
$data =~ tr/\0-\37\177-\377/./;
$data =~ s/[^ -~]/./g;
 
printf "%8.8lX ", $base;
printf "%s%s%s%s %s%s%s%s %s%s%s%s %s%s%s%s |%-16s|\n",
@array, $data;
}
 
/posix/tools/configure.in
0,0 → 1,28
dnl Process this file with autoconf to produce a configure script.
dnl
dnl $Id: configure.in,v 1.2 2001-09-27 12:01:15 chris Exp $
 
AC_INIT(runtest.in)
RTEMS_TOP(../../../../../../..)
AC_CONFIG_AUX_DIR(../../../../../../..)
 
RTEMS_CANONICAL_TARGET_CPU
 
AM_INIT_AUTOMAKE(rtems-c-src-lib-libbsp-unix-posix-tools,$RTEMS_VERSION,no)
AM_MAINTAINER_MODE
 
RTEMS_PATH_KSH
RTEMS_PATH_PERL
 
AM_CONDITIONAL(PERL,test -n "$PERL")
 
RTEMS_PROJECT_ROOT
RTEMS_TOOLPATHS
 
# Explicitly list all Makefiles here
AC_OUTPUT(
Makefile
runtest
shmdump
looptest
semdump)
/posix/tools/Makefile.am
0,0 → 1,37
##
## $Id: Makefile.am,v 1.2 2001-09-27 12:01:15 chris Exp $
##
 
AUTOMAKE_OPTIONS = foreign 1.4
ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal
 
if PERL
perl_scripts = shmdump semdump
PERL_TMPINSTALL_FILES = $(PROJECT_ROOT)/posix/tests/shmdump \
$(PROJECT_ROOT)/posix/tests/semdump
endif
 
noinst_SCRIPTS = runtest looptest $(perl_scripts)
 
$(PROJECT_ROOT)/posix/tests:
$(mkinstalldirs) $@
 
$(PROJECT_ROOT)/posix/tests/runtest: runtest
$(INSTALL_SCRIPT) $< $@
 
$(PROJECT_ROOT)/posix/tests/looptest: looptest
$(INSTALL_SCRIPT) $< $@
 
$(PROJECT_ROOT)/posix/tests/shmdump: shmdump
$(INSTALL_SCRIPT) $< $@
 
$(PROJECT_ROOT)/posix/tests/semdump: semdump
$(INSTALL_SCRIPT) $< $@
 
TMPINSTALL_FILES += $(PROJECT_ROOT)/posix/tests \
$(PROJECT_ROOT)/posix/tests/runtest $(PROJECT_ROOT)/posix/tests/looptest
 
## HACK: install to build-tree
all-local: $(TMPINSTALL_FILES) $(PERL_TMPINSTALL_FILES)
 
include $(top_srcdir)/../../../../../../../automake/host.am
/posix/tools/runtest.in
0,0 → 1,255
#!@KSH@ -p
#
# Run rtems tests on a POSIX-ish UNIX
#
# $Id: runtest.in,v 1.2 2001-09-27 12:01:15 chris Exp $
#
 
trap "test_exit 1" 1 2 3 13 14 15
 
trap "test_exit 1" 1 2 3 13 14 15
 
# progname=`basename $0`
progname=${0##*/} # fast basename hack for ksh, bash
 
USAGE=\
"usage: $progname [ -opts ] test [ test ... ]
-c clicks -- specify (hex) value for clicks / tick
-v -- verbose
-l logdir -- specify log directory (default is 'logdir')
 
Specify test as 'test' or 'test.exe'.
All multiprocessing tests *must* be specified simply as 'mp01', etc.
"
 
# export everything
set -a
 
# log an error to stderr
prerr()
{
echo "$*" >&2
}
 
fatal() {
[ "$1" ] && prerr $*
prerr "$USAGE"
exit 1
}
 
warn() {
[ "$1" ] && prerr $*
}
 
# print args, 1 per line
ml_echo()
{
for l
do
echo "$l"
done
}
 
killem()
{
kill -9 $pid $pid1 $pid2 2> /dev/null
}
 
 
killem()
{
kill -9 $pid $pid1 $pid2 2> /dev/null
}
 
 
test_exit()
{
exit_code=$1
 
killem
killem
rm -f ${logfile}.tmp*
 
exit $exit_code
}
 
#
# process the options
#
# defaults for getopt vars
#
 
verbose=""
extra_options=""
clicks_per_tick=""
logdir=log
# how long can we run; rtems tests might run 300 seconds
max_run_time=400
run_to_completion="yes"
 
while getopts vo:c:l: OPT
do
case "$OPT" in
v)
verbose="yes";;
l)
logdir="$OPTARG";;
o)
extra_options="$OPTARG";;
c)
clicks_per_tick="$OPTARG";;
*)
fatal;;
esac
done
 
let $((shiftcount = $OPTIND - 1))
shift $shiftcount
 
args=$*
 
#
# Run the tests
#
 
tests="$args"
if [ ! "$tests" ]
then
set -- `echo *.exe`
tests="$*"
fi
 
[ -d $logdir ] || mkdir $logdir || fatal "could not create log directory ($logdir)"
 
for tfile in $tests
do
 
tname=`echo $tfile | sed -e 's/\.exe$//'`
tname=`basename $tname`
 
TEST_TYPE="single"
 
case $tname in
monitor)
if [ $run_to_completion = "yes" ]
then
warn "Skipping $tname; it is interactive"
continue
fi
;;
*-node2*)
warn "Skipping $tname; 'runtest' runs both nodes when for *-node1"
continue;;
*-node1*)
tname=`echo $tname | sed 's/-node.*//'`
warn "Running both nodes associated with $tname"
TEST_TYPE="mp"
;;
stackchk*|spfatal*|malloctest*|termio*)
warn "Skipping $tname; it locks up or takes a VERY long time to run"
continue
;;
esac
 
if [ $TEST_TYPE = "mp" ]
then
logfile1=$logdir/${tname}_1
infofile1=$logfile1.info
logfile2=$logdir/${tname}_2
infofile2=$logfile2.info
 
rm -f ${logfile1}
rm -f ${logfile2}
 
date=`date`
echo "Starting $tname at $date"
 
./${tname}-node1.exe > $logfile1 2>&1 &
pid1=$!
./${tname}-node2.exe > $logfile2 2>&1 &
pid2=$!
 
# Wait for both cpu's to complete, ensuring they don't run forever...
time_run=0
while [ $time_run -lt $max_run_time ]
do
# sleep 5s at a time waiting for jobs to finish or timer to expire
# if job has exited, then we exit, too.
sleep 5
kill -0 $pid1 2> /dev/null
running1=$?
kill -0 $pid2 2> /dev/null
running2=$?
if [ $running1 -eq 0 ] && [ $running2 -eq 0 ] # both still running
then
time_run=$((time_run + 5))
if [ $time_run -ge $max_run_time ]
then
echo "$tname ran too long; killing it"
ran_too_long="yes"
fi
else
ran_too_long="no"
# if one is still running, have to kill them
if [ $running1 -ne $running2 ]
then
sleep 10 # give other node a chance to gracefully die
fi
break
fi
done
 
# make sure they are gone
kill -9 $pid1 2> /dev/null
kill -9 $pid2 2> /dev/null
fi
 
if [ $TEST_TYPE = "single" ]
then
logfile=$logdir/$tname
infofile=$logfile.info
 
rm -f ${logfile}
 
date=`date`
echo "Starting $tname.exe at $date"
 
./$tname.exe > $logfile 2>&1 &
pid=$!
 
# Make sure it won't run forever...
time_run=0
while [ $time_run -lt $max_run_time ]
do
# sleep 5s at a time waiting for job to finish or timer to expire
# if job has exited, then we exit, too.
sleep 5
kill -0 $pid 2> /dev/null
running=$?
if [ $running -eq 0 ]
then
time_run=$((time_run + 5))
if [ $time_run -ge $max_run_time ]
then
kill -9 $pid 2> /dev/null
ran_too_long="yes"
fi
else
ran_too_long="no"
break
fi
done
fi
 
pid=""
 
done
 
test_exit 0
 
# Local Variables: ***
# mode:ksh ***
# End: ***
 
/posix/tools/looptest.in
0,0 → 1,93
#!@KSH@ -p
#
# $Id: looptest.in,v 1.2 2001-09-27 12:01:15 chris Exp $
#
 
# progname=`basename $0`
progname=${0##*/} # fast basename hack for ksh, bash
 
# must be uppercase hex; dc is feeble minded
clicks_per_tick="1"
# default is 0x3
hexbump=1
iterations=10
 
USAGE=\
"usage: $progname [ -opts ] file [ file ... ]
-o options -- specify options to be passed to runtest
-c clicks -- specify (hex) value for clicks / tick (default $clicks_per_tick)
-n iterations -- num times to loop thru specified tests (default $iterations)
-b hexbump -- increment clicks-per-ticks this much each loop (default $hexbump)
-v -- verbose"
 
# log an error to stderr
prerr()
{
echo "$*" >&2
}
 
fatal() {
[ "$1" ] && prerr $*
prerr "$USAGE"
exit 1
}
 
warn() {
[ "$1" ] && prerr $*
}
 
#
# process the options
#
# defaults for getopt vars
#
 
verbose=""
extra_options=""
 
while getopts vo:c:n:b: OPT
do
case "$OPT" in
v)
verbose="yes";;
o)
extra_options="$OPTARG";;
c)
clicks_per_ticks="$OPTARG";;
n)
iterations="$OPTARG";;
b)
hexbump="$OPTARG";;
*)
fatal;;
esac
done
((shiftcount = $OPTIND - 1))
shift $shiftcount
 
args=$*
 
#
# Run the tests
# After each run, rename 'log' to log.$clicks_per_tick
#
 
tests="$args"
 
while [ $iterations -gt 0 ]
do
./runtest $extra_options -c $clicks_per_tick $tests
rm -rf log.$clicks_per_tick.OLD
[ -d log.$clicks_per_tick ] && mv log.$clicks_per_tick log.$clicks_per_tick.OLD
mv log log.$clicks_per_tick
 
((iterations = $iterations - 1))
clicks_per_tick=`echo 16 o 16 i $clicks_per_tick $hexbump + p q | dc`
done
 
exit 0
 
# Local Variables: ***
# mode:ksh ***
# End: ***
 
/posix/bsp_specs
0,0 → 1,8
%rename lib old_lib
 
*lib:
%{!qrtems: %(old_lib)} \
%{qrtems: %{!qrtems_debug: -lrtemsall } \
%{qrtems_debug: -lrtemsall_g} \
%(old_lib)}
 
/posix/times
0,0 → 1,10
#
# Timing Test Suite Results for the UNIX Simulator BSP
#
# $Id: times,v 1.2 2001-09-27 12:01:14 chris Exp $
#
 
The times when running on the UNIX simulator are irrelevant. They vary based
on a variety of factors including host OS, host configuration, and system load.
The intent of the UNIX simulator is to provide a testing and prototyping
environment not to compete with the "normal" embedded role of RTEMS.
/posix/console/console.c
0,0 → 1,95
/*
* Console IO Support Routines
*
* These provide UNIX-like read and write calls for the C library.
*
* NOTE: For the most part, this is just a space holder.
*
* COPYRIGHT (c) 1994 by Division Incorporated
*
* 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: console.c,v 1.2 2001-09-27 12:01:14 chris Exp $
*/
 
#include <bsp.h>
 
#include <unistd.h>
#include <errno.h>
 
rtems_device_driver
console_initialize(rtems_device_major_number major,
rtems_device_minor_number minor,
void * arg
)
{
return 0;
}
 
 
/*
* Open entry point
*/
 
rtems_device_driver console_open(
rtems_device_major_number major,
rtems_device_minor_number minor,
void * arg
)
{
return RTEMS_SUCCESSFUL;
}
/*
* Close entry point
*/
 
rtems_device_driver console_close(
rtems_device_major_number major,
rtems_device_minor_number minor,
void * arg
)
{
return RTEMS_SUCCESSFUL;
}
 
/*
* read bytes from the serial port. We only have stdin.
*/
 
rtems_device_driver console_read(
rtems_device_major_number major,
rtems_device_minor_number minor,
void * arg
)
{
return RTEMS_UNSATISFIED;
}
 
/*
* write bytes to the serial port. Stdout and stderr are the same.
*/
 
rtems_device_driver console_write(
rtems_device_major_number major,
rtems_device_minor_number minor,
void * arg
)
{
return -1;
}
 
/*
* IO Control entry point
*/
 
rtems_device_driver console_control(
rtems_device_major_number major,
rtems_device_minor_number minor,
void * arg
)
{
return RTEMS_SUCCESSFUL;
}
/posix/console/Makefile.am
0,0 → 1,32
##
## $Id: Makefile.am,v 1.2 2001-09-27 12:01:14 chris Exp $
##
 
AUTOMAKE_OPTIONS = foreign 1.4
 
PGM = $(ARCH)/console.rel
 
C_FILES = console.c
C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
 
OBJS = $(C_O_FILES)
 
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../../../../../../automake/lib.am
 
#
# (OPTIONAL) Add local stuff here using +=
#
 
$(PGM): $(OBJS)
$(make-rel)
 
# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
 
all-local: $(ARCH) $(OBJS) $(PGM)
 
.PRECIOUS: $(PGM)
 
EXTRA_DIST = console.c
 
include $(top_srcdir)/../../../../../../automake/local.am
/posix/startup/no-ctor.c
0,0 → 1,16
/*
* rtems, floss, libc are always compiled with GNU compilers
* application code may be compiled with some other C++ compiler
* that has a different global constructor technique.
*
* For the simple case, where the app has no global constructors or
* is compiled by g++, we provide this empty routine
* In order to get both g++ constructors (RTEMS::RTEMS, for example)
* and application constructors run, we provide this routine.
*
* $Id: no-ctor.c,v 1.2 2001-09-27 12:01:15 chris Exp $
*/
 
void invoke_non_gnu_constructors(void)
{
}
/posix/startup/bspstart.c
0,0 → 1,230
/*
* This routine starts the application. It includes application,
* board, and monitor specific initialization and configuration.
* The generic CPU dependent initialization has been performed
* before this routine is invoked.
*
* Called by RTEMS::RTEMS constructor in startup-ctor.cc
*
* COPYRIGHT (c) 1989-1999.
* 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: bspstart.c,v 1.2 2001-09-27 12:01:15 chris Exp $
*/
 
#include <stdio.h>
#include <stdlib.h>
 
#include <unistd.h>
 
#include <bsp.h>
#include <libcsupport.h>
 
#include <rtems/libio.h>
 
extern rtems_configuration_table Configuration;
 
/*
* A copy of the configuration table from the application
* with some changes applied to it.
*/
 
rtems_configuration_table BSP_Configuration;
rtems_multiprocessing_table BSP_Multiprocessing;
rtems_cpu_table Cpu_table;
rtems_unsigned32 bsp_isr_level;
rtems_unsigned32 Heap_size;
int rtems_argc;
char **rtems_argv;
 
/*
* May be overridden by RTEMS_WORKSPACE_SIZE and RTEMS_HEAPSPACE_SIZE
* environment variables; see below.
*/
 
#define DEFAULT_WORKSPACE_SIZE (WORKSPACE_MB * (1024 * 1024))
#define DEFAULT_HEAPSPACE_SIZE (HEAPSPACE_MB * (1024 * 1024))
 
/*
* Amount to increment itimer by each pass
* It is a variable instead of a #define to allow the 'looptest'
* script to bump it without recompiling rtems
*/
 
rtems_unsigned32 CPU_CLICKS_PER_TICK;
 
/*
* Use the shared implementations of the following routines
*/
void bsp_postdriver_hook(void);
void bsp_libc_init( void *, unsigned32, int );
 
/*
* Function: bsp_pretasking_hook
* Created: 95/03/10
*
* Description:
* BSP pretasking hook. Called just before drivers are initialized.
* Used to setup libc and install any BSP extensions.
*
* NOTES:
* Must not use libc (to do io) from here, since drivers are
* not yet initialized.
*/
 
void bsp_pretasking_hook(void)
{
void *heap_start;
 
if (getenv("RTEMS_HEAPSPACE_SIZE"))
Heap_size = strtol(getenv("RTEMS_HEAPSPACE_SIZE"), 0, 0);
else
Heap_size = DEFAULT_HEAPSPACE_SIZE;
heap_start = 0;
 
bsp_libc_init((void *)heap_start, Heap_size, 1024 * 1024);
 
 
#ifdef RTEMS_DEBUG
rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
#endif
 
/*
* Dump malloc stats on exit...
*/
#if defined(RTEMS_DEBUG)
atexit(malloc_dump);
#endif
}
 
/*
* DO NOT Use the shared bsp_postdriver_hook() implementation
*/
void bsp_postdriver_hook(void)
{
return;
}
 
/*
* bsp_start
*
* This routine does the bulk of the system initialization.
*/
 
void bsp_start(void)
{
unsigned32 workspace_ptr;
 
/*
* Copy the table (normally done in shared main).
*/
 
BSP_Configuration = Configuration;
/*
* If the node number is -1 then the application better provide
* it through environment variables RTEMS_NODE.
* Ditto for RTEMS_MAXIMUM_NODES
*/
 
if (BSP_Configuration.User_multiprocessing_table) {
char *p;
/* make a copy for possible editing */
BSP_Multiprocessing = *BSP_Configuration.User_multiprocessing_table;
BSP_Configuration.User_multiprocessing_table = &BSP_Multiprocessing;
if (BSP_Multiprocessing.node == -1)
{
p = getenv("RTEMS_NODE");
BSP_Multiprocessing.node = p ? atoi(p) : 1;
}
/* If needed provide maximum_nodes also */
if (BSP_Multiprocessing.maximum_nodes == -1)
{
p = getenv("RTEMS_MAXIMUM_NODES");
BSP_Multiprocessing.maximum_nodes = p ? atoi(p) : 1;
}
}
 
/*
* Set cpu_number to accurately reflect our cpu number
*/
 
if (BSP_Configuration.User_multiprocessing_table)
cpu_number = BSP_Configuration.User_multiprocessing_table->node - 1;
else
cpu_number = 0;
 
if (getenv("RTEMS_WORKSPACE_SIZE"))
BSP_Configuration.work_space_size =
strtol(getenv("RTEMS_WORKSPACE_SIZE"), 0, 0);
else
BSP_Configuration.work_space_size = DEFAULT_WORKSPACE_SIZE;
/*
* Allocate workspace memory, ensuring it is properly aligned
*/
workspace_ptr =
(unsigned32) sbrk(BSP_Configuration.work_space_size + CPU_ALIGNMENT);
workspace_ptr += CPU_ALIGNMENT - 1;
workspace_ptr &= ~(CPU_ALIGNMENT - 1);
 
BSP_Configuration.work_space_start = (void *) workspace_ptr;
/*
* Set up our hooks
* Make sure libc_init is done before drivers init'd so that
* they can use atexit()
*/
 
Cpu_table.pretasking_hook = bsp_pretasking_hook; /* init libc, etc. */
 
Cpu_table.predriver_hook = NULL;
 
Cpu_table.postdriver_hook = bsp_postdriver_hook;
 
Cpu_table.idle_task = NULL; /* do not override system IDLE task */
 
/*
* Don't zero out the workspace since it is in the BSS under UNIX.
*/
 
Cpu_table.do_zero_of_workspace = FALSE;
 
/*
* XXX; interrupt stack not currently used, so this doesn't matter
*/
 
Cpu_table.interrupt_stack_size = CONFIGURE_INTERRUPT_STACK_MEMORY;
 
Cpu_table.extra_mpci_receive_server_stack = 0;
 
/*
* Add 1 extension for MPCI_fatal
*/
 
if (BSP_Configuration.User_multiprocessing_table)
BSP_Configuration.maximum_extensions++;
 
CPU_CLICKS_PER_TICK = 1;
 
/*
* Start most of RTEMS
* main() will start the rest
*/
 
bsp_isr_level = rtems_initialize_executive_early(
&BSP_Configuration,
&Cpu_table
);
}
/posix/startup/rtems-ctor.cc
0,0 → 1,116
/*
* rtems-ctor.cc
*
* Description:
* This file exists solely to (try to) ensure RTEMS is initialized
* before any global constructors are run.
*
* The problem:
* Global constructors might reasonably expect that new() will
* work, but since new() uses malloc() which uses RTEMS regions,
* it can not be called until after initialize_executive().
*
* Global constructors are called in GNU systems one of 2 ways:
*
* an "invisible" call to __main() inserted by compiler
* This __main() calls __do_global_ctors() which
* walks thru the table and calls all global
* constructors.
*
* or -
* A special section is put into the linked binary. The
* system startup code knows to run the constructors in
* this special section before calling main().
*
* By making RTEMS initialization a constructor, we avoid having
* too much about all this. All we have to guarantee is that
* this constructor is the first one run.
*
*
* So for the first case above, this is what happens
*
* host crt0
* main()
* __main()
* __do_global_ctors()
* bsp_start()
* init_executive_early()
* <<any other constructors>>
*
* init_executive_late()
* bsp_cleanup()
*
* TODO:
*
* $Id: rtems-ctor.cc,v 1.2 2001-09-27 12:01:15 chris Exp $
*/
 
#include <bsp.h>
#include <stdio.h>
#include <stdlib.h>
 
/*
* RTEMS program name
* Probably not used by anyone, but it is nice to have it.
* Actually the UNIX version of CPU_INVOKE_DEBUGGER will probably
* need to use it
*/
 
char *rtems_progname;
 
class RTEMS {
public:
RTEMS();
~RTEMS();
};
 
RTEMS rtems_constructor;
 
RTEMS::RTEMS()
{
bsp_start();
}
 
RTEMS::~RTEMS()
{
bsp_cleanup();
}
 
extern "C" {
extern void invoke_non_gnu_constructors(void);
 
int
main(int argc,
char **argv,
char ** /* environp is unused */)
{
rtems_argc = argc;
rtems_argv = argv;
 
if ((argc > 0) && argv && argv[0])
rtems_progname = argv[0];
else
rtems_progname = "RTEMS";
 
/*
* run any non-gnu constructors we may need
*/
invoke_non_gnu_constructors();
 
/*
* Start multitasking
*/
 
rtems_initialize_executive_late( bsp_isr_level );
 
/*
* Returns when multitasking is stopped
* This allows our destructors to get run normally
*/
 
fflush( stdout );
fflush( stderr );
return 0;
}
}
/posix/startup/main.c
0,0 → 1,54
/*
* Description:
* This file exists solely to (try to) ensure RTEMS is initialized.
* It is not to be used in systems which want C++ support.
*
* $Id: main.c,v 1.2 2001-09-27 12:01:15 chris Exp $
*/
 
#include <bsp.h>
#include <stdio.h>
#include <stdlib.h>
 
/*
* RTEMS program name
* Probably not used by anyone, but it is nice to have it.
* Actually the UNIX version of CPU_INVOKE_DEBUGGER will probably
* need to use it
*/
 
char *rtems_progname;
 
int main(
int argc,
char **argv
)
{
rtems_argc = argc;
rtems_argv = argv;
 
bsp_start();
 
if ((argc > 0) && argv && argv[0])
rtems_progname = argv[0];
else
rtems_progname = "RTEMS";
 
/*
* Start multitasking
*/
 
rtems_initialize_executive_late( bsp_isr_level );
 
/*
* Returns when multitasking is stopped
* This allows our destructors to get run normally
*/
 
fflush( stdout );
fflush( stderr );
 
bsp_cleanup();
 
return 0;
}
/posix/startup/bspclean.c
0,0 → 1,40
/* bsp_cleanup()
*
* This routine normally is part of start.s and returns
* control to a monitor but on the UNIX simulator
* we do that directly from main.c.
*
* INPUT: NONE
*
* OUTPUT: NONE
*
* COPYRIGHT (c) 1989-1999.
* 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: bspclean.c,v 1.2 2001-09-27 12:01:15 chris Exp $
*/
 
#include <bsp.h>
 
#include <stdio.h>
 
/*
* The app has "exited" (called rtems_shutdown_executive)
*/
 
void bsp_cleanup( void )
{
/*
* Invoke any fatal error extension and "halt"
* By definition, rtems_fatal_error_occurred does not return.
*/
 
fflush(stdout);
fflush(stderr);
 
rtems_fatal_error_occurred(0);
}
/posix/startup/Makefile.am
0,0 → 1,60
##
## $Id: Makefile.am,v 1.2 2001-09-27 12:01:15 chris Exp $
##
 
AUTOMAKE_OPTIONS = foreign 1.4
 
VPATH = @srcdir@:@srcdir@/../../../shared
 
PGM = ${ARCH}/startup.rel
 
if HAS_CXX
C_MAIN_C_FILES =
else
C_MAIN_C_FILES = main.c bootcard.c
endif
 
# C sources
C_FILES = bspclean.c bsplibc.c bspstart.c setvec.c $(C_MAIN_C_FILES)
C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o)
startup_rel_OBJECTS = $(C_O_FILES)
 
# CC sources
CC_FILES = rtems-ctor.cc
CC_O_FILES = $(CC_FILES:%.cc=${ARCH}/%.o}
 
# We install the RTEMS constructor as a separate .o
# so it can be easily place correctly by the compiler config file.
 
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../../../../../../automake/lib.am
 
#
# (OPTIONAL) Add local stuff here using +=
#
 
AM_CFLAGS += $(LIBC_DEFINES)
 
$(PGM): $(startup_rel_OBJECTS)
$(make-rel)
 
${ARCH}/libno-ctor.a: $(ARCH)/no-ctor.o
$(AR) -cvr $@ $<
 
$(PROJECT_RELEASE)/lib/libno-ctor$(LIB_VARIANT).a: ${ARCH}/libno-ctor.a
$(INSTALL_DATA) $< $@
 
$(PROJECT_RELEASE)/lib/rtems-ctor$(LIB_VARIANT).o: $(ARCH)/rtems-ctor.o
$(INSTALL_DATA) $< $@
 
if HAS_CXX
all-local: $(ARCH) $(PGM) $(PROJECT_RELEASE)/lib/libno-ctor$(LIB_VARIANT).a \
$(PROJECT_RELEASE)/lib/rtems-ctor$(LIB_VARIANT).o
else
all-local: $(ARCH) $(PGM)
endif
 
EXTRA_DIST = bspclean.c bspstart.c exit.c main.c no-ctor.c rtems-ctor.cc \
setvec.c
 
include $(top_srcdir)/../../../../../../automake/local.am
/posix/startup/exit.c
0,0 → 1,26
/*
* exit
*
* This routine returns control to "the pre-RTEMS environment".
*
* COPYRIGHT (c) 1989-1999.
* 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: exit.c,v 1.2 2001-09-27 12:01:15 chris Exp $
*/
 
#include <bsp.h>
#include <clockdrv.h>
 
void _exit( void )
{
/* Clock or Timer cleanup is run by at_exit() */
 
Io_cleanup();
 
bsp_cleanup();
}
/posix/startup/setvec.c
0,0 → 1,46
/* set_vector
*
* This routine installs an interrupt vector on UNIX.
*
* INPUT:
* handler - interrupt handler entry point
* vector - vector number
* type - 0 indicates raw hardware connect
* 1 indicates RTEMS interrupt connect
*
* RETURNS:
* address of previous interrupt handler
*
* COPYRIGHT (c) 1989-1999.
* 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: setvec.c,v 1.2 2001-09-27 12:01:15 chris Exp $
*/
 
#include <bsp.h>
 
rtems_isr_entry
set_vector( /* returns old vector */
rtems_isr_entry handler, /* isr routine */
rtems_vector_number vector, /* vector number */
int type /* RTEMS or RAW intr */
)
{
rtems_isr_entry rtems_isr_ptr = 0;
proc_ptr raw_isr_ptr;
 
if ( type ) {
rtems_interrupt_catch( handler, vector, &rtems_isr_ptr );
return rtems_isr_ptr;
} else {
_CPU_ISR_install_vector( vector, (proc_ptr) handler, &raw_isr_ptr );
return raw_isr_ptr;
}
}
 
 
/posix/include/Makefile.am
0,0 → 1,25
##
## $Id: Makefile.am,v 1.2 2001-09-27 12:01:14 chris Exp $
##
 
AUTOMAKE_OPTIONS = foreign 1.4
 
H_FILES = bsp.h
 
$(PROJECT_INCLUDE):
$(mkinstalldirs) $@
 
$(PROJECT_INCLUDE)/%.h: %.h
$(INSTALL_DATA) $< $@
 
$(PROJECT_INCLUDE)/coverhd.h: $(srcdir)/../../../shared/include/coverhd.h
$(INSTALL_DATA) $< $@
 
TMPINSTALL_FILES += $(PROJECT_INCLUDE) $(H_FILES:%.h=$(PROJECT_INCLUDE)/%.h) \
$(PROJECT_INCLUDE)/coverhd.h
 
all-local: $(TMPINSTALL_FILES)
 
EXTRA_DIST = bsp.h
 
include $(top_srcdir)/../../../../../../automake/local.am
/posix/include/bsp.h
0,0 → 1,108
/* bsp.h
*
* This include file contains all POSIX BSP definitions.
*
* COPYRIGHT (c) 1989-1999.
* 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: bsp.h,v 1.2 2001-09-27 12:01:14 chris Exp $
*/
 
#ifndef __POSIX_BSP_h
#define __POSIX_BSP_h
 
#ifdef __cplusplus
extern "C" {
#endif
 
#include <rtems.h>
#include <clockdrv.h>
#include <console.h>
#include <iosupp.h>
 
/*
* confdefs.h overrides for this BSP:
* - number of termios serial ports (defaults to 1)
* - Interrupt stack space is not minimum if defined.
*/
 
/* #define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 2 */
#define CONFIGURE_INTERRUPT_STACK_MEMORY (4 * 1024)
 
/*
* Define the time limits for RTEMS Test Suite test durations.
* Long test and short test duration limits are provided. These
* values are in seconds and need to be converted to ticks for the
* application.
*
*/
 
#define MAX_LONG_TEST_DURATION 300 /* 5 minutes = 300 seconds */
#define MAX_SHORT_TEST_DURATION 3 /* 3 seconds */
 
/*
* Stuff for Time Test 27
*/
 
#define MUST_WAIT_FOR_INTERRUPT 1
 
#define Install_tm27_vector( handler ) \
set_vector( (handler), 16, 1 )
 
#define Cause_tm27_intr() \
raise( 16 )
 
#define Clear_tm27_intr()
 
#define Lower_tm27_intr() \
_ISR_Set_level( 0 );
 
#define RAM_START 0
#define RAM_END 0x100000
 
/* miscellaneous stuff assumed to exist */
 
extern rtems_configuration_table BSP_Configuration;
 
/*
* Device Driver Table Entries
*/
 
/*
* NOTE: Use the standard Console driver entry
*/
/*
* NOTE: Use the standard Clock driver entry
*/
/* functions */
 
rtems_isr_entry set_vector(rtems_isr_entry, rtems_vector_number, int);
void bsp_start( void );
void bsp_cleanup( void );
 
/* miscellaneous stuff assumed to exist */
 
extern rtems_configuration_table BSP_Configuration; /* owned by BSP */
extern rtems_cpu_table Cpu_table; /* owned by BSP */
 
extern int rtems_argc;
extern char **rtems_argv;
 
extern rtems_unsigned32 bsp_isr_level;
 
extern char *rtems_progname; /* UNIX executable name */
 
extern int cpu_number;
 
#ifdef __cplusplus
}
#endif
 
#endif
/* end of include file */
/posix/configure.in
0,0 → 1,49
dnl Process this file with autoconf to produce a configure script.
dnl
dnl $Id: configure.in,v 1.2 2001-09-27 12:01:14 chris Exp $
 
AC_PREREQ(2.13)
AC_INIT(bsp_specs)
RTEMS_TOP(../../../../../..)
AC_CONFIG_AUX_DIR(../../../../../..)
 
RTEMS_CANONICAL_TARGET_CPU
AM_INIT_AUTOMAKE(rtems-c-src-lib-libbsp-unix-posix,$RTEMS_VERSION,no)
AM_MAINTAINER_MODE
 
RTEMS_ENABLE_CXX
RTEMS_ENABLE_MULTIPROCESSING
 
RTEMS_ENV_RTEMSBSP
RTEMS_CANONICAL_HOST
 
RTEMS_PROG_CC_FOR_TARGET
 
if test "$RTEMS_HAS_CPLUSPLUS" = "yes"; then
RTEMS_PROG_CXX_FOR_TARGET
fi
 
RTEMS_CANONICALIZE_TOOLS
RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
RTEMS_CHECK_BSP_CACHE(RTEMS_BSP)
RTEMS_CHECK_MULTIPROCESSING(RTEMS_BSP)
 
RTEMS_CHECK_CXX
 
AC_CONFIG_SUBDIRS(tools)
AM_CONDITIONAL(HAS_MP,test "$HAS_MP" = "yes")
 
AM_CONDITIONAL(HAS_CXX,test "$HAS_CPLUSPLUS" = "yes")
 
RTEMS_PROJECT_ROOT
 
# Explicitly list all Makefiles here
AC_OUTPUT(
Makefile
clock/Makefile
console/Makefile
include/Makefile
shmsupp/Makefile
startup/Makefile
timer/Makefile
wrapup/Makefile)
/posix/Makefile.am
0,0 → 1,17
##
## $Id: Makefile.am,v 1.2 2001-09-27 12:01:14 chris Exp $
##
 
AUTOMAKE_OPTIONS = foreign 1.4
ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal
 
# wrapup is the one that actually builds and installs the library
# from the individual .rel files built in other directories
SUBDIRS = . include startup clock console timer shmsupp wrapup tools
 
include $(top_srcdir)/../../bsp.am
 
EXTRA_DIST = bsp_specs times
 
include $(top_srcdir)/../../../../../../automake/subdirs.am
include $(top_srcdir)/../../../../../../automake/local.am
/posix/clock/Makefile.am
0,0 → 1,33
##
## $Id: Makefile.am,v 1.2 2001-09-27 12:01:14 chris Exp $
##
 
AUTOMAKE_OPTIONS = foreign 1.4
 
PGM = $(ARCH)/clock.rel
 
C_FILES = clock.c
C_O_FILES = $(C_FILES:%.c=$(ARCH)/%.o)
 
OBJS = $(C_O_FILES)
 
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../../../../../../automake/lib.am
 
#
# (OPTIONAL) Add local stuff here using +=
#
 
$(PGM): $(OBJS)
$(make-rel)
 
# the .rel file built here will be put into libbsp.a by
# ../wrapup/Makefile
 
all-local: $(ARCH) $(OBJS) $(PGM)
 
.PRECIOUS: $(PGM)
 
EXTRA_DIST = clock.c
 
include $(top_srcdir)/../../../../../../automake/local.am
/posix/clock/clock.c
0,0 → 1,111
/* Clock
*
* This routine generates clock ticks using standard POSIX services.
* The tick frequency is specified by the bsp.
*
* COPYRIGHT (c) 1989-1999.
* 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: clock.c,v 1.2 2001-09-27 12:01:14 chris Exp $
*/
 
#include <bsp.h>
#include <rtems/libio.h>
#include <stdlib.h>
 
void Clock_exit(void);
 
volatile rtems_unsigned32 Clock_driver_ticks;
 
rtems_unsigned32 Clock_driver_vector;
 
/*
* These are set by clock driver during its init
*/
 
rtems_device_major_number rtems_clock_major = ~0;
rtems_device_minor_number rtems_clock_minor;
 
void Install_clock(rtems_isr_entry clock_isr)
{
Clock_driver_ticks = 0;
 
(void) set_vector( clock_isr, Clock_driver_vector, 1 );
 
_CPU_Start_clock( BSP_Configuration.microseconds_per_tick );
 
atexit(Clock_exit);
}
 
void Clock_isr(int vector)
{
Clock_driver_ticks++;
rtems_clock_tick();
}
 
/*
* Called via atexit()
* Remove the clock signal
*/
 
void Clock_exit(void)
{
_CPU_Stop_clock();
 
(void) set_vector( 0, Clock_driver_vector, 1 );
}
 
rtems_device_driver Clock_initialize(
rtems_device_major_number major,
rtems_device_minor_number minor,
void *pargp
)
{
Clock_driver_vector = _CPU_Get_clock_vector();
 
Install_clock((rtems_isr_entry) Clock_isr);
 
/*
* make major/minor avail to others such as shared memory driver
*/
rtems_clock_major = major;
rtems_clock_minor = minor;
 
return RTEMS_SUCCESSFUL;
}
 
rtems_device_driver Clock_control(
rtems_device_major_number major,
rtems_device_minor_number minor,
void *pargp
)
{
rtems_unsigned32 isrlevel;
rtems_libio_ioctl_args_t *args = pargp;
 
if (args == 0)
goto done;
 
/*
* This is hokey, but until we get a defined interface
* to do this, it will just be this simple...
*/
 
if (args->command == rtems_build_name('I', 'S', 'R', ' '))
{
Clock_isr(Clock_driver_vector);
}
else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
{
rtems_interrupt_disable( isrlevel );
(void) set_vector( args->buffer, Clock_driver_vector, 1 );
rtems_interrupt_enable( isrlevel );
}
done:
return RTEMS_SUCCESSFUL;
}
/posix/README
0,0 → 1,18
#
# $Id: README,v 1.2 2001-09-27 12:01:14 chris Exp $
#
 
 
This is a "generic" BSP for a modern UNIX system which is enough
System V and POSIX compliant to support at least the following:
+ semaphores
+ itimers
+ mmap
+ shared memory
 
At the moment, this BSP is known to work with the following UNIXes:
 
+ HP-UX 9.0.x
+ Solaris 2.x
+ Linux 1.1.x (single processor only -- mmap is broken)
/posix/wrapup/Makefile.am
0,0 → 1,43
##
## $Id: Makefile.am,v 1.2 2001-09-27 12:01:15 chris Exp $
##
 
AUTOMAKE_OPTIONS = foreign 1.4
 
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../../../../../../automake/lib.am
 
if HAS_MP
BSP_MP_O_FILES = shmsupp
endif
BSP_FILES = startup clock console timer $(BSP_MP_O_FILES)
 
# pieces to pick up out of libcpu/unix
 
if HAS_MP
GENERIC_MP_REL_FILES = shmdr
endif
GENERIC_FILES = $(GENERIC_MP_REL_FILES)
 
# bummer; have to use $foreach since % pattern subst rules only replace 1x
OBJS = $(foreach piece, $(BSP_FILES), $(wildcard ../$(piece)/$(ARCH)/*.o)) \
$(foreach piece, $(GENERIC_FILES), ../../../$(piece)/$(ARCH)/$(piece).rel)
LIB = $(ARCH)/libbsp.a
 
#
# (OPTIONAL) Add local stuff here using +=
#
 
$(LIB): $(OBJS)
$(make-library)
 
$(PROJECT_RELEASE)/lib/libbsp$(LIB_VARIANT).a: $(LIB)
$(INSTALL_DATA) $< $@
 
TMPINSTALL_FILES += $(PROJECT_RELEASE)/lib/libbsp$(LIB_VARIANT).a
 
all-local: $(ARCH) $(OBJS) $(LIB) $(TMPINSTALL_FILES)
 
.PRECIOUS: $(LIB)
 
include $(top_srcdir)/../../../../../../automake/local.am
/configure.in
0,0 → 1,24
dnl Process this file with autoconf to produce a configure script.
dnl
dnl $Id: configure.in,v 1.2 2001-09-27 12:01:14 chris Exp $
 
AC_PREREQ(2.13)
AC_INIT(posix)
RTEMS_TOP(../../../../..)
AC_CONFIG_AUX_DIR(../../../../..)
 
RTEMS_CANONICAL_TARGET_CPU
AM_INIT_AUTOMAKE(rtems-c-src-lib-libbsp-unix,$RTEMS_VERSION,no)
AM_MAINTAINER_MODE
 
RTEMS_ENV_RTEMSBSP
RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
RTEMS_CHECK_BSP_CACHE(RTEMS_BSP)
RTEMS_PROJECT_ROOT
 
RTEMS_BSP_ALIAS(${RTEMS_BSP},bspdir)
AC_CONFIG_SUBDIRS($bspdir)
 
# Explicitly list all Makefiles here
AC_OUTPUT(
Makefile)
/Makefile.am
0,0 → 1,12
##
## $Id: Makefile.am,v 1.2 2001-09-27 12:01:14 chris Exp $
##
 
AUTOMAKE_OPTIONS = foreign 1.4
ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal
 
# Descend into the $(RTEMS_BSP_FAMILY) directory
SUBDIRS = $(RTEMS_BSP_FAMILY)
 
include $(top_srcdir)/../../../../../automake/subdirs.am
include $(top_srcdir)/../../../../../automake/local.am

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.