/**********************************************************************
 * Copyright (c) 1998 - 2000 by Borst Automation, Fachingen
 * All rights reserved
 *
 * Filename:  HartApi.c
 * Project:   HART Slave
 * Date:      jul-25-00
 * Author(s): W. Borst
 *
 * Revision:
 * Date:      Name:       Version:  Description:
 * Jul-25-00  W. Borst    -----     Initial Draft
 *
 * Description: Hart Hardware Abstraction Layer
 *              This module contains the necessary makro definitions
 *
 **********************************************************************/
#ifndef __hartapi_h__
#define __hartapi_h__

/**********************************************************************
 * Includes                                                           *
 **********************************************************************/
#ifdef __HARTAPI_H__
  #include <string.h>
  #include "..\Common\Types.h"
  #include "..\Common\Hart.h"
  #include "..\Protocol\HartLoL.h"
  #include "..\Api\UserApi.h"
  #include "..\FbHart\FbHart.h"
#endif

#ifdef VC_STUDIO
  //Definitions as in winbase.h
  #define CBR_1200    1200
  #define ODDPARITY      1
  #define ONESTOPBIT     0
  
  //User definitions
  #define MYCOMPORT      1  //Use COM 1
  
  /* Makros for PC simulation goes here */
  #define M_HRT_START_SEND(pBuf,ucLen) WriteToCom( MYCOMPORT, \
                                                   pBuf, \
                                                   ucLen \
                                                 )
  #define M_HRT_PUSH_REGS
  #define M_HRT_POP_REGS
  #define M_HRT_DISABLE_RCV
  #define M_HRT_ENABLE_RCV
  //Change 
  #define M_HRT_INIT_COM OpenComPort( MYCOMPORT, \
                                      CBR_1200, \
                                      8, \
                                      ODDPARITY, \
                                      ONESTOPBIT \
                                    )
  #define M_HRT_TERMINATE CloseComPort(MYCOMPORT)
  #define M_HRT_IS_CARRIER        0
  #define M_HRT_GET_RCV_ERROR     GetRcvErr()
  #define M_HRT_GET_RCV_CHAR      GetRcvChar()
  #define M_HRT_DISABLE_INTERRUPT
  #define M_HRT_ENABLE_INTERRUPT
#else
  /* Makros for the target system goes here */
  #define M_HRT_START_SEND(pBuf,ucLen)
  #define M_HRT_PUSH_REGS
  #define M_HRT_POP_REGS
  #define M_HRT_DISABLE_RCV
  #define M_HRT_ENABLE_RCV
  #define M_HRT_INIT_COM
  #define M_HRT_IS_CARRIER        0
  #define M_HRT_GET_RCV_ERROR     0
  #define M_HRT_GET_RCV_CHAR      0
  #define M_HRT_DISABLE_INTERRUPT
  #define M_HRT_ENABLE_INTERRUPT
#endif

#endif