source: rtems/doc/user/example.texi @ abdeac2a

4.115
Last change on this file since abdeac2a was abdeac2a, checked in by Joel Sherrill <joel.sherrill@…>, on 12/06/11 at 15:12:48

2011-12-06 Joel Sherrill <joel.sherrill@…>

PR 1793/doc

  • .cvsignore, Makefile.am, README, configure.ac, index.html.in, main.am, project.am, ada_user/.cvsignore, ada_user/ada_user.texi, ada_user/example.texi, bsp_howto/.cvsignore, bsp_howto/bsp_howto.texi, cpu_supplement/.cvsignore, cpu_supplement/cpu_supplement.texi, cpu_supplement/preface.texi, develenv/.cvsignore, develenv/develenv.texi, develenv/intro.texi, filesystem/.cvsignore, filesystem/filesystem.texi, filesystem/preface.texi, networking/.cvsignore, networking/networking.texi, networking/preface.texi, porting/.cvsignore, porting/porting.texi, porting/preface.texi, posix1003.1/.cvsignore, posix1003.1/posix1003_1.texi, posix_users/.cvsignore, posix_users/posix_users.texi, posix_users/preface.texi, shell/.cvsignore, shell/preface.texi, shell/shell.texi, started/.cvsignore, started/started.texi, user/.cvsignore, user/c_user.texi, user/dirstat.texi, user/example.texi, user/glossary.texi, user/preface.texi: Convert from texi2www to texi2html.
  • texi2html_init.in: New file.
  • rtems_footer.html.in, rtems_header.html.in: Removed.
  • Property mode set to 100644
File size: 2.1 KB
Line 
1@c
2@c  COPYRIGHT (c) 1989-2011.
3@c  On-Line Applications Research Corporation (OAR).
4@c  All rights reserved.
5@c
6@c  $Id$
7@c
8
9@node Example Application, Glossary, Directive Status Codes, Top
10@chapter Example Application
11
12@example
13/*
14 *  This file contains an example of a simple RTEMS
15 *  application.  It instantiates the RTEMS Configuration
16 *  Information using confdef.h and contains two tasks:
17 *  a *  user initialization task and a simple task.
18 *
19 *  This example assumes that a board support package exists.
20 */
21
22#include <rtems.h>
23
24rtems_task user_application(rtems_task_argument argument);
25
26rtems_task init_task(
27  rtems_task_argument ignored
28)
29@{
30  rtems_id          tid;
31  rtems_status_code status;
32  rtems_name        name;
33
34  name = rtems_build_name( 'A', 'P', 'P', '1' )
35
36  status = rtems_task_create(
37     name, 1, RTEMS_MINIMUM_STACK_SIZE,
38     RTEMS_NO_PREEMPT, RTEMS_FLOATING_POINT, &tid
39  );
40  if ( status != RTEMS_STATUS_SUCCESSFUL ) @{
41    printf( "rtems_task_create failed with status of %d.\n", status );
42    exit( 1 );
43  @}
44
45  status = rtems_task_start( tid, user_application, 0 );
46  if ( status != RTEMS_STATUS_SUCCESSFUL ) @{
47    printf( "rtems_task_start failed with status of %d.\n", status );
48    exit( 1 );
49  @}
50 
51  status = rtems_task_delete( SELF );    /* should not return */
52  printf( "rtems_task_delete returned with status of %d.\n", status );
53  exit( 1 );
54@}
55
56
57rtems_task user_application(rtems_task_argument argument)
58@{
59  /* application specific initialization goes here */
60
61  while ( 1 )  @{              /* infinite loop */
62
63    /*  APPLICATION CODE GOES HERE
64     *
65     *  This code will typically include at least one
66     *  directive which causes the calling task to
67     *  give up the processor.
68     */
69  @}
70@}
71
72#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER  /* for stdio */
73#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER    /* for time services */
74
75#define CONFIGURE_MAXIMUM_TASKS 2
76
77#define CONFIGURE_INIT_TASK_NAME rtems_build_name( 'E', 'X', 'A', 'M' )
78#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
79
80#define CONFIGURE_INIT
81
82#include <confdefs.h>
83@end example
84
85
86
Note: See TracBrowser for help on using the repository browser.