?? dnet.h
字號(hào):
/*****************************************************************************
*
* Microchip DeviceNet Stack (DeviceNet Object Header)
*
*****************************************************************************
* FileName: dnet.h
* Dependencies:
* Processor: PIC18F with CAN
* Compiler: C18 02.10.02 or higher
* Linker: MPLINK 03.20.01 or higher
* Company: Microchip Technology Incorporated
*
* Software License Agreement
*
* The software supplied herewith by Microchip Technology Incorporated
* (the "Company") is intended and supplied to you, the Company's
* customer, for use solely and exclusively with products manufactured
* by the Company.
*
* The software is owned by the Company and/or its supplier, and is
* protected under applicable copyright laws. All rights are reserved.
* Any use in violation of the foregoing restrictions may subject the
* user to criminal sanctions under applicable laws, as well as to
* civil liability for the breach of the terms and conditions of this
* license.
*
* THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES,
* WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
* TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
* IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
* CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
*
*
* This file contains the DeviceNet object described in section 5-5 of
* volume 1 of the DeviceNet specification.
*
* Author Date Comment
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Ross Fosler 04/03/03 ...
*
*****************************************************************************/
#define DNET_ATTRIB_MAC_ID 0x01
#define DNET_ATTRIB_BAUD_RATE 0x02
#define DNET_ATTRIB_BOI 0x03
#define DNET_ATTRIB_BO_COUNT 0x04
#define DNET_ATTRIB_ALLOC_INFO 0x05
#define DNET_ATTRIB_MAC_SW_CH 0x06
#define DNET_ATTRIB_BAUD_SW_CH 0x07
#define DNET_ATTRIB_MAC_SW_VAL 0x08
#define DNET_ATTRIB_BAUD_SW_VAL 0x09
/*********************************************************************
* DeviceNet object data structure
********************************************************************/
typedef union U_ALLOC
{
USINT byte;
struct S_ALLOC_BITS
{
unsigned expl:1;
unsigned poll:1;
unsigned strobe:1;
unsigned multi:1;
unsigned cos:1;
unsigned cyclic:1;
unsigned acksup:1;
unsigned res1:1;
}bits;
}ALLOC;
typedef struct _DNET
{
USINT MACID;
USINT BaudRate;
BOOL BOI;
USINT BusOffCount;
struct _ALLOC_INFO
{
ALLOC AllocChoice;
USINT MasterMACID;
}AllocInfo;
#if ALLOW_MAC_ID_SW_CH
BOOL MACSwChange;
#endif
#if ALLOW_BAUD_RATE_SW_CH
BOOL BaudSwChange;
#endif
#if ALLOW_MAC_ID_SW_VAL
USINT MACSwValue;
#endif
#if ALLOW_BAUD_RATE_SW_VAL
USINT BaudSwValue;
#endif
}DNET;
/*********************************************************************
* DeviceNet object data structure declared global
********************************************************************/
extern DNET uDNet;
unsigned char _DNetAllocNoSupportChk(BYTE choice);
/*********************************************************************
* Function: unsigned char DNetExplMsgHandler(void)
*
* PreCondition: The path (aService, aClassID, aInstanceID) must
* be loaded prior to using this function. If service
* indicates any type of IO then the buffer pointers
* must be initialized.
*
* Input: aHeader, aClassID, aInstanceID, aService
* *pOutBuf, *pInBuf, aOutBufDataLen, aInBufDataLen
* aOutBufLen, aInBufLen
*
* Output: aHeader, aService
* *pOutBuf, *pInBuf, aOutBufDataLen, aInBufDataLen
*
*
*
* Side Effects:
*
* Overview: DeviceNet object explicit messaging handler. This
* fucntion is called by the Router object. It decodes
* the instance and service and performs the requested
* function.
*
* Note: None
********************************************************************/
unsigned char _DNetExplMsgHandler(void);
//unsigned char DNetInit(void);
/*********************************************************************
* Function: unsigned char DNetInst0GetAttrib(void)
*
* PreCondition: The path (aService, aClassID, aInstanceID) must
* be loaded prior to using this function. If service
* indicates any type of IO then the buffer pointers
* must be initialized.
*
* Input: aHeader, aClassID, aInstanceID, aService
* *pOutBuf, *pInBuf, aOutBufDataLen, aInBufDataLen
* aOutBufLen, aInBufLen
*
* Output: aHeader, aService
* *pOutBuf, *pInBuf, aOutBufDataLen, aInBufDataLen
*
*
*
* Side Effects:
*
* Overview: Get attribute service for instance 0.
*
* Note: None
********************************************************************/
unsigned char _DNetInst0GetAttrib(void);
/*********************************************************************
* Function: unsigned char DNetInst1GetAttrib(void)
*
* PreCondition: The path (aService, aClassID, aInstanceID) must
* be loaded prior to using this function. If service
* indicates any type of IO then the buffer pointers
* must be initialized.
*
* Input: aHeader, aClassID, aInstanceID, aService
* *pOutBuf, *pInBuf, aOutBufDataLen, aInBufDataLen
* aOutBufLen, aInBufLen
*
* Output: aHeader, aService
* *pOutBuf, *pInBuf, aOutBufDataLen, aInBufDataLen
*
*
*
* Side Effects:
*
* Overview: Get attribute service for instance 1.
*
* Note: None
********************************************************************/
unsigned char _DNetInst1GetAttrib(void);
/*********************************************************************
* Function: unsigned char DNetInst1SetAttrib(void)
*
* PreCondition: The path (aService, aClassID, aInstanceID) must
* be loaded prior to using this function. If service
* indicates any type of IO then the buffer pointers
* must be initialized.
*
* Input: aHeader, aClassID, aInstanceID, aService
* *pOutBuf, *pInBuf, aOutBufDataLen, aInBufDataLen
* aOutBufLen, aInBufLen
*
* Output: aHeader, aService
* *pOutBuf, *pInBuf, aOutBufDataLen, aInBufDataLen
*
*
*
* Side Effects:
*
* Overview: Set attribute service for instance 1.
*
* Note: None
********************************************************************/
unsigned char _DNetInst1SetAttrib(void);
/*********************************************************************
* Function: unsigned char DNetAllocateConnection(void)
*
* PreCondition: The path (aService, aClassID, aInstanceID) must
* be loaded prior to using this function. If service
* indicates any type of IO then the buffer pointers
* must be initialized.
*
* Input: aHeader, aClassID, aInstanceID, aService
* *pOutBuf, *pInBuf, aOutBufDataLen, aInBufDataLen
* aOutBufLen, aInBufLen
*
* Output: aHeader, aService
* *pOutBuf, *pInBuf, aOutBufDataLen, aInBufDataLen
*
*
*
* Side Effects:
*
* Overview: Allocate predefined master/slave connection set.
*
* Note: None
********************************************************************/
unsigned char _DNetAllocateConnection(void);
/*********************************************************************
* Function: unsigned char DNetReleaseConnection(void)
*
* PreCondition: The path (aService, aClassID, aInstanceID) must
* indicates any type of IO then the buffer pointers
* must be initialized.
*
* Input: aHeader, aClassID, aInstanceID, aService
* *pOutBuf, *pInBuf, aOutBufDataLen, aInBufDataLen
* aOutBufLen, aInBufLen
*
* Output: aHeader, aService
* *pOutBuf, *pInBuf, aOutBufDataLen, aInBufDataLen
*
*
*
* Side Effects:
*
* Overview: Release predefined master/slave connections or
* the connection set.
*
* Note: None
********************************************************************/
unsigned char _DNetReleaseConnection(void);
unsigned char _DNetCreateConnections(BYTE choice);
void _DNetCloseConnections(BYTE choice);
/*********************************************************************
* Function: void DNetSetMACID(USINT macID)
*
* PreCondition:
*
* Input: macID
*
* Output: none
*
* Side Effects:
*
* Overview: Writes to the DeviceNet object variable, MACID.
*
* Note: None
********************************************************************/
#define mDNetSetMACID(macID) (uDNet.MACID = macID)
/*********************************************************************
* Function: void DNetSetBaudRate(USINT baudrate)
*
* PreCondition:
*
* Input: macID
*
* Output: none
*
* Side Effects:
*
* Overview: Writes to the DeviceNet object variable, BaudRate.
*
* Note: None
********************************************************************/
#define mDNetSetBaudRate(baudrate) (uDNet.BaudRate = baudrate)
/*********************************************************************
* Function: void DNetSetBOI(BOOL boi)
*
* PreCondition:
*
* Input: boi
*
* Output: none
*
* Side Effects:
*
* Overview: Writes to the DeviceNet object variable, BOI.
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -