diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-07-09 20:23:38 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-07-09 20:23:38 +0000 |
commit | 8f9b2f6026dc42c84540388bd985c60b65040180 (patch) | |
tree | 411c9358470a98570f7f1b6a8d18cd6533e14ef2 /testsuites/sptests/sp59/init.c | |
parent | 2009-07-09 Joel Sherrill <joel.sherrill@OARcorp.com> (diff) | |
download | rtems-8f9b2f6026dc42c84540388bd985c60b65040180.tar.bz2 |
2009-07-09 Joel Sherrill <joel.sherrill@OARcorp.com>
* Makefile.am, configure.ac: Add sp59 to test path through
_Thread_queue_First_priority where the task's priority was in the
bottom 1/4 of the range.
* sp59/.cvsignore, sp59/Makefile.am, sp59/init.c, sp59/sp59.doc,
sp59/sp59.scn: New files.
Diffstat (limited to 'testsuites/sptests/sp59/init.c')
-rw-r--r-- | testsuites/sptests/sp59/init.c | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/testsuites/sptests/sp59/init.c b/testsuites/sptests/sp59/init.c new file mode 100644 index 0000000000..fd0bce867f --- /dev/null +++ b/testsuites/sptests/sp59/init.c @@ -0,0 +1,120 @@ +/* + * COPYRIGHT (c) 1989-2009. + * 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.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#include <tmacros.h> + +#define ALLOC_SIZE 400 +uint8_t Region_Memory[512]; +rtems_id Region; + +rtems_task Blocking_task( + rtems_task_argument ignored +) +{ + rtems_status_code status; + void *address_1; + + puts( "Blocking_task - wait for memory" ); + rtems_region_get_segment( + Region, + ALLOC_SIZE, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_1 + ); + directive_failed( status, "rtems_region_get_segment" ); + + puts( "Blocking_task - Got memory segment after freed" ); + + puts( "Blocking_task - delete self" ); + status = rtems_task_delete(RTEMS_SELF); +} + +rtems_task Init( + rtems_task_argument ignored +) +{ + rtems_status_code status; + rtems_id task_id; + void *address_1; + rtems_task_priority priority; + + puts( "\n\n*** TEST 59 ***" ); + + priority = RTEMS_MAXIMUM_PRIORITY / 4; + priority = (priority * 3) + (priority / 2); + printf( "Init - blocking task priority will be %d\n", priority ); + + puts( "Init - rtems_task_create - delay task - OK" ); + status = rtems_task_create( + rtems_build_name( 'T', 'A', '1', ' ' ), + priority, + RTEMS_MINIMUM_STACK_SIZE, + RTEMS_DEFAULT_OPTIONS, + RTEMS_DEFAULT_ATTRIBUTES, + &task_id + ); + directive_failed( status, "rtems_task_create" ); + + puts( "Init - rtems_task_start - delay task - OK" ); + status = rtems_task_start( task_id, Blocking_task, 0 ); + directive_failed( status, "rtems_task_start" ); + + puts( "Init - rtems_region_create - OK" ); + status = rtems_region_create( + rtems_build_name('R', 'N', '0', '1'), + Region_Memory, + sizeof( Region_Memory ), + 64, + RTEMS_PRIORITY, + &Region + ); + directive_failed( status, "rtems_region_create of RN1" ); + + puts( "TA1 - rtems_region_get_segment - get segment to consume memory" ); + rtems_region_get_segment( + Region, + ALLOC_SIZE, + RTEMS_PRIORITY, + RTEMS_NO_TIMEOUT, + &address_1 + ); + directive_failed( status, "rtems_region_get_segment" ); + + puts( "Init - rtems_task_wake_after - let other task block - OK" ); + status = rtems_task_wake_after( RTEMS_MILLISECONDS_TO_TICKS(1000) ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "Init1 - rtems_region_get_segment - return segment" ); + status = rtems_region_return_segment( Region, address_1 ); + directive_failed( status, "rtems_region_return_segment" ); + + puts( "Init - rtems_task_wake_after - let other task run again - OK" ); + status = rtems_task_wake_after( RTEMS_MILLISECONDS_TO_TICKS(1000) ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "*** END OF TEST 59 ***" ); + rtems_test_exit(0); +} + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 2 +#define CONFIGURE_MAXIMUM_REGIONS 1 +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT +#include <rtems/confdefs.h> + +/* global variables */ |