//*****************************************************************************
//*****************************************************************************
//  FILENAME: QP1A.h
//   Version: 2.4, Updated on 2004/10/27 at 18:25:09
//  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 QP1A_EnableInt
#pragma fastcall16 QP1A_DisableInt
#pragma fastcall16 QP1A_Start
#pragma fastcall16 QP1A_Stop
#pragma fastcall16 QP1A_bReadCounter              // Read  DR0
#pragma fastcall16 QP1A_WritePeriod               // Write DR1
#pragma fastcall16 QP1A_bReadCompareValue         // Read  DR2
#pragma fastcall16 QP1A_WriteCompareValue         // Write DR2

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


//-------------------------------------------------
// Prototypes of the QP1A API.
//-------------------------------------------------

extern void QP1A_EnableInt(void);                           // Proxy Class 1
extern void QP1A_DisableInt(void);                          // Proxy Class 1
extern void QP1A_Start(void);                               // Proxy Class 1
extern void QP1A_Stop(void);                                // Proxy Class 1
extern BYTE QP1A_bReadCounter(void);                        // Proxy Class 1
extern void QP1A_WritePeriod(BYTE bPeriod);                 // Proxy Class 1
extern BYTE QP1A_bReadCompareValue(void);                   // Proxy Class 2
extern void QP1A_WriteCompareValue(BYTE bCompareValue);     // Proxy Class 1

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


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

#define QP1A_CONTROL_REG_START_BIT             ( 0x01 )
#define QP1A_INT_REG_ADDR                      ( 0x0df )
#define QP1A_INT_MASK                          ( 0x08 )


//--------------------------------------------------
// Constants for QP1A user defined values
//--------------------------------------------------

#define QP1A_PERIOD                            ( 0xff )
#define QP1A_COMPARE_VALUE                     ( 0x00 )


//-------------------------------------------------
// Register Addresses for QP1A
//-------------------------------------------------

#pragma ioport  QP1A_COUNTER_REG:   0x04c                  //DR0 Count register
BYTE            QP1A_COUNTER_REG;
#pragma ioport  QP1A_PERIOD_REG:    0x04d                  //DR1 Period register
BYTE            QP1A_PERIOD_REG;
#pragma ioport  QP1A_COMPARE_REG:   0x04e                  //DR2 Compare register
BYTE            QP1A_COMPARE_REG;
#pragma ioport  QP1A_CONTROL_REG:   0x04f                  //Control register
BYTE            QP1A_CONTROL_REG;
#pragma ioport  QP1A_FUNC_REG:  0x14c                      //Function register
BYTE            QP1A_FUNC_REG;
#pragma ioport  QP1A_INPUT_REG: 0x14d                      //Input register
BYTE            QP1A_INPUT_REG;
#pragma ioport  QP1A_OUTPUT_REG:    0x14e                  //Output register
BYTE            QP1A_OUTPUT_REG;
#pragma ioport  QP1A_INT_REG:       0x0df                  //Interrupt Mask Register
BYTE            QP1A_INT_REG;


//-------------------------------------------------
// QP1A Macro 'Functions'
//-------------------------------------------------

#define QP1A_Start_M \
   QP1A_CONTROL_REG |=  QP1A_CONTROL_REG_START_BIT

#define QP1A_Stop_M  \
   QP1A_CONTROL_REG &= ~QP1A_CONTROL_REG_START_BIT

#define QP1A_EnableInt_M   \
   M8C_EnableIntMask(QP1A_INT_REG, QP1A_INT_MASK)

#define QP1A_DisableInt_M  \
   M8C_DisableIntMask(QP1A_INT_REG, QP1A_INT_MASK)


// end of file QP1A.h
