##// END OF EJS Templates
stardundee 2.63 files added
stardundee 2.63 files added

File last commit:

r16:d3bf7e9eeada default
r16:d3bf7e9eeada default
Show More
star_dundee_types.h
97 lines | 3.5 KiB | text/x-c | CLexer
/******************************************************************************/
/* */
/* star_dundee_types.h */
/* */
/* This file contains the definitions of common types used by STAR-Dundee */
/* drivers and APIs. */
/* */
/* IMPORTANT NOTE: If you are experiencing compilation errors indicating */
/* that U8 is already defined, for example, please add the */
/* following line to your code prior to including this */
/* file: */
/* #define NO_STAR_TYPES */
/* Alternatively you can compile your code with a flag of */
/* -DNO_STAR_TYPES. */
/* */
/* Version 1.0, March 22nd 2007 */
/* */
/* Version 1.0 - March 22nd 2007 */
/* =========== */
/* Initial version. */
/* */
/* Copyright (2012), STAR-Dundee Ltd., */
/* STAR House, */
/* 166 Nethergate, */
/* Dundee, DD1 4EE, */
/* Scotland, UK. */
/* e-mail: support@star-dundee.com */
/* */
/******************************************************************************/
#ifndef STAR_DUNDEE_TYPES
#define STAR_DUNDEE_TYPES
typedef void *star_device_handle;
#ifndef NO_STAR_TYPES
#if (defined(__linux__) || defined(LINUX) || defined(__LINUX__)) && \
defined(__KERNEL__)
#include <linux/types.h>
/* Define U8, U16 and U32 in the Linux kernel */
typedef u8 U8;
typedef u16 U16;
typedef u32 U32;
#else
#include <limits.h>
/* Define U8 */
#if (UCHAR_MAX == 0xff)
typedef unsigned char U8;
#elif (UINT_MAX == 0xff)
typedef unsigned int U8;
#else
#error "No valid definition of U8 available"
#endif
/* Define U16 */
#if (USHRT_MAX == 0xffff)
typedef unsigned short U16;
#elif (UINT_MAX == 0xffff)
typedef unsigned int U16;
#elif (UCHAR_MAX == 0xffff)
typedef unsigned char U16;
#else
#error "No valid definition of U16 available"
#endif
/* Define U32 */
#if (UINT_MAX == 0xffffffff)
typedef unsigned int U32;
#elif (ULONG_MAX == 0xffffffff)
typedef unsigned long U32;
#elif (USHRT_MAX == 0xffffffff)
typedef unsigned short U32;
#elif (UCHAR_MAX == 0xffffffff)
typedef unsigned char U32;
#else
#error "No valid definition of U32 available"
#endif
#endif /* Linux kernel test */
#endif /* NO_STAR_TYPES */
#endif /* STAR_DUNDEE_TYPES */