source: rtems/doc/user/example.texi @ 1e524995

4.104.114.84.95
Last change on this file since 1e524995 was 1e524995, checked in by Joel Sherrill <joel.sherrill@…>, on 02/06/98 at 14:14:30

Updated copyrights

  • Property mode set to 100644
File size: 2.9 KB
Line 
1@c
2@c  COPYRIGHT (c) 1988-1998.
3@c  On-Line Applications Research Corporation (OAR).
4@c  All rights reserved.
5@c
6@c  $Id$
7@c
8
9@ifinfo
10@node Example Application, Glossary, Directive Status Codes, Top
11@end ifinfo
12@chapter Example Application
13
14@example
15/*  example.c
16 *
17 *  This file contains an example of a simple RTEMS
18 *  application.  It contains a Configuration Table, a
19 *  user initialization task, and a simple task.
20 *
21 *  This example assumes that a board support package exists
22 *  and invokes the initialize_executive() directive.
23 */
24
25#include "rtems.h"
26
27rtems_task init_task();
28
29#define INIT_NAME      build_name( 'A', 'B', 'C', ' ' ' )
30
31rtems_initialization_tasks_table init_task = @{
32  @{ INIT_NAME,          /* init task name  "ABC" */
33    1024,               /* init task stack size */
34    1,                  /* init task priority */
35    DEFAULT_ATTRIBUTES, /* init task attributes */
36    init_task,          /* init task entry point */
37    TIMESLICE,          /* init task initial mode */
38    0                   /* init task argument */
39  @}
40@};
41
42rtems_configuration_table User_Configuration_Table = @{
43  NULL,                 /* filled in by the BSP */
44  65536,                /* executive RAM size */
45  2,                    /* maximum tasks */
46  0,                    /* maximum timers */
47  0,                    /* maximum semaphores */
48  0,                    /* maximum message queues */
49  0,                    /* maximum messages */
50  0,                    /* maximum partitions */
51  0,                    /* maximum regions */
52  0,                    /* maximum ports */
53  0,                    /* maximum periods */
54  0,                    /* maximum extensions */
55  RTEMS_MILLISECONDS_TO_MICROSECONDS(10), /* number of ms in a tick */
56  1,                    /* num of ticks in a timeslice  */
57  1,                    /* number of user init tasks    */
58  init_task_tbl,        /* user init task(s) table      */
59  0,                    /* number of device drivers     */
60  NULL,                 /* ptr to driver address table  */
61  NULL,                 /* ptr to extension table */
62  NULL                  /* ptr to MP config table */
63@};
64
65task user_application(
66  rtems_task_argument ignored
67);
68
69#define USER_APP_NAME  1  /* any 32-bit name; unique helps */
70
71rtems_task init_task(
72  rtems_task_argument ignored
73)
74@{
75  rtems_id tid;
76
77  /* example assumes SUCCESSFUL return value */
78
79  (void) rtems_task_create( USER_APP_NAME, 1, 1024,
80                        RTEMS_NO_PREEMPT, RTEMS_FLOATING_POINT, &tid );
81  (void) rtems_task_start( tid, user_application, 0 );
82  (void) rtems_task_delete( SELF );
83@}
84
85
86
87rtems_task user_application()
88
89@{
90  /* application specific initialization goes here */
91
92  while ( 1 )  @{              /* infinite loop */
93
94    /*  APPLICATION CODE GOES HERE
95     *
96     *  This code will typically include at least one
97     *  directive which causes the calling task to
98     *  give up the processor.
99     */
100  @}
101@}
102@end example
103
104
105
Note: See TracBrowser for help on using the repository browser.