//*****************************************************************************
//*****************************************************************************
//  FILENAME: Timer16_SONAR.h
//   Version: 2.4, Updated on 2004/10/27 at 18:26:46
//  Generated by PSoC Designer ver 4.2  b1013 : 02 September, 2004
//
//  DESCRIPTION: Timer16 User Module C Language interface file
//               for the 22/24/27/29xxx PSoC family of devices
//-----------------------------------------------------------------------------
//  Copyright (c) Cypress MicroSystems 2000-2004. All Rights Reserved.
//*****************************************************************************
//*****************************************************************************

#include <m8c.h>

#pragma fastcall16 Timer16_SONAR_EnableInt
#pragma fastcall16 Timer16_SONAR_DisableInt
#pragma fastcall16 Timer16_SONAR_Start
#pragma fastcall16 Timer16_SONAR_Stop
#pragma fastcall16 Timer16_SONAR_wReadTimer                // Read  DR0
#pragma fastcall16 Timer16_SONAR_wReadTimerSaveCV          // Read  DR0      
#pragma fastcall16 Timer16_SONAR_WritePeriod               // Write DR1
#pragma fastcall16 Timer16_SONAR_wReadCompareValue         // Read  DR2
#pragma fastcall16 Timer16_SONAR_WriteCompareValue         // Write DR2

// The following symbols are deprecated.
// They may be omitted in future releases
//
#pragma fastcall16 wTimer16_SONAR_ReadCounter              // Read  DR0 "Obsolete"
#pragma fastcall16 wTimer16_SONAR_CaptureCounter           // Read  DR0 "Obsolete"
#pragma fastcall16 wTimer16_SONAR_ReadTimer                // Read  DR0 (Deprecated)
#pragma fastcall16 wTimer16_SONAR_ReadTimerSaveCV          // Read  DR0 (Deprecated)
#pragma fastcall16 wTimer16_SONAR_ReadCompareValue         // Read  DR2 (Deprecated)


//-------------------------------------------------
// Prototypes of the Timer16_SONAR API.
//-------------------------------------------------

extern void Timer16_SONAR_EnableInt(void);                           // Proxy 1
extern void Timer16_SONAR_DisableInt(void);                          // Proxy 1
extern void Timer16_SONAR_Start(void);                               // Proxy 1
extern void Timer16_SONAR_Stop(void);                                // Proxy 1
extern WORD Timer16_SONAR_wReadTimer(void);                          // Proxy 1
extern WORD Timer16_SONAR_wReadTimerSaveCV(void);                    // Proxy 2
extern void Timer16_SONAR_WritePeriod(WORD wPeriod);                 // Proxy 1
extern WORD Timer16_SONAR_wReadCompareValue(void);                   // Proxy 1
extern void Timer16_SONAR_WriteCompareValue(WORD wCompareValue);     // Proxy 1

// The following functions are deprecated.
// They may be omitted in future releases
//
extern WORD wTimer16_SONAR_ReadCompareValue(void);       // Deprecated
extern WORD wTimer16_SONAR_ReadTimerSaveCV(void);        // Deprecated
extern WORD wTimer16_SONAR_ReadCounter(void);            // Obsolete
extern WORD wTimer16_SONAR_ReadTimer(void);              // Deprecated
extern WORD wTimer16_SONAR_CaptureCounter(void);         // Obsolete


//--------------------------------------------------
// Constants for Timer16_SONAR API's.
//--------------------------------------------------

#define Timer16_SONAR_CONTROL_REG_START_BIT    ( 0x01 )
#define Timer16_SONAR_INT_REG_ADDR             ( 0x0df )
#define Timer16_SONAR_INT_MASK                 ( 0x80 )


//--------------------------------------------------
// Constants for Timer16_SONAR user defined values
//--------------------------------------------------

#define Timer16_SONAR_PERIOD                   ( 0x0 )
#define Timer16_SONAR_COMPARE_VALUE            ( 0x0 )


//-------------------------------------------------
// Register Addresses for Timer16_SONAR
//-------------------------------------------------

#pragma ioport  Timer16_SONAR_COUNTER_LSB_REG:  0x058      //Count register LSB
BYTE            Timer16_SONAR_COUNTER_LSB_REG;
#pragma ioport  Timer16_SONAR_COUNTER_MSB_REG:  0x05c      //Count register MSB
BYTE            Timer16_SONAR_COUNTER_MSB_REG;
#pragma ioport  Timer16_SONAR_PERIOD_LSB_REG:   0x059      //Period register LSB
BYTE            Timer16_SONAR_PERIOD_LSB_REG;
#pragma ioport  Timer16_SONAR_PERIOD_MSB_REG:   0x05d      //Period register MSB
BYTE            Timer16_SONAR_PERIOD_MSB_REG;
#pragma ioport  Timer16_SONAR_COMPARE_LSB_REG:  0x05a      //Compare register LSB
BYTE            Timer16_SONAR_COMPARE_LSB_REG;
#pragma ioport  Timer16_SONAR_COMPARE_MSB_REG:  0x05e      //Compare register MSB
BYTE            Timer16_SONAR_COMPARE_MSB_REG;
#pragma ioport  Timer16_SONAR_CONTROL_LSB_REG:  0x05b      //Control register LSB
BYTE            Timer16_SONAR_CONTROL_LSB_REG;
#pragma ioport  Timer16_SONAR_CONTROL_MSB_REG:  0x05f      //Control register MSB
BYTE            Timer16_SONAR_CONTROL_MSB_REG;
#pragma ioport  Timer16_SONAR_FUNC_LSB_REG: 0x158          //Function register LSB
BYTE            Timer16_SONAR_FUNC_LSB_REG;
#pragma ioport  Timer16_SONAR_FUNC_MSB_REG: 0x15c          //Function register MSB
BYTE            Timer16_SONAR_FUNC_MSB_REG;
#pragma ioport  Timer16_SONAR_INPUT_LSB_REG:    0x159      //Input register LSB
BYTE            Timer16_SONAR_INPUT_LSB_REG;
#pragma ioport  Timer16_SONAR_INPUT_MSB_REG:    0x15d      //Input register MSB
BYTE            Timer16_SONAR_INPUT_MSB_REG;
#pragma ioport  Timer16_SONAR_OUTPUT_LSB_REG:   0x15a      //Output register LSB
BYTE            Timer16_SONAR_OUTPUT_LSB_REG;
#pragma ioport  Timer16_SONAR_OUTPUT_MSB_REG:   0x15e      //Output register MSB
BYTE            Timer16_SONAR_OUTPUT_MSB_REG;
#pragma ioport  Timer16_SONAR_INT_REG:       0x0df         //Interrupt Mask Register
BYTE            Timer16_SONAR_INT_REG;


//-------------------------------------------------
// Timer16_SONAR Macro 'Functions'
//-------------------------------------------------

#define Timer16_SONAR_Start_M \
   ( Timer16_SONAR_CONTROL_LSB_REG |=  Timer16_SONAR_CONTROL_REG_START_BIT )

#define Timer16_SONAR_Stop_M  \
   ( Timer16_SONAR_CONTROL_LSB_REG &= ~Timer16_SONAR_CONTROL_REG_START_BIT )

#define Timer16_SONAR_EnableInt_M   \
   M8C_EnableIntMask(  Timer16_SONAR_INT_REG, Timer16_SONAR_INT_MASK )

#define Timer16_SONAR_DisableInt_M  \
   M8C_DisableIntMask( Timer16_SONAR_INT_REG, Timer16_SONAR_INT_MASK )


// end of file Timer16_SONAR.h


