/*
*******************************************************************************
COPYRIGHT 2003 STMicroelectronics
Source File Name : itc_hr.h
Group            : IPSW,CMG-IPDF.
Author           : MCD Application Team
Date First Issued: 5/3/2002 
********************************Documentation**********************************
General Purpose - Mapping of all hardware registers for COSMIC and their 
                  declaration as extern for HIWARE
********************************RevisionHistory********************************
1. Removed the mapping of hardware registers.
2. Defined  constants used in itc.c.
3. Included necessary comments.
4. Updated file for release 2.0.
_______________________________________________________________________________
Date :5/3/2002   	Release:1.0                                
Date :23/9/2003         Release: 2.0
Date :28/04/04          MISRA changes
******************************************************************************/    
/* MACROS FOR ASM INSTRUCTIONS */  
#include "ST7lib_config.h"
      
#ifdef _HIWARE_ 
		
    #define STORE_CONTENTS()     {_asm("PUSH CC");}         

    #define RESTORE_CONTENTS()   {_asm("POP CC");}

#endif    

#ifdef _COSMIC_ 
    #define STORE_CONTENTS()	{_asm("PUSH CC");}   

    #define RESTORE_CONTENTS()	{_asm("POP CC");} 							   		   
#endif    

#ifdef _RAISONANCE_
    #include "intrist7.h"

    #define STORE_CONTENTS()	{ asm {0x8A};}   

    #define RESTORE_CONTENTS()	{asm {0x86};} 		
#endif 
    
/****************************************************************************/  
/* MACROS */             /* setting interrupts in software priority registers*/

#define ITREG_DEFAULT 0xff
#define REG_DEFAULT 0x00
#define DEFAULT_VALUE 0x0c   
#define MASK_MISC1 0x27
#define MASK_MISC3 0xf3
    
#define SET_VALUE1(s) ((s)<<3)
#define SET_VALUE2(s) ((s)<<6) 
#define SET_VALUE3(s) ((s)<<2)
      
#define MASK_IPA (0xe3)
#define MASK_IPB (0x1f)

#define SET_IPA (0x04)     
#define SET_IPB (0x20)

#define SET_ITRFRE1(P) (0x01 << (P))
#define SET_ITRFRE2(P) (0x01 << ((P)-2))

#define MASK_ITRFRE2(P) (0x30 << (P))
#define ITRFRE2_VALUE(S,P)((S) << (P))  

#define EIREG_MASKEI0 (0xfc)
#define EIREG_MASKEI1 (0xf3)   
#define EIREG_MASKEI2 (0xcf)
#define EIREG_MASKEI3 (0x3f)
   
#define EICR_SET(V,S) ((V)<< (S))
#define EISR_SET(V,S) ((V)<< (S))
                                  
#define SET_ITRFRE(P) (0x01 << (P))

#define MISC_MASK (0xe7)     

#define REVERT_IPA (0x04)
#define REVERT_IPB (0x20)

     
#define TLI_FALL (0xfd)
#define TLI_RISE (0x02)
#define TLI_ENABLE (0x01)
#define TLI_DISABLE (0xfe)
     
/********** (c) 2003   STMicroelectronics ********************* END OF FILE*/



