/**********************************************************************
 * Copyright (c) 2000 by Borst Automation, Fachingen
 * All rights reserved
 *
 * Filename:  UserApi.h
 * Project:   HART Slave
 * Date:      jul-29-00
 * Author(s): W. Borst
 *
 * Revision:
 * Date:      Name:       Version:  Description:
 * Jul-29-00  W. Borst    -----     Initial Draft
 *
 * Description: User's target implementations
 *
 **********************************************************************/
//Prolog
#ifndef __userapi_h__
#define __userapi_h__

#ifndef __USERAPI_H__
  #include "..\Common\MemDecls.h"
  extern BOOL bLowLevelLocked;
#endif

#ifdef VC_STUDIO
  BOOL sysEEPromIsValid(void);
  void sysEEPromWrite(EEPROM void *, const void *, BYTE);
  void sysEEPromRead(void *, const EEPROM void *, BYTE);
  void sysTriggerWatchdog(void);
  BOOL sysDevIsWrProtected(void);
  void sysPutInt16(void *,UINT16);
  void sysPutInt24(void *,UINT24);
  void sysPutInt32(void *,UINT32);
  void sysPutFloat(void *,FLOAT);
  void sysSwap2(UCHR *);
  void sysSwap3(UCHR *);
  void sysSwap4(UCHR *);
  void sysIEEEtoMSfloat(void *);
  void sysMSfloatToIEEE(void *);

  #define M_API_MEMCPY(pDst,pSrc,iLen) \
             memcpy(pDst,pSrc,iLen)
  #define M_API_IS_EE_VALID sysEEPromIsValid()
  #define M_API_EE_WRITE(pEE,pSrc,byLen) \
             sysEEPromWrite(pEE,pSrc,byLen)
  #define M_API_EE_READ(pDst,pEE,byLen) \
             sysEEPromRead(pDst,pEE,byLen)             
  #define M_API_TRIGGER_WATCHDOG sysTriggerWatchdog()
  #define M_API_IS_WR_PROTECTED FbHartGetWrProtCode()
  #define M_API_PUT_UINT16(pDst,ui16) \
             sysPutInt16(pDst,ui16)
  #define M_API_PUT_UINT24(pDst,ui24) \
             sysPutInt24(pDst,ui24)
  #define M_API_PUT_UINT32(pDst,ui32) \
             sysPutInt32(pDst,ui32)
  #define M_API_PUT_FLOAT(pDst,fl) \
             sysPutFloat(pDst,fl)
  #define M_API_SWAP2(pSrcDst) \
             sysSwap2(pDstSrc)
  #define M_API_SWAP3(pSrcDst) \
             sysSwap3(pSrcDst)
  #define M_API_SWAP4(pSrcDst) \
             sysSwap4(pSrcDst)
  #define M_API_IEEEtoMSfloat(pSrcDst) \
             sysIEEEtoMSfloat(pSrcDst)
  #define M_API_MSfloatToIEEE(pSrcDst) \
             sysMSfloatToIEEE(pSrcDst)
#else
  //Makros for the target goes here
#endif

//Epilog
#endif