summaryrefslogtreecommitdiffstats
path: root/c_user/example_application.rst
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2016-02-18 15:29:28 +1100
committerAmar Takhar <verm@darkbeer.org>2016-05-02 20:51:26 -0400
commit0d86b7111e378286bd61613c363c06cec39d0538 (patch)
treedb53c1ba4c2ac32c0a1420bfc9074f4c2b526445 /c_user/example_application.rst
parentAdd semaphore attributes figure. (diff)
downloadrtems-docs-0d86b7111e378286bd61613c363c06cec39d0538.tar.bz2
Clean up.
Diffstat (limited to '')
-rw-r--r--c_user/example_application.rst90
1 files changed, 49 insertions, 41 deletions
diff --git a/c_user/example_application.rst b/c_user/example_application.rst
index dcec917..0ecce36 100644
--- a/c_user/example_application.rst
+++ b/c_user/example_application.rst
@@ -1,66 +1,74 @@
+.. COMMENT: COPYRIGHT (c) 1989-2011.
+.. COMMENT: On-Line Applications Research Corporation (OAR).
+.. COMMENT: All rights reserved.
+
Example Application
###################
-.. code:: c
+.. code-block:: c
+ :linenos:
/*
* This file contains an example of a simple RTEMS
* application. It instantiates the RTEMS Configuration
* Information using confdef.h and contains two tasks:
* a user initialization task and a simple task.
- \*/
+ */
+
#include <rtems.h>
+
rtems_task user_application(rtems_task_argument argument);
+
rtems_task init_task(
- rtems_task_argument ignored
+ rtems_task_argument ignored
)
{
- rtems_id tid;
- rtems_status_code status;
- rtems_name name;
- name = rtems_build_name( 'A', 'P', 'P', '1' )
- status = rtems_task_create(
- name, 1, RTEMS_MINIMUM_STACK_SIZE,
- RTEMS_NO_PREEMPT, RTEMS_FLOATING_POINT, &tid
- );
- if ( status != RTEMS_STATUS_SUCCESSFUL ) {
- printf( "rtems_task_create failed with status of %d.\\n", status );
- exit( 1 );
- }
- status = rtems_task_start( tid, user_application, 0 );
- if ( status != RTEMS_STATUS_SUCCESSFUL ) {
- printf( "rtems_task_start failed with status of %d.\\n", status );
- exit( 1 );
- }
- status = rtems_task_delete( SELF ); /* should not return \*/
- printf( "rtems_task_delete returned with status of %d.\\n", status );
- exit( 1 );
+ rtems_id tid;
+ rtems_status_code status;
+ rtems_name name;
+
+ name = rtems_build_name( 'A', 'P', 'P', '1' )
+
+ status = rtems_task_create(
+ name, 1, RTEMS_MINIMUM_STACK_SIZE,
+ RTEMS_NO_PREEMPT, RTEMS_FLOATING_POINT, &tid
+ );
+ if ( status != RTEMS_STATUS_SUCCESSFUL ) {
+ printf( "rtems_task_create failed with status of %d.\n", status );
+ exit( 1 );
+ }
+
+ status = rtems_task_start( tid, user_application, 0 );
+ if ( status != RTEMS_STATUS_SUCCESSFUL ) {
+ printf( "rtems_task_start failed with status of %d.\n", status );
+ exit( 1 );
+ }
+
+ status = rtems_task_delete( SELF ); /* should not return */
+
+ printf( "rtems_task_delete returned with status of %d.\n", status );
+ exit( 1 );
}
+
rtems_task user_application(rtems_task_argument argument)
{
- /* application specific initialization goes here \*/
- while ( 1 ) { /* infinite loop \*/
- /* APPLICATION CODE GOES HERE
- *
- * This code will typically include at least one
- * directive which causes the calling task to
- * give up the processor.
- \*/
+ /* application specific initialization goes here */
+ while ( 1 ) { /* infinite loop */
+ /* APPLICATION CODE GOES HERE
+ *
+ * This code will typically include at least one
+ * directive which causes the calling task to
+ * give up the processor.
+ */
+ }
}
- }
- /* The Console Driver supplies Standard I/O. \*/
+
+ /* The Console Driver supplies Standard I/O. */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
- /* The Clock Driver supplies the clock tick. \*/
+ /* The Clock Driver supplies the clock tick. */
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 2
#define CONFIGURE_INIT_TASK_NAME rtems_build_name( 'E', 'X', 'A', 'M' )
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>
-
-.. COMMENT: COPYRIGHT (c) 1989-2011.
-
-.. COMMENT: On-Line Applications Research Corporation (OAR).
-
-.. COMMENT: All rights reserved.
-