/** ###################################################################
**     THIS COMPONENT MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
**     Filename  : PE_Types.H
**     Project   : ProcessorExpert
**     Processor : MCF52233CAF60
**     Component : PE_Types
**     Version   : Driver 01.00
**     Compiler  : CodeWarrior MCF C Compiler
**     Date/Time : 26. 3. 2010, 17:30
**     Abstract  :
**         PE_Types.h - contains definitions of basic types,
**         register access macros and hardware specific macros
**         which can be used in user application.
**     Settings  :
**     Contents  :
**         No public methods
**
**     Copyright : 1997 - 2010 Freescale Semiconductor, Inc. All Rights Reserved.
**
**     http      : www.freescale.com
**     mail      : support@freescale.com
** ###################################################################*/

#ifndef __PE_Types_H
#define __PE_Types_H

/*lint -save -e960 Disable MISRA rule 98 checking */
/* Standard ANSI C types */
#include <stdint.h>
#include "FreeRTOS.h"

#ifndef FALSE
  #define  FALSE  0x00                 /* Boolean value FALSE. FALSE is defined always as a zero value. */
#endif
#ifndef TRUE
  #define  TRUE   0x01                 /* Boolean value TRUE. TRUE is defined always as a non zero value. */
#endif

#ifndef NULL
  #define  NULL   0x00
#endif

#if ((!_MSL_LONGLONG) && (!_EWL_LONGLONG))
typedef unsigned long long      uint64_t;
#endif
/* PE types definition */
#ifndef __cplusplus
typedef unsigned char           bool;
#endif
typedef unsigned char           byte;
typedef unsigned short          word;
typedef unsigned long           dword;
typedef unsigned long long      dlong;
typedef unsigned char           TPE_ErrCode;



/**********************************************************/
/* Uniform multiplatform 8-bits peripheral access macros */
/**********************************************************/

#define setReg8Bit(RegName, BitName)                            (RegName |= (byte)(RegName##_##BitName##_##BITMASK))
#define clrReg8Bit(RegName, BitName)                            (RegName &= (byte)(~RegName##_##BitName##_##BITMASK))
#define invertReg8Bit(RegName, BitName)                         (RegName ^= (byte)(RegName##_##BitName##_##BITMASK))
#define testReg8Bit(RegName, BitName)                           (RegName & RegName##_##BitName##_##BITMASK)

/* Whole peripheral register access macros */
#define setReg8(RegName, val)                                   (RegName = (byte)(val))
#define getReg8(RegName)                                        (RegName)

/* Bits peripheral register access macros */
#define testReg8Bits(RegName, GetMask)                          (RegName & (byte)(GetMask))
#define clrReg8Bits(RegName, ClrMask)                           (RegName &= (byte)(~(byte)(ClrMask)))
#define setReg8Bits(RegName, SetMask)                           (RegName |= (byte)(SetMask))
#define invertReg8Bits(RegName, InvMask)                        (RegName ^= (byte)(InvMask))
#define clrSetReg8Bits(RegName, ClrMask, SetMask)               (RegName = (byte)((RegName & (~(byte)(ClrMask))) | (byte)(SetMask)))
#define seqClrSetReg8Bits(RegName, BitsMask, BitsVal)           ( RegName &= (byte)(~((~(byte)(BitsVal)) & (byte)(BitsMask))),\
                                                                 RegName |= (byte)((byte)(BitsVal) & (byte)(BitsMask)) )
#define seqSetClrReg8Bits(RegName, BitsMask, BitsVal)           ( RegName |= (byte)((byte)(BitsVal) & (byte)(BitsMask)),\
                                                                 RegName &= (byte)(~(~(byte)(BitsVal) & (byte)(BitsMask))) )
#define seqResetSetReg8Bits(RegName, BitsMask, BitsVal)         ( RegName &= (byte)(~(byte)(BitsMask)),\
                                                                 RegName |= (byte)((byte)(BitsVal) & (byte)(BitsMask)) )
#define clrReg8BitsByOne(RegName, ClrMask, BitsMask)            (RegName &= (byte)((byte)(ClrMask) & (byte)(BitsMask)))

/* Bit group peripheral register access macros */
#define testReg8BitGroup(RegName, GroupName)                    (RegName & RegName##_##GroupName##_##GRPMASK)
#define getReg8BitGroupVal(RegName, GroupName)                  ((RegName & RegName##_##GroupName##_##GRPMASK) >> RegName##_##GroupName##_##GRPPOS)
#define setReg8BitGroupVal(RegName, GroupName, GroupVal)        (RegName = (byte)((RegName & ~RegName##_##GroupName##_##GRPMASK) | ((byte)(GroupVal) << RegName##_##GroupName##_##GRPPOS)))
#define seqClrSetReg8BitGroupVal(RegName,GroupName,GroupVal)    ( RegName &= (byte)(~(~((byte)(GroupVal) << RegName##_##GroupName##_##GRPPOS) & RegName##_##GroupName##_##GRPMASK)),\
                                                                 RegName |= (byte)(((byte)(GroupVal) << RegName##_##GroupName##_##GRPPOS) & RegName##_##GroupName##_##GRPMASK) )
#define seqSetClrReg8BitGroupVal(RegName,GroupName,GroupVal)    ( RegName |= (byte)(((byte)(GroupVal) << RegName##_##GroupName##_##GRPPOS) & RegName##_##GroupName##_##GRPMASK),\
                                                                 RegName &= (byte)(~(~((byte)(GroupVal) << RegName##_##GroupName##_##GRPPOS) & RegName##_##GroupName##_##GRPMASK)) )
#define seqResetSetReg8BitGroupVal(RegName,GroupName,GroupVal)  ( RegName &= (byte)(~RegName##_##GroupName##_##GRPMASK),\
                                                                 RegName |= (byte)(((byte)(GroupVal) << RegName##_##GroupName##_##GRPPOS) & RegName##_##GroupName##_##GRPMASK) )

/* Peripheral access macros based on the memory address */
#define periphMemWrite8(Address, Val)                           (*((volatile uint8_t *)(Address)) = (uint8_t)(Val))
#define periphMemRead8(Address)                                 (*((volatile uint8_t *)(Address)))
#define periphBitsClr8(Address, ClrMask)                        (*((volatile uint8_t *)(Address)) &= (uint8_t)(~(uint8_t)(ClrMask)))
#define periphBitsSet8(Address, SetMask)                        (*((volatile uint8_t *)(Address)) |= (uint8_t)(SetMask))
#define periphBitsTest8(Address, GetMask)                       (*((volatile uint8_t *)(Address)) & (uint8_t)(GetMask))


/**********************************************************/
/* Uniform multiplatform 16-bits peripheral access macros */
/**********************************************************/

#define setReg16Bit(RegName, BitName)                           (RegName |= (word)(RegName##_##BitName##_##BITMASK))
#define clrReg16Bit(RegName, BitName)                           (RegName &= (word)(~RegName##_##BitName##_##BITMASK))
#define invertReg16Bit(RegName, BitName)                        (RegName ^= (word)(RegName##_##BitName##_##BITMASK))
#define testReg16Bit(RegName, BitName)                          (RegName & RegName##_##BitName##_##BITMASK)

/* Whole peripheral register access macros */
#define setReg16(RegName, val)                                   (RegName = (word)(val))
#define getReg16(RegName)                                        (RegName)

/* Bits peripheral register access macros */
#define testReg16Bits(RegName, GetMask)                          (RegName & (word)(GetMask))
#define clrReg16Bits(RegName, ClrMask)                           (RegName &= (word)(~(word)(ClrMask)))
#define setReg16Bits(RegName, SetMask)                           (RegName |= (word)(SetMask))
#define invertReg16Bits(RegName, InvMask)                        (RegName ^= (word)(InvMask))
#define clrSetReg16Bits(RegName, ClrMask, SetMask)               (RegName = (word)((RegName & (word)((~(word)(ClrMask))) | (word)(SetMask))))
#define seqClrSetReg16Bits(RegName, BitsMask, BitsVal)           ( RegName &= (word)(~(word)(~(word)(BitsVal) & (word)(BitsMask))),\
                                                                 RegName |= (word)((word)(BitsVal) & (word)(BitsMask)) )
#define seqSetClrReg16Bits(RegName, BitsMask, BitsVal)           ( RegName |= (word)((word)(BitsVal) & (word)(BitsMask)),\
                                                                 RegName &= (word)(~(~(word)(BitsVal) & (word)(BitsMask))) )
#define seqResetSetReg16Bits(RegName, BitsMask, BitsVal)         ( RegName &= (word)(~(word)(BitsMask)),\
                                                                 RegName |= (word)((word)(BitsVal) & (word)(BitsMask)) )
#define clrReg16BitsByOne(RegName, ClrMask, BitsMask)            (RegName &= (word)((word)(ClrMask) & (word)(BitsMask)))

/* Bit group peripheral register access macros */
#define testReg16BitGroup(RegName, GroupName)                    (RegName & (word)(RegName##_##GroupName##_##GRPMASK)
#define getReg16BitGroupVal(RegName, GroupName)                  ((RegName & RegName##_##GroupName##_##GRPMASK) >> RegName##_##GroupName##_##GRPPOS)
#define setReg16BitGroupVal(RegName, GroupName, GroupVal)        (RegName = (word)((RegName & ~RegName##_##GroupName##_##GRPMASK) | ((word)(GroupVal) << RegName##_##GroupName##_##GRPPOS)))
#define seqClrSetReg16BitGroupVal(RegName,GroupName,GroupVal)    ( RegName &= (word)(~(~((word)(GroupVal) << RegName##_##GroupName##_##GRPPOS) & RegName##_##GroupName##_##GRPMASK)),\
                                                                 RegName |= (word)(((word)(GroupVal) << RegName##_##GroupName##_##GRPPOS) & RegName##_##GroupName##_##GRPMASK) )
#define seqSetClrReg16BitGroupVal(RegName,GroupName,GroupVal)    ( RegName |= (word)(((word)(GroupVal) << RegName##_##GroupName##_##GRPPOS) & RegName##_##GroupName##_##GRPMASK),\
                                                                 RegName &= (word)(~(~((word)(GroupVal) << RegName##_##GroupName##_##GRPPOS) & RegName##_##GroupName##_##GRPMASK)) )
#define seqResetSetReg16BitGroupVal(RegName,GroupName,GroupVal)  ( RegName &= (word)(~RegName##_##GroupName##_##GRPMASK),\
                                                                 RegName |= (word)(((word)(GroupVal) << RegName##_##GroupName##_##GRPPOS) & RegName##_##GroupName##_##GRPMASK) )

/* Peripheral access macros based on the memory address */
#define periphMemWrite16(Address, Val)                           (*((volatile uint16_t *)(Address)) = (uint16_t)(Val))
#define periphMemRead16(Address)                                 (*((volatile uint16_t *)(Address)))
#define periphBitsClr16(Address, ClrMask)                        (*((volatile uint16_t *)(Address)) &= (uint16_t)(~(uint16_t)(ClrMask)))
#define periphBitsSet16(Address, SetMask)                        (*((volatile uint16_t *)(Address)) |= (uint16_t)(SetMask))
#define periphBitsTest16(Address, GetMask)                       (*((volatile uint16_t *)(Address)) & (uint16_t)(GetMask))


/**********************************************************/
/* Uniform multiplatform 32-bits peripheral access macros */
/**********************************************************/

#define setReg32Bit(RegName, BitName)                           (RegName |= (dword)(RegName##_##BitName##_##BITMASK))
#define clrReg32Bit(RegName, BitName)                           (RegName &= (dword)(~RegName##_##BitName##_##BITMASK))
#define invertReg32Bit(RegName, BitName)                        (RegName ^= (dword)(RegName##_##BitName##_##BITMASK))
#define testReg32Bit(RegName, BitName)                          (RegName & RegName##_##BitName##_##BITMASK)

/* Whole peripheral register access macros */
#define setReg32(RegName, val)                                   (RegName = (dword)(val))
#define getReg32(RegName)                                        (RegName)

/* Bits peripheral register access macros */
#define testReg32Bits(RegName, GetMask)                          (RegName & (dword)(GetMask))
#define clrReg32Bits(RegName, ClrMask)                           (RegName &= (dword)(~(dword)(ClrMask)))
#define setReg32Bits(RegName, SetMask)                           (RegName |= (dword)(SetMask))
#define invertReg32Bits(RegName, InvMask)                        (RegName ^= (dword)(InvMask))
#define clrSetReg32Bits(RegName, ClrMask, SetMask)               (RegName = (dword)((RegName & (~(dword)(ClrMask))) | (dword)(SetMask)))
#define seqClrSetReg32Bits(RegName, BitsMask, BitsVal)           ( RegName &= (dword)(~(~(dword)(BitsVal) & (dword)(BitsMask))),\
                                                                 RegName |= (dword)((dword)(BitsVal) & (dword)(BitsMask)) )
#define seqSetClrReg32Bits(RegName, BitsMask, BitsVal)           ( RegName |= (dword)((dword)(BitsVal) & (dword)(BitsMask)),\
                                                                 RegName &= (dword)(~(~(dword)(BitsVal) & (dword)(BitsMask))) )
#define seqResetSetReg32Bits(RegName, BitsMask, BitsVal)         ( RegName &= (dword)(~(dword)(BitsMask)),\
                                                                 RegName |= (dword)((dword)(BitsVal) & (dword)(BitsMask)) )
#define clrReg32BitsByOne(RegName, ClrMask, BitsMask)            (RegName &= (dword)((dword)(ClrMask) & (dword)(BitsMask)))

/* Bit group peripheral register access macros */
#define testReg32BitGroup(RegName, GroupName)                    (RegName & RegName##_##GroupName##_##GRPMASK)
#define getReg32BitGroupVal(RegName, GroupName)                  ((RegName & RegName##_##GroupName##_##GRPMASK) >> RegName##_##GroupName##_##GRPPOS)
#define setReg32BitGroupVal(RegName, GroupName, GroupVal)        (RegName = (RegName & ~RegName##_##GroupName##_##GRPMASK) | ((dword)(GroupVal) << RegName##_##GroupName##_##GRPPOS))
#define seqClrSetReg32BitGroupVal(RegName,GroupName,GroupVal)    ( RegName &= (dword)(~(~((dword)(GroupVal) << RegName##_##GroupName##_##GRPPOS) & RegName##_##GroupName##_##GRPMASK)),\
                                                                 RegName |= (dword)(((dword)(GroupVal) << RegName##_##GroupName##_##GRPPOS) & RegName##_##GroupName##_##GRPMASK) )
#define seqSetClrReg32BitGroupVal(RegName,GroupName,GroupVal)    ( RegName |= (dword)(((dword)(GroupVal) << RegName##_##GroupName##_##GRPPOS) & RegName##_##GroupName##_##GRPMASK),\
                                                                 RegName &= (dword)(~(~((dword)(GroupVal) << RegName##_##GroupName##_##GRPPOS) & RegName##_##GroupName##_##GRPMASK)) )
#define seqResetSetReg32BitGroupVal(RegName,GroupName,GroupVal)  ( RegName &= (dword)(~RegName##_##GroupName##_##GRPMASK),\
                                                                 RegName |= (dword)(((dword)(GroupVal) << RegName##_##GroupName##_##GRPPOS) & RegName##_##GroupName##_##GRPMASK) )

/* Peripheral access macros based on the memory address */
#define periphMemWrite32(Address, Val)                           (*((volatile uint32_t *)(Address)) = (uint32_t)(Val))
#define periphMemRead32(Address)                                 (*((volatile uint32_t *)(Address)))
#define periphBitsClr32(Address, ClrMask)                        (*((volatile uint32_t *)(Address)) &= (uint32_t)(~(uint32_t)(ClrMask)))
#define periphBitsSet32(Address, SetMask)                        (*((volatile uint32_t *)(Address)) |= (uint32_t)(SetMask))
#define periphBitsTest32(Address, GetMask)                       (*((volatile uint32_t *)(Address)) & (uint32_t)(GetMask))



                                   /* This macro is used by Processor Expert. It restores CCR register saved in SaveStatusReg(). */ \
/* Save status register and disable interrupts */
#define EnterCritical() portENTER_CRITICAL()

/* Restore status register  */
#define ExitCritical() portEXIT_CRITICAL()


typedef struct {          /* Black&White image  */
  word width;             /* Image width  */
  word height;            /* Image height */
  byte *pixmap;           /* Image pixel bitmap */
  dword size;             /* Image size */
  byte *name;             /* Image name */
} TIMAGE;

typedef TIMAGE* PIMAGE ;  /* Pointer to an image */


#endif /* __PE_Types_H */

/*lint -restore */
/*
** ###################################################################
**
**     This file was created by Processor Expert 4.00 Beta [04.39]
**     for the Freescale MCF series of microcontrollers.
**
** ###################################################################
*/
