source: rtems/testsuites/libtests/stackchk/task1.c

Last change on this file was c499856, checked in by Chris Johns <chrisj@…>, on Mar 20, 2014 at 9:10:47 PM

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*  task1.c
2 *
3 *  This set of three tasks do some simple task switching for about
4 *  15 seconds and then call a routine to "blow the stack".
5 *
6 *  COPYRIGHT (c) 1989-2009.
7 *  On-Line Applications Research Corporation (OAR).
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.rtems.org/license/LICENSE.
12 */
13
14#ifdef HAVE_CONFIG_H
15#include "config.h"
16#endif
17
18#include "system.h"
19
20rtems_task Task_1_through_3(
21  rtems_task_argument argument
22)
23{
24  rtems_id          tid;
25  rtems_time_of_day time;
26  rtems_status_code status;
27
28  status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
29  directive_failed( status, "rtems_task_ident" );
30
31  while( FOREVER ) {
32    status = rtems_clock_get_tod( &time );
33    directive_failed( status, "rtems_clock_get_tod" );
34
35    if ( time.second >= 15 && tid == Task_id[ 1 ] ) {
36       blow_stack();
37    }
38
39    put_name( Task_name[ task_number( tid ) ], FALSE );
40    print_time( " - rtems_clock_get_tod - ", &time, "\n" );
41
42    status = rtems_task_wake_after(
43      task_number( tid ) * 5 * rtems_clock_get_ticks_per_second() );
44    directive_failed( status, "rtems_task_wake_after" );
45  }
46}
Note: See TracBrowser for help on using the repository browser.