📄 fmaclien.h
字号:
//-----------------------------------------------------------------------------
// $Id: fmaclient.h,v 1.0.0 2004/01/13
//-----------------------------------------------------------------------------
//
// ProfiM - PROFIBUS MASTER DRIVER FOR WINDOWS NT/2000
//
// Author:
// Pavel Trnka, CTU FEE
// trnkap@seznam.cz
// With help and advices from:
// Ing. Petr Smolik, CTU FEE
// Ing. Pavel Pisa, CTU FEE
// Ing. Pavel Burget, CTU FEE
//-----------------------------------------------------------------------------
//---------------------------------------------------------------------------
#ifndef _FMACLIENT_H_
#define _FMACLIENT_H_
typedef unsigned char UCHAR;
typedef unsigned char BYTE;
typedef unsigned short UWORD;
typedef unsigned int UDWORD;
typedef unsigned long ULONG;
//**********************************************************************************
//**********************************************************************************
//**********************************************************************************
//
// Standratni struktury pro FDL
//
//**********************************************************************************
//**********************************************************************************
//**********************************************************************************
/* ------------------- */
/* definitions for FLC */
/* ------------------- */
#define FLC_Subsys 0x22
#define DEFAULT_SAP 0xff
#define EVENT_SAP 64
#define NO_SEGMENT 0xff
#define BROADCAST 127 /* broadcast-addr.: rem_add.station, dsap = 63 */
#define MULTICAST 127 /* multicast-addr.: rem_add.station, dsap != 63 */
#define LEN_MAX_RECEIVE_BUFFER 255 /* max. buffer-length for a receive telegram */
#define LEN_MIN_RECEIVE_BUFFER 32 /* min. receive_l_sdu.length */
#define ALL 0x7f
#define SEGMENT_VALID 0x80
#define SEGMENT_INVALID 0x00
#define SEGMENT_TYP 0x40
/* example */
/* access_sap = ALL or sap_number; */
/* access_station = (ALL or station_number) + (SEGMENT_VALID or SEGMENT_INVALID); */
/* if SEGMENT_VALID: access_segment = SEGMENT_TYP + segment_number (0 ... 63); */
/* SERVICE */
#define SDA_RESERVED 0x00
#define SDN_RESERVED 0x01
#define SRD_RESERVED 0x03
#define CSRD_RESERVED 0x05
/* ROLE */
#define INITIATOR 0x00 /* only possible by "sap_activate" */
#define RESPONDER 0x10 /* possible by "sap_activate" and mandatory by "rsap_activate" */
#define BOTH_ROLES 0x20 /* only possible by "sap_activate" */
#define SERVICE_NOT_ACTIVATED 0x30 /* service not activated */
#define STATION_PASSIVE 0x00
#define STATION_NON_EXISTANT 0x10
#define STATION_NON_EXISTENT 0x10
#define STATION_ACTIVE_READY 0x20
#define STATION_ACTIVE 0x30
#define LEN_SAP_ACTIVATE sizeof(struct fdl_sap)
#define LEN_EVENT_INDICATION sizeof(struct event_indication)
enum flc_boolean
{
flc_false,
flc_true
};
enum com_class
{
request = 0x00,
confirm = 0x01,
indication = 0x02
};
enum service_code
{
sda = 0x00,
/* Send Data with Acknowledge */
sdn = 0x01,
/* Send Data with no Acknowledge */
sdn_broadcast = 0x7f,
/* only for FDL-indication !!! (signs received broadcast-telegram) */
srd = 0x03,
/* Send and Request Data */
csrd = 0x05,
/* Cyclic Send and Request Data */
reply_update_single = 0x06,
/* Reply Update Single Mode */
reply_update_multiple = 0x07,
/* Reply Update Multiple Mode */
fdl_read_value = 0x0b,
/* read busparameter */
fdl_set_value = 0x0c,
/* set busparameter */
sap_activate = 0x0e,
/* activate local SAP */
rsap_activate = 0x11,
/* activate local Responder-SAP */
sap_deactivate = 0x12,
/* deactivate local (R)SAP */
fdl_reset = 0x13,
/* reset PHY and FDL; all FDL-information is lost, exc. last busparam. */
mac_reset = 0x15,
/* reset for MAC; a part of last valid busparameter will be updated */
fdl_event = 0x18,
/* only for indication, list of events */
lsap_status = 0x19,
/* requests information of remote-SAP or local-SAP */
fdl_life_list_create_remote = 0x1a,
/* requests list of intact stations */
fdl_life_list_create_local = 0x1b,
/* requests quick-list of intact stations (LAS and GAP will be actual) */
fdl_ident = 0x1c,
/* requests data of software- and hardware-release */
fdl_read_statistic_ctr = 0x1d,
/* NOT SUPPORTED! reads counter values of statistic and resets counter */
fdl_read_las_statistic_ctr = 0x1e,
/* NOT SUPPORTED! reads LAS and las_cycle_ctr and resets las_cycle_ctr */
await_indication = 0x1f,
/* provides resources for indication (sap-dependent) */
withdraw_indication = 0x20,
/* returnes indication-resources */
load_routing_table = 0x21,
/* only for network-connection !!! */
deactivate_routing_table = 0x22,
/* only for network-connection !!! */
get_direct_conn = 0x23 /* gets adress of next station */
};
enum service_class
{
low = 0x00,
high = 0x01
};
enum link_status
{
ok = 0x00,
/* ACK. positive */
ue = 0x01,
/* ACK. negative: remote-USER/FDL interface error */
rr = 0x02,
/* ACK. negative: no remote resource available */
rs = 0x03,
/* ACK. negative: service or rem_add at remote-lsap not activated */
dl = 0x08,
/* response-data (l_sdu) low available */
nr = 0x09,
/* ACK. negative: no response-data at remote-FDL available */
dh = 0x0a,
/* response-data (l_sdu) high available */
rdl = 0x0c,
/* response-data (l_sdu) low available, but negative-ACK for send-data */
rdh = 0x0d,
/* response-data (l_sdu) high available, but negative-ACK for send-data */
ls = 0x10,
/* service not activated at local sap */
na = 0x11,
/* no reaction (ACK/RES) from remote-station */
ds = 0x12,
/* local FDL/PHY not in token-ring */
no = 0x13,
/* ACK. negative: not ok (different meanings dependant on service) */
lr = 0x14,
/* resource of local FDL not available */
iv = 0x15,
/* invalid parameter in request */
lo = 0x20,
/* LOw-prior response-data are sent at this srd */
hi = 0x21,
/* HIgh-prior response-data are sent at this srd */
no_data = 0x22 /* NO-DATA are sent at this srd */
};
enum poll_element_entry
{
unlocked = 0x00,
/* polling enabled for this element */
locked = 0x01,
/* element locked for this poll-cycle */
not_changed = 0x02 /* the same meaning as "unlocked", but layer 2 doesn't plausible this */
/* service; use only, if this element has already been sent and no */
/* parameter changed, but actualize receive_l_sdu.length !!!!!!!!! */
};
typedef enum
{
passive = 0x00,
active = 0x01,
active_fast = 0x02,
passive_fast = 0x03,
sm_active = 0x04,
/* possible returned by read_value (PROFIBUS-PA) */
sm_passive = 0x05
} station_type ;
typedef enum
{
kbaud_9_6 = 0x00,
kbaud_19_2 = 0x01,
kbaud_93_75 = 0x02,
kbaud_187_5 = 0x03,
kbaud_500 = 0x04
} baud_rate;
enum redundancy
{
no_redundancy = 0x00,
bus_a_highprior = 0x01,
bus_b_highprior = 0x02,
redundancy_on = 0x03
};
enum physical_layer
{
rs485 = 0x00,
modem = 0x01
};
enum false_bus_parameter /* "fdl_set_value" : if FDL-User sets false bus_parameter, */
/* application_block -> l_status = false_bus_parameter + iv; */
/* that means, high-byte corresponds with number of false parameter */
{
false_hsa = 0x100,
false_ts = 0x200,
false_station_type = 0x300,
false_baud_rate = 0x400,
false_medium_red = 0x500,
false_retry_ctr = 0x600,
false_default_sap = 0x700,
false_network_connection_sap = 0x800,
false_tsl = 0x900,
false_tqui = 0xa00,
false_tset = 0xb00,
false_min_tsdr = 0xc00,
false_max_tsdr = 0xd00,
false_ttr = 0xe00,
false_g = 0xf00,
false_in_ring_desired = 0x1000,
false_physical_layer = 0x1100,
false_ident = 0x1200
};
//-----------------------------------------------
struct service
{
enum service_code code;
};
struct remote_address
{
UCHAR station;
UCHAR segment; /* if no segment is used, set "NO_SEGMENT" */
};
struct link_service_data_unit
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -