source: rtems/c/src/tests/samples/unlimited/test1.c @ f4a8ee1

4.104.114.84.95
Last change on this file since f4a8ee1 was f4a8ee1, checked in by Joel Sherrill <joel.sherrill@…>, on Mar 17, 1999 at 4:01:03 PM

Unlimited objects patch from Chris Johns <ccj@…>. Email follows:

First, the unlimited patch. I have compiled the unlmited patch for the
Linux posix BSP only and it seems to work cleanly. I would like a really
major application run on this change before commiting as the changes are
very core and significant. I am currently building all the tests to run.

I have no targets suitable to test on at the moment.

I have tested the patch for inline functions and macros.

Turning macros on has found some core bugs. I have fixed these but have
not run all the tests. Please review the patch for these changes. They
are:

1) The conditional compilation for MP support broke the core messages
code. You cannot embed a conditional macro in another macro. The Send
and Urgent Send calls are macros.

2) User extensions handler initialisation now has two parameters. I have
updated the macros to support the extra parameter.

The patch also contains the gcc-target-default.cfg fix required to build
the kernel. More of a by product than a fix for you.

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/*  Test1
2 *
3 *  This test uses a hack to disable suto-extend then checks to see only the
4 *  requested number of objects are allocated.
5 *
6 *  Input parameters:  NONE
7 *
8 *  Output parameters:  NONE
9 *
10 *  COPYRIGHT (c) 1989-1997.
11 *  On-Line Applications Research Corporation (OAR).
12 *  Copyright assigned to U.S. Government, 1994.
13 *
14 *  The license and distribution terms for this file may in
15 *  the file LICENSE in this distribution or at
16 *  http://www.OARcorp.com/rtems/license.html.
17 *
18 *  $Id$
19 */
20
21#include "system.h"
22#include <rtems/score/object.h>
23#include <stdio.h>
24
25void test1()
26{
27  boolean           auto_extend;
28  rtems_status_code result;
29  rtems_unsigned32  task_count = 0;
30 
31  char              c1 = 'a';
32  char              c2 = 'a';
33  char              c3 = '0';
34  char              c4 = '0';
35   
36  printf( "\n TEST1 : auto-extend disabled.\n" );
37
38  /*
39   * This is a major hack and only recommended for a test. Doing this
40   * saves having another test.
41   */
42
43  auto_extend = _Objects_Information_table[OBJECTS_RTEMS_TASKS]->auto_extend;
44  _Objects_Information_table[OBJECTS_RTEMS_TASKS]->auto_extend = FALSE;
45 
46  while (task_count < MAX_TASKS)
47  {
48    rtems_name name;
49
50    printf(" TEST1 : creating task '%c%c%c%c', ", c1, c2, c3, c4);
51   
52    name = rtems_build_name(c1, c2, c3, c4);
53
54    result = rtems_task_create(name,
55                               10,
56                               4096,
57                               RTEMS_DEFAULT_ATTRIBUTES,
58                               RTEMS_LOCAL,
59                               &task_id[task_count]);
60
61    if (status_code_bad(result))
62      break;
63   
64    printf("number = %3i, id = %08x, starting, ", task_count, task_id[task_count]);
65   
66    result = rtems_task_start(task_id[task_count],
67                              test_task,
68                              (rtems_task_argument) task_count);
69   
70    if (status_code_bad(result))
71      break;
72   
73    /*
74     *  Update the name.
75     */
76   
77    NEXT_TASK_NAME(c1, c2, c3, c4);
78   
79    task_count++;
80  }
81
82  if (task_count >= MAX_TASKS)
83    printf( "\nMAX_TASKS too small for work-space size, please make larger !!\n\n" );
84   
85  if (task_count != (TASK_ALLOCATION_SIZE - 1)) {
86    printf( " FAIL1 : the number of tasks does not equal the expected size -\n"
87            "           task created = %i, required number = %i\n",
88            task_count, TASK_ALLOCATION_SIZE);
89    exit( 1 );
90  }
91
92  destory_all_tasks("TEST1");
93 
94  _Objects_Information_table[OBJECTS_RTEMS_TASKS]->auto_extend = auto_extend;
95 
96  printf( " TEST1 : completed\n" );
97}
98
99
100
101
102
Note: See TracBrowser for help on using the repository browser.