URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
Compare Revisions
- This comparison shows the changes necessary to convert path
/openrisc/trunk/rtos/rtems/c/src/tests/sptests/sp08
- from Rev 30 to Rev 173
- ↔ Reverse comparison
Rev 30 → Rev 173
/init.c
0,0 → 1,52
/* Init |
* |
* This routine is the initialization task for this test program. |
* It is a user initialization task and has the responsibility for creating |
* and starting the tasks that make up the test. If the time of day |
* clock is required for the test, it should also be set to a known |
* value by this function. |
* |
* Input parameters: |
* argument - task argument |
* |
* Output parameters: NONE |
* |
* COPYRIGHT (c) 1989-1999. |
* On-Line Applications Research Corporation (OAR). |
* |
* The license and distribution terms for this file may be |
* found in the file LICENSE in this distribution or at |
* http://www.OARcorp.com/rtems/license.html. |
* |
* $Id: init.c,v 1.2 2001-09-27 12:02:31 chris Exp $ |
*/ |
|
#define TEST_INIT |
#include "system.h" |
|
rtems_task Init( |
rtems_task_argument argument |
) |
{ |
rtems_status_code status; |
|
puts( "\n\n*** TEST 8 ***" ); |
|
Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); |
|
status = rtems_task_create( |
Task_name[ 1 ], |
1, |
RTEMS_MINIMUM_STACK_SIZE * 2, |
RTEMS_DEFAULT_MODES, |
RTEMS_DEFAULT_ATTRIBUTES, |
&Task_id[ 1 ] |
); |
directive_failed( status, "rtems_task_create of TA1" ); |
|
status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); |
directive_failed( status, "rtems_task_start of TA1" ); |
|
status = rtems_task_delete( RTEMS_SELF ); |
directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); |
} |
/task1.c
0,0 → 1,255
/* Task_1 |
* |
* This routine serves as a test task. It verifies all combinations of |
* task mode changes. |
* |
* Input parameters: |
* argument - task argument |
* |
* Output parameters: NONE |
* |
* COPYRIGHT (c) 1989-1999. |
* On-Line Applications Research Corporation (OAR). |
* |
* The license and distribution terms for this file may be |
* found in the file LICENSE in this distribution or at |
* http://www.OARcorp.com/rtems/license.html. |
* |
* $Id: task1.c,v 1.2 2001-09-27 12:02:31 chris Exp $ |
*/ |
|
#include "system.h" |
|
rtems_task Task_1( |
rtems_task_argument argument |
) |
{ |
rtems_mode previous_mode; |
rtems_status_code status; |
|
/* BEGINNING OF RTEMS_ASR */ |
|
status = rtems_task_mode( RTEMS_ASR, RTEMS_ASR_MASK, &previous_mode ); |
directive_failed( status, "rtems_task_mode" ); |
put_mode( |
"TA1 - rtems_task_mode - RTEMS_ASR - previous mode: ", |
previous_mode |
); |
|
status = rtems_task_mode( |
RTEMS_NO_ASR, |
RTEMS_ASR_MASK, |
&previous_mode |
); |
directive_failed( status, "rtems_task_mode" ); |
put_mode( |
"TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: ", |
previous_mode |
); |
|
status = rtems_task_mode( |
RTEMS_NO_ASR, |
RTEMS_ASR_MASK, |
&previous_mode |
); |
directive_failed( status, "rtems_task_mode" ); |
put_mode( |
"TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: ", |
previous_mode |
); |
|
status = rtems_task_mode( |
RTEMS_ASR, |
RTEMS_ASR_MASK, |
&previous_mode |
); |
directive_failed( status, "rtems_task_mode" ); |
put_mode( |
"TA1 - rtems_task_mode - RTEMS_ASR - previous mode: ", |
previous_mode |
); |
|
/* END OF RTEMS_ASR */ |
|
/* BEGINNING OF RTEMS_TIMESLICE */ |
|
status = rtems_task_mode( |
RTEMS_NO_TIMESLICE, |
RTEMS_TIMESLICE_MASK, |
&previous_mode |
); |
directive_failed( status, "rtems_task_mode" ); |
put_mode( |
"TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE - previous mode: ", |
previous_mode |
); |
|
status = rtems_task_mode( |
RTEMS_TIMESLICE, |
RTEMS_TIMESLICE_MASK, |
&previous_mode |
); |
directive_failed( status, "rtems_task_mode" ); |
put_mode( |
"TA1 - rtems_task_mode - RTEMS_TIMESLICE - previous mode: ", |
previous_mode |
); |
|
status = rtems_task_mode( |
RTEMS_TIMESLICE, |
RTEMS_TIMESLICE_MASK, |
&previous_mode |
); |
directive_failed( status, "rtems_task_mode" ); |
put_mode( |
"TA1 - rtems_task_mode - RTEMS_TIMESLICE - previous mode: ", |
previous_mode |
); |
|
status = rtems_task_mode( |
RTEMS_NO_TIMESLICE, |
RTEMS_TIMESLICE_MASK, |
&previous_mode |
); |
directive_failed( status, "rtems_task_mode" ); |
put_mode( |
"TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE - previous mode: ", |
previous_mode |
); |
|
/* END OF RTEMS_TIMESLICE */ |
|
/* BEGINNING OF RTEMS_PREEMPT */ |
|
status = rtems_task_mode( |
RTEMS_PREEMPT, |
RTEMS_PREEMPT_MASK, |
&previous_mode |
); |
directive_failed( status, "rtems_task_mode" ); |
put_mode( |
"TA1 - rtems_task_mode - RTEMS_PREEMPT - previous mode: ", |
previous_mode |
); |
|
status = rtems_task_mode( |
RTEMS_NO_PREEMPT, |
RTEMS_PREEMPT_MASK, |
&previous_mode |
); |
directive_failed( status, "rtems_task_mode" ); |
put_mode( |
"TA1 - rtems_task_mode - RTEMS_NO_PREEMPT - previous mode: ", |
previous_mode |
); |
|
status = rtems_task_mode( |
RTEMS_NO_PREEMPT, |
RTEMS_PREEMPT_MASK, |
&previous_mode |
); |
directive_failed( status, "rtems_task_mode" ); |
put_mode( |
"TA1 - rtems_task_mode - RTEMS_NO_PREEMPT - previous mode: ", |
previous_mode |
); |
|
status = rtems_task_mode( |
RTEMS_PREEMPT, |
RTEMS_PREEMPT_MASK, |
&previous_mode |
); |
directive_failed( status, "rtems_task_mode" ); |
put_mode( |
"TA1 - rtems_task_mode - RTEMS_PREEMPT - previous mode: ", |
previous_mode |
); |
|
/* END OF RTEMS_PREEMPT */ |
|
/* BEGINNING OF RTEMS_INTERRUPT_LEVEL */ |
|
status = rtems_task_mode( |
RTEMS_INTERRUPT_LEVEL(3), |
RTEMS_INTERRUPT_MASK, |
&previous_mode |
); |
directive_failed( status, "rtems_task_mode" ); |
put_mode( |
"TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 3 ) - previous mode: ", |
previous_mode |
); |
|
status = rtems_task_mode( |
RTEMS_INTERRUPT_LEVEL(5), |
RTEMS_INTERRUPT_MASK, |
&previous_mode |
); |
directive_failed( status, "rtems_task_mode" ); |
put_mode( |
"TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 5 ) - previous mode: ", |
previous_mode |
); |
|
/* END OF RTEMS_INTERRUPT_LEVEL */ |
|
/* BEGINNING OF COMBINATIONS */ |
|
status = rtems_task_mode( |
RTEMS_INTERRUPT_LEVEL(3) | RTEMS_NO_ASR | |
RTEMS_TIMESLICE | RTEMS_NO_PREEMPT, |
RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK | |
RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK, |
&previous_mode |
); |
directive_failed( status, "rtems_task_mode" ); |
put_mode( |
"TA1 - rtems_task_mode - set all modes - previous mode: ", |
previous_mode |
); |
|
status = rtems_task_mode( |
RTEMS_INTERRUPT_LEVEL(3) | RTEMS_NO_ASR | |
RTEMS_TIMESLICE | RTEMS_NO_PREEMPT, |
RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK | |
RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK, |
&previous_mode |
); |
directive_failed( status, "rtems_task_mode" ); |
put_mode( |
"TA1 - rtems_task_mode - set all modes - previous mode: ", |
previous_mode |
); |
|
status = rtems_task_mode( |
RTEMS_INTERRUPT_LEVEL(0) | RTEMS_ASR | RTEMS_NO_TIMESLICE | RTEMS_PREEMPT, |
RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK | |
RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK, |
&previous_mode |
); |
directive_failed( status, "rtems_task_mode" ); |
put_mode( |
"TA1 - rtems_task_mode - clear all modes - previous mode: ", |
previous_mode |
); |
|
/* END OF COMBINATIONS */ |
|
/* BEGINNING OF CURRENT MODE */ |
|
status = rtems_task_mode( |
RTEMS_CURRENT_MODE, |
RTEMS_CURRENT_MODE, |
&previous_mode |
); |
directive_failed( status, "rtems_task_mode" ); |
put_mode( |
"TA1 - rtems_task_mode - get current mode - previous mode: ", |
previous_mode |
); |
|
/* END OF CURRENT MODE */ |
|
puts( "*** END OF TEST 8 ***" ); |
exit( 0 ); |
} |
/Makefile.am
0,0 → 1,38
## |
## $Id: Makefile.am,v 1.2 2001-09-27 12:02:31 chris Exp $ |
## |
|
AUTOMAKE_OPTIONS = foreign 1.4 |
|
TEST = sp08 |
|
MANAGERS = io |
|
C_FILES = init.c task1.c |
C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o) |
|
H_FILES = system.h |
noinst_HEADERS = $(H_FILES) |
|
DOCTYPES = scn doc |
DOCS = $(DOCTYPES:%=$(TEST).%) |
|
SRCS = $(C_FILES) $(H_FILES) |
OBJS = $(C_O_FILES) |
|
PRINT_SRCS = $(DOCS) |
|
PGM = ${ARCH}/$(TEST).exe |
|
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg |
include $(RTEMS_ROOT)/make/leaf.cfg |
include $(top_srcdir)/sptests.am |
|
${PGM}: $(OBJS) $(LINK_FILES) |
$(make-exe) |
|
all-local: $(ARCH) $(TMPINSTALL_FILES) |
|
EXTRA_DIST = $(C_FILES) $(DOCS) |
|
include $(top_srcdir)/../../../../automake/local.am |
/system.h
0,0 → 1,50
/* system.h |
* |
* This include file contains information that is included in every |
* function in the test set. |
* |
* COPYRIGHT (c) 1989-1999. |
* On-Line Applications Research Corporation (OAR). |
* |
* The license and distribution terms for this file may be |
* found in the file LICENSE in this distribution or at |
* http://www.OARcorp.com/rtems/license.html. |
* |
* $Id: system.h,v 1.2 2001-09-27 12:02:31 chris Exp $ |
*/ |
|
#include <tmacros.h> |
|
/* functions */ |
|
rtems_task Init( |
rtems_task_argument argument |
); |
|
rtems_task Task_1( |
rtems_task_argument argument |
); |
|
#define put_mode( _comment, _output_mode ) \ |
printf( "%s %08x\n", _comment, _output_mode ); |
|
/* configuration information */ |
|
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|
#define CONFIGURE_TICKS_PER_TIMESLICE 100 |
|
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
|
#define CONFIGURE_EXTRA_TASK_STACKS (1 * RTEMS_MINIMUM_STACK_SIZE) |
#define CONFIGURE_MAXIMUM_TASKS 2 |
|
#include <confdefs.h> |
|
/* global variables */ |
|
TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ |
TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */ |
|
/* end of include file */ |
/sp08.scn
0,0 → 1,22
*** TEST 8 *** |
TA1 - rtems_task_mode - RTEMS_ASR - previous mode: 00000000 |
TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: 00000000 |
TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: 00000400 |
TA1 - rtems_task_mode - RTEMS_ASR - previous mode: 00000400 |
TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE - previous mode: 00000000 |
TA1 - rtems_task_mode - RTEMS_TIMESLICE - previous mode: 00000000 |
TA1 - rtems_task_mode - RTEMS_TIMESLICE - previous mode: 00000200 |
TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE - previous mode: 00000200 |
TA1 - rtems_task_mode - RTEMS_PREEMPT - previous mode: 00000000 |
TA1 - rtems_task_mode - RTEMS_NO_PREEMPT - previous mode: 00000000 |
TA1 - rtems_task_mode - RTEMS_NO_PREEMPT - previous mode: 00000100 |
TA1 - rtems_task_mode - RTEMS_PREEMPT - previous mode: 00000100 |
TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 3 ) - previous mode: 00000000 |
TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 5 ) - previous mode: 00000003 |
TA1 - rtems_task_mode - set all modes - previous mode: 00000005 |
TA1 - rtems_task_mode - set all modes - previous mode: 00000703 |
TA1 - rtems_task_mode - clear all modes - previous mode: 00000703 |
TA1 - rtems_task_mode - get current mode - previous mode: 00000000 |
*** END OF TEST 8 *** |
|
NOTE: The interrupt level lines will be different on CPUs with few levels. |
/sp08.doc
0,0 → 1,25
# |
# $Id: sp08.doc,v 1.7 1999/11/17 17:51:32 joel Exp $ |
# |
# COPYRIGHT (c) 1989-1999. |
# On-Line Applications Research Corporation (OAR). |
# |
# The license and distribution terms for this file may be |
# found in the file LICENSE in this distribution or at |
# http://www.OARcorp.com/rtems/license.html. |
# |
|
|
This file describes the directives and concepts tested by this test set. |
|
test set name: test8 |
|
directives: |
ex_init, ex_start, t_create, t_start, tm_tick, i_return, |
t_mode |
|
concepts: |
|
a. Verifies every mode change possible. |
|
b. Verifies the fatal error handler. |