/*
** ###################################################################
**
**     THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
**
**     Filename  : Cpu.C
**
**     Project   : projRT1
** 
**     Processor : MC68HC908AZ60MFU
**
**     Beantype  : MC68HC908AZ60
**
**     Version   : Bean 01.041, Driver 01.03, CPU db: 2.81.019
**
**     Compiler  : Metrowerks HC08 C Compiler V-5.0.13
**
**     Date/Time : 2.4.2002, 8:44
**
**     Abstract  :
**
**         This bean "MC68HC908AZ60" implements properties, methods,
**         and events of the CPU.
**
**     Settings  :
**
**
**     Contents  :
**
**         GetSpeedMode - byte Cpu_GetSpeedMode(void);
**         EnableInt    - void Cpu_EnableInt(void);
**         DisableInt   - void Cpu_DisableInt(void);
**
**
**     (c) Copyright UNIS, spol. s r.o. 1997-2002
**
**     UNIS, spol. s r.o.
**     Jundrovska 33
**     624 00 Brno
**     Czech Republic
**
**     http      : www.processorexpert.com
**     mail      : info@processorexpert.com
**
** ###################################################################
*/

/* MODULE Cpu. */
#include "TI1.h"
#include "Faster.h"
#include "Slower.h"
#include "Byte1.h"
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"
#include "Events.h"
#include "Cpu.h"

#define CGM_DELAY  255UL


/* Global variables */
byte CCR_reg;                          /* Current CCR register */
byte CpuMode = HIGH_SPEED;             /* Current speed mode */


/*
** ===================================================================
**     Method      :  Cpu_Interrupt (bean MC68HC908AZ60)
**
**     Description :
**         This method is internal. It is used by Processor Expert
**         only.
** ===================================================================
*/
__interrupt void Cpu_Interrupt(void)
{
}

/*
** ===================================================================
**     Method      :  Cpu_DisableInt (bean MC68HC908AZ60)
**
**     Description :
**         Disable maskable interrupts
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
/*
void Cpu_DisableInt(void)

**      This method is implemented as macro in the header module. **
*/

/*
** ===================================================================
**     Method      :  Cpu_EnableInt (bean MC68HC908AZ60)
**
**     Description :
**         Enable maskable interrupts
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
/*
void Cpu_EnableInt(void)

**      This method is implemented as macro in the header module. **
*/

/*
** ===================================================================
**     Method      :  Cpu_GetSpeedMode (bean MC68HC908AZ60)
**
**     Description :
**         Get current speed mode
**     Parameters  : None
**     Returns     :
**         ---             - Speed mode (HIGH_SPEED, LOW_SPEED,
**                           SLOW_SPEED)
** ===================================================================
*/
byte Cpu_GetSpeedMode(void)
{
  return CpuMode;                      /* Result the actual cpu mode */
}

/*
** ===================================================================
**         There is beginning of initialization code for CPU 
**         and embedded beans.
** ===================================================================
*/
void __low_level_init(void)
{
  byte i;
  /* Common initialization of the CPU registers */
  output( DDRH, input( DDRH ) & ~1 );
  /* ### MC68HC908AZ60 "Cpu" init code ... */
  CONFIG_1 = 1;                        /* Set the CONFIG_1 register */
  CONFIG_2 = 1;                        /* Set the CONFIG_2 register */
  /* ### TimerInt "TI1" init code ... */
  TI1_Init();
  /* ### External interrupt "Faster" init code ... */
  ISCR_MODE1 = 0;
  ISCR_IMASK1 = 1;
  ISCR_ACK1 = 1;
  ISCR_IMASK1 = 0;
  /* ### External interrupt "Slower" init code ... */
  KBSCR_MODEK = 0;
  KBSCR_IMASKK = 1;
  KBIE |= 8;
  KBSCR_ACKK = 1;
  KBSCR_IMASKK = 0;
  /* ### ByteIO "Byte1" init code ... */
  PTA = 0;                             /* Prepare value for output */
  DDRA = 255;                          /* Set direction to output */
  __EI();                              /* Enable interrupts */
}

/* END Cpu. */

/*
** ###################################################################
**
**     This file was created by UNIS Processor Expert 02.84 for 
**     the Motorola HC08 series of microcontrollers.
**
** ###################################################################
*/
