mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-11-16 12:34:45 +00:00
Compare commits
1 Commits
18b2ce8e81
...
3.6.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43e1177def |
@@ -1,32 +0,0 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
Misc. support tools for RTEMS workspaces.
|
||||
More will be added later as they are converted from Teamware
|
||||
to CVS.
|
||||
|
||||
install-if-change
|
||||
Smart install script that also can append suffixes as it
|
||||
installs (suffixes used for debug and profile variants).
|
||||
Requires bash or ksh.
|
||||
|
||||
rcs-clean
|
||||
deletes all files from the current directory that can be
|
||||
re-created from RCS. Careful to not delete locked files.
|
||||
May be used by 'gmake clobber'
|
||||
|
||||
lock-directory
|
||||
unlock-directory
|
||||
traverse a directory structure making it unwritable.
|
||||
Useful to keep people from accidentally overwriting
|
||||
"released" trees if they get confused about which
|
||||
module they have loaded.
|
||||
|
||||
rtems-glom
|
||||
glom together all the rtems libraries in order to simplify
|
||||
the link line used by applications.
|
||||
Produces rtems.rel.
|
||||
Not used by the RTEMS src tree at all.
|
||||
Strictly optional.
|
||||
|
||||
@@ -1,364 +0,0 @@
|
||||
/*
|
||||
* cklength - check the length of lines in a file
|
||||
*
|
||||
* This program check to see if the files passed to it on the command line
|
||||
* contain a line which exceeds the maximum allowable length. The default
|
||||
* maximum line length is 80.
|
||||
*
|
||||
* usage: cklength [ -v ] [ arg ... ] files...
|
||||
* -l length -- maximum line length
|
||||
* -v -- verbose
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#define GETOPTARGS "l:nNv"
|
||||
|
||||
char *USAGE = "\
|
||||
usage: cklength [ -v ] [ arg ... ] files... \n\
|
||||
-l length -- maximum line length\n\
|
||||
-n -- report line numbers for offending lines\n\
|
||||
-N -- report line numbers and length for offending lines\n\
|
||||
-v -- verbose\n\
|
||||
\n\
|
||||
Print the name of files which have at least 1 line which exceeds the\n\
|
||||
maximum line length. The default maximum line length is 80.\n\
|
||||
";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#define BUFFER_SIZE 512
|
||||
|
||||
#define SUCCESS 0
|
||||
#define FAILURE -1
|
||||
#define Failed(x) (((int) (x)) == FAILURE)
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#define STREQ(a,b) (strcmp(a,b) == 0)
|
||||
#define NUMELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
|
||||
|
||||
/*
|
||||
* Definitions for unsigned "ints"; especially for use in data structures
|
||||
* that will be shared among (potentially) different cpu's (we punt on
|
||||
* byte ordering problems tho)
|
||||
*/
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned long u32;
|
||||
|
||||
/*
|
||||
* vars controlled by command line options
|
||||
*/
|
||||
|
||||
int verbose = FALSE; /* be verbose */
|
||||
int report_line_numbers = FALSE; /* report line numbers of offenders */
|
||||
int report_line_length = FALSE; /* report line length of offenders */
|
||||
|
||||
int line_length = 80; /* maximum allowable line length */
|
||||
|
||||
extern char *optarg; /* getopt(3) control vars */
|
||||
extern int optind, opterr;
|
||||
extern int errno;
|
||||
|
||||
char *progname; /* for error() */
|
||||
|
||||
int process(char *arg);
|
||||
void error(int errn, ...);
|
||||
long getparm(char *s, long min, long max, char *msg);
|
||||
|
||||
#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
|
||||
#define ERR_FATAL (ERR_ERRNO / 2) /* fatal error ; no return */
|
||||
#define ERR_ABORT (ERR_ERRNO / 4) /* fatal error ; abort */
|
||||
#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
|
||||
|
||||
#define stol(p) strtol(p, (char **) NULL, 0)
|
||||
int Open(), Read(), Write();
|
||||
|
||||
int
|
||||
main(int argc, char **argv, char **env)
|
||||
{
|
||||
register int c;
|
||||
int showusage = FALSE; /* usage error? */
|
||||
int rc = 0;
|
||||
|
||||
/*
|
||||
* figure out invocation leaf-name
|
||||
*/
|
||||
|
||||
if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
|
||||
progname = argv[0];
|
||||
else
|
||||
progname++;
|
||||
|
||||
argv[0] = progname; /* for getopt err reporting */
|
||||
|
||||
/*
|
||||
* Check options and arguments.
|
||||
*/
|
||||
|
||||
opterr = 0; /* we'll report all errors */
|
||||
while ((c = getopt(argc, argv, GETOPTARGS)) != EOF)
|
||||
switch (c)
|
||||
{
|
||||
case 'l': /* line length */
|
||||
line_length = atoi( optarg );
|
||||
if ( line_length < 0 || line_length > BUFFER_SIZE )
|
||||
error(ERR_FATAL, "(%d) is illegal line length\n",line_length);
|
||||
break;
|
||||
|
||||
case 'n': /* toggle report_line_numbers */
|
||||
report_line_numbers = ! report_line_numbers;
|
||||
break;
|
||||
|
||||
case 'N': /* toggle both reports */
|
||||
report_line_numbers = ! report_line_numbers;
|
||||
report_line_length = ! report_line_length;
|
||||
break;
|
||||
|
||||
case 'v': /* toggle verbose */
|
||||
verbose = ! verbose;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
showusage = TRUE;
|
||||
}
|
||||
|
||||
if (showusage)
|
||||
{
|
||||
(void) fprintf(stderr, "%s", USAGE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* traverse and process the arguments
|
||||
*/
|
||||
|
||||
for ( ; argv[optind]; optind++)
|
||||
if (Failed(process(argv[optind])))
|
||||
rc = FAILURE;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* process(arg)
|
||||
*/
|
||||
|
||||
int
|
||||
process(char *arg)
|
||||
{
|
||||
FILE *in;
|
||||
char *bptr;
|
||||
char buffer[ BUFFER_SIZE ];
|
||||
int line_number;
|
||||
int length;
|
||||
int count;
|
||||
int rc = SUCCESS; /* succeed by default */
|
||||
|
||||
in = fopen( arg, "r" );
|
||||
if (!in)
|
||||
error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
|
||||
|
||||
count = 0;
|
||||
|
||||
for ( line_number=1 ; ; line_number++ ) {
|
||||
bptr = fgets( buffer, BUFFER_SIZE, in );
|
||||
if (!bptr)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Don't count the carriage return.
|
||||
*/
|
||||
|
||||
length = strlen( buffer ) - 1;
|
||||
|
||||
if ( length <= line_length )
|
||||
continue;
|
||||
|
||||
if ( count == 0 ) {
|
||||
fprintf( stderr, "%s\n", arg );
|
||||
if ( !report_line_numbers )
|
||||
break;
|
||||
}
|
||||
|
||||
if ( verbose )
|
||||
fprintf( stderr, "TOO LONG:%d: %s\n", line_number, buffer );
|
||||
|
||||
if ( report_line_numbers ) {
|
||||
if ( report_line_length )
|
||||
fprintf( stderr, "%d: %d\n" , line_number, length );
|
||||
else
|
||||
fprintf( stderr, "%d\n" , line_number );
|
||||
}
|
||||
|
||||
count++;
|
||||
|
||||
}
|
||||
|
||||
fclose( in );
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* error(errn, arglist)
|
||||
* report an error to stderr using printf(3) conventions.
|
||||
* Any output is preceded by '<progname>: '
|
||||
*
|
||||
* Uses ERR_FATAL bit to request exit(errn)
|
||||
* ERR_ABORT to request abort()
|
||||
* ERR_ERRNO to indicate use of errno instead of argument.
|
||||
*
|
||||
* If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
|
||||
* associated error message is appended to the output.
|
||||
*/
|
||||
|
||||
/*VARARGS*/
|
||||
|
||||
void
|
||||
error(int error_flag, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
register char *format;
|
||||
extern char *sys_errlist[];
|
||||
extern int sys_nerr;
|
||||
int local_errno;
|
||||
|
||||
extern int errno;
|
||||
|
||||
(void) fflush(stdout); /* in case stdout/stderr same */
|
||||
|
||||
local_errno = error_flag & ~ERR_MASK;
|
||||
if (error_flag & ERR_ERRNO) /* use errno? */
|
||||
local_errno = errno;
|
||||
|
||||
va_start(arglist, error_flag);
|
||||
format = va_arg(arglist, char *);
|
||||
(void) fprintf(stderr, "%s: ", progname);
|
||||
(void) vfprintf(stderr, format, arglist);
|
||||
va_end(arglist);
|
||||
|
||||
if (local_errno)
|
||||
if ((local_errno > 0) && (local_errno < sys_nerr))
|
||||
(void) fprintf(stderr, " (%s)\n", sys_errlist[local_errno]);
|
||||
else
|
||||
(void) fprintf(stderr, " (unknown errno=%d)\n", local_errno);
|
||||
else
|
||||
(void) fprintf(stderr, "\n");
|
||||
|
||||
(void) fflush(stderr);
|
||||
|
||||
if (error_flag & (ERR_FATAL | ERR_ABORT))
|
||||
{
|
||||
if (error_flag & ERR_FATAL)
|
||||
{
|
||||
error(0, "fatal error, exiting");
|
||||
exit(local_errno ? local_errno : 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
error(0, "fatal error, aborting");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long
|
||||
getparm(char *s,
|
||||
long min,
|
||||
long max,
|
||||
char *msg)
|
||||
{
|
||||
long val;
|
||||
|
||||
if ( ! strchr("0123456789-", *s))
|
||||
{
|
||||
error(ERR_FATAL, "'%s' is not a number", s);
|
||||
return min;
|
||||
}
|
||||
|
||||
val = strtol(s, (char **) NULL, 0);
|
||||
if ((val < min) || (val > max))
|
||||
{
|
||||
if (min == max)
|
||||
error(ERR_FATAL, "%s can only be %ld", s, min);
|
||||
else
|
||||
error(ERR_FATAL, "%s must be between %ld and %ld", msg, min, max);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Open()
|
||||
* Perform open(2), returning the file descriptor. Prints
|
||||
* error message if open fails.
|
||||
*/
|
||||
|
||||
int
|
||||
Open(char *file,
|
||||
int oflag,
|
||||
int mode)
|
||||
{
|
||||
int O_fd;
|
||||
|
||||
if (Failed(O_fd = open(file, oflag, mode)))
|
||||
error(
|
||||
ERR_ERRNO | ERR_FATAL,
|
||||
"open('%s', 0x%x, 0%o) failed", file, oflag, mode
|
||||
);
|
||||
|
||||
return O_fd;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read()
|
||||
* Perform read(2); prints error message if fails.
|
||||
*/
|
||||
|
||||
int
|
||||
Read(int file,
|
||||
char *buffer,
|
||||
unsigned int count)
|
||||
{
|
||||
int nbytes;
|
||||
|
||||
if (Failed(nbytes = read(file, buffer, count)))
|
||||
error(
|
||||
ERR_ERRNO | ERR_FATAL,
|
||||
"read(%d, 0x%x, %d) failed", file, buffer, count
|
||||
);
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write()
|
||||
* Perform write(2); prints error message if fails.
|
||||
*/
|
||||
|
||||
int
|
||||
Write(int file,
|
||||
char *buffer,
|
||||
unsigned int count)
|
||||
{
|
||||
int nbytes;
|
||||
|
||||
if (Failed(nbytes = write(file, buffer, count)))
|
||||
error(
|
||||
ERR_ERRNO | ERR_FATAL,
|
||||
"write(%d, 0x%x, %d) failed", file, buffer, count
|
||||
);
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
@@ -1,351 +0,0 @@
|
||||
/*
|
||||
* eolstrip - strip white space from end of lines
|
||||
*
|
||||
* This program strips the white space from the end of every line in the
|
||||
* specified program.
|
||||
*
|
||||
* usage: eolstrip [ -v ] [ arg ... ] files...
|
||||
* -v -- verbose
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#define GETOPTARGS "vt"
|
||||
|
||||
char *USAGE = "\
|
||||
usage: cklength [ -v ] [ arg ... ] files... \n\
|
||||
-v -- verbose\n\
|
||||
-t -- test only .. DO NOT OVERWRITE FILE!!!\n\
|
||||
\n\
|
||||
Strip the white space from the end of every line on the list of files.\n\
|
||||
";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#define BUFFER_SIZE 2048
|
||||
#define MAX_PATH 2048
|
||||
|
||||
#define SUCCESS 0
|
||||
#define FAILURE -1
|
||||
#define Failed(x) (((int) (x)) == FAILURE)
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#define STREQ(a,b) (strcmp(a,b) == 0)
|
||||
#define NUMELEMS(arr) (sizeof(arr) / sizeof(arr[0]))
|
||||
|
||||
/*
|
||||
* Definitions for unsigned "ints"; especially for use in data structures
|
||||
* that will be shared among (potentially) different cpu's (we punt on
|
||||
* byte ordering problems tho)
|
||||
*/
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned long u32;
|
||||
|
||||
/*
|
||||
* vars controlled by command line options
|
||||
*/
|
||||
|
||||
int verbose = FALSE; /* be verbose */
|
||||
int test_only = FALSE; /* test only */
|
||||
|
||||
extern char *optarg; /* getopt(3) control vars */
|
||||
extern int optind, opterr;
|
||||
extern int errno;
|
||||
|
||||
char *progname; /* for error() */
|
||||
|
||||
int process(char *arg);
|
||||
void error(int errn, ...);
|
||||
long getparm(char *s, long min, long max, char *msg);
|
||||
|
||||
#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
|
||||
#define ERR_FATAL (ERR_ERRNO / 2) /* fatal error ; no return */
|
||||
#define ERR_ABORT (ERR_ERRNO / 4) /* fatal error ; abort */
|
||||
#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
|
||||
|
||||
#define stol(p) strtol(p, (char **) NULL, 0)
|
||||
int Open(), Read(), Write();
|
||||
|
||||
int
|
||||
main(int argc, char **argv, char **env)
|
||||
{
|
||||
register int c;
|
||||
int showusage = FALSE; /* usage error? */
|
||||
int rc = 0;
|
||||
|
||||
/*
|
||||
* figure out invocation leaf-name
|
||||
*/
|
||||
|
||||
if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
|
||||
progname = argv[0];
|
||||
else
|
||||
progname++;
|
||||
|
||||
argv[0] = progname; /* for getopt err reporting */
|
||||
|
||||
/*
|
||||
* Check options and arguments.
|
||||
*/
|
||||
|
||||
opterr = 0; /* we'll report all errors */
|
||||
while ((c = getopt(argc, argv, GETOPTARGS)) != EOF)
|
||||
switch (c)
|
||||
{
|
||||
case 't': /* toggle test only mode */
|
||||
test_only = ! test_only;
|
||||
break;
|
||||
|
||||
case 'v': /* toggle verbose */
|
||||
verbose = ! verbose;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
showusage = TRUE;
|
||||
}
|
||||
|
||||
if (showusage)
|
||||
{
|
||||
(void) fprintf(stderr, "%s", USAGE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* traverse and process the arguments
|
||||
*/
|
||||
|
||||
for ( ; argv[optind]; optind++)
|
||||
if (Failed(process(argv[optind])))
|
||||
rc = FAILURE;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* process(arg)
|
||||
*/
|
||||
|
||||
int
|
||||
process(char *arg)
|
||||
{
|
||||
FILE *in;
|
||||
FILE *out = (FILE *) 0;
|
||||
char outname[ MAX_PATH ];
|
||||
char *bptr;
|
||||
char buffer[ BUFFER_SIZE ];
|
||||
int length;
|
||||
int line_number;
|
||||
int rc = SUCCESS; /* succeed by default */
|
||||
|
||||
in = fopen( arg, "r" );
|
||||
if (!in)
|
||||
error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
|
||||
|
||||
if ( !test_only ) {
|
||||
sprintf( outname, "%s.eoltmp", arg );
|
||||
|
||||
out = fopen( outname, "w" );
|
||||
if (!out)
|
||||
error( ERR_ERRNO | ERR_FATAL, "Unable to open file (%s)\n", arg );
|
||||
}
|
||||
|
||||
if ( verbose )
|
||||
fprintf( stderr, "Processing %s\n", arg );
|
||||
|
||||
for ( line_number=1 ; ; line_number++ ) {
|
||||
bptr = fgets( buffer, BUFFER_SIZE, in );
|
||||
if (!bptr)
|
||||
break;
|
||||
|
||||
/*
|
||||
* Don't count the carriage return.
|
||||
*/
|
||||
|
||||
length = strlen( buffer ) - 1;
|
||||
|
||||
if ( buffer[ length ] != '\n' )
|
||||
error(ERR_ERRNO|ERR_FATAL, "Line %d too long in %s\n", line_number, arg);
|
||||
|
||||
while ( isspace( buffer[ length ] ) )
|
||||
buffer[ length-- ] = '\0';
|
||||
|
||||
if ( test_only ) {
|
||||
fprintf( stderr, "%s\n", arg );
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf( out, "%s\n", buffer );
|
||||
}
|
||||
|
||||
fclose( in );
|
||||
if ( !test_only ) {
|
||||
fclose( out );
|
||||
rename( outname, arg );
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* error(errn, arglist)
|
||||
* report an error to stderr using printf(3) conventions.
|
||||
* Any output is preceded by '<progname>: '
|
||||
*
|
||||
* Uses ERR_FATAL bit to request exit(errn)
|
||||
* ERR_ABORT to request abort()
|
||||
* ERR_ERRNO to indicate use of errno instead of argument.
|
||||
*
|
||||
* If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
|
||||
* associated error message is appended to the output.
|
||||
*/
|
||||
|
||||
/*VARARGS*/
|
||||
|
||||
void
|
||||
error(int error_flag, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
register char *format;
|
||||
extern char *sys_errlist[];
|
||||
extern int sys_nerr;
|
||||
int local_errno;
|
||||
|
||||
extern int errno;
|
||||
|
||||
(void) fflush(stdout); /* in case stdout/stderr same */
|
||||
|
||||
local_errno = error_flag & ~ERR_MASK;
|
||||
if (error_flag & ERR_ERRNO) /* use errno? */
|
||||
local_errno = errno;
|
||||
|
||||
va_start(arglist, error_flag);
|
||||
format = va_arg(arglist, char *);
|
||||
(void) fprintf(stderr, "%s: ", progname);
|
||||
(void) vfprintf(stderr, format, arglist);
|
||||
va_end(arglist);
|
||||
|
||||
if (local_errno)
|
||||
if ((local_errno > 0) && (local_errno < sys_nerr))
|
||||
(void) fprintf(stderr, " (%s)\n", sys_errlist[local_errno]);
|
||||
else
|
||||
(void) fprintf(stderr, " (unknown errno=%d)\n", local_errno);
|
||||
else
|
||||
(void) fprintf(stderr, "\n");
|
||||
|
||||
(void) fflush(stderr);
|
||||
|
||||
if (error_flag & (ERR_FATAL | ERR_ABORT))
|
||||
{
|
||||
if (error_flag & ERR_FATAL)
|
||||
{
|
||||
error(0, "fatal error, exiting");
|
||||
exit(local_errno ? local_errno : 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
error(0, "fatal error, aborting");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long
|
||||
getparm(char *s,
|
||||
long min,
|
||||
long max,
|
||||
char *msg)
|
||||
{
|
||||
long val;
|
||||
|
||||
if ( ! strchr("0123456789-", *s))
|
||||
{
|
||||
error(ERR_FATAL, "'%s' is not a number", s);
|
||||
return min;
|
||||
}
|
||||
|
||||
val = strtol(s, (char **) NULL, 0);
|
||||
if ((val < min) || (val > max))
|
||||
{
|
||||
if (min == max)
|
||||
error(ERR_FATAL, "%s can only be %ld", s, min);
|
||||
else
|
||||
error(ERR_FATAL, "%s must be between %ld and %ld", msg, min, max);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Open()
|
||||
* Perform open(2), returning the file descriptor. Prints
|
||||
* error message if open fails.
|
||||
*/
|
||||
|
||||
int
|
||||
Open(char *file,
|
||||
int oflag,
|
||||
int mode)
|
||||
{
|
||||
int O_fd;
|
||||
|
||||
if (Failed(O_fd = open(file, oflag, mode)))
|
||||
error(
|
||||
ERR_ERRNO | ERR_FATAL,
|
||||
"open('%s', 0x%x, 0%o) failed", file, oflag, mode
|
||||
);
|
||||
|
||||
return O_fd;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read()
|
||||
* Perform read(2); prints error message if fails.
|
||||
*/
|
||||
|
||||
int
|
||||
Read(int file,
|
||||
char *buffer,
|
||||
unsigned int count)
|
||||
{
|
||||
int nbytes;
|
||||
|
||||
if (Failed(nbytes = read(file, buffer, count)))
|
||||
error(
|
||||
ERR_ERRNO | ERR_FATAL,
|
||||
"read(%d, 0x%x, %d) failed", file, buffer, count
|
||||
);
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write()
|
||||
* Perform write(2); prints error message if fails.
|
||||
*/
|
||||
|
||||
int
|
||||
Write(int file,
|
||||
char *buffer,
|
||||
unsigned int count)
|
||||
{
|
||||
int nbytes;
|
||||
|
||||
if (Failed(nbytes = write(file, buffer, count)))
|
||||
error(
|
||||
ERR_ERRNO | ERR_FATAL,
|
||||
"write(%d, 0x%x, %d) failed", file, buffer, count
|
||||
);
|
||||
|
||||
return nbytes;
|
||||
}
|
||||
@@ -1,513 +0,0 @@
|
||||
|
||||
/***** P A C K H E X . C ************************************************
|
||||
*
|
||||
* Packhex is a hex-file compaction utility. It attempts to concatenate
|
||||
* hex records to produce more size-efficient packaging.
|
||||
*
|
||||
* Limitations: Input files must be correctly formatted. This utility
|
||||
* is not robust enough to detect hex-record formatting
|
||||
* errors.
|
||||
*
|
||||
* Published: 5/93 Embedded Systems magazine
|
||||
*
|
||||
* Compiler: Microsoft C 6.0
|
||||
* cl /F 1000 packhex.c
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
/* #define SMALLER_RECORDS */
|
||||
#ifdef SMALLER_RECORDS
|
||||
#define MAX_LEN_S1_RECS 128
|
||||
#define MAX_LEN_S2_RECS 128
|
||||
#define MAX_LEN_S3_RECS 128
|
||||
#else
|
||||
#define MAX_LEN_S1_RECS 252
|
||||
#define MAX_LEN_S2_RECS 251
|
||||
#define MAX_LEN_S3_RECS 250
|
||||
#endif
|
||||
|
||||
|
||||
/*--------------------------------- includes ---------------------------------*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(__unix__) && !defined(EXIT_FAILURE)
|
||||
#define EXIT_FAILURE -1
|
||||
#define EXIT_SUCCESS 0
|
||||
#endif
|
||||
|
||||
/*--------------------------------- defines ----------------------------------*/
|
||||
|
||||
#define YES 1
|
||||
#define MAX_LINE_SIZE 600
|
||||
#define EOS '\0'
|
||||
|
||||
|
||||
/*---------------------------------- macros ----------------------------------*/
|
||||
|
||||
/* Convert ASCII hexadecimal digit to value. */
|
||||
|
||||
#define HEX_DIGIT( C ) ( ( ( ( C ) > '9' ) ? ( C ) + 25 : ( C ) ) & 0xF )
|
||||
|
||||
|
||||
/*--------------------------------- typedefs ---------------------------------*/
|
||||
|
||||
typedef unsigned char Boolean;
|
||||
typedef unsigned char Uchar;
|
||||
typedef unsigned int Uint;
|
||||
typedef unsigned long Ulong;
|
||||
|
||||
typedef struct /* Functions and constant returning Hex-record vital stats. */
|
||||
{
|
||||
Boolean ( *is_data_record )( char * );
|
||||
Ulong ( *get_address )( char * );
|
||||
Uint ( *get_data_count )( char * );
|
||||
const Uint max_data_count;
|
||||
char *( *get_data_start )( char * );
|
||||
void ( *put_data_record )( Uint, Ulong, char * );
|
||||
} Rec_vitals;
|
||||
|
||||
|
||||
/*--------------------------- function prototypes ----------------------------*/
|
||||
|
||||
Rec_vitals * identify_first_data_record( char * );
|
||||
Ulong get_ndigit_hex( char *, int );
|
||||
|
||||
|
||||
/*----------------------------- Intel Hex format -----------------------------*/
|
||||
|
||||
/*
|
||||
* Intel Hex data-record layout
|
||||
*
|
||||
* :aabbbbccd...dee
|
||||
*
|
||||
* : - header character
|
||||
* aa - record data byte count, a 2-digit hex value
|
||||
* bbbb - record address, a 4-digit hex value
|
||||
* cc - record type, a 2-digit hex value:
|
||||
* "00" is a data record
|
||||
* "01" is an end-of-data record
|
||||
* "02" is an extended-address record
|
||||
* "03" is a start record
|
||||
* d...d - data (always an even number of chars)
|
||||
* ee - record checksum, a 2-digit hex value
|
||||
* checksum = 2's complement
|
||||
* [ (sum of bytes: aabbbbccd...d) modulo 256 ]
|
||||
*/
|
||||
|
||||
|
||||
Boolean is_intel_data_rec( char * rec_str )
|
||||
{
|
||||
return( ( rec_str[ 0 ] == ':' ) && ( rec_str[ 8 ] == '0' ) );
|
||||
}
|
||||
|
||||
Uint get_intel_rec_data_count( char * rec_str )
|
||||
{
|
||||
return( ( Uint ) get_ndigit_hex( rec_str + 1, 2 ) );
|
||||
}
|
||||
|
||||
Ulong get_intel_rec_address( char * rec_str )
|
||||
{
|
||||
return( get_ndigit_hex( rec_str + 3, 4 ) );
|
||||
}
|
||||
|
||||
char * get_intel_rec_data_start( char * rec_str )
|
||||
{
|
||||
return( rec_str + 9 );
|
||||
}
|
||||
|
||||
void put_intel_data_rec( Uint count, Ulong address, char * data_str )
|
||||
{
|
||||
char *ptr;
|
||||
Uint sum = count + ( address >> 8 & 0xff ) + ( address & 0xff );
|
||||
|
||||
for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
|
||||
sum += ( Uint ) get_ndigit_hex( ptr, 2 );
|
||||
|
||||
printf(
|
||||
":%02X%04lX00%s%02X\n", count, address, data_str, (~sum + 1) & 0xff
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Rec_vitals intel_hex =
|
||||
{
|
||||
is_intel_data_rec,
|
||||
get_intel_rec_address,
|
||||
get_intel_rec_data_count,
|
||||
255, /* Maximum data bytes in a record. */
|
||||
get_intel_rec_data_start,
|
||||
put_intel_data_rec
|
||||
};
|
||||
|
||||
|
||||
/*------------------------- Motorola S1-record format ------------------------*/
|
||||
|
||||
/*
|
||||
* Motorola S-record data-record layout
|
||||
*
|
||||
* Sabbc...cd...dee
|
||||
*
|
||||
* S - header character
|
||||
* a - record type, a 1-digit value:
|
||||
* "0" is a header record
|
||||
* "1" is a 2-byte-address data record
|
||||
* "2" is a 3-byte-address data record
|
||||
* "3" is a 4-byte-address data record
|
||||
* "7" is a 4-byte-address end-of-data record
|
||||
* "8" is a 3-byte-address end-of-data record
|
||||
* "9" is a 2-byte-address end-of-data record
|
||||
* bb - record length in bytes, a 2-digit hex value
|
||||
* (record length doesn't count the header/type
|
||||
* chars and checksum byte)
|
||||
* c...c - record address, a 4-, 6-, or 8-digit value,
|
||||
* depending on record type
|
||||
* d...d - data (always an even number of chars)
|
||||
* ee - record checksum, a 2-digit hex value
|
||||
* checksum = 1's complement
|
||||
* [ (sum of all bytes: bbc..cd...d) modulo 256 ]
|
||||
*/
|
||||
|
||||
#define S1_COUNT_OFFSET 3
|
||||
|
||||
|
||||
Boolean is_moto_s1_data_rec( char * rec_str )
|
||||
{
|
||||
return ( ( rec_str[ 0 ] == 'S' ) && ( rec_str[ 1 ] == '1' ) );
|
||||
}
|
||||
|
||||
Uint get_moto_s1_rec_data_count( char * rec_str )
|
||||
{
|
||||
return( ( Uint ) get_ndigit_hex( rec_str + 2, 2 ) - S1_COUNT_OFFSET );
|
||||
}
|
||||
|
||||
Ulong get_moto_s1_rec_address( char * rec_str )
|
||||
{
|
||||
return( get_ndigit_hex( rec_str + 4, 4 ) );
|
||||
}
|
||||
|
||||
char * get_moto_s1_rec_data_start( char * rec_str )
|
||||
{
|
||||
return( rec_str + 8 );
|
||||
}
|
||||
|
||||
void put_moto_s1_data_rec( Uint count, Ulong address, char * data_str )
|
||||
{
|
||||
char *ptr;
|
||||
Uint sum = S1_COUNT_OFFSET + count +
|
||||
( address >> 8 & 0xff ) + ( address & 0xff );
|
||||
|
||||
for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
|
||||
sum += ( Uint ) get_ndigit_hex( ptr, 2 );
|
||||
|
||||
printf(
|
||||
"S1%02X%04lX%s%02X\n",
|
||||
count + S1_COUNT_OFFSET, address, data_str, ~sum & 0xff
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Rec_vitals motorola_s1_rec =
|
||||
{
|
||||
is_moto_s1_data_rec,
|
||||
get_moto_s1_rec_address,
|
||||
get_moto_s1_rec_data_count,
|
||||
MAX_LEN_S1_RECS, /* Maximum data bytes in a record. */
|
||||
get_moto_s1_rec_data_start,
|
||||
put_moto_s1_data_rec
|
||||
};
|
||||
|
||||
|
||||
/*------------------------- Motorola S2-record format ------------------------*/
|
||||
|
||||
#define S2_COUNT_OFFSET 4
|
||||
|
||||
Boolean is_moto_s2_data_rec( char * rec_str )
|
||||
{
|
||||
return ( ( rec_str[ 0 ] == 'S' ) && ( rec_str[ 1 ] == '2' ) );
|
||||
}
|
||||
|
||||
Uint get_moto_s2_rec_data_count( char * rec_str )
|
||||
{
|
||||
return( ( Uint ) get_ndigit_hex( rec_str + 2, 2 ) - S2_COUNT_OFFSET );
|
||||
}
|
||||
|
||||
Ulong get_moto_s2_rec_address( char * rec_str )
|
||||
{
|
||||
return( get_ndigit_hex( rec_str + 4, 6 ) );
|
||||
}
|
||||
|
||||
char * get_moto_s2_rec_data_start( char * rec_str )
|
||||
{
|
||||
return( rec_str + 10 );
|
||||
}
|
||||
|
||||
void put_moto_s2_data_rec( Uint count, Ulong address, char * data_str )
|
||||
{
|
||||
char *ptr;
|
||||
Uint sum = S2_COUNT_OFFSET + count + ( address >> 16 & 0xff ) +
|
||||
( address >> 8 & 0xff ) +
|
||||
( address & 0xff );
|
||||
|
||||
for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
|
||||
sum += ( Uint ) get_ndigit_hex( ptr, 2 );
|
||||
|
||||
printf(
|
||||
"S2%02X%06lX%s%02X\n",
|
||||
count + S2_COUNT_OFFSET, address, data_str, ~sum & 0xff
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Rec_vitals motorola_s2_rec =
|
||||
{
|
||||
is_moto_s2_data_rec,
|
||||
get_moto_s2_rec_address,
|
||||
get_moto_s2_rec_data_count,
|
||||
MAX_LEN_S2_RECS, /* Maximum data bytes in a record. */
|
||||
get_moto_s2_rec_data_start,
|
||||
put_moto_s2_data_rec
|
||||
};
|
||||
|
||||
|
||||
/*------------------------- Motorola S3-record format ------------------------*/
|
||||
|
||||
#define S3_COUNT_OFFSET 5
|
||||
|
||||
Boolean is_moto_s3_data_rec( char * rec_str )
|
||||
{
|
||||
return ( ( rec_str[ 0 ] == 'S' ) && ( rec_str[ 1 ] == '3' ) );
|
||||
}
|
||||
|
||||
Uint get_moto_s3_rec_data_count( char * rec_str )
|
||||
{
|
||||
return( ( Uint ) get_ndigit_hex( rec_str + 2, 2 ) - S3_COUNT_OFFSET );
|
||||
}
|
||||
|
||||
Ulong get_moto_s3_rec_address( char * rec_str )
|
||||
{
|
||||
return( get_ndigit_hex( rec_str + 4, 8 ) );
|
||||
}
|
||||
|
||||
char * get_moto_s3_rec_data_start( char * rec_str )
|
||||
{
|
||||
return( rec_str + 12 );
|
||||
}
|
||||
|
||||
void put_moto_s3_data_rec( Uint count, Ulong address, char * data_str )
|
||||
{
|
||||
char *ptr;
|
||||
Uint sum = S3_COUNT_OFFSET + count + ( address >> 24 & 0xff ) +
|
||||
( address >> 16 & 0xff ) +
|
||||
( address >> 8 & 0xff ) +
|
||||
( address & 0xff );
|
||||
|
||||
for ( ptr = data_str ; *ptr != EOS ; ptr += 2 )
|
||||
sum += ( Uint ) get_ndigit_hex( ptr, 2 );
|
||||
|
||||
printf(
|
||||
"S3%02X%08lX%s%02X\n",
|
||||
count + S3_COUNT_OFFSET, address, data_str, ~sum & 0xff
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Rec_vitals motorola_s3_rec =
|
||||
{
|
||||
is_moto_s3_data_rec,
|
||||
get_moto_s3_rec_address,
|
||||
get_moto_s3_rec_data_count,
|
||||
MAX_LEN_S3_RECS, /* Maximum data bytes in a record. */
|
||||
get_moto_s3_rec_data_start,
|
||||
put_moto_s3_data_rec
|
||||
};
|
||||
|
||||
|
||||
/*-------------------- Put your favorite hex format here ---------------------*/
|
||||
|
||||
/*
|
||||
* * * * The following is a template for an additional hex format: * * *
|
||||
*
|
||||
*
|
||||
* Boolean is_X_data_rec( char * rec_str ) {}
|
||||
*
|
||||
* Uint get_X_rec_data_count( char * rec_str ) {}
|
||||
*
|
||||
* Ulong get_X_rec_address( char * rec_str ) {}
|
||||
*
|
||||
* char * get_X_rec_data_start( char * rec_str ) {}
|
||||
*
|
||||
* void put_X_data_rec( Uint count, Ulong address, char * data_str ) {}
|
||||
*
|
||||
* Rec_vitals X_rec =
|
||||
* {
|
||||
* is_X_data_rec,
|
||||
* get_X_rec_address,
|
||||
* get_X_rec_data_count,
|
||||
* MAXIMUM DATA BYTES IN A RECORD,
|
||||
* get_X_rec_data_start,
|
||||
* put_X_data_rec
|
||||
* };
|
||||
*
|
||||
*/
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*
|
||||
* Put address of additional Rec_vitals structures
|
||||
* in this array, before the NULL entry.
|
||||
*/
|
||||
|
||||
Rec_vitals *formats[] =
|
||||
{
|
||||
&intel_hex,
|
||||
&motorola_s1_rec,
|
||||
&motorola_s2_rec,
|
||||
&motorola_s3_rec,
|
||||
( Rec_vitals * ) NULL
|
||||
};
|
||||
|
||||
|
||||
/**** main *****************************************************************
|
||||
*
|
||||
*
|
||||
* Expects: Nothing (no command-line parameters).
|
||||
*
|
||||
* Returns: Exit status (EXIT_SUCCESS or EXIT_FAILURE).
|
||||
*
|
||||
* Reads hex records on the standard input and attempts to
|
||||
* splice adjacent data fields together. Results appear on
|
||||
* the standard output.
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
void main( void )
|
||||
{
|
||||
|
||||
char inbuff[ MAX_LINE_SIZE ], outbuff[ MAX_LINE_SIZE ];
|
||||
char *in_dptr, *out_dptr;
|
||||
int d_total, d_count, d_excess, n;
|
||||
Ulong in_rec_addr, out_rec_addr = 0;
|
||||
Rec_vitals *rptr;
|
||||
|
||||
|
||||
/* Sift through file until first hex record is identified. */
|
||||
if ( ( rptr = identify_first_data_record( inbuff ) ) == NULL )
|
||||
{
|
||||
fputs( "No hex records found.\n", stderr );
|
||||
exit( EXIT_FAILURE );
|
||||
}
|
||||
|
||||
|
||||
/* Attempt data-record splicing until end-of-file is reached. */
|
||||
d_total = 0;
|
||||
do
|
||||
{
|
||||
if ( rptr->is_data_record( inbuff ) == YES )
|
||||
{ /* Input record is a data record. */
|
||||
d_count = rptr->get_data_count( inbuff );
|
||||
in_rec_addr = rptr->get_address( inbuff );
|
||||
in_dptr = rptr->get_data_start( inbuff );
|
||||
|
||||
if ( d_total == 0 || in_rec_addr != out_rec_addr + d_total )
|
||||
{ /* Begin a new output record. */
|
||||
if ( d_total != 0 )
|
||||
rptr->put_data_record( d_total, out_rec_addr, outbuff );
|
||||
out_dptr = outbuff;
|
||||
n = d_total = d_count;
|
||||
out_rec_addr = in_rec_addr;
|
||||
}
|
||||
else if
|
||||
( ( d_excess = d_total + d_count - rptr->max_data_count ) > 0 )
|
||||
{ /* Output a maximum-length record, then start a new record. */
|
||||
strncat( outbuff, in_dptr, 2 * ( d_count - d_excess ) );
|
||||
rptr->put_data_record(
|
||||
rptr->max_data_count, out_rec_addr, outbuff
|
||||
);
|
||||
in_dptr += 2 * ( d_count - d_excess );
|
||||
out_dptr = outbuff;
|
||||
n = d_total = d_excess;
|
||||
out_rec_addr += rptr->max_data_count;
|
||||
}
|
||||
else
|
||||
{ /* Append input record's data field with accumulated data. */
|
||||
out_dptr = outbuff + ( 2 * d_total );
|
||||
d_total += n = d_count;
|
||||
}
|
||||
strncpy( out_dptr, in_dptr, 2 * n );
|
||||
out_dptr[ 2 * n ] = EOS;
|
||||
}
|
||||
else
|
||||
{ /* Not a data record;
|
||||
* flush accumulated data then echo non-data record.
|
||||
*/
|
||||
if ( d_total != 0 )
|
||||
{
|
||||
rptr->put_data_record( d_total, out_rec_addr, outbuff );
|
||||
d_total = 0;
|
||||
}
|
||||
puts( inbuff );
|
||||
}
|
||||
} while ( gets( inbuff ) != NULL );
|
||||
|
||||
|
||||
exit( EXIT_SUCCESS );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**** identify_first_data_record *******************************************
|
||||
*
|
||||
* Expects: Pointer to hex-record line buffer.
|
||||
*
|
||||
* Returns: Pointer to hex-record structure (NULL if no match found).
|
||||
*
|
||||
* Reads the standard input, line by line, searching for a valid
|
||||
* record header character. If a valid header is found, a pointer
|
||||
* to the hex-record's type structure is returned, otherwise NULL.
|
||||
*
|
||||
* The input-stream pointer is left pointing to the first valid hex record.
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
Rec_vitals * identify_first_data_record( char * buff_ptr )
|
||||
{
|
||||
Rec_vitals ** ptr;
|
||||
|
||||
while ( gets( buff_ptr ) != NULL )
|
||||
{
|
||||
for ( ptr = formats ; *ptr != ( Rec_vitals * ) NULL ; ptr++ )
|
||||
if ( ( *ptr )->is_data_record( buff_ptr ) == YES )
|
||||
return( *ptr ); /* Successful return. */
|
||||
|
||||
puts( buff_ptr ); /* Echo non-hex-record line. */
|
||||
}
|
||||
|
||||
return( ( Rec_vitals * ) NULL ); /* Unsuccessful return. */
|
||||
}
|
||||
|
||||
|
||||
/**** get_ndigit_hex *******************************************************
|
||||
*
|
||||
* Expects: Pointer to first ASCII hexadecimal digit, number of digits.
|
||||
*
|
||||
* Returns: Value of hexadecimal string as an unsigned long.
|
||||
*
|
||||
*******************************************************************************/
|
||||
|
||||
Ulong get_ndigit_hex( char * cptr, int digits )
|
||||
{
|
||||
Ulong value;
|
||||
|
||||
for ( value = 0 ; --digits >= 0 ; cptr++ )
|
||||
value = ( value * 16L ) + HEX_DIGIT( *cptr );
|
||||
|
||||
return( value );
|
||||
}
|
||||
@@ -1,725 +0,0 @@
|
||||
/*
|
||||
* unhex
|
||||
* convert a hex file to binary equivalent. If more than one file name
|
||||
* is given, then the output will be logically concatenated together.
|
||||
* stdin and stdout are defaults. Verbose will enable checksum output.
|
||||
*
|
||||
* Supported input formats are Intel hex, Motorola S records, and TI 'B'
|
||||
* records.
|
||||
*
|
||||
* Intel hex input format is
|
||||
* Byte
|
||||
* 1 Colon :
|
||||
* 2..3 Record length, eg: "20"
|
||||
* 4..7 load address nibbles
|
||||
* 8..9 record type: "00" (data) or "02" base addr
|
||||
* 10..x data bytes in ascii-hex
|
||||
* x+1..x+2 cksum (2's compl of (len+addr+data))
|
||||
* x+3 \n -- newline
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
char *USAGE = "\
|
||||
usage: unhex [-va] [ -o file ] [ file [file ... ] ]\n\
|
||||
-v -- verbose\n\
|
||||
-a base -- 1st byte of output corresponds to this address\n\
|
||||
-l -- linear, just writes data out\n\
|
||||
-o file -- output file; must not be input file\n\
|
||||
-F k_bits -- \"holes\" in input will be filled with 0xFF's\n\
|
||||
up to \"k_bits\" * 1024 bits\n\
|
||||
";
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#define OK 0
|
||||
#define FAILURE (-1)
|
||||
#define Failed(x) ((x) == FAILURE)
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
typedef char bool;
|
||||
#define STREQ(a,b) (strcmp(a,b) == 0)
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned long u32;
|
||||
|
||||
/*
|
||||
* Pick out designated bytes
|
||||
*/
|
||||
|
||||
#define B0(x) ((x) & 0xff)
|
||||
#define B1(x) B0((x) >> 8)
|
||||
#define B2(x) B0((x) >> 16)
|
||||
#define B3(x) B0((x) >> 24)
|
||||
|
||||
typedef struct buffer_rec {
|
||||
u32 dl_destaddr;
|
||||
u32 dl_jumpaddr;
|
||||
int dl_count;
|
||||
u8 dl_buf[512];
|
||||
} buffer_rec;
|
||||
|
||||
/*
|
||||
* vars controlled by command line options
|
||||
*/
|
||||
|
||||
bool verbose = FALSE; /* be verbose */
|
||||
bool linear = FALSE; /* just write out linear data */
|
||||
char *outfilename = "-"; /* default output is stdout */
|
||||
u32 base = 0L; /* base address */
|
||||
u32 FFfill = 0L; /* how far to fill w 0xFF's */
|
||||
|
||||
extern char *optarg; /* getopt(3) control vars */
|
||||
extern int optind;
|
||||
extern int errno;
|
||||
|
||||
char *progname; /* for error() */
|
||||
|
||||
void error(int errn, ...);
|
||||
#define ERR_ERRNO (1<<((sizeof(int) * 8) - 2)) /* hi bit; use 'errno' */
|
||||
#define ERR_FATAL (ERR_ERRNO / 2) /* error is fatal; no return */
|
||||
#define ERR_ABORT (ERR_ERRNO / 4) /* error is fatal; abort */
|
||||
#define ERR_MASK (ERR_ERRNO | ERR_FATAL | ERR_ABORT) /* all */
|
||||
|
||||
#if (defined(sparc) && (sunos < 500))
|
||||
#define stol(p) strtol(p, (char **) NULL, 0) /* Sunos */
|
||||
#else
|
||||
#define stol(p) strtoul(p, (char **) NULL, 0) /* Solaris */
|
||||
#endif
|
||||
|
||||
int unhex(FILE *ifp, char *inm, FILE *ofp, char *onm);
|
||||
int convert_Intel_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
|
||||
int convert_S_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
|
||||
int convert_TI_records(FILE *ifp, char *inm, FILE *ofp, char *onm);
|
||||
void write_record(buffer_rec *tb, FILE *fp);
|
||||
int getnibble(char **p);
|
||||
int getbyte(char **p);
|
||||
long getNbytes(char **p, int n);
|
||||
void badformat(char *s, char *fname, char *msg);
|
||||
|
||||
#define get1bytes(p) ((int) getbyte(p))
|
||||
#define get2bytes(p) ((int) getNbytes(p, 2))
|
||||
#define get3bytes(p) getNbytes(p, 3)
|
||||
#define get4bytes(p) getNbytes(p, 4)
|
||||
|
||||
char *BADADDR = "Invalid record address";
|
||||
char *BADLEN = "Invalid record length";
|
||||
char *BADBASE = "Bad base or starting address";
|
||||
char *BADFMT = "Unrecognized record type";
|
||||
char *BADDATA = "Invalid data byte";
|
||||
char *BADCSUM = "Invalid checksum";
|
||||
char *MISCSUM = "Checksum mismatch";
|
||||
char *BADTYPE = "Unrecognized record type";
|
||||
char *MISTYPE = "Incompatible record types";
|
||||
|
||||
int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
register int c;
|
||||
bool showusage = FALSE; /* usage error? */
|
||||
int rc = 0;
|
||||
FILE *outfp, *infp;
|
||||
|
||||
/*
|
||||
* figure out invocation leaf-name
|
||||
*/
|
||||
|
||||
if ((progname = strrchr(argv[0], '/')) == (char *) NULL)
|
||||
progname = argv[0];
|
||||
else
|
||||
progname++;
|
||||
|
||||
argv[0] = progname; /* for getopt err reporting */
|
||||
|
||||
/*
|
||||
* Check options and arguments.
|
||||
*/
|
||||
|
||||
progname = argv[0];
|
||||
while ((c = getopt(argc, argv, "F:a:o:vl")) != EOF)
|
||||
switch (c)
|
||||
{
|
||||
case 'a': /* base address */
|
||||
base = stol(optarg);
|
||||
break;
|
||||
|
||||
case 'l': /* linear output */
|
||||
linear = TRUE;
|
||||
break;
|
||||
|
||||
case 'v': /* toggle verbose */
|
||||
verbose = ! verbose;
|
||||
break;
|
||||
|
||||
case 'o': /* output file */
|
||||
outfilename = optarg;
|
||||
break;
|
||||
|
||||
case 'F': /* 0xFF fill amount (bytes) */
|
||||
FFfill = stol(optarg) * 1024L / 8L;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
showusage = TRUE;
|
||||
}
|
||||
|
||||
if (showusage)
|
||||
{
|
||||
(void) fprintf(stderr, "%s", USAGE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (linear && (base != 0))
|
||||
{
|
||||
error(0, "-l and -a may not be specified in combination");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (STREQ(outfilename, "-"))
|
||||
{
|
||||
outfp = stdout;
|
||||
outfilename = "stdout";
|
||||
}
|
||||
else
|
||||
if ((outfp = fopen(outfilename, "w")) == (FILE *) NULL)
|
||||
{
|
||||
error(-1, "couldn't open '%s' for output", outfilename);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Now process the input files (or stdin, if none specified)
|
||||
*/
|
||||
|
||||
if (argv[optind] == (char *) NULL) /* just stdin */
|
||||
exit(unhex(stdin, "stdin", outfp, outfilename));
|
||||
else
|
||||
for (; (optarg = argv[optind]); optind++)
|
||||
{
|
||||
if (STREQ(optarg, "-"))
|
||||
rc += unhex(stdin, "stdin", outfp, outfilename);
|
||||
else
|
||||
{
|
||||
if ((infp = fopen(optarg, "r")) == (FILE *) NULL)
|
||||
{
|
||||
error(-1, "couldn't open '%s' for input", optarg);
|
||||
exit(1);
|
||||
}
|
||||
rc += unhex(infp, optarg, outfp, outfilename);
|
||||
}
|
||||
}
|
||||
|
||||
return(rc);
|
||||
}
|
||||
|
||||
u16 filesum;
|
||||
|
||||
int
|
||||
unhex(FILE *ifp,
|
||||
char *inm,
|
||||
FILE *ofp,
|
||||
char *onm)
|
||||
{
|
||||
int c;
|
||||
|
||||
filesum = 0;
|
||||
|
||||
/*
|
||||
* Make sure holes will be filled with 0xFF's if requested. We
|
||||
* do this the easy way by just filling the file with FF's before
|
||||
* getting started. To do it more optimally would be quite a bit
|
||||
* more difficult since the user can skip around as much as he/she
|
||||
* likes in the input hex file addressing.
|
||||
*
|
||||
* We'll clean this up later (after this program has run) with
|
||||
* 'stripffs'
|
||||
*/
|
||||
|
||||
if (FFfill)
|
||||
{
|
||||
(void) fseek(ofp, 0, 0);
|
||||
for (c = FFfill; c > 0; c--)
|
||||
(void) fputc(0xFF, ofp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the first char from file and determine record types
|
||||
*/
|
||||
|
||||
if ((c = getc(ifp)) != EOF)
|
||||
{
|
||||
ungetc(c, ifp);
|
||||
switch(c)
|
||||
{
|
||||
case 'S':
|
||||
convert_S_records(ifp, inm, ofp, onm);
|
||||
break;
|
||||
|
||||
case ':':
|
||||
convert_Intel_records(ifp, inm, ofp, onm);
|
||||
break;
|
||||
|
||||
case '9':
|
||||
case 'B':
|
||||
convert_TI_records(ifp, inm, ofp, onm);
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
char tmp[2];
|
||||
tmp[0] = c; tmp[1] = 0;
|
||||
badformat(tmp, inm, BADFMT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
fprintf(stderr, "'%s' checksum is 0x%04x\n", inm, filesum);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
convert_Intel_records(
|
||||
FILE *ifp,
|
||||
char *inm,
|
||||
FILE *ofp,
|
||||
char *onm)
|
||||
{
|
||||
char buff[512];
|
||||
char *p;
|
||||
u8 cksum;
|
||||
int incksum;
|
||||
int c;
|
||||
int rectype; /* record type */
|
||||
int len; /* data length of current line */
|
||||
u32 addr;
|
||||
u32 base_address = 0;
|
||||
bool endrecord = FALSE;
|
||||
buffer_rec tb;
|
||||
|
||||
while ( ! endrecord && (fgets(buff, sizeof(buff), ifp)))
|
||||
{
|
||||
p = &buff[0];
|
||||
|
||||
if (p[strlen(p)-1] == '\n') /* get rid of newline */
|
||||
p[strlen(p)-1] = '\0';
|
||||
|
||||
if (p[strlen(p)-1] == '\r') /* get rid of any CR */
|
||||
p[strlen(p)-1] = '\0';
|
||||
|
||||
tb.dl_count = 0;
|
||||
|
||||
if (*p != ':')
|
||||
badformat(p, inm, BADFMT);
|
||||
p++;
|
||||
|
||||
if ((len = getbyte(&p)) == -1) /* record len */
|
||||
badformat(buff, inm, BADLEN);
|
||||
|
||||
if ((addr = get2bytes(&p)) == -1L) /* record addr */
|
||||
badformat(buff, inm, BADADDR);
|
||||
|
||||
rectype = getbyte(&p);
|
||||
|
||||
cksum = len + B0(addr) + B1(addr) + rectype;
|
||||
|
||||
switch (rectype)
|
||||
{
|
||||
case 0x00: /* normal data record */
|
||||
tb.dl_destaddr = base_address + addr;
|
||||
while (len--)
|
||||
{
|
||||
if ((c = getbyte(&p)) == -1)
|
||||
badformat(buff, inm, BADDATA);
|
||||
cksum += c;
|
||||
filesum += c;
|
||||
tb.dl_buf[tb.dl_count++] = c;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x01: /* execution start address */
|
||||
base_address = addr;
|
||||
endrecord = TRUE;
|
||||
break;
|
||||
|
||||
case 0x02: /* new base */
|
||||
if ((base_address = get2bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADBASE);
|
||||
cksum += B0(base_address) + B1(base_address);
|
||||
base_address <<= 4;
|
||||
break;
|
||||
|
||||
case 0x03: /* seg/off execution start address */
|
||||
{
|
||||
u32 seg, off;
|
||||
|
||||
seg = get2bytes(&p);
|
||||
off = get2bytes(&p);
|
||||
if ((seg == -1L) || (off == -1L))
|
||||
badformat(buff, inm, BADADDR);
|
||||
|
||||
cksum += B0(seg) + B1(seg) + B0(off) + B1(off);
|
||||
|
||||
tb.dl_jumpaddr = (seg << 4) + off;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
error(0, "unknown Intel-hex record type: 0x%02x", rectype);
|
||||
badformat(buff, inm, BADTYPE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify checksums are correct in file.
|
||||
*/
|
||||
|
||||
cksum = (-cksum) & 0xff;
|
||||
if ((incksum = getbyte(&p)) == -1)
|
||||
badformat(buff, inm, BADCSUM);
|
||||
if (((u8) incksum) != cksum)
|
||||
badformat(buff, inm, MISCSUM);
|
||||
|
||||
if (tb.dl_count)
|
||||
write_record(&tb, ofp);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
convert_S_records(
|
||||
FILE *ifp,
|
||||
char *inm,
|
||||
FILE *ofp,
|
||||
char *onm)
|
||||
{
|
||||
char buff[512];
|
||||
char *p;
|
||||
u8 cksum;
|
||||
int incksum;
|
||||
int c;
|
||||
int len; /* data length of current line */
|
||||
int rectype; /* record type */
|
||||
u32 addr;
|
||||
bool endrecord = FALSE;
|
||||
buffer_rec tb;
|
||||
|
||||
while ( ! endrecord && (fgets(buff, sizeof(buff), ifp)))
|
||||
{
|
||||
p = &buff[0];
|
||||
|
||||
if (p[strlen(p)-1] == '\n') /* get rid of newline */
|
||||
p[strlen(p)-1] = '\0';
|
||||
|
||||
if (p[strlen(p)-1] == '\r') /* get rid of any CR */
|
||||
p[strlen(p)-1] = '\0';
|
||||
|
||||
tb.dl_count = 0;
|
||||
|
||||
if (*p != 'S')
|
||||
badformat(p, inm, BADFMT);
|
||||
p++;
|
||||
|
||||
if ((rectype = getnibble(&p)) == -1) /* record type */
|
||||
badformat(buff, inm, BADTYPE);
|
||||
|
||||
if ((len = getbyte(&p)) == -1) /* record len */
|
||||
badformat(buff, inm, BADLEN);
|
||||
cksum = len;
|
||||
|
||||
switch (rectype)
|
||||
{
|
||||
case 0x00: /* comment field, ignored */
|
||||
goto write_it;
|
||||
|
||||
case 0x01: /* data record, 16 bit addr */
|
||||
if ((addr = get2bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADADDR);
|
||||
len -= 3;
|
||||
goto doit;
|
||||
|
||||
case 0x02: /* ... 24 bit addr */
|
||||
if ((addr = get3bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADADDR);
|
||||
len -= 4;
|
||||
goto doit;
|
||||
|
||||
case 0x03: /* ... 32 bit addr */
|
||||
if ((addr = get4bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADADDR);
|
||||
len -= 5;
|
||||
doit:
|
||||
cksum += B0(addr) + B1(addr) + B2(addr) + B3(addr);
|
||||
|
||||
tb.dl_destaddr = addr;
|
||||
while (len--)
|
||||
{
|
||||
if ((c = getbyte(&p)) == -1)
|
||||
badformat(buff, inm, BADDATA);
|
||||
cksum += c;
|
||||
filesum += c;
|
||||
tb.dl_buf[tb.dl_count++] = c;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x07: /* 32 bit end record */
|
||||
if ((addr = get4bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADADDR);
|
||||
goto end_rec;
|
||||
|
||||
case 0x08: /* 24 bit end record */
|
||||
if ((addr = get3bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADADDR);
|
||||
goto end_rec;
|
||||
|
||||
case 0x09: /* 16 bit end record */
|
||||
if ((addr = get2bytes(&p)) == -1L)
|
||||
badformat(buff, inm, BADADDR);
|
||||
|
||||
end_rec:
|
||||
cksum += B0(addr) + B1(addr) + B2(addr) + B3(addr);
|
||||
tb.dl_jumpaddr = addr;
|
||||
break;
|
||||
|
||||
default:
|
||||
error(0, "unknown Motorola-S record type: 0x%02x", rectype);
|
||||
badformat(buff, inm, BADTYPE);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify checksums are correct in file.
|
||||
*/
|
||||
|
||||
cksum = (~cksum) & 0xff;
|
||||
if ((incksum = getbyte(&p)) == -1)
|
||||
badformat(buff, inm, BADCSUM);
|
||||
if (((u8) incksum) != cksum)
|
||||
badformat(buff, inm, MISCSUM);
|
||||
|
||||
write_it:
|
||||
if (tb.dl_count)
|
||||
write_record(&tb, ofp);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
convert_TI_records(
|
||||
FILE *ifp,
|
||||
char *inm,
|
||||
FILE *ofp,
|
||||
char *onm)
|
||||
{
|
||||
char buff[512];
|
||||
char *p;
|
||||
int c;
|
||||
bool endrecord = FALSE;
|
||||
bool eol;
|
||||
buffer_rec tb;
|
||||
|
||||
while ( ! endrecord && (fgets(buff, sizeof(buff), ifp)))
|
||||
{
|
||||
if (p[strlen(p)-1] == '\n') /* get rid of newline */
|
||||
p[strlen(p)-1] = '\0';
|
||||
|
||||
if (p[strlen(p)-1] == '\r') /* get rid of any CR */
|
||||
p[strlen(p)-1] = '\0';
|
||||
|
||||
tb.dl_count = 0;
|
||||
|
||||
p = &buff[0];
|
||||
eol = FALSE;
|
||||
while ( ! eol && ! endrecord)
|
||||
{
|
||||
switch (*p++)
|
||||
{
|
||||
case '9':
|
||||
if (tb.dl_count)
|
||||
write_record(&tb, ofp);
|
||||
tb.dl_destaddr = get2bytes(&p);
|
||||
break;
|
||||
|
||||
case 'B':
|
||||
c = getbyte(&p);
|
||||
filesum += c;
|
||||
tb.dl_buf[tb.dl_count++] = c;
|
||||
c = getbyte(&p);
|
||||
filesum += c;
|
||||
tb.dl_buf[tb.dl_count++] = c;
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
eol = TRUE;
|
||||
break;
|
||||
|
||||
case ':':
|
||||
endrecord = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
badformat(p, inm, BADFMT);
|
||||
}
|
||||
}
|
||||
if (tb.dl_count)
|
||||
write_record(&tb, ofp);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
write_record(buffer_rec *tb,
|
||||
FILE *fp)
|
||||
{
|
||||
if ( ! linear)
|
||||
{
|
||||
if (tb->dl_destaddr < base)
|
||||
error(ERR_FATAL, "record at address 0x%x precedes base of 0x%x",
|
||||
tb->dl_destaddr, base);
|
||||
(void) fseek(fp, tb->dl_destaddr - base, 0);
|
||||
}
|
||||
|
||||
(void) fwrite(tb->dl_buf, tb->dl_count, 1, fp);
|
||||
tb->dl_destaddr += tb->dl_count;
|
||||
tb->dl_count = 0;
|
||||
}
|
||||
|
||||
int
|
||||
getnibble(char **p)
|
||||
{
|
||||
register int val;
|
||||
|
||||
**p = toupper(**p);
|
||||
switch (**p)
|
||||
{
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
val = **p - '0';
|
||||
break;
|
||||
|
||||
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
|
||||
val = 10 + (**p - 'A');
|
||||
break;
|
||||
|
||||
default:
|
||||
return(-1);
|
||||
}
|
||||
*p += 1;
|
||||
|
||||
return(val & 0x0f);
|
||||
}
|
||||
|
||||
int
|
||||
getbyte(char **p)
|
||||
{
|
||||
int n0, n1;
|
||||
|
||||
if ((n0 = getnibble(p)) == -1)
|
||||
return(-1);
|
||||
if ((n1 = getnibble(p)) == -1)
|
||||
return(-1);
|
||||
|
||||
return(((n0 << 4) + n1) & 0xff);
|
||||
}
|
||||
|
||||
long
|
||||
getNbytes(char **p,
|
||||
int n)
|
||||
{
|
||||
int t;
|
||||
u32 val = 0;
|
||||
|
||||
while (n--)
|
||||
{
|
||||
if ((t = getbyte(p)) == -1)
|
||||
return(-1L);
|
||||
val <<= 8;
|
||||
val += t;
|
||||
}
|
||||
|
||||
return(val);
|
||||
}
|
||||
|
||||
void
|
||||
badformat(char *s,
|
||||
char *fname,
|
||||
char *msg)
|
||||
{
|
||||
if (s[strlen(s)-1] == '\n') /* get rid of newline */
|
||||
s[strlen(s)-1] = '\0';
|
||||
error(0, "line '%s'::\n\tfrom file '%s'; %s", s, fname, msg);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* error(errn, arglist)
|
||||
* report an error to stderr using printf(3) conventions.
|
||||
* Any output is preceded by '<progname>: '
|
||||
*
|
||||
* Uses ERR_EXIT bit to request exit(errn)
|
||||
* ERR_ABORT to request abort()
|
||||
* ERR_ERRNO to indicate use of errno instead of argument.
|
||||
*
|
||||
* If resulting 'errn' is non-zero, it is assumed to be an 'errno' and its
|
||||
* associated error message is appended to the output.
|
||||
*/
|
||||
|
||||
/*VARARGS*/
|
||||
|
||||
void
|
||||
error(int error_flag, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
register char *format;
|
||||
extern char *sys_errlist[];
|
||||
extern int sys_nerr;
|
||||
int local_errno;
|
||||
|
||||
extern int errno;
|
||||
|
||||
(void) fflush(stdout); /* in case stdout/stderr same */
|
||||
|
||||
local_errno = error_flag & ~ERR_MASK;
|
||||
if (error_flag & ERR_ERRNO) /* use errno? */
|
||||
local_errno = errno;
|
||||
|
||||
va_start(arglist, error_flag);
|
||||
format = va_arg(arglist, char *);
|
||||
(void) fprintf(stderr, "%s: ", progname);
|
||||
(void) vfprintf(stderr, format, arglist);
|
||||
va_end(arglist);
|
||||
|
||||
if (local_errno)
|
||||
if ((local_errno > 0) && (local_errno < sys_nerr))
|
||||
(void) fprintf(stderr, " (%s)\n", sys_errlist[local_errno]);
|
||||
else
|
||||
(void) fprintf(stderr, " (unknown errno=%d)\n", local_errno);
|
||||
else
|
||||
(void) fprintf(stderr, "\n");
|
||||
|
||||
(void) fflush(stderr);
|
||||
|
||||
if (error_flag & (ERR_FATAL | ERR_ABORT))
|
||||
{
|
||||
if (error_flag & ERR_FATAL)
|
||||
{
|
||||
error(0, "fatal error, exiting");
|
||||
exit(local_errno ? local_errno : 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
error(0, "fatal error, aborting");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/* clock.h
|
||||
*
|
||||
* This file describes the Clock Driver for all boards.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $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 */
|
||||
@@ -1,69 +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, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $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 }
|
||||
|
||||
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 */
|
||||
@@ -1,44 +0,0 @@
|
||||
/* iosupp.h
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $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
|
||||
@@ -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
|
||||
@@ -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 */
|
||||
@@ -1,33 +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, ...)
|
||||
__attribute__ ((__noreturn__));
|
||||
#else
|
||||
void rtems_panic(const char *printf_format, ...);
|
||||
#endif
|
||||
|
||||
extern int rtems_panic_in_progress;
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -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, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $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 */
|
||||
@@ -1,98 +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
|
||||
|
||||
typedef unsigned32 rtems_libio_offset_t;
|
||||
|
||||
/*
|
||||
* An open file data structure, indexed by 'fd'
|
||||
* TODO:
|
||||
* should really have a separate per/file data structure that this
|
||||
* points to (eg: size, offset, driver, pathname should be in that)
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
rtems_driver_name_t *driver;
|
||||
rtems_libio_offset_t size; /* size of file */
|
||||
rtems_libio_offset_t offset; /* current offset into the file */
|
||||
unsigned32 flags;
|
||||
char *pathname; /* opened pathname */
|
||||
Objects_Id sem;
|
||||
unsigned32 data0; /* private to "driver" */
|
||||
unsigned32 data1; /* ... */
|
||||
} rtems_libio_t;
|
||||
|
||||
|
||||
/*
|
||||
* param block for read/write
|
||||
* Note: it must include 'offset' instead of using iop's offset since
|
||||
* we can have multiple outstanding i/o's on a device.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
rtems_libio_t *iop;
|
||||
rtems_libio_offset_t offset;
|
||||
unsigned8 *buffer;
|
||||
unsigned32 count;
|
||||
unsigned32 flags;
|
||||
unsigned32 bytes_moved;
|
||||
} rtems_libio_rw_args_t;
|
||||
|
||||
/*
|
||||
* param block for open/close
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
rtems_libio_t *iop;
|
||||
unsigned32 flags;
|
||||
unsigned32 mode;
|
||||
} rtems_libio_open_close_args_t;
|
||||
|
||||
/*
|
||||
* param block for ioctl
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
rtems_libio_t *iop;
|
||||
unsigned32 command;
|
||||
void *buffer;
|
||||
unsigned32 ioctl_return;
|
||||
} rtems_libio_ioctl_args_t;
|
||||
|
||||
|
||||
/*
|
||||
* Values for 'flag'
|
||||
*/
|
||||
|
||||
#define LIBIO_FLAGS_NO_DELAY 0x0001 /* return immediately if no data */
|
||||
#define LIBIO_FLAGS_READ 0x0002 /* reading */
|
||||
#define LIBIO_FLAGS_WRITE 0x0004 /* writing */
|
||||
#define LIBIO_FLAGS_LINE_BUFFERED 0x0008 /* line buffered io (^h, ^u, etc) */
|
||||
#define LIBIO_FLAGS_OPEN 0x0100 /* device is open */
|
||||
#define LIBIO_FLAGS_APPEND 0x0200 /* all writes append */
|
||||
#define LIBIO_FLAGS_CREATE 0x0400 /* create file */
|
||||
|
||||
#define LIBIO_FLAGS_READ_WRITE (LIBIO_FLAGS_READ | LIBIO_FLAGS_WRITE)
|
||||
|
||||
void rtems_libio_config(rtems_configuration_table *config, unsigned32 max_fds);
|
||||
void rtems_libio_init(void);
|
||||
|
||||
int __open(const char *pathname, unsigned32 flag, unsigned32 mode);
|
||||
int __close(int fd);
|
||||
int __read(int fd, void *buffer, unsigned32 count);
|
||||
int __write(int fd, const void *buffer, unsigned32 count);
|
||||
int __ioctl(int fd, unsigned32 command, void *buffer);
|
||||
int __lseek(int fd, rtems_libio_offset_t offset, int whence);
|
||||
|
||||
#endif /* _RTEMS_LIBIO_H */
|
||||
@@ -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).
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $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 */
|
||||
@@ -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 */
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/* timerdrv.h
|
||||
*
|
||||
* This file describes the Timer Driver for all boards.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $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 */
|
||||
@@ -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, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $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 */
|
||||
@@ -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.
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
#if !defined(RTEMS_UNIX)
|
||||
|
||||
/*
|
||||
* RTEMS "Broken" __brk/__sbrk Implementation
|
||||
*
|
||||
* NOTE: sbrk is BSP provided.
|
||||
*
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $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
|
||||
@@ -1,103 +0,0 @@
|
||||
#if !defined(RTEMS_UNIX)
|
||||
/*
|
||||
* RTEMS gettimeofday Implementation
|
||||
*
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <rtems.h>
|
||||
|
||||
#ifdef RTEMS_NEWLIB
|
||||
#include <sys/reent.h>
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <assert.h>
|
||||
|
||||
/*
|
||||
* NOTE: The solaris gettimeofday does not have a second parameter.
|
||||
*/
|
||||
|
||||
int gettimeofday(
|
||||
struct timeval *tp,
|
||||
struct timezone *tzp
|
||||
)
|
||||
{
|
||||
rtems_status_code status;
|
||||
rtems_clock_time_value time;
|
||||
|
||||
if ( !tp ) {
|
||||
errno = EFAULT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* "POSIX" does not seem to allow for not having a TOD */
|
||||
status = rtems_clock_get( RTEMS_CLOCK_GET_TIME_VALUE, &time );
|
||||
if ( status != RTEMS_SUCCESSFUL ) {
|
||||
assert( 0 );
|
||||
return -1;
|
||||
}
|
||||
|
||||
tp->tv_sec = time.seconds;
|
||||
tp->tv_usec = time.microseconds;
|
||||
|
||||
/*
|
||||
* 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)
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* "Reentrant" version
|
||||
*/
|
||||
|
||||
int _gettimeofday_r(
|
||||
struct _reent *ignored_reentrancy_stuff,
|
||||
struct timeval *tp,
|
||||
struct timezone *tzp
|
||||
)
|
||||
{
|
||||
return gettimeofday( tp, tzp );
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* "System call" version
|
||||
*/
|
||||
|
||||
int _gettimeofday(
|
||||
struct timeval *tp,
|
||||
struct timezone *tzp
|
||||
)
|
||||
{
|
||||
return gettimeofday( tp, tzp );
|
||||
}
|
||||
|
||||
#endif /* defined(RTEMS_NEWLIB) */
|
||||
|
||||
#endif
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* RTEMS _times Implementation
|
||||
*
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $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 );
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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)
|
||||
{
|
||||
rtems_panic_in_progress++;
|
||||
|
||||
/* disable task switches */
|
||||
_Thread_Disable_dispatch();
|
||||
|
||||
/* 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);
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Routines to access a host errno
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $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;
|
||||
}
|
||||
|
||||
@@ -1,444 +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. */
|
||||
|
||||
#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)
|
||||
|
||||
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 ((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)
|
||||
|
||||
|
||||
void
|
||||
rtems_libio_config(
|
||||
rtems_configuration_table *config,
|
||||
unsigned32 max_fds
|
||||
)
|
||||
{
|
||||
rtems_libio_number_iops = max_fds;
|
||||
|
||||
/*
|
||||
* tweak config to reflect # of semaphores we will need
|
||||
*/
|
||||
|
||||
/* one for iop table */
|
||||
config->RTEMS_api_configuration->maximum_semaphores += 1;
|
||||
config->RTEMS_api_configuration->maximum_semaphores += max_fds;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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 },
|
||||
{ "TIMEOUT", RTEMS_TIMEOUT, ETIME },
|
||||
{ "NO MEMORY", RTEMS_NO_MEMORY, ENOMEM },
|
||||
{ 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 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
__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;
|
||||
|
||||
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
|
||||
__close(
|
||||
int fd
|
||||
)
|
||||
{
|
||||
rtems_status_code rc;
|
||||
rtems_driver_name_t *np;
|
||||
rtems_libio_t *iop = rtems_libio_iop(fd);
|
||||
rtems_libio_open_close_args_t args;
|
||||
|
||||
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);
|
||||
|
||||
if (rc != RTEMS_SUCCESSFUL)
|
||||
return rtems_libio_errno(rc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
__read(
|
||||
int fd,
|
||||
void * buffer,
|
||||
unsigned32 count
|
||||
)
|
||||
{
|
||||
rtems_status_code rc;
|
||||
rtems_driver_name_t *np;
|
||||
rtems_libio_t *iop = rtems_libio_iop(fd);
|
||||
rtems_libio_rw_args_t args;
|
||||
|
||||
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
|
||||
__write(
|
||||
int fd,
|
||||
const void *buffer,
|
||||
unsigned32 count
|
||||
)
|
||||
{
|
||||
rtems_status_code rc;
|
||||
rtems_driver_name_t *np;
|
||||
rtems_libio_t *iop = rtems_libio_iop(fd);
|
||||
rtems_libio_rw_args_t args;
|
||||
|
||||
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
|
||||
__ioctl(
|
||||
int fd,
|
||||
unsigned32 command,
|
||||
void * buffer)
|
||||
{
|
||||
rtems_status_code rc;
|
||||
rtems_driver_name_t *np;
|
||||
rtems_libio_t *iop = rtems_libio_iop(fd);
|
||||
rtems_libio_ioctl_args_t args;
|
||||
|
||||
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
|
||||
__lseek(
|
||||
int fd,
|
||||
rtems_libio_offset_t offset,
|
||||
int whence
|
||||
)
|
||||
{
|
||||
rtems_libio_t *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;
|
||||
}
|
||||
@@ -1,400 +0,0 @@
|
||||
/*
|
||||
* RTEMS Malloc Family Implementation
|
||||
*
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $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>
|
||||
#include <unistd.h> /* sbrk(2) */
|
||||
|
||||
rtems_id RTEMS_Malloc_Heap;
|
||||
size_t RTEMS_Malloc_Sbrk_amount;
|
||||
|
||||
#ifdef RTEMS_DEBUG
|
||||
#define MALLOC_STATS
|
||||
#define MALLOC_DIRTY
|
||||
#endif
|
||||
|
||||
#ifdef MALLOC_STATS
|
||||
#define MSBUMP(f,n) 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;
|
||||
} malloc_stats;
|
||||
|
||||
#else /* No 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 == -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;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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(&malloc_stats, 0, sizeof(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)) == -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 = malloc_stats.lifetime_allocated - malloc_stats.lifetime_freed;
|
||||
if (current_depth > malloc_stats.max_depth)
|
||||
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 = malloc_stats.lifetime_allocated - malloc_stats.lifetime_freed;
|
||||
|
||||
printf("Malloc stats\n");
|
||||
printf(" avail:%uk allocated:%uk (%d%%) max:%uk (%d%%) lifetime:%Luk freed:%Luk\n",
|
||||
(unsigned int) malloc_stats.space_available / 1024,
|
||||
(unsigned int) allocated / 1024,
|
||||
/* avoid float! */
|
||||
(allocated * 100) / malloc_stats.space_available,
|
||||
(unsigned int) malloc_stats.max_depth / 1024,
|
||||
(malloc_stats.max_depth * 100) / malloc_stats.space_available,
|
||||
(unsigned64) malloc_stats.lifetime_allocated / 1024,
|
||||
(unsigned64) malloc_stats.lifetime_freed / 1024);
|
||||
printf(" Call counts: malloc:%d free:%d realloc:%d calloc:%d\n",
|
||||
malloc_stats.malloc_calls,
|
||||
malloc_stats.free_calls,
|
||||
malloc_stats.realloc_calls,
|
||||
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(
|
||||
size_t nelem,
|
||||
size_t elsize
|
||||
)
|
||||
{
|
||||
return calloc( nelem, elsize );
|
||||
}
|
||||
|
||||
void *realloc_r(
|
||||
void *ptr,
|
||||
size_t size
|
||||
)
|
||||
{
|
||||
return realloc_r( ptr, size );
|
||||
}
|
||||
|
||||
void free_r(
|
||||
void *ptr
|
||||
)
|
||||
{
|
||||
free( ptr );
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,423 +0,0 @@
|
||||
#if defined(RTEMS_NEWLIB)
|
||||
|
||||
/*
|
||||
* COPYRIGHT (c) 1994 by Division Incorporated
|
||||
*
|
||||
* To anyone who acknowledges that this file is provided "AS IS"
|
||||
* without any express or implied warranty:
|
||||
* permission to use, copy, modify, and distribute this file
|
||||
* for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice and this notice appears in all
|
||||
* copies, and that the name of Division Incorporated not be
|
||||
* used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific, written prior permission.
|
||||
* Division Incorporated makes no representations about the
|
||||
* suitability of this software for any purpose.
|
||||
*
|
||||
* 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>
|
||||
#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: When using RTEMS fake stat, fstat, and isatty, all output
|
||||
* is line buffered so this setvbuf is not necessary. This
|
||||
* setvbuf insures that we can redirect the output of a test
|
||||
* on the UNIX simulator and it is in the same order as for a
|
||||
* real target.
|
||||
* 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 *);
|
||||
|
||||
void
|
||||
libc_wrapup(void)
|
||||
{
|
||||
_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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
*
|
||||
* NOTE: When using RTEMS fake stat, fstat, and isatty, all output
|
||||
* is line buffered so this setvbuf is not necessary. This
|
||||
* setvbuf insures that we can redirect the output of a test
|
||||
* on the UNIX simulator and it is in the same order as for a
|
||||
* real target.
|
||||
*/
|
||||
|
||||
#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:
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#if !defined(RTEMS_UNIX) && !defined(__GO32__) && !defined(_AM29K)
|
||||
void _exit(int status)
|
||||
{
|
||||
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.
|
||||
*/
|
||||
|
||||
#if !defined(RTEMS_POSIX_API)
|
||||
pid_t __getpid(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(RTEMS_POSIX_API) || defined(__GO32__)
|
||||
pid_t getpid(void)
|
||||
{
|
||||
return __getpid();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(RTEMS_POSIX_API) || defined(__GO32__)
|
||||
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
|
||||
@@ -1,55 +0,0 @@
|
||||
#if !defined(RTEMS_NEWLIB) && !defined(RTEMS_UNIX)
|
||||
|
||||
/* no_libc.h
|
||||
*
|
||||
* This file contains stubs for the reentrancy hooks when
|
||||
* an unknown C library is used.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#include <rtems.h>
|
||||
|
||||
#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
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#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
|
||||
@@ -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();
|
||||
}
|
||||
@@ -1,164 +0,0 @@
|
||||
/* limits.h
|
||||
*
|
||||
* This file lists the minimums for the limits set by each of
|
||||
* the POSIX features subsets.
|
||||
*
|
||||
* XXX: Careful attention needs to be paid to section 2.8 in 1003.1b-1993
|
||||
* to segregrate the variables below based on their "class" according
|
||||
* to our implementation. We also need to set the Run-Time Invariant
|
||||
* and other related values.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include_next <limits.h>
|
||||
|
||||
#ifndef __POSIX_LIMITS_h
|
||||
#define __POSIX_LIMITS_h
|
||||
|
||||
/* really only to get min stack size from <rtems/score/cpu.h> */
|
||||
#include <rtems/system.h>
|
||||
|
||||
/****************************************************************************
|
||||
****************************************************************************
|
||||
* *
|
||||
* P1003.1b-1993 defines the constants below this comment. *
|
||||
* *
|
||||
****************************************************************************
|
||||
****************************************************************************/
|
||||
|
||||
#define _POSIX_AIO_LISTIO_MAX 2
|
||||
#define _POSIX_AIO_MAX 1
|
||||
#define _POSIX_ARG_MAX 4096
|
||||
#define _POSIX_CHILD_MAX 6
|
||||
#define _POSIX_DELAYTIMER_MAX 32
|
||||
#define _POSIX_LINK_MAX 8
|
||||
#define _POSIX_MAX_CANON 255
|
||||
#define _POSIX_MAX_INPUT 255
|
||||
#define _POSIX_MQ_OPEN_MAX 8
|
||||
#define _POSIX_MQ_PRIO_MAX 32
|
||||
#define _POSIX_NAME_MAX 14
|
||||
#define _POSIX_NGROUPS_MAX 0
|
||||
#define _POSIX_OPEN_MAX 16
|
||||
#define _POSIX_PATH_MAX 255
|
||||
#define _POSIX_PIPE_BUF 512
|
||||
#define _POSIX_RTSIG_MAX 8
|
||||
#define _POSIX_SEM_NSEMS_MAX 256
|
||||
#define _POSIX_SEM_VALUE_MAX 32767
|
||||
#define _POSIX_SIGQUEUE_MAX 32
|
||||
#define _POSIX_SSIZE_MAX 32767
|
||||
#define _POSIX_STREAM_MAX 8
|
||||
#define _POSIX_TIMER_MAX 32
|
||||
#define _POSIX_TZNAME_MAX 3
|
||||
|
||||
/*
|
||||
* Definitions of the following may be omitted if the value is >= stated
|
||||
* minimum but is indeterminate.
|
||||
*/
|
||||
|
||||
#define AIO_LISTIO_MAX 2
|
||||
#define AIO_MAX 1
|
||||
#define AIO_PRIO_DELTA_MAX 0
|
||||
#define ARG_MAX 4096
|
||||
#define CHILD_MAX 6
|
||||
#define DELAYTIMER_MAX 32
|
||||
#define MQ_OPEN_MAX 8
|
||||
#define MQ_PRIO_MAX 32
|
||||
#define OPEN_MAX 16
|
||||
#define PAGESIZE 1
|
||||
#define RTSIG_MAX 8
|
||||
#define SEM_NSEMS_MAX 256
|
||||
#define SEM_VALUE_MAX 32767
|
||||
#define SIGQUEUE_MAX 32
|
||||
#define STREAM_MAX 8
|
||||
#define TIMER_MAX 32
|
||||
#define TZNAME_MAX 3
|
||||
|
||||
/*
|
||||
* Pathname Variables
|
||||
*/
|
||||
|
||||
#define LINK_MAX 8
|
||||
#define MAX_CANON 255
|
||||
#define MAX_INPUT 255
|
||||
#define NAME_MAX 14
|
||||
#define PATH_MAX 255
|
||||
#define PIPE_BUF 512
|
||||
|
||||
/*
|
||||
* Invariant values
|
||||
*/
|
||||
|
||||
#define SSIZE_MAX 32767
|
||||
|
||||
/*
|
||||
* Maximum Values
|
||||
*/
|
||||
|
||||
#define _POSIX_CLOCKRES_MIN 0 /* in nanoseconds */
|
||||
|
||||
/****************************************************************************
|
||||
****************************************************************************
|
||||
* *
|
||||
* P1003.1c/D10 defines the constants below this comment. *
|
||||
*
|
||||
* XXX: doc seems to have printing problems in this table :(
|
||||
* *
|
||||
****************************************************************************
|
||||
****************************************************************************/
|
||||
|
||||
#define _POSIX_LOGIN_NAME_MAX 9
|
||||
#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
|
||||
#define _POSIX_THREAD_KEYS_MAX 28
|
||||
#define _POSIX_THREAD_THREADS_MAX 64
|
||||
#define _POSIX_TTY_NAME_MAX 9
|
||||
|
||||
/*
|
||||
* Definitions of the following may be omitted if the value is >= stated
|
||||
* minimum but is indeterminate.
|
||||
*/
|
||||
|
||||
#define LOGIN_NAME_MAX _POSIX_LOGIN_NAME_MAX
|
||||
#define TTY_NAME_MAX _POSIX_TTY_NAME_MAX
|
||||
#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS
|
||||
#define PTHREAD_STACK_MIN CPU_STACK_MINIMUM_SIZE
|
||||
|
||||
/*
|
||||
* The maximum number of keys (PTHREAD_KEYS_MAX) and threads
|
||||
* (PTHREAD_THREADS_MAX) are configurable and may exceed the minimum.
|
||||
*
|
||||
#define PTHREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX
|
||||
#define PTHREAD_THREADS_MAX _POSIX_THREAD_THREADS_MAX
|
||||
*/
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
****************************************************************************
|
||||
* *
|
||||
* P1003.4b/D8 defines the constants below this comment. *
|
||||
* *
|
||||
****************************************************************************
|
||||
****************************************************************************/
|
||||
|
||||
#define _POSIX_INTERRUPT_OVERRUN_MAX 32
|
||||
|
||||
/*
|
||||
* Definitions of the following may be omitted if the value is >= stated
|
||||
* minimum but is indeterminate.
|
||||
*/
|
||||
|
||||
#define INTERRUPT_OVERRUN_MAX 32
|
||||
|
||||
/*
|
||||
* Pathname Variables
|
||||
*/
|
||||
|
||||
#define MIN_ALLOC_SIZE
|
||||
#define REC_MIN_XFER_SIZE
|
||||
#define REC_MAX_XFER_SIZE
|
||||
#define REC_INCR_XFER_SIZE
|
||||
#define REC_XFER_ALIGN
|
||||
#define MAX_ATOMIC_SIZE
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,16 +0,0 @@
|
||||
/* rtems/posix/cancel.h
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_CANCEL_h
|
||||
#define __RTEMS_POSIX_CANCEL_h
|
||||
|
||||
typedef struct {
|
||||
Chain_Node Node;
|
||||
void (*routine)( void * );
|
||||
void *arg;
|
||||
} POSIX_Cancel_Handler_control;
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,130 +0,0 @@
|
||||
/* rtems/posix/cond.h
|
||||
*
|
||||
* This include file contains all the private support information for
|
||||
* POSIX condition variables.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_CONDITION_VARIABLES_h
|
||||
#define __RTEMS_POSIX_CONDITION_VARIABLES_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/score/threadq.h>
|
||||
|
||||
/*
|
||||
* Constant to indicate condition variable does not currently have
|
||||
* a mutex assigned to it.
|
||||
*/
|
||||
|
||||
#define POSIX_CONDITION_VARIABLES_NO_MUTEX 0
|
||||
|
||||
/*
|
||||
* Data Structure used to manage a POSIX condition variable
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Objects_Control Object;
|
||||
int process_shared;
|
||||
pthread_mutex_t Mutex;
|
||||
Thread_queue_Control Wait_queue;
|
||||
} POSIX_Condition_variables_Control;
|
||||
|
||||
/*
|
||||
* The following defines the information control block used to manage
|
||||
* this class of objects.
|
||||
*/
|
||||
|
||||
POSIX_EXTERN Objects_Information _POSIX_Condition_variables_Information;
|
||||
|
||||
/*
|
||||
* _POSIX_Condition_variables_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _POSIX_Condition_variables_Manager_initialization(
|
||||
unsigned32 maximum_condition_variables
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Condition_variables_Allocate
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function allocates a condition variable control block from
|
||||
* the inactive chain of free condition variable control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Condition_variables_Control *
|
||||
_POSIX_Condition_variables_Allocate( void );
|
||||
|
||||
/*
|
||||
* _POSIX_Condition_variables_Free
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine frees a condition variable control block to the
|
||||
* inactive chain of free condition variable control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Condition_variables_Free (
|
||||
POSIX_Condition_variables_Control *the_condition_variable
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Condition_variables_Get
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function maps condition variable IDs to condition variable control
|
||||
* blocks. If ID corresponds to a local condition variable, then it returns
|
||||
* the_condition variable control pointer which maps to ID and location
|
||||
* is set to OBJECTS_LOCAL. if the condition variable ID is global and
|
||||
* resides on a remote node, then location is set to OBJECTS_REMOTE,
|
||||
* and the_condition variable is undefined. Otherwise, location is set
|
||||
* to OBJECTS_ERROR and the_condition variable is undefined.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Condition_variables_Control *_POSIX_Condition_variables_Get (
|
||||
Objects_Id *id,
|
||||
Objects_Locations *location
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Condition_variables_Is_null
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_condition variable is NULL
|
||||
* and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Condition_variables_Is_null (
|
||||
POSIX_Condition_variables_Control *the_condition_variable
|
||||
);
|
||||
|
||||
#include <rtems/posix/cond.inl>
|
||||
#include <rtems/posix/condmp.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,162 +0,0 @@
|
||||
/* condmp.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Multiprocessing Support in the POSIX Condition Variable Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_CONDITION_VARIABLES_MP_h
|
||||
#define __RTEMS_POSIX_CONDITION_VARIABLES_MP_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/mppkt.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
|
||||
/*
|
||||
* The following enumerated type defines the list of
|
||||
* remote condition variable operations.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
POSIX_CONDITION_VARIABLES_MP_ANNOUNCE_CREATE = 0,
|
||||
POSIX_CONDITION_VARIABLES_MP_ANNOUNCE_DELETE = 1,
|
||||
POSIX_CONDITION_VARIABLES_MP_EXTRACT_PROXY = 2,
|
||||
POSIX_CONDITION_VARIABLES_MP_OBTAIN_REQUEST = 3,
|
||||
POSIX_CONDITION_VARIABLES_MP_OBTAIN_RESPONSE = 4,
|
||||
POSIX_CONDITION_VARIABLES_MP_RELEASE_REQUEST = 5,
|
||||
POSIX_CONDITION_VARIABLES_MP_RELEASE_RESPONSE = 6,
|
||||
} POSIX_Condition_variables_MP_Remote_operations;
|
||||
|
||||
/*
|
||||
* The following data structure defines the packet used to perform
|
||||
* remote condition variable operations.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
MP_packet_Prefix Prefix;
|
||||
POSIX_Condition_variables_MP_Remote_operations operation;
|
||||
Objects_Name name;
|
||||
boolean wait; /* XXX options */
|
||||
Objects_Id proxy_id;
|
||||
} POSIX_Condition_variables_MP_Packet;
|
||||
|
||||
/*
|
||||
* _POSIX_Condition_variables_MP_Send_process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* process operation can be performed on another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Condition_variables_MP_Send_process_packet (
|
||||
POSIX_Condition_variables_MP_Remote_operations operation,
|
||||
Objects_Id condition_variables_id,
|
||||
Objects_Name name,
|
||||
Objects_Id proxy_id
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Condition_variables_MP_Send_request_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive operation can be initiated on another node.
|
||||
*/
|
||||
|
||||
int _POSIX_Condition_variables_MP_Send_request_packet (
|
||||
POSIX_Condition_variables_MP_Remote_operations operation,
|
||||
Objects_Id condition_variables_id,
|
||||
boolean wait, /* XXX options */
|
||||
Watchdog_Interval timeout
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Condition_variables_MP_Send_response_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive can be performed on another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Condition_variables_MP_Send_response_packet (
|
||||
POSIX_Condition_variables_MP_Remote_operations operation,
|
||||
Objects_Id condition_variables_id,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
* _POSIX_Condition_variables_MP_Process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the actions specific to this package for
|
||||
* the request from another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Condition_variables_MP_Process_packet (
|
||||
MP_packet_Prefix *the_packet_prefix
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Condition_variables_MP_Send_object_was_deleted
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked indirectly by the thread queue
|
||||
* when a proxy has been removed from the thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _POSIX_Condition_variables_MP_Send_object_was_deleted (
|
||||
Thread_Control *the_proxy
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Condition_variables_MP_Send_extract_proxy
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked when a task is deleted and it
|
||||
* has a proxy which must be removed from a thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _POSIX_Condition_variables_MP_Send_extract_proxy (
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Condition_variables_MP_Get_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function is used to obtain a condition variable mp packet.
|
||||
*/
|
||||
|
||||
POSIX_Condition_variables_MP_Packet
|
||||
*_POSIX_Condition_variables_MP_Get_packet ( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of file */
|
||||
@@ -1,59 +0,0 @@
|
||||
/* config.h
|
||||
*
|
||||
* This include file contains the table of user defined configuration
|
||||
* parameters specific for the POSIX API.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_CONFIGURATION_h
|
||||
#define __RTEMS_POSIX_CONFIGURATION_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* XXX
|
||||
*
|
||||
* The following records define the Configuration Table. The
|
||||
* information contained in this table is required in all
|
||||
* RTEMS systems, whether single or multiprocessor. This
|
||||
* table primarily defines the following:
|
||||
*
|
||||
* + required number of each object type
|
||||
*/
|
||||
|
||||
/*
|
||||
* For now, we are only allowing the user to specify the entry point
|
||||
* for posix initialization threads.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
void *(*entry)(void *);
|
||||
} posix_initialization_threads_table;
|
||||
|
||||
typedef struct {
|
||||
int maximum_threads;
|
||||
int maximum_mutexes;
|
||||
int maximum_condition_variables;
|
||||
int maximum_keys;
|
||||
int maximum_queued_signals;
|
||||
int number_of_initialization_threads;
|
||||
posix_initialization_threads_table *User_initialization_threads_table;
|
||||
} posix_api_configuration_table;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,154 +0,0 @@
|
||||
/* rtems/posix/intr.h
|
||||
*
|
||||
* This include file contains all the private support information for
|
||||
* POSIX Interrupt Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_KEY_h
|
||||
#define __RTEMS_POSIX_KEY_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/isr.h>
|
||||
#include <rtems/score/object.h>
|
||||
|
||||
/*
|
||||
* Data Structure used to manage each POSIX Interrupt Vector
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
int number_installed;
|
||||
int lock_count;
|
||||
int deferred_count;
|
||||
Chain_Control Handlers;
|
||||
} POSIX_Interrupt_Control;
|
||||
|
||||
/*
|
||||
* Data Structure used to manage a POSIX Interrupt Handler
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Objects_Control Object;
|
||||
int is_active;
|
||||
intr_t vector;
|
||||
Thread_Control *server;
|
||||
int (*handler)( void *area );
|
||||
volatile void *user_data_area;
|
||||
} POSIX_Interrupt_Handler_control;
|
||||
|
||||
/*
|
||||
* The following defines the information control block used to manage
|
||||
* this class of objects.
|
||||
*/
|
||||
|
||||
POSIX_EXTERN Objects_Information _POSIX_Interrupt_Handlers_Information;
|
||||
|
||||
/*
|
||||
* The following is an array which is used to manage the set of
|
||||
* interrupt handlers installed on each vector.
|
||||
*/
|
||||
|
||||
POSIX_EXTERN POSIX_Interrupt_Control
|
||||
_POSIX_Interrupt_Information[ ISR_NUMBER_OF_VECTORS ];
|
||||
|
||||
/*
|
||||
* _POSIX_Interrupt_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _POSIX_Interrupt_Manager_initialization(
|
||||
unsigned32 maximum_interrupt_handlers
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Interrupt_Allocate
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function allocates a interrupt handler control block from
|
||||
* the inactive chain of free interrupt handler control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Interrupt_Handler_control *
|
||||
_POSIX_Interrupt_Allocate( void );
|
||||
|
||||
/*
|
||||
* _POSIX_Interrupt_Free
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine frees a interrupt handler control block to the
|
||||
* inactive chain of free interrupt handler control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Interrupt_Free (
|
||||
POSIX_Interrupt_Handler_control *the_intr
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Interrupt_Get
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function maps interrupt handler IDs to interrupt handler control
|
||||
* blocks. If ID corresponds to a local interrupt handler, then it returns
|
||||
* the_intr control pointer which maps to ID and location
|
||||
* is set to OBJECTS_LOCAL. if the interrupt handler ID is global and
|
||||
* resides on a remote node, then location is set to OBJECTS_REMOTE,
|
||||
* and the_intr is undefined. Otherwise, location is set
|
||||
* to OBJECTS_ERROR and the_intr is undefined.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Interrupt_Control *_POSIX_Interrupt_Get (
|
||||
Objects_Id id,
|
||||
Objects_Locations *location
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Interrupt_Is_null
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_intr is NULL and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Interrupt_Is_null (
|
||||
POSIX_Interrupt_Handler_control *the_intr
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Interrupt_Handler
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function XXX.
|
||||
*/
|
||||
|
||||
void _POSIX_Interrupt_Handler(
|
||||
ISR_Vector_number vector
|
||||
);
|
||||
|
||||
#include <rtems/posix/intr.inl>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
/* rtems/posix/key.h
|
||||
*
|
||||
* This include file contains all the private support information for
|
||||
* POSIX key.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_KEY_h
|
||||
#define __RTEMS_POSIX_KEY_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Data Structure used to manage a POSIX key
|
||||
*
|
||||
* NOTE: The Values is a table indexed by the index portion of the
|
||||
* ID of the currently executing thread.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Objects_Control Object;
|
||||
boolean is_active;
|
||||
void (*destructor)( void * );
|
||||
void **Values[ OBJECTS_CLASSES_LAST_THREAD_CLASS + 1 ];
|
||||
} POSIX_Keys_Control;
|
||||
|
||||
/*
|
||||
* The following defines the information control block used to manage
|
||||
* this class of objects.
|
||||
*/
|
||||
|
||||
POSIX_EXTERN Objects_Information _POSIX_Keys_Information;
|
||||
|
||||
/*
|
||||
* _POSIX_Keys_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _POSIX_Key_Manager_initialization(
|
||||
unsigned32 maximum_keys
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Keys_Run_destructors
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function executes all the destructors associated with the thread's
|
||||
* keys. This function will execute until all values have been set to NULL.
|
||||
*
|
||||
* NOTE: This is the routine executed when a thread exits to
|
||||
* run through all the keys and do the destructor action.
|
||||
*/
|
||||
|
||||
void _POSIX_Keys_Run_destructors(
|
||||
Thread_Control *thread
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Keys_Allocate
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function allocates a keys control block from
|
||||
* the inactive chain of free keys control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Keys_Control *_POSIX_Keys_Allocate( void );
|
||||
|
||||
/*
|
||||
* _POSIX_Keys_Free
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine frees a keys control block to the
|
||||
* inactive chain of free keys control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Keys_Free (
|
||||
POSIX_Keys_Control *the_key
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Keys_Get
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function maps key IDs to key control blocks.
|
||||
* If ID corresponds to a local keys, then it returns
|
||||
* the_key control pointer which maps to ID and location
|
||||
* is set to OBJECTS_LOCAL. if the keys ID is global and
|
||||
* resides on a remote node, then location is set to OBJECTS_REMOTE,
|
||||
* and the_key is undefined. Otherwise, location is set
|
||||
* to OBJECTS_ERROR and the_key is undefined.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Keys_Control *_POSIX_Keys_Get (
|
||||
Objects_Id id,
|
||||
Objects_Locations *location
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Keys_Is_null
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_key is NULL and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Keys_Is_null (
|
||||
POSIX_Keys_Control *the_key
|
||||
);
|
||||
|
||||
#include <rtems/posix/key.inl>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,186 +0,0 @@
|
||||
/* rtems/posix/mqueue.h
|
||||
*
|
||||
* This include file contains all the private support information for
|
||||
* POSIX Message Queues.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_MESSAGE_QUEUE_h
|
||||
#define __RTEMS_POSIX_MESSAGE_QUEUE_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/coremsg.h>
|
||||
#include <rtems/score/object.h>
|
||||
|
||||
/*
|
||||
* Data Structure used to manage a POSIX message queue
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Objects_Control Object;
|
||||
int process_shared;
|
||||
int flags;
|
||||
boolean named;
|
||||
boolean linked;
|
||||
boolean blocking;
|
||||
unsigned32 open_count;
|
||||
CORE_message_queue_Control Message_queue;
|
||||
struct sigevent notification;
|
||||
} POSIX_Message_queue_Control;
|
||||
|
||||
/*
|
||||
* The following defines the information control block used to manage
|
||||
* this class of objects.
|
||||
*/
|
||||
|
||||
POSIX_EXTERN Objects_Information _POSIX_Message_queue_Information;
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _POSIX_Message_queue_Manager_initialization(
|
||||
unsigned32 maximum_message_queues
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
* _POSIX_Message_queue_Create_support
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the creation of a message queue utilizing the
|
||||
* core message queue.
|
||||
*/
|
||||
|
||||
int _POSIX_Message_queue_Create_support(
|
||||
const char *name,
|
||||
int pshared,
|
||||
unsigned int oflag,
|
||||
struct mq_attr *attr,
|
||||
POSIX_Message_queue_Control **message_queue
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
* _POSIX_Message_queue_Send_support
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine posts a message to a specified message queue.
|
||||
*/
|
||||
|
||||
int _POSIX_Message_queue_Send_support(
|
||||
mqd_t mqdes,
|
||||
const char *msg_ptr,
|
||||
unsigned32 msg_len,
|
||||
Priority_Control msg_prio,
|
||||
Watchdog_Interval timeout
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_Allocate
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function allocates a message queue control block from
|
||||
* the inactive chain of free message queue control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *_POSIX_Message_queue_Allocate( void );
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_Free
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine frees a message queue control block to the
|
||||
* inactive chain of free message queue control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Message_queue_Free (
|
||||
POSIX_Message_queue_Control *the_mq
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_Get
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function maps message queue IDs to message queue control blocks.
|
||||
* If ID corresponds to a local message queue, then it returns
|
||||
* the_mq control pointer which maps to ID and location
|
||||
* is set to OBJECTS_LOCAL. if the message queue ID is global and
|
||||
* resides on a remote node, then location is set to OBJECTS_REMOTE,
|
||||
* and the_message queue is undefined. Otherwise, location is set
|
||||
* to OBJECTS_ERROR and the_mq is undefined.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Message_queue_Control *_POSIX_Message_queue_Get (
|
||||
Objects_Id id,
|
||||
Objects_Locations *location
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_Is_null
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_message_queue is NULL and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Message_queue_Is_null (
|
||||
POSIX_Message_queue_Control *the_mq
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_Name_to_id
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
int _POSIX_Message_queue_Name_to_id(
|
||||
const char *name,
|
||||
Objects_Id *id
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_Priority_to_core
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Priority_Control _POSIX_Message_queue_Priority_to_core(
|
||||
unsigned int priority
|
||||
);
|
||||
|
||||
#include <rtems/posix/mqueue.inl>
|
||||
#include <rtems/posix/mqueuemp.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,161 +0,0 @@
|
||||
/* mqueuemp.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Multiprocessing Support in the POSIX Message Queue Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_MESSAGE_QUEUE_MP_h
|
||||
#define __RTEMS_POSIX_MESSAGE_QUEUE_MP_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/mppkt.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
|
||||
/*
|
||||
* The following enumerated type defines the list of
|
||||
* remote message queue operations.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
POSIX_MESSAGE_QUEUE_MP_ANNOUNCE_CREATE = 0,
|
||||
POSIX_MESSAGE_QUEUE_MP_ANNOUNCE_DELETE = 1,
|
||||
POSIX_MESSAGE_QUEUE_MP_EXTRACT_PROXY = 2,
|
||||
POSIX_MESSAGE_QUEUE_MP_OBTAIN_REQUEST = 3,
|
||||
POSIX_MESSAGE_QUEUE_MP_OBTAIN_RESPONSE = 4,
|
||||
POSIX_MESSAGE_QUEUE_MP_RELEASE_REQUEST = 5,
|
||||
POSIX_MESSAGE_QUEUE_MP_RELEASE_RESPONSE = 6,
|
||||
} POSIX_Message_queue_MP_Remote_operations;
|
||||
|
||||
/*
|
||||
* The following data structure defines the packet used to perform
|
||||
* remote message queue operations.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
MP_packet_Prefix Prefix;
|
||||
POSIX_Message_queue_MP_Remote_operations operation;
|
||||
Objects_Name name;
|
||||
boolean wait; /* XXX options */
|
||||
Objects_Id proxy_id;
|
||||
} POSIX_Message_queue_MP_Packet;
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_MP_Send_process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* process operation can be performed on another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Message_queue_MP_Send_process_packet (
|
||||
POSIX_Message_queue_MP_Remote_operations operation,
|
||||
Objects_Id mq_id,
|
||||
Objects_Name name,
|
||||
Objects_Id proxy_id
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_MP_Send_request_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive operation can be initiated on another node.
|
||||
*/
|
||||
|
||||
int _POSIX_Message_queue_MP_Send_request_packet (
|
||||
POSIX_Message_queue_MP_Remote_operations operation,
|
||||
Objects_Id mq_id,
|
||||
boolean wait, /* XXX options */
|
||||
Watchdog_Interval timeout
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_MP_Send_response_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive can be performed on another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Message_queue_MP_Send_response_packet (
|
||||
POSIX_Message_queue_MP_Remote_operations operation,
|
||||
Objects_Id mq_id,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
* _POSIX_Message_queue_MP_Process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the actions specific to this package for
|
||||
* the request from another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Message_queue_MP_Process_packet (
|
||||
MP_packet_Prefix *the_packet_prefix
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_MP_Send_object_was_deleted
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked indirectly by the thread queue
|
||||
* when a proxy has been removed from the thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _POSIX_Message_queue_MP_Send_object_was_deleted (
|
||||
Thread_Control *the_proxy
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_MP_Send_extract_proxy
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked when a task is deleted and it
|
||||
* has a proxy which must be removed from a thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _POSIX_Message_queue_MP_Send_extract_proxy (
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Message_queue_MP_Get_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function is used to obtain a message queue mp packet.
|
||||
*/
|
||||
|
||||
POSIX_Message_queue_MP_Packet *_POSIX_Message_queue_MP_Get_packet ( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of file */
|
||||
@@ -1,120 +0,0 @@
|
||||
/* rtems/posix/mutex.h
|
||||
*
|
||||
* This include file contains all the private support information for
|
||||
* POSIX mutex's.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_MUTEX_h
|
||||
#define __RTEMS_POSIX_MUTEX_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/coremutex.h>
|
||||
#include <pthread.h>
|
||||
|
||||
/*
|
||||
* Data Structure used to manage a POSIX mutex
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Objects_Control Object;
|
||||
int process_shared;
|
||||
CORE_mutex_Control Mutex;
|
||||
} POSIX_Mutex_Control;
|
||||
|
||||
/*
|
||||
* The following defines the information control block used to manage
|
||||
* this class of objects.
|
||||
*/
|
||||
|
||||
POSIX_EXTERN Objects_Information _POSIX_Mutex_Information;
|
||||
|
||||
/*
|
||||
* _POSIX_Mutex_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _POSIX_Mutex_Manager_initialization(
|
||||
unsigned32 maximum_mutexes
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Mutex_Allocate
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function allocates a mutexes control block from
|
||||
* the inactive chain of free mutexes control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Allocate( void );
|
||||
|
||||
/*
|
||||
* _POSIX_Mutex_Free
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine frees a mutexes control block to the
|
||||
* inactive chain of free mutexes control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Free (
|
||||
POSIX_Mutex_Control *the_mutex
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Mutex_Get
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function maps mutexes IDs to mutexes control blocks.
|
||||
* If ID corresponds to a local mutexes, then it returns
|
||||
* the_mutex control pointer which maps to ID and location
|
||||
* is set to OBJECTS_LOCAL. if the mutexes ID is global and
|
||||
* resides on a remote node, then location is set to OBJECTS_REMOTE,
|
||||
* and the_mutex is undefined. Otherwise, location is set
|
||||
* to OBJECTS_ERROR and the_mutex is undefined.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Mutex_Control *_POSIX_Mutex_Get (
|
||||
Objects_Id *id,
|
||||
Objects_Locations *location
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Mutex_Is_null
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_mutex is NULL and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Mutex_Is_null (
|
||||
POSIX_Mutex_Control *the_mutex
|
||||
);
|
||||
|
||||
#include <rtems/posix/mutex.inl>
|
||||
#include <rtems/posix/mutexmp.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,161 +0,0 @@
|
||||
/* mutexmp.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Multiprocessing Support in the POSIX Mutex Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_MUTEX_MP_h
|
||||
#define __RTEMS_POSIX_MUTEX_MP_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/mppkt.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
|
||||
/*
|
||||
* The following enumerated type defines the list of
|
||||
* remote mutex operations.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
POSIX_MUTEX_MP_ANNOUNCE_CREATE = 0,
|
||||
POSIX_MUTEX_MP_ANNOUNCE_DELETE = 1,
|
||||
POSIX_MUTEX_MP_EXTRACT_PROXY = 2,
|
||||
POSIX_MUTEX_MP_OBTAIN_REQUEST = 3,
|
||||
POSIX_MUTEX_MP_OBTAIN_RESPONSE = 4,
|
||||
POSIX_MUTEX_MP_RELEASE_REQUEST = 5,
|
||||
POSIX_MUTEX_MP_RELEASE_RESPONSE = 6,
|
||||
} POSIX_Mutex_MP_Remote_operations;
|
||||
|
||||
/*
|
||||
* The following data structure defines the packet used to perform
|
||||
* remote mutex operations.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
MP_packet_Prefix Prefix;
|
||||
POSIX_Mutex_MP_Remote_operations operation;
|
||||
Objects_Name name;
|
||||
boolean wait; /* XXX options */
|
||||
Objects_Id proxy_id;
|
||||
} POSIX_Mutex_MP_Packet;
|
||||
|
||||
/*
|
||||
* _POSIX_Mutex_MP_Send_process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* process operation can be performed on another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Mutex_MP_Send_process_packet (
|
||||
POSIX_Mutex_MP_Remote_operations operation,
|
||||
Objects_Id mutex_id,
|
||||
Objects_Name name,
|
||||
Objects_Id proxy_id
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Mutex_MP_Send_request_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive operation can be initiated on another node.
|
||||
*/
|
||||
|
||||
int _POSIX_Mutex_MP_Send_request_packet (
|
||||
POSIX_Mutex_MP_Remote_operations operation,
|
||||
Objects_Id mutex_id,
|
||||
boolean wait, /* XXX options */
|
||||
Watchdog_Interval timeout
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Mutex_MP_Send_response_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive can be performed on another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Mutex_MP_Send_response_packet (
|
||||
POSIX_Mutex_MP_Remote_operations operation,
|
||||
Objects_Id mutex_id,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
* _POSIX_Mutex_MP_Process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the actions specific to this package for
|
||||
* the request from another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Mutex_MP_Process_packet (
|
||||
MP_packet_Prefix *the_packet_prefix
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Mutex_MP_Send_object_was_deleted
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked indirectly by the thread queue
|
||||
* when a proxy has been removed from the thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _POSIX_Mutex_MP_Send_object_was_deleted (
|
||||
Thread_Control *the_proxy
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Mutex_MP_Send_extract_proxy
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked when a task is deleted and it
|
||||
* has a proxy which must be removed from a thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _POSIX_Mutex_MP_Send_extract_proxy (
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Mutex_MP_Get_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function is used to obtain a mutex mp packet.
|
||||
*/
|
||||
|
||||
POSIX_Mutex_MP_Packet *_POSIX_Mutex_MP_Get_packet ( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of file */
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* POSIX API Support
|
||||
*
|
||||
* NOTE:
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __POSIX_API_h
|
||||
#define __POSIX_API_h
|
||||
|
||||
#include <rtems/config.h>
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_API_Initialize
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
void _POSIX_API_Initialize(
|
||||
rtems_configuration_table *configuration_table
|
||||
);
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,38 +0,0 @@
|
||||
/*
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_PRIORITY_h
|
||||
#define __RTEMS_POSIX_PRIORITY_h
|
||||
|
||||
#include <rtems/score/priority.h>
|
||||
|
||||
/*
|
||||
* 1003.1b-1993,2.2.2.80 definition of priority, p. 19
|
||||
*
|
||||
* "Numericallly higher values represent higher priorities."
|
||||
*
|
||||
* Thus, RTEMS Core has priorities run in the opposite sense of the POSIX API.
|
||||
*/
|
||||
|
||||
#define POSIX_SCHEDULER_MAXIMUM_PRIORITY (255)
|
||||
|
||||
#define POSIX_SCHEDULER_MINIMUM_PRIORITY (1)
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Priority_Is_valid(
|
||||
int priority
|
||||
);
|
||||
|
||||
RTEMS_INLINE_ROUTINE Priority_Control _POSIX_Priority_To_core(
|
||||
int priority
|
||||
);
|
||||
|
||||
RTEMS_INLINE_ROUTINE int _POSIX_Priority_From_core(
|
||||
Priority_Control priority
|
||||
);
|
||||
|
||||
#include <rtems/posix/priority.inl>
|
||||
|
||||
#endif
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __POSIX_SIGNALS_h
|
||||
#define __POSIX_SIGNALS_h
|
||||
|
||||
void _POSIX_signals_Manager_Initialization(
|
||||
int maximum_queued_signals
|
||||
);
|
||||
|
||||
void _POSIX_signals_Post_switch_extension(
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
#endif
|
||||
/* end of file */
|
||||
@@ -1,123 +0,0 @@
|
||||
/* rtems/posix/pthread.h
|
||||
*
|
||||
* This include file contains all the private support information for
|
||||
* POSIX threads.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_THREADS_h
|
||||
#define __RTEMS_POSIX_THREADS_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/posix/config.h>
|
||||
#include <rtems/posix/threadsup.h>
|
||||
|
||||
#define PTHREAD_MINIMUM_STACK_SIZE (STACK_MINIMUM_SIZE * 2)
|
||||
|
||||
/*
|
||||
* The following defines the information control block used to manage
|
||||
* this class of objects.
|
||||
*/
|
||||
|
||||
POSIX_EXTERN Objects_Information _POSIX_Threads_Information;
|
||||
|
||||
/*
|
||||
* These are used to manage the user initialization threads.
|
||||
*/
|
||||
|
||||
POSIX_EXTERN posix_initialization_threads_table
|
||||
*_POSIX_Threads_User_initialization_threads;
|
||||
POSIX_EXTERN unsigned32 _POSIX_Threads_Number_of_initialization_threads;
|
||||
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _POSIX_Threads_Manager_initialization(
|
||||
unsigned32 maximum_pthreads,
|
||||
unsigned32 number_of_initialization_threads,
|
||||
posix_initialization_threads_table *user_threads
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_Allocate
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function allocates a pthread control block from
|
||||
* the inactive chain of free pthread control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Allocate( void );
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_Free
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine frees a pthread control block to the
|
||||
* inactive chain of free pthread control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Threads_Free(
|
||||
Thread_Control *the_pthread
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_Get
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function maps pthread IDs to pthread control blocks.
|
||||
* If ID corresponds to a local pthread, then it returns
|
||||
* the_pthread control pointer which maps to ID and location
|
||||
* is set to OBJECTS_LOCAL. if the pthread ID is global and
|
||||
* resides on a remote node, then location is set to OBJECTS_REMOTE,
|
||||
* and the_pthread is undefined. Otherwise, location is set
|
||||
* to OBJECTS_ERROR and the_pthread is undefined.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Thread_Control *_POSIX_Threads_Get(
|
||||
pthread_t id,
|
||||
Objects_Locations *location
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_Is_null
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_pthread is NULL and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Threads_Is_null(
|
||||
Thread_Control *the_pthread
|
||||
);
|
||||
|
||||
#include <rtems/posix/pthread.inl>
|
||||
#include <rtems/posix/pthreadmp.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,161 +0,0 @@
|
||||
/* pthreadmp.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Multiprocessing Support in the POSIX Threads Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_THREADS_MP_h
|
||||
#define __RTEMS_POSIX_THREADS_MP_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/mppkt.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
|
||||
/*
|
||||
* The following enumerated type defines the list of
|
||||
* remote pthread operations.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
POSIX_THREADS_MP_ANNOUNCE_CREATE = 0,
|
||||
POSIX_THREADS_MP_ANNOUNCE_DELETE = 1,
|
||||
POSIX_THREADS_MP_EXTRACT_PROXY = 2,
|
||||
POSIX_THREADS_MP_OBTAIN_REQUEST = 3,
|
||||
POSIX_THREADS_MP_OBTAIN_RESPONSE = 4,
|
||||
POSIX_THREADS_MP_RELEASE_REQUEST = 5,
|
||||
POSIX_THREADS_MP_RELEASE_RESPONSE = 6
|
||||
} POSIX_Threads_MP_Remote_operations;
|
||||
|
||||
/*
|
||||
* The following data structure defines the packet used to perform
|
||||
* remote pthread operations.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
MP_packet_Prefix Prefix;
|
||||
POSIX_Threads_MP_Remote_operations operation;
|
||||
Objects_Name name;
|
||||
boolean wait;
|
||||
Objects_Id proxy_id;
|
||||
} POSIX_Threads_MP_Packet;
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_MP_Send_process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* process operation can be performed on another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Threads_MP_Send_process_packet (
|
||||
POSIX_Threads_MP_Remote_operations operation,
|
||||
Objects_Id pthread_id,
|
||||
Objects_Name name,
|
||||
Objects_Id proxy_id
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_MP_Send_request_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive operation can be initiated on another node.
|
||||
*/
|
||||
|
||||
int _POSIX_Threads_MP_Send_request_packet (
|
||||
POSIX_Threads_MP_Remote_operations operation,
|
||||
Objects_Id pthread_id,
|
||||
boolean wait,
|
||||
Watchdog_Interval timeout
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_MP_Send_response_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive can be performed on another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Threads_MP_Send_response_packet (
|
||||
POSIX_Threads_MP_Remote_operations operation,
|
||||
Objects_Id pthread_id,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
* _POSIX_Threads_MP_Process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the actions specific to this package for
|
||||
* the request from another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Threads_MP_Process_packet (
|
||||
MP_packet_Prefix *the_packet_prefix
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_MP_Send_object_was_deleted
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked indirectly by the thread queue
|
||||
* when a proxy has been removed from the thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _POSIX_Threads_MP_Send_object_was_deleted (
|
||||
Thread_Control *the_proxy
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_MP_Send_extract_proxy
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked when a task is deleted and it
|
||||
* has a proxy which must be removed from a thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _POSIX_Threads_MP_Send_extract_proxy (
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Threads_MP_Get_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function is used to obtain a pthread mp packet.
|
||||
*/
|
||||
|
||||
POSIX_Threads_MP_Packet *_POSIX_Threads_MP_Get_packet ( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of file */
|
||||
@@ -1,135 +0,0 @@
|
||||
/* rtems/posix/semaphore.h
|
||||
*
|
||||
* This include file contains all the private support information for
|
||||
* POSIX Semaphores.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_SEMAPHORE_h
|
||||
#define __RTEMS_POSIX_SEMAPHORE_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/coresem.h>
|
||||
|
||||
/*
|
||||
* Data Structure used to manage a POSIX semaphore
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Objects_Control Object;
|
||||
int process_shared;
|
||||
boolean named;
|
||||
boolean linked;
|
||||
unsigned32 open_count;
|
||||
CORE_semaphore_Control Semaphore;
|
||||
} POSIX_Semaphore_Control;
|
||||
|
||||
/*
|
||||
* The following defines the information control block used to manage
|
||||
* this class of objects.
|
||||
*/
|
||||
|
||||
POSIX_EXTERN Objects_Information _POSIX_Semaphore_Information;
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _POSIX_Semaphore_Manager_initialization(
|
||||
unsigned32 maximum_semaphorees
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_Allocate
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function allocates a semaphore control block from
|
||||
* the inactive chain of free semaphore control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control *_POSIX_Semaphore_Allocate( void );
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_Free
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine frees a semaphore control block to the
|
||||
* inactive chain of free semaphore control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _POSIX_Semaphore_Free (
|
||||
POSIX_Semaphore_Control *the_semaphore
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_Get
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function maps semaphore IDs to semaphore control blocks.
|
||||
* If ID corresponds to a local semaphore, then it returns
|
||||
* the_semaphore control pointer which maps to ID and location
|
||||
* is set to OBJECTS_LOCAL. if the semaphore ID is global and
|
||||
* resides on a remote node, then location is set to OBJECTS_REMOTE,
|
||||
* and the_semaphore is undefined. Otherwise, location is set
|
||||
* to OBJECTS_ERROR and the_semaphore is undefined.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE POSIX_Semaphore_Control *_POSIX_Semaphore_Get (
|
||||
Objects_Id *id,
|
||||
Objects_Locations *location
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_Is_null
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_semaphore is NULL and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _POSIX_Semaphore_Is_null (
|
||||
POSIX_Semaphore_Control *the_semaphore
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_Name_to_id
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
int _POSIX_Semaphore_Name_to_id(
|
||||
const char *name,
|
||||
Objects_Id *id
|
||||
);
|
||||
|
||||
#include <rtems/posix/semaphore.inl>
|
||||
#include <rtems/posix/semaphoremp.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,161 +0,0 @@
|
||||
/* semaphoremp.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Multiprocessing Support in the POSIX Semaphore Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_SEMAPHORE_MP_h
|
||||
#define __RTEMS_POSIX_SEMAPHORE_MP_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/mppkt.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
|
||||
/*
|
||||
* The following enumerated type defines the list of
|
||||
* remote semaphore operations.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
POSIX_SEMAPHORE_MP_ANNOUNCE_CREATE = 0,
|
||||
POSIX_SEMAPHORE_MP_ANNOUNCE_DELETE = 1,
|
||||
POSIX_SEMAPHORE_MP_EXTRACT_PROXY = 2,
|
||||
POSIX_SEMAPHORE_MP_OBTAIN_REQUEST = 3,
|
||||
POSIX_SEMAPHORE_MP_OBTAIN_RESPONSE = 4,
|
||||
POSIX_SEMAPHORE_MP_RELEASE_REQUEST = 5,
|
||||
POSIX_SEMAPHORE_MP_RELEASE_RESPONSE = 6,
|
||||
} POSIX_Semaphore_MP_Remote_operations;
|
||||
|
||||
/*
|
||||
* The following data structure defines the packet used to perform
|
||||
* remote semaphore operations.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
MP_packet_Prefix Prefix;
|
||||
POSIX_Semaphore_MP_Remote_operations operation;
|
||||
Objects_Name name;
|
||||
boolean wait; /* XXX options */
|
||||
Objects_Id proxy_id;
|
||||
} POSIX_Semaphore_MP_Packet;
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_MP_Send_process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* process operation can be performed on another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Semaphore_MP_Send_process_packet (
|
||||
POSIX_Semaphore_MP_Remote_operations operation,
|
||||
Objects_Id semaphore_id,
|
||||
Objects_Name name,
|
||||
Objects_Id proxy_id
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_MP_Send_request_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive operation can be initiated on another node.
|
||||
*/
|
||||
|
||||
int _POSIX_Semaphore_MP_Send_request_packet (
|
||||
POSIX_Semaphore_MP_Remote_operations operation,
|
||||
Objects_Id semaphore_id,
|
||||
boolean wait, /* XXX options */
|
||||
Watchdog_Interval timeout
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_MP_Send_response_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive can be performed on another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Semaphore_MP_Send_response_packet (
|
||||
POSIX_Semaphore_MP_Remote_operations operation,
|
||||
Objects_Id semaphore_id,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
* _POSIX_Semaphore_MP_Process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the actions specific to this package for
|
||||
* the request from another node.
|
||||
*/
|
||||
|
||||
void _POSIX_Semaphore_MP_Process_packet (
|
||||
MP_packet_Prefix *the_packet_prefix
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_MP_Send_object_was_deleted
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked indirectly by the thread queue
|
||||
* when a proxy has been removed from the thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _POSIX_Semaphore_MP_Send_object_was_deleted (
|
||||
Thread_Control *the_proxy
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_MP_Send_extract_proxy
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked when a task is deleted and it
|
||||
* has a proxy which must be removed from a thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _POSIX_Semaphore_MP_Send_extract_proxy (
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Semaphore_MP_Get_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function is used to obtain a semaphore mp packet.
|
||||
*/
|
||||
|
||||
POSIX_Semaphore_MP_Packet *_POSIX_Semaphore_MP_Get_packet ( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of file */
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __POSIX_SET_ERRNO_h
|
||||
#define __POSIX_SET_ERRNO_h
|
||||
|
||||
#define set_errno_and_return_minus_one( _error ) \
|
||||
{ errno = (_error); return -1; }
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,46 +0,0 @@
|
||||
/* threadsup.h
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_THREAD_SUPPORT_h
|
||||
#define __RTEMS_POSIX_THREAD_SUPPORT_h
|
||||
|
||||
#include <rtems/score/coresem.h>
|
||||
#include <rtems/score/tqdata.h>
|
||||
|
||||
typedef struct {
|
||||
pthread_attr_t Attributes;
|
||||
int detachstate;
|
||||
Thread_queue_Control Join_List;
|
||||
int schedpolicy;
|
||||
struct sched_param schedparam;
|
||||
int ss_high_priority;
|
||||
Watchdog_Control Sporadic_timer;
|
||||
|
||||
sigset_t signals_blocked;
|
||||
sigset_t signals_pending;
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* POSIX Interrupts
|
||||
*/
|
||||
unsigned32 interrupts_installed;
|
||||
CORE_semaphore_Control Interrupt_Semaphore;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* POSIX Cancelability
|
||||
*/
|
||||
int cancelability_state;
|
||||
int cancelability_type;
|
||||
int cancelation_requested;
|
||||
Chain_Control Cancellation_Handlers;
|
||||
#endif
|
||||
|
||||
} POSIX_API_Control;
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_POSIX_TIME_h
|
||||
#define __RTEMS_POSIX_TIME_h
|
||||
|
||||
#include <rtems/score/tod.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))
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Timespec_subtract
|
||||
*/
|
||||
|
||||
void _POSIX_Timespec_subtract(
|
||||
const struct timespec *the_start,
|
||||
const struct timespec *end,
|
||||
struct timespec *result
|
||||
);
|
||||
|
||||
/*
|
||||
* _POSIX_Timespec_to_interval
|
||||
*/
|
||||
|
||||
Watchdog_Interval _POSIX_Timespec_to_interval(
|
||||
const struct timespec *time
|
||||
);
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _POSIX_Interval_to_timespec
|
||||
*/
|
||||
|
||||
void _POSIX_Interval_to_timespec(
|
||||
Watchdog_Interval ticks,
|
||||
struct timespec *time
|
||||
);
|
||||
|
||||
#endif
|
||||
@@ -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 */
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
/* rtems.h
|
||||
*
|
||||
* This include file contains information about RTEMS executive that
|
||||
* is required by the application and is CPU independent. It includes
|
||||
* two (2) CPU dependent files to tailor its data structures for a
|
||||
* particular processor.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_RTEMS_GENERIC_h
|
||||
#define __RTEMS_RTEMS_GENERIC_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Unless told otherwise, the RTEMS include files will hide some stuff
|
||||
* from normal application code. Defining this crosses a boundary which
|
||||
* is undesirable since it means your application is using RTEMS features
|
||||
* which are not included in the formally defined and supported API.
|
||||
* Define this at your own risk.
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_VIOLATE_KERNEL_VISIBILITY__
|
||||
#define __RTEMS_APPLICATION__
|
||||
#endif
|
||||
|
||||
#include <rtems/system.h>
|
||||
#include <rtems/rtems/status.h>
|
||||
#include <rtems/rtems/types.h>
|
||||
|
||||
#include <rtems/config.h>
|
||||
#include <rtems/init.h>
|
||||
#include <rtems/rtems/tasks.h>
|
||||
#include <rtems/rtems/intr.h>
|
||||
#include <rtems/rtems/clock.h>
|
||||
#include <rtems/extension.h>
|
||||
#include <rtems/rtems/timer.h>
|
||||
#include <rtems/rtems/sem.h>
|
||||
#include <rtems/rtems/message.h>
|
||||
#include <rtems/rtems/event.h>
|
||||
#include <rtems/rtems/signal.h>
|
||||
#include <rtems/rtems/event.h>
|
||||
#include <rtems/rtems/part.h>
|
||||
#include <rtems/rtems/region.h>
|
||||
#include <rtems/rtems/dpmem.h>
|
||||
#include <rtems/io.h>
|
||||
#include <rtems/fatal.h>
|
||||
#include <rtems/rtems/ratemon.h>
|
||||
#include <rtems/rtems/mp.h>
|
||||
|
||||
#include <rtems/rtems/support.h>
|
||||
#include <rtems/score/sysstate.h>
|
||||
|
||||
#define RTEMS_HAS_HARDWARE_FP CPU_HARDWARE_FP
|
||||
|
||||
/*
|
||||
* The following define the constants which may be used in name searches.
|
||||
*/
|
||||
|
||||
#define RTEMS_SEARCH_ALL_NODES OBJECTS_SEARCH_ALL_NODES
|
||||
#define RTEMS_SEARCH_OTHER_NODES OBJECTS_SEARCH_OTHER_NODES
|
||||
#define RTEMS_SEARCH_LOCAL_NODE OBJECTS_SEARCH_LOCAL_NODE
|
||||
#define RTEMS_WHO_AM_I OBJECTS_WHO_AM_I
|
||||
|
||||
/*
|
||||
* Parameters and return id's for _Objects_Get_next
|
||||
*/
|
||||
|
||||
#define RTEMS_OBJECT_ID_INITIAL_INDEX OBJECTS_ID_INITIAL_INDEX
|
||||
#define RTEMS_OBJECT_ID_FINAL_INDEX OBJECTS_ID_FINAL_INDEX
|
||||
|
||||
#define RTEMS_OBJECT_ID_INITIAL(class, node) OBJECTS_ID_INITIAL(class, node)
|
||||
#define RTEMS_OBJECT_ID_FINAL OBJECTS_ID_FINAL
|
||||
|
||||
/*
|
||||
* The following constant defines the minimum stack size which every
|
||||
* thread must exceed.
|
||||
*/
|
||||
|
||||
#define RTEMS_MINIMUM_STACK_SIZE STACK_MINIMUM_SIZE
|
||||
|
||||
/*
|
||||
* Constant for indefinite wait. (actually an illegal interval)
|
||||
*/
|
||||
|
||||
#define RTEMS_NO_TIMEOUT WATCHDOG_NO_TIMEOUT
|
||||
|
||||
/*
|
||||
* An MPCI must support packets of at least this size.
|
||||
*/
|
||||
|
||||
#define RTEMS_MINIMUM_PACKET_SIZE MP_PACKET_MINIMUM_PACKET_SIZE
|
||||
|
||||
/*
|
||||
* The following constant defines the number of unsigned32's
|
||||
* in a packet which must be converted to native format in a
|
||||
* heterogeneous system. In packets longer than
|
||||
* MP_PACKET_MINIMUN_HETERO_CONVERSION unsigned32's, some of the "extra" data
|
||||
* may a user message buffer which is not automatically endian swapped.
|
||||
*/
|
||||
|
||||
#define RTEMS_MINIMUN_HETERO_CONVERSION MP_PACKET_MINIMUN_HETERO_CONVERSION
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,112 +0,0 @@
|
||||
/* asr.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Asynchronous Signal Handler. This Handler provides the low-level
|
||||
* support required by the Signal Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_ASR_h
|
||||
#define __RTEMS_ASR_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/rtems/modes.h>
|
||||
|
||||
/*
|
||||
*
|
||||
* The following type defines the control block used to manage
|
||||
* each signal set.
|
||||
*/
|
||||
|
||||
typedef unsigned32 rtems_signal_set;
|
||||
|
||||
/*
|
||||
* Return type for ASR Handler
|
||||
*/
|
||||
|
||||
typedef void rtems_asr;
|
||||
|
||||
/*
|
||||
* The following type corresponds to the applications asynchronous
|
||||
* signal processing routine.
|
||||
*/
|
||||
|
||||
typedef rtems_asr ( *rtems_asr_entry )(
|
||||
rtems_signal_set
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
* The following defines the control structure used to manage
|
||||
* signals. Each thread has a copy of this record.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
boolean is_enabled; /* are ASRs enabled currently? */
|
||||
rtems_asr_entry handler; /* address of RTEMS_ASR */
|
||||
Modes_Control mode_set; /* RTEMS_ASR mode */
|
||||
rtems_signal_set signals_posted; /* signal set */
|
||||
rtems_signal_set signals_pending; /* pending signal set */
|
||||
unsigned32 nest_level; /* nest level of RTEMS_ASR */
|
||||
} ASR_Information;
|
||||
|
||||
/*
|
||||
* The following constants define the individual signals which may
|
||||
* be used to compose a signal set.
|
||||
*/
|
||||
|
||||
#define RTEMS_SIGNAL_0 0x00000001
|
||||
#define RTEMS_SIGNAL_1 0x00000002
|
||||
#define RTEMS_SIGNAL_2 0x00000004
|
||||
#define RTEMS_SIGNAL_3 0x00000008
|
||||
#define RTEMS_SIGNAL_4 0x00000010
|
||||
#define RTEMS_SIGNAL_5 0x00000020
|
||||
#define RTEMS_SIGNAL_6 0x00000040
|
||||
#define RTEMS_SIGNAL_7 0x00000080
|
||||
#define RTEMS_SIGNAL_8 0x00000100
|
||||
#define RTEMS_SIGNAL_9 0x00000200
|
||||
#define RTEMS_SIGNAL_10 0x00000400
|
||||
#define RTEMS_SIGNAL_11 0x00000800
|
||||
#define RTEMS_SIGNAL_12 0x00001000
|
||||
#define RTEMS_SIGNAL_13 0x00002000
|
||||
#define RTEMS_SIGNAL_14 0x00004000
|
||||
#define RTEMS_SIGNAL_15 0x00008000
|
||||
#define RTEMS_SIGNAL_16 0x00010000
|
||||
#define RTEMS_SIGNAL_17 0x00020000
|
||||
#define RTEMS_SIGNAL_18 0x00040000
|
||||
#define RTEMS_SIGNAL_19 0x00080000
|
||||
#define RTEMS_SIGNAL_20 0x00100000
|
||||
#define RTEMS_SIGNAL_21 0x00200000
|
||||
#define RTEMS_SIGNAL_22 0x00400000
|
||||
#define RTEMS_SIGNAL_23 0x00800000
|
||||
#define RTEMS_SIGNAL_24 0x01000000
|
||||
#define RTEMS_SIGNAL_25 0x02000000
|
||||
#define RTEMS_SIGNAL_26 0x04000000
|
||||
#define RTEMS_SIGNAL_27 0x08000000
|
||||
#define RTEMS_SIGNAL_28 0x10000000
|
||||
#define RTEMS_SIGNAL_29 0x20000000
|
||||
#define RTEMS_SIGNAL_30 0x40000000
|
||||
#define RTEMS_SIGNAL_31 0x80000000
|
||||
|
||||
#ifndef __RTEMS_APPLICATION__
|
||||
#include <rtems/rtems/asr.inl>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,84 +0,0 @@
|
||||
/* attr.h
|
||||
*
|
||||
* This include file contains all information about the Object Attributes
|
||||
* Handler.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_ATTRIBUTES_h
|
||||
#define __RTEMS_ATTRIBUTES_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* types */
|
||||
|
||||
typedef unsigned32 rtems_attribute;
|
||||
|
||||
/* constants */
|
||||
|
||||
#define RTEMS_DEFAULT_ATTRIBUTES 0x00000000
|
||||
|
||||
#define RTEMS_NO_FLOATING_POINT 0x00000000 /* don't use FP HW */
|
||||
#define RTEMS_FLOATING_POINT 0x00000001 /* utilize coprocessor */
|
||||
|
||||
#define RTEMS_LOCAL 0x00000000 /* local resource */
|
||||
#define RTEMS_GLOBAL 0x00000002 /* global resource */
|
||||
|
||||
#define RTEMS_FIFO 0x00000000 /* process RTEMS_FIFO */
|
||||
#define RTEMS_PRIORITY 0x00000004 /* process by priority */
|
||||
|
||||
#define RTEMS_COUNTING_SEMAPHORE 0x00000000
|
||||
#define RTEMS_BINARY_SEMAPHORE 0x00000010
|
||||
|
||||
#define RTEMS_NO_INHERIT_PRIORITY 0x00000000
|
||||
#define RTEMS_INHERIT_PRIORITY 0x00000020
|
||||
|
||||
#define RTEMS_NO_PRIORITY_CEILING 0x00000000
|
||||
#define RTEMS_PRIORITY_CEILING 0x00000040
|
||||
|
||||
#if ( CPU_HARDWARE_FP == TRUE )
|
||||
#define ATTRIBUTES_NOT_SUPPORTED 0
|
||||
#else
|
||||
#define ATTRIBUTES_NOT_SUPPORTED RTEMS_FLOATING_POINT
|
||||
#endif
|
||||
|
||||
#if ( CPU_ALL_TASKS_ARE_FP == TRUE )
|
||||
#define ATTRIBUTES_REQUIRED RTEMS_FLOATING_POINT
|
||||
#else
|
||||
#define ATTRIBUTES_REQUIRED 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* _Attributes_Handler_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs initialization for this handler.
|
||||
*
|
||||
* NOTE: There is no initialization required in C. Conditional compilation
|
||||
* takes care of this in C.
|
||||
*/
|
||||
|
||||
#define _Attributes_Handler_initialization()
|
||||
|
||||
#ifndef __RTEMS_APPLICATION__
|
||||
#include <rtems/rtems/attr.inl>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,103 +0,0 @@
|
||||
/* clock.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Clock Manager. This manager provides facilities to set, obtain,
|
||||
* and continually update the current date and time.
|
||||
*
|
||||
* This manager provides directives to:
|
||||
*
|
||||
* + set the current date and time
|
||||
* + obtain the current date and time
|
||||
* + announce a clock tick
|
||||
*
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_CLOCK_h
|
||||
#define __RTEMS_CLOCK_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/tod.h>
|
||||
#include <rtems/rtems/types.h>
|
||||
|
||||
/*
|
||||
* List of things which can be returned by the rtems_clock_get directive.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
RTEMS_CLOCK_GET_TOD,
|
||||
RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH,
|
||||
RTEMS_CLOCK_GET_TICKS_SINCE_BOOT,
|
||||
RTEMS_CLOCK_GET_TICKS_PER_SECOND,
|
||||
RTEMS_CLOCK_GET_TIME_VALUE
|
||||
} rtems_clock_get_options;
|
||||
|
||||
/*
|
||||
* Standard flavor style to return TOD in for a rtems_clock_get option.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
unsigned32 seconds;
|
||||
unsigned32 microseconds;
|
||||
} rtems_clock_time_value;
|
||||
|
||||
/*
|
||||
* rtems_clock_get
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_clock_get directive. It returns
|
||||
* one of the following:
|
||||
* + current time of day
|
||||
* + seconds since epoch
|
||||
* + ticks since boot
|
||||
* + ticks per second
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_clock_get(
|
||||
rtems_clock_get_options option,
|
||||
void *time_buffer
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_clock_set
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_clock_set directive. It sets
|
||||
* the current time of day to that in the time_buffer record.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_clock_set(
|
||||
rtems_time_of_day *time_buffer
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_clock_tick
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_clock_tick directive. It is invoked
|
||||
* to inform RTEMS of the occurrence of a clock tick.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_clock_tick( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,54 +0,0 @@
|
||||
/* config.h
|
||||
*
|
||||
* This include file contains the table of user defined configuration
|
||||
* parameters specific for the RTEMS API.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_RTEMS_CONFIGURATION_h
|
||||
#define __RTEMS_RTEMS_CONFIGURATION_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/rtems/types.h>
|
||||
#include <rtems/rtems/tasks.h>
|
||||
|
||||
/*
|
||||
* The following records define the Configuration Table. The
|
||||
* information contained in this table is required in all
|
||||
* RTEMS systems, whether single or multiprocessor. This
|
||||
* table primarily defines the following:
|
||||
*
|
||||
* + required number of each object type
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
unsigned32 maximum_tasks;
|
||||
unsigned32 maximum_timers;
|
||||
unsigned32 maximum_semaphores;
|
||||
unsigned32 maximum_message_queues;
|
||||
unsigned32 maximum_partitions;
|
||||
unsigned32 maximum_regions;
|
||||
unsigned32 maximum_ports;
|
||||
unsigned32 maximum_periods;
|
||||
unsigned32 number_of_initialization_tasks;
|
||||
rtems_initialization_tasks_table *User_initialization_tasks_table;
|
||||
} rtems_api_configuration_table;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,157 +0,0 @@
|
||||
/* dpmem.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Dual Ported Memory Manager. This manager provides a mechanism
|
||||
* for converting addresses between internal and external representations
|
||||
* for multiple dual-ported memory areas.
|
||||
*
|
||||
* Directives provided are:
|
||||
*
|
||||
* + create a port
|
||||
* + get ID of a port
|
||||
* + delete a port
|
||||
* + convert external to internal address
|
||||
* + convert internal to external address
|
||||
*
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_DUAL_PORTED_MEMORY_h
|
||||
#define __RTEMS_DUAL_PORTED_MEMORY_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/object.h>
|
||||
|
||||
/*
|
||||
* The following structure defines the port control block. Each port
|
||||
* has a control block associated with it. This control block contains
|
||||
* all information required to support the port related operations.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Objects_Control Object;
|
||||
void *internal_base; /* base internal address */
|
||||
void *external_base; /* base external address */
|
||||
unsigned32 length; /* length of dual-ported area */
|
||||
} Dual_ported_memory_Control;
|
||||
|
||||
/*
|
||||
* The following define the internal Dual Ported Memory information.
|
||||
*/
|
||||
|
||||
RTEMS_EXTERN Objects_Information _Dual_ported_memory_Information;
|
||||
|
||||
/*
|
||||
* _Dual_ported_memory_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _Dual_ported_memory_Manager_initialization(
|
||||
unsigned32 maximum_ports
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_port_create
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_port_create directive. The port
|
||||
* will have the name name. The port maps onto an area of dual ported
|
||||
* memory of length bytes which has internal_start and external_start
|
||||
* as the internal and external starting addresses, respectively.
|
||||
* It returns the id of the created port in ID.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_port_create(
|
||||
rtems_name name,
|
||||
void *internal_start,
|
||||
void *external_start,
|
||||
unsigned32 length,
|
||||
Objects_Id *id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_port_ident
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_port_ident directive. This directive
|
||||
* returns the port ID associated with name. If more than one port is
|
||||
* named name, then the port to which the ID belongs is arbitrary.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_port_ident(
|
||||
rtems_name name,
|
||||
Objects_Id *id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_port_delete
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_port_delete directive. It deletes
|
||||
* the port associated with ID.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_port_delete(
|
||||
Objects_Id id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_port_external_to_internal
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_port_external_to_internal directive.
|
||||
* It returns the internal port address which maps to the provided
|
||||
* external port address for the specified port ID.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_port_external_to_internal(
|
||||
Objects_Id id,
|
||||
void *external,
|
||||
void **internal
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_port_internal_to_external
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the Port_internal_to_external directive.
|
||||
* It returns the external port address which maps to the provided
|
||||
* internal port address for the specified port ID.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_port_internal_to_external(
|
||||
Objects_Id id,
|
||||
void *internal,
|
||||
void **external
|
||||
);
|
||||
|
||||
#ifndef __RTEMS_APPLICATION__
|
||||
#include <rtems/rtems/dpmem.inl>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,174 +0,0 @@
|
||||
/* event.h
|
||||
*
|
||||
* This include file contains the information pertaining to the Event
|
||||
* Manager. This manager provides a high performance method of communication
|
||||
* and synchronization.
|
||||
*
|
||||
* Directives provided are:
|
||||
*
|
||||
* + send an event set to a task
|
||||
* + receive event condition
|
||||
*
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_EVENT_h
|
||||
#define __RTEMS_EVENT_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/rtems/types.h>
|
||||
#include <rtems/rtems/options.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
#include <rtems/rtems/eventset.h>
|
||||
|
||||
/*
|
||||
* This constant is passed as the event_in to the
|
||||
* rtems_event_receive directive to determine which events are pending.
|
||||
*/
|
||||
|
||||
#define EVENT_CURRENT 0
|
||||
|
||||
/*
|
||||
* The following enumerated types indicate what happened while the event
|
||||
* manager was in the synchronization window.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
EVENT_SYNC_SYNCHRONIZED,
|
||||
EVENT_SYNC_NOTHING_HAPPENED,
|
||||
EVENT_SYNC_TIMEOUT,
|
||||
EVENT_SYNC_SATISFIED
|
||||
} Event_Sync_states;
|
||||
|
||||
/*
|
||||
* Event_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _Event_Manager_initialization( void );
|
||||
|
||||
/*
|
||||
* rtems_event_send
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_event_send directive. It sends
|
||||
* event_in to the task specified by ID. If the task is blocked
|
||||
* waiting to receive events and the posting of event_in satisfies
|
||||
* the task's event condition, then it is unblocked.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_event_send (
|
||||
Objects_Id id,
|
||||
rtems_event_set event_in
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_event_receive
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_event_receive directive. This
|
||||
* directive is invoked when the calling task wishes to receive
|
||||
* the event_in event condition. One of the fields in the option_set
|
||||
* parameter determines whether the receive request is satisfied if
|
||||
* any or all of the events are pending. If the event condition
|
||||
* is not satisfied immediately, then the task may block with an
|
||||
* optional timeout of TICKS clock ticks or return immediately.
|
||||
* This determination is based on another field in the option_set
|
||||
* parameter. This directive returns the events received in the
|
||||
* event_out parameter.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_event_receive (
|
||||
rtems_event_set event_in,
|
||||
rtems_option option_set,
|
||||
rtems_interval ticks,
|
||||
rtems_event_set *event_out
|
||||
);
|
||||
|
||||
/*
|
||||
* _Event_Seize
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine determines if the event condition event_in is
|
||||
* satisfied. If so or if the no_wait option is enabled in option_set,
|
||||
* then the procedure returns immediately. If neither of these
|
||||
* conditions is true, then the calling task is blocked with an
|
||||
* optional timeout of ticks clock ticks.
|
||||
*/
|
||||
|
||||
void _Event_Seize (
|
||||
rtems_event_set event_in,
|
||||
rtems_option option_set,
|
||||
rtems_interval ticks,
|
||||
rtems_event_set *event_out
|
||||
);
|
||||
|
||||
/*
|
||||
* _Event_Surrender
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine determines if the event condition of the_thread
|
||||
* has been satisfied. If so, it unblocks the_thread.
|
||||
*/
|
||||
|
||||
void _Event_Surrender (
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
* _Event_Timeout
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked when a task's event receive request
|
||||
* has not been satisfied after the specified timeout interval.
|
||||
* The task represented by ID will be unblocked and its status
|
||||
* code will be set in it's control block to indicate that a timeout
|
||||
* has occurred.
|
||||
*/
|
||||
|
||||
void _Event_Timeout (
|
||||
Objects_Id id,
|
||||
void *ignored
|
||||
);
|
||||
|
||||
/*
|
||||
* The following defines the synchronization flag used by the
|
||||
* Event Manager to insure that signals sent to the currently
|
||||
* executing thread are received properly.
|
||||
*/
|
||||
|
||||
RTEMS_EXTERN volatile Event_Sync_states _Event_Sync_state;
|
||||
|
||||
#include <rtems/rtems/eventmp.h>
|
||||
#ifndef __RTEMS_APPLICATION__
|
||||
#include <rtems/rtems/event.inl>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,147 +0,0 @@
|
||||
/* eventmp.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Multiprocessing Support in the Event Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_EVENT_MP_h
|
||||
#define __RTEMS_EVENT_MP_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/rtems/event.h>
|
||||
#include <rtems/score/mppkt.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
|
||||
/*
|
||||
* The following enumerated type defines the list of
|
||||
* remote event operations.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
EVENT_MP_SEND_REQUEST = 0,
|
||||
EVENT_MP_SEND_RESPONSE = 1
|
||||
} Event_MP_Remote_operations;
|
||||
|
||||
/*
|
||||
* The following data structure defines the packet used to perform
|
||||
* remote event operations.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
rtems_packet_prefix Prefix;
|
||||
Event_MP_Remote_operations operation;
|
||||
rtems_event_set event_in;
|
||||
} Event_MP_Packet;
|
||||
|
||||
/*
|
||||
* _Event_MP_Send_process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* process operation can be performed on another node.
|
||||
*
|
||||
* This routine is not needed since there are no process
|
||||
* packets to be sent by this manager.
|
||||
*/
|
||||
|
||||
/*
|
||||
* _Event_MP_Send_request_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive operation can be initiated on another node.
|
||||
*/
|
||||
|
||||
rtems_status_code _Event_MP_Send_request_packet (
|
||||
Event_MP_Remote_operations operation,
|
||||
Objects_Id event_id,
|
||||
rtems_event_set event_in
|
||||
);
|
||||
|
||||
/*
|
||||
* _Event_MP_Send_response_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive can be performed on another node.
|
||||
*/
|
||||
|
||||
void _Event_MP_Send_response_packet (
|
||||
Event_MP_Remote_operations operation,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
* _Event_MP_Process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the actions specific to this package for
|
||||
* the request from another node.
|
||||
*/
|
||||
|
||||
void _Event_MP_Process_packet (
|
||||
rtems_packet_prefix *the_packet_prefix
|
||||
);
|
||||
|
||||
/*
|
||||
* _Event_MP_Send_object_was_deleted
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked indirectly by the thread queue
|
||||
* when a proxy has been removed from the thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*
|
||||
* This routine is not needed since there are no objects
|
||||
* deleted by this manager.
|
||||
*/
|
||||
|
||||
/*
|
||||
* _Event_MP_Send_extract_proxy
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked when a task is deleted and it
|
||||
* has a proxy which must be removed from a thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*
|
||||
* This routine is not needed since there are no objects
|
||||
* deleted by this manager.
|
||||
*/
|
||||
|
||||
/*
|
||||
* _Event_MP_Get_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function is used to obtain a event mp packet.
|
||||
*/
|
||||
|
||||
Event_MP_Packet *_Event_MP_Get_packet ( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of file */
|
||||
@@ -1,89 +0,0 @@
|
||||
/* eventset.h
|
||||
*
|
||||
* This include file contains the information pertaining to the
|
||||
* Event Sets Handler. This handler provides methods for the manipulation
|
||||
* of event sets which will be sent and received by tasks.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_EVENT_SET_h
|
||||
#define __RTEMS_EVENT_SET_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following defines the type used to control event sets.
|
||||
*/
|
||||
|
||||
typedef unsigned32 rtems_event_set;
|
||||
|
||||
/*
|
||||
* The following constants define the individual events which may
|
||||
* be used to compose an event set.
|
||||
*/
|
||||
|
||||
#define RTEMS_PENDING_EVENTS 0 /* receive pending events */
|
||||
#define RTEMS_ALL_EVENTS 0xFFFFFFFF
|
||||
|
||||
#define RTEMS_EVENT_0 0x00000001
|
||||
#define RTEMS_EVENT_1 0x00000002
|
||||
#define RTEMS_EVENT_2 0x00000004
|
||||
#define RTEMS_EVENT_3 0x00000008
|
||||
#define RTEMS_EVENT_4 0x00000010
|
||||
#define RTEMS_EVENT_5 0x00000020
|
||||
#define RTEMS_EVENT_6 0x00000040
|
||||
#define RTEMS_EVENT_7 0x00000080
|
||||
#define RTEMS_EVENT_8 0x00000100
|
||||
#define RTEMS_EVENT_9 0x00000200
|
||||
#define RTEMS_EVENT_10 0x00000400
|
||||
#define RTEMS_EVENT_11 0x00000800
|
||||
#define RTEMS_EVENT_12 0x00001000
|
||||
#define RTEMS_EVENT_13 0x00002000
|
||||
#define RTEMS_EVENT_14 0x00004000
|
||||
#define RTEMS_EVENT_15 0x00008000
|
||||
#define RTEMS_EVENT_16 0x00010000
|
||||
#define RTEMS_EVENT_17 0x00020000
|
||||
#define RTEMS_EVENT_18 0x00040000
|
||||
#define RTEMS_EVENT_19 0x00080000
|
||||
#define RTEMS_EVENT_20 0x00100000
|
||||
#define RTEMS_EVENT_21 0x00200000
|
||||
#define RTEMS_EVENT_22 0x00400000
|
||||
#define RTEMS_EVENT_23 0x00800000
|
||||
#define RTEMS_EVENT_24 0x01000000
|
||||
#define RTEMS_EVENT_25 0x02000000
|
||||
#define RTEMS_EVENT_26 0x04000000
|
||||
#define RTEMS_EVENT_27 0x08000000
|
||||
#define RTEMS_EVENT_28 0x10000000
|
||||
#define RTEMS_EVENT_29 0x20000000
|
||||
#define RTEMS_EVENT_30 0x40000000
|
||||
#define RTEMS_EVENT_31 0x80000000
|
||||
|
||||
|
||||
/*
|
||||
* The following constant is the value of an event set which
|
||||
* has no events pending.
|
||||
*/
|
||||
|
||||
#define EVENT_SETS_NONE_PENDING 0
|
||||
|
||||
#ifndef __RTEMS_APPLICATION__
|
||||
#include <rtems/rtems/eventset.inl>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,160 +0,0 @@
|
||||
/* intr.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Interrupt Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_INTERRUPT_h
|
||||
#define __RTEMS_INTERRUPT_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/isr.h>
|
||||
|
||||
/*
|
||||
* Interrupt level type
|
||||
*/
|
||||
|
||||
typedef ISR_Level rtems_interrupt_level;
|
||||
|
||||
/*
|
||||
* The following type defines the control block used to manage
|
||||
* the vectors.
|
||||
*/
|
||||
|
||||
typedef ISR_Vector_number rtems_vector_number;
|
||||
|
||||
/*
|
||||
* Return type for ISR Handler
|
||||
*/
|
||||
|
||||
typedef void rtems_isr;
|
||||
|
||||
/*
|
||||
* Pointer to an ISR Handler
|
||||
*/
|
||||
|
||||
typedef rtems_isr ( *rtems_isr_entry )(
|
||||
rtems_vector_number
|
||||
);
|
||||
|
||||
/*
|
||||
* _Interrupt_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine initializes the interrupt manager.
|
||||
*
|
||||
*/
|
||||
|
||||
void _Interrupt_Manager_initialization( void );
|
||||
|
||||
/*
|
||||
* rtems_interrupt_catch
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_interrupt_catch directive. This
|
||||
* directive installs new_isr_handler as the RTEMS interrupt service
|
||||
* routine for vector. The previous RTEMS interrupt service
|
||||
* routine is returned in old_isr_handler.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_interrupt_catch(
|
||||
rtems_isr_entry new_isr_handler,
|
||||
rtems_vector_number vector,
|
||||
rtems_isr_entry *old_isr_handler
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_interrupt_disable
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine disables all maskable interrupts and returns the
|
||||
* previous level in _isr_cookie.
|
||||
*/
|
||||
|
||||
#define rtems_interrupt_disable( _isr_cookie ) \
|
||||
_ISR_Disable(_isr_cookie)
|
||||
|
||||
/*
|
||||
* rtems_interrupt_enable
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine enables maskable interrupts to the level indicated
|
||||
* _isr_cookie.
|
||||
*/
|
||||
|
||||
#define rtems_interrupt_enable( _isr_cookie ) \
|
||||
_ISR_Enable(_isr_cookie)
|
||||
|
||||
/*
|
||||
* rtems_interrupt_flash
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine temporarily enables maskable interrupts to the
|
||||
* level in _isr_cookie before redisabling them.
|
||||
*/
|
||||
|
||||
#define rtems_interrupt_flash( _isr_cookie ) \
|
||||
_ISR_Flash(_isr_cookie)
|
||||
|
||||
/*
|
||||
* rtems_interrupt_is_in_progress
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the processor is currently servicing
|
||||
* and interrupt and FALSE otherwise. A return value of TRUE indicates
|
||||
* that the caller is an interrupt service routine, NOT a thread. The
|
||||
* directives available to an interrupt service routine are restricted.
|
||||
*/
|
||||
|
||||
#define rtems_interrupt_is_in_progress() \
|
||||
_ISR_Is_in_progress()
|
||||
|
||||
/*
|
||||
* rtems_interrupt_cause
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine generates an interrupt.
|
||||
*
|
||||
* NOTE: No implementation.
|
||||
*/
|
||||
|
||||
#define rtems_interrupt_cause( _interrupt_to_cause )
|
||||
|
||||
/*
|
||||
* rtems_interrupt_cause
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine clears the specified interrupt.
|
||||
*
|
||||
* NOTE: No implementation.
|
||||
*/
|
||||
|
||||
#define rtems_interrupt_clear( _interrupt_to_clear )
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,317 +0,0 @@
|
||||
/* message.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Message Queue Manager. This manager provides a mechanism for
|
||||
* communication and synchronization between tasks using messages.
|
||||
*
|
||||
* Directives provided are:
|
||||
*
|
||||
* + create a queue
|
||||
* + get ID of a queue
|
||||
* + delete a queue
|
||||
* + put a message at the rear of a queue
|
||||
* + put a message at the front of a queue
|
||||
* + broadcast N messages to a queue
|
||||
* + receive message from a queue
|
||||
* + flush all messages on a queue
|
||||
*
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_MESSAGE_QUEUE_h
|
||||
#define __RTEMS_MESSAGE_QUEUE_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/rtems/types.h>
|
||||
#include <rtems/score/chain.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/rtems/attr.h>
|
||||
#include <rtems/score/threadq.h>
|
||||
#include <rtems/score/coremsg.h>
|
||||
|
||||
/*
|
||||
* The following enumerated type details the modes in which a message
|
||||
* may be submitted to a message queue. The message may be posted
|
||||
* in a send or urgent fashion.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
MESSAGE_QUEUE_SEND_REQUEST = 0,
|
||||
MESSAGE_QUEUE_URGENT_REQUEST = 1
|
||||
} Message_queue_Submit_types;
|
||||
|
||||
/*
|
||||
* The following records define the control block used to manage
|
||||
* each message queue.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Objects_Control Object;
|
||||
rtems_attribute attribute_set;
|
||||
CORE_message_queue_Control message_queue;
|
||||
} Message_queue_Control;
|
||||
|
||||
/*
|
||||
* The following defines the information control block used to
|
||||
* manage this class of objects.
|
||||
*/
|
||||
|
||||
RTEMS_EXTERN Objects_Information _Message_queue_Information;
|
||||
|
||||
/*
|
||||
* _Message_queue_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _Message_queue_Manager_initialization(
|
||||
unsigned32 maximum_message_queues
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_message_queue_create
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_message_queue_create directive. The
|
||||
* message queue will have the name name. If the attribute_set indicates
|
||||
* that the message queue is to be limited in the number of messages
|
||||
* that can be outstanding, then count indicates the maximum number of
|
||||
* messages that will be held. It returns the id of the created
|
||||
* message queue in ID.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_message_queue_create(
|
||||
rtems_name name,
|
||||
unsigned32 count,
|
||||
unsigned32 max_message_size,
|
||||
rtems_attribute attribute_set,
|
||||
Objects_Id *id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_message_queue_ident
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_message_queue_ident directive.
|
||||
* This directive returns the message queue ID associated with NAME.
|
||||
* If more than one message queue is named name, then the message
|
||||
* queue to which the ID belongs is arbitrary. node indicates the
|
||||
* extent of the search for the ID of the message queue named name.
|
||||
* The search can be limited to a particular node or allowed to
|
||||
* encompass all nodes.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_message_queue_ident(
|
||||
rtems_name name,
|
||||
unsigned32 node,
|
||||
Objects_Id *id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_message_queue_delete
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_message_queue_delete directive. The
|
||||
* message queue indicated by ID is deleted.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_message_queue_delete(
|
||||
Objects_Id id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_message_queue_send
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_message_queue_send directive.
|
||||
* This directive sends the message buffer to the message queue
|
||||
* indicated by ID. If one or more tasks is blocked waiting
|
||||
* to receive a message from this message queue, then one will
|
||||
* receive the message. The task selected to receive the
|
||||
* message is based on the task queue discipline algorithm in
|
||||
* use by this particular message queue. If no tasks are waiting,
|
||||
* then the message buffer will be placed at the rear of the
|
||||
* chain of pending messages for this message queue.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_message_queue_send(
|
||||
Objects_Id id,
|
||||
void *buffer,
|
||||
unsigned32 size
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_message_queue_urgent
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_message_queue_send directive.
|
||||
* This directive sends the message buffer to the message queue
|
||||
* indicated by ID. If one or more tasks is blocked waiting
|
||||
* to receive a message from this message queue, then one will
|
||||
* receive the message. The task selected to receive the
|
||||
* message is based on the task queue discipline algorithm in
|
||||
* use by this particular message queue. If no tasks are waiting,
|
||||
* then the message buffer will be placed at the rear of the
|
||||
* chain of pending messages for this message queue.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_message_queue_urgent(
|
||||
Objects_Id id,
|
||||
void *buffer,
|
||||
unsigned32 size
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_message_queue_broadcast
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_message_queue_send directive.
|
||||
* This directive sends the message buffer to the message queue
|
||||
* indicated by ID. If one or more tasks is blocked waiting
|
||||
* to receive a message from this message queue, then one will
|
||||
* receive the message. The task selected to receive the
|
||||
* message is based on the task queue discipline algorithm in
|
||||
* use by this particular message queue. If no tasks are waiting,
|
||||
* then the message buffer will be placed at the rear of the
|
||||
* chain of pending messages for this message queue.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_message_queue_broadcast(
|
||||
Objects_Id id,
|
||||
void *buffer,
|
||||
unsigned32 size,
|
||||
unsigned32 *count
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_message_queue_receive
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_message_queue_receive directive.
|
||||
* This directive is invoked when the calling task wishes to receive
|
||||
* a message from the message queue indicated by ID. The received
|
||||
* message is to be placed in buffer. If no messages are outstanding
|
||||
* and the option_set indicates that the task is willing to block,
|
||||
* then the task will be blocked until a message arrives or until,
|
||||
* optionally, timeout clock ticks have passed.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_message_queue_receive(
|
||||
Objects_Id id,
|
||||
void *buffer,
|
||||
unsigned32 *size,
|
||||
unsigned32 option_set,
|
||||
rtems_interval timeout
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_message_queue_flush
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_message_queue_flush directive.
|
||||
* This directive takes all outstanding messages for the message
|
||||
* queue indicated by ID and returns them to the inactive message
|
||||
* chain. The number of messages flushed is returned in COUNT.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_message_queue_flush(
|
||||
Objects_Id id,
|
||||
unsigned32 *count
|
||||
);
|
||||
|
||||
/*
|
||||
* _Message_queue_Submit
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the directives rtems_message_queue_send
|
||||
* and rtems_message_queue_urgent. It processes a message that is
|
||||
* to be submitted to the designated message queue. The message will
|
||||
* either be processed as a send send message which it will be inserted
|
||||
* at the rear of the queue or it will be processed as an urgent message
|
||||
* which will be inserted at the front of the queue.
|
||||
*/
|
||||
|
||||
rtems_status_code _Message_queue_Submit(
|
||||
Objects_Id id,
|
||||
void *buffer,
|
||||
unsigned32 size,
|
||||
Message_queue_Submit_types submit_type
|
||||
);
|
||||
|
||||
/*
|
||||
* _Message_queue_Allocate
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function allocates a message queue control block from
|
||||
* the inactive chain of free message queue control blocks.
|
||||
*/
|
||||
|
||||
Message_queue_Control *_Message_queue_Allocate (
|
||||
unsigned32 count,
|
||||
unsigned32 max_message_size
|
||||
);
|
||||
|
||||
/*
|
||||
* _Message_queue_Translate_core_message_queue_return_code
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns a RTEMS status code based on the core message queue
|
||||
* status code specified.
|
||||
*/
|
||||
|
||||
rtems_status_code _Message_queue_Translate_core_message_queue_return_code (
|
||||
unsigned32 the_message_queue_status
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
* _Message_queue_Core_message_queue_mp_support
|
||||
*
|
||||
* Input parameters:
|
||||
* the_thread - the remote thread the message was submitted to
|
||||
* id - id of the message queue
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*/
|
||||
|
||||
void _Message_queue_Core_message_queue_mp_support (
|
||||
Thread_Control *the_thread,
|
||||
Objects_Id id
|
||||
);
|
||||
|
||||
#ifndef __RTEMS_APPLICATION__
|
||||
#include <rtems/rtems/message.inl>
|
||||
#endif
|
||||
#include <rtems/rtems/msgmp.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,89 +0,0 @@
|
||||
/* modes.h
|
||||
*
|
||||
* This include file contains all constants and structures associated
|
||||
* with the RTEMS thread and RTEMS_ASR modes.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_MODES_h
|
||||
#define __RTEMS_MODES_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/isr.h>
|
||||
|
||||
/*
|
||||
* The following type defines the control block used to manage
|
||||
* each a mode set.
|
||||
*/
|
||||
|
||||
typedef unsigned32 Modes_Control;
|
||||
|
||||
/*
|
||||
* The following constants define the individual modes and masks
|
||||
* which may be used to compose a mode set and to alter modes.
|
||||
*/
|
||||
|
||||
#define RTEMS_ALL_MODE_MASKS 0x0000ffff
|
||||
|
||||
#define RTEMS_DEFAULT_MODES 0x00000000
|
||||
#define RTEMS_CURRENT_MODE 0
|
||||
|
||||
#define RTEMS_PREEMPT_MASK 0x00000100 /* preemption bit */
|
||||
#define RTEMS_TIMESLICE_MASK 0x00000200 /* timeslice bit */
|
||||
#define RTEMS_ASR_MASK 0x00000400 /* RTEMS_ASR enable bit */
|
||||
#define RTEMS_INTERRUPT_MASK CPU_MODES_INTERRUPT_MASK
|
||||
|
||||
#define RTEMS_PREEMPT 0x00000000 /* enable preemption */
|
||||
#define RTEMS_NO_PREEMPT 0x00000100 /* disable preemption */
|
||||
|
||||
#define RTEMS_NO_TIMESLICE 0x00000000 /* disable timeslicing */
|
||||
#define RTEMS_TIMESLICE 0x00000200 /* enable timeslicing */
|
||||
|
||||
#define RTEMS_ASR 0x00000000 /* enable RTEMS_ASR */
|
||||
#define RTEMS_NO_ASR 0x00000400 /* disable RTEMS_ASR */
|
||||
|
||||
/*
|
||||
* The number of bits for interrupt levels is CPU dependent.
|
||||
* RTEMS supports 0 to 256 levels in bits 0-7 of the mode.
|
||||
*/
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* RTEMS_INTERRUPT_LEVEL
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns the processor dependent interrupt
|
||||
* level which corresponds to the requested interrupt level.
|
||||
*
|
||||
* NOTE: RTEMS supports 256 interrupt levels using the least
|
||||
* significant eight bits of MODES.CONTROL. On any
|
||||
* particular CPU, fewer than 256 levels may be supported.
|
||||
*/
|
||||
|
||||
#define RTEMS_INTERRUPT_LEVEL( _mode_set ) \
|
||||
( (_mode_set) & RTEMS_INTERRUPT_MASK )
|
||||
|
||||
|
||||
#ifndef __RTEMS_APPLICATION__
|
||||
#include <rtems/rtems/modes.inl>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,53 +0,0 @@
|
||||
/* mp.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Multiprocessing Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_MP_h
|
||||
#define __RTEMS_MP_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
*
|
||||
* _Multiprocessing_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _Multiprocessing_Manager_initialization ( void );
|
||||
|
||||
/*
|
||||
*
|
||||
* rtems_multiprocessing_announce
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the MULTIPROCESSING_ANNOUNCE directive.
|
||||
* It is invoked by the MPCI layer to indicate that an MPCI packet
|
||||
* has been received.
|
||||
*/
|
||||
|
||||
void rtems_multiprocessing_announce ( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,175 +0,0 @@
|
||||
/* msgmp.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Multiprocessing Support in the Message Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_MESSAGE_QUEUE_MP_h
|
||||
#define __RTEMS_MESSAGE_QUEUE_MP_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/rtems/message.h>
|
||||
#include <rtems/score/mppkt.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/rtems/options.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
|
||||
/*
|
||||
* The following enumerated type defines the list of
|
||||
* remote message queue operations.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
MESSAGE_QUEUE_MP_ANNOUNCE_CREATE = 0,
|
||||
MESSAGE_QUEUE_MP_ANNOUNCE_DELETE = 1,
|
||||
MESSAGE_QUEUE_MP_EXTRACT_PROXY = 2,
|
||||
MESSAGE_QUEUE_MP_RECEIVE_REQUEST = 3,
|
||||
MESSAGE_QUEUE_MP_RECEIVE_RESPONSE = 4,
|
||||
MESSAGE_QUEUE_MP_SEND_REQUEST = 5,
|
||||
MESSAGE_QUEUE_MP_SEND_RESPONSE = 6,
|
||||
MESSAGE_QUEUE_MP_URGENT_REQUEST = 7,
|
||||
MESSAGE_QUEUE_MP_URGENT_RESPONSE = 8,
|
||||
MESSAGE_QUEUE_MP_BROADCAST_REQUEST = 9,
|
||||
MESSAGE_QUEUE_MP_BROADCAST_RESPONSE = 10,
|
||||
MESSAGE_QUEUE_MP_FLUSH_REQUEST = 11,
|
||||
MESSAGE_QUEUE_MP_FLUSH_RESPONSE = 12
|
||||
} Message_queue_MP_Remote_operations;
|
||||
|
||||
/*
|
||||
* The following data structure defines the packet used to perform
|
||||
* remote message queue operations.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
rtems_packet_prefix Prefix;
|
||||
Message_queue_MP_Remote_operations operation;
|
||||
rtems_name name;
|
||||
rtems_option option_set;
|
||||
Objects_Id proxy_id;
|
||||
unsigned32 count;
|
||||
unsigned32 size;
|
||||
unsigned32 pad0;
|
||||
CORE_message_queue_Buffer Buffer;
|
||||
} Message_queue_MP_Packet;
|
||||
|
||||
/*
|
||||
* _Message_queue_MP_Send_process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* process operation can be performed on another node.
|
||||
*/
|
||||
|
||||
void _Message_queue_MP_Send_process_packet (
|
||||
Message_queue_MP_Remote_operations operation,
|
||||
Objects_Id message_queue_id,
|
||||
rtems_name name,
|
||||
Objects_Id proxy_id
|
||||
);
|
||||
|
||||
/*
|
||||
* _Message_queue_MP_Send_request_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive operation can be initiated on another node.
|
||||
*/
|
||||
|
||||
rtems_status_code _Message_queue_MP_Send_request_packet (
|
||||
Message_queue_MP_Remote_operations operation,
|
||||
Objects_Id message_queue_id,
|
||||
void *buffer,
|
||||
unsigned32 *size_p,
|
||||
rtems_option option_set,
|
||||
Watchdog_Interval timeout
|
||||
);
|
||||
|
||||
/*
|
||||
* _Message_queue_MP_Send_response_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive can be performed on another node.
|
||||
*/
|
||||
|
||||
void _Message_queue_MP_Send_response_packet (
|
||||
Message_queue_MP_Remote_operations operation,
|
||||
Objects_Id message_queue_id,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
* _Message_queue_MP_Process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the actions specific to this package for
|
||||
* the request from another node.
|
||||
*/
|
||||
|
||||
void _Message_queue_MP_Process_packet (
|
||||
rtems_packet_prefix *the_packet_prefix
|
||||
);
|
||||
|
||||
/*
|
||||
* _Message_queue_MP_Send_object_was_deleted
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked indirectly by the thread queue
|
||||
* when a proxy has been removed from the thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _Message_queue_MP_Send_object_was_deleted (
|
||||
Thread_Control *the_proxy
|
||||
);
|
||||
|
||||
/*
|
||||
* _Message_queue_MP_Send_extract_proxy
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked when a task is deleted and it
|
||||
* has a proxy which must be removed from a thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _Message_queue_MP_Send_extract_proxy (
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
* _Message_queue_MP_Get_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function is used to obtain a message queue mp packet.
|
||||
*/
|
||||
|
||||
Message_queue_MP_Packet *_Message_queue_MP_Get_packet ( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of file */
|
||||
@@ -1,53 +0,0 @@
|
||||
/* options.h
|
||||
*
|
||||
* This include file contains information which defines the
|
||||
* options available on many directives.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_OPTIONS_h
|
||||
#define __RTEMS_OPTIONS_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following type defines the control block used to manage
|
||||
* option sets.
|
||||
*/
|
||||
|
||||
typedef unsigned32 rtems_option;
|
||||
|
||||
/*
|
||||
* The following constants define the individual options which may
|
||||
* be used to compose an option set.
|
||||
*/
|
||||
|
||||
#define RTEMS_DEFAULT_OPTIONS 0x00000000
|
||||
|
||||
#define RTEMS_WAIT 0x00000000 /* wait on resource */
|
||||
#define RTEMS_NO_WAIT 0x00000001 /* do not wait on resource */
|
||||
|
||||
#define RTEMS_EVENT_ALL 0x00000000 /* wait for all events */
|
||||
#define RTEMS_EVENT_ANY 0x00000002 /* wait on any event */
|
||||
|
||||
#ifndef __RTEMS_APPLICATION__
|
||||
#include <rtems/rtems/options.inl>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,168 +0,0 @@
|
||||
/* partition.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Partition Manager. This manager provides facilities to
|
||||
* dynamically allocate memory in fixed-sized units which are returned
|
||||
* as buffers.
|
||||
*
|
||||
* Directives provided are:
|
||||
*
|
||||
* + create a partition
|
||||
* + get an ID of a partition
|
||||
* + delete a partition
|
||||
* + get a buffer from a partition
|
||||
* + return a buffer to a partition
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_PARTITION_h
|
||||
#define __RTEMS_PARTITION_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/address.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/rtems/attr.h>
|
||||
#include <rtems/rtems/types.h>
|
||||
|
||||
/*
|
||||
* The following defines the control block used to manage each partition.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Objects_Control Object;
|
||||
void *starting_address; /* physical address */
|
||||
unsigned32 length; /* in bytes */
|
||||
unsigned32 buffer_size; /* in bytes */
|
||||
rtems_attribute attribute_set; /* attributes */
|
||||
unsigned32 number_of_used_blocks; /* or allocated buffers */
|
||||
Chain_Control Memory; /* buffer chain */
|
||||
} Partition_Control;
|
||||
|
||||
/*
|
||||
* The following defines the information control block used to
|
||||
* manage this class of objects.
|
||||
*/
|
||||
|
||||
RTEMS_EXTERN Objects_Information _Partition_Information;
|
||||
|
||||
/*
|
||||
* _Partition_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _Partition_Manager_initialization(
|
||||
unsigned32 maximum_partitions
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_partition_create
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_partition_create directive. The
|
||||
* partition will have the name name. The memory area managed by
|
||||
* the partition is of length bytes and starts at starting_address.
|
||||
* The memory area will be divided into as many buffers of
|
||||
* buffer_size bytes as possible. The attribute_set determines if
|
||||
* the partition is global or local. It returns the id of the
|
||||
* created partition in ID.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_partition_create(
|
||||
rtems_name name,
|
||||
void *starting_address,
|
||||
unsigned32 length,
|
||||
unsigned32 buffer_size,
|
||||
rtems_attribute attribute_set,
|
||||
Objects_Id *id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_partition_ident
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_partition_ident directive.
|
||||
* This directive returns the partition ID associated with name.
|
||||
* If more than one partition is named name, then the partition
|
||||
* to which the ID belongs is arbitrary. node indicates the
|
||||
* extent of the search for the ID of the partition named name.
|
||||
* The search can be limited to a particular node or allowed to
|
||||
* encompass all nodes.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_partition_ident(
|
||||
rtems_name name,
|
||||
unsigned32 node,
|
||||
Objects_Id *id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_partition_delete
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_partition_delete directive. The
|
||||
* partition indicated by ID is deleted.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_partition_delete(
|
||||
Objects_Id id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_partition_get_buffer
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_partition_get_buffer directive. It
|
||||
* attempts to allocate a buffer from the partition associated with ID.
|
||||
* If a buffer is allocated, its address is returned in buffer.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_partition_get_buffer(
|
||||
Objects_Id id,
|
||||
void **buffer
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_partition_return_buffer
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_partition_return_buffer directive. It
|
||||
* frees the buffer to the partition associated with ID. The buffer must
|
||||
* have been previously allocated from the same partition.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_partition_return_buffer(
|
||||
Objects_Id id,
|
||||
void *buffer
|
||||
);
|
||||
|
||||
#ifndef __RTEMS_APPLICATION__
|
||||
#include <rtems/rtems/part.inl>
|
||||
#endif
|
||||
#include <rtems/rtems/partmp.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,161 +0,0 @@
|
||||
/* partmp.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Multiprocessing Support in the Partition Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_PARTITION_MP_h
|
||||
#define __RTEMS_PARTITION_MP_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/mppkt.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/rtems/options.h>
|
||||
#include <rtems/score/thread.h>
|
||||
|
||||
#include <rtems/rtems/part.h>
|
||||
|
||||
/*
|
||||
* The following enumerated type defines the list of
|
||||
* remote partition operations.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
PARTITION_MP_ANNOUNCE_CREATE = 0,
|
||||
PARTITION_MP_ANNOUNCE_DELETE = 1,
|
||||
PARTITION_MP_EXTRACT_PROXY = 2,
|
||||
PARTITION_MP_GET_BUFFER_REQUEST = 3,
|
||||
PARTITION_MP_GET_BUFFER_RESPONSE = 4,
|
||||
PARTITION_MP_RETURN_BUFFER_REQUEST = 5,
|
||||
PARTITION_MP_RETURN_BUFFER_RESPONSE = 6
|
||||
} Partition_MP_Remote_operations;
|
||||
|
||||
/*
|
||||
* The following data structure defines the packet used to perform
|
||||
* remote partition operations.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
rtems_packet_prefix Prefix;
|
||||
Partition_MP_Remote_operations operation;
|
||||
rtems_name name;
|
||||
void *buffer;
|
||||
Objects_Id proxy_id;
|
||||
} Partition_MP_Packet;
|
||||
|
||||
/*
|
||||
* _Partition_MP_Send_process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* process operation can be performed on another node.
|
||||
*/
|
||||
|
||||
void _Partition_MP_Send_process_packet (
|
||||
Partition_MP_Remote_operations operation,
|
||||
Objects_Id partition_id,
|
||||
rtems_name name,
|
||||
Objects_Id proxy_id
|
||||
);
|
||||
|
||||
/*
|
||||
* _Partition_MP_Send_request_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive operation can be initiated on another node.
|
||||
*/
|
||||
|
||||
rtems_status_code _Partition_MP_Send_request_packet (
|
||||
Partition_MP_Remote_operations operation,
|
||||
Objects_Id partition_id,
|
||||
void *buffer
|
||||
);
|
||||
|
||||
/*
|
||||
* _Partition_MP_Send_response_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive can be performed on another node.
|
||||
*/
|
||||
|
||||
void _Partition_MP_Send_response_packet (
|
||||
Partition_MP_Remote_operations operation,
|
||||
Objects_Id partition_id,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
* _Partition_MP_Process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the actions specific to this package for
|
||||
* the request from another node.
|
||||
*/
|
||||
|
||||
void _Partition_MP_Process_packet (
|
||||
rtems_packet_prefix *the_packet_prefix
|
||||
);
|
||||
|
||||
/*
|
||||
* _Partition_MP_Send_object_was_deleted
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked indirectly by the thread queue
|
||||
* when a proxy has been removed from the thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*
|
||||
* This routine is not needed by the Partition since a partition
|
||||
* cannot be deleted when buffers are in use.
|
||||
*/
|
||||
|
||||
/*
|
||||
* _Partition_MP_Send_extract_proxy
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked when a task is deleted and it
|
||||
* has a proxy which must be removed from a thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _Partition_MP_Send_extract_proxy (
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
* _Partition_MP_Get_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function is used to obtain a partition mp packet.
|
||||
*/
|
||||
|
||||
Partition_MP_Packet *_Partition_MP_Get_packet ( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of file */
|
||||
@@ -1,185 +0,0 @@
|
||||
/* ratemon.h
|
||||
*
|
||||
* This include file contains all the constants, structures, and
|
||||
* prototypes associated with the Rate Monotonic Manager. This manager
|
||||
* provides facilities to implement tasks which execute in a periodic fashion.
|
||||
*
|
||||
* Directives provided are:
|
||||
*
|
||||
* + create a rate monotonic timer
|
||||
* + cancel a period
|
||||
* + delete a rate monotonic timer
|
||||
* + conclude current and start the next period
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_RATE_MONOTONIC_h
|
||||
#define __RTEMS_RATE_MONOTONIC_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
|
||||
/*
|
||||
* The following enumerated type defines the states in which a
|
||||
* period may be.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
RATE_MONOTONIC_INACTIVE, /* off chain, never initialized */
|
||||
RATE_MONOTONIC_OWNER_IS_BLOCKING, /* on chain, owner is blocking on it */
|
||||
RATE_MONOTONIC_ACTIVE, /* on chain, running continuously */
|
||||
RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING, /* on chain, expired while owner was */
|
||||
/* was blocking on it */
|
||||
RATE_MONOTONIC_EXPIRED /* off chain, will be reset by next */
|
||||
/* rtems_rate_monotonic_period */
|
||||
} Rate_Monotonic_Period_states;
|
||||
|
||||
/*
|
||||
* The following constant is the interval passed to the rate_monontonic_period
|
||||
* directive to obtain status information.
|
||||
*/
|
||||
|
||||
#define RTEMS_PERIOD_STATUS WATCHDOG_NO_TIMEOUT
|
||||
|
||||
/*
|
||||
* The following structure defines the control block used to manage
|
||||
* each period.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Objects_Control Object;
|
||||
Watchdog_Control Timer;
|
||||
Rate_Monotonic_Period_states state;
|
||||
Thread_Control *owner;
|
||||
} Rate_monotonic_Control;
|
||||
|
||||
RTEMS_EXTERN Objects_Information _Rate_monotonic_Information;
|
||||
|
||||
/*
|
||||
* _Rate_monotonic_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _Rate_monotonic_Manager_initialization(
|
||||
unsigned32 maximum_periods
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_rate_monotonic_create
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rate_monotonic_create directive. The
|
||||
* period will have the name name. It returns the id of the
|
||||
* created period in ID.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_rate_monotonic_create(
|
||||
rtems_name name,
|
||||
Objects_Id *id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_rate_monotonic_ident
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_rate_monotonic_ident directive.
|
||||
* This directive returns the period ID associated with name.
|
||||
* If more than one period is named name, then the period
|
||||
* to which the ID belongs is arbitrary.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_rate_monotonic_ident(
|
||||
rtems_name name,
|
||||
Objects_Id *id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_rate_monotonic_cancel
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_rate_monotonic_cancel directive. This
|
||||
* directive stops the period associated with ID from continuing to
|
||||
* run.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_rate_monotonic_cancel(
|
||||
Objects_Id id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_rate_monotonic_delete
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_rate_monotonic_delete directive. The
|
||||
* period indicated by ID is deleted.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_rate_monotonic_delete(
|
||||
Objects_Id id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_rate_monotonic_period
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_rate_monotonic_period directive. When
|
||||
* length is non-zero, this directive initiates the period associated with
|
||||
* ID from continuing for a period of length. If length is zero, then
|
||||
* result is set to indicate the current state of the period.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_rate_monotonic_period(
|
||||
Objects_Id id,
|
||||
rtems_interval length
|
||||
);
|
||||
|
||||
/*
|
||||
* _Rate_monotonic_Timeout
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked when the period represented
|
||||
* by ID expires. If the task which owns this period is blocked
|
||||
* waiting for the period to expire, then it is readied and the
|
||||
* period is restarted. If the owning task is not waiting for the
|
||||
* period to expire, then the period is placed in the EXPIRED
|
||||
* state and not restarted.
|
||||
*/
|
||||
|
||||
void _Rate_monotonic_Timeout (
|
||||
Objects_Id id,
|
||||
void *ignored
|
||||
);
|
||||
|
||||
#ifndef __RTEMS_APPLICATION__
|
||||
#include <rtems/rtems/ratemon.inl>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,234 +0,0 @@
|
||||
/* region.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Region Manager. This manager provides facilities to dynamically
|
||||
* allocate memory in variable sized units which are returned as segments.
|
||||
*
|
||||
* Directives provided are:
|
||||
*
|
||||
* + create a region
|
||||
* + get an ID of a region
|
||||
* + delete a region
|
||||
* + get a segment from a region
|
||||
* + return a segment to a region
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_REGION_h
|
||||
#define __RTEMS_REGION_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/score/threadq.h>
|
||||
#include <rtems/score/heap.h>
|
||||
#include <rtems/debug.h>
|
||||
#include <rtems/rtems/attr.h>
|
||||
#include <rtems/rtems/types.h>
|
||||
|
||||
/*
|
||||
* The following records define the control block used to manage
|
||||
* each region.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Objects_Control Object;
|
||||
Thread_queue_Control Wait_queue; /* waiting threads */
|
||||
void *starting_address; /* physical start addr */
|
||||
unsigned32 length; /* physical length(bytes) */
|
||||
unsigned32 page_size; /* in bytes */
|
||||
unsigned32 maximum_segment_size; /* in bytes */
|
||||
rtems_attribute attribute_set;
|
||||
unsigned32 number_of_used_blocks; /* blocks allocated */
|
||||
Heap_Control Memory;
|
||||
} Region_Control;
|
||||
|
||||
/*
|
||||
* The following defines the information control block used to
|
||||
* manage this class of objects.
|
||||
*/
|
||||
|
||||
RTEMS_EXTERN Objects_Information _Region_Information;
|
||||
|
||||
/*
|
||||
* _Region_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _Region_Manager_initialization(
|
||||
unsigned32 maximum_regions
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_region_create
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_region_create directive. The
|
||||
* region will have the name name. The memory area managed by
|
||||
* the region is of length bytes and starts at starting_address.
|
||||
* The memory area will be divided into as many allocatable units of
|
||||
* page_size bytes as possible. The attribute_set determines which
|
||||
* thread queue discipline is used by the region. It returns the
|
||||
* id of the created region in ID.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_region_create(
|
||||
rtems_name name,
|
||||
void *starting_address,
|
||||
unsigned32 length,
|
||||
unsigned32 page_size,
|
||||
rtems_attribute attribute_set,
|
||||
Objects_Id *id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_region_extend
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_region_extend directive. The
|
||||
* region will have the name name. The memory area managed by
|
||||
* the region will be attempted to be grown by length bytes using
|
||||
* the memory starting at starting_address.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_region_extend(
|
||||
Objects_Id id,
|
||||
void *starting_address,
|
||||
unsigned32 length
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_region_ident
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_region_ident directive.
|
||||
* This directive returns the region ID associated with name.
|
||||
* If more than one region is named name, then the region
|
||||
* to which the ID belongs is arbitrary.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_region_ident(
|
||||
rtems_name name,
|
||||
Objects_Id *id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_region_delete
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_region_delete directive. The
|
||||
* region indicated by ID is deleted.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_region_delete(
|
||||
Objects_Id id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_region_get_segment
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_region_get_segment directive. It
|
||||
* attempts to allocate a segment from the region associated with ID.
|
||||
* If a segment of the requested size can be allocated, its address
|
||||
* is returned in segment. If no segment is available, then the task
|
||||
* may return immediately or block waiting for a segment with an optional
|
||||
* timeout of timeout clock ticks. Whether the task blocks or returns
|
||||
* immediately is based on the no_wait option in the option_set.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_region_get_segment(
|
||||
Objects_Id id,
|
||||
unsigned32 size,
|
||||
rtems_option option_set,
|
||||
rtems_interval timeout,
|
||||
void **segment
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_region_get_segment_size
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_region_get_segment_size directive. It
|
||||
* returns the size in bytes of the specified user memory area.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_region_get_segment_size(
|
||||
Objects_Id id,
|
||||
void *segment,
|
||||
unsigned32 *size
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_region_return_segment
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_region_return_segment directive. It
|
||||
* frees the segment to the region associated with ID. The segment must
|
||||
* have been previously allocated from the same region. If freeing the
|
||||
* segment results in enough memory being available to satisfy the
|
||||
* rtems_region_get_segment of the first blocked task, then that task and as
|
||||
* many subsequent tasks as possible will be unblocked with their requests
|
||||
* satisfied.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_region_return_segment(
|
||||
Objects_Id id,
|
||||
void *segment
|
||||
);
|
||||
|
||||
#ifndef __RTEMS_APPLICATION__
|
||||
#include <rtems/rtems/region.inl>
|
||||
#endif
|
||||
#include <rtems/rtems/regionmp.h>
|
||||
|
||||
/*
|
||||
* _Region_Debug_Walk
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked to verify the integrity of a heap associated
|
||||
* with the_region.
|
||||
*/
|
||||
|
||||
#ifdef RTEMS_DEBUG
|
||||
|
||||
#define _Region_Debug_Walk( _the_region, _source ) \
|
||||
do { \
|
||||
if ( _Debug_Is_enabled( RTEMS_DEBUG_REGION ) ) \
|
||||
_Heap_Walk( &(_the_region)->Memory, _source, FALSE ); \
|
||||
} while ( 0 )
|
||||
|
||||
#else
|
||||
|
||||
#define _Region_Debug_Walk( _the_region, _source )
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,166 +0,0 @@
|
||||
/* regionmp.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Multiprocessing Support in the Region Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_REGION_MP_h
|
||||
#define __RTEMS_REGION_MP_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/mppkt.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/score/thread.h>
|
||||
|
||||
#include <rtems/rtems/options.h>
|
||||
#include <rtems/rtems/region.h>
|
||||
|
||||
/*
|
||||
* The following enumerated type defines the list of
|
||||
* remote region operations.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
REGION_MP_ANNOUNCE_CREATE = 0,
|
||||
REGION_MP_ANNOUNCE_DELETE = 1,
|
||||
REGION_MP_EXTRACT_PROXY = 2,
|
||||
REGION_MP_GET_SEGMENT_REQUEST = 3,
|
||||
REGION_MP_GET_SEGMENT_RESPONSE = 4,
|
||||
REGION_MP_RETURN_SEGMENT_REQUEST = 5,
|
||||
REGION_MP_RETURN_SEGMENT_RESPONSE = 6
|
||||
} Region_MP_Remote_operations;
|
||||
|
||||
/*
|
||||
* The following data structure defines the packet used to perform
|
||||
* remote region operations.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
rtems_packet_prefix Prefix;
|
||||
Region_MP_Remote_operations operation;
|
||||
rtems_name name;
|
||||
rtems_option option_set;
|
||||
unsigned32 size;
|
||||
Objects_Id proxy_id;
|
||||
void *segment;
|
||||
} Region_MP_Packet;
|
||||
|
||||
/*
|
||||
* _Region_MP_Send_process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* process operation can be performed on another node.
|
||||
*/
|
||||
|
||||
void _Region_MP_Send_process_packet (
|
||||
Region_MP_Remote_operations operation,
|
||||
Objects_Id region_id,
|
||||
rtems_name name,
|
||||
Objects_Id proxy_id
|
||||
);
|
||||
|
||||
/*
|
||||
* _Region_MP_Send_request_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive operation can be initiated on another node.
|
||||
*/
|
||||
|
||||
rtems_status_code _Region_MP_Send_request_packet (
|
||||
Region_MP_Remote_operations operation,
|
||||
Objects_Id region_id,
|
||||
void *segment,
|
||||
unsigned32 size,
|
||||
rtems_option option_set,
|
||||
rtems_interval timeout
|
||||
);
|
||||
|
||||
/*
|
||||
* _Region_MP_Send_response_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive can be performed on another node.
|
||||
*/
|
||||
|
||||
void _Region_MP_Send_response_packet (
|
||||
Region_MP_Remote_operations operation,
|
||||
Objects_Id region_id,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
* _Region_MP_Process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the actions specific to this package for
|
||||
* the request from another node.
|
||||
*/
|
||||
|
||||
void _Region_MP_Process_packet (
|
||||
rtems_packet_prefix *the_packet_prefix
|
||||
);
|
||||
|
||||
/*
|
||||
* _Region_MP_Send_object_was_deleted
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked indirectly by the thread queue
|
||||
* when a proxy has been removed from the thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*
|
||||
* This routine is not needed by the Region since a region
|
||||
* cannot be deleted when segments are in use.
|
||||
*/
|
||||
|
||||
/*
|
||||
* _Region_MP_Send_extract_proxy
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked when a task is deleted and it
|
||||
* has a proxy which must be removed from a thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _Region_MP_Send_extract_proxy (
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
* _Region_MP_Get_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function is used to obtain a region mp packet.
|
||||
*/
|
||||
|
||||
Region_MP_Packet *_Region_MP_Get_packet ( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of file */
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* RTEMS API Support
|
||||
*
|
||||
* NOTE:
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_API_h
|
||||
#define __RTEMS_API_h
|
||||
|
||||
#include <rtems/config.h>
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _RTEMS_API_Initialize
|
||||
*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
void _RTEMS_API_Initialize(
|
||||
rtems_configuration_table *configuration_table
|
||||
);
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,248 +0,0 @@
|
||||
/* semaphore.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Semaphore Manager. This manager utilizes standard Dijkstra
|
||||
* counting semaphores to provide synchronization and mutual exclusion
|
||||
* capabilities.
|
||||
*
|
||||
* Directives provided are:
|
||||
*
|
||||
* + create a semaphore
|
||||
* + get an ID of a semaphore
|
||||
* + delete a semaphore
|
||||
* + acquire a semaphore
|
||||
* + release a semaphore
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_SEMAPHORE_h
|
||||
#define __RTEMS_SEMAPHORE_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/rtems/types.h>
|
||||
#include <rtems/rtems/support.h>
|
||||
#include <rtems/rtems/tasks.h>
|
||||
#include <rtems/rtems/attr.h>
|
||||
#include <rtems/score/coremutex.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/score/coresem.h>
|
||||
#include <rtems/score/threadq.h>
|
||||
|
||||
/*
|
||||
* The following defines the control block used to manage each semaphore.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Objects_Control Object;
|
||||
rtems_attribute attribute_set;
|
||||
union {
|
||||
CORE_mutex_Control mutex;
|
||||
CORE_semaphore_Control semaphore;
|
||||
} Core_control;
|
||||
} Semaphore_Control;
|
||||
|
||||
/*
|
||||
* The following defines the information control block used to manage
|
||||
* this class of objects.
|
||||
*/
|
||||
|
||||
RTEMS_EXTERN Objects_Information _Semaphore_Information;
|
||||
|
||||
/*
|
||||
* _Semaphore_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _Semaphore_Manager_initialization(
|
||||
unsigned32 maximum_semaphores
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_semaphore_create
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_semaphore_create directive. The
|
||||
* semaphore will have the name name. The starting count for
|
||||
* the semaphore is count. The attribute_set determines if
|
||||
* the semaphore is global or local and the thread queue
|
||||
* discipline. It returns the id of the created semaphore in ID.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_semaphore_create(
|
||||
rtems_name name,
|
||||
unsigned32 count,
|
||||
rtems_attribute attribute_set,
|
||||
rtems_task_priority priority_ceiling,
|
||||
rtems_id *id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_semaphore_ident
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_semaphore_ident directive.
|
||||
* This directive returns the semaphore ID associated with name.
|
||||
* If more than one semaphore is named name, then the semaphore
|
||||
* to which the ID belongs is arbitrary. node indicates the
|
||||
* extent of the search for the ID of the semaphore named name.
|
||||
* The search can be limited to a particular node or allowed to
|
||||
* encompass all nodes.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_semaphore_ident(
|
||||
rtems_name name,
|
||||
unsigned32 node,
|
||||
rtems_id *id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_semaphore_delete
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_semaphore_delete directive. The
|
||||
* semaphore indicated by ID is deleted.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_semaphore_delete(
|
||||
rtems_id id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_semaphore_obtain
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_semaphore_obtain directive. It
|
||||
* attempts to obtain a unit from the semaphore associated with ID.
|
||||
* If a unit can be allocated, the calling task will return immediately.
|
||||
* If no unit is available, then the task may return immediately or
|
||||
* block waiting for a unit with an optional timeout of timeout
|
||||
* clock ticks. Whether the task blocks or returns immediately
|
||||
* is based on the RTEMS_NO_WAIT option in the option_set.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_semaphore_obtain(
|
||||
rtems_id id,
|
||||
unsigned32 option_set,
|
||||
rtems_interval timeout
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_semaphore_release
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_semaphore_release directive. It
|
||||
* frees a unit to the semaphore associated with ID. If a task was
|
||||
* blocked waiting for a unit from this semaphore, then that task will
|
||||
* be readied and the unit given to that task. Otherwise, the unit
|
||||
* will be returned to the semaphore.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_semaphore_release(
|
||||
rtems_id id
|
||||
);
|
||||
|
||||
/*
|
||||
* _Semaphore_Seize
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine attempts to receive a unit from the_semaphore.
|
||||
* If a unit is available or if the RTEMS_NO_WAIT option is enabled in
|
||||
* option_set, then the routine returns. Otherwise, the calling task
|
||||
* is blocked until a unit becomes available.
|
||||
*/
|
||||
|
||||
boolean _Semaphore_Seize(
|
||||
Semaphore_Control *the_semaphore,
|
||||
unsigned32 option_set
|
||||
);
|
||||
|
||||
/*
|
||||
* _Semaphore_Translate_core_mutex_return_code
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns a RTEMS status code based on the mutex
|
||||
* status code specified.
|
||||
*/
|
||||
|
||||
rtems_status_code _Semaphore_Translate_core_mutex_return_code (
|
||||
unsigned32 the_mutex_status
|
||||
);
|
||||
|
||||
/*
|
||||
* _Semaphore_Translate_core_semaphore_return_code
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns a RTEMS status code based on the semaphore
|
||||
* status code specified.
|
||||
*/
|
||||
|
||||
rtems_status_code _Semaphore_Translate_core_semaphore_return_code (
|
||||
unsigned32 the_mutex_status
|
||||
);
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Semaphore_Core_mutex_mp_support
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function processes the global actions necessary for remote
|
||||
* accesses to a global semaphore based on a core mutex. This function
|
||||
* is called by the core.
|
||||
*/
|
||||
|
||||
void _Semaphore_Core_mutex_mp_support (
|
||||
Thread_Control *the_thread,
|
||||
rtems_id id
|
||||
);
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Semaphore_Core_mp_support
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function processes the global actions necessary for remote
|
||||
* accesses to a global semaphore based on a core semaphore. This function
|
||||
* is called by the core.
|
||||
*/
|
||||
|
||||
void _Semaphore_Core_semaphore_mp_support (
|
||||
Thread_Control *the_thread,
|
||||
rtems_id id
|
||||
);
|
||||
|
||||
#ifndef __RTEMS_APPLICATION__
|
||||
#include <rtems/rtems/sem.inl>
|
||||
#endif
|
||||
#include <rtems/rtems/semmp.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,163 +0,0 @@
|
||||
/* semmp.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Multiprocessing Support in the Semaphore Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_SEMAPHORE_MP_h
|
||||
#define __RTEMS_SEMAPHORE_MP_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/mppkt.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/rtems/options.h>
|
||||
#include <rtems/rtems/sem.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
|
||||
/*
|
||||
* The following enumerated type defines the list of
|
||||
* remote semaphore operations.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
SEMAPHORE_MP_ANNOUNCE_CREATE = 0,
|
||||
SEMAPHORE_MP_ANNOUNCE_DELETE = 1,
|
||||
SEMAPHORE_MP_EXTRACT_PROXY = 2,
|
||||
SEMAPHORE_MP_OBTAIN_REQUEST = 3,
|
||||
SEMAPHORE_MP_OBTAIN_RESPONSE = 4,
|
||||
SEMAPHORE_MP_RELEASE_REQUEST = 5,
|
||||
SEMAPHORE_MP_RELEASE_RESPONSE = 6
|
||||
} Semaphore_MP_Remote_operations;
|
||||
|
||||
/*
|
||||
* The following data structure defines the packet used to perform
|
||||
* remote semaphore operations.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
rtems_packet_prefix Prefix;
|
||||
Semaphore_MP_Remote_operations operation;
|
||||
rtems_name name;
|
||||
rtems_option option_set;
|
||||
Objects_Id proxy_id;
|
||||
} Semaphore_MP_Packet;
|
||||
|
||||
/*
|
||||
* _Semaphore_MP_Send_process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* process operation can be performed on another node.
|
||||
*/
|
||||
|
||||
void _Semaphore_MP_Send_process_packet (
|
||||
Semaphore_MP_Remote_operations operation,
|
||||
Objects_Id semaphore_id,
|
||||
rtems_name name,
|
||||
Objects_Id proxy_id
|
||||
);
|
||||
|
||||
/*
|
||||
* _Semaphore_MP_Send_request_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive operation can be initiated on another node.
|
||||
*/
|
||||
|
||||
rtems_status_code _Semaphore_MP_Send_request_packet (
|
||||
Semaphore_MP_Remote_operations operation,
|
||||
Objects_Id semaphore_id,
|
||||
rtems_option option_set,
|
||||
rtems_interval timeout
|
||||
);
|
||||
|
||||
/*
|
||||
* _Semaphore_MP_Send_response_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive can be performed on another node.
|
||||
*/
|
||||
|
||||
void _Semaphore_MP_Send_response_packet (
|
||||
Semaphore_MP_Remote_operations operation,
|
||||
Objects_Id semaphore_id,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
* _Semaphore_MP_Process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the actions specific to this package for
|
||||
* the request from another node.
|
||||
*/
|
||||
|
||||
void _Semaphore_MP_Process_packet (
|
||||
rtems_packet_prefix *the_packet_prefix
|
||||
);
|
||||
|
||||
/*
|
||||
* _Semaphore_MP_Send_object_was_deleted
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked indirectly by the thread queue
|
||||
* when a proxy has been removed from the thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _Semaphore_MP_Send_object_was_deleted (
|
||||
Thread_Control *the_proxy
|
||||
);
|
||||
|
||||
/*
|
||||
* _Semaphore_MP_Send_extract_proxy
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked when a task is deleted and it
|
||||
* has a proxy which must be removed from a thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*/
|
||||
|
||||
void _Semaphore_MP_Send_extract_proxy (
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
* _Semaphore_MP_Get_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function is used to obtain a semaphore mp packet.
|
||||
*/
|
||||
|
||||
Semaphore_MP_Packet *_Semaphore_MP_Get_packet ( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of file */
|
||||
@@ -1,83 +0,0 @@
|
||||
/* signal.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Signal Manager. This manager provides capabilities required
|
||||
* for asynchronous communication between tasks via signal sets.
|
||||
*
|
||||
* Directives provided are:
|
||||
*
|
||||
* + establish an asynchronous signal routine
|
||||
* + send a signal set to a task
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_SIGNAL_h
|
||||
#define __RTEMS_SIGNAL_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/rtems/asr.h>
|
||||
#include <rtems/rtems/modes.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/rtems/status.h>
|
||||
#include <rtems/rtems/types.h>
|
||||
|
||||
/*
|
||||
* _Signal_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _Signal_Manager_initialization( void );
|
||||
|
||||
/*
|
||||
* rtems_signal_catch
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_signal_catch directive. This directive
|
||||
* is used to establish asr_handler as the Asynchronous Signal Routine
|
||||
* (RTEMS_ASR) for the calling task. The asr_handler will execute with a
|
||||
* mode of mode_set.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_signal_catch(
|
||||
rtems_asr_entry asr_handler,
|
||||
rtems_mode mode_set
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_signal_send
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_signal_send directive. This directive
|
||||
* sends the signal_set to the task specified by ID.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_signal_send(
|
||||
Objects_Id id,
|
||||
rtems_signal_set signal_set
|
||||
);
|
||||
|
||||
#include <rtems/rtems/signalmp.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,147 +0,0 @@
|
||||
/* signalmp.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the Multiprocessing Support in the Signal Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_SIGNAL_MP_h
|
||||
#define __RTEMS_SIGNAL_MP_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/rtems/asr.h>
|
||||
#include <rtems/score/mppkt.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
|
||||
/*
|
||||
* The following enumerated type defines the list of
|
||||
* remote signal operations.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
SIGNAL_MP_SEND_REQUEST = 0,
|
||||
SIGNAL_MP_SEND_RESPONSE = 1
|
||||
} Signal_MP_Remote_operations;
|
||||
|
||||
/*
|
||||
* The following data structure defines the packet used to perform
|
||||
* remote signal operations.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
rtems_packet_prefix Prefix;
|
||||
Signal_MP_Remote_operations operation;
|
||||
rtems_signal_set signal_in;
|
||||
} Signal_MP_Packet;
|
||||
|
||||
/*
|
||||
* _Signal_MP_Send_process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* process operation can be performed on another node.
|
||||
*
|
||||
* This routine is not needed since there are no process
|
||||
* packets to be sent by this manager.
|
||||
*/
|
||||
|
||||
/*
|
||||
* _Signal_MP_Send_request_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive operation can be initiated on another node.
|
||||
*/
|
||||
|
||||
rtems_status_code _Signal_MP_Send_request_packet (
|
||||
Signal_MP_Remote_operations operation,
|
||||
Objects_Id task_id,
|
||||
rtems_signal_set signal_in
|
||||
);
|
||||
|
||||
/*
|
||||
* _Signal_MP_Send_response_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive can be performed on another node.
|
||||
*/
|
||||
|
||||
void _Signal_MP_Send_response_packet (
|
||||
Signal_MP_Remote_operations operation,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
* _Signal_MP_Process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the actions specific to this package for
|
||||
* the request from another node.
|
||||
*/
|
||||
|
||||
void _Signal_MP_Process_packet (
|
||||
rtems_packet_prefix *the_packet_prefix
|
||||
);
|
||||
|
||||
/*
|
||||
* _Signal_MP_Send_object_was_deleted
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked indirectly by the thread queue
|
||||
* when a proxy has been removed from the thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*
|
||||
* This routine is not needed since there are no objects
|
||||
* deleted by this manager.
|
||||
*/
|
||||
|
||||
/*
|
||||
* _Signal_MP_Send_extract_proxy
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked when a task is deleted and it
|
||||
* has a proxy which must be removed from a thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*
|
||||
* This routine is not needed since there are no objects
|
||||
* deleted by this manager.
|
||||
*/
|
||||
|
||||
/*
|
||||
* _Signal_MP_Get_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function is used to obtain a signal mp packet.
|
||||
*/
|
||||
|
||||
Signal_MP_Packet *_Signal_MP_Get_packet ( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of file */
|
||||
@@ -1,82 +0,0 @@
|
||||
/* status.h
|
||||
*
|
||||
* This include file contains the status codes returned from the
|
||||
* executive directives.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_STATUS_h
|
||||
#define __RTEMS_STATUS_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* types */
|
||||
|
||||
/* enumerated constants */
|
||||
|
||||
typedef enum {
|
||||
RTEMS_SUCCESSFUL = 0, /* successful completion */
|
||||
RTEMS_TASK_EXITTED = 1, /* returned from a thread */
|
||||
RTEMS_MP_NOT_CONFIGURED = 2, /* multiprocessing not configured */
|
||||
RTEMS_INVALID_NAME = 3, /* invalid object name */
|
||||
RTEMS_INVALID_ID = 4, /* invalid object id */
|
||||
RTEMS_TOO_MANY = 5, /* too many */
|
||||
RTEMS_TIMEOUT = 6, /* timed out waiting */
|
||||
RTEMS_OBJECT_WAS_DELETED = 7, /* object deleted while waiting */
|
||||
RTEMS_INVALID_SIZE = 8, /* specified size was invalid */
|
||||
RTEMS_INVALID_ADDRESS = 9, /* address specified is invalid */
|
||||
RTEMS_INVALID_NUMBER = 10, /* number was invalid */
|
||||
RTEMS_NOT_DEFINED = 11, /* item has not been initialized */
|
||||
RTEMS_RESOURCE_IN_USE = 12, /* resources still outstanding */
|
||||
RTEMS_UNSATISFIED = 13, /* request not satisfied */
|
||||
RTEMS_INCORRECT_STATE = 14, /* thread is in wrong state */
|
||||
RTEMS_ALREADY_SUSPENDED = 15, /* thread already in state */
|
||||
RTEMS_ILLEGAL_ON_SELF = 16, /* illegal on calling thread */
|
||||
RTEMS_ILLEGAL_ON_REMOTE_OBJECT = 17, /* illegal for remote object */
|
||||
RTEMS_CALLED_FROM_ISR = 18, /* called from wrong environment */
|
||||
RTEMS_INVALID_PRIORITY = 19, /* invalid thread priority */
|
||||
RTEMS_INVALID_CLOCK = 20, /* invalid date/time */
|
||||
RTEMS_INVALID_NODE = 21, /* invalid node id */
|
||||
RTEMS_NOT_CONFIGURED = 22, /* directive not configured */
|
||||
RTEMS_NOT_OWNER_OF_RESOURCE = 23, /* not owner of resource */
|
||||
RTEMS_NOT_IMPLEMENTED = 24, /* directive not implemented */
|
||||
RTEMS_INTERNAL_ERROR = 25, /* RTEMS inconsistency detected */
|
||||
RTEMS_NO_MEMORY = 26 /* could not get enough memory */
|
||||
} rtems_status_code;
|
||||
|
||||
#define RTEMS_STATUS_CODES_FIRST RTEMS_SUCCESSFUL
|
||||
#define RTEMS_STATUS_CODES_LAST RTEMS_NO_MEMORY
|
||||
|
||||
extern rtems_status_code _Status_Object_name_errors_to_status[];
|
||||
|
||||
#ifdef RTEMS_API_INIT
|
||||
rtems_status_code _Status_Object_name_errors_to_status[] = {
|
||||
RTEMS_SUCCESSFUL, /* OBJECTS_SUCCESSFUL */
|
||||
RTEMS_INVALID_NAME, /* OBJECTS_INVALID_NAME */
|
||||
RTEMS_INVALID_NODE /* OBJECTS_INVALID_NODE */
|
||||
};
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Applications are allowed to use the macros to compare status codes.
|
||||
*/
|
||||
|
||||
#include <rtems/rtems/status.inl>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,97 +0,0 @@
|
||||
/* support.h
|
||||
*
|
||||
* This include file contains information about support functions for
|
||||
* the RTEMS API.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_RTEMS_SUPPORT_h
|
||||
#define __RTEMS_RTEMS_SUPPORT_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/rtems/types.h>
|
||||
|
||||
/*
|
||||
* rtems_build_name
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns an object name composed of the four characters
|
||||
* C1, C2, C3, and C4.
|
||||
*
|
||||
* NOTE:
|
||||
*
|
||||
* This must be implemented as a macro for use in Configuration Tables.
|
||||
*
|
||||
*/
|
||||
|
||||
#define rtems_build_name( _C1, _C2, _C3, _C4 ) \
|
||||
( (_C1) << 24 | (_C2) << 16 | (_C3) << 8 | (_C4) )
|
||||
|
||||
/*
|
||||
* rtems_get_class
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns the class portion of the ID.
|
||||
*
|
||||
*/
|
||||
|
||||
#define rtems_get_class( _id ) \
|
||||
_Objects_Get_class( _id )
|
||||
|
||||
/*
|
||||
* rtems_get_node
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns the node portion of the ID.
|
||||
*
|
||||
*/
|
||||
|
||||
#define rtems_get_node( _id ) \
|
||||
_Objects_Get_node( _id )
|
||||
|
||||
/*
|
||||
* rtems_get_index
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns the index portion of the ID.
|
||||
*
|
||||
*/
|
||||
|
||||
#define rtems_get_index( _id ) \
|
||||
_Objects_Get_index( _id )
|
||||
|
||||
/*
|
||||
* Time related
|
||||
*/
|
||||
|
||||
#define RTEMS_MILLISECONDS_TO_MICROSECONDS(_ms) \
|
||||
TOD_MILLISECONDS_TO_MICROSECONDS(_ms)
|
||||
#define RTEMS_MILLISECONDS_TO_TICKS(_ms) \
|
||||
TOD_MILLISECONDS_TO_TICKS(_ms)
|
||||
|
||||
#ifndef __RTEMS_APPLICATION__
|
||||
#include <rtems/rtems/support.inl>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,167 +0,0 @@
|
||||
/* taskmp.h
|
||||
*
|
||||
* This include file contains all the constants and structures associated
|
||||
* with the multiprocessing support in the task manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_RTEMS_TASKS_MP_h
|
||||
#define __RTEMS_RTEMS_TASKS_MP_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/mppkt.h>
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/rtems/options.h>
|
||||
#include <rtems/score/priority.h>
|
||||
#include <rtems/rtems/tasks.h>
|
||||
#include <rtems/score/thread.h>
|
||||
|
||||
/*
|
||||
* The following enumerated type defines the list of
|
||||
* remote task operations.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
RTEMS_TASKS_MP_ANNOUNCE_CREATE = 0,
|
||||
RTEMS_TASKS_MP_ANNOUNCE_DELETE = 1,
|
||||
RTEMS_TASKS_MP_SUSPEND_REQUEST = 2,
|
||||
RTEMS_TASKS_MP_SUSPEND_RESPONSE = 3,
|
||||
RTEMS_TASKS_MP_RESUME_REQUEST = 4,
|
||||
RTEMS_TASKS_MP_RESUME_RESPONSE = 5,
|
||||
RTEMS_TASKS_MP_SET_PRIORITY_REQUEST = 6,
|
||||
RTEMS_TASKS_MP_SET_PRIORITY_RESPONSE = 7,
|
||||
RTEMS_TASKS_MP_GET_NOTE_REQUEST = 8,
|
||||
RTEMS_TASKS_MP_GET_NOTE_RESPONSE = 9,
|
||||
RTEMS_TASKS_MP_SET_NOTE_REQUEST = 10,
|
||||
RTEMS_TASKS_MP_SET_NOTE_RESPONSE = 11
|
||||
} RTEMS_tasks_MP_Remote_operations;
|
||||
|
||||
/*
|
||||
* The following data structure defines the packet used to perform
|
||||
* remote task operations.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
rtems_packet_prefix Prefix;
|
||||
RTEMS_tasks_MP_Remote_operations operation;
|
||||
rtems_name name;
|
||||
rtems_task_priority the_priority;
|
||||
unsigned32 notepad;
|
||||
unsigned32 note;
|
||||
} RTEMS_tasks_MP_Packet;
|
||||
|
||||
/*
|
||||
* _RTEMS_tasks_MP_Send_process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* process operation can be performed on another node.
|
||||
*/
|
||||
|
||||
void _RTEMS_tasks_MP_Send_process_packet (
|
||||
RTEMS_tasks_MP_Remote_operations operation,
|
||||
Objects_Id task_id,
|
||||
rtems_name name
|
||||
);
|
||||
|
||||
/*
|
||||
* _RTEMS_tasks_MP_Send_request_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive operation can be initiated on another node.
|
||||
*/
|
||||
|
||||
rtems_status_code _RTEMS_tasks_MP_Send_request_packet (
|
||||
RTEMS_tasks_MP_Remote_operations operation,
|
||||
Objects_Id task_id,
|
||||
rtems_task_priority the_priority,
|
||||
unsigned32 notepad,
|
||||
unsigned32 note
|
||||
);
|
||||
|
||||
/*
|
||||
* _RTEMS_tasks_MP_Send_response_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs a remote procedure call so that a
|
||||
* directive can be performed on another node.
|
||||
*/
|
||||
|
||||
void _RTEMS_tasks_MP_Send_response_packet (
|
||||
RTEMS_tasks_MP_Remote_operations operation,
|
||||
Thread_Control *the_thread
|
||||
);
|
||||
|
||||
/*
|
||||
*
|
||||
* _RTEMS_tasks_MP_Process_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the actions specific to this package for
|
||||
* the request from another node.
|
||||
*/
|
||||
|
||||
void _RTEMS_tasks_MP_Process_packet (
|
||||
rtems_packet_prefix *the_packet_prefix
|
||||
);
|
||||
|
||||
/*
|
||||
* _RTEMS_tasks_MP_Send_object_was_deleted
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked indirectly by the thread queue
|
||||
* when a proxy has been removed from the thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*
|
||||
* This routine is not needed by RTEMS_tasks since a task
|
||||
* cannot be deleted when segments are in use.
|
||||
*/
|
||||
|
||||
/*
|
||||
* _RTEMS_tasks_MP_Send_extract_proxy
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine is invoked when a task is deleted and it
|
||||
* has a proxy which must be removed from a thread queue and
|
||||
* the remote node must be informed of this.
|
||||
*
|
||||
* This routine is not needed since there are no objects
|
||||
* deleted by this manager.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* _RTEMS_tasks_MP_Get_packet
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function is used to obtain a task mp packet.
|
||||
*/
|
||||
|
||||
RTEMS_tasks_MP_Packet *_RTEMS_tasks_MP_Get_packet ( void );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of file */
|
||||
@@ -1,421 +0,0 @@
|
||||
/* tasks.h
|
||||
*
|
||||
* This include file contains all constants and structures associated
|
||||
* with RTEMS tasks. This manager provides a comprehensive set of directives
|
||||
* to create, delete, and administer tasks.
|
||||
*
|
||||
* Directives provided are:
|
||||
*
|
||||
* + create a task
|
||||
* + get an ID of a task
|
||||
* + start a task
|
||||
* + restart a task
|
||||
* + delete a task
|
||||
* + suspend a task
|
||||
* + resume a task
|
||||
* + set a task's priority
|
||||
* + change the current task's mode
|
||||
* + get a task notepad entry
|
||||
* + set a task notepad entry
|
||||
* + wake up after interval
|
||||
* + wake up when specified
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_RTEMS_TASKS_h
|
||||
#define __RTEMS_RTEMS_TASKS_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/score/states.h>
|
||||
#include <rtems/score/thread.h>
|
||||
#include <rtems/rtems/types.h>
|
||||
#include <rtems/rtems/eventset.h>
|
||||
#include <rtems/rtems/asr.h>
|
||||
#include <rtems/rtems/attr.h>
|
||||
#include <rtems/rtems/status.h>
|
||||
|
||||
/*
|
||||
* Constant to be used as the ID of current task
|
||||
*/
|
||||
|
||||
#define RTEMS_SELF OBJECTS_ID_OF_SELF
|
||||
|
||||
/*
|
||||
* This constant is passed to the rtems_task_wake_after directive as the
|
||||
* interval when a task wishes to yield the CPU.
|
||||
*/
|
||||
|
||||
#define RTEMS_YIELD_PROCESSOR WATCHDOG_NO_TIMEOUT
|
||||
|
||||
/*
|
||||
* Define the type for an RTEMS API task priority.
|
||||
*/
|
||||
|
||||
typedef Priority_Control rtems_task_priority;
|
||||
|
||||
#define RTEMS_NO_PRIORITY RTEMS_CURRENT_PRIORITY
|
||||
|
||||
#define RTEMS_MINIMUM_PRIORITY (PRIORITY_MINIMUM + 1)
|
||||
#define RTEMS_MAXIMUM_PRIORITY PRIORITY_MAXIMUM
|
||||
|
||||
/*
|
||||
* The following constant is passed to rtems_task_set_priority when the
|
||||
* caller wants to obtain the current priority.
|
||||
*/
|
||||
|
||||
#define RTEMS_CURRENT_PRIORITY PRIORITY_MINIMUM
|
||||
|
||||
/*
|
||||
* Notepads constants (indices into notepad array)
|
||||
*/
|
||||
|
||||
#define RTEMS_NOTEPAD_FIRST 0 /* lowest numbered notepad */
|
||||
#define RTEMS_NOTEPAD_0 0 /* notepad location 0 */
|
||||
#define RTEMS_NOTEPAD_1 1 /* notepad location 1 */
|
||||
#define RTEMS_NOTEPAD_2 2 /* notepad location 2 */
|
||||
#define RTEMS_NOTEPAD_3 3 /* notepad location 3 */
|
||||
#define RTEMS_NOTEPAD_4 4 /* notepad location 4 */
|
||||
#define RTEMS_NOTEPAD_5 5 /* notepad location 5 */
|
||||
#define RTEMS_NOTEPAD_6 6 /* notepad location 6 */
|
||||
#define RTEMS_NOTEPAD_7 7 /* notepad location 7 */
|
||||
#define RTEMS_NOTEPAD_8 8 /* notepad location 8 */
|
||||
#define RTEMS_NOTEPAD_9 9 /* notepad location 9 */
|
||||
#define RTEMS_NOTEPAD_10 10 /* notepad location 10 */
|
||||
#define RTEMS_NOTEPAD_11 11 /* notepad location 11 */
|
||||
#define RTEMS_NOTEPAD_12 12 /* notepad location 12 */
|
||||
#define RTEMS_NOTEPAD_13 13 /* notepad location 13 */
|
||||
#define RTEMS_NOTEPAD_14 14 /* notepad location 14 */
|
||||
#define RTEMS_NOTEPAD_15 15 /* notepad location 15 */
|
||||
#define RTEMS_NOTEPAD_LAST RTEMS_NOTEPAD_15 /* highest numbered notepad */
|
||||
|
||||
#define RTEMS_NUMBER_NOTEPADS (RTEMS_NOTEPAD_LAST+1)
|
||||
|
||||
/*
|
||||
* External API name for Thread_Control
|
||||
*/
|
||||
|
||||
typedef Thread_Control rtems_tcb;
|
||||
|
||||
/*
|
||||
* The following defines the "return type" of an RTEMS task.
|
||||
*/
|
||||
|
||||
typedef void rtems_task;
|
||||
|
||||
/*
|
||||
* The following defines the argument to an RTEMS task.
|
||||
*/
|
||||
|
||||
typedef unsigned32 rtems_task_argument;
|
||||
|
||||
/*
|
||||
* The following defines the type for the entry point of an RTEMS task.
|
||||
*/
|
||||
|
||||
typedef rtems_task ( *rtems_task_entry )(
|
||||
rtems_task_argument
|
||||
);
|
||||
|
||||
/*
|
||||
* The following records define the Initialization Tasks Table.
|
||||
* Each entry contains the information required by RTEMS to
|
||||
* create and start a user task automatically at executive
|
||||
* initialization time.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
rtems_name name; /* task name */
|
||||
unsigned32 stack_size; /* task stack size */
|
||||
rtems_task_priority initial_priority; /* task priority */
|
||||
rtems_attribute attribute_set; /* task attributes */
|
||||
rtems_task_entry entry_point; /* task entry point */
|
||||
rtems_mode mode_set; /* task initial mode */
|
||||
unsigned32 argument; /* task argument */
|
||||
} rtems_initialization_tasks_table;
|
||||
|
||||
/*
|
||||
* This is the API specific information required by each thread for
|
||||
* the RTEMS API to function correctly.
|
||||
*/
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned32 Notepads[ RTEMS_NUMBER_NOTEPADS ];
|
||||
rtems_event_set pending_events;
|
||||
rtems_event_set event_condition;
|
||||
ASR_Information Signal;
|
||||
} RTEMS_API_Control;
|
||||
|
||||
/*
|
||||
* The following defines the information control block used to
|
||||
* manage this class of objects.
|
||||
*/
|
||||
|
||||
RTEMS_EXTERN Objects_Information _RTEMS_tasks_Information;
|
||||
|
||||
/*
|
||||
* These are used to manage the user initialization tasks.
|
||||
*/
|
||||
|
||||
RTEMS_EXTERN rtems_initialization_tasks_table
|
||||
*_RTEMS_tasks_User_initialization_tasks;
|
||||
RTEMS_EXTERN unsigned32 _RTEMS_tasks_Number_of_initialization_tasks;
|
||||
|
||||
/*
|
||||
* _RTEMS_tasks_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine initializes all Task Manager related data structures.
|
||||
*/
|
||||
|
||||
void _RTEMS_tasks_Manager_initialization(
|
||||
unsigned32 maximum_tasks,
|
||||
unsigned32 number_of_initialization_tasks,
|
||||
rtems_initialization_tasks_table *user_tasks
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_task_create
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_task_create directive. The task
|
||||
* will have the name name. The attribute_set can be used to indicate
|
||||
* that the task will be globally accessible or utilize floating point.
|
||||
* The task's stack will be stack_size bytes. The task will begin
|
||||
* execution with initial_priority and initial_modes. It returns the
|
||||
* id of the created task in ID.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_task_create(
|
||||
rtems_name name,
|
||||
rtems_task_priority initial_priority,
|
||||
unsigned32 stack_size,
|
||||
rtems_mode initial_modes,
|
||||
rtems_attribute attribute_set,
|
||||
Objects_Id *id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_task_ident
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_task_ident directive.
|
||||
* This directive returns the task ID associated with name.
|
||||
* If more than one task is named name, then the task to
|
||||
* which the ID belongs is arbitrary. node indicates the
|
||||
* extent of the search for the ID of the task named name.
|
||||
* The search can be limited to a particular node or allowed to
|
||||
* encompass all nodes.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_task_ident(
|
||||
rtems_name name,
|
||||
unsigned32 node,
|
||||
Objects_Id *id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_task_delete
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_task_delete directive. The
|
||||
* task indicated by ID is deleted.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_task_delete(
|
||||
Objects_Id id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_task_get_note
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_task_get_note directive. The
|
||||
* value of the indicated notepad for the task associated with ID
|
||||
* is returned in note.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_task_get_note(
|
||||
Objects_Id id,
|
||||
unsigned32 notepad,
|
||||
unsigned32 *note
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_task_set_note
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_task_set_note directive. The
|
||||
* value of the indicated notepad for the task associated with ID
|
||||
* is returned in note.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_task_set_note(
|
||||
Objects_Id id,
|
||||
unsigned32 notepad,
|
||||
unsigned32 note
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_task_mode
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_task_mode directive. The current
|
||||
* values of the modes indicated by mask of the calling task are changed
|
||||
* to that indicated in mode_set. The former mode of the task is
|
||||
* returned in mode_set.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_task_mode(
|
||||
rtems_mode mode_set,
|
||||
rtems_mode mask,
|
||||
rtems_mode *previous_mode_set
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_task_restart
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_task_restart directive. The
|
||||
* task associated with ID is restarted at its initial entry
|
||||
* point with the new argument.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_task_restart(
|
||||
Objects_Id id,
|
||||
unsigned32 arg
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_task_suspend
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_task_suspend directive. The
|
||||
* SUSPENDED state is set for task associated with ID.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_task_suspend(
|
||||
Objects_Id id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_task_resume
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_task_resume Directive. The
|
||||
* SUSPENDED state is cleared for task associated with ID.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_task_resume(
|
||||
Objects_Id id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_task_set_priority
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_task_set_priority directive. The
|
||||
* current priority of the task associated with ID is set to
|
||||
* new_priority. The former priority of that task is returned
|
||||
* in old_priority.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_task_set_priority(
|
||||
Objects_Id id,
|
||||
rtems_task_priority new_priority,
|
||||
rtems_task_priority *old_priority
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_task_start
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_task_start directive. The
|
||||
* starting execution point of the task associated with ID is
|
||||
* set to entry_point with the initial argument.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_task_start(
|
||||
Objects_Id id,
|
||||
rtems_task_entry entry_point,
|
||||
unsigned32 argument
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_task_wake_when
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_task_wake_when directive. The
|
||||
* calling task is blocked until the current time of day is
|
||||
* equal to that indicated by time_buffer.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_task_wake_when(
|
||||
rtems_time_of_day *time_buffer
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_task_wake_after
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_task_wake_after directive. The
|
||||
* calling task is blocked until the indicated number of clock
|
||||
* ticks have occurred.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_task_wake_after(
|
||||
rtems_interval ticks
|
||||
);
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _RTEMS_tasks_Initialize_user_tasks
|
||||
*
|
||||
* This routine creates and starts all configured user
|
||||
* initialzation threads.
|
||||
*
|
||||
* Input parameters: NONE
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*/
|
||||
|
||||
void _RTEMS_tasks_Initialize_user_tasks( void );
|
||||
|
||||
#ifndef __RTEMS_APPLICATION__
|
||||
#include <rtems/rtems/tasks.inl>
|
||||
#endif
|
||||
#include <rtems/rtems/taskmp.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,207 +0,0 @@
|
||||
/* timer.h
|
||||
*
|
||||
* This include file contains all the constants, structures, and
|
||||
* prototypes associated with the Timer Manager. This manager provides
|
||||
* facilities to configure, initiate, cancel, and delete timers which will
|
||||
* fire at specified intervals of time.
|
||||
*
|
||||
* Directives provided are:
|
||||
*
|
||||
* + create a timer
|
||||
* + get an ID of a timer
|
||||
* + delete a timer
|
||||
* + set a timer to fire after a number of ticks have passed
|
||||
* + set a timer to fire when a specified date and time has been reached
|
||||
* + reset a timer
|
||||
* + cancel a time
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_TIMER_h
|
||||
#define __RTEMS_TIMER_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/score/tod.h>
|
||||
#include <rtems/score/watchdog.h>
|
||||
|
||||
/*
|
||||
* The following enumerated type details the classes to which a timer
|
||||
* may belong.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
TIMER_INTERVAL,
|
||||
TIMER_TIME_OF_DAY,
|
||||
TIMER_DORMANT
|
||||
} Timer_Classes;
|
||||
|
||||
/*
|
||||
* The following types define a pointer to a timer service routine.
|
||||
*/
|
||||
|
||||
typedef void rtems_timer_service_routine;
|
||||
|
||||
typedef rtems_timer_service_routine ( *rtems_timer_service_routine_entry )(
|
||||
rtems_id,
|
||||
void *
|
||||
);
|
||||
|
||||
/*
|
||||
* The following defines the information control block used to manage
|
||||
* this class of objects.
|
||||
*/
|
||||
|
||||
RTEMS_EXTERN Objects_Information _Timer_Information;
|
||||
|
||||
/*
|
||||
* The following records define the control block used to manage
|
||||
* each timer.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
Objects_Control Object;
|
||||
Watchdog_Control Ticker;
|
||||
Timer_Classes the_class;
|
||||
} Timer_Control;
|
||||
|
||||
/*
|
||||
* _Timer_Manager_initialization
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine performs the initialization necessary for this manager.
|
||||
*/
|
||||
|
||||
void _Timer_Manager_initialization(
|
||||
unsigned32 maximum_timers
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_timer_create
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_timer_create directive. The
|
||||
* timer will have the name name. It returns the id of the
|
||||
* created timer in ID.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_timer_create(
|
||||
rtems_name name,
|
||||
Objects_Id *id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_timer_ident
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_timer_ident directive.
|
||||
* This directive returns the timer ID associated with name.
|
||||
* If more than one timer is named name, then the timer
|
||||
* to which the ID belongs is arbitrary.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_timer_ident(
|
||||
rtems_name name,
|
||||
Objects_Id *id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_timer_cancel
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_timer_cancel directive. It is used
|
||||
* to stop the timer associated with ID from firing.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_timer_cancel(
|
||||
Objects_Id id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_timer_delete
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_timer_delete directive. The
|
||||
* timer indicated by ID is deleted.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_timer_delete(
|
||||
Objects_Id id
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_timer_fire_after
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_timer_fire_after directive. It
|
||||
* initiates the timer associated with ID to fire in ticks clock
|
||||
* ticks. When the timer fires, the routine will be invoked.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_timer_fire_after(
|
||||
Objects_Id id,
|
||||
rtems_interval ticks,
|
||||
rtems_timer_service_routine_entry routine,
|
||||
void *user_data
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_timer_fire_when
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_timer_fire_when directive. It
|
||||
* initiates the timer associated with ID to fire at wall_time
|
||||
* When the timer fires, the routine will be invoked.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_timer_fire_when(
|
||||
Objects_Id id,
|
||||
rtems_time_of_day *wall_time,
|
||||
rtems_timer_service_routine_entry routine,
|
||||
void *user_data
|
||||
);
|
||||
|
||||
/*
|
||||
* rtems_timer_reset
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine implements the rtems_timer_reset directive. It is used
|
||||
* to reinitialize the interval timer associated with ID just as if
|
||||
* rtems_timer_fire_after were re-invoked with the same arguments that
|
||||
* were used to initiate this timer.
|
||||
*/
|
||||
|
||||
rtems_status_code rtems_timer_reset(
|
||||
Objects_Id id
|
||||
);
|
||||
|
||||
#ifndef __RTEMS_APPLICATION__
|
||||
#include <rtems/rtems/timer.inl>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,96 +0,0 @@
|
||||
/* types.h
|
||||
*
|
||||
* This include file defines the types used by the RTEMS API.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_RTEMS_TYPES_h
|
||||
#define __RTEMS_RTEMS_TYPES_h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rtems/score/object.h>
|
||||
#include <rtems/score/priority.h>
|
||||
#include <rtems/rtems/modes.h>
|
||||
#include <rtems/score/mpci.h>
|
||||
#include <rtems/score/mppkt.h>
|
||||
|
||||
/*
|
||||
* RTEMS basic type definitions
|
||||
*/
|
||||
|
||||
typedef unsigned8 rtems_unsigned8; /* unsigned 8-bit value */
|
||||
typedef unsigned16 rtems_unsigned16; /* unsigned 16-bit value */
|
||||
typedef unsigned32 rtems_unsigned32; /* unsigned 32-bit value */
|
||||
|
||||
typedef signed8 rtems_signed8; /* signed 8-bit value */
|
||||
typedef signed16 rtems_signed16; /* signed 16-bit value */
|
||||
typedef signed32 rtems_signed32; /* signed 32-bit value */
|
||||
|
||||
/*
|
||||
* some C++ compilers (eg: HP's) don't do 'long long'
|
||||
*/
|
||||
#if defined(__GNUC__)
|
||||
typedef unsigned64 rtems_unsigned64; /* unsigned 64-bit value */
|
||||
typedef signed64 rtems_signed64; /* signed 64-bit value */
|
||||
#endif
|
||||
|
||||
typedef single_precision rtems_single; /* single precision float */
|
||||
typedef double_precision rtems_double; /* double precision float */
|
||||
|
||||
typedef boolean rtems_boolean;
|
||||
|
||||
typedef unsigned32 rtems_name;
|
||||
typedef Objects_Id rtems_id;
|
||||
|
||||
typedef Context_Control rtems_context;
|
||||
typedef Context_Control_fp rtems_context_fp;
|
||||
typedef CPU_Interrupt_frame rtems_interrupt_frame;
|
||||
|
||||
/*
|
||||
* Time related
|
||||
*/
|
||||
|
||||
typedef Watchdog_Interval rtems_interval;
|
||||
typedef TOD_Control rtems_time_of_day;
|
||||
|
||||
/*
|
||||
* Define the type for an RTEMS API task mode.
|
||||
*/
|
||||
|
||||
typedef Modes_Control rtems_mode;
|
||||
|
||||
/*
|
||||
* MPCI related entries
|
||||
*/
|
||||
|
||||
typedef MP_packet_Classes rtems_mp_packet_classes;
|
||||
typedef MP_packet_Prefix rtems_packet_prefix;
|
||||
|
||||
typedef MPCI_initialization_entry rtems_mpci_initialization_entry;
|
||||
typedef MPCI_get_packet_entry rtems_mpci_get_packet_entry;
|
||||
typedef MPCI_return_packet_entry rtems_mpci_return_packet_entry;
|
||||
typedef MPCI_send_entry rtems_mpci_send_packet_entry;
|
||||
typedef MPCI_receive_entry rtems_mpci_receive_packet_entry;
|
||||
|
||||
typedef MPCI_Entry rtems_mpci_entry;
|
||||
|
||||
typedef MPCI_Control rtems_mpci_table;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,128 +0,0 @@
|
||||
/* inline/asr.inl
|
||||
*
|
||||
* This include file contains the implemenation of all routines
|
||||
* associated with the asynchronous signal handler which are inlined.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __INLINE_ASR_inl
|
||||
#define __INLINE_ASR_inl
|
||||
|
||||
#include <rtems/score/isr.h>
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _ASR_Initialize
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine initializes the given RTEMS_ASR information record.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _ASR_Initialize (
|
||||
ASR_Information *information
|
||||
)
|
||||
{
|
||||
information->is_enabled = TRUE;
|
||||
information->handler = NULL;
|
||||
information->mode_set = RTEMS_DEFAULT_MODES;
|
||||
information->signals_posted = 0;
|
||||
information->signals_pending = 0;
|
||||
information->nest_level = 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _ASR_Swap_signals
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine atomically swaps the pending and posted signal
|
||||
* sets. This is done when the thread alters its mode in such a
|
||||
* way that the RTEMS_ASR disable/enable flag changes.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _ASR_Swap_signals (
|
||||
ASR_Information *information
|
||||
)
|
||||
{
|
||||
rtems_signal_set _signals;
|
||||
ISR_Level _level;
|
||||
|
||||
_ISR_Disable( _level );
|
||||
_signals = information->signals_pending;
|
||||
information->signals_pending = information->signals_posted;
|
||||
information->signals_posted = _signals;
|
||||
_ISR_Enable( _level );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _ASR_Is_null_handler
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the given asr_handler is NULL and
|
||||
* FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _ASR_Is_null_handler (
|
||||
rtems_asr_entry asr_handler
|
||||
)
|
||||
{
|
||||
return asr_handler == NULL;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _ASR_Are_signals_pending
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if there are signals pending in the
|
||||
* given RTEMS_ASR information record and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _ASR_Are_signals_pending (
|
||||
ASR_Information *information
|
||||
)
|
||||
{
|
||||
return information->signals_posted != 0;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _ASR_Post_signals
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine posts the given signals into the signal_set
|
||||
* passed in. The result is returned to the user in signal_set.
|
||||
*
|
||||
* NOTE: This must be implemented as a macro.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _ASR_Post_signals(
|
||||
rtems_signal_set signals,
|
||||
rtems_signal_set *signal_set
|
||||
)
|
||||
{
|
||||
ISR_Level _level;
|
||||
|
||||
_ISR_Disable( _level );
|
||||
*signal_set |= signals;
|
||||
_ISR_Enable( _level );
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,159 +0,0 @@
|
||||
/* inline/attr.inl
|
||||
*
|
||||
* This include file contains all of the inlined routines associated
|
||||
* with attributes.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __INLINE_ATTRIBUTES_inl
|
||||
#define __INLINE_ATTRIBUTES_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Attributes_Set
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function sets the requested new_attributes in the attribute_set
|
||||
* passed in. The result is returned to the user.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE rtems_attribute _Attributes_Set (
|
||||
rtems_attribute new_attributes,
|
||||
rtems_attribute attribute_set
|
||||
)
|
||||
{
|
||||
return attribute_set | new_attributes;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Attributes_Clear
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function clears the requested new_attributes in the attribute_set
|
||||
* passed in. The result is returned to the user.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE rtems_attribute _Attributes_Clear (
|
||||
rtems_attribute attribute_set,
|
||||
rtems_attribute mask
|
||||
)
|
||||
{
|
||||
return attribute_set & ~mask;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Attributes_Is_floating_point
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the floating point attribute is
|
||||
* enabled in the attribute_set and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Attributes_Is_floating_point(
|
||||
rtems_attribute attribute_set
|
||||
)
|
||||
{
|
||||
return ( attribute_set & RTEMS_FLOATING_POINT );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Attributes_Is_global
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the global object attribute is
|
||||
* enabled in the attribute_set and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Attributes_Is_global(
|
||||
rtems_attribute attribute_set
|
||||
)
|
||||
{
|
||||
return ( attribute_set & RTEMS_GLOBAL );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Attributes_Is_priority
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the priority attribute is
|
||||
* enabled in the attribute_set and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Attributes_Is_priority(
|
||||
rtems_attribute attribute_set
|
||||
)
|
||||
{
|
||||
return ( attribute_set & RTEMS_PRIORITY );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Attributes_Is_binary_semaphore
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the binary semaphore attribute is
|
||||
* enabled in the attribute_set and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Attributes_Is_binary_semaphore(
|
||||
rtems_attribute attribute_set
|
||||
)
|
||||
{
|
||||
return ( attribute_set & RTEMS_BINARY_SEMAPHORE );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Attributes_Is_inherit_priority
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the priority inheritance attribute
|
||||
* is enabled in the attribute_set and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Attributes_Is_inherit_priority(
|
||||
rtems_attribute attribute_set
|
||||
)
|
||||
{
|
||||
return ( attribute_set & RTEMS_INHERIT_PRIORITY );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Attributes_Is_priority_ceiling
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the priority ceiling attribute
|
||||
* is enabled in the attribute_set and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Attributes_Is_priority_ceiling(
|
||||
rtems_attribute attribute_set
|
||||
)
|
||||
{
|
||||
return ( attribute_set & RTEMS_PRIORITY_CEILING );
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,95 +0,0 @@
|
||||
/* inline/dpmem.inl
|
||||
*
|
||||
* This include file contains the inline routine used in conjunction
|
||||
* with the Dual Ported Memory Manager
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __INLINE_DPMEM_inl
|
||||
#define __INLINE_DPMEM_inl
|
||||
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Dual_ported_memory_Allocate
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine allocates a port control block from the inactive chain
|
||||
* of free port control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Dual_ported_memory_Control
|
||||
*_Dual_ported_memory_Allocate ( void )
|
||||
{
|
||||
return (Dual_ported_memory_Control *)
|
||||
_Objects_Allocate( &_Dual_ported_memory_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Dual_ported_memory_Free
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine frees a port control block to the inactive chain
|
||||
* of free port control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _Dual_ported_memory_Free (
|
||||
Dual_ported_memory_Control *the_port
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_Dual_ported_memory_Information, &the_port->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Dual_ported_memory_Get
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function maps port IDs to port control blocks. If ID
|
||||
* corresponds to a local port, then it returns the_port control
|
||||
* pointer which maps to ID and location is set to OBJECTS_LOCAL.
|
||||
* Global ports are not supported, thus if ID does not map to a
|
||||
* local port, location is set to OBJECTS_ERROR and the_port is
|
||||
* undefined.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Dual_ported_memory_Control *_Dual_ported_memory_Get (
|
||||
Objects_Id id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
return (Dual_ported_memory_Control *)
|
||||
_Objects_Get( &_Dual_ported_memory_Information, id, location );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Dual_ported_memory_Is_null
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_port is NULL and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Dual_ported_memory_Is_null(
|
||||
Dual_ported_memory_Control *the_port
|
||||
)
|
||||
{
|
||||
return ( the_port == NULL );
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,21 +0,0 @@
|
||||
/* inline/event.inl
|
||||
*
|
||||
* This include file contains the static inline implementation of
|
||||
* macros for the Event Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __MACROS_EVENT_inl
|
||||
#define __MACROS_EVENT_inl
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,91 +0,0 @@
|
||||
/* inline/eventset.inl
|
||||
*
|
||||
* This include file contains the information pertaining to event sets.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __INLINE_EVENT_SET_inl
|
||||
#define __INLINE_EVENT_SET_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Event_sets_Is_empty
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if on events are posted in the event_set,
|
||||
* and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Event_sets_Is_empty(
|
||||
rtems_event_set the_event_set
|
||||
)
|
||||
{
|
||||
return ( the_event_set == 0 );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Event_sets_Post
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine posts the given new_events into the event_set
|
||||
* passed in. The result is returned to the user in event_set.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _Event_sets_Post(
|
||||
rtems_event_set the_new_events,
|
||||
rtems_event_set *the_event_set
|
||||
)
|
||||
{
|
||||
*the_event_set |= the_new_events;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Event_sets_Get
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns the events in event_condition which are
|
||||
* set in event_set.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE rtems_event_set _Event_sets_Get(
|
||||
rtems_event_set the_event_set,
|
||||
rtems_event_set the_event_condition
|
||||
)
|
||||
{
|
||||
return ( the_event_set & the_event_condition );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Event_sets_Clear
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function removes the events in mask from the event_set
|
||||
* passed in. The result is returned to the user in event_set.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE rtems_event_set _Event_sets_Clear(
|
||||
rtems_event_set the_event_set,
|
||||
rtems_event_set the_mask
|
||||
)
|
||||
{
|
||||
return ( the_event_set & ~(the_mask) );
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,83 +0,0 @@
|
||||
/* message.inl
|
||||
*
|
||||
* This include file contains the static inline implementation of all
|
||||
* inlined routines in the Message Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __MESSAGE_QUEUE_inl
|
||||
#define __MESSAGE_QUEUE_inl
|
||||
|
||||
#include <rtems/score/wkspace.h>
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Message_queue_Is_null
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function places the_message at the rear of the outstanding
|
||||
* messages on the_message_queue.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Message_queue_Is_null (
|
||||
Message_queue_Control *the_message_queue
|
||||
)
|
||||
{
|
||||
return ( the_message_queue == NULL );
|
||||
}
|
||||
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Message_queue_Free
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine deallocates a message queue control block into
|
||||
* the inactive chain of free message queue control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _Message_queue_Free (
|
||||
Message_queue_Control *the_message_queue
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_Message_queue_Information, &the_message_queue->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Message_queue_Get
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function maps message queue IDs to message queue control
|
||||
* blocks. If ID corresponds to a local message queue, then it
|
||||
* returns the_message_queue control pointer which maps to ID
|
||||
* and location is set to OBJECTS_LOCAL. If the message queue ID is
|
||||
* global and resides on a remote node, then location is set
|
||||
* to OBJECTS_REMOTE, and the_message_queue is undefined.
|
||||
* Otherwise, location is set to OBJECTS_ERROR and
|
||||
* the_message_queue is undefined.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Message_queue_Control *_Message_queue_Get (
|
||||
Objects_Id id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
return (Message_queue_Control *)
|
||||
_Objects_Get( &_Message_queue_Information, id, location );
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,152 +0,0 @@
|
||||
/* modes.inl
|
||||
*
|
||||
* This include file contains the static inline implementation of the
|
||||
* inlined routines in the Mode Handler
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __MODES_inl
|
||||
#define __MODES_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Modes_Mask_changed
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if any of the mode flags in mask
|
||||
* are set in mode_set, and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Modes_Mask_changed (
|
||||
Modes_Control mode_set,
|
||||
Modes_Control masks
|
||||
)
|
||||
{
|
||||
return ( mode_set & masks );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Modes_Is_asr_disabled
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if mode_set indicates that Asynchronous
|
||||
* Signal Processing is disabled, and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Modes_Is_asr_disabled (
|
||||
Modes_Control mode_set
|
||||
)
|
||||
{
|
||||
return (mode_set & RTEMS_ASR_MASK) == RTEMS_NO_ASR;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Modes_Is_preempt
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if mode_set indicates that preemption
|
||||
* is enabled, and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Modes_Is_preempt (
|
||||
Modes_Control mode_set
|
||||
)
|
||||
{
|
||||
return (mode_set & RTEMS_PREEMPT_MASK) == RTEMS_PREEMPT;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Modes_Is_timeslice
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if mode_set indicates that timeslicing
|
||||
* is enabled, and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Modes_Is_timeslice (
|
||||
Modes_Control mode_set
|
||||
)
|
||||
{
|
||||
return (mode_set & RTEMS_TIMESLICE_MASK) == RTEMS_TIMESLICE;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Modes_Get_interrupt_level
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns the interrupt level portion of the mode_set.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE ISR_Level _Modes_Get_interrupt_level (
|
||||
Modes_Control mode_set
|
||||
)
|
||||
{
|
||||
return ( mode_set & RTEMS_INTERRUPT_MASK );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Modes_Set_interrupt_level
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine sets the current interrupt level to that specified
|
||||
* in the mode_set.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _Modes_Set_interrupt_level (
|
||||
Modes_Control mode_set
|
||||
)
|
||||
{
|
||||
_ISR_Set_level( _Modes_Get_interrupt_level( mode_set ) );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Modes_Change
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine changes the modes in old_mode_set indicated by
|
||||
* mask to the requested values in new_mode_set. The resulting
|
||||
* mode set is returned in out_mode_set and the modes that changed
|
||||
* is returned in changed.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _Modes_Change (
|
||||
Modes_Control old_mode_set,
|
||||
Modes_Control new_mode_set,
|
||||
Modes_Control mask,
|
||||
Modes_Control *out_mode_set,
|
||||
Modes_Control *changed
|
||||
)
|
||||
{
|
||||
Modes_Control _out_mode;
|
||||
|
||||
_out_mode = old_mode_set;
|
||||
_out_mode &= ~mask;
|
||||
_out_mode |= new_mode_set & mask;
|
||||
*changed = _out_mode ^ old_mode_set;
|
||||
*out_mode_set = _out_mode;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,55 +0,0 @@
|
||||
/* options.inl
|
||||
*
|
||||
* This file contains the static inline implementation of the inlined
|
||||
* routines from the Options Handler.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __OPTIONS_inl
|
||||
#define __OPTIONS_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Options_Is_no_wait
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the RTEMS_NO_WAIT option is enabled in
|
||||
* option_set, and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Options_Is_no_wait (
|
||||
rtems_option option_set
|
||||
)
|
||||
{
|
||||
return (option_set & RTEMS_NO_WAIT);
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Options_Is_any
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the RTEMS_EVENT_ANY option is enabled in
|
||||
* OPTION_SET, and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Options_Is_any (
|
||||
rtems_option option_set
|
||||
)
|
||||
{
|
||||
return (option_set & RTEMS_EVENT_ANY);
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,199 +0,0 @@
|
||||
/* part.inl
|
||||
*
|
||||
* This file contains the macro implementation of all inlined routines
|
||||
* in the Partition Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __PARTITION_inl
|
||||
#define __PARTITION_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Partition_Allocate_buffer
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function attempts to allocate a buffer from the_partition.
|
||||
* If successful, it returns the address of the allocated buffer.
|
||||
* Otherwise, it returns NULL.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void *_Partition_Allocate_buffer (
|
||||
Partition_Control *the_partition
|
||||
)
|
||||
{
|
||||
return _Chain_Get( &the_partition->Memory );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Partition_Free_buffer
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine frees the_buffer to the_partition.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _Partition_Free_buffer (
|
||||
Partition_Control *the_partition,
|
||||
Chain_Node *the_buffer
|
||||
)
|
||||
{
|
||||
_Chain_Append( &the_partition->Memory, the_buffer );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Partition_Is_buffer_on_boundary
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_buffer is on a valid buffer
|
||||
* boundary for the_partition, and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Partition_Is_buffer_on_boundary (
|
||||
void *the_buffer,
|
||||
Partition_Control *the_partition
|
||||
)
|
||||
{
|
||||
unsigned32 offset;
|
||||
|
||||
offset = (unsigned32) _Addresses_Subtract(
|
||||
the_buffer,
|
||||
the_partition->starting_address
|
||||
);
|
||||
|
||||
return ((offset % the_partition->buffer_size) == 0);
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Partition_Is_buffer_valid
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_buffer is a valid buffer from
|
||||
* the_partition, otherwise FALSE is returned.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Partition_Is_buffer_valid (
|
||||
Chain_Node *the_buffer,
|
||||
Partition_Control *the_partition
|
||||
)
|
||||
{
|
||||
void *starting;
|
||||
void *ending;
|
||||
|
||||
starting = the_partition->starting_address;
|
||||
ending = _Addresses_Add_offset( starting, the_partition->length );
|
||||
|
||||
return (
|
||||
_Addresses_Is_in_range( the_buffer, starting, ending ) &&
|
||||
_Partition_Is_buffer_on_boundary( the_buffer, the_partition )
|
||||
);
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Partition_Is_buffer_size_aligned
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the use of the specified buffer_size
|
||||
* will result in the allocation of buffers whose first byte is
|
||||
* properly aligned, and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Partition_Is_buffer_size_aligned (
|
||||
unsigned32 buffer_size
|
||||
)
|
||||
{
|
||||
return ((buffer_size % CPU_PARTITION_ALIGNMENT) == 0);
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Partition_Allocate
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function allocates a partition control block from
|
||||
* the inactive chain of free partition control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Partition_Control *_Partition_Allocate ( void )
|
||||
{
|
||||
return (Partition_Control *) _Objects_Allocate( &_Partition_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Partition_Free
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine frees a partition control block to the
|
||||
* inactive chain of free partition control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _Partition_Free (
|
||||
Partition_Control *the_partition
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_Partition_Information, &the_partition->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Partition_Get
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function maps partition IDs to partition control blocks.
|
||||
* If ID corresponds to a local partition, then it returns
|
||||
* the_partition control pointer which maps to ID and location
|
||||
* is set to OBJECTS_LOCAL. If the partition ID is global and
|
||||
* resides on a remote node, then location is set to OBJECTS_REMOTE,
|
||||
* and the_partition is undefined. Otherwise, location is set
|
||||
* to OBJECTS_ERROR and the_partition is undefined.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Partition_Control *_Partition_Get (
|
||||
Objects_Id id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
return (Partition_Control *)
|
||||
_Objects_Get( &_Partition_Information, id, location );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Partition_Is_null
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_partition is NULL
|
||||
* and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Partition_Is_null (
|
||||
Partition_Control *the_partition
|
||||
)
|
||||
{
|
||||
return ( the_partition == NULL );
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,143 +0,0 @@
|
||||
/* ratemon.inl
|
||||
*
|
||||
* This file contains the static inline implementation of the inlined
|
||||
* routines in the Rate Monotonic Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RATE_MONOTONIC_inl
|
||||
#define __RATE_MONOTONIC_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Rate_monotonic_Allocate
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function allocates a period control block from
|
||||
* the inactive chain of free period control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Rate_monotonic_Control *_Rate_monotonic_Allocate( void )
|
||||
{
|
||||
return (Rate_monotonic_Control *)
|
||||
_Objects_Allocate( &_Rate_monotonic_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Rate_monotonic_Free
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine allocates a period control block from
|
||||
* the inactive chain of free period control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _Rate_monotonic_Free (
|
||||
Rate_monotonic_Control *the_period
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_Rate_monotonic_Information, &the_period->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Rate_monotonic_Get
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function maps period IDs to period control blocks.
|
||||
* If ID corresponds to a local period, then it returns
|
||||
* the_period control pointer which maps to ID and location
|
||||
* is set to OBJECTS_LOCAL. Otherwise, location is set
|
||||
* to OBJECTS_ERROR and the_period is undefined.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Rate_monotonic_Control *_Rate_monotonic_Get (
|
||||
Objects_Id id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
return (Rate_monotonic_Control *)
|
||||
_Objects_Get( &_Rate_monotonic_Information, id, location );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Rate_monotonic_Is_active
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_period is in the ACTIVE state,
|
||||
* and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Rate_monotonic_Is_active (
|
||||
Rate_monotonic_Control *the_period
|
||||
)
|
||||
{
|
||||
return (the_period->state == RATE_MONOTONIC_ACTIVE);
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Rate_monotonic_Is_inactive
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_period is in the ACTIVE state,
|
||||
* and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Rate_monotonic_Is_inactive (
|
||||
Rate_monotonic_Control *the_period
|
||||
)
|
||||
{
|
||||
return (the_period->state == RATE_MONOTONIC_INACTIVE);
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Rate_monotonic_Is_expired
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_period is in the EXPIRED state,
|
||||
* and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Rate_monotonic_Is_expired (
|
||||
Rate_monotonic_Control *the_period
|
||||
)
|
||||
{
|
||||
return (the_period->state == RATE_MONOTONIC_EXPIRED);
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Rate_monotonic_Is_null
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_period is NULL and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Rate_monotonic_Is_null (
|
||||
Rate_monotonic_Control *the_period
|
||||
)
|
||||
{
|
||||
return (the_period == NULL);
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,127 +0,0 @@
|
||||
/* region.inl
|
||||
*
|
||||
* This file contains the macro implementation of the inlined
|
||||
* routines from the Region Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __REGION_inl
|
||||
#define __REGION_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Region_Allocate
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function allocates a region control block from
|
||||
* the inactive chain of free region control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Region_Control *_Region_Allocate( void )
|
||||
{
|
||||
return (Region_Control *) _Objects_Allocate( &_Region_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Region_Free
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine frees a region control block to the
|
||||
* inactive chain of free region control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _Region_Free (
|
||||
Region_Control *the_region
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_Region_Information, &the_region->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Region_Get
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function maps region IDs to region control blocks.
|
||||
* If ID corresponds to a local region, then it returns
|
||||
* the_region control pointer which maps to ID and location
|
||||
* is set to OBJECTS_LOCAL. Otherwise, location is set
|
||||
* to OBJECTS_ERROR and the_region is undefined.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Region_Control *_Region_Get (
|
||||
Objects_Id id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
return (Region_Control *)
|
||||
_Objects_Get( &_Region_Information, id, location );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Region_Allocate_segment
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function attempts to allocate a segment from the_region.
|
||||
* If successful, it returns the address of the allocated segment.
|
||||
* Otherwise, it returns NULL.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void *_Region_Allocate_segment (
|
||||
Region_Control *the_region,
|
||||
unsigned32 size
|
||||
)
|
||||
{
|
||||
return _Heap_Allocate( &the_region->Memory, size );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Region_Free_segment
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function frees the_segment to the_region.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Region_Free_segment (
|
||||
Region_Control *the_region,
|
||||
void *the_segment
|
||||
)
|
||||
{
|
||||
return _Heap_Free( &the_region->Memory, the_segment );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Region_Is_null
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_region is NULL and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Region_Is_null (
|
||||
Region_Control *the_region
|
||||
)
|
||||
{
|
||||
return ( the_region == NULL );
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,93 +0,0 @@
|
||||
/* sem.inl
|
||||
*
|
||||
* This file contains the static inlin implementation of the inlined
|
||||
* routines from the Semaphore Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __SEMAPHORE_inl
|
||||
#define __SEMAPHORE_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Semaphore_Allocate
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function allocates a semaphore control block from
|
||||
* the inactive chain of free semaphore control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Semaphore_Control *_Semaphore_Allocate( void )
|
||||
{
|
||||
return (Semaphore_Control *) _Objects_Allocate( &_Semaphore_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Semaphore_Free
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine frees a semaphore control block to the
|
||||
* inactive chain of free semaphore control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _Semaphore_Free (
|
||||
Semaphore_Control *the_semaphore
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_Semaphore_Information, &the_semaphore->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Semaphore_Get
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function maps semaphore IDs to semaphore control blocks.
|
||||
* If ID corresponds to a local semaphore, then it returns
|
||||
* the_semaphore control pointer which maps to ID and location
|
||||
* is set to OBJECTS_LOCAL. if the semaphore ID is global and
|
||||
* resides on a remote node, then location is set to OBJECTS_REMOTE,
|
||||
* and the_semaphore is undefined. Otherwise, location is set
|
||||
* to OBJECTS_ERROR and the_semaphore is undefined.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Semaphore_Control *_Semaphore_Get (
|
||||
Objects_Id id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
return (Semaphore_Control *)
|
||||
_Objects_Get( &_Semaphore_Information, id, location );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Semaphore_Is_null
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_semaphore is NULL and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Semaphore_Is_null (
|
||||
Semaphore_Control *the_semaphore
|
||||
)
|
||||
{
|
||||
return ( the_semaphore == NULL );
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,56 +0,0 @@
|
||||
/* inline/status.inl
|
||||
*
|
||||
* This include file contains the implementations of the inlined
|
||||
* routines for the status package.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __INLINE_STATUS_inl
|
||||
#define __INLINE_STATUS_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* rtems_is_status_successful
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the status code is equal to RTEMS_SUCCESSFUL,
|
||||
* and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean rtems_is_status_successful(
|
||||
rtems_status_code code
|
||||
)
|
||||
{
|
||||
return (code == RTEMS_SUCCESSFUL);
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* rtems_are_statuses_equal
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the status code1 is equal to code2,
|
||||
* and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean rtems_are_statuses_equal(
|
||||
rtems_status_code code1,
|
||||
rtems_status_code code2
|
||||
)
|
||||
{
|
||||
return (code1 == code2);
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,61 +0,0 @@
|
||||
/* support.inl
|
||||
*
|
||||
* This include file contains the static inline implementation of all
|
||||
* of the inlined routines specific to the RTEMS API.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_SUPPORT_inl
|
||||
#define __RTEMS_SUPPORT_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* rtems_is_name_valid
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the name is valid, and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE rtems_boolean rtems_is_name_valid (
|
||||
rtems_name name
|
||||
)
|
||||
{
|
||||
return ( name != 0 );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* rtems_name_to_characters
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function breaks the object name into the four component
|
||||
* characters C1, C2, C3, and C4.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void rtems_name_to_characters(
|
||||
rtems_name name,
|
||||
char *c1,
|
||||
char *c2,
|
||||
char *c3,
|
||||
char *c4
|
||||
)
|
||||
{
|
||||
*c1 = (name >> 24) & 0xff;
|
||||
*c2 = (name >> 16) & 0xff;
|
||||
*c3 = (name >> 8) & 0xff;
|
||||
*c4 = name & 0xff;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,90 +0,0 @@
|
||||
/* tasks.inl
|
||||
*
|
||||
* This file contains the static inline implementation of all inlined
|
||||
* routines in the with RTEMS Tasks Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_TASKS_inl
|
||||
#define __RTEMS_TASKS_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _RTEMS_tasks_Allocate
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function allocates a task control block from
|
||||
* the inactive chain of free task control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Thread_Control *_RTEMS_tasks_Allocate( void )
|
||||
{
|
||||
return (Thread_Control *) _Objects_Allocate( &_RTEMS_tasks_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _RTEMS_tasks_Free
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine frees a task control block to the
|
||||
* inactive chain of free task control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _RTEMS_tasks_Free (
|
||||
Thread_Control *the_task
|
||||
)
|
||||
{
|
||||
_Objects_Free(
|
||||
_Objects_Get_information( the_task->Object.id ),
|
||||
&the_task->Object
|
||||
);
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _RTEMS_tasks_Priority_to_Core
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function converts an RTEMS API priority into a core priority.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Priority_Control _RTEMS_tasks_Priority_to_Core(
|
||||
rtems_task_priority priority
|
||||
)
|
||||
{
|
||||
return (Priority_Control) priority;
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _RTEMS_tasks_Priority_is_valid
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_priority is a valid user task priority
|
||||
* and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _RTEMS_tasks_Priority_is_valid (
|
||||
rtems_task_priority the_priority
|
||||
)
|
||||
{
|
||||
return ( ( the_priority >= RTEMS_MINIMUM_PRIORITY ) &&
|
||||
( the_priority <= RTEMS_MAXIMUM_PRIORITY ) );
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,142 +0,0 @@
|
||||
/* timer.inl
|
||||
*
|
||||
* This file contains the static inline implementation of the inlined routines
|
||||
* from the Timer Manager.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __TIMER_inl
|
||||
#define __TIMER_inl
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Timer_Allocate
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function allocates a timer control block from
|
||||
* the inactive chain of free timer control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Timer_Control *_Timer_Allocate( void )
|
||||
{
|
||||
return (Timer_Control *) _Objects_Allocate( &_Timer_Information );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Timer_Free
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This routine frees a timer control block to the
|
||||
* inactive chain of free timer control blocks.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE void _Timer_Free (
|
||||
Timer_Control *the_timer
|
||||
)
|
||||
{
|
||||
_Objects_Free( &_Timer_Information, &the_timer->Object );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Timer_Get
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function maps timer IDs to timer control blocks.
|
||||
* If ID corresponds to a local timer, then it returns
|
||||
* the timer control pointer which maps to ID and location
|
||||
* is set to OBJECTS_LOCAL. Otherwise, location is set
|
||||
* to OBJECTS_ERROR and the returned value is undefined.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE Timer_Control *_Timer_Get (
|
||||
Objects_Id id,
|
||||
Objects_Locations *location
|
||||
)
|
||||
{
|
||||
return (Timer_Control *)
|
||||
_Objects_Get( &_Timer_Information, id, location );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Timer_Is_interval_class
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the class is that of an INTERVAL
|
||||
* timer, and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Timer_Is_interval_class (
|
||||
Timer_Classes the_class
|
||||
)
|
||||
{
|
||||
return ( the_class == TIMER_INTERVAL );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Timer_Is_time_of_day_class
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the class is that of an INTERVAL
|
||||
* timer, and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Timer_Is_timer_of_day_class (
|
||||
Timer_Classes the_class
|
||||
)
|
||||
{
|
||||
return ( the_class == TIMER_TIME_OF_DAY );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Timer_Is_dormant_class
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the class is that of a DORMANT
|
||||
* timer, and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Timer_Is_dormant_class (
|
||||
Timer_Classes the_class
|
||||
)
|
||||
{
|
||||
return ( the_class == TIMER_DORMANT );
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _Timer_Is_null
|
||||
*
|
||||
* DESCRIPTION:
|
||||
*
|
||||
* This function returns TRUE if the_timer is NULL and FALSE otherwise.
|
||||
*/
|
||||
|
||||
RTEMS_INLINE_ROUTINE boolean _Timer_Is_null (
|
||||
Timer_Control *the_timer
|
||||
)
|
||||
{
|
||||
return ( the_timer == NULL );
|
||||
}
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
@@ -1,90 +0,0 @@
|
||||
/* macros/asr.h
|
||||
*
|
||||
* This include file contains the implemenation of all routines
|
||||
* associated with the asynchronous signal handler which are inlined.
|
||||
*
|
||||
* COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* All rights assigned to U.S. Government, 1994.
|
||||
*
|
||||
* This material may be reproduced by or for the U.S. Government pursuant
|
||||
* to the copyright license under the clause at DFARS 252.227-7013. This
|
||||
* notice must appear in all copies of this file and its derivatives.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __INLINE_ASR_h
|
||||
#define __INLINE_ASR_h
|
||||
|
||||
#include <rtems/score/isr.h>
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _ASR_Initialize
|
||||
*
|
||||
*/
|
||||
|
||||
#define _ASR_Initialize( _information ) \
|
||||
{ \
|
||||
(_information)->is_enabled = TRUE; \
|
||||
(_information)->handler = NULL; \
|
||||
(_information)->mode_set = RTEMS_DEFAULT_MODES; \
|
||||
(_information)->signals_posted = 0; \
|
||||
(_information)->signals_pending = 0; \
|
||||
(_information)->nest_level = 0; \
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _ASR_Swap_signals
|
||||
*
|
||||
*/
|
||||
|
||||
#define _ASR_Swap_signals( _information ) \
|
||||
{ \
|
||||
rtems_signal_set _signals; \
|
||||
ISR_Level _level; \
|
||||
\
|
||||
_ISR_Disable( _level ); \
|
||||
_signals = (_information)->signals_pending; \
|
||||
(_information)->signals_pending = (_information)->signals_posted; \
|
||||
(_information)->signals_posted = _signals; \
|
||||
_ISR_Enable( _level ); \
|
||||
}
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _ASR_Is_null_handler
|
||||
*
|
||||
*/
|
||||
|
||||
#define _ASR_Is_null_handler( _asr_handler ) \
|
||||
( (_asr_handler) == NULL )
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _ASR_Are_signals_pending
|
||||
*
|
||||
*/
|
||||
|
||||
#define _ASR_Are_signals_pending( _information ) \
|
||||
( (_information)->signals_posted != 0 )
|
||||
|
||||
/*PAGE
|
||||
*
|
||||
* _ASR_Post_signals
|
||||
*
|
||||
*/
|
||||
|
||||
#define _ASR_Post_signals( _signals, _signal_set ) \
|
||||
do { \
|
||||
ISR_Level _level; \
|
||||
\
|
||||
_ISR_Disable( _level ); \
|
||||
*(_signal_set) |= (_signals); \
|
||||
_ISR_Enable( _level ); \
|
||||
} while ( 0 )
|
||||
|
||||
#endif
|
||||
/* end of include file */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user