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

📄 common.h

📁 这是应用SAM7X256做LonWorks网关的代码
💻 H
字号:
//{{NodeBuilder Code Wizard Start <CodeWizard Timestamp>
// Run on Fri Dec 28 21:24:20 2007, version 3.10.56
//
//}}NodeBuilder Code Wizard End

//////////////////////////////////////////////////////////////////////////////
// File: Common.h
//
//
// Generated by NodeBuilder Code Wizard Version 3.10.56
// Copyright (c) 2001-2003 Echelon Corporation.  All rights reserved.
//                                                                                  
// ECHELON MAKES NO REPRESENTATION, WARRANTY, OR CONDITION OF
// ANY KIND, EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE OR IN
// ANY COMMUNICATION WITH YOU, INCLUDING, BUT NOT LIMITED TO,
// ANY IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY
// QUALITY, FITNESS FOR ANY PARTICULAR PURPOSE, 
// NONINFRINGEMENT, AND THEIR EQUIVALENTS.
//
//
// Written By: NodeBuilder Code Wizard  
//
// Description: Common typedefs, macros, constants, and utility function 
// prototypes.
//
//////////////////////////////////////////////////////////////////////////////

#ifndef _COMMON_
#define _COMMON_

#include <stddef.h>
#include <SNVT_RQ.H>
#include <s32.h> 
#include <float.h>
#include <control.h>
#include "fileSys.h"

//////////////////////////////////////////////////////////////////////////////
// Function block types, constants, etc.

// The TFblockIndex type describes the type of the index of a functional block.
// Note that the LonMark guidelines do not impose a maximum on the number of 
// functional blocks per device other than by means of maximum length of node-SD
// string (1024 bytes). However, each functional block must have at least one 
// network variable, and LonWorks devices are therefore limited to 61 functional
// blocks on a NEURON chip platform and 4095 functional blocks on a hosted platform
// (note the node object, which would be required in these maximum configurations, 
// requires at least two mandatory NV).

typedef unsigned short TFblockIndex;

typedef enum _TFblock_command
{
	FBC_NORMAL			= RQ_NORMAL,
		FBC_DISABLED		= RQ_DISABLED,	
		FBC_UPDATE_STATUS	= RQ_UPDATE_STATUS,
		FBC_SELF_TEST		= RQ_SELF_TEST,
		FBC_UPDATE_ALARM	= RQ_UPDATE_ALARM,
		/* 5 */
		FBC_REPORT_MASK		= RQ_REPORT_MASK,
		FBC_OVERRIDE		= RQ_OVERRIDE,
		FBC_ENABLE			= RQ_ENABLE,
		FBC_RMV_OVERRIDE	= RQ_RMV_OVERRIDE,
		FBC_CLEAR_STATUS	= RQ_CLEAR_STATUS,
		/* 10 */
		FBC_CLEAR_ALARM				= RQ_CLEAR_ALARM,
		FBC_ALARM_NOTIFY_ENABLED	= RQ_ALARM_NOTIFY_ENABLED,
		FBC_ALARM_NOTIFY_DISABLED	= RQ_ALARM_NOTIFY_DISABLED,
		FBC_MANUAL_CTRL				= RQ_MANUAL_CTRL,
		FBC_REMOTE_CTRL				= RQ_REMOTE_CTRL,
		FBC_PROGRAM					= RQ_PROGRAM,
		FBC_OBJECT_REQUEST_COUNT,
		/* 32 */
		FBC_WHEN_OFFLINE = 32,
		FBC_WHEN_ONLINE,
		FBC_WHEN_RESET,
		FBC_WHEN_WINK,
		FBC_WHEN_NV_UPDATE,
		/* 48 */
		FBC_INITIALIZE_FB = 48,
		FBC_BACKGROUND_TIMER,
		FBC_SEND_HEARTBEAT_TIMER,
		FBC_RECEIVE_HEARTBEAT_TIMER,
		FBC_ALARM_TIMER,
		/* 64 */
		FBC_FIRST_EXTENSION = 64,

		FBC_NUL = -1
} TFblock_command;

//
typedef int TPersistentFblockStatus;
// Define some bit-masks for persistent status
#define FBLOCK_DISABLED		(1<<1)
#define FBLOCK_IN_OVERRIDE	(1<<2)
// Each Fblock has persistent storage allocated
extern FBLOCK_PERSISTENT_STATUS_STORAGE TPersistentFblockStatus PersistentFblockStatus[TOTAL_FBLOCK_COUNT];

//
// TFblockData structure tracks Fblock status.
//
typedef struct
{
	SNVT_obj_status objectStatus;
} TFblockData;


//
typedef struct
{
	TFblockIndex 	FblockIndex;
	unsigned short 	nvIndex;
	unsigned short 	nvArrayIndex;
	TFblockIndex 	relFblockIndex;
} TDeviceState;

extern far TFblockData fblockData[TOTAL_FBLOCK_COUNT];
extern far TDeviceState deviceState;

//
//	The following list of prototypes describe utility functions which are defined in root.nc and
//	common.nc. When compiling the application, the Neuron C Compiler will issue warnings NCC#310
//	(function defined but never used) as an efficiency warning. It is recommended to ignore these
//	warnings during development (available resources allowing), and to consider removing all unused
// 	functions for resource preservation before the release of the product.
//
void updateDeviceState(unsigned short nvIndex, unsigned short nvArrayIndex, TFblockIndex firstElementIndex);
void updateNode_Status(void);

void executeOnEachFblock(const TFblock_command cmd);	
void clearFblockStatus(TFblockIndex fblockIndex);
void initAllFblockData(void);
void setPersistentFblockStatus(TFblockIndex fblockIndex, 
							   TPersistentFblockStatus status, 
                               boolean set);
void setFblockDisable(TFblockIndex fblockIndex, boolean disable);
void setFblockOverride(TFblockIndex fblockIndex, boolean override);
void setFblockInAlarm(TFblockIndex fblockIndex);
void setFblockOutOfLimits(TFblockIndex fblockIndex);
void setFblockManualControlBit(TFblockIndex fblockIndex, boolean cmd);
boolean getFblockManualControlBit(TFblockIndex fblockIndex);
void setCommFailedState(TFblockIndex fblockIndex, boolean failed);
void setLockedOutBit(TFblockIndex fblockIndex, boolean lock);
void setFblockFailedSelfTest(TFblockIndex fblockIndex, boolean failed);
void setFblockOverrange(TFblockIndex fblockIndex, boolean ovr);
void setFblockUnderrange(TFblockIndex fblockIndex, boolean under);
boolean fblockNormal(TFblockIndex fblockIndex);
boolean fblockNormalNotLockedOut(TFblockIndex fblockIndex);
boolean fblockEnabled(TFblockIndex fblockIndex);
boolean fblockDisabled(TFblockIndex fblockIndex);
boolean fblockInOverride(TFblockIndex fblockIndex);

///

// If you use FTP to access configuration parameters, then _INCLUDE_FTP
// must be defined
#ifdef _USE_FTP_CPARAMS_ACCESS
	#ifndef _INCLUDE_FTP
		#define _INCLUDE_FTP
	#endif
#endif

#ifdef _INCLUDE_FTP
	#include "fileXfer.h"
#endif 


#endif

⌨️ 快捷键说明

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