
/*****************************************************************************
* Copyright (c) 2002 Digi International Inc., All Rights Reserved
* 
* This software contains proprietary and confidential information of Digi
* International Inc.  By accepting transfer of this copy, Recipient agrees
* to retain this software in confidence, to prevent disclosure to others,
* and to make no use of this software other than that for which it was
* delivered.  This is an unpublished copyrighted work of Digi International
* Inc.  Except as permitted by federal law, 17 USC 117, copying is strictly
* prohibited.
* 
* Restricted Rights Legend
*
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in sub-paragraph (c)(1)(ii) of The Rights in
* Technical Data and Computer Software clause at DFARS 252.227-7031 or
* subparagraphs (c)(1) and (2) of the Commercial Computer Software -
* Restricted Rights at 48 CFR 52.227-19, as applicable.
*
* Digi International Inc. 11001 Bren Road East, Minnetonka, MN 55343
*
*****************************************************************************/

/*
 * $Log: fwtypes.h,v $
 * Revision 1.13.2.1  2009/09/02 17:51:49  jrakhval
 * Moved min() and max() to minmax.h. Vantive 31471.
 *
 * Revision 1.13  2008/04/11 15:12:06  pjacobso
 * Removed from top layer of Autodoc and pushed under the BSP tab.
 *
 * Revision 1.12  2008/04/07 00:09:52  pjacobso
 * Updated Autodoc to reorganize network services under a single tab.
 *
 * Revision 1.11  2007/09/24 19:42:03  cgordon
 * synced up with netos73_branch.
 *
 * Revision 1.9.6.1  2007/09/04 20:19:23  cgordon
 * Updated for Cygwin 4.20.
 *
 * Revision 1.9  2007/02/28 19:34:44  pkrawitz
 * Fixes for NETOS_ARM builds
 *
 * Revision 1.8  2007/02/16 12:13:09  pkrawitz
 * Merge with tinyclr_arm_port_branch
 *
 * Revision 1.7  2007/01/12 22:51:25  whagstro
 * took the latest fwtypes.h from nds, moved type definitions from tx_port.h
 * and usb_types.h into this file.
 *
 * Revision 1.10  2006/12/02 00:27:51  markw
 * Add common zigbee types.
 *
 * Revision 1.9  2006/08/25 22:13:49  markw
 * Put all general types in fwtypes.h, remove them from other files.
 *
 * Revision 1.8  2006/08/25 13:20:37  netos
 * Added more BOOT_CODE protection as a temporary fix.
 *
 * Revision 1.7  2006/08/25 13:05:54  jamesp
 * Added a temporary fix for the type conflict problem introduced with
 * the fwtypes.h update on the 24th.
 *
 * Revision 1.6  2006/08/24 20:53:25  markw
 * Add windows types.
 *
 * Revision 1.5  2006/01/10 16:16:50  cgordon
 * Fixed problems caused by changes to fwtypes.h in nds module.
 *
 * Revision 1.4  2006/01/05 17:12:58  cgordon
 * Fixed build problems in AMAT32, cpd, and connwanvpn caused by changes to
 * fwtypes.h.  Problem was that some source files used things declared in
 * stdio.h and malloc.h but did not include these files.  Changed files to
 * include these files.
 *
 * Revision 1.3  2006/01/04 23:38:55  cgordon
 * Updated fwtypes.h and Npttypes.h to make it easier to share files between
 * NET+OS and NDS.  In doing this, I found that some NDS source files that
 * used NET+OS libraries were not including all of the system header files they
 * needed such as stdlib.h, malloc.h, and stdarg.h.  Updated them to include
 * the headers.
 *
 * Revision 1.2  2005/07/14 18:04:32  jamesp
 * Migrated the NDS treck branch down to become the NDS "trunk".
 *
 * Revision 1.1.4.2.2.2  2005/03/30 15:28:37  miken
 * Cygwin support, initial revision.
 *
 *
 * Revision 1.1.4.3  2005/03/29 22:24:58  netos
 * Cygwin support for NDS.
 *
 * Revision 1.1.4.2.2.1  2005/03/26 00:53:43  markw
 * Add min() and max() macros for general use.
 *
 * Revision 1.1.4.2  2004/11/07 13:24:55  jamesp
 * Merging type declaration consolidation from Amsterdam
 * branch.  "Global" primitive types are now declared in
 * arch/include/fwtypes.h.
 *
 * Revision 1.1.4.1  2004/10/19 21:36:48  jamesp
 * Types for firmware, consolidated.
 *
 * Revision 1.1.2.3  2004/07/10 20:28:14  netos
 * Fixing types in the webUI build.  Also removed
 * "isatty" from the xk_em_serl implementation
 * (because it caused a build failure).
 *
 * Revision 1.1.2.2  2004/07/10 11:20:15  jamesp
 * Modified boot to remove dependence on ARM_lib/types.h,
 * Npttypes.h, bcomm/u32.h, and ARM_lib/defs.h.  The central
 * source for types should now be arch/include/fwtypes.h.
 *
 * Revision 1.1.2.1  2004/07/09 17:36:12  jamesp
 * Retiring "include/types.h" and "bcomm/u32.h".  The new file
 * "arch/include/fwtypes.h" takes its place.  "fwtypes.h" is
 * intended to be a global repository for types in the firmware.
 * It collects the stuff from "include/types.h", "bcomm/u32.h",
 * as well as from Npttypes.h.  This new "fwtypes.h" is then
 * shared between the boot and the eos via the "arch" tree.
 *
 * Revision 1.1.2.6  2004/05/20 00:07:14  markw
 * Ensure that TRUE, FALSE, NULL are defined.
 *
 * Revision 1.1.2.5  2004/05/03 16:40:14  markw
 * Add Byte,Word,DWord types.
 *
 * Revision 1.1.2.4  2004/04/08 19:36:31  kurte
 * Added posix style types.
 *
 * Revision 1.1.2.3  2003/07/15 04:17:32  markw
 * Protect against u32.h.
 *
 * Revision 1.1.2.2  2003/05/21 23:23:36  kurte
 * Adding general hardware types.
 *
 * Revision 1.1.2.1  2003/05/08 17:25:42  markw
 * *** empty log message ***
 *
 */

#ifndef FWTYPES_H_
#define FWTYPES_H_

#if !defined(__ghs__) && !defined(__CC_ARM)
/*
 *  Begin by including the "system" types
 */
#include <sys/types.h>
#endif

#if (__GNUC__ > 3)
    #include <stdint.h>
#endif

/*
 *  Then begin declaring the firmware macros and types
 */
#ifndef TRUE
#define TRUE    1
#endif

#ifndef FALSE
#define FALSE   0
#endif

#ifndef NULL
#define NULL   0
#endif


/* This macro is used in cases where a variable length array after a struct is
   desired.  The last item in the struct will be the array, having zero
   elements.  For example:

    struct {
        ...
        char name[0];
    } s;

    Some compilers, such as MULTI 3.5, require that the 0 be omitted, as:

    struct {
        ...
        char name[];
    } s;

    Therefore, if we define UNALLOCATED_ARRAY and use it in these places,
    we can compile on all compilers that allow this construct.

    struct {
        ...
        char name[UNALLOCATED_ARRAY];
    } s;
*/
#ifndef UNALLOCATED_ARRAY
#ifdef NET_OS
#define UNALLOCATED_ARRAY
#else
#define UNALLOCATED_ARRAY 0
#endif
#endif


/*
 *  When declaring a type, the following model should be used:
 *
 *    #ifdef my_type_name
 *    #define my_type_name _0_
 *    #error
 *    #endif
 *    #ifndef my_type_name_DEFINED_
 *    #define my_type_name_DEFINED_
 *    typedef int my_type_name;
 *    #endif
 *
 *  The first portion determines whether a macro of the same name
 *  already exists, which would cause problems.  The #define to _0_
 *  _should_ cause a warning to let one know where the declaration
 *  of the existing macro is (redeclaration of a macro), followed by
 *  the #error to make sure that the compile does not continue.
 *
 *  The second portion wraps the actual typedef with a unique macro
 *  to avoid redeclaration of the type.  Note that the name of the
 *  type is a part of the unique name.
 */

/* some generic, but commonly used types */
#ifdef  uchar
#define uchar _0_
#error
#endif
#if !defined(uchar_DEFINED_) && !defined(uchar_defined_)  
#define uchar_DEFINED_
#define uchar_defined_

typedef unsigned char uchar;
#endif

#ifdef  ulong
#define ulong _0_
#error
#endif
#if !defined(ulong_DEFINED_) && !defined(ulong_defined_)
#define ulong_DEFINED_
#define ulong_defined_

typedef unsigned long ulong;
#endif

#ifdef  ulonglong
#define ulonglong _0_
#error
#endif
#if !defined(ulonglong_DEFINED_) && !defined(ulonglong_defined_)
#define ulonglong_DEFINED_
#define ulonglong_defined_

typedef unsigned long long ulonglong;
#endif
/*
 *  TYPICALLY, ushort and uint are in sys/types.h, wrapped in
 *  "#ifndef _POSIX_SOURCE".  We take advantage of that fact,
 *  and wrap the ushort and uint declarations in "#ifdef _POSIX_SOURCE"
 *  so that we get them if, for some reason, sys/types.h does not
 *  declare them.
 */
#if defined(_POSIX_SOURCE) || defined(__ghs__) || defined(__CC_ARM)

#ifdef  ushort
#define ushort _0_
#error
#endif
#if !defined(ushort_DEFINED_) && !defined(ushort_defined_)
#define ushort_DEFINED_
#define ushort_defined_

typedef unsigned short ushort;
#endif

#ifdef  uint
#define uint _0_
#error
#endif
#if !defined(uint_DEFINED_) && !defined(uint_defined_)
#define uint_DEFINED_
#define uint_defined_
/*ad*
 * Unsigned 32-bit word
 *
 * @since 6.0
 * @external
 * @category SystemSWServices:general_purpose
 *
*ad*/
typedef unsigned int uint;
#endif

#endif /* _POSIX_SOURCE */


/* define short hand style hardware types */
#ifdef  u32
#define u32 _0_
#error
#endif
#if !defined(u32_DEFINED_) && !defined(u32_defined_)
#define u32_DEFINED_
#define u32_defined_
/*ad*
 * Unsigned 32-bit word
 *
 * @since 6.0
 * @external
 * @category SystemSWServices:general_purpose
 *
*ad*/
typedef unsigned int u32;
#endif

#ifdef  u16
#define u16 _0_
#error
#endif
#if !defined(u16_DEFINED_) && !defined(u16_defined_)
#define u16_DEFINED_
#define u16_defined_

/*ad*
 * Unsigned 16-bit word
 *
 * @since 6.0
 * @external
 * @category SystemSWServices:general_purpose
 *
*ad*/
typedef unsigned short u16;
#endif

#ifdef  u8
#define u8 _0_
#error
#endif
#if !defined(u8_DEFINED_) && !defined(u8_defined_)
#define u8_DEFINED_
#define u8_defined_

/*ad*
 * Unsigned 8-bit word
 *
 * @since 6.0
 * @external
 * @category SystemSWServices:general_purpose
 *
*ad*/
typedef unsigned char u8;
#endif

#ifdef  i32
#define i32 _0_
#error
#endif
#if !defined(i32_DEFINED_) && !defined(i32_defined_)
#define i32_DEFINED_
#define i32_defined_

/*ad*
 * Signed 32-bit word
 *
 * @since 6.0
 * @external
 * @category SystemSWServices:general_purpose
 *
*ad*/
typedef int i32;
#endif

#ifdef  i16
#define i16 _0_
#error
#endif
#if !defined(i16_DEFINED_) && !defined(i16_defined_)
#define i16_DEFINED_
#define i16_defined_

/*ad*
 * Signed 16-bit word
 *
 * @since 6.0
 * @external
 * @category SystemSWServices:general_purpose
 *
*ad*/
typedef short i16;
#endif

#ifdef  i8
#define i8 _0_
#error
#endif
#if !defined(i8_DEFINED_) && !defined(i8_defined_)
#define i8_DEFINED_
#define i8_defined_

/*ad*
 * Signed 8-bit word
 *
 * @since 6.0
 * @external
 * @category SystemSWServices:general_purpose
 *
*ad*/
typedef char i8;
#endif


/* define longer style for hardware types */
#ifdef  uint64
#define uint64 _0_
#error
#endif
#if !defined(uint64_DEFINED_) && !defined(uint64_defined_)
#define uint64_DEFINED_
#define uint64_defined_

/*ad*
 * Unsigned 64-bit word
 *
 * @since 6.0
 * @external
 * @category Networking:SNMP
 *
*ad*/
typedef unsigned long long uint64;
#endif

#ifdef  uint32
#define uint32 _0_
#error
#endif
#if !defined(uint32_DEFINED_) && !defined(uint32_defined_)
#define uint32_DEFINED_
#define uint32_defined_

/*ad*
 * Unsigned 32-bit word
 *
 * @since 6.0
 * @external
 * @category Networking:SNMP
 *
*ad*/
typedef unsigned int uint32;
#endif

#ifdef  int64
#define int64 _0_
#error
#endif
#if !defined(int64_DEFINED_) && !defined(int64_defined_)
#define int64_DEFINED_
#define int64_defined_

/*ad*
 * Signed 64-bit word
 *
 * @since 6.0
 * @external
 * @category Networking:SNMP
 *
*ad*/
typedef signed long long int64;
#endif

#ifdef  int32
#define int32 _0_
#error
#endif
#if !defined(int32_DEFINED_) && !defined(int32_defined_)
#define int32_DEFINED_
#define int32_defined_

/*ad*
 * Signed 32-bit word
 *
 * @since 6.0
 * @external
 * @category Networking:SNMP
 *
*ad*/
typedef int int32;
#endif

#ifdef  uint16
#define uint16 _0_
#error
#endif
#if !defined(uint16_DEFINED_) && !defined(uint16_defined_)
#define uint16_DEFINED_
#define uint16_defined_

/*ad*
 * Unsigned 16-bit word
 *
 * @since 6.0
 * @external
 * @category Networking:SNMP
 *
*ad*/
typedef unsigned short uint16;
#endif

#ifdef  int16
#define int16 _0_
#error
#endif
#if !defined(int16_DEFINED_) && !defined(int16_defined_)
#define int16_DEFINED_
#define int16_defined_

/*ad*
 * Unsigned 16-bit word
 *
 * @since 6.0
 * @external
 * @category Networking:SNMP
 *
*ad*/
typedef short int16;
#endif

#ifdef  uint8
#define uint8 _0_
#error
#endif
#if !defined(uint8_DEFINED_) && !defined(uint8_defined_)
#define uint8_DEFINED_
#define uint8_defined_

/*ad*
 * Unsigned 8-bit word
 *
 * @since 6.0
 * @external
 * @category Networking:SNMP
 *
*ad*/
typedef unsigned char uint8;
#endif

#ifdef  int8
#define int8 _0_
#error
#endif
#if !defined(int8_DEFINED_) && !defined(int8_defined_)
#define int8_DEFINED_
#define int8_defined_
/*ad*
 * Signed 8-bit word
 *
 * @since 6.0
 * @external
 * @category Networking:SNMP
 *
*ad*/
typedef char int8;
#endif


#if !defined( _SIZE_T_DEFINED_) && !defined(__ghs__) && !defined(__CC_ARM)
  typedef __SIZE_TYPE__		size_t;
  #define _SIZE_T_DEFINED_
#endif


/* define a union that is useful for pulling apart values */  
#ifdef  dword_union_t
#define dword_union_t _0_
#error
#endif
#if !defined(dword_union_t_DEFINED_) && !defined(dword_union_t_defined_)
#define dword_union_t_DEFINED_
#define dword_union_t_defined_
typedef union
{
    u32 dw;
    u16 w[2];
    u8 b[4];
} dword_union_t;
#endif

#if (__GNUC__ <= 3)

/* posix style types */

/*
 *  int8_t, int16_t and int32_t are required by the EDP code,
 *  but are not supplied by the cross-compiler version of
 *  sys/types.h.  Unfortunately, they _are_ present in Linux,
 *  so we get type conflicts when building our Linux tools.
 *  We use the Linux #define to predict when these need to
 *  be defined... this is NOT foolproof!!
 */
#if !defined(__int8_t_defined) && !defined(__int8_t_DEFINED)
#define __int8_t_defined
#define __int8_t_DEFINED

#ifdef  int32_t
#define int32_t _0_
#error
#endif
#if !defined(int32_t_DEFINED_) && !defined(int32_t_defined_) && !defined(__int32_t_defined)
#define int32_t_DEFINED_
#define int32_t_defined_
#define __int32_t_defined
/*ad*
 * Signed 32-bit word
 *
 * @since 6.0
 * @external
 * @category SystemSWServices:general_purpose
 *
*ad*/
typedef int int32_t;
#endif

#ifdef  int16_t
#define int16_t _0_
#error
#endif
#if !defined(int16_t_DEFINED_) && !defined(int16_t_defined_)
#define int16_t_DEFINED_
#define int16_t_defined_
/*ad*
 * Signed 16-bit word
 *
 * @since 6.0
 * @external
 * @category SystemSWServices:general_purpose
 *
*ad*/
typedef short int int16_t;
#endif

#ifdef  int8_t
#define int8_t _0_
#error
#endif
#if !defined(int8_t_DEFINED_) && !defined(int8_t_defined_)
#define int8_t_DEFINED_
#define int8_t_defined_
/*ad*
 * Signed 8-bit word/char
 *
 * @since 6.0
 * @external
 * @category SystemSWServices:general_purpose
 *
*ad*/
typedef signed char int8_t;
#endif

#endif /* __int8_t_defined */


#ifdef  uint32_t
#define uint32_t _0_
#error
#endif
#if !defined(uint32_t_DEFINED_) && !defined(uint32_t_defined_) && !defined(__uint32_t_defined)
#define uint32_t_DEFINED_
#define uint32_t_defined_
#define __uint32_t_defined
/*ad*
 * Unsigned 32-bit word
 *
 * @since 6.0
 * @external
 * @category SystemSWServices:general_purpose
 *
*ad*/
typedef unsigned int uint32_t;
#endif

#ifdef  uint16_t
#define uint16_t _0_
#error
#endif
#if !defined(uint16_t_DEFINED_) && !defined(uint16_t_defined_)
#define uint16_t_DEFINED_
#define uint16_t_defined_
/*ad*
 * Unsigned 16-bit word
 *
 * @since 6.0
 * @external
 * @category SystemSWServices:general_purpose
 *
*ad*/
typedef unsigned short uint16_t;
#endif

#ifdef  uint8_t
#define uint8_t _0_
#error
#endif
#if !defined(uint8_t_DEFINED_) && !defined(uint8_t_defined_)
#define uint8_t_DEFINED_
#define uint8_t_defined_
/*ad*
 * Unsigned 8-bit word/character
 *
 * @since 6.0
 * @external
 * @category SystemSWServices:general_purpose
 *
*ad*/
typedef unsigned char uint8_t;
#endif


#endif   /* (__GNUC__ <= 3) */

/* DWord style types */
#ifdef  Byte
#define Byte _0_
#error
#endif
#ifndef Byte_DEFINED_
#define Byte_DEFINED_

typedef unsigned char	Byte;
#endif

#ifdef  sByte
#define sByte _0_
#error
#endif
#ifndef sByte_DEFINED_
#define sByte_DEFINED_

typedef signed char	sByte;
#endif

#ifdef  Word
#define Word _0_
#error
#endif
#ifndef Word_DEFINED_
#define Word_DEFINED_

typedef unsigned short	Word;
#endif

#ifdef  sWord
#define sWord _0_
#error
#endif
#ifndef sWord_DEFINED_
#define sWord_DEFINED_

typedef signed short	sWord;
#endif

#ifdef  DWord
#define DWord _0_
#error
#endif
#ifndef DWord_DEFINED_
#define DWord_DEFINED_
/*ad*
 * Unsigned 32-bit word
 *
 * @since 6.0
 * @external
 * @category SystemSWServices:general_purpose
 *
*ad*/
typedef unsigned long	DWord;
#endif

#ifdef  sDWord
#define sDWord _0_
#error
#endif
#ifndef sDWord_DEFINED_
#define sDWord_DEFINED_
/*ad*
 * Signed 32-bit word
 *
 * @since 6.0
 * @external
 * @category SystemSWServices:general_purpose
 *
*ad*/
typedef signed long	sDWord;
#endif

#ifdef  uInt
#define uInt _0_
#error
#endif
#ifndef uInt_DEFINED_
#define uInt_DEFINED_
typedef unsigned int	uInt;
#endif

#ifdef  Booli
#define Booli _0_
#error
#endif
#ifndef Booli_DEFINED_
#define Booli_DEFINED_
typedef int		Booli;
#endif

#ifdef  booli
#define booli _0_
#error
#endif
#ifndef booli_DEFINED_
#define booli_DEFINED_

typedef int		booli;
#endif

#ifdef  BOOLEAN
#define BOOLEAN _0_
#error
#endif
#ifndef BOOLEAN_DEFINED_
#define BOOLEAN_DEFINED_
/*ad*
 * Boolean type. This type is used for variables that can only be either TRUE or FALSE.
 *
 * @since 6.0
 * @external
 * @category SystemSWServices:general_purpose
 *
*ad*/
typedef int		BOOLEAN;
#endif

#ifdef  BOOL
#define BOOL _0_
#error
#endif
#ifndef BOOL_DEFINED_
#define BOOL_DEFINED_
/*ad*
 * Boolean type. This type is used for variables that can only be either TRUE or FALSE.
 *
 * @since 6.0
 * @external
 * @category SystemSWServices:general_purpose
 *
*ad*/
typedef int BOOL;
#endif

#ifdef  PBOOL
#define PBOOL _0_
#error
#endif
#ifndef PBOOL_DEFINED_
#define PBOOL_DEFINED_
typedef BOOL			*PBOOL;
#endif

/* NET+OS style types */
#ifdef  INT8
#define INT8 _0_
#error
#endif
#ifndef INT8_DEFINED_
#define INT8_DEFINED_
/*ad*
 * Defines the 8-bit integer type used in the firmware.
 *
 * @external
 * @category SystemSWServices:general_purpose
 * @since 1.0
*ad*/
typedef char		INT8;
#endif

#ifdef  INT16
#define INT16 _0_
#error
#endif
#ifndef INT16_DEFINED_
#define INT16_DEFINED_
/*ad*
 * Defines the 16-bit integer type used in the firmware.
 *
 * @external
 * @category SystemSWServices:general_purpose
 * @since 1.0
*ad*/
typedef short int	INT16;
#endif

#ifdef  INT32
#define INT32 _0_
#error
#endif
#ifndef INT32_DEFINED_
#define INT32_DEFINED_
/*ad*
 * Defines the 32-bit integer type used in the firmware.
 *
 * @external
 * @category SystemSWServices:general_purpose
 * @since 1.0
*ad*/
typedef long int	INT32;
#endif

#ifdef  WORD8
#define WORD8 _0_
#error
#endif
#ifndef WORD8_DEFINED_
#define WORD8_DEFINED_
/*ad*
 * Defines the unsigned 8-bit integer used in the firmware.
 *
 * @external
 * @category SystemSWServices:general_purpose
 * @since 1.0 
*ad*/
typedef unsigned char	WORD8;
#endif

#ifdef  BYTE
#define BYTE _0_
#error
#endif
#ifndef BYTE_DEFINED_
#define BYTE_DEFINED_
/*ad*
 * Defines an unsigned 8-bit integer used in the firmware.
 *
 * @external
 * @category SystemSWServices:general_purpose
 * @since 1.0 
*ad*/
typedef unsigned char	BYTE;
#endif

#ifdef  WORD16
#define WORD16 _0_
#error
#endif
#ifndef WORD16_DEFINED_
#define WORD16_DEFINED_
/*ad*
 * Defines the 16-bit unsigned integer used in the firmware.
 *
 * @external
 * @category SystemSWServices:general_purpose
 * @since 1.0 
*ad*/
typedef short unsigned	WORD16;
#endif

#ifdef  WORD32
#define WORD32 _0_
#error
#endif
#ifndef WORD32_DEFINED_
#define WORD32_DEFINED_
/*ad*
 * Defines the 32-bit unsigned integer used in the firmware.
 *
 * @external
 * @category SystemSWServices:general_purpose
 * @since 1.0 
*ad*/
typedef long unsigned	WORD32;
#endif

/*
 * Define MAN_LITTLE_ENDIAN if the compiler has been configured for little
 * endian support.
 */
#if defined(__ghs__) || defined(__CC_ARM)
    #ifdef _LittleEndian
        #define NPT_LITTLE_ENDIAN
    #endif
#endif
#ifndef NETOS_GNU_TOOLS
    #if defined(__arm) || defined(__CC_ARM)
        #ifndef __BIG_ENDIAN
            #define NPT_LITTLE_ENDIAN
        #endif
    #endif
#endif

#ifdef  WORD64
#define WORD64 _0_
#error
#endif
#ifndef WORD64_DEFINED_
#define WORD64_DEFINED_

#ifdef NPT_LITTLE_ENDIAN
/*ad*
 * Substructure of WORD64
 *
 * This structure is used to define a field in the WORD64
 * enum.  It breaks a 64-bit bit value into two 32-bit 
 * values.
 *
 * @external
 * @category SystemSWServices:general_purpose
 * @since 5.0 
 *
 * @param   lsw     Least significant 32 bits
 * @param   msw     Most significant 32 bits
*ad*/
typedef struct
{
    WORD32 lsw;             /* least significant word*/
    WORD32 msw;             /* most signficant word*/
} WORD64_S;
#else
typedef struct
{
    WORD32 msw;             /* most significant word*/
    WORD32 lsw;             /* least signficant word*/
} WORD64_S;
#endif

#ifdef WIN32
#undef WORD64
typedef union
{
    WORD64_S s;
    WORD32  array[2];               /* data value as an array*/
    double  x;						/* true 64-bit unsigned supported by ARM compiler*/
} WORD64;
#else
/*ad*
 * Unsigned 64-bit word
 *
 * This type defines an unsigned 64-bit word.
 *
 * @external
 * @category SystemSWServices:general_purpose
 * @since 5.0 
 *
 * @param   s       64-bit word as structure with 2 32-bit words
 * @param   array   64-bit word as array of 2 32-bit words
 * @param   x       64-bit word as an unsigned long long for compilers that support this type
*ad*/
typedef union
{
    WORD64_S s;
    WORD32  array[2];               /* data value as an array*/
    unsigned long long x;           /* true 64-bit unsigned supported by ARM compiler*/
} WORD64;
#endif
#endif /* WORD64_DEFINED_ */


#ifdef  INT64
#define INT64 _0_
#error
#endif
#ifndef INT64_DEFINED_
#define INT64_DEFINED_

#ifdef NPT_LITTLE_ENDIAN
/*ad*
 * Substructure of INT64
 *
 * This structure is used to define a field in the INT64
 * enum.  It breaks a 64-bit bit value into two 32-bit 
 * values.
 *
 * @external
 * @category SystemSWServices:general_purpose
 * @since 5.0 
 *
 * @param   lsw     Least significant 32 bits
 * @param   msw     Most significant 32 bits
*ad*/
typedef struct
{
    WORD32 lsw;             /* least significant word*/
    WORD32 msw;             /* most signficant word*/
} INT64_S;
#else
typedef struct
{
    WORD32 msw;             /* most significant word*/
    WORD32 lsw;             /* least signficant word*/
} INT64_S;
#endif


#ifdef WIN32
#undef INT64
#if 0
typedef union
{
    INT64_S s;
    WORD32  array[2];               /* data value as an array*/
    double x;                    /* true 64-bit int supported by ARM compiler*/
} INT64;
#endif
#else
/*ad*
 * Signed 64-bit integer
 *
 * This type defines a signed 64-bit integer.
 *
 * @external
 * @category SystemSWServices:general_purpose
 * @since 5.0 
 *
 * @param   s       64-bit word as structure with 2 32-bit words
 * @param   array   64-bit word as array of 2 32-bit words
 * @param   x       64-bit word as long long for compilers that support this type
*ad*/
typedef union
{
    INT64_S s;
    WORD32  array[2];               /* data value as an array*/
    long long x;                    /* true 64-bit int supported by ARM compiler*/
} INT64;
#endif
#endif /* INT64_DEFINED_ */


#ifdef float32
#define float32 _0_
#error 
#endif
#ifndef float32_DEFINED_
#define float32_DEFINED_
typedef float		float32;
#endif


#ifdef float64
#define float64 _0_
#error 
#endif
#ifndef float64_DEFINED_
#define float64_DEFINED_
typedef double		float64;
#endif

#if !defined(_BSDTYPES_DEFINED)
#ifdef u_short
    #define u_short _0_
    #error
#endif
#ifndef u_short_DEFINED_
#define u_short_DEFINED_
/*ad*
 * Unsigned 16-bit integer type
 *
 * @external
 * @category SystemSWServices:general_purpose
 * @since 6.0
*ad*/
typedef short unsigned u_short;
#endif

#ifdef u_long
    #define u_long _0_
    #error
#endif
#ifndef u_long_DEFINED_
#define u_long_DEFINED_
/*ad*
 * Unsigned 32-bit integer type
 *
 * @external
 * @category SystemSWServices:general_purpose
 * @since 6.0
*ad*/
typedef long unsigned u_long;
#endif


#ifdef u_char
    #define u_char _0_
    #error
#endif
#ifndef u_char_DEFINED_
#define u_char_DEFINED_
/*ad*
 * Unsigned 8-bit word/character type
 *
 * @external
 * @category SystemSWServices:general_purpose
 * @since 6.0
*ad*/
typedef unsigned char u_char;
#endif


#ifdef u_int
    #define u_int _0_
    #error
#endif
#ifndef u_int_DEFINED_
#define u_int_DEFINED_
/*ad*
 * Signed 32-bit integer type.
 *
 * @external
 * @category SystemSWServices:general_purpose
 * @since 6.0
*ad*/
typedef unsigned u_int;
#endif

#endif /*!defined(_BSDTYPES_DEFINED)*/

#if defined(__ghs__) || defined(__CC_ARM)

#ifdef caddr_t
    #define caddr_t _0_
    #error
#endif
#ifndef caddr_t_DEFINED_
#define caddr_t_DEFINED_
/*ad*
 * Character pointer type.
 *
 * @external
 * @category SystemSWServices:general_purpose
 * @since 6.0
*ad*/
typedef char *   caddr_t;
#endif

#endif

#ifdef bufp_t
    #define bufp_t _0_
    #error
#endif
#ifndef bufp_t_DEFINED_
#define bufp_t_DEFINED_
/*ad*
 * Buffer pointer type.
 *
 * @external
 * @category SystemSWServices:general_purpose
 * @since 6.0
*ad*/
typedef unsigned char * bufp_t;
#endif

// 64-bit extended device address
#define	ZB_ADDR_SIZE	8
#ifdef addr64_
    #define addr64_ _0_
    #error
#endif
#ifndef addr64_DEFINED_
#define addr64_DEFINED_
typedef u8 addr64[ZB_ADDR_SIZE];
#endif

#ifdef ZbMessageType_
    #define ZbMessageType_ _0_
    #error
#endif
#ifndef ZbMessageType_DEFINED_
#define ZbMessageType_DEFINED_
typedef enum {
	ZB_MSG_NONE,
	ZB_MSG_UNICAST,
	ZB_MSG_BROADCAST,
	ZB_MSG_MULTICAST
} ZbMessageType;
#endif

	/*
	 * WDM / NT style types
	 */

#ifdef  SCHAR
#define SCHAR _0_
#error
#endif
#ifndef SCHAR_DEFINED_
#define SCHAR_DEFINED_
typedef signed char		SCHAR;
#endif

#ifdef  CHAR
#define CHAR _0_
#error
#endif
#ifndef CHAR_DEFINED_
#define CHAR_DEFINED_
typedef char		CHAR;
#endif

#ifdef  INT
#define INT _0_
#error
#endif
#ifndef INT_DEFINED_
#define INT_DEFINED_
typedef int		INT;
#endif

#ifdef  SHORT
#define SHORT _0_
#error
#endif
#ifndef SHORT_DEFINED_
#define SHORT_DEFINED_
typedef short int	SHORT;
#endif

#ifdef  LONG
#define LONG _0_
#error
#endif
#ifndef LONG_DEFINED_
#define LONG_DEFINED_
typedef long int	LONG;
#endif

#ifdef  LONGLONG
#define LONGLONG _0_
#error
#endif
#ifndef LONGLONG_DEFINED_
#define LONGLONG_DEFINED_
typedef long long		LONGLONG;
#endif

#ifdef  UCHAR
#define UCHAR _0_
#error
#endif
#ifndef UCHAR_DEFINED_
#define UCHAR_DEFINED_
typedef unsigned char	UCHAR;
#endif

#ifdef  UINT
#define UINT _0_
#error
#endif
#ifndef UINT_DEFINED_
#define UINT_DEFINED_
typedef unsigned int	UINT;
#endif

#ifdef  USHORT
#define USHORT _0_
#error
#endif
#ifndef USHORT_DEFINED_
#define USHORT_DEFINED_
typedef unsigned short USHORT;
#endif

#ifdef  ULONG
#define ULONG _0_
#error
#endif
#ifndef ULONG_DEFINED_
#define ULONG_DEFINED_
typedef unsigned long	ULONG;
#endif

#ifdef  ULONGLONG
#define ULONGLONG _0_
#error
#endif
#ifndef ULONGLONG_DEFINED_
#define ULONGLONG_DEFINED_
typedef unsigned long long	ULONGLONG;
#endif

#ifdef  WORD
#define WORD _0_
#error
#endif
#ifndef WORD_DEFINED_
#define WORD_DEFINED_
typedef unsigned short		WORD;
#endif

#ifdef  DWORD
#define DWORD _0_
#error
#endif
#ifndef DWORD_DEFINED_
#define DWORD_DEFINED_
typedef unsigned long		DWORD;
#endif

#ifdef  FLONG
#define FLONG _0_
#error
#endif
#ifndef FLONG_DEFINED_
#define FLONG_DEFINED_
typedef unsigned long		FLONG;
#endif

#ifdef  PSCHAR
#define PSCHAR _0_
#error
#endif
#ifndef PSCHAR_DEFINED_
#define PSCHAR_DEFINED_
typedef signed char		*PSCHAR;
#endif

#ifdef  PCHAR
#define PCHAR _0_
#error
#endif
#ifndef PCHAR_DEFINED_
#define PCHAR_DEFINED_
typedef char			*PCHAR;
#endif

#ifdef  PSHORT
#define PSHORT _0_
#error
#endif
#ifndef PSHORT_DEFINED_
#define PSHORT_DEFINED_
typedef short int		*PSHORT;
#endif

#ifdef  PLONG
#define PLONG _0_
#error
#endif
#ifndef PLONG_DEFINED_
#define PLONG_DEFINED_
typedef long int		*PLONG;
#endif

#ifdef  PLONGLONG
#define PLONGLONG _0_
#error
#endif
#ifndef PLONGLONG_DEFINED_
#define PLONGLONG_DEFINED_
typedef long long		*PLONGLONG;
#endif

#ifdef  PINT
#define PINT _0_
#error
#endif
#ifndef PINT_DEFINED_
#define PINT_DEFINED_
typedef INT			*PINT;
#endif

#ifdef  PWORD
#define PWORD _0_
#error
#endif
#ifndef PWORD_DEFINED_
#define PWORD_DEFINED_
typedef WORD			*PWORD;
#endif

#ifdef  PDWORD
#define PDWORD _0_
#error
#endif
#ifndef PDWORD_DEFINED_
#define PDWORD_DEFINED_
typedef DWORD			*PDWORD;
#endif

#ifdef  PFLONG
#define PFLONG _0_
#error
#endif
#ifndef PFLONG_DEFINED_
#define PFLONG_DEFINED_
typedef FLONG			*PFLONG;
#endif

#ifdef  PUINT
#define PUINT _0_
#error
#endif
#ifndef PUINT_DEFINED_
#define PUINT_DEFINED_
typedef UINT			*PUINT;
#endif


#ifdef  LARGE_INTEGER
#define LARGE_INTEGER _0_
#error
#endif
#ifndef LARGE_INTEGER_DEFINED_
#define LARGE_INTEGER_DEFINED_
typedef union _LARGE_INTEGER {
    struct {
        ULONG LowPart;
        LONG HighPart;
    };
    struct {
        ULONG LowPart;
        LONG HighPart;
    } u;
    LONGLONG QuadPart;
} LARGE_INTEGER, *PLARGE_INTEGER;
#endif

#ifdef  ULARGE_INTEGER
#define ULARGE_INTEGER _0_
#error
#endif
#ifndef ULARGE_INTEGER_DEFINED_
#define ULARGE_INTEGER_DEFINED_
typedef union _ULARGE_INTEGER {

    struct {
        ULONG LowPart;
        ULONG HighPart;
    };

    struct {
        ULONG LowPart;
        ULONG HighPart;
    } u;
    ULONGLONG QuadPart;
} ULARGE_INTEGER, *PULARGE_INTEGER;
#endif


#ifdef  PUCHAR
#define PUCHAR _0_
#error
#endif
#ifndef PUCHAR_DEFINED_
#define PUCHAR_DEFINED_
typedef unsigned char	*PUCHAR;
#endif

#ifdef  PUSHORT
#define PUSHORT _0_
#error
#endif
#ifndef PUSHORT_DEFINED_
#define PUSHORT_DEFINED_
typedef unsigned short	*PUSHORT;
#endif

#ifdef  PULONG
#define PULONG _0_
#error
#endif
#ifndef PULONG_DEFINED_
#define PULONG_DEFINED_
typedef unsigned long	*PULONG;
#endif

#ifdef  PULONGLONG
#define PULONGLONG _0_
#error
#endif
#ifndef PULONGLONG_DEFINED_
#define PULONGLONG_DEFINED_
typedef unsigned long long		*PULONGLONG;
#endif

#ifndef VOID
#define VOID void
typedef void			*PVOID;
#endif

// Firmware version number
#ifdef VERSION_NUMBER
#define VERSION_NUMBER _0_
#error
#endif
#ifndef VERSION_NUMBER_DEFINED_
#define VERSION_NUMBER_DEFINED_
typedef struct _VERSION_NUMBER {

    unsigned char	MajorVer;
	unsigned char	MinorVer;
	unsigned short	BuildNumber;

} VERSION_NUMBER, *PVERSION_NUMBER;
#endif

	// Define IN and OUT keywords for documenting
	// whether function arguments are used for
	// Input or Output, and OPTIONAL to indicate
	// an argument may be NULL.

#ifndef IN
#define IN
#endif

#ifndef OUT
#define OUT
#endif

#ifndef OPTIONAL
#define OPTIONAL
#endif

#endif /* FWTYPES_H_ */
