/******************************************************************************
*                                             COPYRIGHT (c) MOTOROLA 2003   
* FILE NAME: projectglobals.h                                        
*                                                                           
* PURPOSE: header file for project level defines global variables
*		   and includes module drivers.  							 
*                                                                           
*******************************************************************************
*******************************************************************************
*                                                                           
*                                                                           
* DESCRIPTION:  project setup (peripherals and drivers)        
*                                                                           
* NOTE: Modify this file to specify which maskset peripheral you are using by
*		uncommenting desired maskset peripheral file. Also uncomment the 
*		drivers which are used by your main application.  
*                                                                           
* AUTHOR: r9aabe       LOCATION: Austin,TX        LAST EDIT DATE: 05/20/03  
*                                                                                                                                                
******************************************************************************/

#ifndef PROJECTGLOBALS_H        /*prevent duplicated includes*/
#define PROJECTGLOBALS_H

/*****************************************************************************/
/*Global Includes															 */
/*****************************************************************************/

#include <hidef.h>				//Includes Code Warrior definitions	
#include "projectvectors.h"		//Includes Vector prototypes

/*****************************************************************************/
/* MCU_Maskset Selection:	     Uncomment one Target MCU_Maskset for        */
/*								 Development from the list of HCS12 Families */
/*****************************************************************************/

/*D-Family*/
//#define Dx512_L00M
//#define DP256_K79X
//#define Dx256_L91N
//#define Dx128_L40K
//#define Dx64_L86D

/*A-Family*/
//#define A512_L00M
//#define A256_L91N
//#define A128_L40K
//#define A64_L86D

/*H-Family*/
//#define H256_K78X
//#define H128_K78X

/*E-Family*/
//#define E128_L15P

/*C-Family*/
#define C32_L45J

/******************************************************************************
* ROUTINE: MCU Peripherals
*
* DESCRIPTION:  includes MCU_Maskset peripheral file from project 
*				definitions library.        
*                                                                           
* NOTE: Modify by selecting which maskset to include into your main 
*		application by uncommenting the appropriate define at the top
*		of projectglobals.h (MCU_Maskset Selection)                                           
*                                                            
******************************************************************************/

#ifdef Dx512_L00M
#include "per_Dx512_L00M.h"	
#define Flash_Sector_Size 0x400	
#endif /*Dx512_L00M*/

#ifdef DP256_K79X
#include "per_DP256_K79X.h"	
#define Flash_Sector_Size 0x200	
#endif /*DP256_K79X*/

#ifdef Dx256_L91N
#include "per_Dx256_L91N.h"	
#define Flash_Sector_Size 0x200	
#endif /*Dx256_L91N*/

#ifdef Dx128_L40K
#include "per_Dx128_L40K.h"	
#define Flash_Sector_Size 0x200	
#endif /*Dx128_L40K*/

#ifdef Dx64_L86D
#include "per_Dx64_L86D.h"		
#define Flash_Sector_Size 0x200	
#endif /*Dx64_L86D*/

#ifdef A512_L00M
#include "per_A512_L00M.h"		
#define Flash_Sector_Size 0x400	
#endif /*A512_L00M*/

#ifdef A256_L91N
#include "per_A256_L91N.h"	
#define Flash_Sector_Size 0x200	
#endif /*A256_L91N*/

#ifdef A128_L40K
#include "per_A128_L40K.h"	
#define Flash_Sector_Size 0x200	
#endif /*A128_L40K*/

#ifdef A64_L86D
#include "per_A64_L86D.h"		
#define Flash_Sector_Size 0x200	
#endif /*A64_L86D*/

#ifdef H256_K78X
#include "per_H256_K78X.h"		
#define Flash_Sector_Size 0x200	
#endif /*H256_K78X*/

#ifdef H128_K78X
#include "per_H128_K78X.h"		
#define Flash_Sector_Size 0x200	
#endif /*H128_K78X*/

#ifdef E128_L15P
#include "per_E128_L15P.h"
#define Flash_Sector_Size 0x400	
#endif /*E128_L15P*/

#ifdef C32_L45J
#include "per_C32_L45J.h"
#define Flash_Sector_Size 0x200	
#endif /*C32_L45J*/

/*****************************************************************************/
/*Macro Definitions				(Defines below are functional examples)    	 */
/*****************************************************************************/

#define int_enable()  {asm andcc   #0xEF;}	  //interrupts enabled
#define int_disable() {asm orcc    #0x10;}	  //interrupts disabled
#define wait()        {asm wait;}			  //enter wait mode
#define stop_enable() {asm andcc   #0x7F;}	  //stop mode enabled
#define stop()        {asm stop;}			  //enter stop mode
#define nop()         {asm nop;}			  //enter NOP asm instruction
#define bgnd()        {asm bgnd; asm nop;}	  //enter BGND asm instruction

#define ON 1								  //ON 
#define OFF 0								  //OFF
#define TRUE 1								  //TRUE
#define FALSE 0								  //FALSE	
#define PASS 0u								  //PASS	
#define FAIL 1u								  //FAIL 	
#define SET 1u								  //SET	
#define CLEAR 0u							  //CLEAR	

#define CLI()   {asm cli;}					  //enable global interrupts
#define SEI()   {asm sei;}				      // disable global interrupts
#define NUL     0x00
#define ESC     0x1B
#define LEFT    0x4B
#define RIGHT   0x4D
#define HOME    0x47
#define END     0x4F
#define INSERT  0x52
#define DELETE  0x53
#define BACKSPC 0x08
#define ENTER   0x0D
#define CTLEND  0x75
#define CTLHOME 0x77
#define CTLRT   0x74
#define CTLLFT  0x73

/*****************************************************************************/
/*Software Driver Selection:      Uncomment necessary peripheral drivers     */
/*								  (Defines below are listed as examples)     */
/*****************************************************************************/

#define SCI

/******************************************************************************
* ROUTINE: Driver Includes
*
* DESCRIPTION:  includes from project driver library        
*                                                                           
* NOTE: Modify by selecting which drivers to include into your main 
*		application by uncommenting the appropriate define at the top
*		of projectglobals.h (Software Driver Selection) 
*		(Defines below are listed as examples)                                          
*                                                            
******************************************************************************/

#ifdef SCI
#include "sci.h"
extern int sprintf (const char *format, ...);
extern int printf (const char *format, ...);
extern int scanf (const char *format, ...);

extern ulong oscclk, busclk;

#define XOn  0x11
#define XOff 0x13
#define RxBufSize 64
#define TxBufSize 32
#define XOnCount RxBufSize - 8
#define XOffCount 18
#endif /*SCI*/


#endif /*PROJECTGLOBALS_H*/