⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 abu_init.h

📁 基于EthernetIP协议的应用程序,可以读取AB公司Controllogix系列Ethernetip协议PLC数据. 此软件代码可用于工业控制.
💻 H
📖 第 1 页 / 共 2 页
字号:
/****************************************************************************
*****************************************************************************
**
** File Name
** ---------
**
**
** ABU_INIT.H
**
*****************************************************************************
*****************************************************************************
**
** Description
** -----------
**
** Host platform interface definitions.
**
** Developers must provide host hardware support for microprocessor
** functions here.
**
**
*****************************************************************************
*****************************************************************************
**
** Source Change Indices
** ---------------------
**
** Porting: <none>----4<major>         Customization: <none>----4<major>
**
****************************************************************************/
/****************************************************************************
**
** Services List
** -------------
**
**  AB_AppendVersionBuild()
**  AB_DmaInit()
**  AB_GetDeviceConfig()
**  AB_GetMacId()
**  abu_ClearDualPort()
**  abu_CndNmiISR()
**  abu_HwInit()
**  abu_RamTest()
**  abu_TestDualPort()
**
*****************************************************************************
*****************************************************************************
**                                                                         **
** ETHERNET/IP EXAMPLE CODE                                                **
** COPYRIGHT (c) 2000-2005 ODVA (Open DeviceNet Vendor Association)		   **
**						   & ControlNet International Ltd.                 **
**                                                                         **
** All rights reserved, except as specifically licensed in writing.        **
** Use of the Ethernet/IP Example Protocol Software is subject to          **
** ODVA's and ControlNet International's Terms of Use Agreement.           **
** The following work constitutes example program code and is intended     **
** merely to illustrate useful programming techniques.  The user is        **
** responsible for applying the code correctly.  The code is provided      **
** AS IS without warranty and is in no way guaranteed to be error-free.    **
**                                                                         **
*****************************************************************************
*****************************************************************************
*/

/****************************************************************************
*****************************************************************************
**
** Change Log
** ----------
**
****************************************************************************/


#ifndef ABU_INIT_H
#define ABU_INIT_H

/*#include "fm.h"*/         /* flash utility public interfaces                 */


/****************************************************************************
**
** Constants
**
*****************************************************************************
*/

/*
** Total number of non-volatile segments managed by this application
** will be the sum of all user required application code segments and
** the compiled internal objects requiring non-volatile segment management
** i.e. keeper, cco.
*/

#define ABU_NUM_OF_SEGMENTS   1

/*---------------------------------------------------------------------------
**
** non-volatile segment descriptors
**
**---------------------------------------------------------------------------
*/

#define ABU_BOOT_SEGMENT                           1
#define ABU_BOOT_SECTOR                  FM_SECTOR_8
#define ABU_BOOT_SECTOR_END             FM_SECTOR_10

/*
** In previous builds, boot started at a different flash sector address.
** This is necessary to support flash updating older devices.
*/

#define ABU_BOOT_SECTOR_OLD              FM_SECTOR_9

#define ABU_MAIN_SEGMENT                           2
#define ABU_MAIN_SECTOR                  FM_SECTOR_4
#define ABU_MAIN_SECTOR_END              FM_SECTOR_6


/*---------------------------------------------------------------------------
**
** Flash special locations
**
**---------------------------------------------------------------------------
*/

#define ABU_CHECKSUM_OFFSET             0
#define ABU_VERSION_OFFSET              2
#define ABU_DATE_OFFSET                 4
#define ABU_SERIAL_OFFSET               8
#define ABU_SERIAL_BAR_OFFSET          12

/*
** Firmware build stuffing into flash is applicable only in the
** main code.
*/

#define ABU_FIRMWARE_BUILD_OFFSET      12


/*
** Boot segment major and minor revisions.
*/

#define AB_BOOT_MAJOR_REVISION   0

#define AB_BOOT_MINOR_REVISION   0

/*
** Main segment major and minor revisions.
*/

#define AB_MAJOR_REVISION        1

#define AB_MINOR_REVISION        1

/*
** Device specific definition of device serial number.
*/
#define AB_SERIAL_NUMBER_ADDRESS       FD_IntelMakePtr(                     \
   FM_FlashMemory[ABU_BOOT_SECTOR].iSectorBaseAddr, ABU_SERIAL_OFFSET )

#define AB_SERIAL_NUMBER_ADDRESS_BAR   FD_IntelMakePtr(                     \
   FM_FlashMemory[ABU_BOOT_SECTOR].iSectorBaseAddr, ABU_SERIAL_BAR_OFFSET )

/*
** Device specific definition of device serial number.  This is for
** reference to previous boot builds which started at a different address.
*/
#define AB_SERIAL_NUMBER_ADDRESS_OLD       FD_IntelMakePtr(                     \
   FM_FlashMemory[ABU_BOOT_SECTOR_OLD].iSectorBaseAddr, ABU_SERIAL_OFFSET )

#define AB_SERIAL_NUMBER_ADDRESS_BAR_OLD   FD_IntelMakePtr(                     \
   FM_FlashMemory[ABU_BOOT_SECTOR_OLD].iSectorBaseAddr, ABU_SERIAL_BAR_OFFSET )

/*
** Device specific definition of device firmware build number.
*/
#define FIRMWARE_BUILD        *(UINT16*)FD_IntelMakePtr(                    \
   FM_FlashMemory[ABU_MAIN_SECTOR].iSectorBaseAddr, ABU_FIRMWARE_BUILD_OFFSET )





/****************************************************************************
**
** Typedefs
**
*****************************************************************************
*/

/*---------------------------------------------------------------------------
**
** AB_DeviceConfigType
**
** Device hardware configuration description data structure.
**
**---------------------------------------------------------------------------
*/
typedef struct _AB_DeviceConfigType
{
   UINT16         iProductCode;
	INT8           abProductName[33];
} AB_DeviceConfigType;

/*---------------------------------------------------------------------------
**
** ABU_SegmentAttributes
**
** Non-volatile segment attributes.
**
**---------------------------------------------------------------------------
*/
typedef struct _ABU_SegmentAttributes
{
	UINT8      bMajRev;					  /* major rev of the segment            */
	UINT8      bMinRev;                /* minor rev of the segment            */
	UINT16     iBootFlag;              /* boot code segment or not            */
	UINT16     iBurnIncrement;         /*                                     */
	UINT16     iTransferSize;          /* non-volatile save chunk size        */
	UINT16     iUploadSize;            /* non-volatile segment upload size    */
   UINT32     lSegSize;               /* segment size                        */
	UINT32     lSegAddr;               /* segment addr                        */
	BOOL       fResetForNvUpdate;      /* device reset prior to nv update     */
} ABU_SegmentAttributes;

/*---------------------------------------------------------------------------
**
** ABU_SegmentConfigType
**
** Non-volatile segment description.
**
**---------------------------------------------------------------------------
*/
typedef struct _ABU_SegmentConfigType
{
	UINT16                 iSegmentNumber;       /* NV instance number        */
	UINT8                  bSectorStart;         /* start sector in flash     */
	UINT8                  bSectorEnd;           /* end sector in flash       */
	BOOL                   fStackedSegment;      /* stacked segment flag      */
	ABU_SegmentAttributes  sSegmentAttributes;

} ABU_SegmentConfigType;

/*---------------------------------------------------------------------------
**
** ABU_DataType
**
** Global data supplied by the user for configuring various pieces
** of the example code.
**
** The values in this structure are filled in during pre-initialization.
**
**---------------------------------------------------------------------------
*/

typedef struct _ABU_DataType
{

   ABU_SegmentConfigType sSegConfig[ABU_NUM_OF_SEGMENTS];

} ABU_DataType;


/*---------------------------------------------------------------------------
**
** ABU_s
**
** Global configuration data.  Filled in by the user.
**
**---------------------------------------------------------------------------
*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -