Home | History | Annotate | Download | only in inc
      1 /*
      2  * dspbridge/mpu_api/inc/std.h
      3  *
      4  * DSP-BIOS Bridge driver support functions for TI OMAP processors.
      5  *
      6  * Copyright (C) 2007 Texas Instruments, Inc.
      7  *
      8  * This program is free software; you can redistribute it and/or modify it
      9  * under the terms of the GNU Lesser General Public License as published
     10  * by the Free Software Foundation version 2.1 of the License.
     11  *
     12  * This program is distributed .as is. WITHOUT ANY WARRANTY of any kind,
     13  * whether express or implied; without even the implied warranty of
     14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     15  * Lesser General Public License for more details.
     16  */
     17 
     18 
     19 /*
     20  *  ======== std.h ========
     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 0
    210 #if defined(_80_)
    211 typedef int Bool;		/* boolean */
    212 #elif defined(_W32_)
    213 typedef long Bool;		/* boolean to match Windows boolean def */
    214 #else
    215 typedef MdUns Bool;		/* boolean */
    216 #endif
    217 #endif
    218 
    219 typedef SmBits Byte;		/* smallest unit of addressable store */
    220 typedef void *Ptr;		/* pointer to arbitrary type */
    221 
    222 /* Arg should be size of Ptr */
    223 #if defined(M_I86SM) || defined(_29_) || defined(_50_) || defined(_54_) || defined(_6x_)
    224 typedef Int Arg;
    225 #elif defined(_55_) || defined(_28_)
    226 typedef void *Arg;
    227 #else
    228 typedef LgInt Arg;		/* uninterpreted LGSIZE-bit word */
    229 #endif
    230 
    231 typedef Int(*Fxn) ();		/* generic function type */
    232 
    233 #if defined(_80_) || defined(_SUN_) || defined(_67_)
    234 typedef float Float;
    235 #else
    236 typedef double Float;
    237 #endif
    238 
    239 #ifndef NULL
    240 #define NULL 0
    241 #endif
    242 
    243 #if 0
    244 #ifndef TRUE
    245 #define FALSE ((Bool)0)
    246 #define TRUE  ((Bool)1)
    247 #endif
    248 #endif
    249 
    250 /*
    251  * These macros are used to cast 'Arg' types to 'Int' or 'Ptr'.
    252  * These macros were added for the 55x since Arg is not the same
    253  * size as Int and Ptr in 55x large model.
    254  */
    255 #if defined(_28l_) || defined(_55l_)
    256 #define ArgToInt(A)	((Int)((long)(A) & 0xffff))
    257 #define ArgToPtr(A)	((Ptr)(A))
    258 #else
    259 #define ArgToInt(A)	((Int)(A))
    260 #define ArgToPtr(A)	((Ptr)(A))
    261 #endif
    262 
    263 /*
    264  *  ======== __inline ========
    265  *  The following definitions define the macro __inline for those
    266  *  C compilers that do not use __inline to indicate inline
    267  *  expansion of functions.
    268  *
    269  *  The TI C compilers support the "inline" keyword (ala C++).  Both
    270  *  Microsoft and GNU C compilers support the "__inline" keyword.  The
    271  *  native SUN OS 4.x C compiler doesn't understand either.
    272  */
    273 #ifdef _TI_
    274 #ifdef _LINT_
    275 #define __inline
    276 #else
    277 #define __inline inline
    278 #endif
    279 #endif
    280 
    281 #ifdef _SUN4_
    282 #define __inline
    283 #endif
    284 
    285 /*
    286  *  ======== inline ========
    287  *  Define "inline" so that all C code can optionally use the "inline"
    288  *  keyword. don't define if we are compiling with GNU C compiler version greater than 3.x
    289  */
    290 #if !defined(inline) && !defined(__cplusplus) && !defined(_TI_)
    291 #if !((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
    292 #define inline	__inline
    293 #endif
    294 #endif
    295 
    296 #endif				/* STD_ */
    297