source: ada-examples/ada_from_c_task/app.c @ 8325959

ada-examples-4-10-branchada-examples-4-9-branch
Last change on this file since 8325959 was 8325959, checked in by Joel Sherrill <joel.sherrill@…>, on 07/23/08 at 18:08:05

2008-07-23 Joel Sherrill <joel.sherrill@…>

  • Makefile, ada_from_c.adb, app.c, config.h, example.adb, example.ads: New files. New test to demonstrate C calling Ada.
  • Property mode set to 100644
File size: 858 bytes
RevLine 
[8325959]1#include <rtems.h>
2
3#include <stdio.h>
4
5rtems_task c_task(
6  rtems_task_argument ignored
7)
8{
9  rtems_interval ticks_per_second;
10  int            iterations;
11
12  ticks_per_second = rtems_clock_get_ticks_per_second();
13
14  for (iterations=0 ; ; iterations++ ) {
15    (void) rtems_task_wake_after( 1 * ticks_per_second );
16    printf( "C task loop iteration\n" );
17    example_ToBeCalled( iterations );
18  }
19}
20
21void initialize_application(void)
22{
23  rtems_status_code status;
24  rtems_id          id;
25
26  status = rtems_task_create(
27    rtems_build_name( 'C', 'T', 'S', 'K' ),
28    133,
29    RTEMS_MINIMUM_STACK_SIZE * 2,
30    RTEMS_DEFAULT_MODES,
31    RTEMS_DEFAULT_ATTRIBUTES,
32    &id
33  );
34  if ( status )
35    printf( "c_task create failed %d\n", status );
36
37  status = rtems_task_start( id, c_task, 0 );
38  if ( status )
39    printf( "c_task start failed %d\n", status );
40
41}
Note: See TracBrowser for help on using the repository browser.