00001 /*************************************************************************** 00002 * $Id: typedefs.h 196 2008-09-13 20:37:42Z merdmann $ 00003 * 00004 * Mon Nov 26 06:59:07 2007 00005 * Copyright 2007 Michael Erdmann 00006 * Email: michael.erdmann@snafu.de 00007 ****************************************************************************/ 00008 00009 /* 00010 * This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00023 */ 00024 00029 #ifndef TYPEDEFS_H 00030 #define TYPEDEFS_H 00031 00032 typedef unsigned char byte; // 8-bit 00033 typedef unsigned int word; // 16-bit 00034 typedef unsigned long dword; // 32-bit 00035 00036 /* ......................... OSEK/VDX Types .................................. */ 00037 /* OSEK/VDX data types */ 00038 typedef byte StatusType; 00039 typedef byte TaskStateType; 00040 typedef TaskStateType* TaskStateRefType; 00041 00043 #define INVALID_TASK 0 00044 #define RUNNING 1 00045 #define WAITING 2 00046 #define READY 3 00047 #define SUSPENDED 4 00048 00049 typedef byte AppModeType; 00050 00051 /* ............................................................................ */ 00052 00053 /* some local types */ 00054 typedef union _BYTE 00055 { 00056 byte _byte; 00057 struct 00058 { 00059 unsigned b0:1; 00060 unsigned b1:1; 00061 unsigned b2:1; 00062 unsigned b3:1; 00063 unsigned b4:1; 00064 unsigned b5:1; 00065 unsigned b6:1; 00066 unsigned b7:1; 00067 }; 00068 } BYTE; 00069 00070 typedef union _WORD 00071 { 00072 word _word; 00073 struct 00074 { 00075 byte byte0; 00076 byte byte1; 00077 }; 00078 struct 00079 { 00080 BYTE Byte0; 00081 BYTE Byte1; 00082 }; 00083 struct 00084 { 00085 BYTE LowB; 00086 BYTE HighB; 00087 }; 00088 struct 00089 { 00090 byte v[2]; 00091 }; 00092 } WORD; 00093 #define LSB(a) ((a).v[0]) 00094 #define MSB(a) ((a).v[1]) 00095 00096 typedef union _DWORD 00097 { 00098 dword _dword; 00099 struct 00100 { 00101 byte byte0; 00102 byte byte1; 00103 byte byte2; 00104 byte byte3; 00105 }; 00106 struct 00107 { 00108 word word0; 00109 word word1; 00110 }; 00111 struct 00112 { 00113 BYTE Byte0; 00114 BYTE Byte1; 00115 BYTE Byte2; 00116 BYTE Byte3; 00117 }; 00118 struct 00119 { 00120 WORD Word0; 00121 WORD Word1; 00122 }; 00123 struct 00124 { 00125 byte v[4]; 00126 }; 00127 } DWORD; 00128 00129 #define LOWER_LSB(a) ((a).v[0]) 00130 #define LOWER_MSB(a) ((a).v[1]) 00131 #define UPPER_LSB(a) ((a).v[2]) 00132 #define UPPER_MSB(a) ((a).v[3]) 00133 00134 #define HANDLE __near char* 00135 00136 #define POINTER __near char* 00137 00138 typedef void(*pFunc)(void); 00139 typedef enum _BOOL { FALSE = 0, TRUE } BOOL; 00140 00141 #define OK TRUE 00142 #define FAIL FALSE 00143 00144 #endif //TYPEDEFS_H
1.4.6