|
0
|
1 #ifndef CYGONCE_KERNEL_KTYPES_H |
|
|
2 #define CYGONCE_KERNEL_KTYPES_H |
|
|
3 |
|
|
4 //========================================================================== |
|
|
5 // |
|
|
6 // ktypes.h |
|
|
7 // |
|
|
8 // Standard types used in the kernel and its interfaces |
|
|
9 // |
|
|
10 //========================================================================== |
|
|
11 //####COPYRIGHTBEGIN#### |
|
|
12 // |
|
|
13 // ------------------------------------------- |
|
|
14 // The contents of this file are subject to the Cygnus eCos Public License |
|
|
15 // Version 1.0 (the "License"); you may not use this file except in |
|
|
16 // compliance with the License. You may obtain a copy of the License at |
|
|
17 // http://sourceware.cygnus.com/ecos |
|
|
18 // |
|
|
19 // Software distributed under the License is distributed on an "AS IS" |
|
|
20 // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
|
|
21 // License for the specific language governing rights and limitations under |
|
|
22 // the License. |
|
|
23 // |
|
|
24 // The Original Code is eCos - Embedded Cygnus Operating System, released |
|
|
25 // September 30, 1998. |
|
|
26 // |
|
|
27 // The Initial Developer of the Original Code is Cygnus. Portions created |
|
|
28 // by Cygnus are Copyright (C) 1998 Cygnus Solutions. All Rights Reserved. |
|
|
29 // ------------------------------------------- |
|
|
30 // |
|
|
31 //####COPYRIGHTEND#### |
|
|
32 //========================================================================== |
|
|
33 //#####DESCRIPTIONBEGIN#### |
|
|
34 // |
|
|
35 // Author(s): nickg from an original by hmt |
|
|
36 // Contributors: nickg |
|
|
37 // Date: 1997-09-08 |
|
|
38 // Purpose: Define kernel specific types |
|
|
39 // Description: Kernel specific types |
|
|
40 // Usage: #include <cyg/kernel/ktypes.h> |
|
|
41 // ... |
|
|
42 // cyg_priority priority; // etc |
|
|
43 // |
|
|
44 //####DESCRIPTIONEND#### |
|
|
45 // |
|
|
46 //========================================================================== |
|
|
47 |
|
|
48 // ------------------------------------------------------------------------- |
|
|
49 // Check that a configuration file is present. |
|
|
50 |
|
|
51 #ifndef CYGONCE_PKGCONF_KERNEL_H |
|
|
52 #error "No Configuration file included" |
|
|
53 #endif |
|
|
54 |
|
|
55 // ------------------------------------------------------------------------- |
|
|
56 |
|
|
57 #include <cyg/infra/cyg_type.h> |
|
|
58 #include <stddef.h> // for size_t |
|
|
59 |
|
|
60 // ------------------------------------------------------------------------- |
|
|
61 // Integer types: |
|
|
62 |
|
|
63 typedef cyg_int32 cyg_code; // General return/error/status code |
|
|
64 |
|
|
65 typedef cyg_count32 cyg_priority; // priority value |
|
|
66 |
|
|
67 typedef cyg_uint32 cyg_vector; // vector number/descriptor |
|
|
68 |
|
|
69 typedef cyg_uint64 cyg_tick_count; // clock tick count value |
|
|
70 |
|
|
71 // ------------------------------------------------------------------------- |
|
|
72 // Predefinitions of various kernel classes |
|
|
73 |
|
|
74 #ifdef __cplusplus |
|
|
75 |
|
|
76 class Cyg_Scheduler; |
|
|
77 class Cyg_Scheduler_Implementation; |
|
|
78 |
|
|
79 class Cyg_HardwareThread; |
|
|
80 class Cyg_SchedThread; |
|
|
81 class Cyg_SchedThread_Implementation; |
|
|
82 class Cyg_Thread; |
|
|
83 |
|
|
84 class Cyg_ThreadQueue; |
|
|
85 class Cyg_ThreadQueue_Implementation; |
|
|
86 |
|
|
87 #endif |
|
|
88 |
|
|
89 |
|
|
90 // ------------------------------------------------------------------------- |
|
|
91 // Class and structure conversion macros. |
|
|
92 // CYG_CLASSFROMFIELD translates a pointer to a field of a struct or |
|
|
93 // class into a pointer to the class. |
|
|
94 // CYG_OFFSETOFBASE yields the offset of a base class of a derived |
|
|
95 // class. |
|
|
96 // CYG_CLASSFROMBASE translates a pointer to a base class into a pointer |
|
|
97 // to a selected derived class. The base class object _must_ be part of |
|
|
98 // the specified derived class. This is essentially a poor mans version |
|
|
99 // of the RTTI dynamic_cast operator. |
|
|
100 // Caveat: These macros do not work for virtual base classes. |
|
|
101 |
|
|
102 #define CYG_CLASSFROMFIELD(_type_,_member_,_ptr_)\ |
|
|
103 ((_type_ *)((char *)(_ptr_)-((char *)&(((_type_ *)0)->_member_)))) |
|
|
104 |
|
|
105 #ifdef __cplusplus |
|
|
106 |
|
|
107 #define CYG_OFFSETOFBASE(_type_,_base_)\ |
|
|
108 ((char *)((_base_ *)((_type_ *)4)) - (char *)4) |
|
|
109 |
|
|
110 # define CYG_CLASSFROMBASE(_class_,_base_,_ptr_)\ |
|
|
111 ((_class_ *)((char *)(_ptr_) - CYG_OFFSETOFBASE(_class_,_base_))) |
|
|
112 |
|
|
113 #endif |
|
|
114 |
|
|
115 // ------------------------------------------------------------------------- |
|
|
116 #endif // CYGONCE_KERNEL_KTYPES_H |
|
|
117 // EOF ktypes.h |
|
|
118 |