source: rtems/testsuites/sptests/sp57/init.c @ d5ae827

4.104.115
Last change on this file since d5ae827 was 0281931, checked in by Joel Sherrill <joel.sherrill@…>, on 07/08/09 at 18:49:15

2009-07-08 Joel Sherrill <joel.sherrill@…>

  • Makefile.am, configure.ac: Add test of restarting a task which is in the middle of a sleep or wake after.
  • sp57/.cvsignore, sp57/Makefile.am, sp57/init.c, sp57/sp57.doc, sp57/sp57.scn: New files.
  • Property mode set to 100644
File size: 1.9 KB
Line 
1/*  Restart a task which is delaying
2 *
3 *  COPYRIGHT (c) 1989-2009.
4 *  On-Line Applications Research Corporation (OAR).
5 *
6 *  The license and distribution terms for this file may be
7 *  found in the file LICENSE in this distribution or at
8 *  http://www.rtems.com/license/LICENSE.
9 *
10 *  $Id$
11 */
12
13#include <tmacros.h>
14
15rtems_task Delay_task(
16  rtems_task_argument ignored
17)
18{
19  rtems_status_code    status;
20
21  puts( "Delay - rtems_task_wake_after - OK" );
22  status = rtems_task_wake_after( RTEMS_MILLISECONDS_TO_TICKS(2000) );
23
24  puts( "ERROR - delay task woke up!!" );
25  rtems_test_exit(0);
26}
27
28rtems_task Init(
29  rtems_task_argument ignored
30)
31{
32  rtems_status_code    status;
33  rtems_id             task_id;
34
35  puts( "\n\n*** TEST 57 ***" );
36
37  puts( "Init - rtems_task_create - delay task - OK" );
38  status = rtems_task_create(
39     rtems_build_name( 'T', 'A', '1', ' ' ),
40     1,
41     RTEMS_MINIMUM_STACK_SIZE,
42     RTEMS_DEFAULT_OPTIONS,
43     RTEMS_DEFAULT_ATTRIBUTES,
44     &task_id
45  );
46  directive_failed( status, "rtems_task_create" );
47
48  puts( "Init - rtems_task_start - delay task - OK" );
49  status = rtems_task_start( task_id, Delay_task, 0 );
50  directive_failed( status, "rtems_task_start" );
51 
52  puts( "Init - rtems_task_wake_after - let delay task block - OK" );
53  status = rtems_task_wake_after( RTEMS_MILLISECONDS_TO_TICKS(1000) );
54  directive_failed( status, "rtems_task_wake_after" );
55
56  puts( "Init - rtems_task_restart - delay task - OK" );
57  status = rtems_task_restart( task_id, 0 );
58  directive_failed( status, "rtems_task_restart" );
59 
60  puts( "*** END OF TEST 57 ***" );
61  rtems_test_exit(0);
62}
63
64/* configuration information */
65
66#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
67#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
68
69#define CONFIGURE_MAXIMUM_TASKS             2
70#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
71
72#define CONFIGURE_INIT
73#include <rtems/confdefs.h>
74
75/* global variables */
Note: See TracBrowser for help on using the repository browser.