source: rtems/c/src/ada-tests/support/init.c @ d5154d0f

5
Last change on this file since d5154d0f was d5154d0f, checked in by Aun-Ali Zaidi <admin@…>, on Dec 23, 2015 at 8:44:02 PM

api: Remove deprecated Notepads

Notepads where a feature of RTEMS' tasks that simply functioned in
the same way as POSIX keys or threaded local storage (TLS). They were
introduced well before per task variables, which are also deprecated,
and were barely used in favor of their POSIX alternatives.

In addition to their scarce usage, Notepads took up unnecessary memory.
For each task:

  • 16 32-bit integers were allocated.
  • A total of 64 bytes per task per thread.

This is especially critical in low memory and safety-critical applications.

They are also defined as uint32_t, and therefore are not guaranteed to
hold a pointer.

Lastly, they are not portable solutions for SMP and uniprocessor systems,
like POSIX keys and TLS.

updates #2493.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2015
3 *  On-Line Applications Research Corporation (OAR).
4 */
5
6#include <bsp.h>
7#include <stdlib.h>
8
9#include <rtems/score/threadimpl.h>
10
11/*
12 * This is the entry point automatically generated by GNAT.
13 */
14extern int gnat_main ( int argc, char **argv, char **envp );
15
16static void *POSIX_Init(
17  void *argument
18)
19{
20  (void) gnat_main ( 0, 0, 0 );
21
22  exit( 0 );
23}
24
25/*
26 *  Prototypes for various test support routines. Since these are bound to
27 *  from Ada, there are no external .h files even though they must be public.
28 */
29uint32_t milliseconds_per_tick(void);
30uint32_t ticks_per_second(void);
31uint32_t work_space_size(void);
32uint32_t is_configured_multiprocessing(void);
33uint32_t get_node(void);
34rtems_id tcb_to_id(Thread_Control *tcb);
35
36/*
37 *  By putting this in brackets rather than quotes, we get the search
38 *  path and can get this file from ".." in the mptests.
39 */
40#define CONFIGURE_INIT
41#define CONFIGURE_GNAT_RTEMS
42#define CONFIGURE_MEMORY_OVERHEAD  (256)
43
44#include <config.h>
45
46rtems_id tcb_to_id(
47  Thread_Control *tcb
48)
49{
50  return tcb->Object.id; /* Only for sp04 */
51}
52
53uint32_t milliseconds_per_tick(void)
54{
55  return CONFIGURE_MICROSECONDS_PER_TICK / 1000;
56}
57
58uint32_t ticks_per_second(void)
59{
60  return rtems_clock_get_ticks_per_second();
61}
62
63uint32_t work_space_size(void)
64{
65  return CONFIGURE_EXECUTIVE_RAM_SIZE;
66}
67
68uint32_t is_configured_multiprocessing(void)
69{
70#if defined(RTEMS_MULTIPROCESSING)
71  return 1;
72#else
73  return 0;
74#endif
75}
76
77uint32_t get_node(void)
78{
79  /* XXX HACK -- use public API */
80  return _Objects_Local_node;
81}
82
Note: See TracBrowser for help on using the repository browser.