/***********************************************************
 *  File Name:  SYSTEM.H
 *
 *  Version: V1.0
 *
 *  Requirements:
 *
 *
 *
 *  Description:
 *      This contains the PSC system definitions.
 *
 *  History:
 *
 *      Original          30-JAN-2001        P. Ahearn-Heyse
 *
 *
 ***********************************************************/

#ifndef _SYSTEM_H
#define _SYSTEM_H





#ifdef DEBUG
   #define DEBUGMSG(cond,printf_exp) ((void)((cond)?(printf printf_exp),1:0))
   #define PSC_ERROR(printf_exp)     (printf printf_exp)

   #define DBG_INIT    1
   #define DBG_CONFIG  1
   #define DBG_READ    1
   #define DBG_WRITE   1
   #define DBG_ERROR   1
   #define DBG_TRACE   1
#else
   #define DEBUGMSG(cond,printf_exp) ((void)0)
   #define PSC_ERROR(printf_exp)     ((void)0)

   #define DBG_INIT    0
   #define DBG_CONFIG  0
   #define DBG_READ    0
   #define DBG_WRITE   0
   #define DBG_ERROR   0
   #define DBG_TRACE   0
#endif




/**************************************************************************
 *  Elementary defines and typedefs
 **************************************************************************/
typedef enum boolean_value_enum {FALSE=0, TRUE=1} BOOL;

#ifndef VOLATILE
   #define VOLATILE volatile            /* Compiler specific keyword */
#endif

#ifndef BYTE
typedef unsigned char BYTE;
#endif

/* The following are also defined by nucleus.h */
#ifndef NUCLEUS
typedef signed char INT8;
typedef unsigned char UINT8;
typedef signed short INT16;
typedef unsigned short UINT16;
typedef signed int INT32;
typedef unsigned int UINT32;
#endif

typedef VOLATILE signed char VINT8;
typedef VOLATILE unsigned char VUINT8;
typedef VOLATILE signed short VINT16;
typedef VOLATILE unsigned short VUINT16;
typedef VOLATILE signed int VINT32;
typedef VOLATILE unsigned int VUINT32;

typedef float FLOAT32;
typedef double FLOAT64;
typedef signed long long INT64;
typedef unsigned long long UINT64;
typedef VOLATILE signed long long VINT64;
typedef VOLATILE unsigned long long VUINT64;


typedef VOLATILE UINT32 REG32;
typedef VOLATILE UINT16 REG16;
typedef VOLATILE UINT8 REG8;


#ifndef INTERRUPT
   #define INTERRUPT __interrupt__      /* Compiler-specific keyword */
//   typedef INTERRUPT void (* _ExceptionHandler)(void);
   typedef void (* _IrqHandler)(void);
#endif

#ifndef REGISTER
   #define REGISTER register
#endif



#ifndef NULL
   #define NULL ((void *)0L)
#endif



/**************************************************************************
 *  PSC defines & typedefs
 **************************************************************************/

typedef UINT32 PSCStatusType;


#define PSC_OK            0
#define PSC_FAIL          0x7FFFFFFF

#define PSC_WRONGARG      1
#define PSC_BUSY          2
#define PSC_OVERRUN       3
#define PSC_NOTSUPPORTED  4
#define PSC_EMPTY         5




#define WORDMASK_BYTE1 0xFF000000
#define WORDMASK_BYTE2 0xFF0000
#define WORDMASK_BYTE3 0xFF00
#define WORDMASK_BYTE4 0xFF

 
extern const UINT32 WordBitMaskTable[];
extern const UINT16 ShortBitMaskTable[];
extern const UINT8 ByteBitMaskTable[];


typedef enum {IO_INPUT=0, IO_OUTPUT=1} IOModeType;

typedef enum {PSC_INVALID=0,PSC1, PSC2,PSC3} PSCIDType;
typedef enum {NOT_AVAILABLE=0, AVAILABLE=1} AvailableType;

#endif
