source: rtems/cpukit/score/include/rtems/system.h @ f0ad529

4.104.114.84.95
Last change on this file since f0ad529 was f0ad529, checked in by Joel Sherrill <joel.sherrill@…>, on 03/07/06 at 20:47:53

2006-03-07 Joel Sherrill <joel@…>

PR 866/rtems

  • score/include/rtems/system.h, score/include/rtems/score/isr.h, score/inline/rtems/score/thread.inl, score/macros/rtems/score/thread.inl: Added memory barriers to enter and exit of dispatching and interrupt critical sections so GCC will not optimize and reorder code out of a critical section.
  • Property mode set to 100644
File size: 7.4 KB
Line 
1/**
2 *  @file  rtems/system.h
3 *
4 *  This include file contains information that is included in every
5 *  function in the executive.  This must be the first include file
6 *  included in all internal RTEMS files.
7 */
8
9/*
10 *  COPYRIGHT (c) 1989-2006.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.com/license/LICENSE.
16 *
17 *  $Id$
18 */
19
20#ifndef _RTEMS_SYSTEM_H
21#define _RTEMS_SYSTEM_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/** This macro defines the major version portion of an RTEMS release.
28 *
29 *  @note Use this macros to test for features in specific releases.
30 */
31#define __RTEMS_MAJOR__ 4
32
33/** This macro defines the minor version portion of an RTEMS release.
34 *
35 *  @note Use this macros to test for features in specific releases.
36 */
37#define __RTEMS_MINOR__ 6
38
39/** This macro defines the revision version portion of an RTEMS release.
40 *
41 *  @note Use this macros to test for features in specific releases.
42 */
43#define __RTEMS_REVISION__ 99
44
45/*
46 *  The cpu options include file defines all cpu dependent
47 *  parameters for this build of RTEMS.  It must be included
48 *  first so the basic macro definitions are in place.
49 */
50#include <rtems/score/cpuopts.h>
51
52/**
53 *  The following ensures that all data is declared in the space
54 *  of the initialization routine for either the Initialization Manager
55 *  or the initialization file for the appropriate API.  It is
56 *  referenced as "external" in every other file.
57 */
58#ifdef SCORE_INIT
59#undef  SCORE_EXTERN
60#define SCORE_EXTERN
61#else
62#undef  SCORE_EXTERN
63#define SCORE_EXTERN  extern
64#endif
65
66/**
67 *  The following ensures that all data is declared in the space
68 *  of the initialization routine for either the Initialization Manager
69 *  or the initialization file for the appropriate API.  It is
70 *  referenced as "external" in every other file.
71 */
72#ifdef SAPI_INIT
73#undef  SAPI_EXTERN
74#define SAPI_EXTERN
75#else
76#undef  SAPI_EXTERN
77#define SAPI_EXTERN  extern
78#endif
79
80/**
81 *  The following ensures that all data is declared in the space
82 *  of the initialization routine for either the Initialization Manager
83 *  or the initialization file for the appropriate API.  It is
84 *  referenced as "external" in every other file.
85 */
86#ifdef RTEMS_API_INIT
87#undef  RTEMS_EXTERN
88#define RTEMS_EXTERN
89#else
90#undef  RTEMS_EXTERN
91#define RTEMS_EXTERN  extern
92#endif
93
94/**
95 *  The following ensures that all data is declared in the space
96 *  of the initialization routine for either the Initialization Manager
97 *  or the initialization file for the appropriate API.  It is
98 *  referenced as "external" in every other file.
99 */
100#ifdef POSIX_API_INIT
101#undef  POSIX_EXTERN
102#define POSIX_EXTERN
103#else
104#undef  POSIX_EXTERN
105#define POSIX_EXTERN  extern
106#endif
107
108/**
109 *  The following ensures that all data is declared in the space
110 *  of the initialization routine for either the Initialization Manager
111 *  or the initialization file for the appropriate API.  It is
112 *  referenced as "external" in every other file.
113 */
114#ifdef ITRON_API_INIT
115#undef  ITRON_EXTERN
116#define ITRON_EXTERN
117#else
118#undef  ITRON_EXTERN
119#define ITRON_EXTERN  extern
120#endif
121
122/**
123 *  The following (in conjunction with compiler arguments) are used
124 *  to choose between the use of static inline functions and macro
125 *  functions.   The static inline implementation allows better
126 *  type checking with no cost in code size or execution speed.
127 */
128#ifdef RTEMS_INLINES
129# ifdef __GNUC__
130#  define RTEMS_INLINE_ROUTINE static __inline__
131# else
132#  define RTEMS_INLINE_ROUTINE static inline
133# endif
134#else
135# define RTEMS_INLINE_ROUTINE
136#endif
137
138/**
139 *  The following macro is a compiler specific way to ensure that memory
140 *  writes are not reordered around certian points.  This specifically can
141 *  impact interrupt disable and thread dispatching critical sections.
142 */
143#ifdef __GNUC__
144  #define RTEMS_COMPILER_MEMORY_BARRIER() asm volatile("" ::: "memory")
145#else
146  #define RTEMS_COMPILER_MEMORY_BARRIER()
147#endif
148
149#ifdef RTEMS_POSIX_API
150/** The following is used by the POSIX implementation to catch bad paths.  */
151int POSIX_MP_NOT_IMPLEMENTED( void );
152
153/** The following is used by the POSIX implementation to catch bad paths.  */
154int POSIX_NOT_IMPLEMENTED( void );
155
156/** The following is used by the POSIX implementation to catch bad paths.  */
157int POSIX_BOTTOM_REACHED( void );
158#endif
159
160/*
161 *  Include a base set of files.
162 */
163
164/**
165 * XXX: Eventually proc_ptr needs to disappear!!!
166 */
167typedef void * proc_ptr;
168
169#include <stddef.h>
170
171#if !defined( TRUE ) || (TRUE != 1)
172/**  Boolean constant TRUE */
173#undef TRUE
174#define TRUE     (1)
175#endif
176
177#if !defined( FALSE ) || (FALSE != 0)
178/**  Boolean constant TRUE */
179#undef FALSE
180#define FALSE     (0)
181#endif
182
183#include <rtems/stdint.h>
184#include <rtems/score/cpu.h>        /* processor specific information */
185
186/**
187 *  This macro is used to obtain the offset of a field in a structure.
188 */
189#define RTEMS_offsetof(type, field) \
190       ((uint32_t  ) &(((type *) 0)->field))
191
192/**
193 *  The following is the extern for the RTEMS version string.
194 *
195 *  @note The contents of this string are CPU specific.
196 */
197extern const char _RTEMS_version[];
198
199/**
200 *  The following is the extern for the RTEMS copyright string.
201 */
202extern const char _Copyright_Notice[];
203
204/**
205 *  The following defines the CPU dependent information table.
206 */
207SCORE_EXTERN rtems_cpu_table _CPU_Table;
208
209/*
210 *  Macros to access CPU Table fields required by ALL ports.
211 */
212
213/** This macro assists in accessing the CPU Specific Configuration Table. */
214#define rtems_cpu_configuration_get_table() (&_CPU_Table)
215
216
217/** This macro assists in accessing the pretasking BSP hook. */
218#define rtems_cpu_configuration_get_pretasking_hook() \
219   (_CPU_Table.pretasking_hook)
220
221/** This macro assists in accessing the predriver BSP hook. */
222#define rtems_cpu_configuration_get_predriver_hook() \
223   (_CPU_Table.predriver_hook)
224
225/** This macro assists in accessing the postdriver BSP hook. */
226#define rtems_cpu_configuration_get_postdriver_hook() \
227   (_CPU_Table.postdriver_hook)
228
229/** This macro assists in accessing the BSP specific IDLE task entry point. */
230#define rtems_cpu_configuration_get_idle_task() \
231   (_CPU_Table.idle_task)
232
233/**
234  * This macro assists in accessing the field which indicates whether
235  * RTEMS is responsible for zeroing the Executive Workspace.
236  */
237#define rtems_cpu_configuration_get_do_zero_of_workspace() \
238   (_CPU_Table.do_zero_of_workspace)
239
240/** This macro assists in accessing the IDLE task stack point size. */
241#define rtems_cpu_configuration_get_idle_task_stack_size() \
242   (_CPU_Table.idle_task_stack_size)
243
244/** This macro assists in accessing the interrupt stack size. */
245#define rtems_cpu_configuration_get_interrupt_stack_size() \
246   (_CPU_Table.interrupt_stack_size)
247
248/** This macro assists in accessing the size of the MPCI receiver server. */
249#define rtems_cpu_configuration_get_extra_mpci_receive_server_stack() \
250   (_CPU_Table.extra_mpci_receive_server_stack)
251
252/** This macro assists in accessing the BSP stack allocation hook. */
253#define rtems_cpu_configuration_get_stack_allocate_hook() \
254   (_CPU_Table.stack_allocate_hook)
255
256/** This macro assists in accessing the BSP stack allocation free hook. */
257#define rtems_cpu_configuration_get_stack_free_hook() \
258   (_CPU_Table.stack_free_hook)
259
260/** This macro defines the maximum length of a Classic API name. */
261#define RTEMS_MAXIMUM_NAME_LENGTH sizeof(rtems_name)
262
263#ifdef __cplusplus
264}
265#endif
266
267#endif
268/* end of include file */
Note: See TracBrowser for help on using the repository browser.