source: rtems/testsuites/sptests/spchain/init.c @ b1274bd9

4.104.115
Last change on this file since b1274bd9 was b1274bd9, checked in by Ralf Corsepius <ralf.corsepius@…>, on 11/30/09 at 03:33:25

Whitespace removal.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2009.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12#include <tmacros.h>
13#include <rtems/chain.h>
14
15typedef struct {
16  rtems_chain_node Node;
17  int              id;
18} test_node;
19
20rtems_task Init(
21  rtems_task_argument ignored
22)
23{
24  rtems_chain_control  chain1;
25  rtems_chain_node    *p;
26  test_node            node1, node2;
27  int                  id;
28
29  puts( "\n\n*** TEST OF RTEMS CHAIN API ***" );
30
31  puts( "Init - Initialize chain empty" );
32  rtems_chain_initialize_empty( &chain1 );
33
34  /* verify that the chain append and insert work */
35  puts( "INIT - Verify rtems_chain_insert" );
36  node1.id = 1;
37  node2.id = 2;
38  rtems_chain_append( &chain1, &node1.Node );
39  rtems_chain_insert( &node1.Node, &node2.Node );
40
41  for ( p = chain1.first, id = 1 ;
42        !rtems_chain_is_tail(&chain1, p) ;
43        p = p->next , id++ ) {
44     test_node *t = (test_node *)p;
45     if ( id > 2 ) {
46       puts( "INIT - TOO MANY NODES ON CHAIN" );
47       rtems_test_exit(0);
48     }
49     if ( t->id != id ) {
50       puts( "INIT - ERROR ON CHAIN ID MISMATCH" );
51       rtems_test_exit(0);
52     }
53  }
54
55  puts( "*** END OF RTEMS CHAIN API TEST ***" );
56  rtems_test_exit(0);
57}
58
59/* configuration information */
60
61#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
62#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
63
64#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
65#define CONFIGURE_MAXIMUM_TASKS 1
66
67#define CONFIGURE_INIT
68#include <rtems/confdefs.h>
69
70/* global variables */
Note: See TracBrowser for help on using the repository browser.