Files
rtems/doc/user/example.texi
Joel Sherrill abdeac2a14 2011-12-06 Joel Sherrill <joel.sherrill@oarcorp.com>
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.
2011-12-06 15:12:48 +00:00

87 lines
2.1 KiB
Plaintext

@c
@c COPYRIGHT (c) 1989-2011.
@c On-Line Applications Research Corporation (OAR).
@c All rights reserved.
@c
@c $Id$
@c
@node Example Application, Glossary, Directive Status Codes, Top
@chapter Example Application
@example
/*
* 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.
*
* This example assumes that a board support package exists.
*/
#include <rtems.h>
rtems_task user_application(rtems_task_argument argument);
rtems_task init_task(
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_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.
*/
@}
@}
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER /* for stdio */
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER /* for time services */
#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 <confdefs.h>
@end example