亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mstp.h

?? Bacnet protocol stack for linux
?? H
字號:
/*####COPYRIGHTBEGIN####
 -------------------------------------------
 Copyright (C) 2004 Steve Karg

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to:
 The Free Software Foundation, Inc.
 59 Temple Place - Suite 330
 Boston, MA  02111-1307
 USA.

 As a special exception, if other files instantiate templates or
 use macros or inline functions from this file, or you compile
 this file and link it with other works to produce a work based
 on this file, this file does not by itself cause the resulting
 work to be covered by the GNU General Public License. However
 the source code for this file must still be made available in
 accordance with section (3) of the GNU General Public License.

 This exception does not invalidate any other reasons why a work
 based on this file might be covered by the GNU General Public
 License.
 -------------------------------------------
####COPYRIGHTEND####*/

#ifndef MSTP_H
#define MSTP_H

#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include "bacdef.h"
#include "dlmstp.h"

/*  The value 255 is used to denote broadcast when used as a */
/* destination address but is not allowed as a value for a station. */
/* Station addresses for master nodes can be 0-127.  */
/* Station addresses for slave nodes can be 127-254.  */
#define MSTP_BROADCAST_ADDRESS 255

/* MS/TP Frame Type */
/* Frame Types 8 through 127 are reserved by ASHRAE. */
#define FRAME_TYPE_TOKEN 0
#define FRAME_TYPE_POLL_FOR_MASTER 1
#define FRAME_TYPE_REPLY_TO_POLL_FOR_MASTER 2
#define FRAME_TYPE_TEST_REQUEST 3
#define FRAME_TYPE_TEST_RESPONSE 4
#define FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY 5
#define FRAME_TYPE_BACNET_DATA_NOT_EXPECTING_REPLY 6
#define FRAME_TYPE_REPLY_POSTPONED 7
/* Frame Types 128 through 255: Proprietary Frames */
/* These frames are available to vendors as proprietary (non-BACnet) frames. */
/* The first two octets of the Data field shall specify the unique vendor */
/* identification code, most significant octet first, for the type of */
/* vendor-proprietary frame to be conveyed. The length of the data portion */
/* of a Proprietary frame shall be in the range of 2 to 501 octets. */
#define FRAME_TYPE_PROPRIETARY_MIN 128
#define FRAME_TYPE_PROPRIETARY_MAX 255
/* The initial CRC16 checksum value */
#define CRC16_INITIAL_VALUE (0xFFFF)


/* receive FSM states */
typedef enum {
    MSTP_RECEIVE_STATE_IDLE,
    MSTP_RECEIVE_STATE_PREAMBLE,
    MSTP_RECEIVE_STATE_HEADER,
    MSTP_RECEIVE_STATE_HEADER_CRC,
    MSTP_RECEIVE_STATE_DATA
} MSTP_RECEIVE_STATE;

/* master node FSM states */
typedef enum {
    MSTP_MASTER_STATE_INITIALIZE,
    MSTP_MASTER_STATE_IDLE,
    MSTP_MASTER_STATE_USE_TOKEN,
    MSTP_MASTER_STATE_WAIT_FOR_REPLY,
    MSTP_MASTER_STATE_DONE_WITH_TOKEN,
    MSTP_MASTER_STATE_PASS_TOKEN,
    MSTP_MASTER_STATE_NO_TOKEN,
    MSTP_MASTER_STATE_POLL_FOR_MASTER,
    MSTP_MASTER_STATE_ANSWER_DATA_REQUEST
} MSTP_MASTER_STATE;

struct mstp_port_struct_t {
    MSTP_RECEIVE_STATE receive_state;
    /* When a master node is powered up or reset, */
    /* it shall unconditionally enter the INITIALIZE state. */
    MSTP_MASTER_STATE master_state;
    /* A Boolean flag set to TRUE by the Receive State Machine  */
    /* if an error is detected during the reception of a frame.  */
    /* Set to FALSE by the main state machine. */
    unsigned ReceiveError:1;
    /* There is data in the buffer */
    unsigned DataAvailable:1;
    unsigned FramingError:1;    /* TRUE if we got a framing error */
    unsigned ReceivedInvalidFrame:1;
    /* A Boolean flag set to TRUE by the Receive State Machine  */
    /* if a valid frame is received.  */
    /* Set to FALSE by the main state machine. */
    unsigned ReceivedValidFrame:1;
    /* A Boolean flag set to TRUE by the master machine if this node is the */
    /* only known master node. */
    unsigned SoleMaster:1;
    /* After receiving a frame this value will be TRUE until Tturnaround */
    /* has expired */
    unsigned Turn_Around_Waiting:1;
    /* stores the latest received data */
    uint8_t DataRegister;
    /* Used to accumulate the CRC on the data field of a frame. */
    uint16_t DataCRC;
    /* Used to store the data length of a received frame. */
    unsigned DataLength;
    /* Used to store the destination address of a received frame. */
    uint8_t DestinationAddress;
    /* Used to count the number of received octets or errors. */
    /* This is used in the detection of link activity. */
    /* Compared to Nmin_octets */
    uint8_t EventCount;
    /* Used to store the frame type of a received frame. */
    uint8_t FrameType;
    /* The number of frames sent by this node during a single token hold. */
    /* When this counter reaches the value Nmax_info_frames, the node must */
    /* pass the token. */
    unsigned FrameCount;
    /* Used to accumulate the CRC on the header of a frame. */
    uint8_t HeaderCRC;
    /* Used as an index by the Receive State Machine, up to a maximum value of */
    /* InputBufferSize. */
    unsigned Index;
    /* An array of octets, used to store octets as they are received. */
    /* InputBuffer is indexed from 0 to InputBufferSize-1. */
    /* The maximum size of a frame is 501 octets. */
    uint8_t InputBuffer[MAX_MPDU];
    /* "Next Station," the MAC address of the node to which This Station passes */
    /* the token. If the Next_Station is unknown, Next_Station shall be equal to */
    /* This_Station. */
    uint8_t Next_Station;
    /* "Poll Station," the MAC address of the node to which This Station last */
    /* sent a Poll For Master. This is used during token maintenance. */
    uint8_t Poll_Station;
    /* A counter of transmission retries used for Token and Poll For Master */
    /* transmission. */
    unsigned RetryCount;
    /* A timer with nominal 5 millisecond resolution used to measure and */
    /* generate silence on the medium between octets. It is incremented by a */
    /* timer process and is cleared by the Receive State Machine when activity */
    /* is detected and by the SendFrame procedure as each octet is transmitted. */
    /* Since the timer resolution is limited and the timer is not necessarily */
    /* synchronized to other machine events, a timer value of N will actually */
    /* denote intervals between N-1 and N */
    uint16_t SilenceTimer;

    /* A timer used to measure and generate Reply Postponed frames.  It is */
    /* incremented by a timer process and is cleared by the Master Node State */
    /* Machine when a Data Expecting Reply Answer activity is completed. */
    uint16_t ReplyPostponedTimer;

    /* Used to store the Source Address of a received frame. */
    uint8_t SourceAddress;

    /* The number of tokens received by this node. When this counter reaches the */
    /* value Npoll, the node polls the address range between TS and NS for */
    /* additional master nodes. TokenCount is set to zero at the end of the */
    /* polling process. */
    unsigned TokenCount;

    /* "This Station," the MAC address of this node. TS is generally read from a */
    /* hardware DIP switch, or from nonvolatile memory. Valid values for TS are */
    /* 0 to 254. The value 255 is used to denote broadcast when used as a */
    /* destination address but is not allowed as a value for TS. */
    uint8_t This_Station;

    /* This parameter represents the value of the Max_Info_Frames property of */
    /* the node's Device object. The value of Max_Info_Frames specifies the */
    /* maximum number of information frames the node may send before it must */
    /* pass the token. Max_Info_Frames may have different values on different */
    /* nodes. This may be used to allocate more or less of the available link */
    /* bandwidth to particular nodes. If Max_Info_Frames is not writable in a */
    /* node, its value shall be 1. */
    unsigned Nmax_info_frames;

    /* This parameter represents the value of the Max_Master property of the */
    /* node's Device object. The value of Max_Master specifies the highest */
    /* allowable address for master nodes. The value of Max_Master shall be */
    /* less than or equal to 127. If Max_Master is not writable in a node, */
    /* its value shall be 127. */
    unsigned Nmax_master;

    /* An array of octets, used to store PDU octets prior to being transmitted. */
    /* This array is only used for APDU messages */
    uint8_t TxBuffer[MAX_MPDU];
    unsigned TxLength;
    bool TxReady;       /* true if ready to be sent or received */
    uint8_t TxFrameType;        /* type of message - needed by MS/TP */
};

#define DEFAULT_MAX_INFO_FRAMES 1
#define DEFAULT_MAX_MASTER 127

/* The minimum time after the end of the stop bit of the final octet of a */
/* received frame before a node may enable its EIA-485 driver: 40 bit times. */
/* At 9600 baud, 40 bit times would be about 4.166 milliseconds */
#define Tturnaround  40;

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

    void MSTP_Init(
        volatile struct mstp_port_struct_t *mstp_port,
        uint8_t this_station_mac);
    void MSTP_Millisecond_Timer(
        volatile struct mstp_port_struct_t
        *mstp_port);
    void MSTP_Receive_Frame_FSM(
        volatile struct mstp_port_struct_t
        *mstp_port);
    bool MSTP_Master_Node_FSM(
        volatile struct mstp_port_struct_t
        *mstp_port);

    /* returns true if line is active */
    bool MSTP_Line_Active(
        volatile struct mstp_port_struct_t *mstp_port);

    unsigned MSTP_Create_Frame(
        uint8_t * buffer,       /* where frame is loaded */
        unsigned buffer_len,    /* amount of space available */
        uint8_t frame_type,     /* type of frame to send - see defines */
        uint8_t destination,    /* destination address */
        uint8_t source, /* source address */
        uint8_t * data, /* any data to be sent - may be null */
        unsigned data_len);     /* number of bytes of data (up to 501) */


#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久国产精品麻豆| 成人福利视频在线看| 色婷婷综合视频在线观看| 国产婷婷色一区二区三区四区| 日韩**一区毛片| 9191久久久久久久久久久| 亚洲一区二区美女| 国产99久久精品| 亚洲少妇最新在线视频| 99国产精品久| 亚洲一线二线三线视频| 欧美午夜精品久久久久久超碰 | 国产乱码一区二区三区| 日韩制服丝袜av| 精品1区2区3区| 日韩电影一二三区| 日韩美一区二区三区| 免费的国产精品| 久久久影视传媒| av中文一区二区三区| 午夜av一区二区| 日韩你懂的在线播放| 激情综合色播激情啊| 国产亚洲欧洲997久久综合| 国产成人精品www牛牛影视| 久久久无码精品亚洲日韩按摩| av在线不卡免费看| 亚洲成人av中文| 精品噜噜噜噜久久久久久久久试看| 麻豆传媒一区二区三区| 久久久久久久久久久久电影 | 一区二区三区免费网站| 日本一区二区三区四区| 日韩精品一区二区三区四区 | 97精品视频在线观看自产线路二| 亚洲免费在线观看| 91精品免费观看| fc2成人免费人成在线观看播放| 亚洲综合999| 久久精品一区二区三区四区| 欧美亚一区二区| 国产成人免费高清| 日韩av在线免费观看不卡| 国产精品女同互慰在线看| 欧美一区二区三区视频免费播放| 成人不卡免费av| 激情图片小说一区| 日韩精品电影一区亚洲| 国产日韩欧美综合一区| 欧美—级在线免费片| 91精品国产色综合久久不卡蜜臀| 成人网男人的天堂| 狠狠色2019综合网| 蜜桃精品视频在线| 亚洲网友自拍偷拍| 夜夜精品浪潮av一区二区三区| 国产精品欧美久久久久一区二区| 日韩视频免费观看高清完整版| 色综合久久中文综合久久97| 丰满亚洲少妇av| 福利一区福利二区| 国产一区高清在线| 另类欧美日韩国产在线| 午夜欧美电影在线观看| 依依成人综合视频| 一区二区三区四区在线播放| 欧美国产精品中文字幕| 久久综合九色综合欧美亚洲| 日韩一区二区中文字幕| 91麻豆精品国产91久久久使用方法| 91久久国产最好的精华液| 一本色道久久综合亚洲91| 欧美亚洲国产一区在线观看网站| 亚洲人成网站影音先锋播放| 欧美疯狂做受xxxx富婆| 欧美日韩黄色影视| 精品污污网站免费看| 欧美视频在线观看一区| 欧美色成人综合| 在线播放中文一区| 日韩精品一区二区在线| 精品国精品国产尤物美女| 精品国偷自产国产一区| 亚洲精品一区二区三区福利| 久久免费偷拍视频| 亚洲国产精品t66y| 亚洲天堂久久久久久久| 亚洲视频中文字幕| 亚洲综合激情网| 日韩中文欧美在线| 激情综合网天天干| 成人aa视频在线观看| 色偷偷久久人人79超碰人人澡| 欧洲视频一区二区| 欧美精品黑人性xxxx| 久久这里只精品最新地址| 国产亚洲一本大道中文在线| 国产精品久久久久久福利一牛影视| 成人动漫一区二区在线| 国产精品久久久99| 久久久另类综合| 国产精品第四页| 五月综合激情婷婷六月色窝| 蜜桃免费网站一区二区三区| 国产成人免费av在线| 91丨九色丨蝌蚪富婆spa| 欧美精品国产精品| 久久久久9999亚洲精品| 亚洲精品日产精品乱码不卡| 肉丝袜脚交视频一区二区| 精品一区二区三区影院在线午夜 | www.欧美精品一二区| 欧美亚州韩日在线看免费版国语版| 3d成人动漫网站| 欧美激情一二三区| 亚洲国产成人av网| 国产成人鲁色资源国产91色综 | 美日韩一区二区三区| 国产91精品在线观看| 久久丁香综合五月国产三级网站| 欧美一区二区三区免费视频| 在线观看亚洲一区| 欧美成人官网二区| 亚洲美腿欧美偷拍| 国内成人免费视频| 欧美性受极品xxxx喷水| 国产欧美日韩卡一| 午夜不卡av免费| 99久久精品免费观看| 日韩一区二区在线播放| 中文字幕一区二区三区四区 | 日韩欧美专区在线| 亚洲免费色视频| 国产**成人网毛片九色| 日韩一二三四区| 亚洲另类一区二区| 风间由美性色一区二区三区| 91精品久久久久久久99蜜桃| 亚洲蜜桃精久久久久久久| 丁香婷婷综合网| 日韩免费看的电影| 亚洲国产一区在线观看| 99久久99久久久精品齐齐| 久久免费偷拍视频| 久久精品国产精品亚洲精品| 欧美日韩在线免费视频| 美女性感视频久久| 国产网红主播福利一区二区| 国产欧美1区2区3区| 日本不卡123| 91.xcao| 洋洋成人永久网站入口| 丰满少妇久久久久久久| 337p粉嫩大胆噜噜噜噜噜91av | www.一区二区| 久久人人97超碰com| 久久精品99久久久| 日韩一区二区三区在线观看| 亚洲国产成人av| 欧美影视一区在线| 夜夜嗨av一区二区三区| 欧美性猛交xxxxxxxx| 亚洲精品菠萝久久久久久久| www.亚洲色图| 国产精品美女久久久久av爽李琼| 成人夜色视频网站在线观看| 欧美韩国一区二区| 成人一区二区在线观看| 欧美激情一区二区三区不卡| 粉嫩av一区二区三区在线播放| 日本一区二区免费在线观看视频| 国产自产2019最新不卡| 久久精品日产第一区二区三区高清版 | 欧美一级午夜免费电影| 日韩黄色小视频| 精品嫩草影院久久| 国产精品亚洲第一区在线暖暖韩国| 26uuu成人网一区二区三区| 国产高清久久久| 国产精品国产馆在线真实露脸| 91免费国产在线观看| 亚洲国产一区二区三区 | 日韩精品一区二区三区四区视频| 美女性感视频久久| 国产色产综合色产在线视频| 不卡av免费在线观看| 亚洲一区二区三区四区不卡| 777欧美精品| 九九视频精品免费| 国产精品国产三级国产aⅴ原创| 91久久久免费一区二区| 美女www一区二区| 欧美国产精品一区| 欧美三级在线播放| 精品综合免费视频观看| 中文字幕一区二区三区不卡在线| 欧美综合色免费| 久久99蜜桃精品| 亚洲免费av高清| 亚洲精品一线二线三线无人区|