//*****************************************************************************
//*****************************************************************************
//  FILENAME: QP0A.h
//   Version: 2.3, Updated on 2004/07/29 at 17:41:18
//  Generated by PSoC Designer ver 4.2  b1013 : 02 September, 2004
//
//  DESCRIPTION: Counter8 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 QP0A_EnableInt
#pragma fastcall16 QP0A_DisableInt
#pragma fastcall16 QP0A_Start
#pragma fastcall16 QP0A_Stop
#pragma fastcall16 QP0A_bReadCounter              // Read  DR0
#pragma fastcall16 QP0A_WritePeriod               // Write DR1
#pragma fastcall16 QP0A_bReadCompareValue         // Read  DR2
#pragma fastcall16 QP0A_WriteCompareValue         // Write DR2

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


//-------------------------------------------------
// Prototypes of the QP0A API.
//-------------------------------------------------

extern void QP0A_EnableInt(void);                           // Proxy Class 1
extern void QP0A_DisableInt(void);                          // Proxy Class 1
extern void QP0A_Start(void);                               // Proxy Class 1
extern void QP0A_Stop(void);                                // Proxy Class 1
extern BYTE QP0A_bReadCounter(void);                        // Proxy Class 1
extern void QP0A_WritePeriod(BYTE bPeriod);                 // Proxy Class 1
extern BYTE QP0A_bReadCompareValue(void);                   // Proxy Class 2
extern void QP0A_WriteCompareValue(BYTE bCompareValue);     // Proxy Class 1

// The following functions are deprecated.
// They may be omitted in future releases
//
extern BYTE bQP0A_ReadCounter(void);            // Deprecated
extern BYTE bQP0A_ReadCompareValue(void);       // Deprecated


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

#define QP0A_CONTROL_REG_START_BIT             ( 0x01 )
#define QP0A_INT_REG_ADDR                      ( 0x0df )
#define QP0A_INT_MASK                          ( 0x04 )


//--------------------------------------------------
// Constants for QP0A user defined values
//--------------------------------------------------

#define QP0A_PERIOD                            ( 0xff )
#define QP0A_COMPARE_VALUE                     ( 0x00 )


//-------------------------------------------------
// Register Addresses for QP0A
//-------------------------------------------------

#pragma ioport  QP0A_COUNTER_REG:   0x048                  //DR0 Count register
BYTE            QP0A_COUNTER_REG;
#pragma ioport  QP0A_PERIOD_REG:    0x049                  //DR1 Period register
BYTE            QP0A_PERIOD_REG;
#pragma ioport  QP0A_COMPARE_REG:   0x04a                  //DR2 Compare register
BYTE            QP0A_COMPARE_REG;
#pragma ioport  QP0A_CONTROL_REG:   0x04b                  //Control register
BYTE            QP0A_CONTROL_REG;
#pragma ioport  QP0A_FUNC_REG:  0x148                      //Function register
BYTE            QP0A_FUNC_REG;
#pragma ioport  QP0A_INPUT_REG: 0x149                      //Input register
BYTE            QP0A_INPUT_REG;
#pragma ioport  QP0A_OUTPUT_REG:    0x14a                  //Output register
BYTE            QP0A_OUTPUT_REG;
#pragma ioport  QP0A_INT_REG:       0x0df                  //Interrupt Mask Register
BYTE            QP0A_INT_REG;


//-------------------------------------------------
// QP0A Macro 'Functions'
//-------------------------------------------------

#define QP0A_Start_M \
   QP0A_CONTROL_REG |=  QP0A_CONTROL_REG_START_BIT

#define QP0A_Stop_M  \
   QP0A_CONTROL_REG &= ~QP0A_CONTROL_REG_START_BIT

#define QP0A_EnableInt_M   \
   M8C_EnableIntMask(QP0A_INT_REG, QP0A_INT_MASK)

#define QP0A_DisableInt_M  \
   M8C_DisableIntMask(QP0A_INT_REG, QP0A_INT_MASK)


// end of file QP0A.h
