/**********************************************************************
 * Function Block Factory Files Generator V 1.0                       *
 * This file was generated automatically!                             *
 * ==============================================                     *
 * DO NEVER MAKE CHANGES IN THIS FILE MANUALLY!!!                     *
 * ==============================================                     *
 * Date/Time: 31.07.00 12:54:23                                       *
 *                                                                    *
 *                                                                    *
 * Copyright 2000, Borst Automation, Fachingen                        *
 * All Rights Reserved                                                *
 *                                                                    *
 *         File Name: FbHart.h                                        *
 *            Device: MyDevice                                        *
 *         Author(s):                                                 *
 *                    Walter Borst                                    *
 *                                                                    *
 * Revision History                                                   *
 * ================                                                   *
 * 1.11.1999, W.Borst:                                                *
 *   Initial Version                                                  *
 *                                                                    *
 **********************************************************************/
#ifndef __fbhart_h__
#define __fbhart_h__

/**********************************************************************
 * Includes                                                           *
 **********************************************************************/
#ifdef __FBHART_H__
  #include <String.h>
  #include "..\Common\Types.h"
  #include "..\Common\MemDecls.h"
  #include "..\Api\UserApi.h"
  #include "..\HrtSrvIn\HrtSrvIn.h"
#endif

/**********************************************************************
 * Function Block Parameters                                          *
 **********************************************************************/
#ifndef __FBHART_H__
  /*
   * Funny number of command 0
   */
  extern    ROM  UINT8 co_ui8FbHartCmd0ID;

  /*
   * Manufacturer's HART Identifier
   */
  extern    ROM  UINT8 co_ui8FbHartMfrID;

  /*
   * Manufacturer's Device Type
   */
  extern    ROM  UINT8 co_ui8FbHartMfrDevType;

  /*
   * Number of Request Preambles
   */
  extern    ROM  UINT8 co_ui8FbHartNoReqPreAmbs;

  /*
   * Version of HART Command Specification
   */
  extern    ROM  UINT8 co_ui8FbHartUnivCmdRev;

  /*
   * Transmitter Specific Revision
   */
  extern    ROM  UINT8 co_ui8FbHartTransmSpecRev;

  /*
   * Software Version
   */
  extern    ROM  UINT8 co_ui8FbHartSoftwRev;

  /*
   * Hardware Version (0x08 = 1.0)
   */
  extern    ROM  UINT8 co_ui8FbHartHardwRev;

  /*
   * Device has no Flags
   */
  extern    ROM  UINT8 co_ui8FbHartFlags;

  /*
   * Remark: The Device ID Number has
   * to be unique because it is used to build the unique identifier.
   */
  extern    ROM UINT24 co_ui24FbHartDeviceIDnum;

  /*
   * Used by the HART low level communication driver.
   */
  extern    RAM   BYTE rs_osFbHartUniqueID[5];

  /*
   * Used to store response code 2 for the HART protocol
   */
  extern    RAM  UINT8 rs_ui8FbHartResponse2;

  /*
   * Only stored for HART environment,
   * Default Value = 'WALTER__'
   */
  extern EEPROM   BYTE ee_paFbHartTagName[6];
  extern    RAM   BYTE re_paFbHartTagName[6];
  extern    RAM   BYTE rl_paFbHartTagName[6];

  /*
   * Only stored for HART environment,
   * Default Value: Spaces
   */
  extern EEPROM   BYTE ee_paFbHartDescription[12];
  extern    RAM   BYTE rs_paFbHartDescription[12];

  /*
   * Only stored for HART environment
   */
  extern EEPROM  UINT8 ee_ui8FbHartDayOfMonth;
  extern    RAM  UINT8 rs_ui8FbHartDayOfMonth;

  /*
   * Only stored for HART environment
   */
  extern EEPROM  UINT8 ee_ui8FbHartMonthOfYear;
  extern    RAM  UINT8 rs_ui8FbHartMonthOfYear;

  /*
   * Only stored for HART environment
   */
  extern EEPROM  UINT8 ee_ui8FbHartYearSince1900;
  extern    RAM  UINT8 rs_ui8FbHartYearSince1900;

  /*
   * Configuration change flag for master 1
   */
  extern EEPROM  UINT8 ee_ui8FbHartCfgChangeM1;
  extern    RAM  UINT8 rs_ui8FbHartCfgChangeM1;

  /*
   * Configuration change flag for master 2
   */
  extern EEPROM  UINT8 ee_ui8FbHartCfgChangeM2;
  extern    RAM  UINT8 rs_ui8FbHartCfgChangeM2;

  /*
   * Not used
   */
  extern    ROM  UINT8 co_ui8FbHartAlmSelCode;

  /*
   * Not used
   */
  extern    ROM  UINT8 co_ui8FbHartXferFuncCode;

  /*
   * 251 = not used
   */
  extern    ROM  UINT8 co_ui8FbHartPrivLabDistCode;

  /*
   * Short address for HART communication
   */
  extern EEPROM  UINT8 ee_ui8FbHartAddress;
  extern    RAM  UINT8 re_ui8FbHartAddress;
  extern    RAM  UINT8 rl_ui8FbHartAddress;

  /*
   * User notes stored in EE
   */
  extern EEPROM   BYTE ee_paFbHartMessage[24];
  extern    RAM   BYTE rs_paFbHartMessage[24];

  /*
   * Kind of ser num stored by user
   */
  extern EEPROM UINT24 ee_ui24FbHartFinAssNum;
  extern    RAM UINT24 rs_ui24FbHartFinAssNum;

  /*
   * Status if device is write protected
   */
  extern    RAM  UINT8 rs_ui8FbHartWrProtCode;


/**********************************************************************
 * Automatically generated semaphores                                 *
 **********************************************************************/
  extern    RAM   BOOL se_bFbHartParamChanged;

#endif

/**********************************************************************
 * Standard Methods                                                   *
 **********************************************************************/
extern void FbHartInit(void);
extern void FbHartVerify(void);


/**********************************************************************
 * User Methods                                                       *
 **********************************************************************/

/*
 * To be called by the command interpreter
 */
extern UINT8 FbHartGetResponse2(
                               );
/*
 * Deliver response to command 1
 */
extern UINT8 FbHartGetRspCmd1(
                             );
/*
 * Plausibility check of range values
 */
extern UINT8 FbHartGetRspCmd35(
                              );
extern UINT8 FbHartGetRspCmd6(
                             );
/*
 * Returns the write protect code for HART command 15
 */
extern UINT8 FbHartGetWrProtCode(
                                  void
                                );
/*
 * Prepares data to be send by the propper entity
 */
extern VOID FbHartSendStream(
                              PBYTE pbyBuf,
                              UINT uiBufSize
                            );
#endif
