/*
 * Copyright 2010 Trident Microsystems (Far East) Ltd. All rights reserved.
 * All prior copyright rights in this work and the accompanying software
 * products transferred to Trident Microsystems (Far East) Ltd. by written
 * agreement.
 */
/*****************************************************************************/
/* Copyright (c) 2010 NXP B.V.  All rights are reserved.                     */
/*                                                                           */
/* Redistribution and use in source and binary forms, with or without        */
/* modification, are permitted provided that the following conditions        */
/* are met:                                                                  */
/*                                                                           */
/* Redistributions of source code must retain the above copyright            */
/* notice, this list of conditions and the following disclaimer.             */
/*                                                                           */
/* Redistributions in binary form must reproduce the above copyright         */
/* notice, this list of conditions and the following disclaimer in the       */
/* documentation and/or other materials provided with the distribution.      */
/*                                                                           */
/* Neither the name of NXP nor the names of its                              */
/* contributors may be used to endorse or promote products derived from      */
/* this software without specific prior written permission.                  */
/*                                                                           */
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS       */
/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT         */
/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR     */
/* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT      */
/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,     */
/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT          */
/* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,     */
/* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY     */
/* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT       */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE         */
/* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH          */
/* DAMAGE.                                                                   */
/*                                                                           */
/*****************************************************************************/

/*############################################################
 *
 * Module name  : tmNxTypes.h  %version: SOUsb225#21.1.2 %
 *
 * Last Update  : %date_modified: Mon Feb 10 21:38:00 2003 %
 *
 * Description: MoReUse/Nexperia global type definitions.
 *
 * Document Ref: Nexperia/MoReUse Naming Conventions specification
 *               DVP Software Versioning Specification
 *
 *############################################################
 */

#ifndef TMNXTYPES_H
#define TMNXTYPES_H

/*-----------------------------------------------------------------------------
** Standard include files:
**-----------------------------------------------------------------------------
*/

/*-----------------------------------------------------------------------------
** Project include files:
**-----------------------------------------------------------------------------
** NOTE: tmFlags.h
**  The tmFlags.h header file defines CPU type/model, OS type/version,
**  big/little endianness, and other platform dependent settings.  The file
**  is automatically generated by the SDE2 build process.  If not using the
**  SDE2 build process, do the following:
**  1)  Obtain a copy of tmFlagsExample.h file from the MoReUse website
**      (URL: http://nww.nxp.com/it/corpit/products/reuse-standards/html/global_files.html).
**  2)  Rename the file to tmFlags.h and place it in the build include path.
**  3)  Modify the file for your platform settings, using the comments in the
**      file as a guide for the required modifications.
*/
#include "tmFlags.h"                /* DVP platform dependent build flags */

#ifdef __cplusplus
extern "C"
{
#endif

/*-----------------------------------------------------------------------------
** Types and defines:
**-----------------------------------------------------------------------------
**
** NOTE: Bool values
**  TM_TRUE is defined as 1 (instead of !TM_FALSE) to utilize the Trimedia
**  processor hardware architecture.  Two TM CPU registers are hardwired to
**  represent the Bool values:  r0 = 0 (TM_FALSE) and r1 = 1 (TM_TRUE).
*/
#define TM_FALSE        0
#define TM_TRUE         1

/* NOTE: TCS tmtypes.h
**  tmNxTypes.h duplicates many of the same typedefs that are defined in the
**  Trimedia Compilation and Simulation system (TCS) tmtypes.h header file so
**  there is no requirement that TCS be installed on the development system.
**  To prevent type definition conflicts when both header files are used by a
**  source file, the check for _TMtypes_h is done.  Whichever header file
**  (tmNxTypes.h or TCS tmtypes.h) is included first will define the shared
**  types and define _TMtypes_h, thereby excluding the type definitions in
**  the other header file.
*/
#ifndef _TMtypes_h                  /* if TCS tmtypes.h not included (yet) */
#define _TMtypes_h                  /* (typedefs defined below) */

#define False           (TM_FALSE)  /* NOTE: Legacy - use TM_FALSE instead */
#define True            (TM_TRUE)   /* NOTE: Legacy - use TM_TRUE  instead */

#ifdef __cplusplus
#define Null            0
#else
#define Null            ((Void *) 0)
#endif

/*
** Standard Types
*/

#if TMFL_OS_IS_LINUX
  /* To get definitions of uint32_t, etc on Linux */
  #if TMFL_MODE_KERNEL
    /* Kernel mode */
    #include "linux/types.h"
  #else
    /* User mode */
    #include "stdint.h"
  #endif

  #if !defined(__cplusplus) && !TMFL_MODE_KERNEL && !defined(__bool_true_false_are_defined)
    /* Our compiler is so old it doesn't have stdbool.h, so fake it up. */
    /* Note : bool is left as an implementation dependent type as it used by
              non-NXP code. Within our own code we should always use Bool.
    */
    typedef _Bool bool;
    #define false (0)
    #define true (!0)
    #define __bool_true_false_are_defined 1
  #endif

  // 64bit literals
  // TODO: DJL Use the types defined I64LIT and U64LIT not these.
  #define LIT64(_x)   (_x##LL)
  #define LIT64U(_x)  (_x##ULL)

  typedef int8_t Int8;
  typedef int16_t Int16;
  typedef int32_t Int32;
  typedef uint8_t UInt8;
  typedef uint16_t UInt16;
  typedef uint32_t UInt32;
//
// We need the Bool types to be defined as the same size for both Linux and CE.
// We don't use bool as it is implementation specific.
// Our precompiled libraries used a 1 byte representation for Bool
// so we now stipulate uint8_t for both Linux & CE
//
  typedef uint8_t Bool;

#elif TMFL_OS_IS_CE
    #ifdef WINCEMACRO
        #undef WINCEMACRO
    #endif
    #define WIN32_NO_OLE
    #define WIN32_LEAN_AND_MEAN             // Exclude rarely-used stuff from Windows headers
    #include <windows.h>
    #include <WTypes.h>
    #include <stdlib.h>
    #include <tchar.h>
    #include <stdio.h>
    #include <errno.h>
    #include <inc/userlib/basicdef.h>

    // 64bit literals
    // TODO: DJL Use the types defined I64LIT and U64LIT not these.
    #define LIT64(_x)   (_x##i64)
    #define LIT64U(_x)  (_x##ui64)

    // emulate stdint.h
    typedef INT8    int8_t;
    typedef INT16   int16_t;
    typedef INT32   int32_t;
    typedef UINT8   uint8_t;
    typedef UINT16  uint16_t;
    typedef UINT32  uint32_t;
    // emulate stdbool.h
    #if !defined(__cplusplus)
    /* Note : Within NXP code we should always use Bool not bool.
    */
      typedef uint8_t     bool;
      #define false   (0)
      #define true    (!0)
    #endif

    #define EXPORT_SYMBOL(a)
#else
#error Unsupported OS!
#endif

typedef char  char_t;

#if !TMFL_OS_IS_LINUX
typedef signed   char   Int8;       /*  8 bit   signed integer */
typedef signed   short  Int16;      /* 16 bit   signed integer */
typedef signed   long   Int32;      /* 32 bit   signed integer */
typedef unsigned char  UInt8;      /*  8 bit unsigned integer */
typedef unsigned short UInt16;     /* 16 bit unsigned integer */
typedef unsigned long  UInt32;     /* 32 bit unsigned integer */
//
// We need the Bool types to be defined as the same size for both Linux and CE.
// We don't use bool as it is implementation specific.
// Our precompiled libraries used a 1 byte representation for bool
// so we now stipulate uint8_t for both Linux & CE
//
typedef uint8_t         Bool;       /* Boolean (True/False) */

#endif

typedef float           Float;      /* 32 bit floating point */
typedef char            Char;       /* character, character array ptr */
typedef int             Int;        /* machine-natural integer */
typedef unsigned int    UInt;       /* machine-natural unsigned integer */
typedef char           *String;     /* Null terminated 8 bit char str */

/*-----------------------------------------------------------------------------
** Legacy TM Types/Structures (Not necessarily DVP Coding Guideline compliant)
** NOTE: For Nexperia/DVP Coding Gudeline compliance, do not use these types.
*/
typedef char          *Address;        /* Ready for address-arithmetic */
typedef char const    *ConstAddress;
typedef unsigned char  Byte;           /* Raw byte */
typedef float          Float32;        /* Single-precision float */
typedef double         Float64;        /* Double-precision float */
typedef void          *Pointer;        /* Pointer to anonymous object */
typedef void const    *ConstPointer;
typedef char const    *ConstString;

typedef Int             Endian;
#define BigEndian       0
#define LittleEndian    1

/* Required by TMDownloader.h */
/* TM32 = 0 for compatibility!, allow many tm32 versions before TM64 */
typedef enum { TM32 = 0, TM32V2, TM64=100 } TMArch;
extern char* TMArch_names[];

typedef struct tmVersion
{
    UInt8   majorVersion;
    UInt8   minorVersion;
    UInt16  buildVersion;
}   tmVersion_t, *ptmVersion_t;

#endif /* ifndef _TMtypes_h */

/* Define DVP types that are not TCS types.
** NOTE: IBits32/UBits32 types are defined for use with 32 bit bitfields.
**       This is done because ANSI/ISO compliant compilers require bitfields
**       to be of type "int" else a large number of compiler warnings will
**       result.  To avoid the risks associated with redefining Int32/UInt32
**       to type "int" instead of type "long" (which are the same size on 32
**       bit CPUs) separate 32bit signed/unsigned bitfield types are defined.
*/
typedef signed   int    IBits32;    /* 32 bit   signed integer bitfields */
typedef unsigned int    UBits32;    /* 32 bit unsigned integer bitfields */

typedef Int8    *pInt8;             /*  8 bit   signed integer ptr */
typedef Int16   *pInt16;            /* 16 bit   signed integer ptr */
typedef Int32   *pInt32;            /* 32 bit   signed integer ptr */
typedef IBits32 *pIBits32;          /* 32 bit   signed integer bitfield ptr */
typedef UBits32 *pUBits32;          /* 32 bit unsigned integer bitfield ptr */
typedef UInt8   *pUInt8;            /*  8 bit unsigned integer ptr */
typedef UInt16  *pUInt16;           /* 16 bit unsigned integer ptr */
typedef UInt32  *pUInt32;           /* 32 bit unsigned integer ptr */
#define Void void
typedef void    *pVoid;             /* Void ptr */
typedef Float   *pFloat;            /* 32 bit floating point, float ptr */
typedef double  Double, *pDouble;   /* 32/64 bit floating point, double ptr */
typedef Bool    *pBool;             /* Boolean (True/False) ptr */
typedef Char    *pChar;             /* character, character array ptr */
typedef Int     *pInt;              /* machine-natural integer ptr */
typedef UInt    *pUInt;             /* machine-natural unsigned integer ptr */
typedef String  *pString;           /* Null terminated 8 bit char str ptr */

/*
** NOTE: Compiler version dependent support
**  C/C++ compiler versions C99 and later support 64 bit signed/unsigned
**  integers and some special keywords (such as "restrict") natively.  As
**  the compiler version used to compile this header file can vary, some
**  preprocessor checks are done to determine if the features are supported,
**  are not supported and must be emulated, or must be disabled altogether.
**  The __STDC_VERSION__ compiler version number (if defined) is compared
**  with the expected compiler version.  If the compiler version is not
**  defined, it is assumed that the compiler does not support the features.
*/
#define TMFL_STDC_VERSION_C89   198912L /* C89 compiler version (simulated) */
#define TMFL_STDC_VERSION_C95   199409L /* C95 compiler version number */
#define TMFL_STDC_VERSION_C99   199901L /* C99 compliant if >= this version */

#define TMFL_MSC_VERSION_600    1200    /* Microsoft Visual C Version 6.00 */

#ifndef __STDC_VERSION__
#define __STDC_VERSION__        (TMFL_STDC_VERSION_C89) /* assume old comp. */
#endif /* __STDC_VERSION__ */

#if     (__STDC_VERSION__ >= TMFL_STDC_VERSION_C99)
/* This can be enabled only when all explicit references to the hi and lo
    structure members are eliminated from client code. */
#define TMFL_NATIVE_INT64   1           /* Native 64 bit integer support */

typedef signed   long long int Int64,  *pInt64;  /* 64-bit signed integer */
typedef unsigned long long int UInt64, *pUInt64; /* 64-bit unsigned integer */

/*#elif   (defined (_MSC_VER) && (_MSC_VER >= TMFL_MSC_VERSION_600))
** NOTE: Microsoft Visual C 64 bit integer support
**  The Microsoft Visual C Version 6.00 (and later) compiler has native 64 bit
**  integer support.  As some code currently accesses the emulated 64 bit
**  integer structure .hi/.lo members directly (rather than through macros),
**  that code will not compile if the MSC 64 bit integer support is enabled.
**  For this reason, the MSC 64 bit integer support is disabled (commented
**  out) until all code has been updated to remove the explicit references to
**  the .hi and .lo structure members.
*/
/*#define TMFL_NATIVE_INT64   1 */

/* typedef signed   __int64 Int64,  *pInt64;  */ /* 64-bit signed   integer */
/* typedef unsigned __int64 UInt64, *pUInt64; */ /* 64-bit unsigned integer */

#else /* (__STDC_VERSION__ < TMFL_STDC_VERSION_C99) */

/* Use native 64-bit integer math for compilers that have it. */
#if defined(__TCS_VERSION__) && (__TCS_VERSION__ >= 310)
#define TMFL_NATIVE_INT64 1

typedef signed   long long Int64,  *pInt64;  /* 64-bit integer */
typedef unsigned long long UInt64, *pUInt64; /* 64-bit bitmask */

#else /* defined(__TCS_VERSION__) && (__TCS_VERSION__ >= 310) */

/* Use native 64-bit integer math for compilers that have it. */
#if (TMFL_OS_IS_LINUX || TMFL_OS_IS_CE)
#define TMFL_NATIVE_INT64 1

/** Added from tmNxTypes.h in STB810.*/
#define I64LIT(i) i##LL
#define U64LIT(u) u##ULL

typedef signed   long long Int64,  *pInt64;  /* 64-bit integer */
typedef unsigned long long UInt64, *pUInt64; /* 64-bit bitmask */

#else /* No native compiler support for long long int Int64/UInt64 data type */

/* NOTE: Int64/UInt64 integer emulation data structures
** The Int64/UInt64 data structures defined below are used to emulate 64 bit
** integer support when used with older compilers that don't support them
** natively.  The data structure members (hi/lo) should not be accessed
** directly by software as this prevents the code from being portable when
** being built by compilers that do support 64 bit integers natively.
** Instead, code should use tmutil64.h (tmutil infrastructure component)
** which defines a set of macros for portable operations involving 64 bit
** integers (e.g., I64ADD, U64GT, U8CASTI64, F32CASTI64, etc.).
*/
#define TMFL_NATIVE_INT64   0           /* No native 64 bit integer support */

typedef struct  /* Int64: 64-bit signed integer */
{
        /*Get the correct endianness (this has no impact on any other part of
            the system, but may make memory dumps easier to understand).*/
#if     (TMFL_ENDIAN == TMFL_ENDIAN_BIG)
        Int32 hi; UInt32 lo;
#else
        UInt32 lo; Int32 hi;
#endif
}   Int64, *pInt64;

typedef struct  /* UInt64: 64-bit unsigned integer */
    {
#if     (TMFL_ENDIAN == TMFL_ENDIAN_BIG)
        UInt32 hi; UInt32 lo;
#else
        UInt32 lo; UInt32 hi;
#endif
}   UInt64, *pUInt64;

#endif /* (TMFL_OS_IS_LINUX || TMFL_OS_IS_CE) */
#endif /* defined(__TCS_VERSION__) && (__TCS_VERSION__ >= 310) */
#endif /* (__STDC_VERSION__ >= TMFL_STDC_VERSION_C99) */


/* Maximum length of device name in all DVP BSL and capability structures */
#define HAL_DEVICE_NAME_LENGTH  16

typedef UInt32 tmErrorCode_t;
typedef UInt32 tmProgressCode_t;

/* timestamp definition */
typedef UInt64 tmTimeStamp_t, *ptmTimeStamp_t;

/* for backwards compatibility with the older tmTimeStamp_t definition */
#define ticks   lo
#define hiTicks hi

typedef union tmColor3                 /* 3 byte color structure */
{
    UBits32 u32;
#if (TMFL_ENDIAN == TMFL_ENDIAN_BIG)
    struct {
        UBits32       : 8;
        UBits32 red   : 8;
        UBits32 green : 8;
        UBits32 blue  : 8;
    } rgb;
    struct {
        UBits32   : 8;
        UBits32 y : 8;
        UBits32 u : 8;
        UBits32 v : 8;
    } yuv;
    struct {
        UBits32   : 8;
        UBits32 u : 8;
        UBits32 m : 8;
        UBits32 l : 8;
    } uml;
#else /* (TMFL_ENDIAN == TMFL_ENDIAN_LITTLE) */
    struct {
        UBits32 blue  : 8;
        UBits32 green : 8;
        UBits32 red   : 8;
        UBits32       : 8;
    } rgb;
    struct {
        UBits32 v : 8;
        UBits32 u : 8;
        UBits32 y : 8;
        UBits32   : 8;
    } yuv;
    struct {
        UBits32 l : 8;
        UBits32 m : 8;
        UBits32 u : 8;
        UBits32   : 8;
    } uml;
#endif /* (TMFL_ENDIAN == TMFL_ENDIAN_BIG) */
}   tmColor3_t, *ptmColor3_t;

typedef union tmColor4                 /* 4 byte color structure */
{
    UBits32 u32;
#if (TMFL_ENDIAN == TMFL_ENDIAN_BIG)
    struct {
        UBits32 alpha    : 8;
        UBits32 red      : 8;
        UBits32 green    : 8;
        UBits32 blue     : 8;
    } argb;
    struct {
        UBits32 alpha    : 8;
        UBits32 y        : 8;
        UBits32 u        : 8;
        UBits32 v        : 8;
    } ayuv;
    struct {
        UBits32 alpha    : 8;
        UBits32 u        : 8;
        UBits32 m        : 8;
        UBits32 l        : 8;
    } auml;
#else /* (TMFL_ENDIAN == TMFL_ENDIAN_LITTLE) */
    struct {
        UBits32 blue     : 8;
        UBits32 green    : 8;
        UBits32 red      : 8;
        UBits32 alpha    : 8;
    } argb;
    struct {
        UBits32 v        : 8;
        UBits32 u        : 8;
        UBits32 y        : 8;
        UBits32 alpha    : 8;
    } ayuv;
    struct {
        UBits32 l        : 8;
        UBits32 m        : 8;
        UBits32 u        : 8;
        UBits32 alpha    : 8;
    } auml;
#endif /* (TMFL_ENDIAN == TMFL_ENDIAN_BIG) */
}   tmColor4_t, *ptmColor4_t;

/*-----------------------------------------------------------------------------
** Hardware device power states
*/
typedef enum tmPowerState
{
    tmPowerOn,                          /* Device powered on      (D0 state) */
    tmPowerStandby,                     /* Device power standby   (D1 state) */
    tmPowerSuspend,                     /* Device power suspended (D2 state) */
    tmPowerOff                          /* Device powered off     (D3 state) */

}   tmPowerState_t, *ptmPowerState_t;

/*-----------------------------------------------------------------------------
** Software Version Structure
*/
typedef struct tmSWVersion
{
    UInt32      compatibilityNr;        /* Interface compatibility number */
    UInt32      majorVersionNr;         /* Interface major version number */
    UInt32      minorVersionNr;         /* Interface minor version number */

}   tmSWVersion_t, *ptmSWVersion_t;

/*-----------------------------------------------------------------------------
** NOTE: This macro converts four characters into a UInt32 value.  It is used
**       instead of multi-character constants (i.e. 'ABCD') to prevent some
**       compiler warnings, especially with GNU-based compilers.
*/
#define TM_CHARS_TO_UINT32(a,b,c,d) ((UInt32) ((UInt8) (a) << 24 | (UInt8) (b) << 16 | (UInt8) (c) << 8 | (UInt8) (d)))


/* NOTE: TCS tmBoardDef.h
**  tmNxTypes.h duplicates many of the same typedefs that are defined in the
**  Trimedia Compilation and Simulation system (TCS) tmBoardDef.h header file
**  so there is no requirement that TCS be installed on a development system.
**  To prevent type definition conflicts when both header files are used by a
**  source file, the check for _TMBOARDDEF_H_ is done.  Whichever header file
**  (tmNxTypes.h or TCS tmBoardDef.h) is included first will define the
**  shared types and define _TMBOARDDEF_H_, thereby excluding the type
**  definitions in the other header file.
*/
#ifndef _TMBOARDDEF_H_                  /* tmBoardDef.h not included (yet) */
#define _TMBOARDDEF_H_                  /* exclude tmBoardDef.h defines */

/*-----------------------------------------------------------------------------
** HW Unit Selection
*/
typedef Int tmUnitSelect_t, *ptmUnitSelect_t;

#define tmUnitNone (-1)
#define tmUnit0    0
#define tmUnit1    1
#define tmUnit2    2
#define tmUnit3    3
#define tmUnit4    4

/*+compatibility*/
#define unitSelect_t       tmUnitSelect_t
#define unit0              tmUnit0
#define unit1              tmUnit1
#define unit2              tmUnit2
#define unit3              tmUnit3
#define unit4              tmUnit4
#define DEVICE_NAME_LENGTH HAL_DEVICE_NAME_LENGTH
/*-compatibility*/

#endif /* ifndef _TMBOARDDEF_H_ */

/* Additional tmUnitSelect_t defines (not duplicated in TCS tmBoardDef.h) */
#define tmUnit5    5
#define tmUnit6    6
#define tmUnit7    7


/*-----------------------------------------------------------------------------
** Instance handle
*/
typedef Int tmInstance_t, *ptmInstance_t;

/* Callback function declaration */
typedef Void (*ptmCallback_t) (UInt32 events, Void *pData, UInt32 userData);
#define tmCallback_t ptmCallback_t /*compatibility*/


#if     (TMFL_OS_IS_CE || TMFL_OS_IS_NT)

/*-----------------------------------------------------------------------------
** Shared data segment macro - Places shared data in named DLL data segment.
** WinNT/WinCE: Use TMSHARED_DATA_BEGIN/TMSHARED_DATA_END for multiprocess
**  shared data on a single CPU.  To define data variables that are shared
**  across all processes for WinNT/WinCE, use the defined #pragma macros
**  TMSHARED_DATA_BEGIN/TMSHARED_DATA_END and initialize the data variables
**  as shown in the example below.  Data defined outside of the begin/end
**  section or not initialized will not be shared across all processes for
**  WinNT/WinCE; there will be a separate instance of the variable in each
**  process.  Use WinNT Explorer "QuickView" on the target DLL or text edit
**  the target DLL *.map file to verify the shared data section presence and
**  size (shared/static variables will not be named in the MAP file but will
**  be included in the shared section virtual size).
** NOTE: All data variables in the multiprocess section _MUST_BE_INITIALIZED_
**       to be shared across processes; if no explicit initialization is
**       done, the data variables will not be shared across processes.  This
**       shared data mechanism only applies to WinNT/WinCE multiprocess data
**       on a single CPU (pSOS shares all data across tasks by default).  Use
**       the TMML MP shared data region for shared data across multiple CPUs
**       and multiple processes.  Example (note global variable naming):
**
**  #if     (TMFL_OS_IS_CE || TMFL_OS_IS_NT)
**  #pragma TMSHARED_DATA_BEGIN         // Multiprocess shared data begin
**  #endif
**
**  static g<Multiprocess shared data variable> = <Initialization value>;
**         gtm<Multiprocess shared data variable> = <Initialization value>;
**
**  #if     (TMFL_OS_IS_CE || TMFL_OS_IS_NT)
**  #pragma TMSHARED_DATA_END           // Multiprocess shared data end
**  #endif
**
** NOTE: These pragma defines require that the DLL flags include the following
**       line: "-section:.tmShare,RWS" in the makelib.mk and maketarget.mk
**       (or equivalent) target OS makefiles for this mechanism to work.
*/
#define TMSHARED_DATA_BEGIN     data_seg(".tmShare")
#define TMSHARED_DATA_END       data_seg()

#endif /* (TMFL_OS_IS_CE || TMFL_OS_IS_NT) */

#if     (!(defined __TCS__) && (__STDC_VERSION__ < TMFL_STDC_VERSION_C99))
/*-----------------------------------------------------------------------------
** 'C' language keywords
** ---------------------
**  [inline]
**  The Trimedia Compilation and Simulation system (TCS) compiler and also
**  C99 or later compilers support the "inline" keyword.  For non-TCS and
**  pre-C99 compilant compilers, the "inline" keyword is mapped to the native
**  compiler's equivalent keyword.
**
**  [restrict]
**  The "restrict" keyword (e.g., UInt32 * restrict pData) tells the 'C'
**  compiler that within the scope of this pointer, no other pointer will
**  alias to the same memory location (i.e., the only way to access the data
**  is through this pointer), allowing the compiler to perform certain code
**  optimizations.  The "restrict" keyword is supported by the Trimedia
**  Compilation and Simulation system (TCS) tmcc compiler and by C99 and
**  later compiler versions.  If the compiler doesn't support "restrict," the
**  keyword is defined as blank (nothing).
*/
#if     (TMFL_OS_IS_CE || TMFL_OS_IS_NT)

#if     (!defined __cplusplus)          /* Exclude keyword if C++ build */
#define inline      __inline
#endif /* (!defined __cplusplus) */

#define INLINE_FUNCTION inline

#define restrict    /**/

#elif      TMFL_OS_IS_PSOS && TMFL_CPU_IS_MIPS

/* NOTE regarding the keyword INLINE:
**
** Inline is not an ANSI-C keyword, hence every compiler can implement inlining
** the way it wants to. When using the dcc compiler this might possibly lead to
** redeclaration warnings when linking. For example:
**
**      dld: warning: Redeclaration of tmmlGetMemHandle
**      dld:    Defined in root.o
**      dld:    and        tmmlApi.o(../../lib/pSOS-MIPS/libtmml.a)
**
** For the dcc compiler inlining is not on by default. When building a retail
** version ( _TMTGTREL=ret), inlining is turned on explicitly in the dvp1 pSOS
** makefiles by specifying -XO, which enables all standard optimizations plus
** some others, including inlining (see the Language User's Manual, D-CC and
** D-C++ Compiler Suites p46). When building a debug version ( _TMTGTREL=dbg),
** the optimizations are not turned on (and even if they were they would have
** been overruled by -g anyway).
**
** When a .h file with inline function declarations gets included in multiple
** source files, redeclaration warnings are issued.
**
** When building a retail version those functions are inlined, but in addition
** the function is also declared within the .o file, resulting in redeclaration
** warnings as the same function is also defined by including that same header
** file in other source files. Defining the functions as static inline rather
** than inline solves the problem, as now the additional function declaration
** is omitted (as now the compiler realizes that there is no point in keeping
** that declaration as it can only be called from within this specific file,
** but it isn't, because all calls are already inline).
**
** When building a debug version no inlining is done, but the functions are
** still defined within the .o file, again resulting in redeclaration warnings.
** Again, defining the functions to be static inline rather than inline solves
** the problem.
**
** Now if we would change the definition of the inline keyword for pSOS from
** __inline__ to static __inline__, all inline function definitions throughout
** the code would not issue redeclaration warnings anymore, but all static
** inline definitions would.
** If we don't change the definition of the inline keyword, all inline func-
** tion definitions would return redeclaration warnings.
**
** As this is a pSOS linker bug, it was decided not to change the code but
** rather to ignore the issued warnings.
*/

#if     (!defined __cplusplus)          /* Exclude keyword if C++ build */
#ifndef TMFL_OS_IS_LINUX
#define inline      __inline__
#endif
#endif /* (!defined __cplusplus) */

#define INLINE_FUNCTION inline

#define restrict    /**/

#elif   (TMFL_OS_IS_PSOS && TMFL_CPU_IS_TM)
/* TCS supports the "inline"   keyword */
/* TCS supports the "restrict" keyword */
#define INLINE_FUNCTION inline

#elif   (TMFL_OS_IS_LINUX)
  /* Linux already supports inline well. */
#define INLINE_FUNCTION inline
#elif   (TMFL_OS_IS_VXWORKS || TMFL_OS_IS_HPUNIX || TMFL_OS_IS_NULLOS || (TMFL_OS_IS_ECOS && TMFL_CPU_IS_MIPS))
/*
** TMFL_OS_IS_HPUNIX is the HP Unix workstation target OS environment for the
** DVP SDE2 using the GNU gcc toolset.  It is the same as TMFL_OS_IS_NULLOS
** (which is inaccurately named because it is the HP Unix CPU/OS target
** environment).
** TMFL_OS_IS_VXWORKS is the VxWorks build which also uses the GNU toolset.
** TMFL_OS_IS_LINUX is the Linux build which also used the GNU toolset.
*/
#if ( TMFL_OS_IS_ECOS && TMFL_CPU_IS_MIPS )

#ifdef inline
#undef inline
#endif

#ifdef __cplusplus 
#define inline  __inline__ 
#else
#define inline static __inline__
#endif

#define INLINE_FUNCTION __inline__

#else /* ( TMFL_OS_IS_ECOS && TMFL_CPU_IS_MIPS ) */

#if     (!defined __cplusplus)          /* Exclude keyword if C++ build */
#define inline      __inline__
#endif /* (!defined __cplusplus) */

#define INLINE_FUNCTION inline

#endif /*( TMFL_OS_IS_ECOS && TMFL_CPU_IS_MIPS ) */

#define restrict    /**/

#else /* TMFL_OS_IS_??? */

#error ERROR: Unrecognized/unsupported TMFL_OS_IS_XXX value !

#endif /* TMFL_OS_IS_XXX */

#else /* (!(defined __TCS__) && (__STDC_VERSION__ < TMFL_STDC_VERSION_C99)) */

   #if        TMFL_OS_IS_CE || TMFL_OS_IS_NT
      #define inline  __inline

   #elif      TMFL_OS_IS_PSOS && TMFL_CPU_IS_MIPS
      #define inline  __inline

   #elif      TMFL_OS_IS_PSOS && TMFL_CPU_IS_TM
   // TriMedia keyword is already inline

   #elif      TMFL_OS_IS_ECOS && TMFL_CPU_IS_MIPS

      #ifdef inline
      #undef inline
      #endif

      #ifdef __cplusplus 
         #define inline  __inline__ 

      #else
         #define inline static __inline__

      #endif

      #define INLINE_FUNCTION __inline__

   #elif      (TMFL_OS_IS_NULLOS)
      #define inline  

   #else // TMFL_OS_IS_???
      #error confusing value in TMFL_OS!

  #endif // TMFL_OS_IS_XXX

#endif /* (!(defined __TCS__) && (__STDC_VERSION__ < TMFL_STDC_VERSION_C99)) */


#ifdef __cplusplus
}
#endif

#endif /* ifndef TMNXTYPES_H */

