forked from Imagelibrary/rtems
Made examples include checking of return status.
This commit is contained in:
@@ -29,14 +29,30 @@ rtems_task init_task(
|
|||||||
rtems_task_argument ignored
|
rtems_task_argument ignored
|
||||||
)
|
)
|
||||||
@{
|
@{
|
||||||
rtems_id tid;
|
rtems_id tid;
|
||||||
|
rtems_status_code status;
|
||||||
|
rtems_name name;
|
||||||
|
|
||||||
/* example assumes SUCCESSFUL return value */
|
name = rtems_build_name( 'A', 'P', 'P', '1' )
|
||||||
|
|
||||||
(void) rtems_task_create( USER_APP_NAME, 1, RTEMS_MINIMUM_STACK_SIZE,
|
status = rtems_task_create(
|
||||||
RTEMS_NO_PREEMPT, RTEMS_FLOATING_POINT, &tid );
|
name, 1, RTEMS_MINIMUM_STACK_SIZE,
|
||||||
(void) rtems_task_start( tid, user_application, 0 );
|
RTEMS_NO_PREEMPT, RTEMS_FLOATING_POINT, &tid
|
||||||
(void) rtems_task_delete( SELF );
|
);
|
||||||
|
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 );
|
||||||
@}
|
@}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -723,10 +723,15 @@ rtems_task Periodic_task()
|
|||||||
|
|
||||||
name = rtems_build_name( 'P', 'E', 'R', 'D' );
|
name = rtems_build_name( 'P', 'E', 'R', 'D' );
|
||||||
|
|
||||||
(void) rate_monotonic_create( name, &period );
|
status = rate_monotonic_create( name, &period );
|
||||||
|
if ( status != RTEMS_STATUS_SUCCESSFUL ) {
|
||||||
|
printf( "rtems_monotonic_create failed with status of %d.\n", rc );
|
||||||
|
exit( 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
while ( 1 ) @{
|
while ( 1 ) @{
|
||||||
if ( rate_monotonic_period( period, 100 ) == TIMEOUT )
|
if ( rate_monotonic_period( period, 100 ) == RTEMS_TIMEOUT )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Perform some periodic actions */
|
/* Perform some periodic actions */
|
||||||
@@ -734,8 +739,15 @@ rtems_task Periodic_task()
|
|||||||
|
|
||||||
/* missed period so delete period and SELF */
|
/* missed period so delete period and SELF */
|
||||||
|
|
||||||
(void) rate_monotonic_delete( period );
|
status = rate_monotonic_delete( period );
|
||||||
(void) task_delete( SELF );
|
if ( status != RTEMS_STATUS_SUCCESSFUL ) {
|
||||||
|
printf( "rate_monotonic_delete 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 );
|
||||||
@}
|
@}
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user