Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
ce758cd3
Commit
ce758cd3
authored
Jun 26, 2019
by
Marcus Nordenberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update profibus api
parent
9344a78b
Changes
29
Show whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
3817 additions
and
4376 deletions
+3817
-4376
profibus/lib/rt/src/Papi.c
profibus/lib/rt/src/Papi.c
+344
-701
profibus/lib/rt/src/buildnr.papi.h
profibus/lib/rt/src/buildnr.papi.h
+0
-35
profibus/lib/rt/src/busparam.c
profibus/lib/rt/src/busparam.c
+48
-85
profibus/lib/rt/src/ccrl.c
profibus/lib/rt/src/ccrl.c
+174
-189
profibus/lib/rt/src/cif_api.c
profibus/lib/rt/src/cif_api.c
+682
-343
profibus/lib/rt/src/dpgdl.c
profibus/lib/rt/src/dpgdl.c
+106
-126
profibus/lib/rt/src/dpm_user.h
profibus/lib/rt/src/dpm_user.h
+240
-176
profibus/lib/rt/src/dpsgdl.c
profibus/lib/rt/src/dpsgdl.c
+49
-79
profibus/lib/rt/src/fdlgdl.c
profibus/lib/rt/src/fdlgdl.c
+35
-61
profibus/lib/rt/src/fm7gdl.c
profibus/lib/rt/src/fm7gdl.c
+62
-78
profibus/lib/rt/src/fmbgdl.c
profibus/lib/rt/src/fmbgdl.c
+40
-63
profibus/lib/rt/src/fmsgdl.c
profibus/lib/rt/src/fmsgdl.c
+188
-154
profibus/lib/rt/src/keywords.h
profibus/lib/rt/src/keywords.h
+4
-39
profibus/lib/rt/src/papiaux.c
profibus/lib/rt/src/papiaux.c
+33
-67
profibus/lib/rt/src/pb_conf.h
profibus/lib/rt/src/pb_conf.h
+21
-57
profibus/lib/rt/src/pb_dp.h
profibus/lib/rt/src/pb_dp.h
+293
-266
profibus/lib/rt/src/pb_dps.h
profibus/lib/rt/src/pb_dps.h
+65
-82
profibus/lib/rt/src/pb_err.h
profibus/lib/rt/src/pb_err.h
+174
-199
profibus/lib/rt/src/pb_fdl.h
profibus/lib/rt/src/pb_fdl.h
+98
-123
profibus/lib/rt/src/pb_fm7.h
profibus/lib/rt/src/pb_fm7.h
+226
-231
profibus/lib/rt/src/pb_fmb.h
profibus/lib/rt/src/pb_fmb.h
+115
-133
profibus/lib/rt/src/pb_fms.h
profibus/lib/rt/src/pb_fms.h
+418
-368
profibus/lib/rt/src/pb_hw.h
profibus/lib/rt/src/pb_hw.h
+0
-164
profibus/lib/rt/src/pb_if.h
profibus/lib/rt/src/pb_if.h
+133
-168
profibus/lib/rt/src/pb_ioctl.h
profibus/lib/rt/src/pb_ioctl.h
+32
-57
profibus/lib/rt/src/pb_ntdrv.h
profibus/lib/rt/src/pb_ntdrv.h
+54
-86
profibus/lib/rt/src/pb_tools.h
profibus/lib/rt/src/pb_tools.h
+12
-46
profibus/lib/rt/src/pb_type.h
profibus/lib/rt/src/pb_type.h
+10
-41
profibus/wbl/mcomp/src/profibus.wb_load
profibus/wbl/mcomp/src/profibus.wb_load
+161
-159
No files found.
profibus/lib/rt/src/Papi.c
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*******************************************************************************
/******************************************************************************
* *
*
SOFTING AG
*
*
SOFTING Industrial Automation GmbH
*
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone: (++49)-(0)89-45656-0 *
* Fax: (++49)-(0)89-45656-399 *
* *
*
Copyright (C) SOFTING AG 1995-2003
*
*
Copyright (C) SOFTING Industrial Automation GmbH 1995-2012
*
* All Rights Reserved *
* *
*******************************************************************************
...
...
@@ -55,11 +20,11 @@ MODULE PAPI
COMPONENT_LIBRARY PAPI Lib
PAPI DLL
AUTHOR SOFTING
AG
AUTHOR SOFTING
VERSION 5.
26.1
.00.release
VERSION 5.
46.0
.00.release
DATE
27-June-2003
DATE
October-2011
STATUS finished
...
...
@@ -67,12 +32,12 @@ STATUS finished
FUNCTIONAL_MODULE_DESCRIPTION
PROFIBUS
FMS/DPV1 Master and DP-Slave Application Program Interface (PAPI) for
WinXP/Win2K/WinNT
PROFIBUS
DP Master, FMS/DPV1 Master and DP-Slave Application Program Interface
(PAPI) for Linux
------------------------------------------------------------------------------------------------
This modul contains the PROFIBUS
FMS/DPV1 Master and DP-Slave Application
Program Interface
This modul contains the PROFIBUS
DP Master, FMS/DPV1 Master and DP-Slave
Application
Program Interface
functions.
...
...
@@ -142,14 +107,35 @@ extern INT16 fmbgdl_get_data_len(INT16, USIGN8, USIGN8, USIGN8*, INT16*);
EXPORT_DATA
// --- global variables used for compatibility mode
HANDLE
hServiceReadDevice
=
0
;
// Handle for Service device
HANDLE
hServiceWriteDevice
=
(
HANDLE
)
0
;
// Handle for Service device
HANDLE
hDpDataDevice
=
(
HANDLE
)
0
;
// Handle for DP-Data device
HANDLE
hDpsInputDataDevice
=
(
HANDLE
)
0
;
// Handle for DP-Slave Input-Data device
HANDLE
hDpsOutputDataDevice
=
(
HANDLE
)
0
;
// Handle for DP-Slave Output-Data device
USIGN8
CurrentBoardNumber
=
0
;
USIGN16
last_error
=
0
;
IMPORT_DATA
LOCAL_DATA
// --- copyright
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
static
const
char
copyright
[]
=
"PROFIBUS WinXP/Win2K/WinNT API (c) Copyright "
"1995-2005. SOFTING AG. All Rights Reserved."
;
// --- Operation Mode
static
USIGN32
OperationMode
;
#endif
#ifdef _LINUX
static
const
char
copyright
[]
=
"PROFIBUS Linux API (c) Copyright 1995-2005. "
"SOFTING AG. All Rights Reserved."
;
#endif
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
...
...
@@ -240,12 +226,12 @@ Possible return values:
Channel
=
0
;
// for future use
// --- open basic management device
sprintf
(
DeviceName
,
"
\\\\
.
\\
PROFIBUS
\\
Board%u
\\
Pb%u
\\
Management"
,
Board
,
Channel
);
sprintf
(
DeviceName
,
"
\\\\
.
\\
PROFIBUS
\\
Board%u
\\
Pb%u
\\
Management"
,
Board
,
Channel
);
return
(
CreateFile
(
DeviceName
,
DesiredAccess
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
));
return
(
CreateFile
(
DeviceName
,
DesiredAccess
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
));
}
#endif
...
...
@@ -253,7 +239,9 @@ Possible return values:
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
FUNCTION
GLOBAL
HANDLE
CALL_CONV
profi_open
(
IN
HANDLE
hBasicMgmtDevice
,
IN
INT32
DeviceType
,
IN
USIGN32
Index
,
IN
INT32
DesiredAccess
)
IN
INT32
DeviceType
,
IN
USIGN32
Index
,
IN
INT32
DesiredAccess
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -293,7 +281,8 @@ Possible return values:
FUNCTION_BODY
// --- select IOCTL code specified by device type
switch
(
DeviceType
)
{
switch
(
DeviceType
)
{
case
DEVICE_DP_MANAGEMENT
:
IOControlCode
=
(
DWORD
)
IOCTL_PROFI_CREATE_DP_MANAGEMENT
;
break
;
...
...
@@ -333,15 +322,16 @@ Possible return values:
// --- get device name
if
(
!
DeviceIoControl
((
HANDLE
)
hBasicMgmtDevice
,
(
DWORD
)
IOControlCode
,
(
LPVOID
)
&
Index
,
(
DWORD
)
sizeof
(
ULONG
),
(
LPVOID
)
DeviceName
,
(
DWORD
)
128
,
(
LPDWORD
)
&
BytesReturned
,
NULL
))
{
(
LPVOID
)
&
Index
,
(
DWORD
)
sizeof
(
ULONG
),
(
LPVOID
)
DeviceName
,
(
DWORD
)
128
,
(
LPDWORD
)
&
BytesReturned
,
NULL
))
{
return
(
INVALID_HANDLE_VALUE
);
}
// --- open device
return
(
CreateFile
(
DeviceName
,
DesiredAccess
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
));
return
(
CreateFile
(
DeviceName
,
DesiredAccess
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
));
}
#endif
...
...
@@ -376,9 +366,9 @@ Possible return values:
#endif
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_read_service
(
IN
HANDLE
hDevice
,
OUT
T_PROFI_SERVICE_DESCR
*
pSdb
,
OUT
VOID
*
pData
,
INOUT
USIGN16
*
pDataLength
)
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_read_service
(
IN
HANDLE
hDevice
,
OUT
T_PROFI_SERVICE_DESCR
*
pSdb
,
OUT
VOID
*
pData
,
INOUT
USIGN16
*
pDataLength
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -415,19 +405,25 @@ received
// printf("papi: profi_read_service\n");
// --- allocate memory for SDB and DATABLOCK
if
(
!
(
pSdbData
=
malloc
((
*
pDataLength
+
sizeof
(
T_PROFI_SERVICE_DESCR
)))))
{
if
(
!
(
pSdbData
=
malloc
((
*
pDataLength
+
sizeof
(
T_PROFI_SERVICE_DESCR
)))))
{
return
(
E_IF_OS_ERROR
);
}
while
((
BytesRead
=
read
(
hDevice
,
pSdbData
,
(
int
)(
*
pDataLength
+
sizeof
(
T_PROFI_SERVICE_DESCR
))))
<
0
)
{
if
(
errno
!=
EAGAIN
)
{
while
((
BytesRead
=
read
(
hDevice
,
pSdbData
,
(
int
)(
*
pDataLength
+
sizeof
(
T_PROFI_SERVICE_DESCR
))))
<
0
)
{
if
(
errno
!=
EAGAIN
)
{
free
(
pSdbData
);
printf
(
"%s
\n
"
,
strerror
(
errno
));
// printf("bytesRead=%u\n",BytesRead);
return
(
papi_get_last_error
());
}
else
{
}
else
{
*
pDataLength
=
0
;
free
(
pSdbData
);
// printf("bytesRead=%u\n",BytesRead);
...
...
@@ -439,12 +435,15 @@ received
// printf("bytesRead=%u\n",BytesRead);
// --- check if IND or CON is available
if
(
BytesRead
==
0
)
{
if
(
BytesRead
==
0
)
{
*
pDataLength
=
0
;
// printf ("%s 3\n", strerror (errno));
free
(
pSdbData
);
return
(
NO_CON_IND_RECEIVED
);
}
else
{
}
else
{
// printf("bytesRead=%u\n",BytesRead);
}
...
...
@@ -456,7 +455,8 @@ received
*
pDataLength
=
(
USIGN16
)
BytesRead
-
sizeof
(
T_PROFI_SERVICE_DESCR
);
// --- copy DATABLOCK
if
(
*
pDataLength
)
{
if
(
*
pDataLength
)
{
memcpy
(
pData
,
&
pSdbData
[
sizeof
(
T_PROFI_SERVICE_DESCR
)],
*
pDataLength
);
}
...
...
@@ -519,7 +519,8 @@ RES
pSdb
->
comm_ref
&=
0x00FF
;
// clear all BITs in upper byte
// --- check Service-Primitive
if
((
pSdb
->
primitive
==
IND
)
||
(
pSdb
->
primitive
==
CON
))
{
if
((
pSdb
->
primitive
==
IND
)
||
(
pSdb
->
primitive
==
CON
))
{
return
(
E_IF_INVALID_PRIMITIVE
);
}
...
...
@@ -528,35 +529,36 @@ RES
pSdb
->
result
=
POS
;
// --- get service specific data length
switch
(
pSdb
->
layer
)
{
switch
(
pSdb
->
layer
)
{
case
FMS
:
RetVal
=
fmsgdl_get_data_len
(
pSdb
->
result
,
pSdb
->
service
,
pSdb
->
primitive
,
pData
,
&
DataLength
);
RetVal
=
fmsgdl_get_data_len
(
pSdb
->
result
,
pSdb
->
service
,
pSdb
->
primitive
,
pData
,
&
DataLength
);
break
;
case
FM7
:
RetVal
=
fm7gdl_get_data_len
(
pSdb
->
result
,
pSdb
->
service
,
pSdb
->
primitive
,
pData
,
&
DataLength
);
RetVal
=
fm7gdl_get_data_len
(
pSdb
->
result
,
pSdb
->
service
,
pSdb
->
primitive
,
pData
,
&
DataLength
);
break
;
case
FDLIF
:
RetVal
=
fdlgdl_get_data_len
(
pSdb
->
result
,
pSdb
->
service
,
pSdb
->
primitive
,
pData
,
&
DataLength
);
RetVal
=
fdlgdl_get_data_len
(
pSdb
->
result
,
pSdb
->
service
,
pSdb
->
primitive
,
pData
,
&
DataLength
);
break
;
case
DP
:
RetVal
=
dpgdl_get_data_len
(
pSdb
->
result
,
pSdb
->
service
,
pSdb
->
primitive
,
pData
,
&
DataLength
);
RetVal
=
dpgdl_get_data_len
(
pSdb
->
result
,
pSdb
->
service
,
pSdb
->
primitive
,
pData
,
&
DataLength
);
break
;
case
FMB
:
RetVal
=
fmbgdl_get_data_len
(
pSdb
->
result
,
pSdb
->
service
,
pSdb
->
primitive
,
pData
,
&
DataLength
);
RetVal
=
fmbgdl_get_data_len
(
pSdb
->
result
,
pSdb
->
service
,
pSdb
->
primitive
,
pData
,
&
DataLength
);
break
;
case
DPS
:
RetVal
=
dpsgdl_get_data_len
(
pSdb
->
result
,
pSdb
->
service
,
pSdb
->
primitive
,
pData
,
&
DataLength
);
RetVal
=
dpsgdl_get_data_len
(
pSdb
->
result
,
pSdb
->
service
,
pSdb
->
primitive
,
pData
,
&
DataLength
);
break
;
default:
...
...
@@ -564,10 +566,12 @@ RES
break
;
}
if
(
RetVal
==
E_OK
)
{
if
(
RetVal
==
E_OK
)
{
// allocate memory for SDB and DATABLOCK
if
(
!
(
pSdbData
=
(
USIGN8
*
)
malloc
((
DataLength
+
sizeof
(
T_PROFI_SERVICE_DESCR
)))))
{
if
(
!
(
pSdbData
=
(
USIGN8
*
)
malloc
((
DataLength
+
sizeof
(
T_PROFI_SERVICE_DESCR
)))))
{
return
(
E_IF_OS_ERROR
);
}
...
...
@@ -583,8 +587,8 @@ RES
#endif
#ifdef _LINUX
if
((
write
(
hDevice
,
pSdbData
,
DataLength
+
sizeof
(
T_PROFI_SERVICE_DESCR
)))
<
0
)
if
((
write
(
hDevice
,
pSdbData
,
DataLength
+
sizeof
(
T_PROFI_SERVICE_DESCR
)))
<
0
)
#endif
{
free
(
pSdbData
);
...
...
@@ -639,7 +643,8 @@ received
FUNCTION_BODY
// --- allocate memory for SDB and DATABLOCK
if
(
!
(
pSdbData
=
malloc
((
*
pDataLength
+
sizeof
(
T_PROFI_SERVICE_DESCR
)))))
{
if
(
!
(
pSdbData
=
malloc
((
*
pDataLength
+
sizeof
(
T_PROFI_SERVICE_DESCR
)))))
{
return
(
E_IF_OS_ERROR
);
}
...
...
@@ -648,13 +653,15 @@ received
(
LPVOID
)
phDevices
,
(
DWORD
)
NrOfHandles
*
sizeof
(
HANDLE
),
(
LPVOID
)
pSdbData
,
(
DWORD
)(
*
pDataLength
+
sizeof
(
T_PROFI_SERVICE_DESCR
)),
(
LPDWORD
)
&
BytesRead
,
NULL
))
{
(
LPDWORD
)
&
BytesRead
,
NULL
))
{
free
(
pSdbData
);
return
(
papi_get_last_error
());
}
// --- check if IND or CON is available
if
(
BytesRead
==
0
)
{
if
(
BytesRead
==
0
)
{
*
pDataLength
=
0
;
free
(
pSdbData
);
return
(
NO_CON_IND_RECEIVED
);
...
...
@@ -668,7 +675,8 @@ received
*
pDataLength
=
(
USIGN16
)
BytesRead
-
sizeof
(
T_PROFI_SERVICE_DESCR
);
// --- copy DATABLOCK
if
(
*
pDataLength
)
{
if
(
*
pDataLength
)
{
memcpy
(
pData
,
&
pSdbData
[
sizeof
(
T_PROFI_SERVICE_DESCR
)],
*
pDataLength
);
}
...
...
@@ -680,94 +688,10 @@ received
#endif
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_read_data
(
IN
HANDLE
hDevice
,
OUT
VOID
*
pData
,
INOUT
USIGN16
*
pDataLength
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
This function is used to read DP-Slave-I/O-Data from a DP SLAVE DATA DEVICE.
IN: hDevice -> device handle
OUT: pData -> pointer to data buffer
INOUT: pDataLength -> IN: length of data buffer
OUT: length of received data
Possible return values:
- E_OK -> no error occured
- E_IF_INVALID_DP_STATE -> DP is not in operational state
- E_IF_SLAVE_ERROR -> no valid communication with DP-Slave
- E_IF_SLAVE_DIAG_DATA -> new DP diagnostics data available
- E_IF_INVALID_CMI_CALL -> invalid offset inside data image
- E_IF_CMI_ERROR -> serious CMI error
- E_IF_INVALID_DATA_SIZE -> size of data block provided not sufficient
- E_IF_SERVICE_CONSTR_CONFLICT -> service not executable at time
- E_IF_OS_ERROR -> NT system error
-----------------------------------------------------------------------------*/
{
LOCAL_VARIABLES
DWORD
BytesRead
=
0
;
FUNCTION_BODY
if
(
!
ReadFile
(
hDevice
,
pData
,
*
pDataLength
,
&
BytesRead
,
NULL
))
{
*
pDataLength
=
0
;
return
(
papi_get_last_error
());
}
else
{
*
pDataLength
=
(
USIGN16
)
BytesRead
;
return
(
E_OK
);
}
}
#endif
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_write_data
(
IN
HANDLE
hDevice
,
IN
VOID
*
pData
,
IN
USIGN16
DataLength
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
This function is used to write DP-Slave-I/O-Data to a DP SLAVE DATA DEVICE.
IN: hDevice -> device handle
IN: pData -> pointer to data buffer
IN: DataLength -> length of data to write
Possible return values:
- E_OK -> no error occured
- E_IF_INVALID_DP_STATE -> DP is not in operational state
- E_IF_SLAVE_ERROR -> no valid communication with DP-Slave
- E_IF_SLAVE_DIAG_DATA -> new DP diagnostics data available
- E_IF_INVALID_CMI_CALL -> invalid offset inside data image
- E_IF_CMI_ERROR -> serious CMI error
- E_IF_INVALID_DATA_SIZE -> size of data block provided not sufficient
- E_IF_SERVICE_CONSTR_CONFLICT -> service not executable at time
- E_IF_OS_ERROR -> NT system error
-----------------------------------------------------------------------------*/
{
LOCAL_VARIABLES
DWORD
BytesWritten
=
0
;
FUNCTION_BODY
// write data
if
(
!
WriteFile
(
hDevice
,
pData
,
DataLength
,
&
BytesWritten
,
NULL
))
{
return
(
papi_get_last_error
());
}
else
{
return
(
E_OK
);
}
}
#endif
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_read_dps_data
(
IN
HANDLE
hDevice
,
OUT
USIGN8
*
pData
,
INOUT
USIGN8
*
pDataLength
,
OUT
USIGN8
*
pState
)
OUT
USIGN8
*
pData
,
INOUT
USIGN8
*
pDataLength
,
OUT
USIGN8
*
pState
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -821,14 +745,18 @@ Possible return values:
*
pDataLength
=
(
USIGN8
)(
BytesRead
-
1
);
memcpy
(
pData
,
DataBuffer
,
*
pDataLength
);
return
(
E_OK
);
}
else
{
}
else
{
*
pDataLength
=
0
;
return
(
papi_get_last_error
());
}
}
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_write_dps_data
(
IN
HANDLE
hDevice
,
IN
USIGN8
*
pData
,
IN
USIGN8
DataLength
,
OUT
USIGN8
*
pState
)
IN
USIGN8
*
pData
,
IN
USIGN8
DataLength
,
OUT
USIGN8
*
pState
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -857,6 +785,7 @@ data size
#ifdef _LINUX
NTIoctl
SlaveInput
;
char
FirstByte
;
#endif
FUNCTION_BODY
...
...
@@ -875,271 +804,31 @@ data size
SlaveInput
.
OutBuf
=
(
USIGN8
*
)
pData
;
SlaveInput
.
OutBufLength
=
DataLength
;
if
(
DataLength
)
{
FirstByte
=
pData
[
0
];
}
// printf("\nprofi_get_data: buf=%p, len=%u, size=%lu\n",
// SlaveInput.InBuf,
// SlaveInput.InBufLength,
// sizeof(SlaveInput));
if
(
ioctl
(
hDevice
,
IOCTL_PROFI_SET_SLAVE_IN
,
&
SlaveInput
)
==
-
1
)
#endif
{
return
(
papi_get_last_error
());
}
else
{
return
(
E_OK
);
}
}
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
FUNCTION
GLOBAL
BOOL
CALL_CONV
profi_get_cntrl_info
(
IN
USIGN8
Board
,
OUT
char
*
pFirmwareVersion
,
OUT
USIGN32
*
pSerialDeviceNumber
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
This function is used to get the version of the firmware and the serial
device number of PROFIBUS controller.
IN: Board -> board number
OUT: pFirmwareVersion -> data buffer for firmware version string
OUT: pSerialDeviceNumber -> serial device number
NOTE: There must be at least 100 Bytes (VERSION_STRING_LENGTH) free space for
firmware version buffer.
Possible return values:
- TRUE -> function returns sucessfully
- FALSE -> function returns not successfully
-----------------------------------------------------------------------------*/
{
LOCAL_VARIABLES
DWORD
BytesRead
=
0
;
HANDLE
hDevice
;
PROFI_DATA_IMAGE_DESCR
DataImageDescr
;
char
DeviceName
[
64
];
FUNCTION_BODY
// --- open BOARD device
sprintf
(
DeviceName
,
"
\\\\
.
\\
PROFIBUS
\\
Board%u
\\
Board"
,
Board
);
if
(
INVALID_HANDLE_VALUE
==
(
hDevice
=
CreateFile
(
DeviceName
,
GENERIC_READ
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
)))
{
return
(
FALSE
);
}
// --- get FIRMWARE VERSION
DataImageDescr
.
imageId
=
ID_FW_VERS_IMAGE
;
DataImageDescr
.
offset
=
0
;
DataImageDescr
.
bus
=
0
;
if
(
!
DeviceIoControl
((
HANDLE
)
hDevice
,
(
DWORD
)
IOCTL_PROFI_GET_DATA_IMAGE
,
(
LPVOID
)
&
DataImageDescr
,
(
DWORD
)
sizeof
(
DataImageDescr
),
(
LPVOID
)
pFirmwareVersion
,
(
DWORD
)
VERSION_STRING_LENGTH
,
(
LPDWORD
)
&
BytesRead
,
NULL
))
{
CloseHandle
(
hDevice
);
return
(
FALSE
);
}
// --- get SERIAL DEVICE NUMBER
DataImageDescr
.
imageId
=
ID_SERIAL_DEVICE_NUMBER
;
DataImageDescr
.
offset
=
0
;
DataImageDescr
.
bus
=
0
;
if
(
!
DeviceIoControl
((
HANDLE
)
hDevice
,
(
DWORD
)
IOCTL_PROFI_GET_DATA_IMAGE
,
(
LPVOID
)(
VOID
*
)
&
DataImageDescr
,
(
DWORD
)
sizeof
(
DataImageDescr
),
(
LPVOID
)
pSerialDeviceNumber
,
(
DWORD
)
sizeof
(
USIGN32
),
(
LPDWORD
)
&
BytesRead
,
NULL
))
{
CloseHandle
(
hDevice
);
return
(
FALSE
);
}
CloseHandle
(
hDevice
);
return
(
TRUE
);
}
#endif
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
FUNCTION
GLOBAL
BOOL
CALL_CONV
profi_set_timeout
(
IN
HANDLE
hBasicMgmtDevice
,
IN
USIGN32
ReadTimeout
,
IN
USIGN32
WriteTimeout
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
This function is used to set send and receive TIMEOUTs for SEND/RECEIVE
interface
functions
IN: hBasicMgmtDevice -> basic management device handle
IN: ReadTimeout -> receive timeout in ms (WAIT_FOREVER for infinite wait)
IN: WriteTimeout -> send timeout in ms (WAIT_FOREVER for infinite wait)
Possible return values:
- TRUE -> function returns sucessfully
- FALSE -> function returns not successfully
-----------------------------------------------------------------------------*/
{
LOCAL_VARIABLES
DWORD
BytesReturned
;
USIGN32
ReadWriteTimeout
[
2
];
FUNCTION_BODY
ReadWriteTimeout
[
0
]
=
ReadTimeout
;
ReadWriteTimeout
[
1
]
=
WriteTimeout
;
return
(
DeviceIoControl
((
HANDLE
)
hBasicMgmtDevice
,
(
DWORD
)
IOCTL_PROFI_SET_TIMEOUT
,
(
LPVOID
)
ReadWriteTimeout
,
(
DWORD
)
2
*
sizeof
(
USIGN32
),
(
LPVOID
)
NULL
,
(
DWORD
)
0
,
(
LPDWORD
)
&
BytesReturned
,
NULL
));
}
#endif
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
FUNCTION
GLOBAL
BOOL
CALL_CONV
profi_get_timeout
(
IN
HANDLE
hBasicMgmtDevice
,
OUT
USIGN32
*
pReadTimeout
,
OUT
USIGN32
*
pWriteTimeout
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
This function is used to get the set send and receive TIMEOUTs for SEND/RECEIVE
interface functions
IN: hBasicMgmtDevice -> basic management device handle
OUT: pReadTimeout -> pointer to receive timeout in ms (WAIT_FOREVER for
infinite wait)
OUT: pWriteTimeout -> pointer to send timeout in ms (WAIT_FOREVER for
infinite wait)
Possible return values:
- TRUE -> function returns sucessfully
- FALSE -> function returns not successfully
-----------------------------------------------------------------------------*/
{
LOCAL_VARIABLES
DWORD
BytesReturned
;
USIGN32
ReadWriteTimeout
[
2
];
FUNCTION_BODY
if
(
!
DeviceIoControl
((
HANDLE
)
hBasicMgmtDevice
,
(
DWORD
)
IOCTL_PROFI_GET_TIMEOUT
,
(
LPVOID
)
NULL
,
(
DWORD
)
0
,
(
LPVOID
)
ReadWriteTimeout
,
(
DWORD
)
2
*
sizeof
(
USIGN32
),
(
LPDWORD
)
&
BytesReturned
,
NULL
))
{
return
(
FALSE
);
else
{
if
(
DataLength
)
{
pData
[
0
]
=
FirstByte
;
}
if
(
BytesReturned
==
8
)
{
*
pReadTimeout
=
ReadWriteTimeout
[
0
];
*
pWriteTimeout
=
ReadWriteTimeout
[
1
];
return
(
TRUE
);
}
else
{
SetLastError
(
ERROR_INVALID_DATA
);
return
(
FALSE
);
return
(
E_OK
);
}
}
#endif
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
FUNCTION
GLOBAL
BOOL
CALL_CONV
profi_set_queue_size
(
IN
HANDLE
hBasicMgmtDevice
,
IN
USIGN32
QueueSize
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
This function is used to set the max. receive queue size for the PROFIBUS
driver.
IN: hBasicMgmtDevice -> basic management device handle
IN: QueueSize -> max. receive queue size
Possible return values:
- TRUE -> function returns sucessfully
- FALSE -> function returns not successfully
-----------------------------------------------------------------------------*/
{
LOCAL_VARIABLES
DWORD
BytesReturned
;
FUNCTION_BODY
return
(
DeviceIoControl
((
HANDLE
)
hBasicMgmtDevice
,
(
DWORD
)
IOCTL_PROFI_SET_QUEUE_SIZE
,
(
LPVOID
)
&
QueueSize
,
(
DWORD
)
sizeof
(
USIGN32
),
(
LPVOID
)
NULL
,
(
DWORD
)
0
,
(
LPDWORD
)
&
BytesReturned
,
NULL
));
}
#endif
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
FUNCTION
GLOBAL
BOOL
CALL_CONV
profi_get_queue_size
(
IN
HANDLE
hBasicMgmtDevice
,
OUT
USIGN32
*
pQueueSize
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
This function is used to get the set max. receive queue size for the PROFIBUS
driver.
IN: hBasicMgmtDevice -> basic management device handle
OUT: pQueueSize -> pointer to max. receive queue size
Possible return values:
- TRUE -> function returns sucessfully
- FALSE -> function returns not successfully
-----------------------------------------------------------------------------*/
{
LOCAL_VARIABLES
DWORD
BytesReturned
;
FUNCTION_BODY
return
(
DeviceIoControl
((
HANDLE
)
hBasicMgmtDevice
,
(
DWORD
)
IOCTL_PROFI_GET_QUEUE_SIZE
,
(
LPVOID
)
NULL
,
(
DWORD
)
0
,
(
LPVOID
)
pQueueSize
,
(
DWORD
)
sizeof
(
USIGN32
),
(
LPDWORD
)
&
BytesReturned
,
NULL
));
}
#endif
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
FUNCTION
GLOBAL
BOOL
CALL_CONV
profi_get_overrun_count
(
IN
HANDLE
hBasicMgmtDevice
,
OUT
USIGN32
*
pOverrunCount
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
IN: hBasicMgmtDevice -> basic management device handle
OUT: pOverrunCount -> pointer to overrun counts
Possible return values:
- TRUE -> function returns sucessfully
- FALSE -> function returns not successfully
-----------------------------------------------------------------------------*/
{
LOCAL_VARIABLES
DWORD
BytesReturned
;
FUNCTION_BODY
return
(
DeviceIoControl
((
HANDLE
)
hBasicMgmtDevice
,
(
DWORD
)
IOCTL_PROFI_GET_OVERRUN_COUNT
,
(
LPVOID
)
NULL
,
(
DWORD
)
0
,
(
LPVOID
)
pOverrunCount
,
(
DWORD
)
sizeof
(
USIGN32
),
(
LPDWORD
)
&
BytesReturned
,
NULL
));
}
#endif
// ***************************************************************************
// ***************************************************************************
// *
...
...
@@ -1149,9 +838,10 @@ Possible return values:
// ***************************************************************************
// ***************************************************************************
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_set_default
(
OUT
T_PROFI_DEVICE_HANDLE
*
hDevice
,
IN
USIGN8
Board
,
IN
USIGN8
Channel
,
IN
USIGN32
ReadTimeout
,
IN
USIGN32
WriteTimeout
)
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_set_default
(
IN
USIGN8
Board
,
IN
USIGN8
Channel
,
IN
USIGN32
ReadTimeout
,
IN
USIGN32
WriteTimeout
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -1182,31 +872,35 @@ version
USIGN32
ReadWriteTimeout
[
2
];
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
DWORD
BytesReturned
;
#endif
FUNCTION_BODY
if
(
h
Device
->
hServiceReadDevice
||
hDevice
->
hServiceWriteDevice
||
hDevice
->
hDpDataDevice
)
{
if
(
h
ServiceReadDevice
||
hServiceWriteDevice
||
hDpDataDevice
)
{
return
E_IF_SERVICE_NOT_EXECUTABLE
;
// Application has called init_profibus
// before
}
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
if
(
!
ReadBoardRegistryEntries
(
Board
,
&
OperationMode
))
{
if
(
!
ReadBoardRegistryEntries
(
Board
,
&
OperationMode
))
{
return
(
E_IF_READING_REGISTRY
);
}
// get service device name
sprintf
(
DeviceName
,
"
\\\\
.
\\
PROFIBUS
\\
Board%u
\\
Pb%u
\\
Service"
,
Board
,
Channel
);
sprintf
(
DeviceName
,
"
\\\\
.
\\
PROFIBUS
\\
Board%u
\\
Pb%u
\\
Service"
,
Board
,
Channel
);
// Open service device for read access
hServiceReadDevice
=
CreateFile
(
DeviceName
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
hServiceReadDevice
=
CreateFile
(
DeviceName
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
hServiceReadDevice
==
INVALID_HANDLE_VALUE
)
{
if
(
hServiceReadDevice
==
INVALID_HANDLE_VALUE
)
{
hServiceReadDevice
=
NULL
;
return
(
E_IF_OS_ERROR
);
}
...
...
@@ -1215,22 +909,26 @@ version
hServiceWriteDevice
=
CreateFile
(
DeviceName
,
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
hServiceWriteDevice
==
INVALID_HANDLE_VALUE
)
{
if
(
hServiceWriteDevice
==
INVALID_HANDLE_VALUE
)
{
CloseHandle
(
hServiceReadDevice
);
hServiceReadDevice
=
NULL
;
hServiceWriteDevice
=
NULL
;
return
(
E_IF_OS_ERROR
);
}
if
(
OperationMode
==
FMS_DPV1_MASTER_MODE
)
{
if
(
OperationMode
==
FMS_DPV1_MASTER_MODE
)
{
// --- get DP-Master's Data device name
sprintf
(
DeviceName
,
"
\\\\
.
\\
PROFIBUS
\\
Board%u
\\
Pb%u
\\
DpData"
,
Board
,
Channel
);
sprintf
(
DeviceName
,
"
\\\\
.
\\
PROFIBUS
\\
Board%u
\\
Pb%u
\\
DpData"
,
Board
,
Channel
);
hDpDataDevice
=
CreateFile
(
DeviceName
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
hDpDataDevice
=
CreateFile
(
DeviceName
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
hDpDataDevice
==
INVALID_HANDLE_VALUE
)
{
if
(
hDpDataDevice
==
INVALID_HANDLE_VALUE
)
{
CloseHandle
(
hServiceReadDevice
);
CloseHandle
(
hServiceWriteDevice
);
hServiceReadDevice
=
NULL
;
...
...
@@ -1238,15 +936,19 @@ version
hDpDataDevice
=
NULL
;
return
(
E_IF_OS_ERROR
);
}
}
else
{
}
else
{
// get DP-Slave Input-Data device name
sprintf
(
DeviceName
,
"
\\\\
.
\\
PROFIBUS
\\
Board%u
\\
Pb%u
\\
DpSlaveInputData"
,
Board
,
Channel
);
hDpsInputDataDevice
=
CreateFile
(
DeviceName
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
hDpsInputDataDevice
=
CreateFile
(
DeviceName
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
hDpsInputDataDevice
==
INVALID_HANDLE_VALUE
)
{
if
(
hDpsInputDataDevice
==
INVALID_HANDLE_VALUE
)
{
CloseHandle
(
hServiceReadDevice
);
CloseHandle
(
hServiceWriteDevice
);
hServiceReadDevice
=
NULL
;
...
...
@@ -1259,10 +961,12 @@ version
sprintf
(
DeviceName
,
"
\\\\
.
\\
PROFIBUS
\\
Board%u
\\
Pb%u
\\
DpSlaveOutputData"
,
Board
,
Channel
);
hDpsOutputDataDevice
=
CreateFile
(
DeviceName
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
hDpsOutputDataDevice
=
CreateFile
(
DeviceName
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
hDpsOutputDataDevice
==
INVALID_HANDLE_VALUE
)
{
if
(
hDpsOutputDataDevice
==
INVALID_HANDLE_VALUE
)
{
CloseHandle
(
hServiceReadDevice
);
CloseHandle
(
hServiceWriteDevice
);
CloseHandle
(
hDpsInputDataDevice
);
...
...
@@ -1280,7 +984,8 @@ version
if
(
!
DeviceIoControl
((
HANDLE
)
hServiceReadDevice
,
(
DWORD
)
IOCTL_PROFI_SET_TIMEOUT
,
(
LPVOID
)
ReadWriteTimeout
,
(
DWORD
)
2
*
sizeof
(
USIGN32
),
(
LPVOID
)
NULL
,
(
DWORD
)
0
,
(
LPDWORD
)
&
BytesReturned
,
NULL
))
{
(
LPDWORD
)
&
BytesReturned
,
NULL
))
{
CloseHandle
(
hServiceReadDevice
);
CloseHandle
(
hServiceWriteDevice
);
if
(
hDpDataDevice
)
...
...
@@ -1310,56 +1015,59 @@ version
sprintf
(
DeviceName
,
"/dev/pbservice%u"
,
Board
+
Channel
);
// Open service device for read access
h
Device
->
h
ServiceReadDevice
=
open
(
DeviceName
,
O_RDWR
|
O_NONBLOCK
);
hServiceReadDevice
=
open
(
DeviceName
,
O_RDWR
|
O_NONBLOCK
);
if
(
hDevice
->
hServiceReadDevice
==
INVALID_HANDLE_VALUE
)
{
hDevice
->
hServiceReadDevice
=
(
HANDLE
)
NULL
;
if
(
hServiceReadDevice
==
INVALID_HANDLE_VALUE
)
{
hServiceReadDevice
=
(
HANDLE
)
0
;
return
(
E_IF_OS_ERROR
);
}
// Open service device for write access
h
Device
->
hServiceWriteDevice
=
hDevice
->
hServiceReadDevice
;
h
ServiceWriteDevice
=
hServiceReadDevice
;
// --- get DP-Master's Data device name
sprintf
(
DeviceName
,
"/dev/pbdata%u"
,
Board
+
Channel
);
hD
evice
->
hD
pDataDevice
=
open
(
DeviceName
,
O_RDWR
|
O_NONBLOCK
);
hDpDataDevice
=
open
(
DeviceName
,
O_RDWR
|
O_NONBLOCK
);
// get DP-Slave Input-Data device name
sprintf
(
DeviceName
,
"/dev/pbslin%u"
,
Board
+
Channel
);
hD
evice
->
hD
psInputDataDevice
=
open
(
DeviceName
,
O_RDWR
|
O_NONBLOCK
);
hDpsInputDataDevice
=
open
(
DeviceName
,
O_RDWR
|
O_NONBLOCK
);
// get DP-Slave Output-Data device name
sprintf
(
DeviceName
,
"/dev/pbslout%u"
,
Board
+
Channel
);
hDevice
->
hDpsOutputDataDevice
=
open
(
DeviceName
,
O_RDWR
|
O_NONBLOCK
);
if
((
hDevice
->
hDpDataDevice
==
INVALID_HANDLE_VALUE
)
&&
(
hDevice
->
hDpsInputDataDevice
==
INVALID_HANDLE_VALUE
)
&&
(
hDevice
->
hDpsOutputDataDevice
==
INVALID_HANDLE_VALUE
))
{
close
(
hDevice
->
hServiceReadDevice
);
close
(
hDevice
->
hServiceWriteDevice
);
close
(
hDevice
->
hDpDataDevice
);
close
(
hDevice
->
hDpsInputDataDevice
);
close
(
hDevice
->
hDpsOutputDataDevice
);
hDevice
->
hServiceReadDevice
=
(
HANDLE
)
NULL
;
hDevice
->
hServiceWriteDevice
=
(
HANDLE
)
NULL
;
hDevice
->
hDpDataDevice
=
(
HANDLE
)
NULL
;
hDevice
->
hDpsInputDataDevice
=
(
HANDLE
)
NULL
;
hDevice
->
hDpsOutputDataDevice
=
(
HANDLE
)
NULL
;
hDpsOutputDataDevice
=
open
(
DeviceName
,
O_RDWR
|
O_NONBLOCK
);
if
((
hDpDataDevice
==
INVALID_HANDLE_VALUE
)
&&
(
hDpsInputDataDevice
==
INVALID_HANDLE_VALUE
)
&&
(
hDpsOutputDataDevice
==
INVALID_HANDLE_VALUE
))
{
close
(
hServiceReadDevice
);
close
(
hServiceWriteDevice
);
close
(
hDpDataDevice
);
close
(
hDpsInputDataDevice
);
close
(
hDpsOutputDataDevice
);
hServiceReadDevice
=
(
HANDLE
)
0
;
hServiceWriteDevice
=
(
HANDLE
)
0
;
hDpDataDevice
=
(
HANDLE
)
0
;
hDpsInputDataDevice
=
(
HANDLE
)
0
;
hDpsOutputDataDevice
=
(
HANDLE
)
0
;
return
(
E_IF_OS_ERROR
);
}
hDevice
->
CurrentBoardNumber
=
Board
+
Channel
;
CurrentBoardNumber
=
Board
+
Channel
;
#endif
return
(
E_OK
);
}
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_init
(
OUT
T_PROFI_DEVICE_HANDLE
*
hDevice
,
IN
USIGN8
Board
,
IN
USIGN32
ReadTimeout
,
IN
USIGN32
WriteTimeout
)
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_init
(
IN
USIGN8
Board
,
IN
USIGN32
ReadTimeout
,
IN
USIGN32
WriteTimeout
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -1388,19 +1096,21 @@ version
FUNCTION_BODY
if
((
hDevice
->
hServiceReadDevice
&&
hDevice
->
hServiceWriteDevice
)
&&
(
hDevice
->
hDpDataDevice
||
(
hDevice
->
hDpsInputDataDevice
&&
hDevice
->
hDpsOutputDataDevice
)))
{
if
((
hServiceReadDevice
&&
hServiceWriteDevice
)
&&
(
hDpDataDevice
||
(
hDpsInputDataDevice
&&
hDpsOutputDataDevice
)))
{
return
(
E_OK
);
// PAPI is already initialized
}
else
{
return
(
profi_set_default
(
hDevice
,
Board
,
0
,
ReadTimeout
,
WriteTimeout
));
// initalize PAPI
}
else
{
return
(
profi_set_default
(
Board
,
0
,
ReadTimeout
,
WriteTimeout
));
// initalize PAPI
}
}
FUNCTION
GLOBAL
INT16
CALL_CONV
init_profibus
(
IN
USIGN32
DprAdress
,
IN
USIGN16
IoPortAdress
,
IN
PB_BOOL
Dummy
)
FUNCTION
GLOBAL
INT16
CALL_CONV
init_profibus
(
IN
USIGN32
DprAdress
,
IN
USIGN16
IoPortAdress
,
IN
PB_BOOL
Dummy
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -1427,21 +1137,20 @@ version
{
LOCAL_VARIABLES
T_PROFI_DEVICE_HANDLE
hDevice
;
FUNCTION_BODY
if
((
hDevice
.
hServiceReadDevice
&&
hDevice
.
hServiceWriteDevice
)
&&
(
hDevice
.
hDpDataDevice
||
(
hDevice
.
hDpsInputDataDevice
&&
hDevice
.
hDpsOutputDataDevice
)))
{
if
((
hServiceReadDevice
&&
hServiceWriteDevice
)
&&
(
hDpDataDevice
||
(
hDpsInputDataDevice
&&
hDpsOutputDataDevice
)))
{
return
(
E_OK
);
// PAPI is already initialized
}
else
{
return
(
profi_set_default
(
&
hDevice
,
0
,
0
,
0
,
0
));
// initalize PAPI
}
else
{
return
(
profi_set_default
(
0
,
0
,
0
,
0
));
// initalize PAPI
}
}
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_end
(
IN
T_PROFI_DEVICE_HANDLE
*
hDevice
)
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_end
(
VOID
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -1459,75 +1168,79 @@ Possible return values:
FUNCTION_BODY
// close service device
if
(
hDevice
->
hServiceReadDevice
)
{
if
(
hServiceReadDevice
)
{
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
CloseHandle
(
hServiceReadDevice
);
#endif
#ifdef _LINUX
close
(
h
Device
->
h
ServiceReadDevice
);
close
(
hServiceReadDevice
);
#endif
h
Device
->
hServiceReadDevice
=
(
HANDLE
)
NULL
;
h
ServiceReadDevice
=
(
HANDLE
)
0
;
}
if
(
hDevice
->
hServiceWriteDevice
)
{
if
(
hServiceWriteDevice
)
{
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
CloseHandle
(
hServiceWriteDevice
);
#endif
#ifdef _LINUX
close
(
h
Device
->
h
ServiceWriteDevice
);
close
(
hServiceWriteDevice
);
#endif
h
Device
->
hServiceWriteDevice
=
(
HANDLE
)
NULL
;
h
ServiceWriteDevice
=
(
HANDLE
)
0
;
}
// close DP-Data device
if
(
hDevice
->
hDpDataDevice
)
{
if
(
hDpDataDevice
)
{
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
CloseHandle
(
hDpDataDevice
);
#endif
#ifdef _LINUX
close
(
hD
evice
->
hD
pDataDevice
);
close
(
hDpDataDevice
);
#endif
hD
evice
->
hDpDataDevice
=
(
HANDLE
)
NULL
;
hD
pDataDevice
=
(
HANDLE
)
0
;
}
// close DP-Slave Input-Data device
if
(
hDevice
->
hDpsInputDataDevice
)
{
if
(
hDpsInputDataDevice
)
{
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
CloseHandle
(
hDpsInputDataDevice
);
#endif
#ifdef _LINUX
close
(
hD
evice
->
hD
psInputDataDevice
);
close
(
hDpsInputDataDevice
);
#endif
hD
evice
->
hDpsInputDataDevice
=
(
HANDLE
)
NULL
;
hD
psInputDataDevice
=
(
HANDLE
)
0
;
}
// close DP-Slave Output-Data device
if
(
hDevice
->
hDpsOutputDataDevice
)
{
if
(
hDpsOutputDataDevice
)
{
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
CloseHandle
(
hDpsOutputDataDevice
);
#endif
#ifdef _LINUX
close
(
hD
evice
->
hD
psOutputDataDevice
);
close
(
hDpsOutputDataDevice
);
#endif
hD
evice
->
hDpsOutputDataDevice
=
(
HANDLE
)
NULL
;
hD
psOutputDataDevice
=
(
HANDLE
)
0
;
}
return
(
E_OK
);
}
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_snd_req_res
(
IN
T_PROFI_DEVICE_HANDLE
*
hDevice
,
IN
T_PROFI_SERVICE_DESCR
*
pSdb
,
IN
VOID
*
pData
,
IN
PB_BOOL
dummy
)
IN
T_PROFI_SERVICE_DESCR
*
pSdb
,
IN
VOID
*
pData
,
IN
PB_BOOL
dummy
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -1566,15 +1279,15 @@ RES
FUNCTION_BODY
// --- check if service device is open
if
(
!
h
Device
||
!
hDevice
->
h
ServiceWriteDevice
)
if
(
!
hServiceWriteDevice
)
return
(
E_IF_PAPI_NOT_INITIALIZED
);
return
(
profi_write_service
(
h
Device
->
h
ServiceWriteDevice
,
pSdb
,
pData
));
return
(
profi_write_service
(
hServiceWriteDevice
,
pSdb
,
pData
));
}
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_rcv_con_ind
(
IN
T_PROFI_DEVICE_HANDLE
*
hDevice
,
OUT
T_PROFI_SERVICE_DESCR
*
pSdb
,
OUT
VOID
*
pData
,
INOUT
USIGN16
*
pDataLength
)
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_rcv_con_ind
(
OUT
T_PROFI_SERVICE_DESCR
*
pSdb
,
OUT
VOID
*
pData
,
INOUT
USIGN16
*
pDataLength
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -1602,16 +1315,16 @@ Possible return values:
FUNCTION_BODY
// --- check if service device is open
if
(
!
h
Device
||
!
hDevice
->
h
ServiceReadDevice
)
if
(
!
hServiceReadDevice
)
return
(
E_IF_PAPI_NOT_INITIALIZED
);
return
(
profi_read_service
(
hDevice
->
hServiceReadDevice
,
pSdb
,
pData
,
pDataLength
));
return
(
profi_read_service
(
hServiceReadDevice
,
pSdb
,
pData
,
pDataLength
));
}
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_set_data
(
IN
T_PROFI_DEVICE_HANDLE
*
hDevice
,
IN
USIGN8
DataId
,
IN
USIGN16
Offset
,
IN
USIGN16
DataLength
,
IN
VOID
*
pData
)
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_set_data
(
IN
USIGN8
DataId
,
IN
USIGN16
Offset
,
IN
USIGN16
DataLength
,
IN
VOID
*
pData
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -1647,7 +1360,7 @@ possible return values:
FUNCTION_BODY
// --- check if DP-Data device is open
if
(
!
hD
evice
->
hD
pDataDevice
)
if
(
!
hDpDataDevice
)
return
(
E_IF_PAPI_NOT_INITIALIZED
);
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
...
...
@@ -1656,18 +1369,22 @@ possible return values:
overlapped
.
Offset
=
Offset
;
// write data
if
(
!
WriteFile
(
hDpDataDevice
,
pData
,
DataLength
,
&
BytesWritten
,
&
overlapped
))
{
if
(
!
WriteFile
(
hDpDataDevice
,
pData
,
DataLength
,
&
BytesWritten
,
&
overlapped
))
{
return
(
papi_get_last_error
());
}
#endif
#ifdef _LINUX
if
(
lseek
(
hDevice
->
hDpDataDevice
,
Offset
,
SEEK_SET
)
<
0
)
{
if
(
lseek
(
hDpDataDevice
,
Offset
,
SEEK_SET
)
<
0
)
{
printf
(
"lseek error
\n
"
);
return
(
papi_get_last_error
());
}
if
(
write
(
hDevice
->
hDpDataDevice
,
pData
,
DataLength
)
<
0
)
{
if
(
write
(
hDpDataDevice
,
pData
,
DataLength
)
<
0
)
{
printf
(
"write error
\n
"
);
return
(
papi_get_last_error
());
}
#endif
...
...
@@ -1675,9 +1392,10 @@ possible return values:
return
(
E_OK
);
}
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_get_data
(
IN
T_PROFI_DEVICE_HANDLE
*
hDevice
,
IN
USIGN8
DataId
,
IN
USIGN16
Offset
,
INOUT
USIGN16
*
pDataLength
,
OUT
VOID
*
pData
)
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_get_data
(
IN
USIGN8
DataId
,
IN
USIGN16
Offset
,
INOUT
USIGN16
*
pDataLength
,
OUT
VOID
*
pData
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -1709,66 +1427,31 @@ possible return values:
FUNCTION_BODY
INT16
RetVal
=
E_OK
;
HANDLE
hBoard
=
(
HANDLE
)
NULL
;
HANDLE
hBoard
=
(
HANDLE
)
0
;
char
DeviceName
[
64
];
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
DWORD
BytesRead
=
0
;
T_PROFI_DATA_IMAGE_DESCR
DataImageDescr
;
OVERLAPPED
Overlapped
;
#endif
#ifdef _LINUX
ssize_t
BytesRead
=
0
;
DataImage
DataImageDescr
;
#endif
switch
(
DataId
)
{
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
case
ID_SERIAL_DEVICE_NUMBER
:
case
ID_FW_VERS_IMAGE
:
case
ID_EXCEPTION_IMAGE
:
// --- open BOARD-Device
sprintfprofi_get_data
(
DeviceName
,
"
\\\\
.
\\
PROFIBUS
\\
Board%u
\\
Board"
,
CurrentBoardNumber
);
if
(
INVALID_HANDLE_VALUE
==
(
hBoard
=
CreateFile
(
DeviceName
,
0
,
0
,
NULL
,
OPEN_ALWAYS
,
profi_get_data
FILE_ATTRIBUTE_NORMAL
,
NULL
)))
{
BytesRead
return
(
E_IF_OS_ERROR
);
}
// --- set input IOCTL data structure
DataImageDescr
.
imageId
=
DataId
;
DataImageDescr
.
offset
=
Offset
;
DataImageDescr
.
bus
=
0
;
// --- read DATA-Image
if
(
DeviceIoprofi_get_dataControl
((
HANDLE
)
hBoard
,
(
DWORD
)
IOCTL_PROFI_GET_DATA_IMAGE
,
(
LPVOID
)
&
DataImageDescr
,
BytesRead
(
DWORD
)
sizeof
(
DataImageDescr
),
(
LPVOID
)
pData
,
(
DWORD
)
*
pDataLength
,
(
LPDWORD
)
&
BytesRead
,
NULL
))
{
profi_get_data
*
pDataLength
=
(
USIGN16
)
BytesRead
;
RetVal
=
E_OK
;
}
else
{
*
pDataLength
=
0
;
RetVal
=
papi_get_last_error
();
}
CloseHandle
(
hBoard
);
#endif // BytesRead
switch
(
DataId
)
{
#ifdef _LINUX
case
ID_SERIAL_DEVICE_NUMBER
:
case
ID_FW_VERS_IMAGE
:
sprintf
(
DeviceName
,
"/dev/pbboard%u"
,
hDevice
->
CurrentBoardNumber
);
sprintf
(
DeviceName
,
"/dev/pbboard%u"
,
CurrentBoardNumber
);
if
((
hBoard
=
open
(
DeviceName
,
O_RDONLY
))
<
0
)
{
if
((
hBoard
=
open
(
DeviceName
,
O_RDONLY
))
<
0
)
{
return
(
papi_get_last_error
());
}
if
(
DataId
==
ID_SERIAL_DEVICE_NUMBER
)
{
if
(
lseek
(
hBoard
,
Offset
,
SEEK_SET
)
<
0
)
{
if
(
DataId
==
ID_SERIAL_DEVICE_NUMBER
)
{
if
(
lseek
(
hBoard
,
Offset
,
SEEK_SET
)
<
0
)
{
return
(
papi_get_last_error
());
}
...
...
@@ -1776,21 +1459,34 @@ possible return values:
DataImageDescr
.
Buf
=
pData
;
DataImageDescr
.
Length
=
*
pDataLength
;
if
(
ioctl
(
hBoard
,
IOCTL_PROFI_SERIAL_NUMBER
,
&
DataImageDescr
)
==
-
1
)
{
// printf("\nprofi_get_data: buf=%p, len=%u, size=%lu\n",
// DataImageDescr.Buf,
// DataImageDescr.Length,
// sizeof(DataImageDescr));
if
(
ioctl
(
hBoard
,
IOCTL_PROFI_SERIAL_NUMBER
,
&
DataImageDescr
)
==
-
1
)
{
*
pDataLength
=
0
;
RetVal
=
papi_get_last_error
();
}
else
{
}
else
{
*
pDataLength
=
(
USIGN16
)
4
;
*
(
USIGN32
*
)
pData
=
*
(
USIGN32
*
)
&
DataImageDescr
;
RetVal
=
E_OK
;
// printf("papi: Serialnumber = %lu len = %hu\n",*(USIGN32*)pData,
// BytesRead);
}
}
else
{
if
((
BytesRead
=
read
(
hBoard
,
pData
,
*
pDataLength
))
<
0
)
{
}
else
{
if
((
BytesRead
=
read
(
hBoard
,
pData
,
*
pDataLength
))
<
0
)
{
*
pDataLength
=
0
;
RetVal
=
papi_get_last_error
();
}
else
{
}
else
{
*
pDataLength
=
(
USIGN16
)
BytesRead
;
RetVal
=
E_OK
;
}
...
...
@@ -1803,24 +1499,13 @@ possible return values:
case
ID_DP_SLAVE_IO_IMAGE
:
// --- check if DP-Data device is open
if
(
!
hD
evice
->
hD
pDataDevice
)
if
(
!
hDpDataDevice
)
return
(
E_IF_PAPI_NOT_INITIALIZED
);
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
// --- init overlapped structure
memset
(
&
Overlapped
,
0
,
sizeof
(
OVERLAPPED
));
Overlapped
.
OfhBoardfset
=
Offset
;
if
(
!
ReadFile
(
hDpDataDevice
,
pData
,
*
pDataLength
,
&
BytesRead
,
&
Overlapped
))
{
return
(
papi_get_last_error
());
}
#endif
#ifdef _LINUX
if
(
lseek
(
hDevice
->
hDpDataDevice
,
Offset
,
SEEK_SET
)
<
0
)
{
if
(
lseek
(
hDpDataDevice
,
Offset
,
SEEK_SET
)
<
0
)
{
return
(
papi_get_last_error
());
}
...
...
@@ -1834,13 +1519,21 @@ possible return values:
&DataImageDescr,
CurrentBoardNumber);
*/
if
(
ioctl
(
hDevice
->
hDpDataDevice
,
IOCTL_PROFI_GET_DATA_IMAGE
,
&
DataImageDescr
)
==
-
1
)
{
// printf("\nprofi_get_data: buf=%p, IOCTL_PROFI_GET_DATA_IMAGE
// len=%u, size=%lu\n",
// DataImageDescr.Buf,
// DataImageDescr.Length,
// sizeof(DataImageDescr));
if
(
ioctl
((
int
)
hDpDataDevice
,
(
int
)
IOCTL_PROFI_GET_DATA_IMAGE
,
&
DataImageDescr
)
==
-
1
)
{
BytesRead
=
0
;
RetVal
=
papi_get_last_error
();
}
else
{
}
else
{
BytesRead
=
(
USIGN16
)
DataImageDescr
.
Length
;
// printf("papi data length = %u\n", BytesRead);
RetVal
=
E_OK
;
...
...
@@ -1856,8 +1549,8 @@ possible return values:
}
}
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_set_dps_input_data
(
IN
T_PROFI_DEVICE_HANDLE
*
hDevice
,
IN
USIGN8
*
pData
,
IN
USIGN8
DataLength
,
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_set_dps_input_data
(
IN
USIGN8
*
pData
,
IN
USIGN8
DataLength
,
OUT
USIGN8
*
pState
)
/*-----------------------------------------------------------------------------
...
...
@@ -1883,17 +1576,16 @@ data size
FUNCTION_BODY
if
(
hDevice
->
hDpsInputDataDevice
==
(
HANDLE
)
NULL
)
{
if
(
hDpsInputDataDevice
==
(
HANDLE
)
0
)
{
return
(
E_IF_PAPI_NOT_INITIALIZED
);
}
return
(
profi_write_dps_data
(
hDevice
->
hDpsInputDataDevice
,
pData
,
DataLength
,
pState
));
return
(
profi_write_dps_data
(
hDpsInputDataDevice
,
pData
,
DataLength
,
pState
));
}
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_get_dps_input_data
(
IN
T_PROFI_DEVICE_HANDLE
*
hDevice
,
OUT
USIGN8
*
pData
,
INOUT
USIGN8
*
pDataLength
,
OUT
USIGN8
*
pState
)
OUT
USIGN8
*
pData
,
INOUT
USIGN8
*
pDataLength
,
OUT
USIGN8
*
pState
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -1915,17 +1607,16 @@ possible return values:
FUNCTION_BODY
if
(
hDevice
->
hDpsInputDataDevice
==
(
HANDLE
)
NULL
)
{
if
(
hDpsInputDataDevice
==
(
HANDLE
)
0
)
{
return
(
E_IF_PAPI_NOT_INITIALIZED
);
}
return
(
profi_read_dps_data
(
hDevice
->
hDpsInputDataDevice
,
pData
,
pDataLength
,
pState
));
return
(
profi_read_dps_data
(
hDpsInputDataDevice
,
pData
,
pDataLength
,
pState
));
}
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_get_dps_output_data
(
IN
T_PROFI_DEVICE_HANDLE
*
hDevice
,
OUT
USIGN8
*
pData
,
INOUT
USIGN8
*
pDataLength
,
OUT
USIGN8
*
pState
)
OUT
USIGN8
*
pData
,
INOUT
USIGN8
*
pDataLength
,
OUT
USIGN8
*
pState
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -1949,17 +1640,17 @@ possible return values:
FUNCTION_BODY
if
(
hDevice
->
hDpsOutputDataDevice
==
(
HANDLE
)
NULL
)
{
if
(
hDpsOutputDataDevice
==
(
HANDLE
)
0
)
{
return
(
E_IF_PAPI_NOT_INITIALIZED
);
}
return
(
profi_read_dps_data
(
hDevice
->
hDpsOutputDataDevice
,
pData
,
pDataLength
,
pState
));
return
(
profi_read_dps_data
(
hDpsOutputDataDevice
,
pData
,
pDataLength
,
pState
));
}
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_get_versions
(
IN
T_PROFI_DEVICE_HANDLE
*
hDevice
,
OUT
CSTRING
*
pPapiVersion
,
OUT
CSTRING
*
pFirmwareVersion
)
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_get_versions
(
OUT
CSTRING
*
pPapiVersion
,
OUT
CSTRING
*
pFirmwareVersion
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -1997,14 +1688,15 @@ Possible return values:
// --- get PROFIBUS firmware version
DataLength
=
(
USIGN16
)
VERSION_STRING_LENGTH
;
if
(
profi_get_data
(
hDevice
,
ID_FW_VERS_IMAGE
,
0
,
&
DataLength
,
pFirmwareVersion
)
!=
E_OK
)
{
if
(
profi_get_data
(
ID_FW_VERS_IMAGE
,
0
,
&
DataLength
,
pFirmwareVersion
)
!=
E_OK
)
{
strcpy
(
pFirmwareVersion
,
(
CSTRING
*
)
"controller not initialized"
);
}
// --- convert \n to ' '
for
(
i
=
0
;
i
<
VERSION_STRING_LENGTH
;
i
++
)
{
for
(
i
=
0
;
i
<
VERSION_STRING_LENGTH
;
i
++
)
{
if
(
pFirmwareVersion
[
i
]
==
'\n'
)
pFirmwareVersion
[
i
]
=
' '
;
else
if
(
pFirmwareVersion
[
i
]
==
'\0'
)
...
...
@@ -2016,8 +1708,8 @@ Possible return values:
return
(
E_OK
);
}
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_get_serial_device_number
(
IN
T_PROFI_DEVICE_HANDLE
*
hDevice
,
OUT
USIGN32
*
pSerialDeviceNumber
)
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_get_serial_device_number
(
OUT
USIGN32
*
pSerialDeviceNumber
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -2041,8 +1733,8 @@ Possible return values:
DataLength
=
(
USIGN16
)
sizeof
(
USIGN32
);
// --- get serial device number
return
(
profi_get_data
(
hDevice
,
ID_SERIAL_DEVICE_NUMBER
,
0
,
&
DataLength
,
pSerialDeviceNumber
));
return
(
profi_get_data
(
ID_SERIAL_DEVICE_NUMBER
,
0
,
&
DataLength
,
pSerialDeviceNumber
));
}
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_get_last_error
(
VOID
)
...
...
@@ -2080,55 +1772,6 @@ Possible return values:
#endif
}
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
FUNCTION
BOOL
WINAPI
DllMain
(
IN
HINSTANCE
hInstDLL
,
IN
ULONG
Reason
,
IN
LPVOID
pReserved
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
32Bit-DLL main function.
The function is called by MS-Windows during loading DLL.
Possible return values:
- TRUE
-----------------------------------------------------------------------------*/
{
LOCAL_VARIABLES
FUNCTION_BODY
switch
(
Reason
)
{
case
DLL_PROCESS_ATTACH
:
hServiceReadDevice
=
NULL
;
hServiceWriteDevice
=
NULL
;
hDpDataDevice
=
NULL
;
hDpsInputDataDevice
=
NULL
;
hDpsOutputDataDevice
=
NULL
;
CurrentBoardNumber
=
0
;
break
;
case
DLL_THREAD_ATTACH
:
break
;
case
DLL_THREAD_DETACH
:
break
;
case
DLL_PROCESS_DETACH
:
profi_end
();
break
;
default:
break
;
}
return
TRUE
;
}
#endif
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
#pragma check_stack
#endif
profibus/lib/rt/src/buildnr.papi.h
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
#define BUILD_NUMBER 52
#define BUILD_NUMBER_STR "52"
...
...
profibus/lib/rt/src/busparam.c
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************
/******************************************************************************
* *
*
SOFTING AG
*
*
SOFTING Industrial Automation GmbH
*
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone:
++49-89-4 56 56-0
*
*
Fax: ++49-89-4 56 56-3 99
*
* Phone:
(++49)-(0)89-45656-0
*
*
Fax: (++49)-(0)89-45656-399
*
* *
*
Copyright (C) SOFTING AG 1995-2003
*
*
Copyright (C) SOFTING Industrial Automation GmbH 1995-2012
*
* All Rights Reserved *
* *
******************************************************************************
******************************************************************************
*
FILE_NAME BUSPARAM.C
...
...
@@ -55,25 +20,11 @@ MODULE BUSPARAM
COMPONENT_LIBRARY PBT LIBs and DLL (16-Bit)
PBTOOLS DLL (32-Bit)
AUTHOR SOFTING AG
VERSION 5.00
5.01
5.02
5.10
5.11
5.20.0.00.alpha
5.20.0.00.release
5.21.0.00.release
DATE 24-November-1995
31-January-1996
14-July-1996
20-Febrary-1997
18-March-1997
30-July-1997
17-October-1997
27-February-1998
AUTHOR SOFTING
VERSION 5.21.0.00.release
DATE February-1998
STATUS finished
...
...
@@ -138,7 +89,8 @@ possible return values:
FUNCTION_BODY
switch
(
baud_rate
)
{
switch
(
baud_rate
)
{
case
0
:
/* 9,6 KBaud */
case
1
:
/* 19,2 KBaud */
case
2
:
/* 93,75 KBaud */
...
...
@@ -242,7 +194,8 @@ possible return values:
FUNCTION_BODY
switch
(
baud_rate
)
{
switch
(
baud_rate
)
{
case
0
:
/* 9,6 KBaud */
bus_param_ptr
->
tsl
=
100
;
bus_param_ptr
->
min_tsdr
=
30
;
...
...
@@ -365,7 +318,8 @@ possible return values:
FUNCTION_BODY
switch
(
baud_rate
)
{
switch
(
baud_rate
)
{
case
0
:
/* 9,6 KBaud */
bus_param_ptr
->
tsl
=
125
;
bus_param_ptr
->
min_tsdr
=
30
;
...
...
@@ -481,8 +435,8 @@ possible return values:
}
}
FUNCTION
GLOBAL
PB_BOOL
CALL_CONV
pbt_get_dp_def_bus_param
(
IN
USIGN8
baud_rate
,
IN
USIGN8
station_addr
,
IN
USIGN16
mode
,
FUNCTION
GLOBAL
PB_BOOL
CALL_CONV
pbt_get_dp_def_bus_param
(
IN
USIGN8
baud_rate
,
IN
USIGN8
station_addr
,
IN
USIGN16
mode
,
OUT
T_DP_BUS_PARA_SET
FAR
*
bus_param_ptr
)
/*----------------------------------------------------------------------------
...
...
@@ -510,7 +464,8 @@ possible return values:
FUNCTION_BODY
ret_val
=
PB_TRUE
;
switch
(
mode
)
{
switch
(
mode
)
{
case
DP_MODE
:
/* only DP mode */
ret_val
=
pbt_get_bus_param_for_dp
(
baud_rate
,
&
bus_param
);
break
;
...
...
@@ -524,7 +479,8 @@ possible return values:
break
;
}
if
(
ret_val
==
PB_TRUE
)
{
if
(
ret_val
==
PB_TRUE
)
{
/* -- set variable busparametes ---------------------------------------- */
bus_param_ptr
->
tsl
=
bus_param
.
tsl
;
bus_param_ptr
->
min_tsdr
=
bus_param
.
min_tsdr
;
...
...
@@ -583,7 +539,8 @@ possible return values:
FUNCTION_BODY
if
(
pbt_get_bus_param_for_fms
(
baud_rate
,
&
bus_param
))
{
if
(
pbt_get_bus_param_for_fms
(
baud_rate
,
&
bus_param
))
{
/* -- set variable busparametes -------------------------------------- */
bus_param_ptr
->
tsl
=
bus_param
.
tsl
;
bus_param_ptr
->
min_tsdr
=
bus_param
.
min_tsdr
;
...
...
@@ -607,7 +564,9 @@ possible return values:
bus_param_ptr
->
ident
[
3
]
=
0
;
return
(
PB_TRUE
);
}
else
{
}
else
{
return
(
PB_FALSE
);
}
}
...
...
@@ -644,7 +603,8 @@ possible return values:
FUNCTION_BODY
switch
(
mode
)
{
switch
(
mode
)
{
case
DP_MODE
:
/* only DP mode */
ret_val
=
pbt_get_bus_param_for_dp
(
baud_rate
,
&
bus_param
);
break
;
...
...
@@ -662,7 +622,8 @@ possible return values:
break
;
}
if
(
ret_val
==
PB_TRUE
)
{
if
(
ret_val
==
PB_TRUE
)
{
/* -- set variable busparametes ---------------------------------------- */
bus_param_ptr
->
tsl
=
bus_param
.
tsl
;
bus_param_ptr
->
min_tsdr
=
bus_param
.
min_tsdr
;
...
...
@@ -689,9 +650,9 @@ possible return values:
return
(
ret_val
);
}
FUNCTION
GLOBAL
PB_BOOL
CALL_CONV
pbt_get_fmb_def_bus_param
(
IN
USIGN8
baud_rate
,
IN
USIGN8
station_addr
,
IN
PB_BOOL
in_ring_desired
,
IN
USIGN16
mode
,
OUT
T_FMB_SET_BUSPARAMETER_REQ
FAR
*
bus_param_ptr
)
FUNCTION
GLOBAL
PB_BOOL
CALL_CONV
pbt_get_fmb_def_bus_param
(
IN
USIGN8
baud_rate
,
IN
USIGN8
station_addr
,
IN
PB_BOOL
in_ring_desired
,
IN
USIGN16
mode
,
OUT
T_FMB_SET_BUSPARAMETER_REQ
FAR
*
bus_param_ptr
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -720,7 +681,8 @@ possible return values:
FUNCTION_BODY
switch
(
mode
)
{
switch
(
mode
)
{
case
DP_MODE
:
/* only DP mode */
ret_val
=
pbt_get_bus_param_for_dp
(
baud_rate
,
&
bus_param
);
break
;
...
...
@@ -738,7 +700,8 @@ possible return values:
break
;
}
if
(
ret_val
==
PB_TRUE
)
{
if
(
ret_val
==
PB_TRUE
)
{
/* -- set variable busparametes ---------------------------------------- */
bus_param_ptr
->
tsl
=
bus_param
.
tsl
;
bus_param_ptr
->
min_tsdr
=
bus_param
.
min_tsdr
;
...
...
profibus/lib/rt/src/ccrl.c
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************
/******************************************************************************
* *
*
SOFTING AG
*
*
SOFTING Industrial Automation GmbH
*
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone:
++49-89-4 56 56-0
*
*
Fax: ++49-89-4 56 56-3 99
*
* Phone:
(++49)-(0)89-45656-0
*
*
Fax: (++49)-(0)89-45656-399
*
* *
*
Copyright (C) SOFTING AG 1995-2003
*
*
Copyright (C) SOFTING Industrial Automation GmbH 1995-2012
*
* All Rights Reserved *
* *
******************************************************************************
*******************************************************************************
FILE_NAME CCRL.C
PROJECT_NAME PROFIBUS
...
...
@@ -54,25 +20,11 @@ MODULE CCRL
COMPONENT_LIBRARY PBT LIBs and DLL (16-Bit)
PBTOOLS.DLL (32-Bit)
AUTHOR SOFTING AG
VERSION 5.00
5.01
5.02
5.10
5.11
5.20.0.00.alpha
5.20.0.00.release
5.21.0.00.release
DATE 24-November-1995
31-January-1996
14-July-1996
20-Febrary-1997
18-March-1997
30-July-1997
17-October-1997
27-February-1998
AUTHOR SOFTING
VERSION 5.21.0.00.release
DATE February-1998
STATUS finished
...
...
@@ -133,14 +85,12 @@ INCLUDES
#include <windows.h>
#endif
#include "co_math.h"
#include "pb_type.h"
#include "pb_if.h"
#include "pb_fmb.h"
#include "pb_fm7.h"
#include "pb_err.h"
#include "pb_tools.h"
#include <pb_type.h>
#include <pb_if.h>
#include <pb_fmb.h>
#include <pb_fm7.h>
#include <pb_err.h>
#include <pb_tools.h>
LOCAL_DEFINES
...
...
@@ -156,17 +106,29 @@ LOCAL_DEFINES
#define _IS_I_CONN(x) ((x & 0x03) == I_CONN)
#define _IS_CYCLIC(type) (type & 0x02)
#define _WITHOUT_SLAVE_INITIATIVE(type) (!(type & 0x04))
#define _IS_CONN_LESS(x) ((x & 0x09) == BRCT)
#define _IS_CONN_ORIENTED(x) (!_IS_CONN_LESS(x))
#ifndef min
#define min(a, b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef max
#define max(a, b) (((a) > (b)) ? (a) : (b))
#endif
LOCAL_TYPEDEFS
typedef
struct
_T_CCRL_CONN_RESRCES
{
typedef
struct
_T_CCRL_CONN_RESRCES
{
USIGN8
no_of_fal_sdbs
;
USIGN8
no_of_fdl_sdbs
;
USIGN8
no_of_data_buffer
;
USIGN8
no_of_api_buffer
;
}
T_CCRL_CONN_RESRCES
;
typedef
struct
_T_CCRL
{
typedef
struct
_T_CCRL
{
T_FMB_CONFIG_CRL
ccrl
;
USIGN8
poll_sap
;
PB_BOOL
mms_exist
;
...
...
@@ -188,8 +150,8 @@ static T_CCRL ccrl_obj;
#pragma check_stack(off)
#endif
FUNCTION
LOCAL
USIGN16
ccrl_determine_role
(
IN
T_CRL_STATIC
FAR
*
crl_ptr
,
IN
USIGN8
*
role_ptr
)
FUNCTION
LOCAL
USIGN16
ccrl_determine_role
(
IN
T_CRL_STATIC
FAR
*
crl_ptr
,
IN
USIGN8
*
role_ptr
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -210,7 +172,8 @@ R_CL -> Receiver of multicast/broadcast messages
FUNCTION_BODY
switch
((
USIGN8
)(
crl_ptr
->
conn_type
&
0x0F
))
{
switch
((
USIGN8
)(
crl_ptr
->
conn_type
&
0x0F
))
{
case
MMAC
:
*
role_ptr
=
M_MM
;
return
(
E_OK
);
...
...
@@ -238,8 +201,8 @@ R_CL -> Receiver of multicast/broadcast messages
}
}
FUNCTION
LOCAL
VOID
ccrl_correct_crl_entry
(
IN
USIGN16
cr
,
IN
USIGN8
role
,
INOUT
T_CRL_STATIC
FAR
*
crl_ptr
)
FUNCTION
LOCAL
VOID
ccrl_correct_crl_entry
(
IN
USIGN16
cr
,
IN
USIGN8
role
,
INOUT
T_CRL_STATIC
FAR
*
crl_ptr
)
/*------------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -250,15 +213,18 @@ FUNCTIONAL_DESCRIPTION
FUNCTION_BODY
if
(
crl_ptr
->
lli_sap
==
1
)
{
if
(
cr
>
1
)
{
if
(
crl_ptr
->
lli_sap
==
1
)
{
if
(
cr
>
1
)
{
/* There is a management client -----------------------------------------
*/
crl_ptr
->
max_scc
=
1
;
crl_ptr
->
max_sac
=
0
;
crl_ptr
->
max_rcc
=
0
;
crl_ptr
->
max_rac
=
0
;
}
else
/* (cr == 1) */
}
else
/* (cr == 1) */
{
/* There is a management server -----------------------------------------
*/
...
...
@@ -269,14 +235,17 @@ FUNCTIONAL_DESCRIPTION
}
}
if
(
role
==
M_MS
)
{
if
(
role
==
M_MS
)
{
crl_ptr
->
max_rcc
=
0
;
if
(
_IS_CYCLIC
(
crl_ptr
->
conn_type
))
crl_ptr
->
max_scc
=
0
;
if
(
_WITHOUT_SLAVE_INITIATIVE
(
crl_ptr
->
conn_type
))
crl_ptr
->
max_rac
=
0
;
}
else
if
(
role
==
S_MS
)
{
}
else
if
(
role
==
S_MS
)
{
crl_ptr
->
max_scc
=
0
;
if
(
_IS_CYCLIC
(
crl_ptr
->
conn_type
))
...
...
@@ -288,8 +257,8 @@ FUNCTIONAL_DESCRIPTION
return
;
}
FUNCTION
LOCAL
VOID
ccrl_update_resrc_ctr
(
INOUT
USIGN8
*
stored_number_ptr
,
INOUT
USIGN8
*
current_number_ptr
)
FUNCTION
LOCAL
VOID
ccrl_update_resrc_ctr
(
INOUT
USIGN8
*
stored_number_ptr
,
INOUT
USIGN8
*
current_number_ptr
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -302,18 +271,22 @@ FUNCTIONAL_DESCRIPTION
FUNCTION_BODY
if
(
*
stored_number_ptr
<
*
current_number_ptr
)
{
if
(
*
stored_number_ptr
<
*
current_number_ptr
)
{
diff
=
(
USIGN8
)(
*
current_number_ptr
-
*
stored_number_ptr
);
*
stored_number_ptr
=
*
current_number_ptr
;
*
current_number_ptr
=
diff
;
}
else
{
}
else
{
*
current_number_ptr
=
0
;
}
return
;
}
FUNCTION
LOCAL
VOID
ccrl_adapt_resrces
(
IN
T_CCRL_CONN_RESRCES
*
in_resrces_ptr
,
FUNCTION
LOCAL
VOID
ccrl_adapt_resrces
(
IN
T_CCRL_CONN_RESRCES
*
in_resrces_ptr
,
INOUT
T_CCRL_CONN_RESRCES
*
out_resrces_ptr
)
/*----------------------------------------------------------------------------
...
...
@@ -325,14 +298,14 @@ FUNCTIONAL_DESCRIPTION
FUNCTION_BODY
ccrl_update_resrc_ctr
(
&
in_resrces_ptr
->
no_of_fal_sdbs
,
&
out_resrces_ptr
->
no_of_fal_sdbs
);
ccrl_update_resrc_ctr
(
&
in_resrces_ptr
->
no_of_fdl_sdbs
,
&
out_resrces_ptr
->
no_of_fdl_sdbs
);
ccrl_update_resrc_ctr
(
&
in_resrces_ptr
->
no_of_data_buffer
,
&
out_resrces_ptr
->
no_of_data_buffer
);
ccrl_update_resrc_ctr
(
&
in_resrces_ptr
->
no_of_api_buffer
,
&
out_resrces_ptr
->
no_of_api_buffer
);
ccrl_update_resrc_ctr
(
&
in_resrces_ptr
->
no_of_fal_sdbs
,
&
out_resrces_ptr
->
no_of_fal_sdbs
);
ccrl_update_resrc_ctr
(
&
in_resrces_ptr
->
no_of_fdl_sdbs
,
&
out_resrces_ptr
->
no_of_fdl_sdbs
);
ccrl_update_resrc_ctr
(
&
in_resrces_ptr
->
no_of_data_buffer
,
&
out_resrces_ptr
->
no_of_data_buffer
);
ccrl_update_resrc_ctr
(
&
in_resrces_ptr
->
no_of_api_buffer
,
&
out_resrces_ptr
->
no_of_api_buffer
);
return
;
}
...
...
@@ -370,7 +343,8 @@ possible return values:
ccrl_obj
.
poll_sap
=
crl_hdr_ptr
->
poll_sap
;
ccrl_obj
.
mms_exist
=
PB_FALSE
;
for
(
i
=
0
;
i
<
65
;
i
++
)
{
for
(
i
=
0
;
i
<
65
;
i
++
)
{
ccrl_obj
.
isap_resrces
[
i
].
no_of_fal_sdbs
=
0
;
ccrl_obj
.
isap_resrces
[
i
].
no_of_fdl_sdbs
=
0
;
ccrl_obj
.
isap_resrces
[
i
].
no_of_data_buffer
=
0
;
...
...
@@ -380,8 +354,9 @@ possible return values:
return
;
}
FUNCTION
GLOBAL
USIGN16
CALL_CONV
ccrl_resrces_add_entry
(
IN
USIGN16
cr
,
IN
T_CRL_STATIC
FAR
*
crl_ptr
,
OUT
T_FMB_CONFIG_CRL
FAR
*
config_ptr
)
FUNCTION
GLOBAL
USIGN16
CALL_CONV
ccrl_resrces_add_entry
(
IN
USIGN16
cr
,
IN
T_CRL_STATIC
FAR
*
crl_ptr
,
OUT
T_FMB_CONFIG_CRL
FAR
*
config_ptr
)
/*------------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -483,57 +458,60 @@ possible return values:
fdl_sap
=
0
;
/* (FDL) */
fdl_rsap
=
0
;
/* (DATA or FDL + DATA) */
switch
(
role
)
{
switch
(
role
)
{
case
M_MM
:
/* Master in Master/Master Connection ----------------------------- */
snd_req
=
(
USIGN8
)(
MAX
(
1
,
/* snd ASS.req */
snd_req
=
(
USIGN8
)(
max
(
1
,
/* snd ASS.req */
(
max_scc
/* snd DTC.req */
+
max_sac
))
/* snd DTA.req */
+
1
/* snd ABT.req */
);
lli_api_snd_resrc
=
(
USIGN8
)(
MIN
(
ci
,
1
)
/* snd IDLE.req */
lli_api_snd_resrc
=
(
USIGN8
)(
min
(
ci
,
1
)
/* snd IDLE.req */
+
1
/* LLI abort resrc */
);
rcv_res
=
(
USIGN8
)(
MAX
(
1
,
/* rcv ASS_RES_PDU */
rcv_res
=
(
USIGN8
)(
max
(
1
,
/* rcv ASS_RES_PDU */
(
max_scc
/* rcv DTC_RES_PDU */
+
max_sac
))
/* rcv DTA_ACK_PDU */
);
rcv_ind
=
(
USIGN8
)(
MAX
(
1
,
/* rcv ASS_REQ_PDU */
rcv_ind
=
(
USIGN8
)(
max
(
1
,
/* rcv ASS_REQ_PDU */
(
max_rcc
/* rcv DTC_REQ_PDU */
+
max_rac
))
/* rcv DTA_REQ_PDU */
+
1
/* rcv ABT_REQ_PDU */
);
lli_rcv_ind
=
(
USIGN8
)
MIN
(
ci
,
1
);
/* rcv IDLE_REQ_PDU */
lli_rcv_ind
=
(
USIGN8
)
min
(
ci
,
1
);
/* rcv IDLE_REQ_PDU */
fdl_sap
=
1
;
/* act/deact LSAP */
break
;
case
M_MS
:
/* Master in a cyclic master/slave connection --------------------- */
if
(
_IS_CYCLIC
(
crl_ptr
->
conn_type
))
{
if
(
_IS_CYCLIC
(
crl_ptr
->
conn_type
))
{
max_scc
=
1
;
ci
=
0
;
lli_idm
=
1
;
/* image data memory */
if
(
crl_ptr
->
conn_type
&
LLI_EVT_BIT
)
lli_evt_resrc
=
1
;
}
else
/* _IS_ACYCLIC (crl_ptr->conn_type) */
}
else
/* _IS_ACYCLIC (crl_ptr->conn_type) */
{
multiplier
=
1
;
}
lli_poll_elem
=
(
USIGN8
)(
MAX
(
multiplier
,
1
));
/* poll_list_element */
lli_poll_elem
=
(
USIGN8
)(
max
(
multiplier
,
1
));
/* poll_list_element */
lli_api_resrc
=
(
USIGN8
)(
MIN
(
ci
,
1
)
/* snd IDLE_REQ_PDU */
lli_api_resrc
=
(
USIGN8
)(
min
(
ci
,
1
)
/* snd IDLE_REQ_PDU */
+
1
/* LLI abort resrc */
);
snd_req_csrd
=
(
USIGN8
)(
MAX
(
1
,
/* snd ASS.req */
snd_req_csrd
=
(
USIGN8
)(
max
(
1
,
/* snd ASS.req */
(
max_scc
/* snd DTC.req */
+
max_sac
))
/* snd DTA.req */
+
1
/* snd ABT.req */
...
...
@@ -547,7 +525,8 @@ possible return values:
snd_res_srd
=
max_rac
;
/* snd DTA.ack (high)*/
if
(
!
ccrl_obj
.
mms_exist
)
{
if
(
!
ccrl_obj
.
mms_exist
)
{
fdl_sap
=
1
;
ccrl_obj
.
mms_exist
=
PB_TRUE
;
}
...
...
@@ -558,7 +537,8 @@ possible return values:
fdl_rsap
=
1
;
/* reply update buffer */
if
(
_IS_CYCLIC
(
crl_ptr
->
conn_type
))
{
if
(
_IS_CYCLIC
(
crl_ptr
->
conn_type
))
{
max_rcc
=
1
;
ci
=
0
;
lli_idm
=
1
;
/* image data memory */
...
...
@@ -570,17 +550,17 @@ possible return values:
rcv_res
=
max_sac
;
/* rcv DTA_ACK_PDU */
lli_sr_snd_resrc
=
(
USIGN8
)(
MIN
(
ci
,
1
)
/* snd IDLE.req */
lli_sr_snd_resrc
=
(
USIGN8
)(
min
(
ci
,
1
)
/* snd IDLE.req */
+
1
/* LLI abort resrc */
);
rcv_ind
=
(
USIGN8
)(
MAX
(
1
,
/* rcv ASS_REQ_PDU */
rcv_ind
=
(
USIGN8
)(
max
(
1
,
/* rcv ASS_REQ_PDU */
(
max_rcc
/* rcv DTC_REQ_PDU */
+
max_rac
))
/* rcv DTA_REQ_PDU */
+
1
/* rcv ABT_REQ_PDU */
);
lli_rcv_ind
=
(
USIGN8
)(
MIN
(
ci
,
1
)
/* rcv IDLE_REQ_PDU */
lli_rcv_ind
=
(
USIGN8
)(
min
(
ci
,
1
)
/* rcv IDLE_REQ_PDU */
+
2
/* rcv poll telegrams */
);
fdl_sap
=
1
;
/* act/deact LSAP */
...
...
@@ -589,13 +569,13 @@ possible return values:
case
S_CL
:
/* Broadcast/Multicast Sender ------------------------------------- */
snd_req
=
(
USIGN8
)
MAX
(
1
,
max_sac
);
/* snd DTU.req */
snd_req
=
(
USIGN8
)
max
(
1
,
max_sac
);
/* snd DTU.req */
fdl_sap
=
1
;
/* act/deact LSAP */
break
;
case
R_CL
:
/* Broadcast/Multicast Receiver ----------------------------------- */
rcv_ind
=
(
USIGN8
)
MAX
(
1
,
max_rac
);
/* rcv DTU_REQ_PDU */
rcv_ind
=
(
USIGN8
)
max
(
1
,
max_rac
);
/* rcv DTU_REQ_PDU */
fdl_sap
=
1
;
/* act/deact LSAP */
break
;
...
...
@@ -603,24 +583,28 @@ possible return values:
return
(
E_FM7_CRL_INVALID_ENTRY
);
}
no_of_fal_sdbs
=
(
USIGN16
)(
snd_req
+
snd_req_csrd
+
rcv_ind
+
rcv_ind_csrd
+
lli_api_resrc
+
lli_api_snd_resrc
+
lli_sr_snd_resrc
+
lli_evt_resrc
);
no_of_fal_sdbs
=
(
USIGN16
)(
snd_req
+
snd_req_csrd
+
rcv_ind
+
rcv_ind_csrd
+
lli_api_resrc
+
lli_api_snd_resrc
+
lli_sr_snd_resrc
+
lli_evt_resrc
);
no_of_fdl_sdbs
=
(
USIGN16
)(
snd_req
+
snd_req_srd
+
rcv_res
+
rcv_ind
+
snd_res_srd
+
lli_api_snd_resrc
+
lli_sr_snd_resrc
+
lli_rcv_ind
+
fdl_sap
+
lli_poll_elem
);
no_of_fdl_sdbs
=
(
USIGN16
)(
snd_req
+
snd_req_srd
+
rcv_res
+
rcv_ind
+
snd_res_srd
+
lli_api_snd_resrc
+
lli_sr_snd_resrc
+
lli_rcv_ind
+
fdl_sap
+
lli_poll_elem
);
no_of_fdl_sdbs
=
(
USIGN16
)(
no_of_fdl_sdbs
+
fdl_rsap
);
no_of_data_buffer
=
(
USIGN16
)(
snd_req
+
snd_req_csrd
+
snd_req_srd
+
rcv_res
+
rcv_ind
+
rcv_ind_csrd
+
lli_sr_snd_resrc
+
lli_poll_elem
+
lli_idm
+
lli_rcv_ind
+
fdl_rsap
+
lli_evt_resrc
);
no_of_data_buffer
=
(
USIGN16
)(
snd_req
+
snd_req_csrd
+
snd_req_srd
+
rcv_res
+
rcv_ind
+
rcv_ind_csrd
+
lli_sr_snd_resrc
+
lli_poll_elem
+
lli_idm
+
lli_rcv_ind
+
fdl_rsap
+
lli_evt_resrc
);
no_of_api_buffer
=
(
USIGN16
)(
snd_res_srd
+
lli_api_resrc
+
lli_api_snd_resrc
+
lli_poll_elem
);
no_of_api_buffer
=
(
USIGN16
)(
snd_res_srd
+
lli_api_resrc
+
lli_api_snd_resrc
+
lli_poll_elem
);
if
((
no_of_fal_sdbs
>
0xFF
)
||
(
no_of_fdl_sdbs
>
0xFF
)
||
(
no_of_data_buffer
>
0xFF
)
||
(
no_of_api_buffer
>
0xFF
))
{
if
((
no_of_fal_sdbs
>
0xFF
)
||
(
no_of_fdl_sdbs
>
0xFF
)
||
(
no_of_data_buffer
>
0xFF
)
||
(
no_of_api_buffer
>
0xFF
))
{
return
(
E_FM7_CRL_INVALID_ENTRY
);
}
...
...
@@ -631,26 +615,27 @@ possible return values:
conn_resrc
.
no_of_data_buffer
=
(
USIGN8
)
no_of_data_buffer
;
conn_resrc
.
no_of_api_buffer
=
(
USIGN8
)
no_of_api_buffer
;
if
((
role
==
M_MM
)
&&
(
_IS_I_CONN
(
crl_ptr
->
conn_attr
)))
{
if
((
role
==
M_MM
)
&&
(
_IS_I_CONN
(
crl_ptr
->
conn_attr
)))
{
ccrl_adapt_resrces
(
&
ccrl_obj
.
isap_resrces
[
_CCRL_MAP_SAP_NR
(
crl_ptr
->
loc_lsap
)],
&
conn_resrc
);
}
ccrl_obj
.
ccrl
.
max_no_fal_sdbs
=
(
USIGN16
)(
ccrl_obj
.
ccrl
.
max_no_fal_sdbs
+
conn_resrc
.
no_of_fal_sdbs
);
ccrl_obj
.
ccrl
.
max_no_fal_sdbs
=
(
USIGN16
)(
ccrl_obj
.
ccrl
.
max_no_fal_sdbs
+
conn_resrc
.
no_of_fal_sdbs
);
ccrl_obj
.
ccrl
.
max_no_fdl_sdbs
=
(
USIGN16
)(
ccrl_obj
.
ccrl
.
max_no_fdl_sdbs
+
conn_resrc
.
no_of_fdl_sdbs
);
ccrl_obj
.
ccrl
.
max_no_fdl_sdbs
=
(
USIGN16
)(
ccrl_obj
.
ccrl
.
max_no_fdl_sdbs
+
conn_resrc
.
no_of_fdl_sdbs
);
ccrl_obj
.
ccrl
.
max_no_data_buffer
=
(
USIGN16
)(
ccrl_obj
.
ccrl
.
max_no_data_buffer
+
conn_resrc
.
no_of_data_buffer
);
ccrl_obj
.
ccrl
.
max_no_api_buffer
=
(
USIGN16
)(
ccrl_obj
.
ccrl
.
max_no_api_buffer
+
conn_resrc
.
no_of_api_buffer
);
ccrl_obj
.
ccrl
.
max_no_api_buffer
=
(
USIGN16
)(
ccrl_obj
.
ccrl
.
max_no_api_buffer
+
conn_resrc
.
no_of_api_buffer
);
ccrl_obj
.
ccrl
.
max_no_poll_entries
=
(
USIGN16
)(
ccrl_obj
.
ccrl
.
max_no_poll_entries
+
lli_poll_elem
);
ccrl_obj
.
ccrl
.
max_no_poll_entries
=
(
USIGN16
)(
ccrl_obj
.
ccrl
.
max_no_poll_entries
+
lli_poll_elem
);
*
config_ptr
=
ccrl_obj
.
ccrl
;
...
...
profibus/lib/rt/src/cif_api.c
View file @
ce758cd3
...
...
@@ -62,13 +62,14 @@ Discription
int
hDevDrv
=
INVALID_HANDLE_VALUE
;
// handle to cifDevDrv
static
unsigned
short
DrvOpenCount
=
0
;
// no Application is logged in
typedef
struct
DEV_DPM_SIZEtag
{
typedef
struct
DEV_DPM_SIZEtag
{
unsigned
int
ulDpmSize
;
unsigned
int
ulDpmIOSize
;
}
DEV_DPM_SIZE
;
DEV_DPM_SIZE
tDevDPMSize
[
MAX_DEV_BOARDS
]
=
{
{
0L
,
0L
},
{
0L
,
0L
},
{
0L
,
0L
},
{
0L
,
0L
}
};
// DPM size of each board
DEV_DPM_SIZE
tDevDPMSize
[
MAX_DEV_BOARDS
]
=
{
{
0L
,
0L
},
{
0L
,
0L
},
{
0L
,
0L
},
{
0L
,
0L
}
};
// DPM size of each board
/* <ST>
=================================================================================
...
...
@@ -86,17 +87,22 @@ short DevOpenDriver()
{
short
sRet
=
DRV_NO_ERROR
;
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
// first application, search CIF device driver
if
((
hDevDrv
=
open
(
"/dev/cif"
,
O_RDONLY
))
==
-
1
)
{
// handle of file with attributes to copy
if
((
hDevDrv
=
open
(
"/dev/cif"
,
O_RDONLY
))
==
-
1
)
{
// handle of file with attributes to copy
// error open CIF driver
sRet
=
DRV_USR_OPEN_ERROR
;
}
else
{
}
else
{
// driver is opend for the 1st. time, store application in DrvOpencount
DrvOpenCount
=
1
;
}
}
else
{
}
else
{
// driver is already opend, store application in DrvOpencount
DrvOpenCount
++
;
}
...
...
@@ -122,14 +128,20 @@ short DevCloseDriver()
{
short
sRet
=
DRV_NO_ERROR
;
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
{
}
else
{
// test if other applications are logged in
if
(
DrvOpenCount
>
1
)
{
if
(
DrvOpenCount
>
1
)
{
// there are more applications logged in, do not close the driver
DrvOpenCount
--
;
}
else
{
}
else
{
// no more application are logged in, close File Handle
close
(
hDevDrv
);
// handle of object to close
DrvOpenCount
=
0
;
...
...
@@ -160,15 +172,18 @@ short DevGetBoardInfo(BOARD_INFO* pvData)
BOARD_INFO
*
ptBoardInfo
=
NULL
;
short
sRet
=
DRV_NO_ERROR
;
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
{
if
((
ptBuffer
=
(
DEVIO_GETBOARDINFOCMD
*
)
malloc
(
sizeof
(
DEVIO_GETBOARDINFOCMD
)))
==
NULL
)
}
else
{
if
((
ptBuffer
=
(
DEVIO_GETBOARDINFOCMD
*
)
malloc
(
sizeof
(
DEVIO_GETBOARDINFOCMD
)))
==
NULL
)
return
DRV_USR_SENDBUF_PTR_NULL
;
if
((
ptBuffer
->
ptBoardInfo
=
(
BOARD_INFO
*
)
malloc
(
sizeof
(
BOARD_INFO
)))
==
NULL
)
{
if
((
ptBuffer
->
ptBoardInfo
=
(
BOARD_INFO
*
)
malloc
(
sizeof
(
BOARD_INFO
)))
==
NULL
)
{
free
(
ptBuffer
);
return
DRV_USR_SENDBUF_PTR_NULL
;
}
...
...
@@ -176,10 +191,13 @@ short DevGetBoardInfo(BOARD_INFO* pvData)
ptBuffer
->
usInfoLen
=
sizeof
(
BOARD_INFO
);
ptBoardInfo
=
ptBuffer
->
ptBoardInfo
;
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLBOARDINFO
,
(
unsigned
long
)
ptBuffer
))
{
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLBOARDINFO
,
(
unsigned
long
)
ptBuffer
))
{
// fprintf(stderr, "CIF_IOCTLBOARDINFO: %s\n", strerror(errno));
sRet
=
DRV_USR_COMM_ERR
;
}
else
{
}
else
{
ptBuffer
->
ptBoardInfo
=
ptBoardInfo
;
// printf("sRet=%X, &tBuffer=%lX, ->ptBI=%lX\n",sRet,(unsigned
// long)tBuffer,(unsigned long)ptBoardInfo);
...
...
@@ -217,16 +235,19 @@ short DevGetBoardInfoEx(BOARD_INFOEX* pvData)
BOARD_INFOEX
*
ptBoardInfoEx
=
NULL
;
short
sRet
=
DRV_NO_ERROR
;
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
{
if
((
ptBuffer
=
(
DEVIO_GETBOARDINFOEXCMD
*
)
malloc
(
sizeof
(
DEVIO_GETBOARDINFOEXCMD
)))
==
NULL
)
}
else
{
if
((
ptBuffer
=
(
DEVIO_GETBOARDINFOEXCMD
*
)
malloc
(
sizeof
(
DEVIO_GETBOARDINFOEXCMD
)))
==
NULL
)
return
DRV_USR_SENDBUF_PTR_NULL
;
ptBuffer
->
usInfoLen
=
sizeof
(
BOARD_INFOEX
);
if
((
ptBuffer
->
ptBoard
=
(
BOARD_INFOEX
*
)
malloc
(
sizeof
(
BOARD_INFOEX
)))
==
NULL
)
{
if
((
ptBuffer
->
ptBoard
=
(
BOARD_INFOEX
*
)
malloc
(
sizeof
(
BOARD_INFOEX
)))
==
NULL
)
{
free
(
ptBuffer
);
return
DRV_USR_SENDBUF_PTR_NULL
;
}
...
...
@@ -234,10 +255,13 @@ short DevGetBoardInfoEx(BOARD_INFOEX* pvData)
ptBuffer
->
usInfoLen
=
sizeof
(
BOARD_INFOEX
);
ptBuffer
->
sError
=
sRet
;
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLBOARDINFOEX
,
(
unsigned
long
)
ptBuffer
))
{
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLBOARDINFOEX
,
(
unsigned
long
)
ptBuffer
))
{
// fprintf(stderr, "CIF_IOCTLBOARDINFOEX: %s\n", strerror(errno));
sRet
=
DRV_USR_COMM_ERR
;
}
else
{
}
else
{
sRet
=
ptBuffer
->
sError
;
ptBuffer
->
ptBoard
=
ptBoardInfoEx
;
memcpy
(
pvData
,
ptBoardInfoEx
,
sizeof
(
BOARD_INFOEX
));
...
...
@@ -260,27 +284,35 @@ short DevGetBoardInfoEx(BOARD_INFOEX* pvData)
=================================================================================
<En> */
short
DevSetOpMode
(
unsigned
short
usBoard
,
unsigned
short
usMode
,
unsigned
short
*
usIrq
)
short
DevSetOpMode
(
unsigned
short
usBoard
,
unsigned
short
usMode
,
unsigned
short
*
usIrq
)
{
DEVIO_SETOPMODE
tBuffer
;
short
sRet
=
DRV_NO_ERROR
;
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
if
(
usBoard
>=
MAX_DEV_BOARDS
)
{
}
else
if
(
usBoard
>=
MAX_DEV_BOARDS
)
{
// number is invalid
sRet
=
DRV_USR_DEV_NUMBER_INVALID
;
}
else
{
}
else
{
// clear all data buffers
tBuffer
.
usBoard
=
usBoard
;
tBuffer
.
usMode
=
usMode
;
tBuffer
.
sError
=
sRet
;
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTL_IRQ_POLL
,
(
unsigned
long
)(
&
tBuffer
)))
{
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTL_IRQ_POLL
,
(
unsigned
long
)(
&
tBuffer
)))
{
// fprintf(stderr, "CIFAPI (CIF_IOCTL_IRQ_POLL): %s\n", strerror(errno));
sRet
=
DRV_USR_COMM_ERR
;
}
else
{
}
else
{
sRet
=
tBuffer
.
sError
;
*
usIrq
=
tBuffer
.
usIrq
;
}
...
...
@@ -307,28 +339,37 @@ short DevInitBoard(unsigned short usDevNumber)
DEVIO_RESETCMD
tBuffer
;
short
sRet
=
DRV_NO_ERROR
;
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
// number is invalid
sRet
=
DRV_USR_DEV_NUMBER_INVALID
;
}
else
{
}
else
{
// clear all data buffers
tBuffer
.
usBoard
=
usDevNumber
;
tBuffer
.
sError
=
sRet
;
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLINITDRV
,
(
unsigned
long
)(
&
tBuffer
)))
{
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLINITDRV
,
(
unsigned
long
)(
&
tBuffer
)))
{
// fprintf(stderr, "CIFAPI (CIF_IOCTLINITDRV): %s\n", strerror(errno));
sRet
=
DRV_USR_COMM_ERR
;
}
else
{
}
else
{
sRet
=
tBuffer
.
sError
;
// printf("CIFAPI (CIF_IOCTLINITDRV): sRet = %d\n", sRet);
if
(
sRet
==
DRV_NO_ERROR
)
{
if
(
sRet
==
DRV_NO_ERROR
)
{
// Save the DPM size for further function calls and calculate the length
// of the DPM-IO data area
tDevDPMSize
[
usDevNumber
].
ulDpmSize
=
tBuffer
.
ulDpmSize
;
tDevDPMSize
[
usDevNumber
].
ulDpmIOSize
=
((
tBuffer
.
ulDpmSize
*
1024
)
-
1024
)
/
2
;
tDevDPMSize
[
usDevNumber
].
ulDpmIOSize
=
((
tBuffer
.
ulDpmSize
*
1024
)
-
1024
)
/
2
;
}
}
}
...
...
@@ -350,22 +391,29 @@ short DevInitBoard(unsigned short usDevNumber)
=================================================================================
<En> */
short
DevReset
(
unsigned
char
usDevNumber
,
unsigned
short
usMode
,
unsigned
long
ulTimeout
)
short
DevReset
(
unsigned
char
usDevNumber
,
unsigned
short
usMode
,
unsigned
long
ulTimeout
)
{
DEVIO_RESETCMD
tBuffer
;
unsigned
int
lBytesReturned
;
short
sRet
=
DRV_NO_ERROR
;
// valid handle available, driver is open
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
sRet
=
DRV_USR_DEV_NUMBER_INVALID
;
}
else
if
((
usMode
!=
COLDSTART
)
&&
(
usMode
!=
WARMSTART
)
&&
(
usMode
!=
BOOTSTART
))
{
}
else
if
((
usMode
!=
COLDSTART
)
&&
(
usMode
!=
WARMSTART
)
&&
(
usMode
!=
BOOTSTART
))
{
sRet
=
DRV_USR_MODE_INVALID
;
}
else
{
}
else
{
// fill in parameter data
lBytesReturned
=
0
;
// set output buffer
...
...
@@ -376,10 +424,13 @@ short DevReset(
// printf("CIF_IOCTLRESETDEV: BOARD = %d, mode = %d, tout = %ld\n",
// tBuffer.ucBoard, tBuffer.usMode, tBuffer.ulTimeout);
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLRESETDEV
,
(
unsigned
long
)(
&
tBuffer
)))
{
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLRESETDEV
,
(
unsigned
long
)(
&
tBuffer
)))
{
// fprintf(stderr, "CIF_IOCTLRESETDEV: %s\n", strerror(errno));
sRet
=
DRV_USR_COMM_ERR
;
}
else
{
}
else
{
sRet
=
tBuffer
.
sError
;
}
}
...
...
@@ -410,59 +461,76 @@ short DevGetInfo(unsigned short usDevNumber, unsigned short usInfoArea,
short
sRet
=
DRV_NO_ERROR
;
// valid handle available, driver is open
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
sRet
=
DRV_USR_DEV_NUMBER_INVALID
;
}
else
if
(
usSize
==
0
)
{
}
else
if
(
usSize
==
0
)
{
sRet
=
DRV_USR_SIZE_ZERO
;
}
else
{
}
else
{
// test area spezific data
switch
(
usInfoArea
)
{
switch
(
usInfoArea
)
{
case
GET_VERSION_INFO
:
if
(
usSize
>
sizeof
(
VERSIONINFO
))
{
if
(
usSize
>
sizeof
(
VERSIONINFO
))
{
sRet
=
DRV_USR_SIZE_TOO_LONG
;
}
break
;
case
GET_DRIVER_INFO
:
if
(
usSize
>
sizeof
(
DRIVERINFO
))
{
if
(
usSize
>
sizeof
(
DRIVERINFO
))
{
sRet
=
DRV_USR_SIZE_TOO_LONG
;
}
break
;
case
GET_FIRMWARE_INFO
:
if
(
usSize
>
sizeof
(
FIRMWAREINFO
))
{
if
(
usSize
>
sizeof
(
FIRMWAREINFO
))
{
sRet
=
DRV_USR_SIZE_TOO_LONG
;
}
break
;
case
GET_RCS_INFO
:
if
(
usSize
>
sizeof
(
RCSINFO
))
{
if
(
usSize
>
sizeof
(
RCSINFO
))
{
sRet
=
DRV_USR_SIZE_TOO_LONG
;
}
break
;
case
GET_DEV_INFO
:
if
(
usSize
>
sizeof
(
DEVINFO
))
{
if
(
usSize
>
sizeof
(
DEVINFO
))
{
sRet
=
DRV_USR_SIZE_TOO_LONG
;
}
break
;
case
GET_TASK_INFO
:
if
(
usSize
>
sizeof
(
TASKINFO
))
{
if
(
usSize
>
sizeof
(
TASKINFO
))
{
sRet
=
DRV_USR_SIZE_TOO_LONG
;
}
break
;
case
GET_IO_INFO
:
if
(
usSize
>
sizeof
(
IOINFO
))
{
if
(
usSize
>
sizeof
(
IOINFO
))
{
sRet
=
DRV_USR_SIZE_TOO_LONG
;
}
break
;
case
GET_IO_SEND_DATA
:
if
(
usSize
>
tDevDPMSize
[
usDevNumber
].
ulDpmIOSize
)
{
if
(
usSize
>
tDevDPMSize
[
usDevNumber
].
ulDpmIOSize
)
{
sRet
=
DRV_USR_SIZE_TOO_LONG
;
}
break
;
default:
sRet
=
DRV_USR_INFO_AREA_INVALID
;
}
/* end switch */
if
(
sRet
==
DRV_NO_ERROR
)
{
if
(
sRet
==
DRV_NO_ERROR
)
{
// complete buffer length with return data
// usDataBufferLen = usSize;
// fill in parameter data
...
...
@@ -471,15 +539,18 @@ short DevGetInfo(unsigned short usDevNumber, unsigned short usInfoArea,
tBuffer
.
usBoard
=
usDevNumber
;
tBuffer
.
usInfoArea
=
usInfoArea
;
tBuffer
.
usInfoLen
=
usSize
;
tBuffer
.
pabInfoData
=
pvData
;
// needed in kernel-space to copy data back to it!
tBuffer
.
pabInfoData
=
pvData
;
// needed in kernel-space to copy data back to it!
tBuffer
.
sError
=
sRet
;
// activate function
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLGETINFO
,
(
unsigned
long
)(
&
tBuffer
)))
{
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLGETINFO
,
(
unsigned
long
)(
&
tBuffer
)))
{
// fprintf(stderr, "(CIFAPI: (CIF_IOCTLGETINFO): %s\n",
// strerror(errno));
sRet
=
DRV_USR_COMM_ERR
;
}
else
{
}
else
{
// memcpy(pvData, tBuffer.pabInfoData, usSize); already copied by
// driver direct !!!
sRet
=
tBuffer
.
sError
;
...
...
@@ -512,18 +583,28 @@ short DevPutTaskParameter(unsigned short usDevNumber, unsigned short usNumber,
unsigned
int
lBytesReturned
;
short
sRet
=
DRV_NO_ERROR
;
// valid handle available, driver is open
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
sRet
=
DRV_USR_DEV_NUMBER_INVALID
;
}
else
if
((
usNumber
<
1
)
||
(
usNumber
>
7
))
{
// 3...7 wird in MailBox memory area geschrieben
}
else
if
((
usNumber
<
1
)
||
(
usNumber
>
7
))
{
// 3...7 wird in MailBox memory area geschrieben
sRet
=
DRV_USR_NUMBER_INVALID
;
}
else
if
(
usSize
==
0
)
{
}
else
if
(
usSize
==
0
)
{
sRet
=
DRV_USR_SIZE_ZERO
;
}
else
if
(
usSize
>
sizeof
(
TASKPARAM
))
{
}
else
if
(
usSize
>
sizeof
(
TASKPARAM
))
{
sRet
=
DRV_USR_SIZE_TOO_LONG
;
}
else
{
}
else
{
// fill in parameter data
lBytesReturned
=
0
;
// set command buffer
...
...
@@ -534,10 +615,12 @@ short DevPutTaskParameter(unsigned short usDevNumber, unsigned short usNumber,
usSize
);
tBuffer
.
sError
=
sRet
;
// activate function
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLPARAMETER
,
(
unsigned
long
)(
&
tBuffer
)))
{
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLPARAMETER
,
(
unsigned
long
)(
&
tBuffer
)))
{
// fprintf(stderr, "CIF_IOCTLRESETDEV: %s\n", strerror(errno));
sRet
=
DRV_USR_COMM_ERR
;
}
else
}
else
sRet
=
tBuffer
.
sError
;
}
return
sRet
;
...
...
@@ -567,17 +650,28 @@ short DevGetTaskState(unsigned short usDevNumber, unsigned short usNumber,
short
sRet
=
DRV_NO_ERROR
;
// valid handle available, driver is open
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
sRet
=
DRV_USR_DEV_NUMBER_INVALID
;
}
else
if
(
usNumber
<
1
||
usNumber
>
2
)
{
}
else
if
(
usNumber
<
1
||
usNumber
>
2
)
{
sRet
=
DRV_USR_NUMBER_INVALID
;
}
else
if
(
usSize
==
0
)
{
}
else
if
(
usSize
==
0
)
{
sRet
=
DRV_USR_SIZE_ZERO
;
}
else
if
(
usSize
>
sizeof
(
TASKSTATE
))
{
}
else
if
(
usSize
>
sizeof
(
TASKSTATE
))
{
sRet
=
DRV_USR_SIZE_TOO_LONG
;
}
else
{
}
else
{
// fill in parameter data
lBytesReturned
=
0
;
...
...
@@ -588,10 +682,13 @@ short DevGetTaskState(unsigned short usDevNumber, unsigned short usNumber,
// memcpy( tBuffer.TaskState, pvData, usSize);
tBuffer
.
sError
=
sRet
;
// activate function
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLTASKSTATE
,
(
unsigned
long
)(
&
tBuffer
)))
{
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLTASKSTATE
,
(
unsigned
long
)(
&
tBuffer
)))
{
// fprintf(stderr, "CIF_IOCTLTASKSTATE: %s\n", strerror(errno));
sRet
=
DRV_USR_COMM_ERR
;
}
else
{
}
else
{
memcpy
(
pvData
,
tBuffer
.
TaskState
,
usSize
);
sRet
=
tBuffer
.
sError
;
}
...
...
@@ -621,11 +718,16 @@ short DevGetMBXState(unsigned short usDevNumber, unsigned short* pusDevMbxState,
short
sRet
=
DRV_NO_ERROR
;
// valid handle available, driver is open
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
sRet
=
DRV_USR_DEV_NUMBER_INVALID
;
}
else
{
}
else
{
// fill in parameter data
lBytesReturned
=
0
;
// set output buffer
...
...
@@ -634,10 +736,13 @@ short DevGetMBXState(unsigned short usDevNumber, unsigned short* pusDevMbxState,
tBuffer
.
usHostMbxState
=
0x00
;
//*pusHostMbxState;
tBuffer
.
sError
=
sRet
;
// activate function
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLMBXINFO
,
(
unsigned
long
)(
&
tBuffer
)))
{
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLMBXINFO
,
(
unsigned
long
)(
&
tBuffer
)))
{
// fprintf(stderr, "CIF_IOCTLMBXINFO: %s\n", strerror(errno));
sRet
=
DRV_USR_COMM_ERR
;
}
else
{
}
else
{
*
pusDevMbxState
=
tBuffer
.
usDevMbxState
;
*
pusHostMbxState
=
tBuffer
.
usHostMbxState
;
sRet
=
tBuffer
.
sError
;
...
...
@@ -669,16 +774,24 @@ short DevGetMBXData(unsigned short usDevNumber, unsigned short usHostSize,
short
sRet
=
DRV_NO_ERROR
;
// valid handle available, driver is open
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
sRet
=
DRV_USR_DEV_NUMBER_INVALID
;
}
else
if
((
usHostSize
==
0
)
||
(
usDevSize
==
0
))
{
}
else
if
((
usHostSize
==
0
)
||
(
usDevSize
==
0
))
{
sRet
=
DRV_USR_SIZE_ZERO
;
}
else
if
((
usHostSize
>
sizeof
(
MSG_STRUC
))
||
(
usDevSize
>
sizeof
(
MSG_STRUC
)))
{
}
else
if
((
usHostSize
>
sizeof
(
MSG_STRUC
))
||
(
usDevSize
>
sizeof
(
MSG_STRUC
)))
{
sRet
=
DRV_USR_SIZE_TOO_LONG
;
}
else
{
}
else
{
// fill in parameter data
lBytesReturned
=
0
;
...
...
@@ -705,7 +818,9 @@ short DevGetMBXData(unsigned short usDevNumber, unsigned short usHostSize,
// fprintf(stderr, "CIF_IOCTLGETMBX: %s\n", strerror(errno));
// function error
sRet
=
DRV_USR_COMM_ERR
;
}
else
{
}
else
{
printf
(
"cif_api::DevGetMBXData: after CIF_IOCTLGETMBX ...
\n
"
);
memcpy
(
pvDevData
,
tBuffer
.
abDevMbx
,
usDevSize
);
printf
(
"cif_api::DevGetMBXData: after memcpy ...
\n
"
);
...
...
@@ -736,12 +851,17 @@ short DevExitBoard(unsigned short usDevNumber)
unsigned
short
usDrvOpenCount
=
0
;
short
sRet
=
DRV_NO_ERROR
;
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
// number is invalid
sRet
=
DRV_USR_DEV_NUMBER_INVALID
;
}
else
{
}
else
{
// valid handle available, driver is open
// clear all data buffers
lBytesReturned
=
0
;
...
...
@@ -749,10 +869,13 @@ short DevExitBoard(unsigned short usDevNumber)
// tBuffer.usDrvOpenCount = usDrvOpenCount; // [out]
// tBuffer.sError = sRet; // [out]
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLEXITDRV
,
(
unsigned
long
)(
&
tBuffer
)))
{
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLEXITDRV
,
(
unsigned
long
)(
&
tBuffer
)))
{
// fprintf(stderr, "CIF_IOCTLEXITDRV: %s\n", strerror(errno));
sRet
=
DRV_USR_COMM_ERR
;
}
else
{
}
else
{
tBuffer
.
usDrvOpenCount
=
usDrvOpenCount
;
// [out]
sRet
=
tBuffer
.
sError
;
// [out]
}
...
...
@@ -784,15 +907,22 @@ short DevReadSendData(unsigned short usDevNumber, unsigned short usOffset,
short
sRet
=
DRV_NO_ERROR
;
// valid handle available, driver is open
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
sRet
=
DRV_USR_DEV_NUMBER_INVALID
;
}
else
if
((
usSize
!=
0
)
&&
((
usSize
+
usOffset
)
>
(
unsigned
short
)
tDevDPMSize
[
usDevNumber
].
ulDpmIOSize
))
{
}
else
if
((
usSize
!=
0
)
&&
((
usSize
+
usOffset
)
>
(
unsigned
short
)
tDevDPMSize
[
usDevNumber
].
ulDpmIOSize
))
{
sRet
=
DRV_USR_SIZE_TOO_LONG
;
}
else
{
}
else
{
// fill in parameter data
lBytesReturned
=
0
;
// set output buffer
...
...
@@ -803,10 +933,13 @@ short DevReadSendData(unsigned short usDevNumber, unsigned short usOffset,
tBuffer
.
sError
=
sRet
;
// activate function
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLREADSEND
,
(
unsigned
long
)(
&
tBuffer
)))
{
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLREADSEND
,
(
unsigned
long
)(
&
tBuffer
)))
{
// fprintf(stderr, "CIF_IOCTLREADSEND: %s\n", strerror(errno));
sRet
=
DRV_USR_COMM_ERR
;
}
else
{
}
else
{
sRet
=
tBuffer
.
sError
;
}
}
...
...
@@ -834,13 +967,20 @@ short DevTriggerWatchDog(unsigned short usDevNumber, unsigned short usMode,
unsigned
int
lBytesReturned
;
short
sRet
=
DRV_NO_ERROR
;
// valid handle available, driver is open
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
sRet
=
DRV_USR_DEV_NUMBER_INVALID
;
}
else
if
(
usMode
>
WATCHDOG_START
)
{
}
else
if
(
usMode
>
WATCHDOG_START
)
{
sRet
=
DRV_USR_MODE_INVALID
;
}
else
{
}
else
{
// fill in parameter data
lBytesReturned
=
0
;
// set output buffer
...
...
@@ -850,10 +990,13 @@ short DevTriggerWatchDog(unsigned short usDevNumber, unsigned short usMode,
tBuffer
.
sError
=
sRet
;
// activate function
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLTRIGGERWD
,
(
unsigned
long
)(
&
tBuffer
)))
{
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLTRIGGERWD
,
(
unsigned
long
)(
&
tBuffer
)))
{
// fprintf(stderr, "CIF_IOCTLREADSEND: %s\n", strerror(errno));
sRet
=
DRV_USR_COMM_ERR
;
}
else
{
}
else
{
*
pusDevWatchDog
=
tBuffer
.
usTriggerValue
;
sRet
=
tBuffer
.
sError
;
}
...
...
@@ -883,13 +1026,20 @@ short DevSpecialControl(unsigned short usDevNumber, unsigned short usMode,
unsigned
int
lBytesReturned
;
short
sRet
=
DRV_NO_ERROR
;
// valid handle available, driver is open
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
sRet
=
DRV_USR_DEV_NUMBER_INVALID
;
}
else
if
(
pusCtrlAck
==
NULL
)
{
}
else
if
(
pusCtrlAck
==
NULL
)
{
sRet
=
DRV_USR_BUF_PTR_NULL
;
}
else
{
}
else
{
// fill in parameter data
lBytesReturned
=
0
;
// set output buffer
...
...
@@ -898,10 +1048,13 @@ short DevSpecialControl(unsigned short usDevNumber, unsigned short usMode,
tBuffer
.
sError
=
sRet
;
// activate function
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLSPCONTROL
,
(
unsigned
long
)(
&
tBuffer
)))
{
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLSPCONTROL
,
(
unsigned
long
)(
&
tBuffer
)))
{
// fprintf(stderr, "CIF_IOCTLREADSEND: %s\n", strerror(errno));
sRet
=
DRV_USR_COMM_ERR
;
}
else
{
}
else
{
*
pusCtrlAck
=
tBuffer
.
usTriggerValue
;
sRet
=
tBuffer
.
sError
;
}
...
...
@@ -932,17 +1085,28 @@ short DevExtendedData(unsigned short usDevNumber, unsigned short usMode,
unsigned
int
lBytesReturned
;
short
sRet
=
DRV_NO_ERROR
;
// valid handle available, driver is open
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
sRet
=
DRV_USR_DEV_NUMBER_INVALID
;
}
else
if
(
usSize
==
0
)
{
}
else
if
(
usSize
==
0
)
{
sRet
=
DRV_USR_SIZE_ZERO
;
}
else
if
(
usSize
>
EXTDATASIZE
)
{
}
else
if
(
usSize
>
EXTDATASIZE
)
{
sRet
=
DRV_USR_SIZE_TOO_LONG
;
}
else
if
((
usMode
==
0
)
||
(
usMode
>
100
))
{
}
else
if
((
usMode
==
0
)
||
(
usMode
>
100
))
{
sRet
=
DRV_USR_MODE_INVALID
;
}
else
{
}
else
{
// fill in parameter data
lBytesReturned
=
0
;
...
...
@@ -957,10 +1121,12 @@ short DevExtendedData(unsigned short usDevNumber, unsigned short usMode,
// error into the tDataBuffer.
sRet
=
DRV_USR_COMM_ERR
;
// activate function
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLEXTDATA
,
(
unsigned
long
)(
&
tBuffer
)))
{
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLEXTDATA
,
(
unsigned
long
)(
&
tBuffer
)))
{
// fprintf(stderr, "CIF_IOCTLEXTDATA: %s\n", strerror(errno));
sRet
=
DRV_USR_COMM_ERR
;
}
else
}
else
sRet
=
tBuffer
.
sError
;
}
return
sRet
;
...
...
@@ -990,17 +1156,28 @@ short DevGetTaskParameter(unsigned short usDevNumber, unsigned short usNumber,
short
sRet
=
DRV_NO_ERROR
;
// valid handle available, driver is open
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
sRet
=
DRV_USR_DEV_NUMBER_INVALID
;
}
else
if
((
usNumber
<
1
)
||
(
usNumber
>
2
))
{
}
else
if
((
usNumber
<
1
)
||
(
usNumber
>
2
))
{
sRet
=
DRV_USR_NUMBER_INVALID
;
}
else
if
(
usSize
==
0
)
{
}
else
if
(
usSize
==
0
)
{
sRet
=
DRV_USR_SIZE_ZERO
;
}
else
if
(
usSize
>
sizeof
(
TASKPARAM
))
{
}
else
if
(
usSize
>
sizeof
(
TASKPARAM
))
{
sRet
=
DRV_USR_SIZE_TOO_LONG
;
}
else
{
}
else
{
// fill in parameter data
lBytesReturned
=
0
;
// set command buffer
...
...
@@ -1010,10 +1187,13 @@ short DevGetTaskParameter(unsigned short usDevNumber, unsigned short usNumber,
// tBuffer.ptTaskParam = pvData;
tBuffer
.
sError
=
sRet
;
// activate function
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLGETPARAMETER
,
(
unsigned
long
)(
&
tBuffer
)))
{
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLGETPARAMETER
,
(
unsigned
long
)(
&
tBuffer
)))
{
// fprintf(stderr, "CIF_IOCTLGETPARAMETER: %s\n", strerror(errno));
sRet
=
DRV_USR_COMM_ERR
;
}
else
{
}
else
{
memcpy
((
unsigned
char
*
)
pvData
,
(
unsigned
char
*
)
&
(
tBuffer
.
TaskParameter
),
usSize
);
sRet
=
tBuffer
.
sError
;
...
...
@@ -1036,25 +1216,35 @@ short DevGetTaskParameter(unsigned short usDevNumber, unsigned short usNumber,
<En> */
short
DevReadWriteDPMData
(
unsigned
short
usDevNumber
,
unsigned
short
usMode
,
unsigned
short
usOffset
,
unsigned
short
usSize
,
void
*
pvData
)
unsigned
short
usOffset
,
unsigned
short
usSize
,
void
*
pvData
)
{
DEVIO_RWDPMDATACMD
tBuffer
;
unsigned
int
lBytesReturned
;
short
sRet
=
DRV_NO_ERROR
;
// valid handle available, driver is open
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
sRet
=
DRV_USR_DEV_NUMBER_INVALID
;
}
else
if
((
usMode
!=
PARAMETER_READ
)
&&
(
usMode
!=
PARAMETER_WRITE
))
{
}
else
if
((
usMode
!=
PARAMETER_READ
)
&&
(
usMode
!=
PARAMETER_WRITE
))
{
sRet
=
DRV_USR_MODE_INVALID
;
}
else
if
((
usSize
!=
0
)
&&
((
usSize
+
usOffset
)
>
(
unsigned
short
)(
tDevDPMSize
[
usDevNumber
].
ulDpmSize
*
1024
)))
{
}
else
if
((
usSize
!=
0
)
&&
((
usSize
+
usOffset
)
>
(
unsigned
short
)(
tDevDPMSize
[
usDevNumber
].
ulDpmSize
*
1024
)))
{
sRet
=
DRV_USR_SIZE_TOO_LONG
;
;
}
else
{
}
else
{
// fill in parameter data
lBytesReturned
=
0
;
tBuffer
.
usBoard
=
usDevNumber
;
...
...
@@ -1065,10 +1255,12 @@ short DevReadWriteDPMData(unsigned short usDevNumber, unsigned short usMode,
tBuffer
.
sError
=
sRet
;
// activate function
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLRWDPMDATA
,
(
unsigned
long
)(
&
tBuffer
)))
{
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLRWDPMDATA
,
(
unsigned
long
)(
&
tBuffer
)))
{
// fprintf(stderr, "CIF_IOCTLRWDPMDATA: %s\n", strerror(errno));
sRet
=
DRV_USR_COMM_ERR
;
}
else
}
else
sRet
=
tBuffer
.
sError
;
}
/* endif */
return
sRet
;
...
...
@@ -1091,22 +1283,32 @@ short DevReadWriteDPMData(unsigned short usDevNumber, unsigned short usMode,
<En> */
short
DevReadWriteDPMRaw
(
unsigned
short
usDevNumber
,
unsigned
short
usMode
,
unsigned
short
usOffset
,
unsigned
short
usSize
,
void
*
pvData
)
unsigned
short
usOffset
,
unsigned
short
usSize
,
void
*
pvData
)
{
DEVIO_RWRAWDATACMD
tBuffer
;
unsigned
int
lBytesReturned
;
short
sRet
=
DRV_NO_ERROR
;
// valid handle available, driver is open
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
sRet
=
DRV_USR_DEV_NUMBER_INVALID
;
}
else
if
((
usSize
+
usOffset
)
>
sizeof
(
RAWDATA
))
{
}
else
if
((
usSize
+
usOffset
)
>
sizeof
(
RAWDATA
))
{
sRet
=
DRV_USR_SIZE_TOO_LONG
;
}
else
if
((
usMode
!=
PARAMETER_READ
)
&&
(
usMode
!=
PARAMETER_WRITE
))
{
}
else
if
((
usMode
!=
PARAMETER_READ
)
&&
(
usMode
!=
PARAMETER_WRITE
))
{
sRet
=
DRV_USR_MODE_INVALID
;
}
else
{
}
else
{
// fill in parameter data
lBytesReturned
=
0
;
tBuffer
.
usBoard
=
usDevNumber
;
...
...
@@ -1117,10 +1319,12 @@ short DevReadWriteDPMRaw(unsigned short usDevNumber, unsigned short usMode,
tBuffer
.
sError
=
sRet
;
// activate function
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLRWRAW
,
(
unsigned
long
)(
&
tBuffer
)))
{
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLRWRAW
,
(
unsigned
long
)(
&
tBuffer
)))
{
// fprintf(stderr, "CIF_IOCTLRWRAW: %s\n", strerror(errno));
sRet
=
DRV_USR_COMM_ERR
;
}
else
}
else
sRet
=
tBuffer
.
sError
;
}
/* endif */
return
sRet
;
...
...
@@ -1142,27 +1346,38 @@ short DevReadWriteDPMRaw(unsigned short usDevNumber, unsigned short usMode,
<En> */
short
DevExchangeIO
(
unsigned
short
usDevNumber
,
unsigned
short
usSendOffset
,
unsigned
short
usSendSize
,
void
*
pvSendData
,
unsigned
short
usReceiveOffset
,
unsigned
short
usReceiveSize
,
void
*
pvReceiveData
,
unsigned
long
ulTimeout
)
unsigned
short
usSendSize
,
void
*
pvSendData
,
unsigned
short
usReceiveOffset
,
unsigned
short
usReceiveSize
,
void
*
pvReceiveData
,
unsigned
long
ulTimeout
)
{
DEVIO_EXIOCMD
tBuffer
;
unsigned
int
lBytesReturned
;
short
sRet
=
DRV_NO_ERROR
;
int
lRet
=
0
;
// valid handle available, driver is open
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
sRet
=
DRV_USR_DEV_NUMBER_INVALID
;
}
else
if
((
usSendSize
!=
0
)
&&
((
usSendSize
+
usSendOffset
)
>
(
unsigned
short
)
tDevDPMSize
[
usDevNumber
].
ulDpmIOSize
))
{
}
else
if
((
usSendSize
!=
0
)
&&
((
usSendSize
+
usSendOffset
)
>
(
unsigned
short
)
tDevDPMSize
[
usDevNumber
].
ulDpmIOSize
))
{
sRet
=
DRV_USR_SENDSIZE_TOO_LONG
;
}
else
if
((
usReceiveSize
!=
0
)
&&
((
usReceiveSize
+
usReceiveOffset
)
>
(
unsigned
short
)
tDevDPMSize
[
usDevNumber
].
ulDpmIOSize
))
{
}
else
if
((
usReceiveSize
!=
0
)
&&
((
usReceiveSize
+
usReceiveOffset
)
>
(
unsigned
short
)
tDevDPMSize
[
usDevNumber
].
ulDpmIOSize
))
{
sRet
=
DRV_USR_RECVSIZE_TOO_LONG
;
}
else
{
}
else
{
// fill in parameter data
lBytesReturned
=
0
;
// set output buffer
...
...
@@ -1178,10 +1393,12 @@ short DevExchangeIO(unsigned short usDevNumber, unsigned short usSendOffset,
// activate function
lRet
=
ioctl
(
hDevDrv
,
CIF_IOCTLEXIO
,
(
unsigned
long
)(
&
tBuffer
));
if
(
lRet
<=
0
)
{
if
(
lRet
<=
0
)
{
// fprintf(stderr, "CIF_IOCTLEXIO: %s\n", strerror(errno));
sRet
=
DRV_USR_COMM_ERR
;
}
else
}
else
sRet
=
tBuffer
.
sError
;
}
return
sRet
;
...
...
@@ -1204,9 +1421,10 @@ short DevExchangeIO(unsigned short usDevNumber, unsigned short usSendOffset,
<En> */
short
DevExchangeIOEx
(
unsigned
short
usDevNumber
,
unsigned
short
usMode
,
unsigned
short
usSendOffset
,
unsigned
short
usSendSize
,
void
*
pvSendData
,
unsigned
short
usReceiveOffset
,
unsigned
short
usReceiveSize
,
void
*
pvReceiveData
,
unsigned
long
ulTimeout
)
unsigned
short
usSendOffset
,
unsigned
short
usSendSize
,
void
*
pvSendData
,
unsigned
short
usReceiveOffset
,
unsigned
short
usReceiveSize
,
void
*
pvReceiveData
,
unsigned
long
ulTimeout
)
{
DEVIO_EXIOCMDEX
tBuffer
;
unsigned
int
lBytesReturned
;
...
...
@@ -1214,21 +1432,32 @@ short DevExchangeIOEx(unsigned short usDevNumber, unsigned short usMode,
int
lRet
=
0
;
// valid handle available, driver is open
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
sRet
=
DRV_USR_DEV_NUMBER_INVALID
;
}
else
if
((
usSendSize
!=
0
)
&&
((
usSendSize
+
usSendOffset
)
>
(
unsigned
short
)
tDevDPMSize
[
usDevNumber
].
ulDpmIOSize
))
{
}
else
if
((
usSendSize
!=
0
)
&&
((
usSendSize
+
usSendOffset
)
>
(
unsigned
short
)
tDevDPMSize
[
usDevNumber
].
ulDpmIOSize
))
{
sRet
=
DRV_USR_SENDSIZE_TOO_LONG
;
}
else
if
((
usReceiveSize
!=
0
)
&&
((
usReceiveSize
+
usReceiveOffset
)
>
(
unsigned
short
)
tDevDPMSize
[
usDevNumber
].
ulDpmIOSize
))
{
}
else
if
((
usReceiveSize
!=
0
)
&&
((
usReceiveSize
+
usReceiveOffset
)
>
(
unsigned
short
)
tDevDPMSize
[
usDevNumber
].
ulDpmIOSize
))
{
sRet
=
DRV_USR_RECVSIZE_TOO_LONG
;
}
else
if
(
usMode
>
4
)
{
}
else
if
(
usMode
>
4
)
{
sRet
=
DRV_USR_MODE_INVALID
;
}
else
{
}
else
{
// fill in parameter data
lBytesReturned
=
0
;
...
...
@@ -1246,10 +1475,12 @@ short DevExchangeIOEx(unsigned short usDevNumber, unsigned short usMode,
// activate function
lRet
=
ioctl
(
hDevDrv
,
CIF_IOCTLEXIOEX
,
(
unsigned
long
)(
&
tBuffer
));
if
(
lRet
<=
0
)
{
if
(
lRet
<=
0
)
{
// fprintf(stderr, "CIF_IOCTLEXIO: %s\n", strerror(errno));
sRet
=
DRV_USR_COMM_ERR
;
}
else
}
else
sRet
=
tBuffer
.
sError
;
}
return
sRet
;
...
...
@@ -1272,9 +1503,10 @@ short DevExchangeIOEx(unsigned short usDevNumber, unsigned short usMode,
<En> */
short
DevExchangeIOErr
(
unsigned
short
usDevNumber
,
unsigned
short
usSendOffset
,
unsigned
short
usSendSize
,
void
*
pvSendData
,
unsigned
short
usReceiveOffset
,
unsigned
short
usReceiveSize
,
void
*
pvReceiveData
,
COMSTATE
*
ptState
,
unsigned
long
ulTimeout
)
unsigned
short
usSendSize
,
void
*
pvSendData
,
unsigned
short
usReceiveOffset
,
unsigned
short
usReceiveSize
,
void
*
pvReceiveData
,
COMSTATE
*
ptState
,
unsigned
long
ulTimeout
)
{
DEVIO_EXIOCMDERR
tBuffer
;
unsigned
int
lBytesReturned
;
...
...
@@ -1282,19 +1514,28 @@ short DevExchangeIOErr(unsigned short usDevNumber, unsigned short usSendOffset,
int
lRet
=
0
;
// valid handle available, driver is open
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
sRet
=
DRV_USR_DEV_NUMBER_INVALID
;
}
else
if
((
usSendSize
!=
0
)
&&
((
usSendSize
+
usSendOffset
)
>
(
unsigned
short
)
tDevDPMSize
[
usDevNumber
].
ulDpmIOSize
))
{
}
else
if
((
usSendSize
!=
0
)
&&
((
usSendSize
+
usSendOffset
)
>
(
unsigned
short
)
tDevDPMSize
[
usDevNumber
].
ulDpmIOSize
))
{
sRet
=
DRV_USR_SENDSIZE_TOO_LONG
;
}
else
if
((
usReceiveSize
!=
0
)
&&
((
usReceiveSize
+
usReceiveOffset
)
>
(
unsigned
short
)
tDevDPMSize
[
usDevNumber
].
ulDpmIOSize
))
{
}
else
if
((
usReceiveSize
!=
0
)
&&
((
usReceiveSize
+
usReceiveOffset
)
>
(
unsigned
short
)
tDevDPMSize
[
usDevNumber
].
ulDpmIOSize
))
{
sRet
=
DRV_USR_RECVSIZE_TOO_LONG
;
}
else
{
}
else
{
// fill in parameter data
lBytesReturned
=
0
;
// set output buffer
...
...
@@ -1311,10 +1552,12 @@ short DevExchangeIOErr(unsigned short usDevNumber, unsigned short usSendOffset,
// activate function
lRet
=
ioctl
(
hDevDrv
,
CIF_IOCTLEXIOERR
,
(
unsigned
long
)(
&
tBuffer
));
if
(
lRet
<=
0
)
{
if
(
lRet
<=
0
)
{
// fprintf(stderr, "CIF_IOCTLEXIO: %s\n", strerror(errno));
sRet
=
DRV_USR_COMM_ERR
;
}
else
}
else
sRet
=
tBuffer
.
sError
;
}
return
sRet
;
...
...
@@ -1334,21 +1577,28 @@ short DevExchangeIOErr(unsigned short usDevNumber, unsigned short usSendOffset,
=================================================================================
<En> */
short
DevSetHostState
(
unsigned
short
usDevNumber
,
unsigned
short
usMode
,
unsigned
long
ulTimeout
)
short
DevSetHostState
(
unsigned
short
usDevNumber
,
unsigned
short
usMode
,
unsigned
long
ulTimeout
)
{
DEVIO_TRIGGERCMD
tBuffer
;
unsigned
int
lBytesReturned
;
short
sRet
=
DRV_NO_ERROR
;
// valid handle available, driver is open
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
sRet
=
DRV_USR_DEV_NUMBER_INVALID
;
}
else
if
(
usMode
>
HOST_READY
)
{
}
else
if
(
usMode
>
HOST_READY
)
{
sRet
=
DRV_USR_MODE_INVALID
;
}
else
{
}
else
{
// fill in parameter data
lBytesReturned
=
0
;
...
...
@@ -1358,10 +1608,12 @@ short DevSetHostState(
tBuffer
.
ulTimeout
=
ulTimeout
;
tBuffer
.
sError
=
sRet
;
// activate function
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLSETHOST
,
(
unsigned
long
)(
&
tBuffer
)))
{
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLSETHOST
,
(
unsigned
long
)(
&
tBuffer
)))
{
// fprintf(stderr, "CIF_IOCTLSETHOST: %s\n", strerror(errno));
sRet
=
DRV_USR_COMM_ERR
;
}
else
}
else
sRet
=
tBuffer
.
sError
;
}
return
sRet
;
...
...
@@ -1382,19 +1634,24 @@ short DevSetHostState(
=================================================================================
<En> */
short
DevPutMessage
(
unsigned
short
usDevNumber
,
MSG_STRUC
*
ptMessage
,
unsigned
long
ulTimeout
)
short
DevPutMessage
(
unsigned
short
usDevNumber
,
MSG_STRUC
*
ptMessage
,
unsigned
long
ulTimeout
)
{
DEVIO_PUTMESSAGECMD
tBuffer
;
unsigned
int
lBytesReturned
;
short
sRet
=
DRV_NO_ERROR
;
// valid handle available, driver is open
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
sRet
=
DRV_USR_DEV_NUMBER_INVALID
;
}
else
{
}
else
{
// fill in parameter data
lBytesReturned
=
0
;
// set output buffer
...
...
@@ -1404,10 +1661,12 @@ short DevPutMessage(
tBuffer
.
sError
=
sRet
;
// activate function
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLPUTMSG
,
(
unsigned
long
)(
&
tBuffer
)))
{
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLPUTMSG
,
(
unsigned
long
)(
&
tBuffer
)))
{
// fprintf(stderr, "CIF_IOCTLPUTMSG: %s\n", strerror(errno));
sRet
=
DRV_USR_COMM_ERR
;
}
else
}
else
sRet
=
tBuffer
.
sError
;
}
return
sRet
;
...
...
@@ -1438,13 +1697,20 @@ short DevGetMessage(unsigned short usDevNumber, unsigned short usSize,
short
sRet
=
DRV_NO_ERROR
;
// valid handle available, driver is open
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
sRet
=
DRV_USR_DEV_NUMBER_INVALID
;
}
else
if
(
usSize
==
0
||
usSize
>
sizeof
(
MSG_STRUC
))
{
}
else
if
(
usSize
==
0
||
usSize
>
sizeof
(
MSG_STRUC
))
{
sRet
=
DRV_USR_SIZE_INVALID
;
}
else
{
}
else
{
// fill in parameter data
lBytesReturned
=
0
;
// set output buffer
...
...
@@ -1452,10 +1718,13 @@ short DevGetMessage(unsigned short usDevNumber, unsigned short usSize,
tBuffer
.
ulTimeout
=
ulTimeout
;
tBuffer
.
sError
=
sRet
;
// activate function
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLGETMSG
,
(
unsigned
long
)(
&
tBuffer
)))
{
if
(
!
ioctl
(
hDevDrv
,
CIF_IOCTLGETMSG
,
(
unsigned
long
)(
&
tBuffer
)))
{
// fprintf(stderr, "CIF_IOCTLGETMSG: %s\n", strerror(errno));
sRet
=
DRV_USR_COMM_ERR
;
}
else
{
}
else
{
memcpy
(
ptMessage
,
&
tBuffer
.
tMsg
,
sizeof
(
MSG_STRUC
));
sRet
=
tBuffer
.
sError
;
}
...
...
@@ -1481,14 +1750,16 @@ short DevGetMessage(unsigned short usDevNumber, unsigned short usSize,
#define TO_LAST_MSG 15000L
// File data structure
typedef
struct
tagFILEDATA
{
typedef
struct
tagFILEDATA
{
int
fd
;
// struct stat *Info;//struct _stat *Info;
char
*
pabBuffer
;
int
lSize
;
}
FILEDATA
;
typedef
struct
tagDEVICE_TYPE_INFO
{
typedef
struct
tagDEVICE_TYPE_INFO
{
unsigned
char
bHerstellerkennung
;
unsigned
char
bDeviceType
;
unsigned
char
bDeviceModel
;
...
...
@@ -1508,8 +1779,10 @@ typedef struct tagDEVICE_TYPE_INFO {
<En> */
void
closeFile
(
FILEDATA
*
ptFile
)
{
if
(
ptFile
->
fd
>=
0
)
{
if
(
ptFile
->
pabBuffer
!=
NULL
)
{
if
(
ptFile
->
fd
>=
0
)
{
if
(
ptFile
->
pabBuffer
!=
NULL
)
{
free
(
ptFile
->
pabBuffer
);
}
close
(
ptFile
->
fd
);
...
...
@@ -1539,30 +1812,41 @@ short openFile(const char* fileName, FILEDATA* ptFile)
// open the existing file
ptFile
->
fd
=
open
(
fileName
,
O_RDONLY
);
if
(
ptFile
->
fd
<
0
)
{
if
(
ptFile
->
fd
<
0
)
{
// File not opend
sRet
=
DRV_USR_FILE_OPEN_FAILED
;
}
else
{
}
else
{
// Get the file size
ptFile
->
lSize
=
lseek
(
ptFile
->
fd
,
0
,
SEEK_END
);
if
(
ptFile
->
lSize
<=
0
)
{
if
(
ptFile
->
lSize
<=
0
)
{
// File size is zero
sRet
=
DRV_USR_FILE_SIZE_ZERO
;
}
else
{
}
else
{
if
(
lseek
(
ptFile
->
fd
,
0
,
SEEK_SET
)
<
0
)
sRet
=
DRV_USR_FILE_READ_FAILED
;
else
{
else
{
// Allocate memory for file data
if
((
ptFile
->
pabBuffer
=
(
char
*
)
malloc
(
ptFile
->
lSize
))
==
NULL
)
{
if
((
ptFile
->
pabBuffer
=
(
char
*
)
malloc
(
ptFile
->
lSize
))
==
NULL
)
{
// Error by memory allocation
sRet
=
DRV_USR_FILE_NO_MEMORY
;
closeFile
(
ptFile
);
}
else
{
}
else
{
// Read file data into memory
if
((
lNumberOfBytesRead
=
read
(
ptFile
->
fd
,
// handle of file to read
if
((
lNumberOfBytesRead
=
read
(
ptFile
->
fd
,
// handle of file to read
ptFile
->
pabBuffer
,
// address of buffer that receives data
ptFile
->
lSize
))
<
0
)
{
// number of bytes to read
ptFile
->
lSize
))
<
0
)
{
// number of bytes to read
// File read into memory failed
sRet
=
DRV_USR_FILE_READ_FAILED
;
closeFile
(
ptFile
);
...
...
@@ -1586,17 +1870,24 @@ short FreeRecvMailbox(unsigned short usDevNumber)
// Read until no msg available
usIdx
=
0
;
do
{
if
((
sRet
=
DevGetMBXState
(
usDevNumber
,
&
usDevState
,
&
usHostState
))
!=
DRV_NO_ERROR
)
{
do
{
if
((
sRet
=
DevGetMBXState
(
usDevNumber
,
&
usDevState
,
&
usHostState
))
!=
DRV_NO_ERROR
)
{
// Something wrong, end function
break
;
}
else
{
}
else
{
// Check if message available
if
(
usHostState
==
HOST_MBX_FULL
)
{
if
(
usHostState
==
HOST_MBX_FULL
)
{
// Read message and throw away
DevGetMessage
(
usDevNumber
,
sizeof
(
MSG_STRUC
),
&
tRecvMsg
,
100L
);
}
else
{
}
else
{
break
;
}
}
...
...
@@ -1609,8 +1900,8 @@ short FreeRecvMailbox(unsigned short usDevNumber)
//----------------------------------------------------------------------------------------
// Create checksum
//----------------------------------------------------------------------------------------
unsigned
short
CreateChecksum
(
unsigned
char
*
pabData
,
int
lDataLen
,
MSG_STRUC
*
ptSendMsg
)
unsigned
short
CreateChecksum
(
unsigned
char
*
pabData
,
int
lDataLen
,
MSG_STRUC
*
ptSendMsg
)
{
int
lIdx
,
lTempLen
;
unsigned
short
usCheckSum
,
usTemp
;
...
...
@@ -1623,7 +1914,8 @@ unsigned short CreateChecksum(
pByte
=
&
ptSendMsg
->
data
[
3
];
// Calculate the Checksum, start with the first message Msg.d[3] up to
// Msg.d[64]
for
(
lIdx
=
0
;
lIdx
<
31
;
lIdx
++
)
{
for
(
lIdx
=
0
;
lIdx
<
31
;
lIdx
++
)
{
usTemp
=
(
*
(
pByte
+
1
));
usTemp
=
(
unsigned
short
)((
usTemp
<<
8
)
|
(
*
pByte
));
usCheckSum
=
(
unsigned
short
)(
usCheckSum
+
usTemp
);
...
...
@@ -1632,7 +1924,8 @@ unsigned short CreateChecksum(
pByte
=
&
pabData
[
64
];
// Create cheksum for the rest of the file
do
{
do
{
usTemp
=
(
*
(
pByte
+
1
));
usTemp
=
(
unsigned
short
)((
usTemp
<<
8
)
|
(
*
pByte
));
usCheckSum
=
(
unsigned
short
)(
usCheckSum
+
usTemp
);
...
...
@@ -1653,21 +1946,28 @@ short TransferMessage(unsigned short usDevNumber, MSG_STRUC* ptSendMsg,
int
lCount
=
0
;
short
sRet
=
DRV_NO_ERROR
;
if
((
sRet
=
DevPutMessage
(
usDevNumber
,
ptSendMsg
,
TO_SEND_MSG
))
==
DRV_NO_ERROR
)
{
do
{
if
((
sRet
=
DevGetMessage
(
usDevNumber
,
sizeof
(
MSG_STRUC
),
ptRecvMsg
,
lTimeout
))
==
DRV_NO_ERROR
)
{
if
((
sRet
=
DevPutMessage
(
usDevNumber
,
ptSendMsg
,
TO_SEND_MSG
))
==
DRV_NO_ERROR
)
{
do
{
if
((
sRet
=
DevGetMessage
(
usDevNumber
,
sizeof
(
MSG_STRUC
),
ptRecvMsg
,
lTimeout
))
==
DRV_NO_ERROR
)
{
// Check on message errors
if
((
ptRecvMsg
->
tx
==
ptSendMsg
->
rx
)
&&
(
ptRecvMsg
->
rx
==
ptSendMsg
->
tx
)
&&
(
ptRecvMsg
->
a
==
ptSendMsg
->
b
)
&&
(
ptRecvMsg
->
b
==
0
)
&&
(
ptRecvMsg
->
nr
==
ptSendMsg
->
nr
))
{
if
((
ptRecvMsg
->
tx
==
ptSendMsg
->
rx
)
&&
(
ptRecvMsg
->
rx
==
ptSendMsg
->
tx
)
&&
(
ptRecvMsg
->
a
==
ptSendMsg
->
b
)
&&
(
ptRecvMsg
->
b
==
0
)
&&
(
ptRecvMsg
->
nr
==
ptSendMsg
->
nr
))
{
// Check on message error
if
(
ptRecvMsg
->
f
!=
0
)
{
if
(
ptRecvMsg
->
f
!=
0
)
{
sRet
=
(
short
)(
ptRecvMsg
->
f
+
DRV_RCS_ERROR_OFFSET
);
break
;
}
else
{
}
else
{
break
;
}
}
...
...
@@ -1692,7 +1992,8 @@ short ReadDeviceInformation(unsigned short usDevNumber, const char* fileName)
memset
(
&
tSendMsg
,
0
,
sizeof
(
MSG_STRUC
));
memset
(
&
tRecvMsg
,
0
,
sizeof
(
MSG_STRUC
));
if
((
sRet
=
FreeRecvMailbox
(
usDevNumber
))
==
DRV_NO_ERROR
)
{
if
((
sRet
=
FreeRecvMailbox
(
usDevNumber
))
==
DRV_NO_ERROR
)
{
// Insert data into message
tSendMsg
.
rx
=
RCS_TASK
;
tSendMsg
.
tx
=
MSG_SYSTEM_TX
;
...
...
@@ -1704,14 +2005,17 @@ short ReadDeviceInformation(unsigned short usDevNumber, const char* fileName)
tSendMsg
.
e
=
0
;
// Insert data
tSendMsg
.
data
[
0
]
=
MODE_GET_PROJ_WERTE_HW
;
if
((
sRet
=
TransferMessage
(
usDevNumber
,
&
tSendMsg
,
&
tRecvMsg
,
TO_SEND_MSG
))
==
DRV_NO_ERROR
)
{
if
((
sRet
=
TransferMessage
(
usDevNumber
,
&
tSendMsg
,
&
tRecvMsg
,
TO_SEND_MSG
))
==
DRV_NO_ERROR
)
{
// Check entry
dwStrLen
=
strlen
(
fileName
);
pInfo
=
(
DEVICE_TYPE_INFO
*
)
&
tRecvMsg
.
data
[
0
];
if
((
pInfo
->
bHerstellerkennung
!=
(
char
)(
toupper
(
fileName
[
dwStrLen
-
3
])))
||
(
pInfo
->
bDeviceType
!=
(
char
)(
toupper
(
fileName
[
dwStrLen
-
2
])))
||
(
pInfo
->
bDeviceModel
!=
(
char
)(
toupper
(
fileName
[
dwStrLen
-
1
]))))
{
if
((
pInfo
->
bHerstellerkennung
!=
(
char
)(
toupper
(
fileName
[
dwStrLen
-
3
])))
||
(
pInfo
->
bDeviceType
!=
(
char
)(
toupper
(
fileName
[
dwStrLen
-
2
])))
||
(
pInfo
->
bDeviceModel
!=
(
char
)(
toupper
(
fileName
[
dwStrLen
-
1
]))))
{
sRet
=
DRV_USR_INVALID_FILETYPE
;
}
}
...
...
@@ -1732,8 +2036,8 @@ short ReadDeviceInformation(unsigned short usDevNumber, const char* fileName)
Return : DRV_NO_ERROR - Download successfully
=================================================================================
<En> */
short
RunFirmwareDownload
(
unsigned
short
usDevNumber
,
FILEDATA
*
ptFile
,
unsigned
long
*
pdwByte
)
short
RunFirmwareDownload
(
unsigned
short
usDevNumber
,
FILEDATA
*
ptFile
,
unsigned
long
*
pdwByte
)
{
int
lFileLength
,
lSendLen
,
lActIdx
;
unsigned
short
usCheckSum
,
usTemp
;
...
...
@@ -1764,8 +2068,10 @@ short RunFirmwareDownload(
dwState
=
RCS_FIRST_MSK
;
fRet
=
TRUE
;
// Run download
do
{
switch
(
dwState
)
{
do
{
switch
(
dwState
)
{
//--------------------------
// Send first message
//--------------------------
...
...
@@ -1799,12 +2105,14 @@ short RunFirmwareDownload(
tSendMsg
.
data
[
2
]
=
(
unsigned
char
)((
usCheckSum
>>
8
)
&
0x00FF
);
// Process message
if
((
sRet
=
TransferMessage
(
usDevNumber
,
&
tSendMsg
,
&
tRecvMsg
,
TO_1ST_MSG
)
)
!=
DRV_NO_ERROR
)
{
if
((
sRet
=
TransferMessage
(
usDevNumber
,
&
tSendMsg
,
&
tRecvMsg
,
TO_1ST_MSG
))
!=
DRV_NO_ERROR
)
{
// Could not process this message
fRet
=
FALSE
;
}
else
{
}
else
{
// ----------------------------
// Message send second message
// ----------------------------
...
...
@@ -1826,25 +2134,30 @@ short RunFirmwareDownload(
memcpy
(
&
tSendMsg
.
data
[
0
],
&
tSendMsg
.
data
[
1
],
64
);
// Insert byte 64 to 239 from the abData[64]
memcpy
(
&
tSendMsg
.
data
[
64
],
&
pabData
[
64
],
(
unsigned
char
)(
lSendLen
-
64
));
memcpy
(
&
tSendMsg
.
data
[
64
],
&
pabData
[
64
],
(
unsigned
char
)(
lSendLen
-
64
));
// Process message
if
((
sRet
=
TransferMessage
(
usDevNumber
,
&
tSendMsg
,
&
tRecvMsg
,
TO_1ST_MSG
)
)
!=
DRV_NO_ERROR
)
{
if
((
sRet
=
TransferMessage
(
usDevNumber
,
&
tSendMsg
,
&
tRecvMsg
,
TO_1ST_MSG
))
!=
DRV_NO_ERROR
)
{
// Could not process this message
fRet
=
FALSE
;
}
else
{
}
else
{
// No error, send next message
lActIdx
+=
lSendLen
;
// Add send size to actual index
*
pdwByte
=
lActIdx
;
// Calculate next message length
if
(
lFileLength
<=
(
lSendLen
+
lActIdx
))
{
if
(
lFileLength
<=
(
lSendLen
+
lActIdx
))
{
lSendLen
=
lFileLength
-
lActIdx
;
// Set length to rest of data
dwState
=
RCS_LAST_MSK
;
}
else
{
}
else
{
dwState
=
RCS_CONT_MSK
;
}
}
...
...
@@ -1862,12 +2175,14 @@ short RunFirmwareDownload(
memcpy
(
&
tSendMsg
.
data
[
0
],
&
pabData
[
lActIdx
],
lSendLen
);
// Process message
if
((
sRet
=
TransferMessage
(
usDevNumber
,
&
tSendMsg
,
&
tRecvMsg
,
TO_CONT_MSG
)
)
!=
DRV_NO_ERROR
)
{
if
((
sRet
=
TransferMessage
(
usDevNumber
,
&
tSendMsg
,
&
tRecvMsg
,
TO_CONT_MSG
))
!=
DRV_NO_ERROR
)
{
// Could not process this message
fRet
=
FALSE
;
}
else
{
}
else
{
// printf("(A)===========================flen = %ld, Sndlen = %ld,
// ActIdx = %ld\n", lFileLength, lSendLen, lActIdx);
// No error, send next message
...
...
@@ -1875,10 +2190,13 @@ short RunFirmwareDownload(
*
pdwByte
=
lActIdx
;
// Calculate next message length
if
(
lFileLength
<=
(
lSendLen
+
lActIdx
))
{
if
(
lFileLength
<=
(
lSendLen
+
lActIdx
))
{
lSendLen
=
lFileLength
-
lActIdx
;
// Set length to rest of data
dwState
=
RCS_LAST_MSK
;
}
else
{
}
else
{
dwState
=
RCS_CONT_MSK
;
}
}
...
...
@@ -1921,8 +2239,8 @@ short RunFirmwareDownload(
Return : DRV_NO_ERROR - Download successfully
=================================================================================
<En> */
short
RunConfigDownload
(
unsigned
short
usDevNumber
,
FILEDATA
*
ptFile
,
unsigned
long
*
pdwByte
)
short
RunConfigDownload
(
unsigned
short
usDevNumber
,
FILEDATA
*
ptFile
,
unsigned
long
*
pdwByte
)
{
unsigned
int
dwState
;
int
lSendLen
,
lActIdx
,
lOffset
,
lFileLength
;
...
...
@@ -1962,8 +2280,10 @@ short RunConfigDownload(
// Set program state
dwState
=
RCS_FIRST_MSK
;
fRet
=
TRUE
;
do
{
switch
(
dwState
)
{
do
{
switch
(
dwState
)
{
//--------------------------
// Send first message
//--------------------------
...
...
@@ -1988,12 +2308,14 @@ short RunConfigDownload(
// printf("cifAPI: %ld\n", dwState);
// Process message
if
((
sRet
=
TransferMessage
(
usDevNumber
,
&
tSendMsg
,
&
tRecvMsg
,
TO_1ST_MSG
)
)
!=
DRV_NO_ERROR
)
{
if
((
sRet
=
TransferMessage
(
usDevNumber
,
&
tSendMsg
,
&
tRecvMsg
,
TO_1ST_MSG
))
!=
DRV_NO_ERROR
)
{
// Could not process this message
fRet
=
FALSE
;
}
else
{
}
else
{
// Set Index for next message, start at offset 44
lActIdx
=
44
;
*
pdwByte
=
lActIdx
;
...
...
@@ -2020,20 +2342,25 @@ short RunConfigDownload(
memcpy
(
&
tSendMsg
.
data
[
0
],
&
pabData
[
lActIdx
],
lSendLen
);
// Process message
if
((
sRet
=
TransferMessage
(
usDevNumber
,
&
tSendMsg
,
&
tRecvMsg
,
TO_CONT_MSG
)
)
!=
DRV_NO_ERROR
)
{
if
((
sRet
=
TransferMessage
(
usDevNumber
,
&
tSendMsg
,
&
tRecvMsg
,
TO_CONT_MSG
))
!=
DRV_NO_ERROR
)
{
// Could not process this message
fRet
=
FALSE
;
}
else
{
}
else
{
// No error, send next message
lActIdx
+=
lSendLen
;
// Add send size to actual index
*
pdwByte
=
lActIdx
;
// Calculate next message length
if
(
lFileLength
<=
(
lSendLen
+
lActIdx
))
{
if
(
lFileLength
<=
(
lSendLen
+
lActIdx
))
{
lSendLen
=
lFileLength
-
lActIdx
;
// Set length to rest of data
dwState
=
RCS_LAST_MSK
;
// Set to last mask
}
else
{
}
else
{
// Continue message
dwState
=
RCS_CONT_MSK
;
}
...
...
@@ -2082,16 +2409,18 @@ short RunConfigDownload(
Return : DRV_NO_ERROR - Download successfully
=================================================================================
<En> */
short
FirmwareDownload
(
unsigned
short
usDevNumber
,
const
char
*
fileName
,
unsigned
long
*
pdwByte
)
short
FirmwareDownload
(
unsigned
short
usDevNumber
,
const
char
*
fileName
,
unsigned
long
*
pdwByte
)
{
short
sRet
=
DRV_NO_ERROR
;
FILEDATA
tFileData
;
// Read Device Information
if
((
sRet
=
ReadDeviceInformation
(
usDevNumber
,
fileName
))
==
DRV_NO_ERROR
)
{
if
((
sRet
=
ReadDeviceInformation
(
usDevNumber
,
fileName
))
==
DRV_NO_ERROR
)
{
// Firmware name is OK
if
((
sRet
=
openFile
(
fileName
,
&
tFileData
))
==
DRV_NO_ERROR
)
{
if
((
sRet
=
openFile
(
fileName
,
&
tFileData
))
==
DRV_NO_ERROR
)
{
// Firmware file opened and loaded into RAM
sRet
=
RunFirmwareDownload
(
usDevNumber
,
&
tFileData
,
pdwByte
);
closeFile
(
&
tFileData
);
...
...
@@ -2112,13 +2441,14 @@ short FirmwareDownload(
Return : DRV_NO_ERROR - Download successfully
=================================================================================
<En> */
short
ConfigDownload
(
unsigned
short
usDevNumber
,
const
char
*
fileName
,
unsigned
long
*
pdwByte
)
short
ConfigDownload
(
unsigned
short
usDevNumber
,
const
char
*
fileName
,
unsigned
long
*
pdwByte
)
{
unsigned
short
sRet
=
DRV_NO_ERROR
;
FILEDATA
tFileData
;
if
((
sRet
=
openFile
(
fileName
,
&
tFileData
))
==
DRV_NO_ERROR
)
{
if
((
sRet
=
openFile
(
fileName
,
&
tFileData
))
==
DRV_NO_ERROR
)
{
// Configuration file opened and loaded into RAM
sRet
=
RunConfigDownload
(
usDevNumber
,
&
tFileData
,
pdwByte
);
closeFile
(
&
tFileData
);
...
...
@@ -2146,17 +2476,26 @@ short DevDownload(unsigned short usDevNumber, unsigned short usMode,
short
sRet
=
DRV_NO_ERROR
;
// valid handle available, driver is open
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
if
(
hDevDrv
==
INVALID_HANDLE_VALUE
)
{
sRet
=
DRV_USR_NOT_INITIALIZED
;
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
}
else
if
(
usDevNumber
>=
MAX_DEV_BOARDS
)
{
sRet
=
DRV_USR_DEV_NUMBER_INVALID
;
}
else
if
((
pdwBytes
==
NULL
)
||
(
pszFileName
==
NULL
)
||
(
pdwBytes
==
NULL
))
{
}
else
if
((
pdwBytes
==
NULL
)
||
(
pszFileName
==
NULL
)
||
(
pdwBytes
==
NULL
))
{
sRet
=
DRV_USR_BUF_PTR_NULL
;
}
else
if
(
strlen
((
const
char
*
)
pszFileName
)
==
0
)
{
}
else
if
(
strlen
((
const
char
*
)
pszFileName
)
==
0
)
{
sRet
=
DRV_USR_FILENAME_INVALID
;
}
else
{
switch
(
usMode
)
{
}
else
{
switch
(
usMode
)
{
case
FIRMWARE_DOWNLOAD
:
sRet
=
FirmwareDownload
(
usDevNumber
,
(
const
char
*
)
pszFileName
,
pdwBytes
);
break
;
...
...
profibus/lib/rt/src/dpgdl.c
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************
/******************************************************************************
* *
*
SOFTING AG
*
*
SOFTING Industrial Automation GmbH
*
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone:
++49-89-4 56 56-0
*
*
Fax: ++49-89-4 56 56-3 99
*
* Phone:
(++49)-(0)89-45656-0
*
*
Fax: (++49)-(0)89-45656-399
*
* *
*
Copyright (C) SOFTING AG 1995-2003
*
*
Copyright (C) SOFTING Industrial Automation GmbH 1995-2012
*
* All Rights Reserved *
* *
******************************************************************************
*******************************************************************************
FILE_NAME DPGDL.C
PROJECT_NAME PROFIBUS
...
...
@@ -54,11 +20,11 @@ MODULE DPGDL
COMPONENT_LIBRARY PAPI Lib
PAPI DLL
AUTHOR SOFTING
AG
AUTHOR SOFTING
VERSION 5.
22
.0.00.release
VERSION 5.
45
.0.00.release
DATE
26-February-199
9
DATE
Dezember-200
9
STATUS finished
...
...
@@ -103,7 +69,9 @@ LOCAL_DATA
#endif
FUNCTION
PUBLIC
INT16
dpgdl_get_data_len
(
IN
INT16
result
,
IN
USIGN8
service
,
IN
USIGN8
primitive
,
IN
USIGN8
FAR
*
data_ptr
,
OUT
INT16
FAR
*
data_len_ptr
)
IN
USIGN8
primitive
,
IN
USIGN8
FAR
*
data_ptr
,
OUT
INT16
FAR
*
data_len_ptr
)
/*------------------------------------------------------------------------*/
/* FUNCTIONAL_DESCRIPTION */
/*------------------------------------------------------------------------*/
...
...
@@ -116,11 +84,14 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service,
FUNCTION_BODY
switch
(
primitive
)
{
switch
(
primitive
)
{
/*--- USER REQUESTS ----------------------------------------------------*/
case
REQ
:
{
switch
(
service
)
{
case
REQ
:
{
switch
(
service
)
{
case
DP_DATA_TRANSFER
:
*
data_len_ptr
=
0
;
break
;
...
...
@@ -144,15 +115,16 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service,
break
;
case
DP_DOWNLOAD_LOC
:
case
DP_DOWNLOAD
:
{
if
(((
T_DP_DOWNLOAD_REQ
FAR
*
)(
data_ptr
))
->
data_len
>
DP_MAX_DOWNLOAD_DATA_LEN
)
{
result
=
E_IF_INVALID_DATA_SIZE
;
case
DP_DOWNLOAD
:
{
if
(((
T_DP_DOWNLOAD_REQ
FAR
*
)(
data_ptr
))
->
data_len
>
DP_MAX_DOWNLOAD_DATA_LEN
)
{
return
(
E_IF_INVALID_DATA_SIZE
);
}
*
data_len_ptr
=
sizeof
(
T_DP_DOWNLOAD_REQ
)
+
((
T_DP_DOWNLOAD_REQ
FAR
*
)(
data_ptr
))
->
data_len
;
*
data_len_ptr
=
sizeof
(
T_DP_DOWNLOAD_REQ
)
+
((
T_DP_DOWNLOAD_REQ
FAR
*
)(
data_ptr
))
->
data_len
;
break
;
}
...
...
@@ -171,31 +143,33 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service,
break
;
case
DP_SET_PRM
:
case
DP_SET_PRM_LOC
:
{
case
DP_SET_PRM_LOC
:
{
service_data_len
=
swap_16_intel_motorola
(
((
T_DP_SET_PRM_REQ
FAR
*
)(
data_ptr
))
->
prm_data
.
prm_data_len
);
if
(
service_data_len
>
DP_MAX_PRM_DATA_LEN
)
{
result
=
E_IF_INVALID_DATA_SIZE
;
if
(
service_data_len
>
DP_MAX_PRM_DATA_LEN
)
{
return
(
E_IF_INVALID_DATA_SIZE
);
}
*
data_len_ptr
=
sizeof
(
T_DP_SET_PRM_REQ
)
-
sizeof
(
T_DP_PRM_DATA
)
+
service_data_len
;
*
data_len_ptr
=
sizeof
(
T_DP_SET_PRM_REQ
)
-
sizeof
(
T_DP_PRM_DATA
)
+
service_data_len
;
break
;
}
case
DP_CHK_CFG
:
{
case
DP_CHK_CFG
:
{
service_data_len
=
swap_16_intel_motorola
(
((
T_DP_CHK_CFG_REQ
FAR
*
)(
data_ptr
))
->
cfg_data
.
cfg_data_len
);
if
(
service_data_len
>
DP_MAX_CFG_DATA_LEN
)
{
result
=
E_IF_INVALID_DATA_SIZE
;
if
(
service_data_len
>
DP_MAX_CFG_DATA_LEN
)
{
return
(
E_IF_INVALID_DATA_SIZE
);
}
*
data_len_ptr
=
sizeof
(
T_DP_CHK_CFG_REQ
)
-
sizeof
(
T_DP_CFG_DATA
)
+
service_data_len
;
*
data_len_ptr
=
sizeof
(
T_DP_CHK_CFG_REQ
)
-
sizeof
(
T_DP_CFG_DATA
)
+
service_data_len
;
break
;
}
...
...
@@ -212,27 +186,30 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service,
*
data_len_ptr
=
sizeof
(
T_DP_RD_OUTP_REQ
);
break
;
case
DP_DATA_EXCHANGE
:
{
if
(((
T_DP_DATA_EXCHANGE_REQ
FAR
*
)(
data_ptr
))
->
outp_data_len
>
DP_MAX_OUTPUT_DATA_LEN
)
{
result
=
E_IF_INVALID_DATA_SIZE
;
case
DP_DATA_EXCHANGE
:
{
if
(((
T_DP_DATA_EXCHANGE_REQ
FAR
*
)(
data_ptr
))
->
outp_data_len
>
DP_MAX_OUTPUT_DATA_LEN
)
{
return
(
E_IF_INVALID_DATA_SIZE
);
}
*
data_len_ptr
=
sizeof
(
T_DP_DATA_EXCHANGE_REQ
)
+
((
T_DP_DATA_EXCHANGE_REQ
FAR
*
)(
data_ptr
))
->
outp_data_len
;
*
data_len_ptr
=
sizeof
(
T_DP_DATA_EXCHANGE_REQ
)
+
((
T_DP_DATA_EXCHANGE_REQ
FAR
*
)(
data_ptr
))
->
outp_data_len
;
break
;
}
case
DP_SET_SLAVE_ADD
:
{
if
(((
T_DP_SET_SLAVE_ADD_REQ
FAR
*
)(
data_ptr
))
->
rem_slave_data_len
>
DP_MAX_REM_SLAVE_DATA_LEN
)
{
result
=
E_IF_INVALID_DATA_SIZE
;
case
DP_SET_SLAVE_ADD
:
{
if
(((
T_DP_SET_SLAVE_ADD_REQ
FAR
*
)(
data_ptr
))
->
rem_slave_data_len
>
DP_MAX_REM_SLAVE_DATA_LEN
)
{
return
(
E_IF_INVALID_DATA_SIZE
);
}
*
data_len_ptr
=
sizeof
(
T_DP_SET_SLAVE_ADD_REQ
)
+
((
T_DP_SET_SLAVE_ADD_REQ
FAR
*
)(
data_ptr
))
->
rem_slave_data_len
;
*
data_len_ptr
=
sizeof
(
T_DP_SET_SLAVE_ADD_REQ
)
+
((
T_DP_SET_SLAVE_ADD_REQ
FAR
*
)(
data_ptr
))
->
rem_slave_data_len
;
break
;
}
...
...
@@ -249,37 +226,41 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service,
*
data_len_ptr
=
0
;
break
;
case
DP_SET_BUSPARAMETER
:
{
if
((((
T_DP_SET_BUSPARAMETER_REQ
FAR
*
)(
data_ptr
))
->
master_user_data_len
>
DP_MAX_SET_BUSPARAMETER_LEN
)
||
(((
T_DP_SET_BUSPARAMETER_REQ
FAR
*
)(
data_ptr
))
->
master_user_data_len
<
DP_MASTER_USER_DATA_LEN
))
{
result
=
E_IF_INVALID_DATA_SIZE
;
case
DP_SET_BUSPARAMETER
:
{
if
((((
T_DP_SET_BUSPARAMETER_REQ
FAR
*
)(
data_ptr
))
->
master_user_data_len
>
DP_MAX_SET_BUSPARAMETER_LEN
)
||
(((
T_DP_SET_BUSPARAMETER_REQ
FAR
*
)(
data_ptr
))
->
master_user_data_len
<
DP_MASTER_USER_DATA_LEN
))
{
return
(
E_IF_INVALID_DATA_SIZE
);
}
*
data_len_ptr
=
sizeof
(
T_DP_SET_BUSPARAMETER_REQ
)
+
((
T_DP_SET_BUSPARAMETER_REQ
FAR
*
)(
data_ptr
))
->
master_user_data_len
-
DP_MASTER_USER_DATA_LEN
;
*
data_len_ptr
=
sizeof
(
T_DP_SET_BUSPARAMETER_REQ
)
+
((
T_DP_SET_BUSPARAMETER_REQ
FAR
*
)(
data_ptr
))
->
master_user_data_len
-
DP_MASTER_USER_DATA_LEN
;
break
;
}
case
DP_SET_MASTER_PARAM
:
{
if
(((
T_DP_SET_MASTER_PARAM_REQ
FAR
*
)(
data_ptr
))
->
data_len
>
DP_MAX_TELEGRAM_LEN
)
{
result
=
E_IF_INVALID_DATA_SIZE
;
case
DP_SET_MASTER_PARAM
:
{
if
(((
T_DP_SET_MASTER_PARAM_REQ
FAR
*
)(
data_ptr
))
->
data_len
>
DP_MAX_TELEGRAM_LEN
)
{
return
(
E_IF_INVALID_DATA_SIZE
);
}
*
data_len_ptr
=
sizeof
(
T_DP_SET_MASTER_PARAM_REQ
)
+
((
T_DP_SET_MASTER_PARAM_REQ
FAR
*
)(
data_ptr
))
->
data_len
;
*
data_len_ptr
=
sizeof
(
T_DP_SET_MASTER_PARAM_REQ
)
+
((
T_DP_SET_MASTER_PARAM_REQ
FAR
*
)(
data_ptr
))
->
data_len
;
break
;
}
case
DP_INITIATE
:
*
data_len_ptr
=
sizeof
(
T_DP_INITIATE_REQ
)
+
((
T_DP_INITIATE_REQ
FAR
*
)(
data_ptr
))
->
add_addr_param
.
s_len
+
((
T_DP_INITIATE_REQ
FAR
*
)(
data_ptr
))
->
add_addr_param
.
d_len
;
*
data_len_ptr
=
sizeof
(
T_DP_INITIATE_REQ
)
+
((
T_DP_INITIATE_REQ
FAR
*
)(
data_ptr
))
->
add_addr_param
.
s_len
+
((
T_DP_INITIATE_REQ
FAR
*
)(
data_ptr
))
->
add_addr_param
.
d_len
;
break
;
case
DP_ABORT
:
...
...
@@ -291,17 +272,16 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service,
break
;
case
DP_WRITE
:
*
data_len_ptr
=
sizeof
(
T_DP_WRITE_REQ
)
+
((
T_DP_WRITE_REQ
FAR
*
)(
data_ptr
))
->
length
;
*
data_len_ptr
=
sizeof
(
T_DP_WRITE_REQ
)
+
((
T_DP_WRITE_REQ
FAR
*
)(
data_ptr
))
->
length
;
break
;
case
DP_DATA_TRANSPORT
:
*
data_len_ptr
=
sizeof
(
T_DP_DATA_TRANSPORT_REQ
)
+
((
T_DP_DATA_TRANSPORT_REQ
FAR
*
)(
data_ptr
))
->
length
;
*
data_len_ptr
=
sizeof
(
T_DP_DATA_TRANSPORT_REQ
)
+
((
T_DP_DATA_TRANSPORT_REQ
FAR
*
)(
data_ptr
))
->
length
;
break
;
default:
result
=
E_IF_INVALID_SERVICE
;
return
(
E_IF_INVALID_SERVICE
);
}
/* switch serivce */
...
...
@@ -310,8 +290,10 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service,
/*---- USER RESPONSES --------------------------------------------------*/
case
RES
:
{
switch
(
service
)
{
case
RES
:
{
switch
(
service
)
{
case
DP_ACT_PARAM
:
*
data_len_ptr
=
sizeof
(
T_DP_ACT_PARAM_RES_CON
);
break
;
...
...
@@ -325,32 +307,33 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service,
*
data_len_ptr
=
sizeof
(
T_DP_END_SEQ_RES_CON
);
break
;
case
DP_UPLOAD
:
{
if
(((
T_DP_UPLOAD_RES_CON
FAR
*
)(
data_ptr
))
->
data_len
>
DP_MAX_UPLOAD_DATA_LEN
)
{
result
=
E_IF_INVALID_DATA_SIZE
;
case
DP_UPLOAD
:
{
if
(((
T_DP_UPLOAD_RES_CON
FAR
*
)(
data_ptr
))
->
data_len
>
DP_MAX_UPLOAD_DATA_LEN
)
{
return
(
E_IF_INVALID_DATA_SIZE
);
}
*
data_len_ptr
=
sizeof
(
T_DP_UPLOAD_RES_CON
)
+
((
T_DP_UPLOAD_RES_CON
FAR
*
)(
data_ptr
))
->
data_len
;
*
data_len_ptr
=
sizeof
(
T_DP_UPLOAD_RES_CON
)
+
((
T_DP_UPLOAD_RES_CON
FAR
*
)(
data_ptr
))
->
data_len
;
break
;
}
case
DP_GET_MASTER_DIAG
:
{
if
(((
T_DP_GET_MASTER_DIAG_RES_CON
FAR
*
)(
data_ptr
))
->
data_len
>
DP_MAX_TELEGRAM_LEN
)
{
result
=
E_IF_INVALID_DATA_SIZE
;
case
DP_GET_MASTER_DIAG
:
{
if
(((
T_DP_GET_MASTER_DIAG_RES_CON
FAR
*
)(
data_ptr
))
->
data_len
>
DP_MAX_TELEGRAM_LEN
)
{
return
(
E_IF_INVALID_DATA_SIZE
);
}
*
data_len_ptr
=
sizeof
(
T_DP_GET_MASTER_DIAG_RES_CON
)
+
((
T_DP_GET_MASTER_DIAG_RES_CON
FAR
*
)(
data_ptr
))
->
data_len
;
*
data_len_ptr
=
sizeof
(
T_DP_GET_MASTER_DIAG_RES_CON
)
+
((
T_DP_GET_MASTER_DIAG_RES_CON
FAR
*
)(
data_ptr
))
->
data_len
;
break
;
}
default:
result
=
E_IF_INVALID_SERVICE
;
return
(
E_IF_INVALID_SERVICE
);
}
/* switch serivce */
...
...
@@ -360,12 +343,9 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service,
/*---- WRONG PRIMITIVE -------------------------------------------------*/
default:
result
=
E_IF_INVALID_PRIMITIVE
;
return
(
E_IF_INVALID_PRIMITIVE
);
}
/* switch primitive */
result
=
E_OK
;
return
(
E_OK
);
}
/* dp_get_data_len */
...
...
profibus/lib/rt/src/dpm_user.h
View file @
ce758cd3
...
...
@@ -139,7 +139,8 @@ extern "C" {
/* device warm start parameter */
/* --------------------------- */
typedef
struct
DPM_PLC_PARAMETERtag
{
typedef
struct
DPM_PLC_PARAMETERtag
{
unsigned
char
bMode
;
/* handshake of process data */
#define DPM_SET_MODE_BUSSYNC_DEVICE_CONTROLLED 0
#define DPM_SET_MODE_BUFFERED_DEVICE_CONTROLLED 1
...
...
@@ -157,7 +158,8 @@ typedef struct DPM_PLC_PARAMETERtag {
bSlStateMethod
;
/* defines the update method od Sl_State field */
#define DPM_SL_STATE_NOT_SYCHRONOUS 0
#define DPM_SL_STATE_SYCHRONOUS 1
struct
{
struct
{
unsigned
char
biIdentNumberActive
:
1
;
unsigned
char
biHighPriorHandshake
:
1
;
unsigned
char
biReserved
:
6
;
...
...
@@ -173,9 +175,11 @@ typedef struct DPM_PLC_PARAMETERtag {
/* parameter data header structure of a slave station,
described in norm EN 50170 page 101 */
typedef
struct
DPM_SL_PRM_HEADERtag
{
typedef
struct
DPM_SL_PRM_HEADERtag
{
unsigned
short
usSlaveParaLen
;
/* length of whole parameter data set */
struct
{
struct
{
unsigned
char
biReserved1
:
1
;
unsigned
char
biExtra_Alarm_SAP
:
1
;
unsigned
char
biDPV1_Data_Types
:
1
;
...
...
@@ -193,7 +197,8 @@ typedef struct DPM_SL_PRM_HEADERtag {
unsigned
char
bDiag_Upd_Delay
;
unsigned
char
bAlarm_Mode
;
struct
{
struct
{
unsigned
char
biNA_to_Abort
:
1
;
unsigned
char
biIgnore_Aclr
:
1
;
unsigned
char
abiReserved
:
6
;
...
...
@@ -207,13 +212,16 @@ typedef struct DPM_SL_PRM_HEADERtag {
described in norm EN 50170 page 51 */
#define MAX_USR_PRM_LEN 237
typedef
struct
DPV0_PRMtag
{
typedef
struct
DPV0_PRMtag
{
unsigned
char
abUsr_Prm_Data
[
MAX_USR_PRM_LEN
];
/* user parameter data without
DPV1-bytes */
}
GNUC_PACKED
DPV0_PRM
;
typedef
struct
DPV1_USR_PRMtag
{
struct
{
typedef
struct
DPV1_USR_PRMtag
{
struct
{
unsigned
char
bReserved1
:
2
;
unsigned
char
bWD_Base_1ms
:
1
;
unsigned
char
bReserved2
:
2
;
...
...
@@ -222,7 +230,8 @@ typedef struct DPV1_USR_PRMtag {
unsigned
char
bDPV1_Enable
:
1
;
}
GNUC_PACKED
DPV1_Status_1
;
struct
{
struct
{
unsigned
char
bRun_On_Cfg_Fault
:
1
;
unsigned
char
bReserved1
:
1
;
unsigned
char
bEnable_Update_Alarm
:
1
;
...
...
@@ -233,26 +242,30 @@ typedef struct DPV1_USR_PRMtag {
unsigned
char
bEnable_Pull_plug_Alarm
:
1
;
}
GNUC_PACKED
DPV1_Status_2
;
struct
{
struct
{
unsigned
char
bAlarm_Mode
:
3
;
unsigned
char
bIsoM_Req
:
1
;
unsigned
char
bReserved1
:
4
;
}
GNUC_PACKED
DPV1_Status_3
;
}
GNUC_PACKED
DPV1_USR_PRM
;
typedef
struct
DPV1_PRMtag
{
typedef
struct
DPV1_PRMtag
{
DPV1_USR_PRM
tDpv1
;
unsigned
char
abUsr_Prm_Data
[
MAX_USR_PRM_LEN
-
sizeof
(
DPV1_USR_PRM
)];
}
GNUC_PACKED
DPV1_PRM
;
typedef
struct
DPV2_HEADERtag
{
typedef
struct
DPV2_HEADERtag
{
unsigned
char
bStructure_Length
;
unsigned
char
bStructure_Type
;
unsigned
char
bSlot_Number
;
unsigned
char
bReserved
;
}
GNUC_PACKED
DPV2_HEADER
;
typedef
struct
DPV2_ISOM_PRMtag
{
typedef
struct
DPV2_ISOM_PRMtag
{
DPV2_HEADER
tDpv2Header
;
unsigned
char
bVersion
;
unsigned
long
bTBase_Dp
;
...
...
@@ -266,29 +279,34 @@ typedef struct DPV2_ISOM_PRMtag {
unsigned
short
bTPll_D
;
}
GNUC_PACKED
DPV2_ISOM_PRM
;
typedef
struct
DPV2_DBX_LINK_FILTERtag
{
typedef
struct
DPV2_DBX_LINK_FILTERtag
{
unsigned
char
bPublisher_Addr
;
unsigned
char
bPublisher_Length
;
unsigned
char
bSample_Offset
;
unsigned
char
bSample_Length
;
}
GNUC_PACKED
DPV2_DBX_LINK_FILTER
;
typedef
struct
DPV2_DBX_LINKtag
{
typedef
struct
DPV2_DBX_LINKtag
{
DPV2_HEADER
tDpv2Header
;
unsigned
char
bVersion
;
DPV2_DBX_LINK_FILTER
tDbxLinkFilter
;
}
GNUC_PACKED
DPV2_DBX_LINK
;
typedef
struct
DPV2_PRMtag
{
typedef
struct
DPV2_PRMtag
{
DPV1_USR_PRM
tDpv1
;
DPV2_ISOM_PRM
tDpv2Iso
;
unsigned
char
abUsr_Prm_Data
[
MAX_USR_PRM_LEN
-
sizeof
(
DPV1_USR_PRM
)
-
sizeof
(
DPV2_ISOM_PRM
)];
unsigned
char
abUsr_Prm_Data
[
MAX_USR_PRM_LEN
-
sizeof
(
DPV1_USR_PRM
)
-
sizeof
(
DPV2_ISOM_PRM
)];
}
GNUC_PACKED
DPV2_PRM
;
typedef
struct
DPM_SL_PRM_PRM_DATAtag
{
typedef
struct
DPM_SL_PRM_PRM_DATAtag
{
unsigned
short
usPrmDataLen
;
/* length of PRM_PRM_DATA */
struct
{
struct
{
unsigned
char
bReserved
:
3
;
unsigned
char
bWD_On
:
1
;
unsigned
char
bFreeze_Req
:
1
;
...
...
@@ -315,7 +333,8 @@ typedef struct DPM_SL_PRM_PRM_DATAtag {
described in norm EN 50170 page 55 */
#define MAX_CFG_DATA_LEN 244
typedef
struct
DPM_SL_PRM_CFG_DATAtag
{
typedef
struct
DPM_SL_PRM_CFG_DATAtag
{
unsigned
short
usCfg_Data_Len
;
/* length of CFG_DATA */
unsigned
char
abCfg_Data
[
MAX_CFG_DATA_LEN
];
/* configuration data of the
slave station */
...
...
@@ -325,7 +344,8 @@ typedef struct DPM_SL_PRM_CFG_DATAtag {
described in norm EN 50170 page 103 */
#define MAX_EA_OFFSET_LEN 244
typedef
struct
DPM_SL_PRM_ADD_TABtag
{
typedef
struct
DPM_SL_PRM_ADD_TABtag
{
unsigned
short
usAdd_Tab_Len
;
/* length of ADD_TAB */
unsigned
char
bInput_Count
;
/* counter of following input offsets */
unsigned
char
bOutput_Count
;
/* counter of following ouput offsets */
...
...
@@ -337,7 +357,8 @@ typedef struct DPM_SL_PRM_ADD_TABtag {
described in norm EN 50170 page 103 */
#define MAX_SL_PRM_LEN 100
typedef
struct
DPM_SL_PRM_USR_DATAtag
{
typedef
struct
DPM_SL_PRM_USR_DATAtag
{
unsigned
short
usSlave_Usr_Data_Len
;
/* length of USR_DATA */
unsigned
char
abSlave_Usr_Data
[
MAX_SL_PRM_LEN
];
/* user paramteres */
}
GNUC_PACKED
DPM_SL_PRM_USR_DATA
;
...
...
@@ -348,7 +369,8 @@ typedef struct DPM_SL_PRM_USR_DATAtag {
/* master parameter 'DPM_Bus_Dp' data set
described in norm DIN 19245-T3 page 98 */
typedef
struct
DPM_BUS_DPtag
{
typedef
struct
DPM_BUS_DPtag
{
unsigned
short
usBus_Para_Len
;
/* length of BUS_DP */
unsigned
char
bFDL_Add
;
/* master address */
unsigned
char
bBaudrate
;
/* baudrate, see. #defines */
...
...
@@ -373,7 +395,8 @@ typedef struct DPM_BUS_DPtag {
unsigned
char
bG
;
/* gap update */
unsigned
char
bHSA
;
/* highest active station address */
unsigned
char
bMax_Retry_Limit
;
/* retries if error occurs */
struct
{
struct
{
unsigned
char
bReserved
:
7
;
unsigned
char
bError_Action_Flag
:
1
;
}
GNUC_PACKED
Bp_Flag
;
/* auto_clear on/off */
...
...
@@ -392,8 +415,10 @@ typedef struct DPM_BUS_DPtag {
#define MAX_EXT_DIAG_LEN 100
/* slave specific diagnostic structure
described in norm DIN 19245-T3 page 41 */
typedef
struct
DPM_SLAVE_SINGLE_DIAGNOTICStag
{
struct
{
typedef
struct
DPM_SLAVE_SINGLE_DIAGNOTICStag
{
struct
{
unsigned
char
bStation_Non_Existent
:
1
;
/* no response */
unsigned
char
bStation_Not_Ready
:
1
;
/* station not ready */
unsigned
char
bCfg_Fault
:
1
;
/* configuration fault */
...
...
@@ -405,7 +430,8 @@ typedef struct DPM_SLAVE_SINGLE_DIAGNOTICStag {
unsigned
char
bMaster_Lock
:
1
;
/* locked by a master */
}
GNUC_PACKED
Stationstatus_1
;
struct
{
struct
{
unsigned
char
bPrm_Req
:
1
;
/* request new parameters */
unsigned
char
bStat_Diag
:
1
;
/* static diagnostic */
unsigned
char
bTrue
:
1
;
/* set to 1 by a slave */
...
...
@@ -417,7 +443,8 @@ typedef struct DPM_SLAVE_SINGLE_DIAGNOTICStag {
unsigned
char
bDeactivated
:
1
;
/* slave deactivated */
}
GNUC_PACKED
Stationstatus_2
;
struct
{
struct
{
unsigned
char
bReserved
:
7
;
unsigned
char
bExt_Diag_Overflow
:
1
;
/* ext. diagnostic overflow */
}
GNUC_PACKED
Stationstatus_3
;
...
...
@@ -434,9 +461,11 @@ typedef struct DPM_SLAVE_SINGLE_DIAGNOTICStag {
/* Protocol master state structure */
/* ======================================================================== */
typedef
struct
DPM_DIAGNOSTICStag
{
typedef
struct
DPM_DIAGNOSTICStag
{
/* unsigned char field to show bus and master main errors */
struct
{
struct
{
unsigned
char
bCtrl
:
1
;
/* wrong parameterization */
unsigned
char
bAClr
:
1
;
/* auto_clear activated */
unsigned
char
bNonExch
:
1
;
/* no data exchange to at least on station */
...
...
@@ -455,7 +484,8 @@ typedef struct DPM_DIAGNOSTICStag {
#define OPERATE 0xC0
/* location of error and error code */
struct
{
struct
{
unsigned
char
bErr_Rem_Adr
;
/* 0-125, 255 */
#define MST_ERR 0xFF
...
...
@@ -511,19 +541,22 @@ typedef struct DPM_DIAGNOSTICStag {
#define UNDEFINED 1
typedef
struct
{
typedef
struct
{
unsigned
char
abNetwork_Address
[
6
];
/* network address according ISO/OSI */
unsigned
char
abMAC_Address
[
UNDEFINED
];
/* MAC_Address */
}
GNUC_PACKED
ADDR_EXTENTION
;
typedef
struct
{
typedef
struct
{
unsigned
char
bAPI
;
/* application process instance */
unsigned
char
bSCL
;
/* access level */
}
GNUC_PACKED
ADDR
;
#define MAX_ADD_TABLE_LEN 235
typedef
struct
{
typedef
struct
{
#define TYPE_EXT_OFF 0
/* no optional Network/MAC address */
#define TYPE_EXT_ON 1
/* optional Network/MAC address available */
...
...
@@ -536,15 +569,18 @@ typedef struct {
}
GNUC_PACKED
ADD_ADDR_PARAM
;
typedef
struct
{
typedef
struct
{
unsigned
short
usSend_Timeout
;
/* control time for supervision */
struct
{
struct
{
unsigned
char
biDPV1_RW
:
1
;
/* support of MSAC2_READ and WRITE */
unsigned
char
abiReserved
:
7
;
}
GNUC_PACKED
bFeatures_Supported_1
;
struct
{
struct
{
unsigned
char
abiReserved
:
8
;
}
GNUC_PACKED
bFeatures_Supported_2
;
...
...
@@ -556,13 +592,16 @@ typedef struct {
ADD_ADDR_PARAM
tAdd_Addr_Param
;
}
GNUC_PACKED
DPM_MSAC2M_INITIATE_REQ
;
typedef
struct
{
struct
{
typedef
struct
{
struct
{
unsigned
char
biDPV1_RW
:
1
;
/* support of MSAC2_READ and WRITE */
unsigned
char
abiReserved
:
7
;
}
GNUC_PACKED
bFeatures_Supported_1
;
struct
{
struct
{
unsigned
char
abiReserved
:
8
;
}
GNUC_PACKED
bFeatures_Supported_2
;
...
...
@@ -627,7 +666,8 @@ typedef struct {
/* message command msg.b msg.a */
#define DDLM_Slave_Diag 0x42
typedef
struct
DDLM_SLAVE_DIAG_CONFIRMtag
{
typedef
struct
DDLM_SLAVE_DIAG_CONFIRMtag
{
DPM_SLAVE_SINGLE_DIAGNOSTICS
tDiagData
;
}
GNUC_PACKED
DDLM_SLAVE_DIAG_CONFIRM
;
...
...
@@ -638,12 +678,14 @@ typedef struct DDLM_SLAVE_DIAG_CONFIRMtag {
/* message command msg.b msg.a */
#define DDLM_Set_Prm 0x4a
typedef
struct
DDLM_SET_PRM_REQUESTtag
{
typedef
struct
DDLM_SET_PRM_REQUESTtag
{
unsigned
char
bRem_Add
;
unsigned
char
abUsr_Prm_Data
[
DPM_MAX_LEN_DATA_UNIT
];
}
GNUC_PACKED
DDLM_SET_PRM_REQUEST
;
typedef
struct
DDLM_SET_PRM_CONFIRMtag
{
typedef
struct
DDLM_SET_PRM_CONFIRMtag
{
unsigned
char
bRem_Add
;
}
GNUC_PACKED
DDLM_SET_PRM_CONFIRM
;
...
...
@@ -661,13 +703,15 @@ typedef struct DDLM_SET_PRM_CONFIRMtag {
/* message command msg.b msg.a */
#define DDLM_Start_Seq 0x43
typedef
struct
DDLM_START_SEQ_REQUESTtag
{
typedef
struct
DDLM_START_SEQ_REQUESTtag
{
unsigned
char
bReq_Add
;
/* 0 */
unsigned
char
bArea_Code
;
/* 0 - 125 */
unsigned
short
usTimeout
;
/* 0 - 65535 */
}
GNUC_PACKED
DDLM_START_SEQ_REQUEST
;
typedef
struct
DDLM_START_SEQ_CONFIRMtag
{
typedef
struct
DDLM_START_SEQ_CONFIRMtag
{
unsigned
char
bMax_Len_Data_Unit
;
/* 240 */
}
GNUC_PACKED
DDLM_START_SEQ_CONFIRM
;
...
...
@@ -680,7 +724,8 @@ typedef struct DDLM_START_SEQ_CONFIRMtag {
#define DPM_DEVICE_PRM 127
/* message data structure */
typedef
struct
DDLM_DOWNLOAD_REQUESTtag
{
typedef
struct
DDLM_DOWNLOAD_REQUESTtag
{
unsigned
char
bReq_Add
;
/* 0 */
unsigned
char
bArea_Code
;
/* 0 - 125, 127 */
unsigned
short
usAdd_Offset
;
/* 0 - 760 */
...
...
@@ -695,7 +740,8 @@ typedef struct DDLM_DOWNLOAD_REQUESTtag {
#define DDLM_Upload 0x50
/* message data structure */
typedef
struct
DDLM_UPLOAD_REQUESTtag
{
typedef
struct
DDLM_UPLOAD_REQUESTtag
{
unsigned
char
bReq_Add
;
/* 0 */
unsigned
char
bArea_Code
;
/* 0 - 125, 127 */
unsigned
short
usAdd_Offset
;
/* 0 - 760 */
...
...
@@ -710,7 +756,8 @@ typedef struct DDLM_UPLOAD_REQUESTtag {
#define DDLM_End_Seq 0x45
/* message data structure */
typedef
struct
DDLM_END_SEQ_REQUESTtag
{
typedef
struct
DDLM_END_SEQ_REQUESTtag
{
unsigned
char
bReq_Add
;
/* 0 */
}
GNUC_PACKED
DDLM_END_SEQ_REQUEST
;
...
...
@@ -722,7 +769,8 @@ typedef struct DDLM_END_SEQ_REQUESTtag {
#define DDLM_Global_Control 0x46
/* message data structure */
typedef
struct
DDLM_GLOBAL_CONTROL_REQUESTtag
{
typedef
struct
DDLM_GLOBAL_CONTROL_REQUESTtag
{
unsigned
char
bRem_Add
;
/* 0 - 127 */
unsigned
char
bControl_Command
;
#define CLEAR_DATA 0x02
...
...
@@ -734,7 +782,8 @@ typedef struct DDLM_GLOBAL_CONTROL_REQUESTtag {
unsigned
char
bGroup_Select
;
}
GNUC_PACKED
DDLM_GLOBAL_CONTROL_REQUEST
;
typedef
struct
DDLM_GLOBAL_CONTROL_CONFIRMtag
{
typedef
struct
DDLM_GLOBAL_CONTROL_CONFIRMtag
{
unsigned
char
bRem_Add
;
/* 0 - 127 */
}
GNUC_PACKED
DDLM_GLOBAL_CONTROL_CONFIRM
;
...
...
@@ -773,12 +822,14 @@ typedef struct DDLM_GLOBAL_CONTROL_CONFIRMtag {
#define DATA_STU_SIZE 244
typedef
struct
octet_strtag
{
typedef
struct
octet_strtag
{
unsigned
char
bLen
;
/* length of data field 0 to 244 */
unsigned
char
bValue
[
DATA_STU_SIZE
];
/* data field */
}
GNUC_PACKED
octet_str
;
typedef
struct
FDL_DATA_ACK_REQ_STUtag
{
typedef
struct
FDL_DATA_ACK_REQ_STUtag
{
unsigned
char
bSsap
;
/* Src.Serv.Acc.Point0-62,255 */
unsigned
char
bDsap
;
/* Dest.Serv.Acc.Point0-63,255 */
unsigned
char
bRem_add_da
;
/* Remote Address 0-126 */
...
...
@@ -786,7 +837,8 @@ typedef struct FDL_DATA_ACK_REQ_STUtag {
octet_str
tL_sdu
;
/* data field structure */
}
GNUC_PACKED
FDL_DATA_ACK_REQ_STU
;
typedef
struct
FDL_DATA_ACK_IND_STUtag
{
typedef
struct
FDL_DATA_ACK_IND_STUtag
{
unsigned
char
bDsap
;
/* Dest.Serv.Acc.Point0-63,255 */
unsigned
char
bSsap
;
/* Src.Serv.Acc.Point0-62,255 */
unsigned
char
bRem_add_da
;
/* Remote Address 0-126 */
...
...
@@ -810,7 +862,8 @@ typedef struct FDL_DATA_ACK_IND_STUtag {
#define FDL_Send_Data_Reply_Con 0x82
#define FDL_Send_Data_Reply_Ind 0xC2
typedef
struct
FDL_DATA_REPLY_REQ_STUtag
{
typedef
struct
FDL_DATA_REPLY_REQ_STUtag
{
unsigned
char
bSsap
;
/* Source Service Access Point 0 to 126 */
unsigned
char
bDsap
;
/* Destination Service Access Point 0 to 127 */
unsigned
char
bRem_add_da
;
/* Remote Address in PROFIBUS 0 to 127 */
...
...
@@ -818,7 +871,8 @@ typedef struct FDL_DATA_REPLY_REQ_STUtag {
octet_str
tL_sdu
;
/* data field structure */
}
GNUC_PACKED
FDL_DATA_REPLY_REQ_STU
;
typedef
struct
FDL_DATA_REPLY_CON_STUtag
{
typedef
struct
FDL_DATA_REPLY_CON_STUtag
{
unsigned
char
bSsap
;
/* Source Service Access Point 0 to 126 */
unsigned
char
bDsap
;
/* Destination Service Access Point 0 to 127 */
unsigned
char
bRem_add_da
;
/* Remote Address in PROFIBUS 0 to 127 */
...
...
@@ -827,7 +881,8 @@ typedef struct FDL_DATA_REPLY_CON_STUtag {
octet_str
tL_sdu
;
/* data field structure */
}
GNUC_PACKED
FDL_DATA_REPLY_CON_STU
;
typedef
struct
FDL_DATA_REPLY_IND_STUtag
{
typedef
struct
FDL_DATA_REPLY_IND_STUtag
{
unsigned
char
bDsap
;
/* Destination Service Access Point 0 to 127 */
unsigned
char
bSsap
;
/* Source Service Access Point 0 to 126 */
unsigned
char
bRem_add_da
;
/* Remote Address in PROFIBUS 0 to 127 */
...
...
@@ -848,7 +903,8 @@ typedef struct FDL_DATA_REPLY_IND_STUtag {
#define FDL_Reply_Update_Req 0x83
typedef
struct
FDL_REPLY_UPDATE_REQ_STUtag
{
typedef
struct
FDL_REPLY_UPDATE_REQ_STUtag
{
unsigned
char
bSsap
;
/* Src.Serv.Acc.Point 0-62 */
unsigned
char
bDsap
;
/* not used */
unsigned
char
bRem_add_da
;
/* not used */
...
...
@@ -857,7 +913,8 @@ typedef struct FDL_REPLY_UPDATE_REQ_STUtag {
octet_str
tL_sdu
;
/* data field structure */
}
GNUC_PACKED
FDL_REPLY_UPDATE_REQ_STU
;
typedef
struct
FDL_REPLY_UPDATE_CON_STUtag
{
typedef
struct
FDL_REPLY_UPDATE_CON_STUtag
{
unsigned
char
bSsap
;
/* Src.Serv.Acc.Point 0-62 */
unsigned
char
bDsap
;
/* Dest.Serv.Acc.Point 0-63 */
unsigned
char
bRem_add_da
;
/* Remote Address 0-126 */
...
...
@@ -872,7 +929,8 @@ typedef struct FDL_REPLY_UPDATE_CON_STUtag {
#define FDL_SSap_Activate_req 0x97
#define FDL_SSap_Activate_con 0x97
typedef
struct
FDL_SAP_ACTIVATE_REQ_STUtag
{
typedef
struct
FDL_SAP_ACTIVATE_REQ_STUtag
{
unsigned
char
bSsap
;
/* Source Service Access Point 0-63,65 */
unsigned
char
bAccess
;
/* Accessright = 255 */
unsigned
char
bService_list_length
;
/* Length of followed list = 4 */
...
...
@@ -889,7 +947,8 @@ typedef struct FDL_SAP_ACTIVATE_REQ_STUtag {
unsigned
char
abRole_in_service
[
4
];
/* Configuration for the service */
struct
{
struct
{
unsigned
char
bReq_low
;
/* Maximum length of buffer = 240 */
unsigned
char
bReq_high
;
/* Maximum length of buffer = 240 */
unsigned
char
bInd_low
;
/* Maximum length of buffer = 240 */
...
...
@@ -898,7 +957,8 @@ typedef struct FDL_SAP_ACTIVATE_REQ_STUtag {
}
GNUC_PACKED
FDL_SAP_ACTIVATE_REQ_STU
;
typedef
struct
FDL_SAP_ACTIVATE_CON_STUtag
{
typedef
struct
FDL_SAP_ACTIVATE_CON_STUtag
{
unsigned
char
bSsap
;
/* Src. Service Access Pnt */
unsigned
char
bM_status
;
}
GNUC_PACKED
FDL_SAP_ACTIVATE_CON_STU
;
...
...
@@ -910,7 +970,8 @@ typedef struct FDL_SAP_ACTIVATE_CON_STUtag {
#define FDL_RSap_Activate_Req 0x98
#define FDL_RSap_Activate_Con 0x98
typedef
struct
FDL_RSAP_ACTIVATE_REQ_STUtag
{
typedef
struct
FDL_RSAP_ACTIVATE_REQ_STUtag
{
unsigned
char
bSsap
;
/* Source Service Access Point 0-63,65 */
unsigned
char
bAccess
;
/* Accessright = 255 */
unsigned
char
bIndication_mode
;
...
...
@@ -922,7 +983,8 @@ typedef struct FDL_RSAP_ACTIVATE_REQ_STUtag {
}
GNUC_PACKED
FDL_RSAP_ACTIVATE_REQ_STU
;
typedef
struct
FDL_RSAP_ACTIVATE_CON_STUtag
{
typedef
struct
FDL_RSAP_ACTIVATE_CON_STUtag
{
unsigned
char
bSsap
;
/* Src. Service Access Pnt */
unsigned
char
bM_status
;
}
GNUC_PACKED
FDL_RSAP_ACTIVATE_CON_STU
;
...
...
@@ -934,11 +996,13 @@ typedef struct FDL_RSAP_ACTIVATE_CON_STUtag {
#define FDL_Sap_Deactivate_Req 0x9A
#define FDL_Sap_Deactivate_Con 0x9A
typedef
struct
{
typedef
struct
{
unsigned
char
bSsap
;
/* Source Serv. Access Pnt 0-63,255 */
}
GNUC_PACKED
FDL_SAP_DEACTIVATE_REQ_STU
;
typedef
struct
{
typedef
struct
{
unsigned
char
bSsap
;
/* Src. Service Access Pnt 0-63,255 */
unsigned
char
bM_status
;
}
GNUC_PACKED
FDL_SAP_DEACTIVATE_CON_STU
;
...
...
profibus/lib/rt/src/dpsgdl.c
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************
/******************************************************************************
* *
*
SOFTING AG
*
*
SOFTING Industrial Automation GmbH
*
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone:
++49-89-4 56 56-0
*
*
Fax: ++49-89-4 56 56-3 99
*
* Phone:
(++49)-(0)89-45656-0
*
*
Fax: (++49)-(0)89-45656-399
*
* *
*
Copyright (C) SOFTING AG 1998-2003
*
*
Copyright (C) SOFTING Industrial Automation GmbH 1995-2012
*
* All Rights Reserved *
* *
******************************************************************************
******************************************************************************
*
FILE_NAME DPSGDL.C
...
...
@@ -55,12 +20,12 @@ MODULE DPSGDL
COMPONENT_LIBRARY PAPI Lib
PAPI DLL
AUTHOR SOFTING
AG
AUTHOR SOFTING
VERSION 1.
2
0.0.00.release (DP-Slave Stand-Alone for DOS)
VERSION 1.
3
0.0.00.release (DP-Slave Stand-Alone for DOS)
5.22.0.00.release (WIN95/WIN98 and WinNT)
DATE
26-
February-1999
DATE February-1999
STATUS finished
...
...
@@ -107,7 +72,9 @@ LOCAL_DATA
#pragma check_stack(off)
#endif
FUNCTION
PUBLIC
INT16
dpsgdl_get_data_len
(
IN
INT16
result
,
IN
USIGN8
service
,
IN
USIGN8
primitive
,
IN
USIGN8
FAR
*
data_ptr
,
OUT
INT16
FAR
*
data_len_ptr
)
IN
USIGN8
primitive
,
IN
USIGN8
FAR
*
data_ptr
,
OUT
INT16
FAR
*
data_len_ptr
)
/*------------------------------------------------------------------------*/
/* FUNCTIONAL_DESCRIPTION */
/*------------------------------------------------------------------------*/
...
...
@@ -121,29 +88,33 @@ FUNCTION PUBLIC INT16 dpsgdl_get_data_len(IN INT16 result, IN USIGN8 service,
FUNCTION_BODY
switch
(
primitive
)
{
switch
(
primitive
)
{
/*--- USER REQUESTS ----------------------------------------------------*/
case
REQ
:
{
switch
(
service
)
{
case
DPS_INIT_SLAVE
:
{
case
REQ
:
{
switch
(
service
)
{
case
DPS_INIT_SLAVE
:
{
init_slave_req_ptr
=
(
T_DPS_INIT_SLAVE_REQ
FAR
*
)
data_ptr
;
if
((
init_slave_req_ptr
->
cfg_data_len
==
0
)
||
(
init_slave_req_ptr
->
cfg_data_len
>
DP_MAX_CFG_DATA_LEN
))
{
result
=
E_IF_INVALID_DATA_SIZE
;
if
((
init_slave_req_ptr
->
cfg_data_len
==
0
)
||
(
init_slave_req_ptr
->
cfg_data_len
>
DP_MAX_CFG_DATA_LEN
))
{
return
(
E_IF_INVALID_DATA_SIZE
);
}
if
(
init_slave_req_ptr
->
enhanced_init_data_len
>
sizeof
(
init_slave_req_ptr
->
enhanced_init_data
))
{
result
=
E_IF_INVALID_DATA_SIZE
;
if
(
init_slave_req_ptr
->
enhanced_init_data_len
>
sizeof
(
init_slave_req_ptr
->
enhanced_init_data
))
{
return
(
E_IF_INVALID_DATA_SIZE
);
}
*
data_len_ptr
=
sizeof
(
T_DPS_INIT_SLAVE_REQ
)
-
(
sizeof
(
init_slave_req_ptr
->
enhanced_init_data
)
-
init_slave_req_ptr
->
enhanced_init_data_len
);
*
data_len_ptr
=
sizeof
(
T_DPS_INIT_SLAVE_REQ
)
-
(
sizeof
(
init_slave_req_ptr
->
enhanced_init_data
)
-
init_slave_req_ptr
->
enhanced_init_data_len
);
break
;
}
/* case DPS_INIT_SLAVE */
...
...
@@ -151,16 +122,18 @@ FUNCTION PUBLIC INT16 dpsgdl_get_data_len(IN INT16 result, IN USIGN8 service,
*
data_len_ptr
=
0
;
break
;
case
DPS_SLAVE_DIAG
:
{
case
DPS_SLAVE_DIAG
:
{
slave_diag_req_ptr
=
(
T_DPS_SLAVE_DIAG_REQ
FAR
*
)
data_ptr
;
if
(
slave_diag_req_ptr
->
ext_diag_data_len
>
DP_MAX_EXT_DIAG_DATA_LEN
)
{
result
=
E_IF_INVALID_DATA_SIZE
;
if
(
slave_diag_req_ptr
->
ext_diag_data_len
>
DP_MAX_EXT_DIAG_DATA_LEN
)
{
return
(
E_IF_INVALID_DATA_SIZE
);
}
*
data_len_ptr
=
sizeof
(
T_DPS_SLAVE_DIAG_REQ
)
-
(
DP_MAX_EXT_DIAG_DATA_LEN
-
slave_diag_req_ptr
->
ext_diag_data_len
);
*
data_len_ptr
=
sizeof
(
T_DPS_SLAVE_DIAG_REQ
)
-
(
DP_MAX_EXT_DIAG_DATA_LEN
-
slave_diag_req_ptr
->
ext_diag_data_len
);
break
;
}
...
...
@@ -171,11 +144,9 @@ FUNCTION PUBLIC INT16 dpsgdl_get_data_len(IN INT16 result, IN USIGN8 service,
case
DPS_CHK_CFG
:
case
DPS_SET_PRM
:
case
DPS_SET_SLAVE_ADD
:
result
=
E_IF_INVALID_PRIMITIVE
;
return
(
E_IF_INVALID_PRIMITIVE
);
default:
result
=
E_IF_INVALID_SERVICE
;
return
(
E_IF_INVALID_SERVICE
);
}
/* switch serivce */
...
...
@@ -185,8 +156,10 @@ FUNCTION PUBLIC INT16 dpsgdl_get_data_len(IN INT16 result, IN USIGN8 service,
/*---- USER RESPONSES --------------------------------------------------*/
case
RES
:
{
switch
(
service
)
{
case
RES
:
{
switch
(
service
)
{
case
DPS_CHK_CFG
:
*
data_len_ptr
=
sizeof
(
T_DPS_CHK_CFG_RES
);
break
;
...
...
@@ -195,7 +168,6 @@ FUNCTION PUBLIC INT16 dpsgdl_get_data_len(IN INT16 result, IN USIGN8 service,
break
;
default:
result
=
E_IF_INVALID_SERVICE
;
return
(
E_IF_INVALID_SERVICE
);
}
/* switch serivce */
...
...
@@ -206,12 +178,10 @@ FUNCTION PUBLIC INT16 dpsgdl_get_data_len(IN INT16 result, IN USIGN8 service,
/*---- WRONG PRIMITIVE -------------------------------------------------*/
default:
result
=
E_IF_INVALID_PRIMITIVE
;
return
(
E_IF_INVALID_PRIMITIVE
);
}
/* switch primitive */
result
=
E_OK
;
return
(
E_OK
);
}
/* dpsgdl_get_data_len */
...
...
profibus/lib/rt/src/fdlgdl.c
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************
/******************************************************************************
* *
*
SOFTING AG
*
*
SOFTING Industrial Automation GmbH
*
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone:
++49-89-4 56 56-0
*
*
Fax: ++49-89-4 56 56-3 99
*
* Phone:
(++49)-(0)89-45656-0
*
*
Fax: (++49)-(0)89-45656-399
*
* *
*
Copyright (C) SOFTING AG 1995-2003
*
*
Copyright (C) SOFTING Industrial Automation GmbH 1995-2012
*
* All Rights Reserved *
* *
******************************************************************************
******************************************************************************
*
FILE_NAME FDLGDL.C
...
...
@@ -55,11 +20,11 @@ MODULE FDLGDL
COMPONENT_LIBRARY PAPI Lib
PAPI DLL
AUTHOR SOFTING
AG
AUTHOR SOFTING
VERSION 5.23.0.00.release
DATE
30-
October-2000
DATE October-2000
STATUS finished
...
...
@@ -105,12 +70,13 @@ LOCAL_DATA
#pragma check_stack(off)
#endif
FUNCTION
PUBLIC
INT16
fdlgdl_get_data_len
(
IN
INT16
result
,
/* Service-Result */
FUNCTION
PUBLIC
INT16
fdlgdl_get_data_len
(
IN
INT16
result
,
/* Service-Result */
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
,
/* Service-Primitive */
IN
USIGN8
FAR
*
data_ptr
,
/* pointer to data */
OUT
INT16
*
data_len_ptr
/* length of data */
)
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -129,20 +95,26 @@ possible return values:
*
data_len_ptr
=
0
;
result
=
E_OK
;
if
(
primitive
==
REQ
)
{
switch
(
service
)
{
if
(
primitive
==
REQ
)
{
switch
(
service
)
{
case
FDLIF_SDA
:
case
FDLIF_SDN
:
case
FDLIF_SRD
:
{
case
FDLIF_SRD
:
{
T_FDLIF_SDN_SDA_SRD_REQ
FAR
*
req
=
(
T_FDLIF_SDN_SDA_SRD_REQ
FAR
*
)
data_ptr
;
*
data_len_ptr
=
sizeof
(
T_FDLIF_SDN_SDA_SRD_REQ
)
+
req
->
length
;
}
break
;
}
break
;
case
FDLIF_REPLY_UPDATE
:
case
FDLIF_REPLY_UPDATE_MULTIPLE
:
{
case
FDLIF_REPLY_UPDATE_MULTIPLE
:
{
T_FDLIF_RUP_REQ
FAR
*
req
=
(
T_FDLIF_RUP_REQ
FAR
*
)
data_ptr
;
*
data_len_ptr
=
sizeof
(
T_FDLIF_RUP_REQ
)
+
req
->
length
;
}
break
;
}
break
;
case
FDLIF_SET_BUSPARAMETER
:
*
data_len_ptr
=
sizeof
(
T_FDLIF_SET_BUSPARAMETER_REQ
);
...
...
@@ -177,7 +149,9 @@ possible return values:
result
=
E_IF_INVALID_SERVICE
;
break
;
}
}
else
{
}
else
{
result
=
E_IF_INVALID_PRIMITIVE
;
}
...
...
profibus/lib/rt/src/fm7gdl.c
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************
/******************************************************************************
* *
*
SOFTING AG
*
*
SOFTING Industrial Automation GmbH
*
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone:
++49-89-4 56 56-0
*
*
Fax: ++49-89-4 56 56-3 99
*
* Phone:
(++49)-(0)89-45656-0
*
*
Fax: (++49)-(0)89-45656-399
*
* *
*
Copyright (C) SOFTING AG 1995-2003
*
*
Copyright (C) SOFTING Industrial Automation GmbH 1995-2012
*
* All Rights Reserved *
* *
******************************************************************************
******************************************************************************
*
FILE_NAME FM7GDL.C
...
...
@@ -55,11 +20,11 @@ MODULE FM7GDL
COMPONENT_LIBRARY PAPI Lib
PAPI DLL
AUTHOR SOFTING
AG
AUTHOR SOFTING
VERSION 5.21.0.00.release
DATE
27-
February-1998
DATE February-1998
STATUS finished
...
...
@@ -111,9 +76,10 @@ LOCAL_DATA
#pragma check_stack(off)
#endif
FUNCTION
LOCAL
INT16
fm7gdl_get_ctxt_data_len
(
IN
USIGN8
service
,
/* Service */
FUNCTION
LOCAL
INT16
fm7gdl_get_ctxt_data_len
(
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
/* Service-Primitive */
)
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -131,17 +97,21 @@ possible return values:
FUNCTION_BODY
if
(
service
==
FM7_ABORT
&&
primitive
==
REQ
)
{
if
(
service
==
FM7_ABORT
&&
primitive
==
REQ
)
{
return
(
sizeof
(
T_FM7_ABORT_REQ
));
}
else
{
}
else
{
return
(
0
);
}
}
FUNCTION
LOCAL
INT16
fm7gdl_get_crl_data_len
(
IN
USIGN8
service
,
/* Service */
FUNCTION
LOCAL
INT16
fm7gdl_get_crl_data_len
(
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
,
/* Service-Primitive */
IN
USIGN8
FAR
*
data_ptr
/* pointer to data */
)
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -169,7 +139,8 @@ possible return values:
FUNCTION_BODY
switch
(
service
)
{
switch
(
service
)
{
case
FM7_LOAD_CRL_LOC
:
case
FM7_LOAD_CRL_REM
:
if
(
primitive
==
REQ
)
...
...
@@ -179,9 +150,12 @@ possible return values:
case
FM7_READ_CRL_LOC
:
case
FM7_READ_CRL_REM
:
if
(
primitive
==
REQ
)
{
if
(
primitive
==
REQ
)
{
return
(
sizeof
(
T_READ_CRL_REQ
));
}
else
{
}
else
{
T_READ_CRL_CNF
FAR
*
rsp
=
(
T_READ_CRL_CNF
FAR
*
)
data_ptr
;
if
(
rsp
->
desired_cr
==
0
)
...
...
@@ -199,7 +173,7 @@ FUNCTION LOCAL INT16 fm7gdl_get_s_r_value_data_len(
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
,
/* Service-Primitive */
IN
USIGN8
FAR
*
data_ptr
/* pointer to data */
)
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -224,13 +198,16 @@ possible return values:
FUNCTION_BODY
switch
(
service
)
{
switch
(
service
)
{
case
FM7_SET_VALUE_LOC
:
case
FM7_SET_VALUE_REM
:
if
(
primitive
==
REQ
)
{
if
(
primitive
==
REQ
)
{
T_SET_VALUE_REQ
FAR
*
req
=
(
T_SET_VALUE_REQ
FAR
*
)
data_ptr
;
return
(
sizeof
(
T_SET_VALUE_REQ
)
+
req
->
length
);
}
else
}
else
return
(
0
);
case
FM7_SET_BUSPARAMETER
:
...
...
@@ -241,9 +218,12 @@ possible return values:
case
FM7_READ_VALUE_LOC
:
case
FM7_READ_VALUE_REM
:
if
(
primitive
==
REQ
)
{
if
(
primitive
==
REQ
)
{
return
(
sizeof
(
T_READ_VALUE_REQ
));
}
else
{
}
else
{
T_READ_VALUE_CNF
FAR
*
rsp
=
(
T_READ_VALUE_CNF
FAR
*
)
data_ptr
;
return
(
sizeof
(
T_READ_VALUE_CNF
)
+
rsp
->
length
);
}
...
...
@@ -255,7 +235,7 @@ possible return values:
FUNCTION
LOCAL
INT16
fm7gdl_get_ident_data_len
(
IN
USIGN8
primitive
/* Service-Primitive */
)
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -349,7 +329,7 @@ possible return values:
}
FUNCTION
LOCAL
INT16
fm7gdl_get_error_data_len
(
IN
USIGN8
service
/* Service */
)
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -389,7 +369,8 @@ possible return values:
FUNCTION_BODY
switch
(
service
)
{
switch
(
service
)
{
case
FM7_INITIATE
:
return
(
sizeof
(
T_FM7_INIT_ERR_CNF
));
...
...
@@ -425,12 +406,13 @@ possible return values:
}
}
FUNCTION
PUBLIC
INT16
fm7gdl_get_data_len
(
IN
INT16
result
,
/* Service-Result */
FUNCTION
PUBLIC
INT16
fm7gdl_get_data_len
(
IN
INT16
result
,
/* Service-Result */
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
,
/* Service-Primitive */
IN
USIGN8
FAR
*
data_ptr
,
/* pointer to data */
OUT
INT16
*
data_len_ptr
/* length of data */
)
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -448,7 +430,8 @@ possible return values:
*
data_len_ptr
=
0
;
switch
(
service
)
{
switch
(
service
)
{
case
FM7_READ_CRL_LOC
:
case
FM7_INIT_LOAD_CRL_LOC
:
case
FM7_LOAD_CRL_LOC
:
...
...
@@ -470,8 +453,8 @@ possible return values:
case
FM7_SET_VALUE_REM
:
case
FM7_READ_VALUE_REM
:
if
(
result
==
POS
)
*
data_len_ptr
=
fm7gdl_get_s_r_value_data_len
(
service
,
primitive
,
data_ptr
);
*
data_len_ptr
=
fm7gdl_get_s_r_value_data_len
(
service
,
primitive
,
data_ptr
);
else
*
data_len_ptr
=
fm7gdl_get_error_data_len
(
service
);
break
;
...
...
@@ -518,6 +501,7 @@ possible return values:
default:
return
(
E_IF_INVALID_SERVICE
);
break
;
}
return
(
E_OK
);
...
...
profibus/lib/rt/src/fmbgdl.c
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************
/******************************************************************************
* *
*
SOFTING AG
*
*
SOFTING Industrial Automation GmbH
*
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone:
++49-89-4 56 56-0
*
*
Fax: ++49-89-4 56 56-3 99
*
* Phone:
(++49)-(0)89-45656-0
*
*
Fax: (++49)-(0)89-45656-399
*
* *
*
Copyright (C) SOFTING AG 1995-2003
*
*
Copyright (C) SOFTING Industrial Automation GmbH 1995-2012
*
* All Rights Reserved *
* *
******************************************************************************
******************************************************************************
*
FILE_NAME FMBGDL.C
...
...
@@ -55,11 +20,11 @@ MODULE FMBGDL
COMPONENT_LIBRARY PAPI Lib
PAPI DLL
AUTHOR SOFTING
AG
AUTHOR SOFTING
VERSION 5.
21
.0.00.release
VERSION 5.
45
.0.00.release
DATE
27-February-1998
DATE
October-2009
STATUS finished
...
...
@@ -105,12 +70,13 @@ LOCAL_DATA
#pragma check_stack(off)
#endif
FUNCTION
PUBLIC
INT16
fmbgdl_get_data_len
(
IN
INT16
result
,
/* Service-Result */
FUNCTION
PUBLIC
INT16
fmbgdl_get_data_len
(
IN
INT16
result
,
/* Service-Result */
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
,
/* Service-Primitive */
IN
USIGN8
FAR
*
data_ptr
,
/* pointer to data */
OUT
INT16
*
data_len_ptr
/* length of data */
)
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -129,24 +95,29 @@ possible return values:
FUNCTION_BODY
if
(
primitive
==
REQ
)
{
switch
(
service
)
{
case
FMB_SET_CONFIGURATION
:
{
T_FMB_SET_CONFIGURATION_REQ
FAR
*
req_ptr
=
(
T_FMB_SET_CONFIGURATION_REQ
FAR
*
)
data_ptr
;
if
(
primitive
==
REQ
)
{
switch
(
service
)
{
case
FMB_SET_CONFIGURATION
:
{
T_FMB_SET_CONFIGURATION_REQ
FAR
*
req_ptr
=
(
T_FMB_SET_CONFIGURATION_REQ
FAR
*
)
data_ptr
;
#ifdef WIN32
req_ptr
->
sm7_active
&=
0xFE
;
#else
req_ptr
->
sm7_active
=
PB_FALSE
;
#endif
*
data_len_ptr
=
sizeof
(
T_FMB_SET_CONFIGURATION_REQ
);
}
break
;
}
break
;
case
FMB_SET_BUSPARAMETER
:
*
data_len_ptr
=
sizeof
(
T_FMB_SET_BUSPARAMETER_REQ
);
break
;
case
FMB_SET_VALUE
:
{
case
FMB_SET_VALUE
:
{
T_FMB_SET_VALUE_REQ
FAR
*
req
=
(
T_FMB_SET_VALUE_REQ
FAR
*
)
data_ptr
;
*
data_len_ptr
=
(
sizeof
(
T_FMB_SET_VALUE_REQ
)
+
req
->
length
);
break
;
...
...
@@ -160,6 +131,10 @@ possible return values:
*
data_len_ptr
=
sizeof
(
T_FMB_LSAP_STATUS_REQ
);
break
;
case
FMB_VALIDATE_MASTER
:
*
data_len_ptr
=
sizeof
(
T_FMB_VALIDATE_MASTER_REQ
);
break
;
case
FMB_GET_LIVE_LIST
:
case
FMB_READ_BUSPARAMETER
:
case
FMB_EXIT
:
...
...
@@ -172,7 +147,9 @@ possible return values:
ret_val
=
E_IF_INVALID_SERVICE
;
break
;
}
}
else
{
}
else
{
ret_val
=
E_IF_INVALID_PRIMITIVE
;
}
...
...
profibus/lib/rt/src/fmsgdl.c
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************
/******************************************************************************
* *
*
SOFTING AG
*
*
SOFTING Industrial Automation GmbH
*
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone:
++49-89-4 56 56-0
*
*
Fax: ++49-89-4 56 56-3 99
*
* Phone:
(++49)-(0)89-45656-0
*
*
Fax: (++49)-(0)89-45656-399
*
* *
*
Copyright (C) SOFTING AG 1995-2003
*
*
Copyright (C) SOFTING Industrial Automation GmbH 1995-2012
*
* All Rights Reserved *
* *
******************************************************************************
******************************************************************************
*
FILE_NAME FMSGDL.C
...
...
@@ -55,11 +20,11 @@ MODULE FMSGDL
COMPONENT_LIBRARY PAPI Lib
PAPI DLL
AUTHOR SOFTING
AG
AUTHOR SOFTING
VERSION 5.21.0.00.release
DATE
27-
February-1998
DATE February-1998
STATUS finished
...
...
@@ -105,9 +70,10 @@ LOCAL_DATA
#pragma check_stack(off)
#endif
FUNCTION
LOCAL
INT16
fmsgdl_get_ctxt_data_len
(
IN
USIGN8
service
,
/* Service */
FUNCTION
LOCAL
INT16
fmsgdl_get_ctxt_data_len
(
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
/* Service-Primitive */
)
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -126,7 +92,8 @@ possible return values:
FUNCTION_BODY
switch
(
service
)
{
switch
(
service
)
{
case
FMS_INITIATE
:
if
(
primitive
==
REQ
)
return
(
sizeof
(
T_CTXT_INIT_REQ
));
...
...
@@ -144,9 +111,10 @@ possible return values:
}
}
FUNCTION
LOCAL
INT16
fmsgdl_get_vfd_data_len
(
IN
USIGN8
service
,
/* Service */
FUNCTION
LOCAL
INT16
fmsgdl_get_vfd_data_len
(
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
/* Service-Primitive */
)
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -168,7 +136,8 @@ possible return values:
FUNCTION_BODY
switch
(
service
)
{
switch
(
service
)
{
case
FMS_STATUS
:
if
(
primitive
==
RES
)
return
(
sizeof
(
T_VFD_STATUS_CNF
));
...
...
@@ -204,10 +173,11 @@ possible return values:
}
}
FUNCTION
LOCAL
INT16
fmsgdl_get_od_data_len
(
IN
USIGN8
service
,
/* Service */
FUNCTION
LOCAL
INT16
fmsgdl_get_od_data_len
(
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
,
/* Service-Primitive */
IN
USIGN8
FAR
*
data_ptr
/* pointer to data */
)
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -233,24 +203,32 @@ possible return values:
FUNCTION_BODY
switch
(
service
)
{
switch
(
service
)
{
case
FMS_GET_OD
:
if
(
primitive
==
REQ
)
{
if
(
primitive
==
REQ
)
{
return
(
sizeof
(
T_GET_OD_REQ
));
}
else
{
}
else
{
T_GET_OD_CNF
FAR
*
rsp
=
(
T_GET_OD_CNF
FAR
*
)
data_ptr
;
USIGN8
FAR
*
obj_descr_ptr
=
(
USIGN8
FAR
*
)(
rsp
+
1
);
USIGN16
offset
=
0
;
USIGN16
size
=
0
;
USIGN8
i
;
if
(
rsp
->
no_of_od_descr
!=
0
)
{
for
(
i
=
0
;
i
<
rsp
->
no_of_od_descr
;
i
++
)
{
if
(
rsp
->
no_of_od_descr
!=
0
)
{
for
(
i
=
0
;
i
<
rsp
->
no_of_od_descr
;
i
++
)
{
size
+=
(
obj_descr_ptr
[
offset
]
+
1
);
offset
=
size
;
}
return
(
sizeof
(
T_GET_OD_CNF
)
+
size
);
}
else
{
}
else
{
return
(
0
);
}
}
...
...
@@ -262,19 +240,22 @@ possible return values:
return
(
0
);
case
FMS_PUT_OD
:
if
(
primitive
==
REQ
)
{
if
(
primitive
==
REQ
)
{
T_PUT_OD_REQ
FAR
*
req
=
(
T_PUT_OD_REQ
FAR
*
)
data_ptr
;
USIGN8
FAR
*
obj_descr_ptr
=
(
USIGN8
FAR
*
)(
req
+
1
);
USIGN16
offset
=
0
;
USIGN16
size
=
0
;
USIGN8
i
;
for
(
i
=
0
;
i
<
req
->
no_of_od_descr
;
i
++
)
{
for
(
i
=
0
;
i
<
req
->
no_of_od_descr
;
i
++
)
{
size
+=
(
obj_descr_ptr
[
offset
]
+
1
);
offset
=
size
;
}
return
(
sizeof
(
T_PUT_OD_REQ
)
+
size
);
}
else
}
else
return
(
0
);
case
FMS_INIT_LOAD_OD_LOC
:
...
...
@@ -290,33 +271,37 @@ possible return values:
return
(
0
);
case
FMS_LOAD_OD_LOC
:
if
(
primitive
==
REQ
)
{
if
(
primitive
==
REQ
)
{
T_LOAD_OD_REQ
FAR
*
req
=
(
T_LOAD_OD_REQ
FAR
*
)
data_ptr
;
T_OD_NULL_OBJECT
FAR
*
object
=
(
T_OD_NULL_OBJECT
FAR
*
)
&
req
->
obj_descr
.
id
.
null_obj_descr
;
switch
(
object
->
obj_code
)
{
T_OD_NULL_OBJECT
FAR
*
object
=
(
T_OD_NULL_OBJECT
FAR
*
)
&
req
->
obj_descr
.
id
.
null_obj_descr
;
switch
(
object
->
obj_code
)
{
case
TYPE_STRUCT_OBJECT
:
return
(
sizeof
(
T_LOAD_OD_REQ
)
+
(
req
->
obj_descr
.
id
.
ds_obj_descr
.
no_of_elements
*
sizeof
(
T_OD_DT_LIST
)));
return
(
sizeof
(
T_LOAD_OD_REQ
)
+
(
req
->
obj_descr
.
id
.
ds_obj_descr
.
no_of_elements
*
sizeof
(
T_OD_DT_LIST
)));
case
RECORD_OBJECT
:
return
(
sizeof
(
T_LOAD_OD_REQ
)
+
(
req
->
obj_descr
.
id
.
r_var_obj_descr
.
no_of_address
*
sizeof
(
USIGN32
)));
return
(
sizeof
(
T_LOAD_OD_REQ
)
+
(
req
->
obj_descr
.
id
.
r_var_obj_descr
.
no_of_address
*
sizeof
(
USIGN32
)));
case
VAR_LIST_OBJECT
:
return
(
sizeof
(
T_LOAD_OD_REQ
)
+
(
req
->
obj_descr
.
id
.
vlist_obj_descr
.
no_of_var
*
sizeof
(
USIGN16
)));
return
(
sizeof
(
T_LOAD_OD_REQ
)
+
(
req
->
obj_descr
.
id
.
vlist_obj_descr
.
no_of_var
*
sizeof
(
USIGN16
)));
case
INVOCATION_OBJECT
:
return
(
sizeof
(
T_LOAD_OD_REQ
)
+
(
req
->
obj_descr
.
id
.
pi_obj_descr
.
cnt_dom
*
sizeof
(
USIGN16
)));
return
(
sizeof
(
T_LOAD_OD_REQ
)
+
(
req
->
obj_descr
.
id
.
pi_obj_descr
.
cnt_dom
*
sizeof
(
USIGN16
)));
default:
return
(
sizeof
(
T_LOAD_OD_REQ
));
}
}
else
}
else
return
(
0
);
case
FMS_OD_READ_LOC
:
...
...
@@ -330,10 +315,11 @@ possible return values:
}
}
FUNCTION
LOCAL
INT16
fmsgdl_get_var_data_len
(
IN
USIGN8
service
,
/* Service */
FUNCTION
LOCAL
INT16
fmsgdl_get_var_data_len
(
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
,
/* Service-Primitive */
IN
USIGN8
FAR
*
data_ptr
/* pointer to data */
)
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -360,89 +346,113 @@ possible return values:
FUNCTION_BODY
switch
(
service
)
{
switch
(
service
)
{
case
FMS_READ
:
if
(
primitive
==
REQ
)
{
if
(
primitive
==
REQ
)
{
return
(
sizeof
(
T_VAR_READ_REQ
));
}
else
{
}
else
{
T_VAR_READ_CNF
FAR
*
rsp
=
(
T_VAR_READ_CNF
FAR
*
)
data_ptr
;
return
(
sizeof
(
T_VAR_READ_CNF
)
+
rsp
->
length
);
}
case
FMS_READ_WITH_TYPE
:
if
(
primitive
==
REQ
)
{
if
(
primitive
==
REQ
)
{
return
(
sizeof
(
T_VAR_READ_WITH_TYPE_REQ
));
}
else
{
T_VAR_READ_WITH_TYPE_CNF
FAR
*
rsp
=
(
T_VAR_READ_WITH_TYPE_CNF
FAR
*
)
data_ptr
;
return
(
sizeof
(
T_VAR_READ_WITH_TYPE_CNF
)
+
(
sizeof
(
T_TYPE_DESCR
)
*
rsp
->
no_of_type_descr
)
+
rsp
->
length
);
}
else
{
T_VAR_READ_WITH_TYPE_CNF
FAR
*
rsp
=
(
T_VAR_READ_WITH_TYPE_CNF
FAR
*
)
data_ptr
;
return
(
sizeof
(
T_VAR_READ_WITH_TYPE_CNF
)
+
(
sizeof
(
T_TYPE_DESCR
)
*
rsp
->
no_of_type_descr
)
+
rsp
->
length
);
}
case
FMS_WRITE
:
if
(
primitive
==
REQ
)
{
if
(
primitive
==
REQ
)
{
T_VAR_WRITE_REQ
FAR
*
req
=
(
T_VAR_WRITE_REQ
FAR
*
)
data_ptr
;
return
(
sizeof
(
T_VAR_WRITE_REQ
)
+
req
->
length
);
}
else
}
else
return
(
0
);
case
FMS_WRITE_WITH_TYPE
:
if
(
primitive
==
REQ
)
{
T_VAR_WRITE_WITH_TYPE_REQ
FAR
*
req
=
(
T_VAR_WRITE_WITH_TYPE_REQ
FAR
*
)
data_ptr
;
return
(
sizeof
(
T_VAR_WRITE_WITH_TYPE_REQ
)
+
(
sizeof
(
T_TYPE_DESCR
)
*
req
->
no_of_type_descr
)
+
req
->
length
);
}
else
if
(
primitive
==
REQ
)
{
T_VAR_WRITE_WITH_TYPE_REQ
FAR
*
req
=
(
T_VAR_WRITE_WITH_TYPE_REQ
FAR
*
)
data_ptr
;
return
(
sizeof
(
T_VAR_WRITE_WITH_TYPE_REQ
)
+
(
sizeof
(
T_TYPE_DESCR
)
*
req
->
no_of_type_descr
)
+
req
->
length
);
}
else
return
(
0
);
case
FMS_INFO_RPT
:
if
(
primitive
==
REQ
)
{
if
(
primitive
==
REQ
)
{
T_VAR_INFO_RPT_REQ
FAR
*
req
=
(
T_VAR_INFO_RPT_REQ
FAR
*
)
data_ptr
;
return
(
sizeof
(
T_VAR_INFO_RPT_REQ
)
+
req
->
length
);
}
else
}
else
return
(
0
);
case
FMS_INFO_RPT_WITH_TYPE
:
if
(
primitive
==
REQ
)
{
T_VAR_INFO_RPT_WITH_TYPE_REQ
FAR
*
req
=
(
T_VAR_INFO_RPT_WITH_TYPE_REQ
FAR
*
)
data_ptr
;
return
(
sizeof
(
T_VAR_INFO_RPT_WITH_TYPE_REQ
)
+
(
sizeof
(
T_TYPE_DESCR
)
*
req
->
no_of_type_descr
)
+
req
->
length
);
}
else
if
(
primitive
==
REQ
)
{
T_VAR_INFO_RPT_WITH_TYPE_REQ
FAR
*
req
=
(
T_VAR_INFO_RPT_WITH_TYPE_REQ
FAR
*
)
data_ptr
;
return
(
sizeof
(
T_VAR_INFO_RPT_WITH_TYPE_REQ
)
+
(
sizeof
(
T_TYPE_DESCR
)
*
req
->
no_of_type_descr
)
+
req
->
length
);
}
else
return
(
0
);
case
FMS_PHYS_READ
:
if
(
primitive
==
REQ
)
{
if
(
primitive
==
REQ
)
{
return
(
sizeof
(
T_VAR_PHYS_READ_REQ
));
}
else
{
}
else
{
T_VAR_PHYS_READ_CNF
FAR
*
rsp
=
(
T_VAR_PHYS_READ_CNF
FAR
*
)
data_ptr
;
return
(
sizeof
(
T_VAR_PHYS_READ_CNF
)
+
rsp
->
length
);
}
case
FMS_PHYS_WRITE
:
if
(
primitive
==
REQ
)
{
if
(
primitive
==
REQ
)
{
T_VAR_PHYS_WRITE_REQ
FAR
*
req
=
(
T_VAR_PHYS_WRITE_REQ
FAR
*
)
data_ptr
;
return
(
sizeof
(
T_VAR_PHYS_WRITE_REQ
)
+
req
->
length
);
}
else
}
else
return
(
0
);
case
FMS_DEF_VAR_LIST
:
if
(
primitive
==
REQ
)
{
T_VAR_DEFINE_VAR_LIST_REQ
FAR
*
req
=
(
T_VAR_DEFINE_VAR_LIST_REQ
FAR
*
)
data_ptr
;
if
(
primitive
==
REQ
)
{
T_VAR_DEFINE_VAR_LIST_REQ
FAR
*
req
=
(
T_VAR_DEFINE_VAR_LIST_REQ
FAR
*
)
data_ptr
;
USIGN8
FAR
*
d_acc_spec_list
=
(
USIGN8
FAR
*
)(
req
+
1
);
USIGN16
offset
=
0
;
USIGN16
acc_spec_list_size
=
0
;
USIGN8
i
=
0
;
for
(
i
=
0
;
i
<
req
->
no_of_var
;
i
++
)
{
for
(
i
=
0
;
i
<
req
->
no_of_var
;
i
++
)
{
offset
++
;
/* offset to length of acc_spec */
acc_spec_list_size
+=
sizeof
(
T_DYN_ACC_SPEC
)
+
d_acc_spec_list
[
offset
];
offset
=
acc_spec_list_size
;
}
return
(
sizeof
(
T_VAR_DEFINE_VAR_LIST_REQ
)
+
acc_spec_list_size
);
}
else
{
}
else
{
return
(
sizeof
(
T_VAR_DEFINE_VAR_LIST_CNF
));
}
...
...
@@ -457,10 +467,11 @@ possible return values:
}
}
FUNCTION
LOCAL
INT16
fmsgdl_get_evn_data_len
(
IN
USIGN8
service
,
/* Service */
FUNCTION
LOCAL
INT16
fmsgdl_get_evn_data_len
(
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
,
/* Service-Primitive */
IN
USIGN8
FAR
*
data_ptr
/* pointer to data */
)
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -481,20 +492,25 @@ possible return values:
FUNCTION_BODY
switch
(
service
)
{
switch
(
service
)
{
case
FMS_EVN_NOTIFY
:
if
(
primitive
==
REQ
)
{
if
(
primitive
==
REQ
)
{
T_EVENT_NOTIFY_REQ
FAR
*
req
=
(
T_EVENT_NOTIFY_REQ
FAR
*
)
data_ptr
;
return
(
sizeof
(
T_EVENT_NOTIFY_REQ
)
+
req
->
data_length
);
}
else
}
else
return
(
0
);
case
FMS_EVN_NOTIFY_WITH_TYPE
:
if
(
primitive
==
REQ
)
{
T_EVENT_NOTIFY_WITH_TYPE_REQ
FAR
*
req
=
(
T_EVENT_NOTIFY_WITH_TYPE_REQ
FAR
*
)
data_ptr
;
if
(
primitive
==
REQ
)
{
T_EVENT_NOTIFY_WITH_TYPE_REQ
FAR
*
req
=
(
T_EVENT_NOTIFY_WITH_TYPE_REQ
FAR
*
)
data_ptr
;
return
(
sizeof
(
T_EVENT_NOTIFY_WITH_TYPE_REQ
)
+
req
->
data_length
);
}
else
}
else
return
(
0
);
case
FMS_ALT_EVN_CND_MNT
:
...
...
@@ -514,10 +530,11 @@ possible return values:
}
}
FUNCTION
LOCAL
INT16
fmsgdl_get_dom_data_len
(
IN
USIGN8
service
,
/* Service */
FUNCTION
LOCAL
INT16
fmsgdl_get_dom_data_len
(
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
,
/* Service-Primitive */
IN
USIGN8
FAR
*
data_ptr
/* pointer to data */
)
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -548,7 +565,8 @@ possible return values:
FUNCTION_BODY
switch
(
service
)
{
switch
(
service
)
{
case
FMS_INIT_DOWNL_SEQ
:
case
FMS_GEN_INIT_DOWNL_SEQ
:
case
FMS_INIT_UPL_SEQ
:
...
...
@@ -560,9 +578,12 @@ possible return values:
case
FMS_DOWNL_SEG
:
case
FMS_UPL_SEG
:
if
(
primitive
==
REQ
)
{
if
(
primitive
==
REQ
)
{
return
(
sizeof
(
T_DOM_REQ
));
}
else
{
}
else
{
T_DNL_UPL_SEG_CNF
FAR
*
rsp
=
(
T_DNL_UPL_SEG_CNF
FAR
*
)
data_ptr
;
return
(
sizeof
(
T_DNL_UPL_SEG_CNF
)
+
rsp
->
data_len
);
}
...
...
@@ -574,10 +595,12 @@ possible return values:
return
(
0
);
case
FMS_GEN_DOWNL_SEG
:
if
(
primitive
==
REQ
)
{
if
(
primitive
==
REQ
)
{
T_GEN_DNL_SEG_REQ
FAR
*
req
=
(
T_GEN_DNL_SEG_REQ
FAR
*
)
data_ptr
;
return
(
sizeof
(
T_GEN_DNL_SEG_REQ
)
+
req
->
data_len
);
}
else
}
else
return
(
0
);
case
FMS_GEN_TERM_DOWNL_SEQ
:
...
...
@@ -588,10 +611,12 @@ possible return values:
case
FMS_REQ_DOM_DOWNL
:
case
FMS_REQ_DOM_UPL
:
if
(
primitive
==
REQ
)
{
if
(
primitive
==
REQ
)
{
T_REQUEST_DOM_REQ
FAR
*
req
=
(
T_REQUEST_DOM_REQ
FAR
*
)
data_ptr
;
return
(
sizeof
(
T_REQUEST_DOM_REQ
)
+
req
->
add_info_length
);
}
else
}
else
return
(
0
);
default:
...
...
@@ -599,10 +624,11 @@ possible return values:
}
}
FUNCTION
LOCAL
INT16
fmsgdl_get_pi_data_len
(
IN
USIGN8
service
,
/* Service */
FUNCTION
LOCAL
INT16
fmsgdl_get_pi_data_len
(
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
,
/* Service-Primitive */
IN
USIGN8
FAR
*
data_ptr
/* pointer to data */
)
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -627,9 +653,11 @@ possible return values:
FUNCTION_BODY
switch
(
service
)
{
switch
(
service
)
{
case
FMS_PI_CREATE
:
if
(
primitive
==
REQ
)
{
if
(
primitive
==
REQ
)
{
T_PI_CR8_REQ
FAR
*
req
=
(
T_PI_CR8_REQ
FAR
*
)
data_ptr
;
USIGN8
FAR
*
d_acc_spec_list
=
(
USIGN8
FAR
*
)(
req
+
1
);
USIGN16
offset
=
0
;
...
...
@@ -637,13 +665,16 @@ possible return values:
USIGN8
i
=
0
;
/* - dynamic access specification list --------------------------*/
for
(
i
=
0
;
i
<
req
->
cnt_dom
;
i
++
)
{
for
(
i
=
0
;
i
<
req
->
cnt_dom
;
i
++
)
{
offset
++
;
/* offset to length of acc_spec */
acc_spec_list_size
+=
sizeof
(
T_DYN_ACC_SPEC
)
+
d_acc_spec_list
[
offset
];
offset
=
acc_spec_list_size
;
}
return
(
sizeof
(
T_PI_CR8_REQ
)
+
acc_spec_list_size
);
}
else
{
}
else
{
return
(
sizeof
(
T_PI_CR8_CNF
));
}
...
...
@@ -695,7 +726,7 @@ possible return values:
}
FUNCTION
LOCAL
INT16
fmsgdl_get_error_data_len
(
IN
USIGN8
service
/* Service */
)
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -748,7 +779,8 @@ possible return values:
FUNCTION_BODY
switch
(
service
)
{
switch
(
service
)
{
case
FMS_INITIATE
:
return
(
sizeof
(
T_CTXT_INIT_ERR_CNF
));
...
...
@@ -797,12 +829,13 @@ possible return values:
}
}
FUNCTION
PUBLIC
INT16
fmsgdl_get_data_len
(
IN
INT16
result
,
/* Service-Result */
FUNCTION
PUBLIC
INT16
fmsgdl_get_data_len
(
IN
INT16
result
,
/* Service-Result */
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
,
/* Service-Primitive */
IN
USIGN8
FAR
*
data_ptr
,
/* pointer to data */
OUT
INT16
*
data_len_ptr
/* length of data */
)
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -820,7 +853,8 @@ possible return values:
*
data_len_ptr
=
0
;
switch
(
service
)
{
switch
(
service
)
{
case
FMS_INITIATE
:
case
FMS_ABORT
:
if
(
result
==
POS
)
...
...
profibus/lib/rt/src/keywords.h
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/
/* */
/*
SOFTING AG
*/
/*
SOFTING Industrial Automation GmbH
*/
/* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */
/* */
/*
Copyright (C) SOFTING AG 1995-2003
*/
/*
Copyright (C) SOFTING Industrial Automation GmbH 1995-2012
*/
/* All Rights Reserved */
/* */
/*****************************************************************************/
...
...
@@ -50,8 +15,8 @@
/* */
/* Filename : KEYWORDS.H */
/* Version : 5.21.0.00.release */
/* Date :
27-February-1998
*/
/* Author : SOFTING
AG
*/
/* Date :
February-1998
*/
/* Author : SOFTING
*/
/* */
/* Description : This include file defines some keywords which are used */
/* for structuring and formatting the PROFIBUS source files. These */
...
...
profibus/lib/rt/src/papiaux.c
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************
/******************************************************************************
* *
*
SOFTING AG
*
*
SOFTING Industrial Automation GmbH
*
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone:
++49-89-4 56 56-0
*
*
Fax: ++49-89-4 56 56-3 99
*
* Phone:
(++49)-(0)89-45656-0
*
*
Fax: (++49)-(0)89-45656-399
*
* *
*
Copyright (C) SOFTING AG 1999-2003
*
*
Copyright (C) SOFTING Industrial Automation GmbH 1995-2012
*
* All Rights Reserved *
* *
******************************************************************************
******************************************************************************
*
FILE_NAME PAPIAUX.C
...
...
@@ -55,11 +20,11 @@ MODULE PAPIAUX
COMPONENT_LIBRARY PAPI Lib
PAPI DLL
AUTHOR SOFTING
GmbH
AUTHOR SOFTING
VERSION 5.22.0.00.release
DATE
26-
February-1999
DATE February-1999
STATUS finished
...
...
@@ -109,8 +74,8 @@ LOCAL_DATA
// ***************************************************************************
#if defined(WIN32) || defined(_WIN32)
FUNCTION
PUBLIC
BOOL
ReadBoardRegistryEntries
(
IN
USIGN8
BoardNumber
,
OUT
USIGN32
*
OperationMode
)
FUNCTION
PUBLIC
BOOL
ReadBoardRegistryEntries
(
IN
USIGN8
BoardNumber
,
OUT
USIGN32
*
OperationMode
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -134,19 +99,21 @@ return value:
FUNCTION_BODY
if
(
ERROR_SUCCESS
==
RegOpenKeyEx
(
HKEY_LOCAL_MACHINE
,
REGPATH_PARAMETER_FROM_HLM
,
0
,
KEY_READ
,
&
keyParameters
))
{
if
(
ERROR_SUCCESS
==
RegOpenKeyEx
(
HKEY_LOCAL_MACHINE
,
REGPATH_PARAMETER_FROM_HLM
,
0
,
KEY_READ
,
&
keyParameters
))
{
sprintf
(
szKeyBoard
,
"%s
\\
%d"
,
REGPATH_PARAMETER_FROM_HLM
,
BoardNumber
);
if
(
ERROR_SUCCESS
==
RegOpenKeyEx
(
HKEY_LOCAL_MACHINE
,
szKeyBoard
,
0
,
KEY_READ
,
&
keyBoard
))
{
if
(
ERROR_SUCCESS
==
RegOpenKeyEx
(
HKEY_LOCAL_MACHINE
,
szKeyBoard
,
0
,
KEY_READ
,
&
keyBoard
))
{
SizeofBoardType
=
sizeof
(
szBoardType
);
szBoardType
[
0
]
=
'\0'
;
if
((
RetVal
=
RegQueryValueEx
(
keyBoard
,
"Type"
,
NULL
,
NULL
,
(
LPBYTE
)
szBoardType
,
&
SizeofBoardType
))
==
ERROR_SUCCESS
)
{
(
LPBYTE
)
szBoardType
,
&
SizeofBoardType
))
==
ERROR_SUCCESS
)
{
RetVal
|=
RegQueryValueEx
(
keyBoard
,
"OperationMode"
,
NULL
,
NULL
,
(
LPBYTE
)
OperationMode
,
&
sizeULONG
);
...
...
@@ -184,7 +151,8 @@ FUNCTION PUBLIC int kbhit(VOID)
timeout
.
tv_sec
=
0L
;
timeout
.
tv_usec
=
1000L
;
/* wait 1 ms */
if
(
select
(
1
,
&
rd_fds
,
NULL
,
NULL
,
&
timeout
)
>
0
)
{
if
(
select
(
1
,
&
rd_fds
,
NULL
,
NULL
,
&
timeout
)
>
0
)
{
return
(
1
);
}
...
...
@@ -199,7 +167,7 @@ FUNCTION PUBLIC int kbhit(VOID)
FUNCTION
PUBLIC
USIGN16
swap_16_intel_motorola
(
IN
USIGN16
input16
/* value to swap */
)
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -220,8 +188,7 @@ return value:
FUNCTION_BODY
((
USIGN8
*
)
&
inp16
)
[
0
]
=
((
USIGN8
*
)
&
input16
)[
1
];
[
0
]
=
((
USIGN8
*
)
&
input16
)[
1
];
((
USIGN8
*
)
&
inp16
)[
1
]
=
((
USIGN8
*
)
&
input16
)[
0
];
return
(
inp16
);
...
...
@@ -229,7 +196,7 @@ return value:
FUNCTION
PUBLIC
USIGN32
swap_32_intel_motorola
(
IN
USIGN32
input32
/* value to swap */
)
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -250,8 +217,7 @@ return value:
FUNCTION_BODY
((
USIGN8
*
)
&
inp32
)
[
0
]
=
((
USIGN8
*
)
&
input32
)[
3
];
[
0
]
=
((
USIGN8
*
)
&
input32
)[
3
];
((
USIGN8
*
)
&
inp32
)[
1
]
=
((
USIGN8
*
)
&
input32
)[
2
];
((
USIGN8
*
)
&
inp32
)[
2
]
=
((
USIGN8
*
)
&
input32
)[
1
];
((
USIGN8
*
)
&
inp32
)[
3
]
=
((
USIGN8
*
)
&
input32
)[
0
];
...
...
profibus/lib/rt/src/pb_conf.h
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/
/* */
/*
SOFTING AG
*/
/*
SOFTING Industrial Automation GmbH
*/
/* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */
/* */
/*
Copyright (C) SOFTING AG 1995-2003
*/
/*
Copyright (C) SOFTING Industrial Automation GmbH 1995-2012
*/
/* All Rights Reserved */
/* */
/*****************************************************************************/
...
...
@@ -49,13 +14,12 @@
/* PROFIBUS CONFIGURATION AND IMPLEMENTATION DEFINITIONS */
/* */
/* Filename : PB_CONF.H */
/* Version : 5.
26
.0.00.release */
/* Date :
14-February-2002
*/
/* Author : SOFTING
AG
*/
/* Version : 5.
45
.0.00.release */
/* Date :
December-2009
*/
/* Author : SOFTING
*/
/* */
/* Description : This file contains the PROFIBUS configuration and */
/* implementation definitions using Windows ME/98/95 or */
/* Windows XP / 2000 / NT operating system */
/* implementation definitions using Linux operating system */
/* */
/*****************************************************************************/
...
...
@@ -67,7 +31,7 @@
/*****************************************************************************/
#ifndef PB_VER
#define PB_VER 5
26
#define PB_VER 5
45
#endif
/*****************************************************************************/
...
...
@@ -99,9 +63,9 @@
#define HUGE
#define CALL_CONV
#define CALLBACK
#define INVALID_HANDLE_VALUE
((HANDLE)NULL)
#define INVALID_HANDLE_VALUE
0
#define getch() getchar()
typedef
long
int
HANDLE
;
typedef
int
HANDLE
;
typedef
unsigned
long
DWORD
;
#ifdef PB_API_FUNC_NOT_USED
#undef CALL_CONV
...
...
profibus/lib/rt/src/pb_dp.h
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/
/* */
/*
SOFTING AG
*/
/*
SOFTING Industrial Automation GmbH
*/
/* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */
/* */
/*
Copyright (C) SOFTING AG 1995-2003
*/
/*
Copyright (C) SOFTING Industrial Automation GmbH 1995-2012
*/
/* All Rights Reserved */
/* */
/*****************************************************************************/
...
...
@@ -50,8 +15,8 @@
/* */
/* Filename : PB_DP.H */
/* Version : 5.22.0.00.release */
/* Date :
26-February-1999
*/
/* Author : SOFTING
AG
*/
/* Date :
February-1999
*/
/* Author : SOFTING
*/
/* */
/* Description : This file contains the global defines and types of */
/* component DP */
...
...
@@ -232,8 +197,8 @@
#define DP_PRM_WD_ON 0x08
#define DP_PRM_STATION_STATUS \
(DP_PRM_LOCK_REQ | DP_PRM_UNLOCK_REQ | DP_PRM_SYNC_REQ | DP_PRM_FREEZE_REQ
\
|
DP_PRM_WD_ON)
(DP_PRM_LOCK_REQ | DP_PRM_UNLOCK_REQ | DP_PRM_SYNC_REQ | DP_PRM_FREEZE_REQ
|
\
DP_PRM_WD_ON)
/*--- DP SLAVE GLOBAL CONTROL BITS -----------------------------------------*/
...
...
@@ -244,8 +209,8 @@
#define DP_CONTROL_CLEAR_DATA 0x02
#define DP_CONTROL_COMMAND \
(DP_CONTROL_SYNC | DP_CONTROL_UNSYNC | DP_CONTROL_FREEZE
\
|
DP_CONTROL_UNFREEZE | DP_CONTROL_CLEAR_DATA)
(DP_CONTROL_SYNC | DP_CONTROL_UNSYNC | DP_CONTROL_FREEZE
|
\
DP_CONTROL_UNFREEZE | DP_CONTROL_CLEAR_DATA)
/*--- DP AREA CODES --------------------------------------------------------*/
...
...
@@ -313,8 +278,8 @@
#define DP_DIAG_2_PRM_REQ 0x01
#define DP_DIAG_2_STATUS \
(DP_DIAG_2_DEACTIVATED | DP_DIAG_2_SYNC_MODE | DP_DIAG_2_FREEZE_MODE
\
|
DP_DIAG_2_WD_ON | DP_DIAG_2_PRM_REQ)
(DP_DIAG_2_DEACTIVATED | DP_DIAG_2_SYNC_MODE | DP_DIAG_2_FREEZE_MODE
|
\
DP_DIAG_2_WD_ON | DP_DIAG_2_PRM_REQ)
#define DP_DIAG_3_EXT_DIAG_OVERFLOW 0x80
...
...
@@ -367,7 +332,8 @@
/*--- DP SLAVE PARAMETERIZATION DATA ---------------------------------------*/
typedef
struct
_T_DP_PRM_DATA
{
typedef
struct
_T_DP_PRM_DATA
{
USIGN16
prm_data_len
;
/* 9..DP_MAX_PRM_DATA_LEN */
OCTET
station_status
;
/* DP_PRM_xxx */
OCTET
wd_fact_1
;
/* watch dog time factors */
...
...
@@ -381,7 +347,8 @@ typedef struct _T_DP_PRM_DATA {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_CFG_DATA
{
typedef
struct
_T_DP_CFG_DATA
{
USIGN16
cfg_data_len
;
/* 2..244 */
/* OCTET cfg_data [cfg_data_len - 2]; */
...
...
@@ -389,7 +356,8 @@ typedef struct _T_DP_CFG_DATA {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_AAT_DATA
{
typedef
struct
_T_DP_AAT_DATA
{
USIGN16
aat_data_len
;
/* 2..2^16-31 */
USIGN8
number_inputs
;
/* 0..244 */
USIGN8
number_outputs
;
/* 0..244 */
...
...
@@ -400,7 +368,8 @@ typedef struct _T_DP_AAT_DATA {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_SLAVE_USER_DATA
{
typedef
struct
_T_DP_SLAVE_USER_DATA
{
USIGN16
slave_user_data_len
;
/* 2..2^16-31 */
/* OCTET slave_user_data [slave_user_data_len - 2]; */
...
...
@@ -408,7 +377,8 @@ typedef struct _T_DP_SLAVE_USER_DATA {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_SLAVE_PARA_SET
{
typedef
struct
_T_DP_SLAVE_PARA_SET
{
USIGN16
slave_para_len
;
/* 0..MAX_SLAVE_PARA_LEN */
USIGN8
sl_flag
;
/* DP_SL_ACTIVE, DP_SL_FLAG_NEW_PRM */
USIGN8
slave_type
;
/* DP_SLAVE_TYPE_DP */
...
...
@@ -422,7 +392,8 @@ typedef struct _T_DP_SLAVE_PARA_SET {
/*==========================================================================*/
typedef
struct
_T_DP_BUS_PARA_SET
{
typedef
struct
_T_DP_BUS_PARA_SET
{
USIGN16
bus_para_len
;
/* 66..2^16-1 */
USIGN8
fdl_add
;
/* 0..125 */
USIGN8
baud_rate
;
/* DP_xBAUD_xxx */
...
...
@@ -448,7 +419,8 @@ typedef struct _T_DP_BUS_PARA_SET {
/*==========================================================================*/
typedef
struct
_T_DP_DIAG_DATA
{
typedef
struct
_T_DP_DIAG_DATA
{
OCTET
station_status_1
;
/* DP_DIAG_1_xxx */
OCTET
station_status_2
;
/* DP_DIAG_2_xxx */
OCTET
station_status_3
;
/* DP_DIAG_3_xxx */
...
...
@@ -460,7 +432,8 @@ typedef struct _T_DP_DIAG_DATA {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_MASTER_STATUS
{
typedef
struct
_T_DP_MASTER_STATUS
{
OCTET
usif_state
;
/* DP_OP_MODE_xxx */
USIGN8
ident_number_high
;
/* alignment problem in DIN 19245-3 !!! */
USIGN8
ident_number_low
;
/* USIGN16 ident_number at odd address !!! */
...
...
@@ -474,7 +447,8 @@ typedef struct _T_DP_MASTER_STATUS {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_SLAVE_PARAM_SLAVE_INFO
{
typedef
struct
_T_DP_SLAVE_PARAM_SLAVE_INFO
{
USIGN16
diag_entries
;
/* available DIAG messages */
USIGN16
offset_inputs
;
/* offset of input area within I/O memory */
USIGN16
offset_outputs
;
/* offset of output area within I/O memory */
...
...
@@ -487,7 +461,8 @@ typedef struct _T_DP_SLAVE_PARAM_SLAVE_INFO {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_SLAVE_PARAM_SYS_INFO
{
typedef
struct
_T_DP_SLAVE_PARAM_SYS_INFO
{
USIGN8
loaded_slaves
;
/* number downloaded slaves */
USIGN8
active_slaves
;
/* number active slaves */
INT16
diag_entries
;
/* number available DIAG messages */
...
...
@@ -497,7 +472,8 @@ typedef struct _T_DP_SLAVE_PARAM_SYS_INFO {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_SET_IDENT_NUMBER
{
typedef
struct
_T_DP_SET_IDENT_NUMBER
{
USIGN16
ident_number
;
/* new master ident_number */
OCTET
dp_hardware_version
;
/* vendor specific release information */
OCTET
dp_firmware_version
;
...
...
@@ -510,7 +486,8 @@ typedef struct _T_DP_SET_IDENT_NUMBER {
/*--- DP USIF SERVICE STRUCTURES -------------------------------------------*/
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_INIT_MASTER_REQ
{
typedef
struct
_T_DP_INIT_MASTER_REQ
{
USIGN8
master_default_address
;
/* station address for default BP */
PB_BOOL
master_class2
;
/* use M2 requester functionality ? */
STRINGV
master_class2_name
[
32
];
/* vendor name of M2 */
...
...
@@ -529,14 +506,16 @@ typedef struct _T_DP_INIT_MASTER_REQ {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_INIT_MASTER_CON
{
typedef
struct
_T_DP_INIT_MASTER_CON
{
USIGN16
status
;
/* OK, IV, NO */
}
T_DP_INIT_MASTER_CON
;
/*==========================================================================*/
typedef
struct
_T_DP_EXIT_MASTER_CON
{
typedef
struct
_T_DP_EXIT_MASTER_CON
{
USIGN16
status
;
/* OK, NO */
}
T_DP_EXIT_MASTER_CON
;
...
...
@@ -563,7 +542,8 @@ typedef struct _T_DP_START_SEQ_IND /* MM: req_add --> function_num */
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_START_SEQ_RES_CON
{
typedef
struct
_T_DP_START_SEQ_RES_CON
{
USIGN16
status
;
/* status of start sequence service */
USIGN8
max_len_data_unit
;
/* 1..240 */
USIGN8
dummy
;
/* SDU alignment byte */
...
...
@@ -590,7 +570,8 @@ typedef struct _T_DP_END_SEQ_IND /* MM: req_add --> function_num */
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_END_SEQ_RES_CON
{
typedef
struct
_T_DP_END_SEQ_RES_CON
{
USIGN16
status
;
/* OK, DS, NA, RS, RR, UE, TO, FE, RE, */
/* NE, AD, IP, NI, SE, SC, EA, LE */
...
...
@@ -598,7 +579,8 @@ typedef struct _T_DP_END_SEQ_RES_CON {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_END_SEQ_LOC_IND
{
typedef
struct
_T_DP_END_SEQ_LOC_IND
{
USIGN16
status
;
/* TO */
}
T_DP_END_SEQ_LOC_IND
;
...
...
@@ -629,7 +611,8 @@ typedef struct _T_DP_DOWNLOAD_IND /* MM: req_add --> function_num */
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_DOWNLOAD_RES_CON
{
typedef
struct
_T_DP_DOWNLOAD_RES_CON
{
USIGN16
status
;
/* OK, DS, NA, RS, RR, UE, TO, FE, */
/* RE, NE, AD, EA, SC, NI, LE */
...
...
@@ -661,7 +644,8 @@ typedef struct _T_DP_UPLOAD_IND /* MM: req_add --> function_num */
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_UPLOAD_RES_CON
{
typedef
struct
_T_DP_UPLOAD_RES_CON
{
USIGN16
status
;
/* OK, DS, NA, RS, RR, UE, TO, FE, */
/* RE, NE, AD, EA, SC, NI, LE */
USIGN16
data_len
;
/* 1..DP_MAX_UPLOAD_DATA_LEN */
...
...
@@ -693,7 +677,8 @@ typedef struct _T_DP_ACT_PARAM_IND /* MM: req_add --> function_num */
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_ACT_PARAM_RES_CON
{
typedef
struct
_T_DP_ACT_PARAM_RES_CON
{
USIGN16
status
;
/* OK, DS, NA, RS, RR, UE, TO, FE, RE, */
/* NE, AD, IP, SC, NI, DI, EA, LE */
...
...
@@ -719,7 +704,8 @@ typedef struct _T_DP_GET_MASTER_DIAG_IND /* MM: req_add --> function_num */
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_GET_MASTER_DIAG_RES_CON
{
typedef
struct
_T_DP_GET_MASTER_DIAG_RES_CON
{
USIGN16
status
;
/* OK, DS, NA, RS, RR, UE, TO, */
/* FE, RE, NE, AD, IP, EA, LE */
USIGN16
data_len
;
/* 1..DP_MAX_MASTER_DIAG_DATA_LEN */
...
...
@@ -733,7 +719,8 @@ typedef VOID T_DP_GET_SLAVE_DIAG_REQ;
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_GET_SLAVE_DIAG_CON
{
typedef
struct
_T_DP_GET_SLAVE_DIAG_CON
{
USIGN16
status
;
/* OK, NO */
USIGN8
rem_add
;
/* 0..126 */
USIGN8
dummy
;
/* SDU alignment byte */
...
...
@@ -753,7 +740,8 @@ typedef VOID T_DP_DATA_TRANSFER_REQ; /* no SDU */
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_DATA_TRANSFER_CON
{
typedef
struct
_T_DP_DATA_TRANSFER_CON
{
USIGN16
status
;
/* OK, NO */
INT16
diag_entries
;
/* -1..DP_MAX_SLAVE_DIAG_ENTRIES */
...
...
@@ -761,7 +749,8 @@ typedef struct _T_DP_DATA_TRANSFER_CON {
/*==========================================================================*/
typedef
struct
_T_DP_GET_SLAVE_PARAM_REQ
{
typedef
struct
_T_DP_GET_SLAVE_PARAM_REQ
{
USIGN8
identifier
;
/* DP_SLAVE_PARAM_xxx */
USIGN8
rem_add
;
/* 0..126 */
...
...
@@ -769,7 +758,8 @@ typedef struct _T_DP_GET_SLAVE_PARAM_REQ {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_GET_SLAVE_PARAM_CON
{
typedef
struct
_T_DP_GET_SLAVE_PARAM_CON
{
USIGN16
status
;
/* OK, NO, IV, NE */
USIGN16
data_len
;
/* 0..244 */
/* OCTET slave_param_data [data_len]; data_len */
...
...
@@ -778,7 +768,8 @@ typedef struct _T_DP_GET_SLAVE_PARAM_CON {
/*==========================================================================*/
typedef
struct
_T_DP_SET_BUSPARAMETER_REQ
{
typedef
struct
_T_DP_SET_BUSPARAMETER_REQ
{
USIGN8
bp_flag
;
/* DP_BP_ERROR_ACTION */
USIGN8
dummy
;
/* alignment byte */
USIGN16
min_slave_interval
;
/* 1..2^16-1 [100 micros] */
...
...
@@ -792,14 +783,16 @@ typedef struct _T_DP_SET_BUSPARAMETER_REQ {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_SET_BUSPARAMETER_CON
{
typedef
struct
_T_DP_SET_BUSPARAMETER_CON
{
USIGN16
status
;
/* OK, IV, NO */
}
T_DP_SET_BUSPARAMETER_CON
;
/*==========================================================================*/
typedef
struct
_T_DP_SET_MASTER_PARAM_REQ
{
typedef
struct
_T_DP_SET_MASTER_PARAM_REQ
{
USIGN8
identifier
;
/* DP_SET_xxx */
USIGN8
data_len
;
/* 0..DP_MAX_TELEGRAM_LEN */
/* OCTET data [data_len]; data dependent on identifier */
...
...
@@ -808,7 +801,8 @@ typedef struct _T_DP_SET_MASTER_PARAM_REQ {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_SET_MASTER_PARAM_CON
{
typedef
struct
_T_DP_SET_MASTER_PARAM_CON
{
USIGN16
status
;
/* OK, IV, NO */
}
T_DP_SET_MASTER_PARAM_CON
;
...
...
@@ -817,7 +811,8 @@ typedef struct _T_DP_SET_MASTER_PARAM_CON {
/*--- DP DDLM SERVICE STRUCTURES -------------------------------------------*/
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_SLAVE_DIAG_REQ
{
typedef
struct
_T_DP_SLAVE_DIAG_REQ
{
USIGN8
rem_add
;
/* 0..126 */
USIGN8
dummy
;
/* SDU alignment byte */
...
...
@@ -825,7 +820,8 @@ typedef struct _T_DP_SLAVE_DIAG_REQ {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_SLAVE_DIAG_CON
{
typedef
struct
_T_DP_SLAVE_DIAG_CON
{
USIGN16
status
;
/* OK, DS, NA, RS, UE, NR, RE */
USIGN8
rem_add
;
/* 0..126 */
USIGN8
dummy
;
/* PCI alignment byte */
...
...
@@ -836,7 +832,8 @@ typedef struct _T_DP_SLAVE_DIAG_CON {
/*==========================================================================*/
typedef
struct
_T_DP_DATA_EXCHANGE_REQ
{
typedef
struct
_T_DP_DATA_EXCHANGE_REQ
{
USIGN8
rem_add
;
/* 0..126 */
USIGN8
dummy
;
/* PCI alignment byte */
USIGN16
outp_data_len
;
/* 0..DP_MAX_OUTPUT_DATA_LEN */
...
...
@@ -846,7 +843,8 @@ typedef struct _T_DP_DATA_EXCHANGE_REQ {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_DATA_EXCHANGE_CON
{
typedef
struct
_T_DP_DATA_EXCHANGE_CON
{
USIGN16
status
;
/* OK, DS, NA, RS, RR, UE, RE */
USIGN8
rem_add
;
/* 0..126 */
PB_BOOL
diag_flag
;
/* DP_TRUE: DP Slave diagnostic data available */
...
...
@@ -857,7 +855,8 @@ typedef struct _T_DP_DATA_EXCHANGE_CON {
/*==========================================================================*/
typedef
struct
_T_DP_RD_INP_REQ
{
typedef
struct
_T_DP_RD_INP_REQ
{
USIGN8
rem_add
;
/* 0..126 */
USIGN8
dummy
;
/* SDU alignment byte */
...
...
@@ -865,7 +864,8 @@ typedef struct _T_DP_RD_INP_REQ {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_RD_INP_CON
{
typedef
struct
_T_DP_RD_INP_CON
{
USIGN16
status
;
/* OK, DS, NA, RS, UE, NR, RE */
USIGN8
rem_add
;
/* 0..126 */
USIGN8
dummy
;
/* PCI alignment byte */
...
...
@@ -876,7 +876,8 @@ typedef struct _T_DP_RD_INP_CON {
/*==========================================================================*/
typedef
struct
_T_DP_RD_OUTP_REQ
{
typedef
struct
_T_DP_RD_OUTP_REQ
{
USIGN8
rem_add
;
/* 0..126 */
USIGN8
dummy
;
/* SDU alignment byte */
...
...
@@ -884,7 +885,8 @@ typedef struct _T_DP_RD_OUTP_REQ {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_RD_OUTP_CON
{
typedef
struct
_T_DP_RD_OUTP_CON
{
USIGN16
status
;
/* OK, DS, NA, RS, UE, NR, RE */
USIGN8
rem_add
;
/* 0..126 */
USIGN8
dummy
;
/* PCI alignment byte */
...
...
@@ -895,7 +897,8 @@ typedef struct _T_DP_RD_OUTP_CON {
/*==========================================================================*/
typedef
struct
_T_DP_SET_PRM_REQ
{
typedef
struct
_T_DP_SET_PRM_REQ
{
USIGN8
rem_add
;
/* 0..126 */
USIGN8
dummy
;
/* PCI alignment byte */
T_DP_PRM_DATA
prm_data
;
/* 9..DP_MAX_PRM_DATA_LEN */
...
...
@@ -904,14 +907,16 @@ typedef struct _T_DP_SET_PRM_REQ {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_SET_PRM_CON
{
typedef
struct
_T_DP_SET_PRM_CON
{
USIGN16
status
;
/* OK, DS, NA, RS, RR, UE, RE */
}
T_DP_SET_PRM_CON
;
/*==========================================================================*/
typedef
struct
_T_DP_CHK_CFG_REQ
{
typedef
struct
_T_DP_CHK_CFG_REQ
{
USIGN8
rem_add
;
/* 0..126 */
USIGN8
dummy
;
/* PCI alignment byte */
T_DP_CFG_DATA
cfg_data
;
/* 3..DP_MAX_CFG_DATA_LEN */
...
...
@@ -920,14 +925,16 @@ typedef struct _T_DP_CHK_CFG_REQ {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_CHK_CFG_CON
{
typedef
struct
_T_DP_CHK_CFG_CON
{
USIGN16
status
;
/* OK, DS, NA, RS, RR, UE, RE */
}
T_DP_CHK_CFG_CON
;
/*==========================================================================*/
typedef
struct
_T_DP_GET_CFG_REQ
{
typedef
struct
_T_DP_GET_CFG_REQ
{
USIGN8
rem_add
;
/* 0..126 */
USIGN8
dummy
;
/* SDU alignment byte */
...
...
@@ -935,7 +942,8 @@ typedef struct _T_DP_GET_CFG_REQ {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_GET_CFG_CON
{
typedef
struct
_T_DP_GET_CFG_CON
{
USIGN16
status
;
/* OK, DS, NA, RS, UE, NR, RE */
USIGN8
rem_add
;
/* 0..126 */
USIGN8
dummy
;
/* PCI alignment byte */
...
...
@@ -945,7 +953,8 @@ typedef struct _T_DP_GET_CFG_CON {
/*==========================================================================*/
typedef
struct
_T_DP_GLOBAL_CONTROL_REQ
{
typedef
struct
_T_DP_GLOBAL_CONTROL_REQ
{
USIGN8
rem_add
;
/* 0..126, 127 DP_GLOBAL_STATION_ADDRESS */
USIGN8
dummy
;
/* PCI alignment byte */
USIGN8
control_command
;
/* DP_CONTROL_xxx */
...
...
@@ -955,7 +964,8 @@ typedef struct _T_DP_GLOBAL_CONTROL_REQ {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_GLOBAL_CONTROL_CON
{
typedef
struct
_T_DP_GLOBAL_CONTROL_CON
{
USIGN16
status
;
/* OK, DS, NO, IV */
USIGN8
rem_add
;
/* 0..126, 127 DP_GLOBAL_STATION_ADDRESS */
USIGN8
dummy
;
/* SDU alignment byte */
...
...
@@ -964,7 +974,8 @@ typedef struct _T_DP_GLOBAL_CONTROL_CON {
/*==========================================================================*/
typedef
struct
_T_DP_SET_SLAVE_ADD_REQ
{
typedef
struct
_T_DP_SET_SLAVE_ADD_REQ
{
USIGN8
rem_add
;
/* 0..125, 126 DP_DEFAULT_SLAVE_ADDRESS */
USIGN8
dummy
;
/* PCI alignment byte */
USIGN16
rem_slave_data_len
;
/* 0..DP_MAX_REM_SLAVE_DATA_LEN */
...
...
@@ -978,7 +989,8 @@ typedef struct _T_DP_SET_SLAVE_ADD_REQ {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_SET_SLAVE_ADD_CON
{
typedef
struct
_T_DP_SET_SLAVE_ADD_CON
{
USIGN16
status
;
/* OK, DS, NA, RS, RR, UE, RE */
USIGN8
rem_add
;
/* 0..125, 126 DP_DEFAULT_SLAVE_ADDRESS */
USIGN8
dummy
;
/* SDU alignment byte */
...
...
@@ -996,14 +1008,16 @@ typedef struct _T_DP_ACT_PARA_BRCT_REQ /* MM: function_num --> rem_add */
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_ACT_PARA_BRCT_CON
{
typedef
struct
_T_DP_ACT_PARA_BRCT_CON
{
USIGN16
status
;
/* OK, DS */
}
T_DP_ACT_PARA_BRCT_CON
;
/*==========================================================================*/
typedef
struct
_T_DP_FM2_EVENT_IND
{
typedef
struct
_T_DP_FM2_EVENT_IND
{
USIGN16
reason
;
/* FM2 event message */
}
T_DP_FM2_EVENT_IND
;
...
...
@@ -1012,7 +1026,8 @@ typedef struct _T_DP_FM2_EVENT_IND {
/*--- DPV1 DATA STRUCTURES -------------------------------------------------*/
/*--------------------------------------------------------------------------*/
typedef
struct
_T_ADDR
{
typedef
struct
_T_ADDR
{
USIGN8
api
;
/* default: set to 0 */
USIGN8
scl
;
/* default: set to 0 */
OCTET
network_address
[
6
];
/* use only when [d|s]_type is set to 1 */
...
...
@@ -1023,7 +1038,8 @@ typedef struct _T_ADDR {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_ADD_ADDR
{
typedef
struct
_T_ADD_ADDR
{
USIGN8
s_type
;
/* default: set to 0 */
USIGN8
s_len
;
/* default: set to 2 */
USIGN8
d_type
;
/* default: set to 0 */
...
...
@@ -1035,7 +1051,8 @@ typedef struct _T_ADD_ADDR {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_INITIATE_REQ
{
typedef
struct
_T_DP_INITIATE_REQ
{
USIGN8
rem_add
;
/* 0..126 */
USIGN8
reserved
[
3
];
USIGN16
send_timeout
;
/* 1..2^16-1 [10 ms] */
...
...
@@ -1051,12 +1068,13 @@ typedef struct _T_DP_INITIATE_REQ {
#define DP_INITIATE_S_ADDR(x) \
((T_ADDR FAR*)(((USIGN8 FAR*)&((x)->add_addr_param)) + sizeof(T_ADD_ADDR)))
#define DP_INITIATE_D_ADDR(x) \
((T_ADDR FAR*)(((USIGN8 FAR*)&((x)->add_addr_param)) + sizeof(T_ADD_ADDR)
\
+
(x)->add_addr_param.s_len))
((T_ADDR FAR*)(((USIGN8 FAR*)&((x)->add_addr_param)) + sizeof(T_ADD_ADDR)
+
\
(x)->add_addr_param.s_len))
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_INITIATE_CON
{
typedef
struct
_T_DP_INITIATE_CON
{
USIGN16
status
;
USIGN8
rem_add
;
/* 0..126 */
USIGN8
max_len_data_unit
;
/* 0..DP_MSAC2_DATA_LEN */
...
...
@@ -1069,7 +1087,8 @@ typedef struct _T_DP_INITIATE_CON {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_READ_REQ
{
typedef
struct
_T_DP_READ_REQ
{
USIGN8
rem_add
;
/* 0..126, interpreted only when MSAC_C1 */
USIGN8
slot_number
;
/* 0..254, 255 is reserved */
USIGN8
index
;
/* 0..254, 255 is reserved */
...
...
@@ -1079,7 +1098,8 @@ typedef struct _T_DP_READ_REQ {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_READ_CON
{
typedef
struct
_T_DP_READ_CON
{
USIGN16
status
;
USIGN8
rem_add
;
/* 0..126 */
USIGN8
slot_number
;
/* 0..254, 255 is reserved */
...
...
@@ -1091,7 +1111,8 @@ typedef struct _T_DP_READ_CON {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_WRITE_REQ
{
typedef
struct
_T_DP_WRITE_REQ
{
USIGN8
rem_add
;
/* 0..126, interpreted only when MSAC_C1 */
USIGN8
slot_number
;
/* 0..254, 255 is reserved */
USIGN8
index
;
/* 0..254, 255 is reserved */
...
...
@@ -1102,7 +1123,8 @@ typedef struct _T_DP_WRITE_REQ {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_WRITE_CON
{
typedef
struct
_T_DP_WRITE_CON
{
USIGN16
status
;
USIGN8
rem_add
;
/* 0..126 */
USIGN8
slot_number
;
/* 0..254, 255 is reserved */
...
...
@@ -1112,7 +1134,8 @@ typedef struct _T_DP_WRITE_CON {
}
T_DP_WRITE_CON
;
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_DATA_TRANSPORT_REQ
{
typedef
struct
_T_DP_DATA_TRANSPORT_REQ
{
USIGN8
rem_add
;
/* 0..126 */
USIGN8
slot_number
;
/* 0..254, 255 is reserved */
USIGN8
index
;
/* 0..254, 255 is reserved */
...
...
@@ -1123,7 +1146,8 @@ typedef struct _T_DP_DATA_TRANSPORT_REQ {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_DATA_TRANSPORT_CON
{
typedef
struct
_T_DP_DATA_TRANSPORT_CON
{
USIGN16
status
;
USIGN8
rem_add
;
/* 0..126 */
USIGN8
slot_number
;
/* 0..254, 255 is reserved */
...
...
@@ -1135,7 +1159,8 @@ typedef struct _T_DP_DATA_TRANSPORT_CON {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_ABORT_REQ
{
typedef
struct
_T_DP_ABORT_REQ
{
USIGN8
subnet
;
/* 0, 1, 2, others reserved */
USIGN8
reason
;
/* user reason code: 0..0x3F */
...
...
@@ -1143,7 +1168,8 @@ typedef struct _T_DP_ABORT_REQ {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_ABORT_IND
{
typedef
struct
_T_DP_ABORT_IND
{
PB_BOOL
locally_generated
;
USIGN8
subnet
;
/* 0, 1, 2, others reserved */
USIGN8
reason
;
/* reason codes: see DPV1 specification */
...
...
@@ -1154,7 +1180,8 @@ typedef struct _T_DP_ABORT_IND {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DP_ERROR_CON
{
typedef
struct
_T_DP_ERROR_CON
{
USIGN16
status
;
USIGN8
rem_add
;
USIGN8
error_decode
;
...
...
profibus/lib/rt/src/pb_dps.h
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/
/* */
/*
SOFTING AG
*/
/*
SOFTING Industrial Automation GmbH
*/
/* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */
/* */
/*
Copyright (C) SOFTING AG 1995-2003
*/
/*
Copyright (C) SOFTING Industrial Automation GmbH 1995-2012
*/
/* All Rights Reserved */
/* */
/*****************************************************************************/
/*****************************************************************************/
/* */
/* Filename : PB_DPS.H */
/* Version : 5.22.0.00.release */
/* Date : 26-February-1999 */
/* Author : SOFTING AG */
/* Version : 1.30.0.00.release SPC3 based */
/* : 2.06.0.00.release ASPC2 based */
/* Date : July-2009 */
/* Author : SOFTING */
/* */
/* Description : This file contains the global defines and types of DPS */
/* */
...
...
@@ -111,6 +77,9 @@
#define DPS_MAX_CFG_DATA_LEN DP_MAX_CFG_DATA_LEN
#define DPS_MIN_SSA_DATA_LEN 4
#define DPS_MAX_OUTPUT_DATA_LEN 244
#define DPS_MAX_INPUT_DATA_LEN 244
/****************************************************************************/
/*** DPS SERVICE CODES ******************************************************/
/****************************************************************************/
...
...
@@ -179,12 +148,12 @@
#define DPS_DIAG_BIT_WAIT_UNTIL_FETCHED 0x80
#define DPS_DIAG_BIT_STATUS_MASK \
(DPS_DIAG_BIT_EXT_DIAG | DPS_DIAG_BIT_STAT_DIAG
\
|
DPS_DIAG_BIT_EXT_DIAG_OVERFLOW)
(DPS_DIAG_BIT_EXT_DIAG | DPS_DIAG_BIT_STAT_DIAG
|
\
DPS_DIAG_BIT_EXT_DIAG_OVERFLOW)
#define DPS_DIAG_BIT_MASK \
(DPS_DIAG_BIT_EXT_DIAG | DPS_DIAG_BIT_STAT_DIAG
\
|
DPS_DIAG_BIT_EXT_DIAG_OVERFLOW | DPS_DIAG_BIT_WAIT_UNTIL_FETCHED)
(DPS_DIAG_BIT_EXT_DIAG | DPS_DIAG_BIT_STAT_DIAG
|
\
DPS_DIAG_BIT_EXT_DIAG_OVERFLOW | DPS_DIAG_BIT_WAIT_UNTIL_FETCHED)
/*--- DPS SPC3 SPECIAL USR_PRM_BYTE ----------------------------------------*/
...
...
@@ -193,8 +162,8 @@
#define DPS_SPC3_USR_PRM_WD_BASE_1MS 0x04
#define DPS_SPC3_USR_PRM_MASK \
(DPS_SPC3_USR_PRM_DISABLE_STARTBIT | DPS_SPC3_USR_PRM_DISABLE_STOPBIT
\
|
DPS_SPC3_USR_PRM_WD_BASE_1MS)
(DPS_SPC3_USR_PRM_DISABLE_STARTBIT | DPS_SPC3_USR_PRM_DISABLE_STOPBIT
|
\
DPS_SPC3_USR_PRM_WD_BASE_1MS)
/*--- DPS INPUT / OUTPUT STATUS --------------------------------------------*/
...
...
@@ -216,7 +185,8 @@
/*--- DPS USER INTERFACE STRUCTURES ----------------------------------------*/
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DPS_INPUT_DATA_HEADER
{
typedef
struct
_T_DPS_INPUT_DATA_HEADER
{
USIGN8
input_data_len
;
/* length of DPS_USR input data, 0..244 */
USIGN8
input_state
;
/* status of input image: DPS_INPUT_STATE_xxx */
...
...
@@ -226,7 +196,8 @@ typedef struct _T_DPS_INPUT_DATA_HEADER {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DPS_OUTPUT_DATA_HEADER
{
typedef
struct
_T_DPS_OUTPUT_DATA_HEADER
{
USIGN8
output_data_len
;
/* length of DP master output data, 0..244 */
USIGN8
output_state
;
/* status of output image: DPS_OUTPUT_STATE_xxx */
...
...
@@ -236,7 +207,8 @@ typedef struct _T_DPS_OUTPUT_DATA_HEADER {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DPS_CON_IND
{
typedef
struct
_T_DPS_CON_IND
{
USIGN16
status
;
}
T_DPS_CON_IND
;
...
...
@@ -245,7 +217,8 @@ typedef struct _T_DPS_CON_IND {
/*--- DPS USIF SERVICE STRUCTURES ------------------------------------------*/
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DPS_INIT_SLAVE_REQ
{
typedef
struct
_T_DPS_INIT_SLAVE_REQ
{
USIGN8
slave_add
;
/* 0..125, DPS_DEFAULT_SLAVE_ADD, DPS_NON_VOLATILE_SLAVE_ADD */
USIGN8
min_tsdr
;
/* min. station delay responder, default 0, 11..255 */
...
...
@@ -281,7 +254,8 @@ typedef struct _T_DPS_INIT_SLAVE_REQ {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DPS_INIT_SLAVE_CON
{
typedef
struct
_T_DPS_INIT_SLAVE_CON
{
USIGN16
status
;
/* OK, IV, NO */
INT16
remaining_frame_memory
;
/* left memory for telegram buffers */
...
...
@@ -294,7 +268,8 @@ typedef VOID T_DPS_EXIT_SLAVE_REQ; /* no request parameters */
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DPS_EXIT_SLAVE_CON
{
typedef
struct
_T_DPS_EXIT_SLAVE_CON
{
USIGN16
status
;
/* OK */
}
T_DPS_EXIT_SLAVE_CON
;
...
...
@@ -305,7 +280,8 @@ typedef VOID T_DPS_GET_STATUS_REQ; /* no request parameters */
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DPS_GET_STATUS_CON_IND
{
typedef
struct
_T_DPS_GET_STATUS_CON_IND
{
USIGN16
status
;
/* OK, TO */
USIGN8
slave_state
;
/* operation state of DP slave, DPS_STATE_xxx */
...
...
@@ -336,7 +312,8 @@ typedef struct _T_DPS_GET_STATUS_CON_IND {
/*==========================================================================*/
typedef
struct
_T_DPS_SLAVE_DIAG_REQ
{
typedef
struct
_T_DPS_SLAVE_DIAG_REQ
{
USIGN8
diag_state
;
/* diagnostic state of DP slave, DPS_DIAG_BIT_xxx */
USIGN8
ext_diag_data_len
;
/* 0..DP_MAX_EXT_DIAG_DATA_LEN */
...
...
@@ -346,14 +323,16 @@ typedef struct _T_DPS_SLAVE_DIAG_REQ {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DPS_SLAVE_DIAG_CON
{
typedef
struct
_T_DPS_SLAVE_DIAG_CON
{
USIGN16
status
;
/* OK, IV, NO */
}
T_DPS_SLAVE_DIAG_CON
;
/*==========================================================================*/
typedef
struct
_T_DPS_CHK_CFG_IND
{
typedef
struct
_T_DPS_CHK_CFG_IND
{
USIGN16
status
;
/* OK */
USIGN8
cfg_data_len
;
/* CFG from DP master, see EN 50170 */
...
...
@@ -365,14 +344,16 @@ typedef struct _T_DPS_CHK_CFG_IND {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DPS_CHK_CFG_RES
{
typedef
struct
_T_DPS_CHK_CFG_RES
{
USIGN16
status
;
/* OK, NO */
}
T_DPS_CHK_CFG_RES
;
/*==========================================================================*/
typedef
struct
_T_DPS_SET_PRM_IND
{
typedef
struct
_T_DPS_SET_PRM_IND
{
USIGN16
status
;
/* OK */
USIGN8
user_prm_data_len
;
/* 0..DP_MAX_USER_PRM_DATA_LEN */
...
...
@@ -396,14 +377,16 @@ typedef struct _T_DPS_SET_PRM_IND {
/*--------------------------------------------------------------------------*/
typedef
struct
_T_DPS_SET_PRM_RES
{
typedef
struct
_T_DPS_SET_PRM_RES
{
USIGN16
status
;
/* OK, NO */
}
T_DPS_SET_PRM_RES
;
/*==========================================================================*/
typedef
struct
_T_DPS_SET_SLAVE_ADD_IND
{
typedef
struct
_T_DPS_SET_SLAVE_ADD_IND
{
USIGN16
status
;
/* OK */
USIGN8
rem_slave_data_len
;
/* 0..DP_MAX_REM_SLAVE_DATA_LEN */
...
...
profibus/lib/rt/src/pb_err.h
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/
/* */
/*
SOFTING AG
*/
/*
SOFTING Industrial Automation GmbH
*/
/* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */
/* */
/*
Copyright (C) SOFTING AG 1995-2003
*/
/*
Copyright (C) SOFTING Industrial Automation GmbH 1995-2012
*/
/* All Rights Reserved */
/* */
/*****************************************************************************/
...
...
@@ -49,9 +14,9 @@
/* PROFIBUS ABORT-, REJECT-, EVENT- and ERROR DEFINES and -TYPES */
/* */
/* Filename : PB_ERR.H */
/* Version : 5.
26.1
.00.release */
/* Date :
27-June-2003
*/
/* Author : SOFTING
AG
*/
/* Version : 5.
46.0
.00.release */
/* Date :
October-2011
*/
/* Author : SOFTING
*/
/* */
/* Description : This file contains the ABORT, REJECT, EVENT and ERROR */
/* types and defines and the according reason codes. */
...
...
@@ -791,8 +756,7 @@
#define E_IF_INIT_INVALID_PARAMETER 8
/* invalid initialize parameter */
#define E_IF_LOADER_ERROR 9
/* download firmware error */
#define E_IF_NO_CNTRL_RES 10
/* controller does not respond */
#define E_IF_INVALID_CNTRL_TYPE_VERSION \
11
/* inv. controller type or SW \
#define E_IF_INVALID_CNTRL_TYPE_VERSION 11
/* inv. controller type or SW \
vers.*/
#define E_IF_INVALID_LAYER 12
/* invalid layer */
#define E_IF_INVALID_SERVICE 13
/* invalid service identifier */
...
...
@@ -807,7 +771,7 @@
#define E_IF_SERVICE_NOT_SUPPORTED 24
/* service not supported */
#define E_IF_SERVICE_NOT_EXECUTABLE 25
/* service not executable */
#define E_IF_INVALID_VERSION 26
/* invalid version */
#define E_IF_STATE_CONFLICT 27
/* state conflict */
#define E_IF_NO_CNTRL_PRESENT 28
/* controller not available */
#define E_IF_INVALID_PARAMETER 30
/* wrong parameter in REQ or RES */
#define E_IF_INIT_FAILED 31
/* init. API or Controller failed */
...
...
@@ -819,12 +783,14 @@
/* error codes available only in Win NT ---------------------------------------
*/
#define E_IF_SLAVE_DIAG_DATA 0xF0
/* no data available */
/* new diagnostics data available */
/* new diagnostics data available */
#define E_IF_SLAVE_ERROR 0xF1
/* no data exchange */
#define E_IF_INVALID_DP_STATE 0xF2
/* DP is not in state clear/operate*/
#define E_IF_READING_REGISTRY 0xF3
/* error reading registry */
#define E_IF_SOCKET_ERROR 0xFE
/* TCP socket error */
/* get detail with WSAGetLastError */
#define E_IF_OS_ERROR 0xFF
/* OS system (WIN,DOS) error */
/* get detail with GetLastError */
/* get detail with GetLastError */
/* INTERFACE ERROR DETAIL CODES (only Win95/98) -------------------------------
*/
...
...
@@ -862,21 +828,24 @@
#define MAX_ERROR_DESCR_LENGTH _NAME_LENGTH(ERROR_DESCR_LENGTH)
/* --- standard error data structure --------------------------------------- */
typedef
struct
_T_ERROR
{
typedef
struct
_T_ERROR
{
USIGN16
class_code
;
/* class and code */
INT16
add_detail
;
/* additional detail */
STRINGV
add_description
[
MAX_ERROR_DESCR_LENGTH
];
/* additional description */
}
T_ERROR
;
/* --- PI error data structure --------------------------------------------- */
typedef
struct
_T_PI_ERROR
{
typedef
struct
_T_PI_ERROR
{
T_ERROR
error
;
/* standard error type */
USIGN8
pi_state
;
/* pi state */
USIGN8
dummy
;
/* alignment */
}
T_PI_ERROR
;
/* --- PI-LOC error data structure ----------------------------------------- */
typedef
struct
_T_PI_LOC_ERROR
{
typedef
struct
_T_PI_LOC_ERROR
{
T_ERROR
error
;
/* standard error type */
USIGN8
pi_state
;
/* pi state */
USIGN8
dummy
;
/* alignment */
...
...
@@ -884,7 +853,8 @@ typedef struct _T_PI_LOC_ERROR {
}
T_PI_LOC_ERROR
;
/* --- OD error data structure --------------------------------------------- */
typedef
struct
_T_OD_ERROR
{
typedef
struct
_T_OD_ERROR
{
T_ERROR
error
;
/* standard error type */
USIGN16
index
;
/* error index */
}
T_OD_ERROR
;
...
...
@@ -894,7 +864,8 @@ typedef T_OD_ERROR T_OV_ERROR;
#endif
/* --- source OD error data structure -------------------------------------- */
typedef
struct
_T_SRC_OD_ERROR
{
typedef
struct
_T_SRC_OD_ERROR
{
T_ERROR
error
;
/* standard error type */
USIGN32
vfd_number
;
/* vfd number */
USIGN16
index
;
/* error index */
...
...
@@ -905,13 +876,15 @@ typedef T_SRC_OD_ERROR T_SRC_OV_ERROR;
#endif
/* --- VFD error data structure -------------------------------------------- */
typedef
struct
_T_VFD_ERROR
{
typedef
struct
_T_VFD_ERROR
{
T_ERROR
error
;
/* standard error type */
USIGN32
vfd_number
;
/* vfd number */
}
T_VFD_ERROR
;
/* --- CRL error data structure -------------------------------------------- */
typedef
struct
_T_CRL_ERROR
{
typedef
struct
_T_CRL_ERROR
{
T_ERROR
error
;
/* standard error type */
USIGN16
error_cr
;
/* error cr */
}
T_CRL_ERROR
;
...
...
@@ -923,7 +896,8 @@ typedef T_CRL_ERROR T_KBL_ERROR;
/*****************************************************************************/
/************* FDLIF-ERROR DATA STRUCTURES *****************************/
/*****************************************************************************/
typedef
struct
_T_FDLIF_ERROR
{
typedef
struct
_T_FDLIF_ERROR
{
USIGN8
result
;
/* class and code */
USIGN8
dummy
;
/* alignment byte */
USIGN16
add_detail
;
/* additional detail */
...
...
@@ -933,7 +907,8 @@ typedef struct _T_FDLIF_ERROR {
/************* EXCEPTION STRUCTURES *****************************/
/*****************************************************************************/
typedef
struct
_T_EXCEPTION
{
typedef
struct
_T_EXCEPTION
{
USIGN8
task_id
;
/* task identifier in which execption occurs */
USIGN8
par1
;
/* parameter 1 */
USIGN16
par2
;
/* parameter 2 */
...
...
profibus/lib/rt/src/pb_fdl.h
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/
/* */
/*
SOFTING AG
*/
/*
SOFTING Industrial Automation GmbH
*/
/* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */
/* */
/*
Copyright (C) SOFTING AG 1995-2003
*/
/*
Copyright (C) SOFTING Industrial Automation GmbH 1995-2012
*/
/* All Rights Reserved */
/* */
/*****************************************************************************/
...
...
@@ -50,8 +15,8 @@
/* */
/* Filename : PB_FDL.H */
/* Version : 5.21.0.00.release */
/* Date :
27-February-1998
*/
/* Author : SOFTING
AG
*/
/* Date :
February-1998
*/
/* Author : SOFTING
*/
/* */
/* Description : This file contains the types and defines of the FDL-User- */
/* Interface */
...
...
@@ -173,7 +138,8 @@
/* ************** Busparameter block ********************* */
/* ************************************************************************** */
typedef
struct
_T_FDLIF_SET_BUSPARAMETER_REQ
{
typedef
struct
_T_FDLIF_SET_BUSPARAMETER_REQ
{
USIGN8
loc_add
;
/* local station */
USIGN8
loc_segm
;
/* local segment */
USIGN8
baud_rate
;
/* baud rate */
...
...
@@ -192,7 +158,8 @@ typedef struct _T_FDLIF_SET_BUSPARAMETER_REQ {
USIGN8
ident
[
202
];
/* for internal use */
}
T_FDLIF_SET_BUSPARAMETER_REQ
;
typedef
struct
_T_FDLIF_READ_BUSPARAMETER_CNF
{
typedef
struct
_T_FDLIF_READ_BUSPARAMETER_CNF
{
USIGN8
loc_add
;
/* local station */
USIGN8
loc_segm
;
/* local segment */
USIGN8
baud_rate
;
/* baud rate */
...
...
@@ -215,7 +182,8 @@ typedef struct _T_FDLIF_READ_BUSPARAMETER_CNF {
/* ******************* SAP block ************************* */
/* ************************************************************************* */
typedef
struct
_T_FDLIF_SAP_ACTIVATE_REQ
{
typedef
struct
_T_FDLIF_SAP_ACTIVATE_REQ
{
USIGN8
sap_nr
;
/* SAP to be activated */
USIGN8
max_l_sdu_length_req
;
/* maximum length of request telegram */
USIGN8
max_l_sdu_length_con_ind
;
/* maximum length of con/ind telegram */
...
...
@@ -230,7 +198,8 @@ typedef struct _T_FDLIF_SAP_ACTIVATE_REQ {
USIGN8
dummy
;
/* alignment byte */
}
T_FDLIF_SAP_ACTIVATE_REQ
;
typedef
struct
_T_FDLIF_RSAP_ACTIVATE_REQ
{
typedef
struct
_T_FDLIF_RSAP_ACTIVATE_REQ
{
USIGN8
sap_nr
;
/* SAP to be activated */
USIGN8
max_l_sdu_length_req
;
/* maximum length of req telegram */
USIGN8
max_l_sdu_length_ind
;
/* maximum length of ind telegram */
...
...
@@ -241,14 +210,16 @@ typedef struct _T_FDLIF_RSAP_ACTIVATE_REQ {
USIGN8
dummy
;
/* alignmnet byte */
}
T_FDLIF_RSAP_ACTIVATE_REQ
;
typedef
struct
_T_FDLIF_SAP_CHANGE_REQ
{
typedef
struct
_T_FDLIF_SAP_CHANGE_REQ
{
USIGN8
sap_nr
;
/* SAP to be activated */
USIGN8
access_sap
;
/* permitted request SAPs */
USIGN8
access_station
;
/* permitted requestor */
USIGN8
dummy
;
/* alignment byte */
}
T_FDLIF_SAP_CHANGE_REQ
;
typedef
struct
_T_FDLIF_SAP_DEACTIVATE_REQ
{
typedef
struct
_T_FDLIF_SAP_DEACTIVATE_REQ
{
USIGN8
sap_nr
;
/* SAP to be activated */
USIGN8
dummy
;
/* alignment byte */
}
T_FDLIF_SAP_DEACTIVATE_REQ
;
...
...
@@ -257,7 +228,8 @@ typedef struct _T_FDLIF_SAP_DEACTIVATE_REQ {
/* ************* Data transfer ********************* */
/* ************************************************************************* */
typedef
struct
_T_FDLIF_SDN_SDA_SRD_REQ
{
typedef
struct
_T_FDLIF_SDN_SDA_SRD_REQ
{
USIGN8
ssap
;
/* source SAP */
USIGN8
dsap
;
/* destination SAP */
USIGN8
rem_add
;
/* address of remote station */
...
...
@@ -267,13 +239,15 @@ typedef struct _T_FDLIF_SDN_SDA_SRD_REQ {
/* USIGN8 req_data [length] request data */
}
T_FDLIF_SDN_SDA_SRD_REQ
;
typedef
struct
_T_FDLIF_SRD_CNF
{
typedef
struct
_T_FDLIF_SRD_CNF
{
USIGN8
status
;
/* status */
USIGN8
length
;
/* length of request data */
/* USIGN8 cnf_data [length]; request data */
}
T_FDLIF_SRD_CNF
;
typedef
struct
_T_FDLIF_RUP_REQ
{
typedef
struct
_T_FDLIF_RUP_REQ
{
USIGN8
sap_nr
;
/* number of local SAP */
USIGN8
priority
;
/* priority of request */
USIGN8
dummy
;
/* alignment byte */
...
...
@@ -286,7 +260,8 @@ typedef struct _T_FDLIF_RUP_REQ {
/* ************************************************************************* */
/* the possible events are defined in the header file PB_ERR.H */
typedef
struct
_T_FDLIF_EVENT_IND
{
typedef
struct
_T_FDLIF_EVENT_IND
{
USIGN8
event
;
/* event */
USIGN8
dummy
;
/* alignment byte */
}
T_FDLIF_EVENT_IND
;
...
...
profibus/lib/rt/src/pb_fm7.h
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/
/* */
/*
SOFTING AG
*/
/*
SOFTING Industrial Automation GmbH
*/
/* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */
/* */
/*
Copyright (C) SOFTING AG 1995-2003
*/
/*
Copyright (C) SOFTING Industrial Automation GmbH 1995-2012
*/
/* All Rights Reserved */
/* */
/*****************************************************************************/
...
...
@@ -50,8 +15,8 @@
/* */
/* Filename : PB_FM7.H */
/* Version : 5.21.0.00.release */
/* Date :
27-February-1998
*/
/* Author : SOFTING
AG
*/
/* Date :
February-1998
*/
/* Author : SOFTING
*/
/* */
/* Description : This file contains the types and defines of the FM7-User- */
/* Interface */
...
...
@@ -163,7 +128,8 @@
/* Initiate Service */
/****************************************************************************/
typedef
struct
_T_FM7_INIT_REQ
{
typedef
struct
_T_FM7_INIT_REQ
{
USIGN8
snd_len_low
;
/* max FM7 PDU size to send with low priority */
USIGN8
rcv_len_low
;
/* max FM7 PDU size to receive with low priority */
USIGN8
supported_services
[
FEAT_SUPP_LEN
];
/* supported FM7 services */
...
...
@@ -173,7 +139,8 @@ typedef struct _T_FM7_INIT_REQ {
typedef
T_FM7_INIT_REQ
T_FMA_INIT_REQ
;
#endif
typedef
struct
_T_FM7_INIT_ERR_CNF
{
typedef
struct
_T_FM7_INIT_ERR_CNF
{
USIGN16
class_code
;
/* error code and class */
USIGN8
snd_len_low
;
/* max FM7 PDU size to send with low priority */
USIGN8
rcv_len_low
;
/* max FM7 PDU size to receive with low priority */
...
...
@@ -188,7 +155,8 @@ typedef T_FM7_INIT_ERR_CNF T_FMA_INIT_ERR_CNF;
/* Abort Service */
/****************************************************************************/
typedef
struct
_T_FM7_ABORT_REQ
{
typedef
struct
_T_FM7_ABORT_REQ
{
PB_BOOL
local
;
/* local or remote detected */
USIGN8
abort_id
;
/* identifier (USR,LLI_USR,LLI,FDL) */
USIGN8
reason
;
/* abort reason code */
...
...
@@ -267,7 +235,8 @@ typedef T_FM7_ABORT_REQ T_FMA_ABORT_REQ;
#define O_CONN 0x02
/*--- CRL-Header -----------------------------------------------------------*/
typedef
struct
_T_CRL_HDR
{
typedef
struct
_T_CRL_HDR
{
INT16
nr_of_entries
;
/* number of CRL enries */
USIGN8
poll_sap
;
/* poll list SAP */
USIGN8
symbol_length
;
/* max symbol lenght in CRL */
...
...
@@ -282,7 +251,8 @@ typedef T_CRL_HDR T_KBL_HDR;
/*--- CRL-Static-Entry
* -----------------------------------------------------------*/
typedef
struct
_T_CRL_STATIC
{
typedef
struct
_T_CRL_STATIC
{
USIGN8
loc_lsap
;
/* local LSAP */
USIGN8
rem_add
;
/* remote address */
USIGN8
rem_segm
;
/* remote segment */
...
...
@@ -311,7 +281,8 @@ typedef T_CRL_STATIC T_KBL_STATIC;
#endif
/*--- CRL-Dynamic-Entry ----------------------------------------------------*/
typedef
struct
_T_CRL_DYNAMIC
{
typedef
struct
_T_CRL_DYNAMIC
{
USIGN8
rem_add
;
/* current remote address */
USIGN8
rem_segm
;
/* current remote segment */
USIGN8
rem_lsap
;
/* current remote LSAP */
...
...
@@ -333,7 +304,8 @@ typedef T_CRL_DYNAMIC T_KBL_DYNAMIC;
/****************************************************************************/
/*--- Load-CRL-Service -----------------------------------------------------*/
typedef
struct
_T_LOAD_CRL_REQ
{
typedef
struct
_T_LOAD_CRL_REQ
{
USIGN16
desired_cr
;
/* desired communication reference */
union
{
T_CRL_HDR
crl_hdr
;
/* CRL-Header-Entry */
...
...
@@ -342,7 +314,8 @@ typedef struct _T_LOAD_CRL_REQ {
}
T_LOAD_CRL_REQ
;
#if (PB_VER < 500)
typedef
struct
_T_LOAD_KBL_REQ
{
typedef
struct
_T_LOAD_KBL_REQ
{
USIGN16
desired_cr
;
/* desired communication reference */
union
{
T_KBL_HDR
kbl_hdr
;
/* CRL-Header-Entry */
...
...
@@ -446,7 +419,8 @@ typedef struct _T_LOAD_KBL_REQ {
/* --- DTU Receiver ------------------------------------------------------- */
#define CONLS_SERVER 0
typedef
struct
_T_READ_CRL_REQ
{
typedef
struct
_T_READ_CRL_REQ
{
USIGN16
desired_cr
;
/* desired communication reference */
}
T_READ_CRL_REQ
;
...
...
@@ -455,7 +429,8 @@ typedef T_READ_CRL_REQ T_READ_KBL_REQ;
#endif
/*--- CRL-Entry Data-Type --------------------------------------------------*/
typedef
struct
_T_CRL_ENTRY
{
typedef
struct
_T_CRL_ENTRY
{
T_CRL_STATIC
crl_static
;
/* CRL-Static-Entry */
T_CRL_DYNAMIC
crl_dynamic
;
/* CRL-Dynamic-Entry */
USIGN8
dummy
;
/* alignment */
...
...
@@ -464,7 +439,8 @@ typedef struct _T_CRL_ENTRY {
}
T_CRL_ENTRY
;
#if (PB_VER < 500)
typedef
struct
_T_KBL_ENTRY
{
typedef
struct
_T_KBL_ENTRY
{
T_KBL_STATIC
kbl_static
;
/* CRL-Static-Entry */
T_KBL_DYNAMIC
kbl_dynamic
;
/* CRL-Dynamic-Entry */
USIGN8
dummy
;
/* alignment */
...
...
@@ -473,7 +449,8 @@ typedef struct _T_KBL_ENTRY {
}
T_KBL_ENTRY
;
#endif
typedef
struct
_T_READ_CRL_CNF
{
typedef
struct
_T_READ_CRL_CNF
{
USIGN16
desired_cr
;
/* desired communication reference */
union
{
T_CRL_HDR
crl_hdr
;
/* CRL-header */
...
...
@@ -482,7 +459,8 @@ typedef struct _T_READ_CRL_CNF {
}
T_READ_CRL_CNF
;
#if (PB_VER < 500)
typedef
struct
_T_READ_KBL_CNF
{
typedef
struct
_T_READ_KBL_CNF
{
USIGN16
desired_cr
;
/* desired communication reference */
union
{
T_KBL_HDR
kbl_hdr
;
/* CRL-header */
...
...
@@ -548,7 +526,8 @@ typedef struct _T_READ_KBL_CNF {
#define C_NOT_IN_RING_DESIRED NOT_IN_RING_DESIRED
#endif
typedef
struct
_T_SET_BUSPARAMETER_REQ
{
typedef
struct
_T_SET_BUSPARAMETER_REQ
{
USIGN8
loc_add
;
/* local station */
USIGN8
loc_segm
;
/* local segment */
USIGN8
baud_rate
;
/* baud rate */
...
...
@@ -571,7 +550,8 @@ typedef struct _T_SET_BUSPARAMETER_REQ {
/* Read-Busparameter Service (only local) */
/****************************************************************************/
typedef
struct
_T_READ_BUSPARAMETER_CNF
{
typedef
struct
_T_READ_BUSPARAMETER_CNF
{
USIGN8
loc_add
;
/* local station */
USIGN8
loc_segm
;
/* local segment */
USIGN8
baud_rate
;
/* baud rate */
...
...
@@ -625,7 +605,8 @@ typedef struct _T_READ_BUSPARAMETER_CNF {
/****************************************************************************/
#if (PB_VER < 500)
typedef
struct
_T_STATISTICS_BLOCK
{
typedef
struct
_T_STATISTICS_BLOCK
{
USIGN32
frame_send_count
;
/* frame sent counter */
USIGN32
sd_count
;
/* valid start delimiter counter */
USIGN16
retry_count
;
/* retry frame sent counter */
...
...
@@ -633,7 +614,8 @@ typedef struct _T_STATISTICS_BLOCK {
}
T_STATISTICS_BLOCK
;
#endif
typedef
struct
_T_SET_VALUE_REQ
{
typedef
struct
_T_SET_VALUE_REQ
{
USIGN8
id
;
/* value identifier */
USIGN8
length
;
/* # of values in byte */
/* USIGN8 value[length]; list of values */
...
...
@@ -643,7 +625,8 @@ typedef struct _T_SET_VALUE_REQ {
/* Read-Value Service (Local and Remote) */
/****************************************************************************/
#if (PB_VER < 500)
typedef
struct
_T_READ_STATISTIC_CTR_CNF
{
typedef
struct
_T_READ_STATISTIC_CTR_CNF
{
USIGN32
frame_send_count
;
/* frame sent counter */
USIGN32
sd_count
;
/* valid start delimiter counter */
USIGN16
retry_count
;
/* retry frame sent counter */
...
...
@@ -651,12 +634,14 @@ typedef struct _T_READ_STATISTIC_CTR_CNF {
}
T_READ_STATISTIC_CTR_CNF
;
#endif
typedef
struct
_T_READ_VALUE_REQ
{
typedef
struct
_T_READ_VALUE_REQ
{
USIGN8
id
;
/* value identifier */
USIGN8
dummy
;
/* alignment */
}
T_READ_VALUE_REQ
;
typedef
struct
_T_READ_VALUE_CNF
{
typedef
struct
_T_READ_VALUE_CNF
{
USIGN8
id
;
/* value identifier */
USIGN8
length
;
/* # of values in byte */
/* USIGN8 value[length]; list of values */
...
...
@@ -678,13 +663,15 @@ typedef struct _T_READ_VALUE_CNF {
#define ID_PHY 5
#endif
typedef
struct
_T_IDENT_REQ
{
typedef
struct
_T_IDENT_REQ
{
USIGN8
instance_id
;
/* instance identifier */
USIGN8
dummy
;
/* alignment byte */
}
T_IDENT_REQ
;
#if (PB_VER >= 500)
typedef
struct
_T_CHARACTERISTICS
{
typedef
struct
_T_CHARACTERISTICS
{
USIGN8
profile_number
[
2
];
/* profile number */
USIGN8
functions_supp
[
3
];
/* functions supported */
USIGN8
dummy1
;
/* alignment byte */
...
...
@@ -716,7 +703,8 @@ typedef struct _T_CHARACTERISTICS {
USIGN8
max_crl_symbol_length
;
/* max length of symbol in CRL */
}
T_CHARACTERISTICS
;
#else
typedef
struct
_T_CHARACTERISTICS
{
typedef
struct
_T_CHARACTERISTICS
{
USIGN8
profile_number
[
2
];
/* profile number */
USIGN8
functions_supp
[
3
];
/* functions supported */
USIGN8
dummy1
;
/* alignment byte */
...
...
@@ -749,7 +737,8 @@ typedef struct _T_CHARACTERISTICS {
}
T_CHARACTERISTICS
;
#endif
typedef
struct
_T_IDENT_CNF
{
typedef
struct
_T_IDENT_CNF
{
USIGN8
instance_id
;
/* instance ident */
USIGN8
dummy
;
/* alignment */
STRINGV
vendor_name
[
MAX_IDENT_STRING_LENGTH
];
/* vendor name */
...
...
@@ -763,12 +752,14 @@ typedef struct _T_IDENT_CNF {
/* LSAP-Status Service (Local and Remote) */
/****************************************************************************/
typedef
struct
_T_LSAP_STATUS_REQ
{
typedef
struct
_T_LSAP_STATUS_REQ
{
USIGN8
lsap
;
/* desired LSAP */
USIGN8
dummy
;
/* alignment byte */
}
T_LSAP_STATUS_REQ
;
typedef
struct
_T_LSAP_STATUS_CNF
{
typedef
struct
_T_LSAP_STATUS_CNF
{
USIGN8
access
;
/* station address or all */
USIGN8
addr_extension
;
/* segment number */
USIGN8
sda
;
/* SDA */
...
...
@@ -781,12 +772,14 @@ typedef struct _T_LSAP_STATUS_CNF {
/* Get-Live-List Service (Local and Remote) */
/****************************************************************************/
typedef
struct
_T_LIVE_LIST
{
typedef
struct
_T_LIVE_LIST
{
USIGN8
station
;
/* station number */
USIGN8
status
;
/* current station of station */
}
T_LIVE_LIST
;
typedef
struct
_T_GET_LIVE_LIST_CNF
{
typedef
struct
_T_GET_LIVE_LIST_CNF
{
USIGN8
dummy
;
/* alignment */
USIGN8
no_of_elements
;
/* # of live list elements */
/* T_LIVE_LIST live_list[no_of_elements]; list of live list elements */
...
...
@@ -802,7 +795,8 @@ typedef struct _T_GET_LIVE_LIST_CNF {
/* NOTE: instance identifier see IDENT service ---------------------------- */
/* reason-codes and additional details are defined in PB_ERR.H --- */
typedef
struct
_T_FM7_EVENT_IND
{
typedef
struct
_T_FM7_EVENT_IND
{
USIGN16
comm_ref
;
/* communication reference */
USIGN8
instance_id
;
/* LLI, FDL, PHY */
USIGN8
reason
;
/* reason code */
...
...
@@ -823,7 +817,8 @@ typedef T_FM7_EVENT_IND T_FMA7_EVENT_IND;
/* Set-Configuration Service (only local) */
/*****************************************************************************/
typedef
struct
T_SET_CONFIGURATION_REQ
{
typedef
struct
T_SET_CONFIGURATION_REQ
{
USIGN16
max_nr_of_fal_msg_buffers
;
/* max # of Layer7-Message-Buffers
(all CR) */
USIGN16
max_nr_of_fdl_msg_buffers
;
/* max # of Layer2-Message-Buffers
...
...
profibus/lib/rt/src/pb_fmb.h
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/
/* */
/*
SOFTING AG
*/
/*
SOFTING Industrial Automation GmbH
*/
/* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */
/* */
/*
Copyright (C) SOFTING AG 1995-2003
*/
/*
Copyright (C) SOFTING Industrial Automation GmbH 1995-2012
*/
/* All Rights Reserved */
/* */
/*****************************************************************************/
...
...
@@ -50,8 +15,8 @@
/* */
/* Filename : PB_FMB.H */
/* Version : 5.21.0.00.release */
/* Date :
27-February-1998
*/
/* Author : SOFTING
AG
*/
/* Date :
February-1998
*/
/* Author : SOFTING
*/
/* */
/* */
/* Description : This file contains the types and defines of the Fieldbus- */
...
...
@@ -97,7 +62,8 @@
/*****************************************************************************/
/* VFD-Configuration ------------------------------------------------------- */
typedef
struct
_T_FMB_CONFIG_VFD
{
typedef
struct
_T_FMB_CONFIG_VFD
{
USIGN16
max_no_vfds
;
/* max. number of VFD's */
USIGN16
max_no_obj_descr
;
/* max. number of OD object descr.*/
USIGN8
max_obj_name_length
;
/* max. size of OD object name */
...
...
@@ -105,7 +71,8 @@ typedef struct _T_FMB_CONFIG_VFD {
}
T_FMB_CONFIG_VFD
;
/* --- CRL-Configuration --------------------------------------------------- */
typedef
struct
_T_FMB_CONFIG_CRL
{
typedef
struct
_T_FMB_CONFIG_CRL
{
USIGN16
max_no_fal_sdbs
;
/* max. number of FAL-SDBs */
USIGN16
max_no_fdl_sdbs
;
/* max. number of FDL-SDBs */
USIGN16
max_no_data_buffer
;
/* max. number of PDU buffers */
...
...
@@ -131,7 +98,8 @@ component 'max_no_parallel_ind' is introduced for future use - for
end of notes on T_FMB_CONFIG_CRL ------------------------------------------ */
/* DP-Configuration -------------------------------------------------------- */
typedef
struct
_T_FMB_CONFIG_DP
{
typedef
struct
_T_FMB_CONFIG_DP
{
USIGN8
max_number_slaves
;
/* maximum number DP Slaves supported */
USIGN8
max_slave_output_len
;
/* max. length of slave output data */
USIGN8
max_slave_input_len
;
/* max. length of slave input data */
...
...
@@ -142,7 +110,8 @@ typedef struct _T_FMB_CONFIG_DP {
}
T_FMB_CONFIG_DP
;
/* FDLIF-Configuration ----------------------------------------------------- */
typedef
struct
_T_FMB_CONFIG_FDLIF
{
typedef
struct
_T_FMB_CONFIG_FDLIF
{
USIGN8
send_req_credits
;
/* max. number of send credits for SDA and SDN
services */
USIGN8
srd_req_credits
;
/* max. number of send credits for SRD services */
...
...
@@ -151,12 +120,14 @@ typedef struct _T_FMB_CONFIG_FDLIF {
}
T_FMB_CONFIG_FDLIF
;
/* SM7-Configuration ------------------------------------------------------- */
typedef
struct
_T_FMB_CONFIG_SM7
{
typedef
struct
_T_FMB_CONFIG_SM7
{
USIGN16
reserved
;
}
T_FMB_CONFIG_SM7
;
/* Fieldbus-Basic-Management-Configuration --------------------------------- */
typedef
struct
_T_FMB_SET_CONFIGURATION_REQ
{
typedef
struct
_T_FMB_SET_CONFIGURATION_REQ
{
PB_BOOL
fms_active
;
/* FMS and FM7 services are usable */
PB_BOOL
dp_active
;
/* DP services are usable */
PB_BOOL
fdlif_active
;
/* FDLIF services are usable */
...
...
@@ -198,7 +169,8 @@ typedef struct _T_FMB_SET_CONFIGURATION_REQ {
#define IN_RING_DESIRED PB_TRUE
#define NOT_IN_RING_DESIRED PB_FALSE
typedef
struct
_T_FMB_SET_BUSPARAMETER_REQ
{
typedef
struct
_T_FMB_SET_BUSPARAMETER_REQ
{
USIGN8
loc_add
;
/* local station */
USIGN8
loc_segm
;
/* local segment */
USIGN8
baud_rate
;
/* baud rate */
...
...
@@ -219,7 +191,8 @@ typedef struct _T_FMB_SET_BUSPARAMETER_REQ {
/* FMB-Read-FDL-Busparameter */
/*****************************************************************************/
typedef
struct
_T_FMB_READ_BUSPARAMETER_CNF
{
typedef
struct
_T_FMB_READ_BUSPARAMETER_CNF
{
USIGN8
loc_add
;
/* local station */
USIGN8
loc_segm
;
/* local segment */
USIGN8
baud_rate
;
/* baud rate */
...
...
@@ -271,7 +244,8 @@ typedef struct _T_FMB_READ_BUSPARAMETER_CNF {
#endif
typedef
struct
_T_FMB_SET_VALUE_REQ
{
typedef
struct
_T_FMB_SET_VALUE_REQ
{
USIGN8
id
;
/* value identifier */
USIGN8
length
;
/* # of values in byte */
/* USIGN8 value[length]; list of values */
...
...
@@ -281,12 +255,14 @@ typedef struct _T_FMB_SET_VALUE_REQ {
/* FMB-Read-Value Service */
/*****************************************************************************/
typedef
struct
_T_FMB_READ_VALUE_REQ
{
typedef
struct
_T_FMB_READ_VALUE_REQ
{
USIGN8
id
;
/* value identifier */
USIGN8
dummy
;
/* alignment */
}
T_FMB_READ_VALUE_REQ
;
typedef
struct
_T_FMB_READ_VALUE_CNF
{
typedef
struct
_T_FMB_READ_VALUE_CNF
{
USIGN8
id
;
/* value identifier */
USIGN8
length
;
/* # of values in byte */
/* USIGN8 value[length]; list of values */
...
...
@@ -296,12 +272,14 @@ typedef struct _T_FMB_READ_VALUE_CNF {
/* FMB-LSAP-Status Service */
/*****************************************************************************/
typedef
struct
_T_FMB_LSAP_STATUS_REQ
{
typedef
struct
_T_FMB_LSAP_STATUS_REQ
{
USIGN8
lsap
;
/* desired LSAP */
USIGN8
dummy
;
/* alignment byte */
}
T_FMB_LSAP_STATUS_REQ
;
typedef
struct
_T_FMB_LSAP_STATUS_CNF
{
typedef
struct
_T_FMB_LSAP_STATUS_CNF
{
USIGN8
access
;
/* station address or all */
USIGN8
addr_extension
;
/* segment number */
USIGN8
sda
;
/* SDA */
...
...
@@ -314,7 +292,8 @@ typedef struct _T_FMB_LSAP_STATUS_CNF {
/* FMB-Validate-Master Service */
/*****************************************************************************/
typedef
struct
_T_FMB_VALIDATE_MASTER_REQ
{
typedef
struct
_T_FMB_VALIDATE_MASTER_REQ
{
USIGN8
rem_add
;
/* desired remote station */
USIGN8
dummy
;
/* alignment byte */
}
T_FMB_VALIDATE_MASTER_REQ
;
...
...
@@ -328,12 +307,14 @@ typedef struct _T_FMB_VALIDATE_MASTER_REQ {
#define ACTIVE_READY 0x02
#define ACTIVE_IN_RING 0x03
typedef
struct
_T_FMB_LIVE_LIST
{
typedef
struct
_T_FMB_LIVE_LIST
{
USIGN8
station
;
/* station number */
USIGN8
status
;
/* current station of station */
}
T_FMB_LIVE_LIST
;
typedef
struct
_T_FMB_GET_LIVE_LIST_CNF
{
typedef
struct
_T_FMB_GET_LIVE_LIST_CNF
{
USIGN8
dummy
;
/* alignment */
USIGN8
no_of_elements
;
/* # of live list elements */
/* T_FMB_LIVE_LIST live_list[no_of_elements]; list of live list elements
...
...
@@ -355,7 +336,8 @@ typedef struct _T_FMB_GET_LIVE_LIST_CNF {
#define FM2_MAC_ERROR 0x13
/* fatal MAC error */
#define FM2_HW_ERROR 0x14
/* fatal HW error */
typedef
struct
_T_FMB_FM2_EVENT_IND
{
typedef
struct
_T_FMB_FM2_EVENT_IND
{
USIGN16
reason
;
/* reason code */
}
T_FMB_FM2_EVENT_IND
;
...
...
profibus/lib/rt/src/pb_fms.h
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/
/* */
/*
SOFTING AG
*/
/*
SOFTING Industrial Automation GmbH
*/
/* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */
/* */
/*
Copyright (C) SOFTING AG 1995-2003
*/
/*
Copyright (C) SOFTING Industrial Automation GmbH 1995-2012
*/
/* All Rights Reserved */
/* */
/*****************************************************************************/
...
...
@@ -50,8 +15,8 @@
/* */
/* Filename : PB_FMS.H */
/* Version : 5.21.0.00.release */
/* Date :
27-February-1998
*/
/* Author : SOFTING
AG
*/
/* Date :
February-1998
*/
/* Author : SOFTING
*/
/* */
/* Description : This file contains the types and defines of the FMS-User- */
/* Interface */
...
...
@@ -408,7 +373,8 @@
/************* ACCESS CONTROL *********************/
/*****************************************************************************/
typedef
struct
_T_ACCESS
{
typedef
struct
_T_ACCESS
{
USIGN8
pass_word
;
/* password */
USIGN8
acc_groups
;
/* access groups */
USIGN16
acc_right
;
/* access rights */
...
...
@@ -419,7 +385,8 @@ typedef struct _T_ACCESS {
/*****************************************************************************/
/* --- standard access specification data structure (fixed size) ----------- */
typedef
struct
_T_ACC_SPEC
{
typedef
struct
_T_ACC_SPEC
{
USIGN8
tag
;
/* id of the access specification */
USIGN8
dummy
;
/* alignment byte */
union
{
...
...
@@ -430,7 +397,8 @@ typedef struct _T_ACC_SPEC {
/* --- dynamic access specification data structure (used in T_PI_CR8_REQ
and in T_VAR_DEFINE_VAR_LIST_REQ data structure (dynamic size) ----- */
typedef
struct
_T_DYN_ACC_SPEC
{
typedef
struct
_T_DYN_ACC_SPEC
{
USIGN8
tag
;
/* id of the access specification */
USIGN8
length
;
/* length of access specification */
/* USIGN8 acc_spec[length] access specification (index / name)
...
...
@@ -442,7 +410,8 @@ typedef struct _T_DYN_ACC_SPEC {
/*****************************************************************************/
/* --- Initiate-Service -----------------------------------------------------*/
typedef
struct
_T_CTXT_INIT_REQ
{
typedef
struct
_T_CTXT_INIT_REQ
{
USIGN8
profile_number
[
2
];
/* profile number */
PB_BOOL
protection
;
/* access protection */
USIGN8
password
;
/* password */
...
...
@@ -456,7 +425,8 @@ typedef struct _T_CTXT_INIT_REQ {
USIGN8
supported_features
[
FEAT_SUPP_LEN
];
/* supported features */
}
T_CTXT_INIT_REQ
;
typedef
struct
_T_CTXT_INIT_CNF
{
typedef
struct
_T_CTXT_INIT_CNF
{
USIGN8
profile_number
[
2
];
/* profile number */
INT16
od_version
;
/* od version */
PB_BOOL
protection
;
/* access protection */
...
...
@@ -465,7 +435,8 @@ typedef struct _T_CTXT_INIT_CNF {
USIGN8
dummy
;
/* alignment byte */
}
T_CTXT_INIT_CNF
;
typedef
struct
_T_CTXT_INIT_ERR_CNF
{
typedef
struct
_T_CTXT_INIT_ERR_CNF
{
USIGN16
class_code
;
/* error class, error code */
USIGN8
snd_len_h
;
/* max pdu size to send (high prio) */
USIGN8
snd_len_l
;
/* max pdu size to send (low prio) */
...
...
@@ -475,7 +446,8 @@ typedef struct _T_CTXT_INIT_ERR_CNF {
}
T_CTXT_INIT_ERR_CNF
;
/*--- abort service ---------------------------------------------------------*/
typedef
struct
_T_CTXT_ABORT_REQ
{
typedef
struct
_T_CTXT_ABORT_REQ
{
PB_BOOL
local
;
/* local or remote detected */
USIGN8
abort_id
;
/* abort identifier USR, FMS, ... */
USIGN8
reason
;
/* abort reason code */
...
...
@@ -484,7 +456,8 @@ typedef struct _T_CTXT_ABORT_REQ {
}
T_CTXT_ABORT_REQ
;
/*--- reject service --------------------------------------------------------*/
typedef
struct
_T_CTXT_REJECT_IND
{
typedef
struct
_T_CTXT_REJECT_IND
{
PB_BOOL
detected_here
;
/* local or remote detected */
USIGN8
orig_invoke_id
;
/* original invoke ID */
USIGN8
pdu_type
;
/* reject PDU types */
...
...
@@ -495,25 +468,29 @@ typedef struct _T_CTXT_REJECT_IND {
/************* VARIABLE ACCESS MANAGEMENT *********************/
/*****************************************************************************/
typedef
struct
_T_SIMPLE_TYPE
{
typedef
struct
_T_SIMPLE_TYPE
{
USIGN16
data_type_index
;
/* index of data type */
USIGN8
length
;
/* size of data type */
USIGN8
dummy
;
/* alignment byte */
}
T_SIMPLE_TYPE
;
typedef
struct
_T_ARRAY_TYPE
{
typedef
struct
_T_ARRAY_TYPE
{
USIGN16
data_type_index
;
/* index of data type */
USIGN8
length
;
/* size of data type */
USIGN8
no_of_elements
;
/* number of data types */
}
T_ARRAY_TYPE
;
typedef
struct
_T_RECORD_TYPE
{
typedef
struct
_T_RECORD_TYPE
{
USIGN8
no_of_elements
;
/* number of record elem. */
USIGN8
dummy
;
/* alignment byte */
T_SIMPLE_TYPE
simple
[
MAX_VAR_RECORD_ELEMENTS
];
/* list of simple types */
}
T_RECORD_TYPE
;
typedef
struct
_T_TYPE_DESCR
{
typedef
struct
_T_TYPE_DESCR
{
USIGN8
tag
;
/* type description identifier */
USIGN8
dummy
;
/* alignment byte */
union
{
...
...
@@ -528,7 +505,8 @@ typedef struct _T_TYPE_DESCR {
/*--- Simple-Variable-Object-Description
* ------------------------------------------*/
typedef
struct
_T_SIMPLE_VAR_OBJECT
{
typedef
struct
_T_SIMPLE_VAR_OBJECT
{
USIGN16
index
;
/* logical address of the object */
USIGN8
obj_code
;
/* object code */
USIGN8
length
;
/* length of object in octets */
...
...
@@ -541,7 +519,8 @@ typedef struct _T_SIMPLE_VAR_OBJECT {
/*--- Array-Variable-Object-Description
* -------------------------------------------*/
typedef
struct
_T_ARRAY_OBJECT
{
typedef
struct
_T_ARRAY_OBJECT
{
USIGN16
index
;
/* logical address of the object */
USIGN8
obj_code
;
/* object code */
USIGN8
length
;
/* length of an element in octets */
...
...
@@ -556,7 +535,8 @@ typedef struct _T_ARRAY_OBJECT {
/*--- Record-Variable-Object-Description
* ------------------------------------------*/
typedef
struct
_T_RECORD_OBJECT
{
typedef
struct
_T_RECORD_OBJECT
{
USIGN16
index
;
/* index */
USIGN8
obj_code
;
/* object code */
USIGN8
no_of_address
;
/* number of local address */
...
...
@@ -570,7 +550,8 @@ typedef struct _T_RECORD_OBJECT {
/*--- Variable-List-Object-Description
* --------------------------------------------*/
typedef
struct
_T_VAR_LIST_OBJECT
{
typedef
struct
_T_VAR_LIST_OBJECT
{
USIGN16
index
;
/* logical address of the object */
USIGN8
obj_code
;
/* object code */
USIGN8
no_of_var
;
/* number of variables */
...
...
@@ -585,13 +566,15 @@ typedef struct _T_VAR_LIST_OBJECT {
/* --- Read-Service
* ---------------------------------------------------------------*/
typedef
struct
_T_VAR_READ_REQ
{
typedef
struct
_T_VAR_READ_REQ
{
T_ACC_SPEC
acc_spec
;
/* access specification */
USIGN8
subindex
;
/* subindex */
USIGN8
dummy
;
/* alignment byte */
}
T_VAR_READ_REQ
;
typedef
struct
_T_VAR_READ_CNF
{
typedef
struct
_T_VAR_READ_CNF
{
USIGN8
dummy
;
/* alignment byte */
USIGN8
length
;
/* length of values in bytes */
/* USIGN8 value[lenght]; list of data */
...
...
@@ -599,13 +582,15 @@ typedef struct _T_VAR_READ_CNF {
/*--- Read-With-Type-Service
* ------------------------------------------------------*/
typedef
struct
_T_VAR_READ_WITH_TYPE_REQ
{
typedef
struct
_T_VAR_READ_WITH_TYPE_REQ
{
T_ACC_SPEC
acc_spec
;
/* access specification */
USIGN8
subindex
;
/* subindex */
USIGN8
dummy
;
/* alignment byte */
}
T_VAR_READ_WITH_TYPE_REQ
;
typedef
struct
_T_VAR_READ_WITH_TYPE_CNF
{
typedef
struct
_T_VAR_READ_WITH_TYPE_CNF
{
USIGN8
no_of_type_descr
;
/* number of typedescription */
USIGN8
length
;
/* # of values in bytes */
/* T_TYPE_DESCR type_descr_list[no_of_type_descr]; list of type
...
...
@@ -615,7 +600,8 @@ typedef struct _T_VAR_READ_WITH_TYPE_CNF {
/*--- Write-Service
* ---------------------------------------------------------------*/
typedef
struct
_T_VAR_WRITE_REQ
{
typedef
struct
_T_VAR_WRITE_REQ
{
T_ACC_SPEC
acc_spec
;
/* access specification */
USIGN8
subindex
;
/* subindex */
USIGN8
length
;
/* # number of values in bytes */
...
...
@@ -624,7 +610,8 @@ typedef struct _T_VAR_WRITE_REQ {
/*--- Write-With-Type-Service
* -----------------------------------------------------*/
typedef
struct
_T_VAR_WRITE_WITH_TYPE_REQ
{
typedef
struct
_T_VAR_WRITE_WITH_TYPE_REQ
{
T_ACC_SPEC
acc_spec
;
/* access specification */
USIGN8
subindex
;
/* subindex */
USIGN8
dummy
;
/* alignment byte */
...
...
@@ -637,7 +624,8 @@ typedef struct _T_VAR_WRITE_WITH_TYPE_REQ {
/*--- Information-Report-Service
* --------------------------------------------------*/
typedef
struct
_T_VAR_INFO_RPT_REQ
{
typedef
struct
_T_VAR_INFO_RPT_REQ
{
USIGN8
priority
;
/* priority */
USIGN8
subindex
;
/* subindex */
T_ACC_SPEC
acc_spec
;
/* access specification */
...
...
@@ -648,7 +636,8 @@ typedef struct _T_VAR_INFO_RPT_REQ {
/*--- Information-Report-With-Type-Service
* ----------------------------------------*/
typedef
struct
_T_VAR_INFO_RPT_WITH_TYPE_REQ
{
typedef
struct
_T_VAR_INFO_RPT_WITH_TYPE_REQ
{
USIGN8
priority
;
/* priority */
USIGN8
subindex
;
/* subindex */
T_ACC_SPEC
acc_spec
;
/* access specification */
...
...
@@ -661,7 +650,8 @@ typedef struct _T_VAR_INFO_RPT_WITH_TYPE_REQ {
/*--- Define-Variable-List-Service
* ------------------------------------------------*/
typedef
struct
_T_VAR_DEFINE_VAR_LIST_REQ
{
typedef
struct
_T_VAR_DEFINE_VAR_LIST_REQ
{
T_ACCESS
access
;
/* access rights */
STRINGV
name
[
MAX_OBJECT_NAME_LENGTH
];
/* variable list name */
USIGN8
extension
[
MAX_EXTENSION_LENGTH
];
/* extension */
...
...
@@ -675,25 +665,29 @@ typedef struct _T_VAR_DEFINE_VAR_LIST_REQ {
#endif
}
T_VAR_DEFINE_VAR_LIST_REQ
;
typedef
struct
_T_VAR_DEFINE_VAR_LIST_CNF
{
typedef
struct
_T_VAR_DEFINE_VAR_LIST_CNF
{
USIGN16
index
;
/* index of variable list */
}
T_VAR_DEFINE_VAR_LIST_CNF
;
/*--- Delete-Variable-List-Service
* ------------------------------------------------*/
typedef
struct
_T_VAR_DELETE_VAR_LIST_REQ
{
typedef
struct
_T_VAR_DELETE_VAR_LIST_REQ
{
T_ACC_SPEC
acc_spec
;
/* access specification */
}
T_VAR_DELETE_VAR_LIST_REQ
;
/*--- Physical-Read-Service
* -------------------------------------------------------*/
typedef
struct
_T_VAR_PHYS_READ_REQ
{
typedef
struct
_T_VAR_PHYS_READ_REQ
{
USIGN32
int_addr
;
/* physical address to be read */
USIGN8
length
;
/* length in octets */
USIGN8
dummy
;
/* alignment byte */
}
T_VAR_PHYS_READ_REQ
;
typedef
struct
_T_VAR_PHYS_READ_CNF
{
typedef
struct
_T_VAR_PHYS_READ_CNF
{
USIGN8
dummy
;
/* alignment byte */
USIGN8
length
;
/* length of values in bytes */
/* USIGN8 data[length]; list of data */
...
...
@@ -701,7 +695,8 @@ typedef struct _T_VAR_PHYS_READ_CNF {
/*--- Physical-Write-Service
* ------------------------------------------------------*/
typedef
struct
_T_VAR_PHYS_WRITE_REQ
{
typedef
struct
_T_VAR_PHYS_WRITE_REQ
{
USIGN32
int_addr
;
/* physical address to be write */
USIGN8
dummy
;
/* length in octets */
USIGN8
length
;
/* length in octets */
...
...
@@ -710,7 +705,8 @@ typedef struct _T_VAR_PHYS_WRITE_REQ {
/*--- Data-Event service
* ----------------------------------------------------------*/
typedef
struct
_T_VAR_DATA_EVENT_IND
{
typedef
struct
_T_VAR_DATA_EVENT_IND
{
USIGN16
index
;
/* index */
USIGN8
dummy
;
/* alignment byte */
USIGN8
length
;
/* length of values in bytes */
...
...
@@ -722,7 +718,8 @@ typedef struct _T_VAR_DATA_EVENT_IND {
/*****************************************************************************/
/*--- Event-Object-Description ----------------------------------------------*/
typedef
struct
_T_EVENT_OBJECT
{
typedef
struct
_T_EVENT_OBJECT
{
USIGN16
index_event
;
/* index */
USIGN8
obj_code
;
/* object code */
USIGN8
data_length
;
/* size of event data */
...
...
@@ -735,7 +732,8 @@ typedef struct _T_EVENT_OBJECT {
}
T_EVENT_OBJECT
;
/*--- Event-Notification-Service --------------------------------------------*/
typedef
struct
_T_EVENT_NOTIFY_REQ
{
typedef
struct
_T_EVENT_NOTIFY_REQ
{
USIGN8
priority
;
/* priority */
USIGN8
event_number
;
/* event number */
T_ACC_SPEC
acc_spec
;
/* access specification */
...
...
@@ -745,7 +743,8 @@ typedef struct _T_EVENT_NOTIFY_REQ {
}
T_EVENT_NOTIFY_REQ
;
/*--- Event-Notification-With-Type-Service ----------------------------------*/
typedef
struct
_T_EVENT_NOTIFY_WITH_TYPE_REQ
{
typedef
struct
_T_EVENT_NOTIFY_WITH_TYPE_REQ
{
USIGN8
priority
;
/* priority */
USIGN8
event_number
;
/* event number */
T_ACC_SPEC
acc_spec
;
/* access specification */
...
...
@@ -756,14 +755,16 @@ typedef struct _T_EVENT_NOTIFY_WITH_TYPE_REQ {
}
T_EVENT_NOTIFY_WITH_TYPE_REQ
;
/*--- Alter-Event-Condition-Monitoring --------------------------------------*/
typedef
struct
_T_ALT_EVN_CND_MNT_REQ
{
typedef
struct
_T_ALT_EVN_CND_MNT_REQ
{
T_ACC_SPEC
acc_spec
;
/* access specification */
PB_BOOL
enabled
;
/* enable or disable the event */
USIGN8
dummy
;
/* alignment byte */
}
T_ALT_EVN_CND_MNT_REQ
;
/*--- Acknowledge-Event-Notification ----------------------------------------*/
typedef
struct
_T_ACK_EVN_NOTIFY_REQ
{
typedef
struct
_T_ACK_EVN_NOTIFY_REQ
{
T_ACC_SPEC
acc_spec
;
/* access specification */
USIGN8
event_number
;
/* event count number */
USIGN8
dummy
;
/* alignment byte */
...
...
@@ -774,7 +775,8 @@ typedef struct _T_ACK_EVN_NOTIFY_REQ {
/*****************************************************************************/
/*--- Domain-Object-Description ---------------------------------------------*/
typedef
struct
_T_DOM_OBJECT
{
typedef
struct
_T_DOM_OBJECT
{
USIGN16
index
;
/* index */
USIGN8
obj_code
;
/* object code */
USIGN8
state
;
/* domain state */
...
...
@@ -791,35 +793,41 @@ typedef struct _T_DOM_OBJECT {
/*--- Generic-Domain-Download-Services --------------------------------------*/
/*--- Domain-Upload-Services ----------------------------------------------*/
typedef
struct
_T_DOM_REQ
{
typedef
struct
_T_DOM_REQ
{
T_ACC_SPEC
acc_spec
;
/* access specification */
}
T_DOM_REQ
;
typedef
struct
_T_DNL_UPL_SEG_CNF
{
typedef
struct
_T_DNL_UPL_SEG_CNF
{
PB_BOOL
more_follows
;
/* more_follows */
USIGN8
data_len
;
/* data length */
/* USIGN8 data[data_len]; list of data */
}
T_DNL_UPL_SEG_CNF
;
typedef
struct
_T_GEN_DNL_SEG_REQ
{
typedef
struct
_T_GEN_DNL_SEG_REQ
{
T_ACC_SPEC
acc_spec
;
/* access specification */
PB_BOOL
more_follows
;
/* more_follows */
USIGN8
data_len
;
/* data length */
/* USIGN8 data[data_len]; list of data */
}
T_GEN_DNL_SEG_REQ
;
typedef
struct
_T_TERM_DNL_REQ
{
typedef
struct
_T_TERM_DNL_REQ
{
T_ACC_SPEC
acc_spec
;
/* access specification */
PB_BOOL
final_result
;
/* final result */
USIGN8
dummy
;
/* alignment */
}
T_TERM_DNL_REQ
;
typedef
struct
_T_GEN_TERM_DNL_CNF
{
typedef
struct
_T_GEN_TERM_DNL_CNF
{
PB_BOOL
final_result
;
/* final result */
USIGN8
dummy
;
/* alignment */
}
T_GEN_TERM_DNL_CNF
;
typedef
struct
_T_REQUEST_DOM_REQ
{
typedef
struct
_T_REQUEST_DOM_REQ
{
T_ACC_SPEC
acc_spec
;
/* access specification */
USIGN8
dummy
;
/* alignment */
USIGN8
add_info_length
;
/* length of add. information */
...
...
@@ -831,7 +839,8 @@ typedef struct _T_REQUEST_DOM_REQ {
/*****************************************************************************/
/*--- Program-Invocation-Object ---------------------------------------------*/
typedef
struct
_T_PI_OBJECT
{
typedef
struct
_T_PI_OBJECT
{
USIGN16
index
;
/* pi_index in OD */
USIGN8
obj_code
;
/* object code for OD */
USIGN8
cnt_dom
;
/* # domains */
...
...
@@ -847,7 +856,8 @@ typedef struct _T_PI_OBJECT {
}
T_PI_OBJECT
;
/*--- Create-PI-Service -----------------------------------------------------*/
typedef
struct
_T_PI_CR8_REQ
{
typedef
struct
_T_PI_CR8_REQ
{
T_ACCESS
access
;
/* access rights */
USIGN8
cnt_dom
;
/* number of domains */
PB_BOOL
reusable
;
/* => TRUE pi is reusable */
...
...
@@ -861,51 +871,60 @@ typedef struct _T_PI_CR8_REQ {
#endif
}
T_PI_CR8_REQ
;
typedef
struct
_T_PI_CR8_CNF
{
typedef
struct
_T_PI_CR8_CNF
{
USIGN16
index
;
/* index of PI */
}
T_PI_CR8_CNF
;
/*--- Delete-PI-Service -----------------------------------------------------*/
typedef
struct
_T_PI_DEL_REQ
{
typedef
struct
_T_PI_DEL_REQ
{
T_ACC_SPEC
acc_spec
;
/* access specification */
}
T_PI_DEL_REQ
;
/*--- Start-PI-Service ------------------------------------------------------*/
typedef
struct
_T_PI_START_REQ
{
typedef
struct
_T_PI_START_REQ
{
T_ACC_SPEC
acc_spec
;
/* access specific. */
USIGN8
exec_arg
[
MAX_EXECUTION_ARGUMENT_LENGTH
];
/* execution arg. */
}
T_PI_START_REQ
;
/*--- Stop-PI-Service -------------------------------------------------------*/
typedef
struct
_T_PI_STOP_REQ
{
typedef
struct
_T_PI_STOP_REQ
{
T_ACC_SPEC
acc_spec
;
/* access specific. */
}
T_PI_STOP_REQ
;
/*--- Resume-PI-Service -----------------------------------------------------*/
typedef
struct
_T_PI_RESUME_REQ
{
typedef
struct
_T_PI_RESUME_REQ
{
T_ACC_SPEC
acc_spec
;
/* access specific. */
USIGN8
exec_arg
[
MAX_EXECUTION_ARGUMENT_LENGTH
];
/* execution arg. */
}
T_PI_RESUME_REQ
;
/*--- Reset-PI-Service ------------------------------------------------------*/
typedef
struct
_T_PI_RESET_REQ
{
typedef
struct
_T_PI_RESET_REQ
{
T_ACC_SPEC
acc_spec
;
/* access specific. */
}
T_PI_RESET_REQ
;
/*--- Kill-PI-Service -------------------------------------------------------*/
typedef
struct
_T_PI_KILL_REQ
{
typedef
struct
_T_PI_KILL_REQ
{
T_ACC_SPEC
acc_spec
;
/* access specific. */
}
T_PI_KILL_REQ
;
/*--- PI-SET-STATE-Service ( only local Service ) ---------------------------*/
typedef
struct
_T_PI_SET_STATE_REQ
{
typedef
struct
_T_PI_SET_STATE_REQ
{
USIGN32
vfd_number
;
/* vfd number */
T_ACC_SPEC
acc_spec
;
/* access specification */
USIGN8
state
;
/* new PI state */
USIGN8
dummy
;
/* alignment byte */
}
T_PI_SET_STATE_REQ
;
typedef
struct
_T_PI_SET_STATE_CNF
{
typedef
struct
_T_PI_SET_STATE_CNF
{
USIGN32
vfd_number
;
/* vfd number */
}
T_PI_SET_STATE_CNF
;
...
...
@@ -915,7 +934,8 @@ typedef struct _T_PI_SET_STATE_CNF {
/* --- OD-Object-Description
* ---------------------------------------------------*/
typedef
struct
_T_OD_OBJ_DESCR_HDR
{
typedef
struct
_T_OD_OBJ_DESCR_HDR
{
USIGN16
index
;
/* index = 0 */
USIGN8
obj_code
;
/* object-code = 1 */
PB_BOOL
flag
;
/* => TRUE write protected */
...
...
@@ -937,7 +957,8 @@ typedef struct _T_OD_OBJ_DESCR_HDR {
}
T_OD_OBJ_DESCR_HDR
;
#if (PB_VER < 500)
typedef
struct
T_OV_OBJ_DESCR_HDR
{
typedef
struct
T_OV_OBJ_DESCR_HDR
{
USIGN16
index
;
/* index = 0 */
USIGN8
obj_code
;
/* object-code = 1 */
BOOL
flag
;
/* => TRUE write protected */
...
...
@@ -960,7 +981,8 @@ typedef struct T_OV_OBJ_DESCR_HDR {
#endif
/* --- OD-Null-Object-Description -------------------------------------------*/
typedef
struct
_T_OD_NULL_OBJECT
{
typedef
struct
_T_OD_NULL_OBJECT
{
USIGN16
index
;
/* index */
USIGN8
obj_code
;
/* object code */
USIGN8
dummy
;
/* alignment reasons */
...
...
@@ -971,7 +993,8 @@ typedef T_OD_NULL_OBJECT T_OV_NULL_OBJECT;
#endif
/* --- OD-Static-Type-Object-Description ------------------------------------*/
typedef
struct
_T_OD_ST_DT_DESCR
{
typedef
struct
_T_OD_ST_DT_DESCR
{
USIGN16
index
;
/* index */
USIGN8
obj_code
;
/* object code */
USIGN8
dummy
;
/* alignment byte */
...
...
@@ -983,7 +1006,8 @@ typedef T_OD_ST_DT_DESCR T_OV_ST_DT_DESCR;
#endif
/* --- OD-Static-Structure-Object-Description -------------------------------*/
typedef
struct
_T_OD_DT_LIST
{
typedef
struct
_T_OD_DT_LIST
{
USIGN16
index_of_type
;
/* logical address of the type */
USIGN8
length
;
/* length of the element in octets */
USIGN8
dummy
;
/* alignment byte */
...
...
@@ -993,7 +1017,8 @@ typedef struct _T_OD_DT_LIST {
typedef
T_OD_DT_LIST
T_OV_DT_LIST
;
#endif
typedef
struct
_T_OD_ST_DS_DESCR
{
typedef
struct
_T_OD_ST_DS_DESCR
{
USIGN16
index
;
/* index */
USIGN8
obj_code
;
/* object code */
USIGN8
no_of_elements
;
/* number of record elements */
...
...
@@ -1002,7 +1027,8 @@ typedef struct _T_OD_ST_DS_DESCR {
}
T_OD_ST_DS_DESCR
;
#if (PB_VER < 500)
typedef
struct
_T_OV_ST_DS_DESCR
{
typedef
struct
_T_OV_ST_DS_DESCR
{
USIGN16
index
;
/* index */
USIGN8
obj_code
;
/* object code */
USIGN8
no_of_elements
;
/* number of record elements */
...
...
@@ -1013,7 +1039,8 @@ typedef struct _T_OV_ST_DS_DESCR {
/* --- OD-OBJECT-DESCRIPTION ----------------------------------------------- */
#if (PB_VER >= 500)
typedef
struct
_T_OBJECT_DESCR
{
typedef
struct
_T_OBJECT_DESCR
{
union
{
T_OD_OBJ_DESCR_HDR
od_obj_descr
;
T_OD_NULL_OBJECT
null_obj_descr
;
...
...
@@ -1029,7 +1056,8 @@ typedef struct _T_OBJECT_DESCR {
}
id
;
}
T_OBJECT_DESCR
;
#else
typedef
struct
_T_OBJECT_DESCR
{
typedef
struct
_T_OBJECT_DESCR
{
union
{
T_OV_OBJ_DESCR_HDR
ov_obj_descr
;
T_OV_NULL_OBJECT
null_obj_descr
;
...
...
@@ -1047,13 +1075,15 @@ typedef struct _T_OBJECT_DESCR {
#endif
/* --- OD-PACKED-OBJECT-DESCRIPTION ---------------------------------------- */
typedef
struct
_T_PACKED_OBJECT_DESCR
{
typedef
struct
_T_PACKED_OBJECT_DESCR
{
USIGN8
length
;
/* length of packed object description*/
/* USIGN8 packed_obj_descr[length]; packed object description */
}
T_PACKED_OBJECT_DESCR
;
/* --- Get-OD-Service -------------------------------------------------------*/
typedef
struct
_T_GET_OD_REQ
{
typedef
struct
_T_GET_OD_REQ
{
PB_BOOL
format
;
/* TRUE = long format / FALSE = short */
USIGN8
dummy
;
/* alignment byte */
T_ACC_SPEC
acc_spec
;
/* access specification */
...
...
@@ -1063,7 +1093,8 @@ typedef struct _T_GET_OD_REQ {
typedef
T_GET_OD_REQ
T_GET_OV_REQ
;
#endif
typedef
struct
_T_GET_OD_CNF
{
typedef
struct
_T_GET_OD_CNF
{
PB_BOOL
more_follows
;
/* further object descr. follow */
USIGN8
no_of_od_descr
;
/* # of object description */
/* T_PACKED_OBJECT_DESCR obj_descr_list[no_of_od_descr]; list of object
...
...
@@ -1071,7 +1102,8 @@ typedef struct _T_GET_OD_CNF {
}
T_GET_OD_CNF
;
#if (PB_VER < 500)
typedef
struct
_T_GET_OV_CNF
{
typedef
struct
_T_GET_OV_CNF
{
PB_BOOL
more_follows
;
/* further object descr. follow */
USIGN8
no_of_ov_descr
;
/* # of object description */
/* T_PACKED_OBJECT_DESCR obj_descr_list[no_of_ov_descr]; list of object
...
...
@@ -1080,7 +1112,8 @@ typedef struct _T_GET_OV_CNF {
#endif
/* --- Put-OD-Services ------------------------------------------------------*/
typedef
struct
_T_INIT_PUT_OD_REQ
{
typedef
struct
_T_INIT_PUT_OD_REQ
{
INT8
consequence
;
/* Loading interactive/non-interactive */
USIGN8
dummy
;
/* alignment */
}
T_INIT_PUT_OD_REQ
;
...
...
@@ -1089,7 +1122,8 @@ typedef struct _T_INIT_PUT_OD_REQ {
typedef
T_INIT_PUT_OD_REQ
T_INIT_PUT_OV_REQ
;
#endif
typedef
struct
_T_PUT_OD_REQ
{
typedef
struct
_T_PUT_OD_REQ
{
USIGN8
dummy
;
/* alignment */
USIGN8
no_of_od_descr
;
/* # of object description */
/* T_PACKED_OBJECT_DESCR obj_descr_list[no_of_od_descr]; list of object
...
...
@@ -1097,7 +1131,8 @@ typedef struct _T_PUT_OD_REQ {
}
T_PUT_OD_REQ
;
#if (PB_VER < 500)
typedef
struct
_T_PUT_OV_REQ
{
typedef
struct
_T_PUT_OV_REQ
{
USIGN8
dummy
;
/* alignment */
USIGN8
no_of_ov_descr
;
/* # of object description */
/* T_PACKED_OBJECT_DESCR obj_descr_list[no_of_ov_descr]; list of object
...
...
@@ -1106,7 +1141,8 @@ typedef struct _T_PUT_OV_REQ {
#endif
/* --- Load-OD-Local-Service ------------------------------------------------*/
typedef
struct
_T_INIT_LOAD_OD_REQ
{
typedef
struct
_T_INIT_LOAD_OD_REQ
{
USIGN32
vfd_number
;
INT8
consequence
;
USIGN8
dummy
;
...
...
@@ -1116,7 +1152,8 @@ typedef struct _T_INIT_LOAD_OD_REQ {
typedef
T_INIT_LOAD_OD_REQ
T_INIT_LOAD_OV_REQ
;
#endif
typedef
struct
_T_INIT_LOAD_OD_CNF
{
typedef
struct
_T_INIT_LOAD_OD_CNF
{
USIGN32
vfd_number
;
}
T_INIT_LOAD_OD_CNF
;
...
...
@@ -1124,7 +1161,8 @@ typedef struct _T_INIT_LOAD_OD_CNF {
typedef
T_INIT_LOAD_OD_CNF
T_INIT_LOAD_OV_CNF
;
#endif
typedef
struct
_T_LOAD_OD_REQ
{
typedef
struct
_T_LOAD_OD_REQ
{
USIGN32
vfd_number
;
T_OBJECT_DESCR
obj_descr
;
}
T_LOAD_OD_REQ
;
...
...
@@ -1133,7 +1171,8 @@ typedef struct _T_LOAD_OD_REQ {
typedef
T_LOAD_OD_REQ
T_LOAD_OV_REQ
;
#endif
typedef
struct
_T_LOAD_OD_CNF
{
typedef
struct
_T_LOAD_OD_CNF
{
USIGN32
vfd_number
;
}
T_LOAD_OD_CNF
;
...
...
@@ -1141,7 +1180,8 @@ typedef struct _T_LOAD_OD_CNF {
typedef
T_LOAD_OD_CNF
T_LOAD_OV_CNF
;
#endif
typedef
struct
_T_TERM_LOAD_OD_REQ
{
typedef
struct
_T_TERM_LOAD_OD_REQ
{
USIGN32
vfd_number
;
}
T_TERM_LOAD_OD_REQ
;
...
...
@@ -1149,7 +1189,8 @@ typedef struct _T_TERM_LOAD_OD_REQ {
typedef
T_TERM_LOAD_OD_REQ
T_TERM_LOAD_OV_REQ
;
#endif
typedef
struct
_T_TERM_LOAD_OD_CNF
{
typedef
struct
_T_TERM_LOAD_OD_CNF
{
USIGN32
vfd_number
;
}
T_TERM_LOAD_OD_CNF
;
...
...
@@ -1158,7 +1199,8 @@ typedef T_TERM_LOAD_OD_CNF T_TERM_LOAD_OV_CNF;
#endif
/*--- Read-OD-Local-Service -------------------------------------------------*/
typedef
struct
_T_OD_READ_LOC_REQ
{
typedef
struct
_T_OD_READ_LOC_REQ
{
USIGN32
vfd_number
;
USIGN8
obj_code
;
USIGN8
dummy
;
...
...
@@ -1169,7 +1211,8 @@ typedef struct _T_OD_READ_LOC_REQ {
typedef
T_OD_READ_LOC_REQ
T_OV_READ_LOC_REQ
;
#endif
typedef
struct
_T_OD_READ_LOC_CNF
{
typedef
struct
_T_OD_READ_LOC_CNF
{
USIGN32
vfd_number
;
/* vfd number */
T_OBJECT_DESCR
obj_descr
;
/* object description */
}
T_OD_READ_LOC_CNF
;
...
...
@@ -1183,7 +1226,8 @@ typedef T_OD_READ_LOC_CNF T_OV_READ_LOC_CNF;
/*****************************************************************************/
/*--- Create-VFD-Service ----------------------------------------------------*/
typedef
struct
_T_VFD_CREATE_REQ
{
typedef
struct
_T_VFD_CREATE_REQ
{
USIGN32
vfd_number
;
/* vfd number */
STRINGV
vendor_name
[
MAX_VFD_STRING_LENGTH
];
/* vendor name */
STRINGV
model_name
[
MAX_VFD_STRING_LENGTH
];
/* model-name */
...
...
@@ -1191,23 +1235,27 @@ typedef struct _T_VFD_CREATE_REQ {
USIGN8
profile_number
[
2
];
/* profile number */
}
T_VFD_CREATE_REQ
;
typedef
struct
_T_VFD_CREATE_CNF
{
typedef
struct
_T_VFD_CREATE_CNF
{
USIGN32
vfd_number
;
/* vfd number */
}
T_VFD_CREATE_CNF
;
/*--- VFD-Set-Physical-Status -----------------------------------------------*/
typedef
struct
_T_VFD_SET_PHYS_STATUS_REQ
{
typedef
struct
_T_VFD_SET_PHYS_STATUS_REQ
{
USIGN32
vfd_number
;
/* vfd number */
USIGN8
physical_status
;
/* physical status */
USIGN8
dummy
;
/* alignment byte */
}
T_VFD_SET_PHYS_STATUS_REQ
;
typedef
struct
_T_VFD_SET_PHYS_STATUS_CNF
{
typedef
struct
_T_VFD_SET_PHYS_STATUS_CNF
{
USIGN32
vfd_number
;
/* vfd number */
}
T_VFD_SET_PHYS_STATUS_CNF
;
/*--- Status-Service --------------------------------------------------------*/
typedef
struct
_T_VFD_STATUS_CNF
{
typedef
struct
_T_VFD_STATUS_CNF
{
USIGN8
logical_status
;
/* logical status */
USIGN8
physical_status
;
/* physical status */
USIGN8
local_detail
[
3
];
/* local detail */
...
...
@@ -1215,7 +1263,8 @@ typedef struct _T_VFD_STATUS_CNF {
}
T_VFD_STATUS_CNF
;
/*--- Unsolicited-Status-Service --------------------------------------------*/
typedef
struct
_T_VFD_UNSOL_STATUS_REQ
{
typedef
struct
_T_VFD_UNSOL_STATUS_REQ
{
USIGN8
priority
;
/* priority */
USIGN8
logical_status
;
/* logical status */
USIGN8
physical_status
;
/* physical status */
...
...
@@ -1225,7 +1274,8 @@ typedef struct _T_VFD_UNSOL_STATUS_REQ {
}
T_VFD_UNSOL_STATUS_REQ
;
/*--- Identify-Service ------------------------------------------------------*/
typedef
struct
_T_VFD_IDENTIFY_CNF
{
typedef
struct
_T_VFD_IDENTIFY_CNF
{
STRINGV
vendor_name
[
MAX_VFD_STRING_LENGTH
];
/* producer of the device */
STRINGV
model_name
[
MAX_VFD_STRING_LENGTH
];
/* model-name of the device */
STRINGV
revision
[
MAX_VFD_STRING_LENGTH
];
/* revision of the device */
...
...
profibus/lib/rt/src/pb_hw.h
deleted
100644 → 0
View file @
9344a78b
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2011 SSAB Oxelosund AB.
*
* This file is part of Proview.
* Copyright (C) SOFTING GmbH 1995-1999.
* 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 the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*****************************************************************************/
/* */
/* SOFTING GmbH */
/* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */
/* */
/* Copyright (C) SOFTING GmbH 1995-1999 */
/* */
/*****************************************************************************/
/*****************************************************************************/
/* PROFIBoard SPECIFIC DEFINES */
/* Filename : PB_HW.H */
/* Version : 5.22.0.00.release */
/* Date : 26-February-1999 */
/* Author : SOFTING-BG2 */
/* */
/* Description : This file contains the PROFIboard specific defines */
/* */
/* CHANGE_NOTES */
/* */
/* date name change */
/* ----------------------------------------------------------------------- */
/* 03.03.98 BOE new/modify #defines for DPRAM SIZES and IRQ-VAL */
/* offset in DPR */
/* */
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
#ifndef __PB_HW__
#define __PB_HW__
/* --- macros to access DPR ----------------------------------------------- */
#define _GET_DPR_BYTE(var) var
#define _SET_DPR_BYTE(out_var, in_var) out_var = in_var
#define _GET_DPR_WORD(var) var
#define _SET_DPR_WORD(out_var, in_var) out_var = in_var
#define _SET_CHIP_SELECT_ADDR(addr)
/* --- DPRAM SIZES / IRQ-VAL offset in DPR --------------------------------- */
#define DPRAM_SIZE_PROFIBOARD 0x4000
/* 16 KB DPRAM */
#define DPRAM_SIZE_PROFI_104 0x4000
/* 16 KB DPRAM */
#define DPRAM_H_TO_C_IRQ_OFFSET 0x2
/* IRQ memory cells at DPRAM end */
#define DPRAM_C_TO_H_IRQ_OFFSET 0x4
/* --- IRQ-VALUE ----------------------------------------------------------- */
#define RST_IRQ_VALUE 0xAA
/* Reset */
#define REQ_IRQ_VALUE 0xF0
/* SND/RCV Request */
#define ACK_IRQ_VALUE 0x0F
/* SND/RCV Acknowledge */
#define DP_SLAVE_IO_REQ_IRQ_VALUE 0xE0
/* DP-SLAVE-IO Request */
#define DP_SLAVE_IO_ACK_IRQ_VALUE 0x0E
/* DP-SLAVE-IO Acknowldege */
#define DP_DATA_STOP_REQ_IRQ_VALUE 0xD0
/* data transfer stop Request */
#define DP_DATA_STOP_ACK_IRQ_VALUE 0x0D
/* data transfer stop Acknowldege */
/* --- Read Registers in the I/O Area of the PC ---------------------------- */
#define IDENT_1 (IO_BASE_ADD + 0)
/* Identification Byte 1 */
#define IDENT_2 (IO_BASE_ADD + 1)
/* Identification Byte 2 */
#define IDENT_3 (IO_BASE_ADD + 2)
/* Identification Byte 3 */
#define IDENT_4 (IO_BASE_ADD + 3)
/* Identification Byte 4 */
/* --- Write Registers in the I/O Area of the PC --------------------------- */
#define BOARD_CTRL (IO_BASE_ADD + 0)
/* Board Control Register */
#define BASE_ADD (IO_BASE_ADD + 1)
/* DPRAM Base Address Register */
#define PAGE_SEL (IO_BASE_ADD + 2)
/* Page Select Register */
#define CP_IRQ (IO_BASE_ADD + 3)
/* Interrupt Register */
/* -- Pindefinition of the Board Control Register -------------------------- */
#define C165_RESET 0x01
/* Reset of the C165 (low active)*/
#define EN_DPRAM 0x02
/* Enable DPRAM for PC (high active)*/
#define SIZE_16_64 0x04
/* DPRAM size 1:16 kByte 0:64kByte*/
/* 64 kByte (low) */
#define BASE_A14 0x08
/* Address low within the 64 kByte */
#define BASE_A15 0x10
/* Address high within the 64 kByte */
#define DPR_WIDTH_8_16 0x20
/* DPRAM width 0:16Bit 1:8Bit */
#define MEMCS16_LA_SA 0x40
/* MEMCS16 generation 0:LA 1:SA */
/* --- Pindefinition of the DPRAM Base Adress Register --------------------- */
/* Bit 7: Base Address 23 (MSB) to */
/* Bit 0: Base Address 16 (LSB) */
/* --- Pindefinition of the Page Select Register --------------------------- */
#define PAGE_A0 0x01
/* Page Address low within the 64 kByte window */
#define PAGE_A1 0x02
/* Page Address high within the 64 kByte window */
#define PAGE_0 0x00
/* Page 0 0KB - 16KB */
#define PAGE_1 0x01
/* Page 1 16KB - 32KB */
#define PAGE_2 0x02
/* Page 2 32KB - 48KB */
#define PAGE_3 0x03
/* Page 3 48KB - 64KB */
/* --- Macros to Set or Clear Page ----------------------------------------- */
#define CLEAR_PAGE(reg) ((reg) & ~(PAGE_A0 | PAGE_A1))
#define SET_PAGE(reg, page) (CLEAR_PAGE(reg) | page)
/* --- Board I/O identifier ------------------------------------------------ */
#define HW_IO_ID_PROFIBOARD_0 0x96
#define HW_IO_ID_PROFIBOARD_1 0x26
#define HW_IO_ID_PROFIBOARD_2 0x6B
#define HW_IO_ID_PROFI104_0 0x2C
#define HW_IO_ID_PROFI104_1 0x12
#define HW_IO_ID_PROFI104_2 0x41
#endif
profibus/lib/rt/src/pb_if.h
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/
/* */
/*
SOFTING AG
*/
/*
SOFTING Industrial Automation GmbH
*/
/* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */
/* */
/*
Copyright (C) SOFTING AG 1995-2003
*/
/*
Copyright (C) SOFTING Industrial Automation GmbH 1995-2012
*/
/* All Rights Reserved */
/* */
/*****************************************************************************/
...
...
@@ -49,9 +14,9 @@
/* PROFIBUS APPLICATION PROGRAM INTERFACE */
/* */
/* Filename : PB_IF.H */
/* Version : 5.
26.1
.00.release */
/* Date :
27-June-2003
*/
/* Author : SOFTING
AG
*/
/* Version : 5.
46.0
.00.release */
/* Date :
October-2011
*/
/* Author : SOFTING
*/
/* */
/* Description : This file contains the extern function declarations, */
/* defines and types of the PROFIBUS Communication Interface */
...
...
@@ -102,8 +67,7 @@
#define ACK_IRQ 0x0F
/* acknowledge REQ/RES */
#define DP_SLAVE_IO_REQ_IRQ 0xE0
/* MASTER: DP-SLAVE-IO IND/REQ */
#define DP_SLAVE_IO_ACK_IRQ 0x0E
/* MASTER: DP-SLAVE-IO acknowldege IND/REQ */
#define DP_DATA_STOP_REQ_IRQ \
0xD0
/* MASTER: data transfer stop REQ received \
#define DP_DATA_STOP_REQ_IRQ 0xD0
/* MASTER: data transfer stop REQ received \
*/
#define DP_DATA_STOP_ACK_IRQ 0x0D
/* MASTER: data transfer stop Acknowldege */
#define TRC_REQ_IRQ 0xC0
/* TRACE REQ is received */
...
...
@@ -187,15 +151,15 @@
* ---------------------------------------------------------------- */
#define ID_DP_SLAVE_IO_IMAGE 0x80
/* MASTER: image for slave io datas */
#define ID_DP_STATUS_IMAGE 0x81
/* MASTER: image for status datas */
#define ID_DP_SLAVE_IO_CONFIG_IMAGE \
0x82
/* MASTER: DPRAM layout of slave io \
#define ID_DP_SLAVE_IO_CONFIG_IMAGE 0x82
/* MASTER: DPRAM layout of slave io \
*/
/* --- DP-SLAVE
* ----------------------------------------------------------------- */
#define ID_DPS_SLAVE_INPUT_IMAGE 0x90
/* SLAVE: image for slave input datas */
#define ID_DPS_SLAVE_OUTPUT_IMAGE \
0x91
/* SLAVE: image for slave output datas \
#define ID_DPS_SLAVE_OUTPUT_IMAGE 0x91
/* SLAVE: image for slave output datas \
*/
/* --- 0x92 reserved for internal use
*/
/* --- 0xA0 - 0xEF reserved for future use --- (no identifiers defined)
...
...
@@ -216,20 +180,8 @@
/* PROFI SERVICE DESCRIPTION BLOCK */
/**********************************************************************************/
typedef
struct
_T_PROFI_DEVICE_HANDLE
{
HANDLE
hServiceReadDevice
;
// Handle for Service device
HANDLE
hServiceWriteDevice
;
// Handle for Service device
HANDLE
hDpDataDevice
;
// Handle for DP-Data device
HANDLE
hDpsInputDataDevice
;
// Handle for DP-Slave Input-Data device
HANDLE
hDpsOutputDataDevice
;
// Handle for DP-Slave Output-Data device
USIGN8
CurrentBoardNumber
;
}
T_PROFI_DEVICE_HANDLE
;
/**********************************************************************************/
/* PROFI SERVICE DESCRIPTION BLOCK */
/**********************************************************************************/
typedef
struct
_T_PROFI_SERVICE_DESCR
{
typedef
struct
_T_PROFI_SERVICE_DESCR
{
USIGN16
comm_ref
;
/* communication reference */
USIGN8
layer
;
/* layer identifier */
USIGN8
service
;
/* service identifier */
...
...
@@ -242,7 +194,8 @@ typedef struct _T_PROFI_SERVICE_DESCR {
/**********************************************************************************/
/* PROFI INITIALIZATION DATA STRUCTURE */
/**********************************************************************************/
typedef
struct
_T_PROFI_INIT
{
typedef
struct
_T_PROFI_INIT
{
USIGN32
dpr_address
;
/* DPR address */
INT16
io_port_address
;
/* IO port address */
PB_BOOL
load_firmware
;
/* PB_TRUE for PROFI-IF
...
...
@@ -287,9 +240,10 @@ extern "C" {
#endif
#if defined(WIN32) || defined(_LINUX)
FUNCTION
extern
INT16
CALL_CONV
profi_set_default
(
OUT
T_PROFI_DEVICE_HANDLE
*
hDevice
,
IN
USIGN8
Board
,
IN
USIGN8
Channel
,
IN
USIGN32
ReadTimeout
,
IN
USIGN32
WriteTimeout
)
FUNCTION
extern
INT16
CALL_CONV
profi_set_default
(
IN
USIGN8
Board
,
IN
USIGN8
Channel
,
IN
USIGN32
ReadTimeout
,
IN
USIGN32
WriteTimeout
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -316,8 +270,9 @@ FUNCTION extern INT16 CALL_CONV profi_set_default(
-----------------------------------------------------------------------------*/
;
FUNCTION
extern
INT16
CALL_CONV
profi_init
(
OUT
T_PROFI_DEVICE_HANDLE
*
hDevice
,
IN
USIGN8
Board
,
IN
USIGN32
ReadTimeout
,
IN
USIGN32
WriteTimeout
)
FUNCTION
extern
INT16
CALL_CONV
profi_init
(
IN
USIGN8
Board
,
IN
USIGN32
ReadTimeout
,
IN
USIGN32
WriteTimeout
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -345,8 +300,9 @@ FUNCTION extern INT16 CALL_CONV profi_init(OUT T_PROFI_DEVICE_HANDLE* hDevice,
;
#endif
FUNCTION
extern
INT16
CALL_CONV
init_profibus
(
IN
USIGN32
DprAdress
,
IN
USIGN16
IoPortAdress
,
IN
PB_BOOL
Dummy
)
FUNCTION
extern
INT16
CALL_CONV
init_profibus
(
IN
USIGN32
DprAdress
,
IN
USIGN16
IoPortAdress
,
IN
PB_BOOL
Dummy
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -374,7 +330,7 @@ FUNCTION extern INT16 CALL_CONV init_profibus(
-----------------------------------------------------------------------------*/
;
FUNCTION
extern
INT16
CALL_CONV
profi_end
(
IN
T_PROFI_DEVICE_HANDLE
*
hDevice
)
FUNCTION
extern
INT16
CALL_CONV
profi_end
(
VOID
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -389,8 +345,7 @@ FUNCTION extern INT16 CALL_CONV profi_end(IN T_PROFI_DEVICE_HANDLE* hDevice)
;
FUNCTION
extern
INT16
CALL_CONV
profi_snd_req_res
(
IN
T_PROFI_DEVICE_HANDLE
*
hDevice
,
IN
T_PROFI_SERVICE_DESCR
*
pSdb
,
IN
VOID
*
pData
,
IN
PB_BOOL
dummy
)
IN
T_PROFI_SERVICE_DESCR
*
pSdb
,
IN
VOID
*
pData
,
IN
PB_BOOL
dummy
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -426,9 +381,9 @@ FUNCTION extern INT16 CALL_CONV profi_snd_req_res(
----------------------------------------------------------------------------*/
;
FUNCTION
extern
INT16
CALL_CONV
profi_rcv_con_ind
(
IN
T_PROFI_DEVICE_HANDLE
*
hDevice
,
OUT
T_PROFI_SERVICE_DESCR
*
pSdb
,
OUT
VOID
*
pData
,
INOUT
USIGN16
*
pDataLength
)
FUNCTION
extern
INT16
CALL_CONV
profi_rcv_con_ind
(
OUT
T_PROFI_SERVICE_DESCR
*
pSdb
,
OUT
VOID
*
pData
,
INOUT
USIGN16
*
pDataLength
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -455,9 +410,10 @@ FUNCTION extern INT16 CALL_CONV profi_rcv_con_ind(
----------------------------------------------------------------------------*/
;
FUNCTION
extern
INT16
CALL_CONV
profi_set_data
(
IN
T_PROFI_DEVICE_HANDLE
*
hDevice
,
IN
USIGN8
DataId
,
IN
USIGN16
Offset
,
IN
USIGN16
DataLength
,
IN
VOID
*
pData
)
FUNCTION
extern
INT16
CALL_CONV
profi_set_data
(
IN
USIGN8
DataId
,
IN
USIGN16
Offset
,
IN
USIGN16
DataLength
,
IN
VOID
*
pData
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -485,9 +441,10 @@ FUNCTION extern INT16 CALL_CONV profi_set_data(
-----------------------------------------------------------------------------*/
;
FUNCTION
extern
INT16
CALL_CONV
profi_get_data
(
IN
T_PROFI_DEVICE_HANDLE
*
hDevice
,
IN
USIGN8
DataId
,
IN
USIGN16
Offset
,
INOUT
USIGN16
*
pDataLength
,
OUT
VOID
*
pData
)
FUNCTION
extern
INT16
CALL_CONV
profi_get_data
(
IN
USIGN8
DataId
,
IN
USIGN16
Offset
,
INOUT
USIGN16
*
pDataLength
,
OUT
VOID
*
pData
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -515,8 +472,8 @@ FUNCTION extern INT16 CALL_CONV profi_get_data(
-----------------------------------------------------------------------------*/
;
FUNCTION
extern
INT16
CALL_CONV
profi_set_dps_input_data
(
IN
T_PROFI_DEVICE_HANDLE
*
hDevice
,
IN
USIGN8
*
pData
,
IN
USIGN8
DataLength
,
FUNCTION
extern
INT16
CALL_CONV
profi_set_dps_input_data
(
IN
USIGN8
*
pData
,
IN
USIGN8
DataLength
,
OUT
USIGN8
*
pState
)
/*-----------------------------------------------------------------------------
...
...
@@ -540,8 +497,7 @@ FUNCTION extern INT16 CALL_CONV profi_set_dps_input_data(
;
FUNCTION
extern
INT16
CALL_CONV
profi_get_dps_input_data
(
IN
T_PROFI_DEVICE_HANDLE
*
hDevice
,
OUT
USIGN8
*
pData
,
INOUT
USIGN8
*
pDataLength
,
OUT
USIGN8
*
pState
)
OUT
USIGN8
*
pData
,
INOUT
USIGN8
*
pDataLength
,
OUT
USIGN8
*
pState
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -561,8 +517,7 @@ FUNCTION extern INT16 CALL_CONV profi_get_dps_input_data(
;
FUNCTION
extern
INT16
CALL_CONV
profi_get_dps_output_data
(
IN
T_PROFI_DEVICE_HANDLE
*
hDevice
,
OUT
USIGN8
*
pData
,
INOUT
USIGN8
*
pDataLength
,
OUT
USIGN8
*
pState
)
OUT
USIGN8
*
pData
,
INOUT
USIGN8
*
pDataLength
,
OUT
USIGN8
*
pState
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -583,9 +538,8 @@ FUNCTION extern INT16 CALL_CONV profi_get_dps_output_data(
-----------------------------------------------------------------------------*/
;
FUNCTION
extern
INT16
CALL_CONV
profi_get_versions
(
IN
T_PROFI_DEVICE_HANDLE
*
hDevice
,
OUT
CSTRING
*
pPapiVersion
,
OUT
CSTRING
*
pFirmwareVersion
)
FUNCTION
extern
INT16
CALL_CONV
profi_get_versions
(
OUT
CSTRING
*
pPapiVersion
,
OUT
CSTRING
*
pFirmwareVersion
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -604,8 +558,8 @@ FUNCTION extern INT16 CALL_CONV profi_get_versions(
-----------------------------------------------------------------------------*/
;
FUNCTION
extern
INT16
CALL_CONV
profi_get_serial_device_number
(
IN
T_PROFI_DEVICE_HANDLE
*
hDevice
,
OUT
USIGN32
*
pSerialDeviceNumber
)
FUNCTION
extern
INT16
CALL_CONV
profi_get_serial_device_number
(
OUT
USIGN32
*
pSerialDeviceNumber
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -686,7 +640,9 @@ FUNCTION extern HANDLE CALL_CONV profi_open_basic_management(
;
FUNCTION
extern
HANDLE
CALL_CONV
profi_open
(
IN
HANDLE
hBasicMgmtDevice
,
IN
INT32
DeviceType
,
IN
USIGN32
Index
,
IN
INT32
DesiredAccess
)
IN
INT32
DeviceType
,
IN
USIGN32
Index
,
IN
INT32
DesiredAccess
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -737,9 +693,9 @@ FUNCTION extern BOOL CALL_CONV profi_close(IN HANDLE hDevice)
-----------------------------------------------------------------------------*/
;
FUNCTION
extern
INT16
CALL_CONV
profi_read_service
(
IN
HANDLE
hDevice
,
OUT
T_PROFI_SERVICE_DESCR
*
pSdb
,
OUT
VOID
*
pData
,
INOUT
USIGN16
*
pDataLength
)
FUNCTION
extern
INT16
CALL_CONV
profi_read_service
(
IN
HANDLE
hDevice
,
OUT
T_PROFI_SERVICE_DESCR
*
pSdb
,
OUT
VOID
*
pData
,
INOUT
USIGN16
*
pDataLength
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -840,8 +796,9 @@ FUNCTION extern INT16 CALL_CONV profi_read_multi(
-----------------------------------------------------------------------------*/
;
FUNCTION
extern
INT16
CALL_CONV
profi_read_data
(
IN
HANDLE
hDevice
,
OUT
VOID
*
pData
,
OUT
USIGN16
*
pDataLength
)
FUNCTION
extern
INT16
CALL_CONV
profi_read_data
(
IN
HANDLE
hDevice
,
OUT
VOID
*
pData
,
OUT
USIGN16
*
pDataLength
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -867,8 +824,9 @@ FUNCTION extern INT16 CALL_CONV profi_read_data(
-----------------------------------------------------------------------------*/
;
FUNCTION
extern
INT16
CALL_CONV
profi_write_data
(
IN
HANDLE
hDevice
,
IN
VOID
*
pData
,
IN
USIGN16
DataLength
)
FUNCTION
extern
INT16
CALL_CONV
profi_write_data
(
IN
HANDLE
hDevice
,
IN
VOID
*
pData
,
IN
USIGN16
DataLength
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -894,7 +852,9 @@ FUNCTION extern INT16 CALL_CONV profi_write_data(
;
FUNCTION
extern
INT16
CALL_CONV
profi_read_dps_data
(
IN
HANDLE
hDevice
,
OUT
USIGN8
*
pData
,
INOUT
USIGN8
*
pDataLength
,
OUT
USIGN8
*
pState
)
OUT
USIGN8
*
pData
,
INOUT
USIGN8
*
pDataLength
,
OUT
USIGN8
*
pState
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -922,7 +882,9 @@ FUNCTION extern INT16 CALL_CONV profi_read_dps_data(IN HANDLE hDevice,
;
FUNCTION
extern
INT16
CALL_CONV
profi_write_dps_data
(
IN
HANDLE
hDevice
,
IN
USIGN8
*
pData
,
IN
USIGN8
DataLength
,
OUT
USIGN8
*
pState
)
IN
USIGN8
*
pData
,
IN
USIGN8
DataLength
,
OUT
USIGN8
*
pState
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -944,8 +906,9 @@ FUNCTION extern INT16 CALL_CONV profi_write_dps_data(IN HANDLE hDevice,
-----------------------------------------------------------------------------*/
;
FUNCTION
extern
BOOL
CALL_CONV
profi_get_cntrl_info
(
IN
USIGN8
Board
,
OUT
char
*
pFirmwareVersion
,
OUT
USIGN32
*
pSerialDeviceNumber
)
FUNCTION
extern
BOOL
CALL_CONV
profi_get_cntrl_info
(
IN
USIGN8
Board
,
OUT
char
*
pFirmwareVersion
,
OUT
USIGN32
*
pSerialDeviceNumber
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -967,8 +930,9 @@ FUNCTION extern BOOL CALL_CONV profi_get_cntrl_info(IN USIGN8 Board,
-----------------------------------------------------------------------------*/
;
FUNCTION
extern
BOOL
CALL_CONV
profi_set_timeout
(
IN
HANDLE
hBasicMgmtDevice
,
IN
USIGN32
ReadTimeout
,
IN
USIGN32
WriteTimeout
)
FUNCTION
extern
BOOL
CALL_CONV
profi_set_timeout
(
IN
HANDLE
hBasicMgmtDevice
,
IN
USIGN32
ReadTimeout
,
IN
USIGN32
WriteTimeout
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -990,7 +954,8 @@ FUNCTION extern BOOL CALL_CONV profi_set_timeout(
;
FUNCTION
extern
BOOL
CALL_CONV
profi_get_timeout
(
IN
HANDLE
hBasicMgmtDevice
,
OUT
USIGN32
*
pReadTimeout
,
OUT
USIGN32
*
pWriteTimeout
)
OUT
USIGN32
*
pReadTimeout
,
OUT
USIGN32
*
pWriteTimeout
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -1011,8 +976,8 @@ FUNCTION extern BOOL CALL_CONV profi_get_timeout(IN HANDLE hBasicMgmtDevice,
-----------------------------------------------------------------------------*/
;
FUNCTION
extern
BOOL
CALL_CONV
profi_set_queue_size
(
IN
HANDLE
hBasicMgmtDevice
,
IN
USIGN32
QueueSize
)
FUNCTION
extern
BOOL
CALL_CONV
profi_set_queue_size
(
IN
HANDLE
hBasicMgmtDevice
,
IN
USIGN32
QueueSize
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -1029,8 +994,8 @@ FUNCTION extern BOOL CALL_CONV profi_set_queue_size(
-----------------------------------------------------------------------------*/
;
FUNCTION
extern
BOOL
CALL_CONV
profi_get_queue_size
(
IN
HANDLE
hBasicMgmtDevice
,
OUT
USIGN32
*
pQueueSize
)
FUNCTION
extern
BOOL
CALL_CONV
profi_get_queue_size
(
IN
HANDLE
hBasicMgmtDevice
,
OUT
USIGN32
*
pQueueSize
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -1047,8 +1012,8 @@ FUNCTION extern BOOL CALL_CONV profi_get_queue_size(
-----------------------------------------------------------------------------*/
;
FUNCTION
extern
BOOL
CALL_CONV
profi_get_overrun_count
(
IN
HANDLE
hBasicMgmtDevice
,
OUT
USIGN32
*
pOverrunCount
)
FUNCTION
extern
BOOL
CALL_CONV
profi_get_overrun_count
(
IN
HANDLE
hBasicMgmtDevice
,
OUT
USIGN32
*
pOverrunCount
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
profibus/lib/rt/src/pb_ioctl.h
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/
/* */
/*
SOFTING AG
*/
/*
SOFTING Industrial Automation GmbH
*/
/* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */
/* */
/*
Copyright (C) SOFTING AG 1995-2003
*/
/*
Copyright (C) SOFTING Industrial Automation GmbH 1995-2012
*/
/* All Rights Reserved */
/* */
/*****************************************************************************/
/*****************************************************************************/
/*
PROFIBUS WINDOWS NT DRIVERS
*/
/*
PROFIBUS LINUX DRIVERS
*/
/* */
/* Filename : PB_IOCTL.H */
/* Version : 5.
26.0.01
.release */
/* Date :
30-April-2003
*/
/* Author : SOFTING
AG
*/
/* Version : 5.
45.0.00
.release */
/* Date :
December-2009
*/
/* Author : SOFTING
*/
/* */
/* Description : This file contains the global declarations */
/* to access the PROFIBUS Drivers for Linux */
...
...
@@ -77,33 +42,43 @@
#define IOCTL_PROFI_SET_DEBUGLEVEL 0x6909
#ifdef __KERNEL__
extern
int
pb_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32)
long
pb_ioctl
(
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
);
#else
int
pb_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
);
#endif
#endif
/*****************************************************************************/
/* Structure for data image description */
/*****************************************************************************/
typedef
struct
_StatusAndData
{
// #pragma pack(push,1)
typedef
struct
_StatusAndData
{
void
*
StatusImage
;
int
StatusLength
;
__s32
StatusLength
;
void
*
Data
;
int
DataLength
;
}
StatusAndData
;
__s32
DataLength
;
}
__attribute__
((
aligned
(
8
)))
StatusAndData
;
typedef
struct
_NTIoctl
{
typedef
struct
_NTIoctl
{
void
*
InBuf
;
int
InBufLength
;
__s32
InBufLength
;
void
*
OutBuf
;
int
OutBufLength
;
}
NTIoctl
;
__s32
OutBufLength
;
}
__attribute__
((
aligned
(
8
)))
NTIoctl
;
typedef
struct
_DataImage
{
int
id
;
typedef
struct
_DataImage
{
__s32
id
;
void
*
Buf
;
unsigned
short
Length
;
// sizeof( Buf )
}
DataImage
;
__u16
Length
;
// sizeof( Buf )
}
__attribute__
((
aligned
(
8
)))
DataImage
;
// #pragma pack(pop)
/*****************************************************************************/
/* Operation Mode as (FMS/DPV1-Master or DP-Slave) */
...
...
profibus/lib/rt/src/pb_ntdrv.h
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/
/* */
/*
SOFTING AG
*/
/*
SOFTING Industrial Automation GmbH
*/
/* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */
/* */
/*
Copyright (C) SOFTING AG 1995-2003
*/
/*
Copyright (C) SOFTING Industrial Automation GmbH 1995-2012
*/
/* All Rights Reserved */
/* */
/*****************************************************************************/
/*****************************************************************************/
/*
PROFIBUS WINDOWS NT DRIVERS
*/
/*
PROFIBUS LINUX DRIVERS
*/
/* */
/* Filename : PB_NTDRV.H */
/* Version : 5.
26.0.01
.release */
/* Date :
30-April-2003
*/
/* Author : SOFTING
AG
*/
/* Version : 5.
45.0.00
.release */
/* Date :
December-2009
*/
/* Author : SOFTING
*/
/* */
/* Description : This file contains the global declarations */
/* to access the PROFIBUS Drivers for
Windows NT
*/
/* to access the PROFIBUS Drivers for
Linux
*/
/* */
/*****************************************************************************/
...
...
@@ -72,66 +37,66 @@
#define FILE_DEVICE_PROFIBOARD 0x8000
#define IOCTL_PROFI_CREATE_DP_MANAGEMENT \
(ULONG) CTL_CODE(
\
FILE_DEVICE_PROFIBOARD, 0x800, METHOD_BUFFERED,
FILE_ANY_ACCESS)
(ULONG) CTL_CODE(
FILE_DEVICE_PROFIBOARD, 0x800, METHOD_BUFFERED,
\
FILE_ANY_ACCESS)
#define IOCTL_PROFI_CREATE_DP_SERVICE \
(ULONG) CTL_CODE(
\
FILE_DEVICE_PROFIBOARD, 0x801, METHOD_BUFFERED,
FILE_ANY_ACCESS)
(ULONG) CTL_CODE(
FILE_DEVICE_PROFIBOARD, 0x801, METHOD_BUFFERED,
\
FILE_ANY_ACCESS)
#define IOCTL_PROFI_CREATE_DP_SLAVE_DATA \
(ULONG) CTL_CODE(
\
FILE_DEVICE_PROFIBOARD, 0x802, METHOD_BUFFERED,
FILE_ANY_ACCESS)
(ULONG) CTL_CODE(
FILE_DEVICE_PROFIBOARD, 0x802, METHOD_BUFFERED,
\
FILE_ANY_ACCESS)
#define IOCTL_PROFI_CREATE_FDL_MANAGEMENT \
(ULONG) CTL_CODE(
\
FILE_DEVICE_PROFIBOARD, 0x803, METHOD_BUFFERED,
FILE_ANY_ACCESS)
(ULONG) CTL_CODE(
FILE_DEVICE_PROFIBOARD, 0x803, METHOD_BUFFERED,
\
FILE_ANY_ACCESS)
#define IOCTL_PROFI_CREATE_FDL_SAP \
(ULONG) CTL_CODE(
\
FILE_DEVICE_PROFIBOARD, 0x804, METHOD_BUFFERED,
FILE_ANY_ACCESS)
(ULONG) CTL_CODE(
FILE_DEVICE_PROFIBOARD, 0x804, METHOD_BUFFERED,
\
FILE_ANY_ACCESS)
#define IOCTL_PROFI_CREATE_FMS_MANAGEMENT \
(ULONG) CTL_CODE(
\
FILE_DEVICE_PROFIBOARD, 0x805, METHOD_BUFFERED,
FILE_ANY_ACCESS)
(ULONG) CTL_CODE(
FILE_DEVICE_PROFIBOARD, 0x805, METHOD_BUFFERED,
\
FILE_ANY_ACCESS)
#define IOCTL_PROFI_CREATE_FMS_CR \
(ULONG) CTL_CODE(
\
FILE_DEVICE_PROFIBOARD, 0x806, METHOD_BUFFERED,
FILE_ANY_ACCESS)
(ULONG) CTL_CODE(
FILE_DEVICE_PROFIBOARD, 0x806, METHOD_BUFFERED,
\
FILE_ANY_ACCESS)
#define IOCTL_PROFI_CREATE_DP_MSAC \
(ULONG) CTL_CODE(
\
FILE_DEVICE_PROFIBOARD, 0x80e, METHOD_BUFFERED,
FILE_ANY_ACCESS)
(ULONG) CTL_CODE(
FILE_DEVICE_PROFIBOARD, 0x80e, METHOD_BUFFERED,
\
FILE_ANY_ACCESS)
#define IOCTL_PROFI_SET_TIMEOUT \
(ULONG) CTL_CODE(
\
FILE_DEVICE_PROFIBOARD, 0x808, METHOD_BUFFERED,
FILE_READ_ACCESS)
(ULONG) CTL_CODE(
FILE_DEVICE_PROFIBOARD, 0x808, METHOD_BUFFERED,
\
FILE_READ_ACCESS)
#define IOCTL_PROFI_GET_TIMEOUT \
(ULONG) CTL_CODE(
\
FILE_DEVICE_PROFIBOARD, 0x809, METHOD_BUFFERED,
FILE_ANY_ACCESS)
(ULONG) CTL_CODE(
FILE_DEVICE_PROFIBOARD, 0x809, METHOD_BUFFERED,
\
FILE_ANY_ACCESS)
#define IOCTL_PROFI_SET_QUEUE_SIZE \
(ULONG) CTL_CODE(
\
FILE_DEVICE_PROFIBOARD, 0x80a, METHOD_BUFFERED,
FILE_ANY_ACCESS)
(ULONG) CTL_CODE(
FILE_DEVICE_PROFIBOARD, 0x80a, METHOD_BUFFERED,
\
FILE_ANY_ACCESS)
#define IOCTL_PROFI_GET_QUEUE_SIZE \
(ULONG) CTL_CODE(
\
FILE_DEVICE_PROFIBOARD, 0x80b, METHOD_BUFFERED,
FILE_ANY_ACCESS)
(ULONG) CTL_CODE(
FILE_DEVICE_PROFIBOARD, 0x80b, METHOD_BUFFERED,
\
FILE_ANY_ACCESS)
#define IOCTL_PROFI_GET_OVERRUN_COUNT \
(ULONG) CTL_CODE(
\
FILE_DEVICE_PROFIBOARD, 0x80c, METHOD_BUFFERED,
FILE_ANY_ACCESS)
(ULONG) CTL_CODE(
FILE_DEVICE_PROFIBOARD, 0x80c, METHOD_BUFFERED,
\
FILE_ANY_ACCESS)
#define IOCTL_PROFI_READ_MULTI \
(ULONG) CTL_CODE(
\
FILE_DEVICE_PROFIBOARD, 0x80d, METHOD_BUFFERED,
FILE_ANY_ACCESS)
(ULONG) CTL_CODE(
FILE_DEVICE_PROFIBOARD, 0x80d, METHOD_BUFFERED,
\
FILE_ANY_ACCESS)
#define IOCTL_PROFI_GET_DATA_IMAGE \
(ULONG) CTL_CODE(
\
FILE_DEVICE_PROFIBOARD, 0x80f, METHOD_BUFFERED,
FILE_ANY_ACCESS)
(ULONG) CTL_CODE(
FILE_DEVICE_PROFIBOARD, 0x80f, METHOD_BUFFERED,
\
FILE_ANY_ACCESS)
#define IOCTL_PROFI_SET_DPS_DATA \
(ULONG) CTL_CODE(
\
FILE_DEVICE_PROFIBOARD, 0x810, METHOD_IN_DIRECT,
FILE_ANY_ACCESS)
(ULONG) CTL_CODE(
FILE_DEVICE_PROFIBOARD, 0x810, METHOD_IN_DIRECT,
\
FILE_ANY_ACCESS)
#define IOCTL_PROFI_SET_DP_BITS \
(ULONG) CTL_CODE(
\
FILE_DEVICE_PROFIBOARD, 0x811, METHOD_BUFFERED,
FILE_WRITE_ACCESS)
(ULONG) CTL_CODE(
FILE_DEVICE_PROFIBOARD, 0x811, METHOD_BUFFERED,
\
FILE_WRITE_ACCESS)
#define IOCTL_PROFI_CLEAR_DP_BITS \
(ULONG) CTL_CODE(
\
FILE_DEVICE_PROFIBOARD, 0x812, METHOD_BUFFERED,
FILE_WRITE_ACCESS)
(ULONG) CTL_CODE(
FILE_DEVICE_PROFIBOARD, 0x812, METHOD_BUFFERED,
\
FILE_WRITE_ACCESS)
#define IOCTL_PROFI_CHECK_DEV_CONN \
(ULONG) CTL_CODE(
\
FILE_DEVICE_PROFIBOARD, 0x813, METHOD_BUFFERED,
FILE_ANY_ACCESS)
(ULONG) CTL_CODE(
FILE_DEVICE_PROFIBOARD, 0x813, METHOD_BUFFERED,
\
FILE_ANY_ACCESS)
/*****************************************************************************/
/* Macros to access for PROFIBUS specific error codes */
...
...
@@ -153,7 +118,8 @@
#define WAIT_FOREVER ((ULONG)-1)
typedef
struct
_PROFI_TIMEOUT
{
typedef
struct
_PROFI_TIMEOUT
{
ULONG
TimeoutRead
;
ULONG
TimeoutWrite
;
}
PROFI_TIMEOUT
,
T_PROFI_TIMEOUT
;
...
...
@@ -162,7 +128,8 @@ typedef struct _PROFI_TIMEOUT {
/* Structure for data image description */
/*****************************************************************************/
typedef
struct
_PROFI_DATA_IMAGE_DESCR
{
typedef
struct
_PROFI_DATA_IMAGE_DESCR
{
UCHAR
imageId
;
USHORT
offset
;
UCHAR
bus
;
...
...
@@ -172,7 +139,8 @@ typedef struct _PROFI_DATA_IMAGE_DESCR {
/* Structure for bit access in DP output data */
/*****************************************************************************/
typedef
struct
_PROFI_DP_BIT_ACCESS
{
typedef
struct
_PROFI_DP_BIT_ACCESS
{
USHORT
offset
;
UCHAR
mask
;
}
PROFI_DP_BIT_ACCESS
,
T_PROFI_DP_BIT_ACCESS
;
...
...
profibus/lib/rt/src/pb_tools.h
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/
/* */
/*
SOFTING AG
*/
/*
SOFTING Industrial Automation GmbH
*/
/* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */
/* */
/*
Copyright (C) SOFTING AG 1995-2003
*/
/*
Copyright (C) SOFTING Industrial Automation GmbH 1995-2012
*/
/* All Rights Reserved */
/* */
/*****************************************************************************/
...
...
@@ -50,8 +15,8 @@
/* */
/* Filename : PB_TOOLS.H */
/* Version : 5.21.0.00.release */
/* Date :
27-February-1998
*/
/* Author : SOFTING
AG
*/
/* Date :
February-1998
*/
/* Author : SOFTING
*/
/* */
/* Description : This file contains the global function declarations, */
/* defines and types of the PROFIBUS-TOOLS-Interface */
...
...
@@ -79,8 +44,8 @@ extern "C" {
/*----- function prototypes to get default busparameters -------------------*/
#ifdef __PB_DP__
FUNCTION
extern
PB_BOOL
CALL_CONV
pbt_get_dp_def_bus_param
(
IN
USIGN8
BaudRate
,
IN
USIGN8
StationAddr
,
IN
USIGN16
Mode
,
FUNCTION
extern
PB_BOOL
CALL_CONV
pbt_get_dp_def_bus_param
(
IN
USIGN8
BaudRate
,
IN
USIGN8
StationAddr
,
IN
USIGN16
Mode
,
OUT
T_DP_BUS_PARA_SET
FAR
*
pBusParameters
)
/*----------------------------------------------------------------------------
...
...
@@ -158,9 +123,9 @@ FUNCTION extern PB_BOOL CALL_CONV pbt_get_fdlif_def_bus_param(
#endif
#ifdef __PB_FMB__
FUNCTION
extern
PB_BOOL
CALL_CONV
pbt_get_fmb_def_bus_param
(
IN
USIGN8
BaudRate
,
IN
USIGN8
StationAddr
,
IN
PB_BOOL
InRingDesired
,
IN
USIGN16
Mode
,
OUT
T_FMB_SET_BUSPARAMETER_REQ
FAR
*
pBusParameters
)
FUNCTION
extern
PB_BOOL
CALL_CONV
pbt_get_fmb_def_bus_param
(
IN
USIGN8
BaudRate
,
IN
USIGN8
StationAddr
,
IN
PB_BOOL
InRingDesired
,
IN
USIGN16
Mode
,
OUT
T_FMB_SET_BUSPARAMETER_REQ
FAR
*
pBusParameters
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -200,8 +165,9 @@ FUNCTION extern VOID CALL_CONV ccrl_resrces_init(IN T_CRL_HDR FAR* pCrlHdr)
----------------------------------------------------------------------------*/
;
FUNCTION
extern
USIGN16
CALL_CONV
ccrl_resrces_add_entry
(
IN
USIGN16
Cr
,
IN
T_CRL_STATIC
FAR
*
pCrlStatic
,
OUT
T_FMB_CONFIG_CRL
FAR
*
pCrlConfig
)
FUNCTION
extern
USIGN16
CALL_CONV
ccrl_resrces_add_entry
(
IN
USIGN16
Cr
,
IN
T_CRL_STATIC
FAR
*
pCrlStatic
,
OUT
T_FMB_CONFIG_CRL
FAR
*
pCrlConfig
)
/*------------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
profibus/lib/rt/src/pb_type.h
View file @
ce758cd3
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* 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 ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/
/* */
/*
SOFTING AG
*/
/*
SOFTING Industrial Automation GmbH
*/
/* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */
/* */
/*
Copyright (C) SOFTING AG 1995-2003
*/
/*
Copyright (C) SOFTING Industrial Automation GmbH 1995-2012
*/
/* All Rights Reserved */
/* */
/*****************************************************************************/
...
...
@@ -50,8 +15,8 @@
/* */
/* Filename : PB_TYPE.H */
/* Version : 5.22.0.00.release */
/* Date :
26-February-1999
*/
/* Author : SOFTING
AG
*/
/* Date :
February-1999
*/
/* Author : SOFTING
*/
/* */
/* Description : This file contains the PROFIBUS basic types */
/* */
...
...
@@ -60,6 +25,10 @@
#ifndef __PB_TYPE__
#define __PB_TYPE__
#ifdef _LINUX
#include <linux/types.h>
#endif
#include "pb_conf.h"
/* PAPI configuration parameters */
#ifndef NULL
...
...
@@ -84,7 +53,7 @@ typedef unsigned char PB_BOOL;
typedef
unsigned
char
OCTET
;
typedef
unsigned
char
USIGN8
;
typedef
unsigned
short
USIGN16
;
typedef
unsigned
long
USIGN32
;
typedef
__u32
USIGN32
;
typedef
signed
char
INT8
;
typedef
signed
short
INT16
;
...
...
@@ -92,7 +61,7 @@ typedef signed short INT16;
#ifdef WIN32
typedef
int
INT32
;
#else
typedef
signed
long
INT32
;
typedef
__s32
INT32
;
#endif
#ifdef _LINUX
...
...
profibus/wbl/mcomp/src/profibus.wb_load
View file @
ce758cd3
...
...
@@ -2150,13 +2150,15 @@ Volume Profibus $ClassVolume 0.0.250.7
EndObject
EndObject
!/**
! @Author Claes Jurstrand
! @Version 1.
0
! @Author Claes Jurstrand
/Marcus Nordenberg
! @Version 1.
1
! @Group Profibus
! @Summary Configurates a Profibus PCI master card (Softing profiboard)
! Configurates a Profibus PCI master card (Softing Profiboard). Available on LynxOS and Linux.
! The object should be named Px, where x is the number of the device, eg P1.
! You can have maximum two buses (master cards) on each system.
! You can have maximum two buses (master cards) on each system. The latest API from Softing
! can only handle one board per process. So you have to make sure to select PlcThread
! objects from different PlcProcess objects.
!*/
Object Pb_Profiboard $ClassDef 13 16-JAN-2006 09:46:40.51
Body SysBody 16-JAN-2006 09:46:40.51
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment