//*****************************************************************************
//*****************************************************************************
//  FILENAME: Counter16_SONAR.h
//   Version: 2.3, Updated on 2004/07/29 at 17:41:29
//  Generated by PSoC Designer ver 4.2  b1013 : 02 September, 2004
//
//  DESCRIPTION: Counter16 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 Counter16_SONAR_EnableInt
#pragma fastcall16 Counter16_SONAR_DisableInt
#pragma fastcall16 Counter16_SONAR_Start
#pragma fastcall16 Counter16_SONAR_Stop
#pragma fastcall16 Counter16_SONAR_wReadCounter              // Read  DR0
#pragma fastcall16 Counter16_SONAR_WritePeriod               // Write DR1
#pragma fastcall16 Counter16_SONAR_wReadCompareValue         // Read  DR2
#pragma fastcall16 Counter16_SONAR_WriteCompareValue         // Write DR2

// The following symbols are deprecated.
// They may be omitted in future releases
//
#pragma fastcall16 wCounter16_SONAR_ReadCounter              // Read  DR0 (Deprecated)
#pragma fastcall16 wCounter16_SONAR_ReadCompareValue         // Read  DR2 (Deprecated)

//-------------------------------------------------
// Prototypes of the Counter16_SONAR API.
//-------------------------------------------------
extern void Counter16_SONAR_EnableInt(void);                           // Proxy Class 1
extern void Counter16_SONAR_DisableInt(void);                          // Proxy Class 1
extern void Counter16_SONAR_Start(void);                               // Proxy Class 1
extern void Counter16_SONAR_Stop(void);                                // Proxy Class 1
extern WORD Counter16_SONAR_wReadCounter(void);                        // Proxy Class 2
extern void Counter16_SONAR_WritePeriod(WORD wPeriod);                 // Proxy Class 1
extern WORD Counter16_SONAR_wReadCompareValue(void);                   // Proxy Class 1
extern void Counter16_SONAR_WriteCompareValue(WORD wCompareValue);     // Proxy Class 1

// The following functions are deprecated.
// They may be omitted in future releases
//
extern WORD wCounter16_SONAR_ReadCounter(void);            // Deprecated
extern WORD wCounter16_SONAR_ReadCompareValue(void);       // Deprecated


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

#define Counter16_SONAR_CONTROL_REG_START_BIT  ( 0x01 )
#define Counter16_SONAR_INT_REG_ADDR           ( 0x0df )
#define Counter16_SONAR_INT_MASK               ( 0x80 )


//--------------------------------------------------
// Constants for Counter16_SONAR user defined values
//--------------------------------------------------

#define Counter16_SONAR_PERIOD                 ( 0xffff )
#define Counter16_SONAR_COMPARE_VALUE          ( 0x0 )


//-------------------------------------------------
// Register Addresses for Counter16_SONAR
//-------------------------------------------------

#pragma ioport  Counter16_SONAR_COUNTER_LSB_REG:    0x058  //DR0 Counter register LSB
BYTE            Counter16_SONAR_COUNTER_LSB_REG;
#pragma ioport  Counter16_SONAR_COUNTER_MSB_REG:    0x05c  //DR0 Counter register MSB
BYTE            Counter16_SONAR_COUNTER_MSB_REG;
#pragma ioport  Counter16_SONAR_PERIOD_LSB_REG: 0x059      //DR1 Period register LSB
BYTE            Counter16_SONAR_PERIOD_LSB_REG;
#pragma ioport  Counter16_SONAR_PERIOD_MSB_REG: 0x05d      //DR1 Period register MSB
BYTE            Counter16_SONAR_PERIOD_MSB_REG;
#pragma ioport  Counter16_SONAR_COMPARE_LSB_REG:    0x05a  //DR2 Compare register LSB
BYTE            Counter16_SONAR_COMPARE_LSB_REG;
#pragma ioport  Counter16_SONAR_COMPARE_MSB_REG:    0x05e  //DR2 Compare register MSB
BYTE            Counter16_SONAR_COMPARE_MSB_REG;
#pragma ioport  Counter16_SONAR_CONTROL_LSB_REG:    0x05b  //Control register LSB
BYTE            Counter16_SONAR_CONTROL_LSB_REG;
#pragma ioport  Counter16_SONAR_CONTROL_MSB_REG:    0x05f  //Control register MSB
BYTE            Counter16_SONAR_CONTROL_MSB_REG;
#pragma ioport  Counter16_SONAR_FUNC_LSB_REG:   0x158      //Function register LSB
BYTE            Counter16_SONAR_FUNC_LSB_REG;
#pragma ioport  Counter16_SONAR_FUNC_MSB_REG:   0x15c      //Function register MSB
BYTE            Counter16_SONAR_FUNC_MSB_REG;
#pragma ioport  Counter16_SONAR_INPUT_LSB_REG:  0x159      //Input register LSB
BYTE            Counter16_SONAR_INPUT_LSB_REG;
#pragma ioport  Counter16_SONAR_INPUT_MSB_REG:  0x15d      //Input register MSB
BYTE            Counter16_SONAR_INPUT_MSB_REG;
#pragma ioport  Counter16_SONAR_OUTPUT_LSB_REG: 0x15a      //Output register LSB
BYTE            Counter16_SONAR_OUTPUT_LSB_REG;
#pragma ioport  Counter16_SONAR_OUTPUT_MSB_REG: 0x15e      //Output register MSB
BYTE            Counter16_SONAR_OUTPUT_MSB_REG;
#pragma ioport  Counter16_SONAR_INT_REG:       0x0df       //Interrupt Mask Register
BYTE            Counter16_SONAR_INT_REG;


//-------------------------------------------------
// Counter16_SONAR Macro 'Functions'
//-------------------------------------------------

#define Counter16_SONAR_Start_M \
   ( Counter16_SONAR_CONTROL_LSB_REG |=  Counter16_SONAR_CONTROL_REG_START_BIT )

#define Counter16_SONAR_Stop_M  \
   ( Counter16_SONAR_CONTROL_LSB_REG &= ~Counter16_SONAR_CONTROL_REG_START_BIT )

#define Counter16_SONAR_EnableInt_M   \
   M8C_EnableIntMask(  Counter16_SONAR_INT_REG, Counter16_SONAR_INT_MASK )

#define Counter16_SONAR_DisableInt_M  \
   M8C_DisableIntMask( Counter16_SONAR_INT_REG, Counter16_SONAR_INT_MASK )

// end of file Counter16_SONAR.h
