Home | History | Annotate | Download | only in inc
      1 /*
      2  *  Copyright 2001-2008 Texas Instruments - http://www.ti.com/
      3  *
      4  *  Licensed under the Apache License, Version 2.0 (the "License");
      5  *  you may not use this file except in compliance with the License.
      6  *  You may obtain a copy of the License at
      7  *
      8  *     http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  *  Unless required by applicable law or agreed to in writing, software
     11  *  distributed under the License is distributed on an "AS IS" BASIS,
     12  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  *  See the License for the specific language governing permissions and
     14  *  limitations under the License.
     15  */
     16 
     17 
     18 /*
     19  *  ======== std.h ========
     20  *  DSP-BIOS Bridge driver support functions for TI OMAP processors.
     21  *
     22  *! Revision History
     23  *! ================
     24  *! 16-Feb-2004 vp	GNU compiler 3.x defines inline keyword. Added appropriate
     25 			macros not to redefine inline keyword in this file.
     26  *! 24-Oct-2002	ashu	defined _TI_ and _FIXED_ symbols for 28x.
     27  *! 24-Oct-2002	ashu	defined _TI_ for 24x.
     28  *! 01-Mar-2002 kln	changed LARGE_MODEL and Arg definition for 28x
     29  *! 01-Feb-2002 kln	added definitions for 28x
     30  *! 08-Dec-2000 kw:	added 'ArgToInt' and 'ArgToPtr' macros
     31  *! 30-Nov-2000 mf:	Added _64_, _6x_; removed _7d_
     32  *! 30-May-2000 srid:	Added   __TMS320C55X__ for 55x; Arg is void * for 55 .
     33  *! 18-Jun-1999 dr:	Added '_TI_', fixed __inline for SUN4, added inline
     34  *! 10-Feb-1999 rt:	Added '55' support, changed 54's symbol to _TMS320C5XX
     35  *! 29-Aug-1998 mf: 	fixed typo, removed obsolete targets
     36  *! 08-Jun-1998 mf: 	_67_ is synonym for _7d_
     37  *! 10-Oct-1997 rt;	added _7d_ for Raytheon C7DSP triggered by _TMS320C6700
     38  *! 04-Aug-1997 cc:	added _29_ for _TMS320C2XX
     39  *! 11-Jul-1997 dlr:	_5t_, and STD_SPOXTASK keyword for Tasking
     40  *! 12-Jun-1997 mf: 	_TMS320C60 -> _TMS320C6200
     41  *! 13-Feb-1997 mf:	_62_, with 32-bit LgInt
     42  *! 26-Nov-1996 kw: 	merged bios-c00's and wsx-a27's <std.h> changes
     43  *!			*and* revision history
     44  *! 12-Sep-1996 kw: 	added C54x #ifdef's
     45  *! 21-Aug-1996 mf: 	removed #define main smain for _21_
     46  *! 14-May-1996 gp:     def'd out INT, FLOAT, and COMPLEX defines for WSX.
     47  *! 11-Apr-1996 kw:     define _W32_ based on _WIN32 (defined by MS compiler)
     48  *! 07-Mar-1996 mg:     added Win32 support
     49  *! 06-Sep-1995 dh:	added _77_ dynamic stack support via fxns77.h
     50  *! 27-Jun-1995 dh:	added _77_ support
     51  *! 16-Mar-1995 mf: 	for _21_: #define main smain
     52  *! 01-Mar-1995 mf: 	set _20_ and _60_ (as well as _21_ for both)
     53  *! 22-Feb-1995 mf: 	Float is float for _SUN_ and _80_
     54  *! 22-Dec-1994 mf: 	Added _80_ definition, for PP or MP.
     55  *! 09-Dec-1994 mf: 	Added _53_ definition.
     56  *! 22-Nov-1994 mf: 	Ptr is void * everywhere.
     57  *!			Added definitions of _30_, etc.
     58  *! 23-Aug-1994 dh	removed _21_ special case (kw)
     59  *! 17-Aug-1994 dh	added _51_ support
     60  *! 03-Aug-1994 kw	updated _80_ support
     61  *! 30-Jun-1994 kw	added _80_ support
     62  *! 05-Apr-1994 kw:	Added _SUN_ to _FLOAT_ definition
     63  *! 01-Mar-1994 kw: 	Made Bool an int (was MdUns) for _56_ (more efficient).
     64  *!			Added _53_ support.
     65  */
     66 
     67 #ifndef STD_
     68 #define STD_
     69 
     70 #ifdef _TMS320C28X
     71 #define _28_ 1
     72 #ifdef LARGE_MODEL
     73 #define _28l_ 1
     74 #endif
     75 #endif
     76 #ifdef _TMS320C2XX
     77 #define _29_ 1
     78 #endif
     79 #ifdef _TMS320C30
     80 #define _30_ 1
     81 #endif
     82 #ifdef _TMS320C40
     83 #define _40_ 1
     84 #endif
     85 #ifdef _TMS320C50
     86 #define _50_ 1
     87 #endif
     88 #ifdef _TMS320C5XX
     89 #define _54_ 1
     90 #endif
     91 #ifdef __TMS320C55X__
     92 #define _55_ 1
     93 #ifdef __LARGE_MODEL__
     94 #define _55l_ 1
     95 #endif
     96 #endif
     97 #ifdef _TMS320C6200
     98 #define _62_ 1
     99 #define _6x_ 1
    100 #endif
    101 #ifdef _TMS320C6400
    102 #define _64_ 1
    103 #define _6x_ 1
    104 #endif
    105 #ifdef _TMS320C6700
    106 #define _67_ 1
    107 #define _6x_ 1
    108 #endif
    109 #ifdef M_I86
    110 #define _86_ 1
    111 #endif
    112 #ifdef _MVP_MP
    113 #define _80_ 1
    114 #endif
    115 #ifdef _MVP_PP
    116 #define _80_ 1
    117 #endif
    118 #ifdef _WIN32
    119 #define _W32_ 1
    120 #endif
    121 
    122 /*
    123  *  ======== _TI_ ========
    124  *  _TI_ is defined for all TI targets
    125  */
    126 #if defined(_29_) || defined(_30_) || defined(_40_) || defined(_50_) || defined(_54_) || defined(_55_) || defined (_6x_) || defined(_80_) || defined (_28_) || defined(_24_)
    127 #define _TI_	1
    128 #endif
    129 
    130 /*
    131  *  ======== _FLOAT_ ========
    132  *  _FLOAT_ is defined for all targets that natively support floating point
    133  */
    134 #if defined(_SUN_) || defined(_30_) || defined(_40_) || defined(_67_) || defined(_80_)
    135 #define _FLOAT_	1
    136 #endif
    137 
    138 /*
    139  *  ======== _FIXED_ ========
    140  *  _FIXED_ is defined for all fixed point target architectures
    141  */
    142 #if defined(_29_) || defined(_50_) || defined(_54_) || defined(_55_) || defined (_62_) || defined(_64_) || defined (_28_)
    143 #define _FIXED_	1
    144 #endif
    145 
    146 /*
    147  *  ======== _TARGET_ ========
    148  *  _TARGET_ is defined for all target architectures (as opposed to
    149  *  host-side software)
    150  */
    151 #if defined(_FIXED_) || defined(_FLOAT_)
    152 #define _TARGET_ 1
    153 #endif
    154 
    155 /*
    156  *  8, 16, 32-bit type definitions
    157  *
    158  *  Sm*	- 8-bit type
    159  *  Md* - 16-bit type
    160  *  Lg* - 32-bit type
    161  *
    162  *  *Int - signed type
    163  *  *Uns - unsigned type
    164  *  *Bits - unsigned type (bit-maps)
    165  */
    166 typedef char SmInt;		/* SMSIZE-bit signed integer */
    167 typedef short MdInt;		/* MDSIZE-bit signed integer */
    168 #if defined(_6x_)
    169 typedef int LgInt;		/* LGSIZE-bit signed integer */
    170 #else
    171 typedef long LgInt;		/* LGSIZE-bit signed integer */
    172 #endif
    173 
    174 typedef unsigned char SmUns;	/* SMSIZE-bit unsigned integer */
    175 typedef unsigned short MdUns;	/* MDSIZE-bit unsigned integer */
    176 #if defined(_6x_)
    177 typedef unsigned LgUns;		/* LGSIZE-bit unsigned integer */
    178 #else
    179 typedef unsigned long LgUns;	/* LGSIZE-bit unsigned integer */
    180 #endif
    181 
    182 typedef unsigned char SmBits;	/* SMSIZE-bit bit string */
    183 typedef unsigned short MdBits;	/* MDSIZE-bit bit string */
    184 #if defined(_6x_)
    185 typedef unsigned LgBits;	/* LGSIZE-bit bit string */
    186 #else
    187 typedef unsigned long LgBits;	/* LGSIZE-bit bit string */
    188 #endif
    189 
    190 /*
    191  *  Aliases for standard C types
    192  */
    193 typedef int Int;		/* for those rare occasions */
    194 typedef long int Long;
    195 typedef short int Short;
    196 typedef char Char;
    197 #define Void void
    198 
    199 typedef char *String;		/* pointer to null-terminated character
    200 				 * sequence
    201 				 */
    202 
    203 #if defined(_28_) || defined(_29_) || defined(_50_) || defined(_54_) || defined(_55_) || defined(_6x_)
    204 typedef unsigned Uns;
    205 #else
    206 typedef unsigned long Uns;
    207 #endif
    208 
    209 #if defined(_80_)
    210 typedef int Bool;		/* boolean */
    211 #elif defined(_W32_)
    212 typedef long Bool;		/* boolean to match Windows boolean def */
    213 #else
    214 typedef MdUns Bool;		/* boolean */
    215 #endif
    216 
    217 typedef SmBits Byte;		/* smallest unit of addressable store */
    218 typedef void *Ptr;		/* pointer to arbitrary type */
    219 
    220 /* Arg should be size of Ptr */
    221 #if defined(M_I86SM) || defined(_29_) || defined(_50_) || defined(_54_) || defined(_6x_)
    222 typedef Int Arg;
    223 #elif defined(_55_) || defined(_28_)
    224 typedef void *Arg;
    225 #else
    226 typedef LgInt Arg;		/* uninterpreted LGSIZE-bit word */
    227 #endif
    228 
    229 typedef Int(*Fxn) ();		/* generic function type */
    230 
    231 #if defined(_80_) || defined(_SUN_) || defined(_67_)
    232 typedef float Float;
    233 #else
    234 typedef double Float;
    235 #endif
    236 
    237 #ifndef NULL
    238 #define NULL 0
    239 #endif
    240 
    241 #ifndef TRUE
    242 #define FALSE ((Bool)0)
    243 #define TRUE  ((Bool)1)
    244 #endif
    245 
    246 /*
    247  * These macros are used to cast 'Arg' types to 'Int' or 'Ptr'.
    248  * These macros were added for the 55x since Arg is not the same
    249  * size as Int and Ptr in 55x large model.
    250  */
    251 #if defined(_28l_) || defined(_55l_)
    252 #define ArgToInt(A)	((Int)((long)(A) & 0xffff))
    253 #define ArgToPtr(A)	((Ptr)(A))
    254 #else
    255 #define ArgToInt(A)	((Int)(A))
    256 #define ArgToPtr(A)	((Ptr)(A))
    257 #endif
    258 
    259 /*
    260  *  ======== __inline ========
    261  *  The following definitions define the macro __inline for those
    262  *  C compilers that do not use __inline to indicate inline
    263  *  expansion of functions.
    264  *
    265  *  The TI C compilers support the "inline" keyword (ala C++).  Both
    266  *  Microsoft and GNU C compilers support the "__inline" keyword.  The
    267  *  native SUN OS 4.x C compiler doesn't understand either.
    268  */
    269 #ifdef _TI_
    270 #ifdef _LINT_
    271 #define __inline
    272 #else
    273 #define __inline inline
    274 #endif
    275 #endif
    276 
    277 #ifdef _SUN4_
    278 #define __inline
    279 #endif
    280 
    281 /*
    282  *  ======== inline ========
    283  *  Define "inline" so that all C code can optionally use the "inline"
    284  *  keyword. don't define if we are compiling with GNU C compiler version greater than 3.x
    285  */
    286 #if !defined(inline) && !defined(__cplusplus) && !defined(_TI_)
    287 #if !((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
    288 #define inline	__inline
    289 #endif
    290 #endif
    291 
    292 #endif				/* STD_ */
    293