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
ec025559
Commit
ec025559
authored
Jun 26, 2019
by
Marcus Nordenberg
Committed by
Claes Sjöfors
Mar 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update profibus api
parent
655f779b
Changes
29
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
2087 additions
and
2958 deletions
+2087
-2958
profibus/lib/rt/src/Papi.c
profibus/lib/rt/src/Papi.c
+344
-699
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
+103
-123
profibus/lib/rt/src/dpm_user.h
profibus/lib/rt/src/dpm_user.h
+2
-2
profibus/lib/rt/src/dpsgdl.c
profibus/lib/rt/src/dpsgdl.c
+46
-76
profibus/lib/rt/src/fdlgdl.c
profibus/lib/rt/src/fdlgdl.c
+34
-60
profibus/lib/rt/src/fm7gdl.c
profibus/lib/rt/src/fm7gdl.c
+57
-73
profibus/lib/rt/src/fmbgdl.c
profibus/lib/rt/src/fmbgdl.c
+39
-62
profibus/lib/rt/src/fmsgdl.c
profibus/lib/rt/src/fmsgdl.c
+180
-146
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
+30
-63
profibus/lib/rt/src/pb_conf.h
profibus/lib/rt/src/pb_conf.h
+9
-45
profibus/lib/rt/src/pb_dp.h
profibus/lib/rt/src/pb_dp.h
+11
-46
profibus/lib/rt/src/pb_dps.h
profibus/lib/rt/src/pb_dps.h
+11
-42
profibus/lib/rt/src/pb_err.h
profibus/lib/rt/src/pb_err.h
+35
-69
profibus/lib/rt/src/pb_fdl.h
profibus/lib/rt/src/pb_fdl.h
+4
-39
profibus/lib/rt/src/pb_fm7.h
profibus/lib/rt/src/pb_fm7.h
+5
-40
profibus/lib/rt/src/pb_fmb.h
profibus/lib/rt/src/pb_fmb.h
+4
-39
profibus/lib/rt/src/pb_fms.h
profibus/lib/rt/src/pb_fms.h
+4
-39
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
+55
-107
profibus/lib/rt/src/pb_ioctl.h
profibus/lib/rt/src/pb_ioctl.h
+24
-52
profibus/lib/rt/src/pb_ntdrv.h
profibus/lib/rt/src/pb_ntdrv.h
+7
-42
profibus/lib/rt/src/pb_tools.h
profibus/lib/rt/src/pb_tools.h
+4
-39
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 @
ec025559
/*
* 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
);
}
...
...
@@ -504,7 +504,7 @@ RES
{
LOCAL_VARIABLES
INT16
RetVal
;
// return value
INT16
RetVal
;
// return value
INT16
DataLength
;
// size of DATABLOCK
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
DWORD
BytesWritten
;
...
...
@@ -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
);
}
...
...
@@ -578,13 +582,13 @@ RES
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
// write SDB and DATABLOCK
if
(
!
WriteFile
((
HANDLE
)
hDevice
,
(
LPVOID
)
pSdbData
,
(
DWORD
)(
DataLength
+
sizeof
(
T_PROFI_SERVICE_DESCR
)),
(
LPDWORD
)
&
BytesWritten
,
NULL
))
(
DWORD
)(
DataLength
+
sizeof
(
T_PROFI_SERVICE_DESCR
)),
(
LPDWORD
)
&
BytesWritten
,
NULL
))
#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,22 +643,25 @@ 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
);
}
// --- read service data from device
if
(
!
DeviceIoControl
((
HANDLE
)
*
phDevices
,
(
DWORD
)
IOCTL_PROFI_READ_MULTI
,
(
LPVOID
)
phDevices
,
(
DWORD
)
NrOfHandles
*
sizeof
(
HANDLE
),
(
LPVOID
)
pSdbData
,
(
DWORD
)(
*
pDataLength
+
sizeof
(
T_PROFI_SERVICE_DESCR
)),
(
LPDWORD
)
&
BytesRead
,
NULL
))
{
(
LPVOID
)
phDevices
,
(
DWORD
)
NrOfHandles
*
sizeof
(
HANDLE
),
(
LPVOID
)
pSdbData
,
(
DWORD
)(
*
pDataLength
+
sizeof
(
T_PROFI_SERVICE_DESCR
)),
(
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
...
...
@@ -810,7 +734,7 @@ Possible return values:
// --- read DPS input/output data and status
if
(
ReadFile
(
hDevice
,
(
LPVOID
)
DataBuffer
,
(
DWORD
)(
*
pDataLength
+
1
),
(
LPDWORD
)
&
BytesRead
,
NULL
))
(
LPDWORD
)
&
BytesRead
,
NULL
))
#endif
#ifdef _LINUX
...
...
@@ -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
...
...
@@ -865,8 +794,8 @@ data size
// --- write DPS input data and read status
if
(
!
DeviceIoControl
((
HANDLE
)
hDevice
,
(
DWORD
)
IOCTL_PROFI_SET_DPS_DATA
,
(
LPVOID
)
pData
,
(
DWORD
)
DataLength
,
(
LPVOID
)
pState
,
(
DWORD
)
sizeof
(
USIGN8
),
(
LPDWORD
)
&
BytesReturned
,
NULL
))
(
LPVOID
)
pData
,
(
DWORD
)
DataLength
,
(
LPVOID
)
pState
,
(
DWORD
)
sizeof
(
USIGN8
),
(
LPDWORD
)
&
BytesReturned
,
NULL
))
#endif
#ifdef _LINUX
...
...
@@ -875,271 +804,31 @@ data size
SlaveInput
.
OutBuf
=
(
USIGN8
*
)
pData
;
SlaveInput
.
OutBufLength
=
DataLength
;
if
(
ioctl
(
hDevice
,
IOCTL_PROFI_SET_SLAVE_IN
,
&
SlaveInput
)
==
-
1
)
#endif
if
(
DataLength
)
{
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
);
FirstByte
=
pData
[
0
];
}
// printf("\nprofi_get_data: buf=%p, len=%u, size=%lu\n",
// SlaveInput.InBuf,
// SlaveInput.InBufLength,
// sizeof(SlaveInput));
// --- 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
));
}
if
(
ioctl
(
hDevice
,
IOCTL_PROFI_SET_SLAVE_IN
,
&
SlaveInput
)
==
-
1
)
#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
);
{
return
(
papi_get_last_error
());
}
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,55 +872,63 @@ 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
// 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
);
}
// Open service device for write access
hServiceWriteDevice
=
CreateFile
(
DeviceName
,
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
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
);
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
;
...
...
@@ -1257,12 +959,14 @@ version
// get DP-Slave Output-Data device name
sprintf
(
DeviceName
,
"
\\\\
.
\\
PROFIBUS
\\
Board%u
\\
Pb%u
\\
DpSlaveOutputData"
,
Board
,
Channel
);
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
);
...
...
@@ -1278,9 +982,10 @@ version
ReadWriteTimeout
[
1
]
=
WriteTimeout
;
if
(
!
DeviceIoControl
((
HANDLE
)
hServiceReadDevice
,
(
DWORD
)
IOCTL_PROFI_SET_TIMEOUT
,
(
LPVOID
)
ReadWriteTimeout
,
(
DWORD
)
2
*
sizeof
(
USIGN32
),
(
LPVOID
)
NULL
,
(
DWORD
)
0
,
(
LPDWORD
)
&
BytesReturned
,
NULL
))
{
(
DWORD
)
IOCTL_PROFI_SET_TIMEOUT
,
(
LPVOID
)
ReadWriteTimeout
,
(
DWORD
)
2
*
sizeof
(
USIGN32
),
(
LPVOID
)
NULL
,
(
DWORD
)
0
,
(
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,18 +1096,21 @@ version
FUNCTION_BODY
if
((
h
Device
->
hServiceReadDevice
&&
hDevice
->
hServiceWriteDevice
)
&&
(
hDevice
->
hDpDataDevice
||
(
hDevice
->
hDpsInputDataDevice
&&
hDevice
->
hDpsOutputDataDevice
)))
{
if
((
h
ServiceReadDevice
&&
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
...
...
@@ -1426,20 +1137,20 @@ version
{
LOCAL_VARIABLES
T_PROFI_DEVICE_HANDLE
hDevice
;
FUNCTION_BODY
if
((
h
Device
.
hServiceReadDevice
&&
hDevice
.
hServiceWriteDevice
)
&&
(
hDevice
.
hDpDataDevice
||
(
hDevice
.
hDpsInputDataDevice
&&
hDevice
.
hDpsOutputDataDevice
)))
{
if
((
h
ServiceReadDevice
&&
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
...
...
@@ -1457,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
...
...
@@ -1564,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
...
...
@@ -1600,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
...
...
@@ -1645,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)
...
...
@@ -1654,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
...
...
@@ -1673,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
...
...
@@ -1707,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
());
}
...
...
@@ -1774,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
;
}
...
...
@@ -1801,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
());
}
...
...
@@ -1832,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
;
...
...
@@ -1854,9 +1549,9 @@ 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
,
OUT
USIGN8
*
pState
)
FUNCTION
GLOBAL
INT16
CALL_CONV
profi_set_dps_input_data
(
IN
USIGN8
*
pData
,
IN
USIGN8
DataLength
,
OUT
USIGN8
*
pState
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -1881,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
...
...
@@ -1913,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
...
...
@@ -1947,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
...
...
@@ -1995,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'
)
...
...
@@ -2014,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
...
...
@@ -2039,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
)
...
...
@@ -2078,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 @
ec025559
/*
* 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 @
ec025559
/*
* 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 *
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone: ++49-89-4 56 56-0 *
* Fax: ++49-89-4 56 56-3 99 *
* *
* Copyright (C) SOFTING AG 1995-2003 *
* All Rights Reserved *
* *
******************************************************************************
/******************************************************************************
* *
* 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 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
;
...
...
@@ -542,11 +498,11 @@ possible return values:
bus_param_ptr
->
hsa
=
HSA
;
bus_param_ptr
->
bp_flag
=
0x00
;
bus_param_ptr
->
min_slave_interval
=
200
;
/* [100us] */
bus_param_ptr
->
poll_timeout
=
1000
;
/* [ 1ms] */
bus_param_ptr
->
data_control_time
=
100
;
/* [ 10ms] */
bus_param_ptr
->
poll_timeout
=
1000
;
/* [ 1ms] */
bus_param_ptr
->
data_control_time
=
100
;
/* [ 10ms] */
bus_param_ptr
->
master_user_data_len
=
34
;
memcpy
((
USIGN8
FAR
*
)
bus_param_ptr
->
master_class2_name
,
(
USIGN8
FAR
*
)
"SOFTING PROFIBUS DP MASTER "
,
32
);
(
USIGN8
FAR
*
)
"SOFTING PROFIBUS DP MASTER "
,
32
);
bus_param_ptr
->
bus_para_len
+=
bus_param_ptr
->
master_user_data_len
;
}
...
...
@@ -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 @
ec025559
/*
* 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 *
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone: ++49-89-4 56 56-0 *
* Fax: ++49-89-4 56 56-3 99 *
* *
* Copyright (C) SOFTING AG 1995-2003 *
* All Rights Reserved *
* *
******************************************************************************
/******************************************************************************
* *
* 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 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,19 +271,23 @@ 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
,
INOUT
T_CCRL_CONN_RESRCES
*
out_resrces_ptr
)
FUNCTION
LOCAL
VOID
ccrl_adapt_resrces
(
IN
T_CCRL_CONN_RESRCES
*
in_resrces_ptr
,
INOUT
T_CCRL_CONN_RESRCES
*
out_resrces_ptr
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -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
...
...
@@ -461,93 +436,97 @@ possible return values:
ci
=
crl_ptr
->
ci
;
multiplier
=
crl_ptr
->
multiplier
;
snd_req
=
0
;
/* (FAL + DATA) + FDL */
snd_req
=
0
;
/* (FAL + DATA) + FDL */
snd_req_csrd
=
0
;
/* (FAL + DATA) */
snd_req_srd
=
0
;
/* (FDL + DATA) */
snd_req_srd
=
0
;
/* (FDL + DATA) */
rcv_res
=
0
;
/* (FDL + DATA) */
rcv_ind
=
0
;
/* (FDL + DATA) + FAL */
rcv_ind
=
0
;
/* (FDL + DATA) + FAL */
rcv_ind_csrd
=
0
;
/* (FAL + DATA) */
snd_res_srd
=
0
;
/* (FDL + API) */
lli_api_resrc
=
0
;
/* (FAL + API) */
lli_api_resrc
=
0
;
/* (FAL + API) */
lli_api_snd_resrc
=
0
;
/* (FAL + API) + FDL */
lli_sr_snd_resrc
=
0
;
/* (FAL + DATA) + FDL */
lli_rcv_ind
=
0
;
/* (FDL + DATA) */
lli_sr_snd_resrc
=
0
;
/* (FAL + DATA) + FDL */
lli_rcv_ind
=
0
;
/* (FDL + DATA) */
lli_poll_elem
=
0
;
/* (POLL + API) + (FDL + DATA) */
lli_idm
=
0
;
/* (DATA) */
lli_idm
=
0
;
/* (DATA) */
lli_evt_resrc
=
0
;
/* (FAL + DATA) */
fdl_sap
=
0
;
/* (FDL) */
fdl_rsap
=
0
;
/* (DATA or FDL + DATA) */
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 */
(
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 */
+
1
/* LLI abort resrc */
);
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 */
(
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 */
fdl_sap
=
1
;
/* act/deact LSAP */
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 */
+
1
/* LLI abort resrc */
);
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 */
(
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 */
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 */
+
1
/* LLI abort resrc */
);
lli_api_resrc
=
(
USIGN8
)(
min
(
ci
,
1
)
/* snd IDLE_REQ_PDU */
+
1
/* LLI abort resrc */
);
snd_req_csrd
=
(
USIGN8
)(
MAX
(
1
,
/* snd ASS.req */
(
max_scc
/* snd DTC.req */
+
max_sac
))
/* snd DTA.req */
+
1
/* snd ABT.req */
);
snd_req_csrd
=
(
USIGN8
)(
max
(
1
,
/* snd ASS.req */
(
max_scc
/* snd DTC.req */
+
max_sac
))
/* snd DTA.req */
+
1
/* snd ABT.req */
);
snd_req_srd
=
max_sac
;
/* snd DTA.req (high) */
rcv_ind_csrd
=
(
USIGN8
)(
max_rac
/* rcv DTA_REQ_PDU */
+
1
/* rcv ABT_REQ_PDU */
);
+
1
/* rcv ABT_REQ_PDU */
);
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,69 +537,74 @@ 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 */
}
snd_req
=
(
USIGN8
)(
max_sac
/* snd DTA.req */
+
1
/* snd ABT.req */
);
+
1
/* snd ABT.req */
);
rcv_res
=
max_sac
;
/* rcv DTA_ACK_PDU */
lli_sr_snd_resrc
=
(
USIGN8
)(
MIN
(
ci
,
1
)
/* snd IDLE.req */
+
1
/* LLI abort resrc */
);
lli_sr_snd_resrc
=
(
USIGN8
)(
min
(
ci
,
1
)
/* snd IDLE.req */
+
1
/* LLI abort resrc */
);
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 */
);
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 */
+
2
/* rcv poll telegrams */
);
lli_rcv_ind
=
(
USIGN8
)(
min
(
ci
,
1
)
/* rcv IDLE_REQ_PDU */
+
2
/* rcv poll telegrams */
);
fdl_sap
=
1
;
/* act/deact LSAP */
break
;
case
S_CL
:
/* Broadcast/Multicast Sender ------------------------------------- */
snd_req
=
(
USIGN8
)
MAX
(
1
,
max_sac
);
/* snd DTU.req */
fdl_sap
=
1
;
/* act/deact LSAP */
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 */
fdl_sap
=
1
;
/* act/deact LSAP */
rcv_ind
=
(
USIGN8
)
max
(
1
,
max_rac
);
/* rcv DTU_REQ_PDU */
fdl_sap
=
1
;
/* act/deact LSAP */
break
;
default:
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 @
ec025559
...
...
@@ -59,16 +59,17 @@ Discription
#include "rcsdef.h"
#define INVALID_HANDLE_VALUE -1
int
hDevDrv
=
INVALID_HANDLE_VALUE
;
// handle to cifDevDrv
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
;
}
}
...
...
@@ -403,66 +454,83 @@ short DevReset(
<En> */
short
DevGetInfo
(
unsigned
short
usDevNumber
,
unsigned
short
usInfoArea
,
unsigned
short
usSize
,
void
*
pvData
)
unsigned
short
usSize
,
void
*
pvData
)
{
DEVIO_GETDEVINFOCMD
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
==
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
;
...
...
@@ -506,24 +577,34 @@ short DevGetInfo(unsigned short usDevNumber, unsigned short usInfoArea,
<En> */
short
DevPutTaskParameter
(
unsigned
short
usDevNumber
,
unsigned
short
usNumber
,
unsigned
short
usSize
,
void
*
pvData
)
unsigned
short
usSize
,
void
*
pvData
)
{
DEVIO_PUTPARAMETERCMD
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
((
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
...
...
@@ -531,13 +612,15 @@ short DevPutTaskParameter(unsigned short usDevNumber, unsigned short usNumber,
tBuffer
.
usTaskParamNum
=
usNumber
;
tBuffer
.
usTaskParamLen
=
usSize
;
memcpy
((
unsigned
char
*
)
&
(
tBuffer
.
TaskParameter
),
(
unsigned
char
*
)
pvData
,
usSize
);
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
;
...
...
@@ -560,24 +643,35 @@ short DevPutTaskParameter(unsigned short usDevNumber, unsigned short usNumber,
<En> */
short
DevGetTaskState
(
unsigned
short
usDevNumber
,
unsigned
short
usNumber
,
unsigned
short
usSize
,
void
*
pvData
)
unsigned
short
usSize
,
void
*
pvData
)
{
DEVIO_GETTASKSTATECMD
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
(
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
;
}
...
...
@@ -614,30 +711,38 @@ short DevGetTaskState(unsigned short usDevNumber, unsigned short usNumber,
<En> */
short
DevGetMBXState
(
unsigned
short
usDevNumber
,
unsigned
short
*
pusDevMbxState
,
unsigned
short
*
pusHostMbxState
)
unsigned
short
*
pusHostMbxState
)
{
DEVIO_MBXINFOCMD
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
tBuffer
.
ucBoard
=
usDevNumber
;
tBuffer
.
usDevMbxState
=
0x00
;
//*pusDevMbxState;
tBuffer
.
usDevMbxState
=
0x00
;
//*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
;
...
...
@@ -662,23 +767,31 @@ short DevGetMBXState(unsigned short usDevNumber, unsigned short* pusDevMbxState,
=================================================================================
<En> */
short
DevGetMBXData
(
unsigned
short
usDevNumber
,
unsigned
short
usHostSize
,
void
*
pvHostData
,
unsigned
short
usDevSize
,
void
*
pvDevData
)
void
*
pvHostData
,
unsigned
short
usDevSize
,
void
*
pvDevData
)
{
DEVIO_GETMBXCMD
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
((
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
;
...
...
@@ -687,9 +800,9 @@ short DevGetMBXData(unsigned short usDevNumber, unsigned short usHostSize,
tBuffer
.
usDevLen
=
usDevSize
;
tBuffer
.
sError
=
sRet
;
// activate function
if
(
!
ioctl
(
hDevDrv
,
// handle of the device
CIF_IOCTLGETMBX
,
// control code of operation to perform
(
unsigned
long
)(
&
tBuffer
)))
if
(
!
ioctl
(
hDevDrv
,
// handle of the device
CIF_IOCTLGETMBX
,
// control code of operation to perform
(
unsigned
long
)(
&
tBuffer
)))
/*, // address of buffer for input data
sizeof(tBuffer),
// size of input buffer
...
...
@@ -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,12 +869,15 @@ 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]
sRet
=
tBuffer
.
sError
;
// [out]
}
}
...
...
@@ -777,22 +900,29 @@ short DevExitBoard(unsigned short usDevNumber)
<En> */
short
DevReadSendData
(
unsigned
short
usDevNumber
,
unsigned
short
usOffset
,
unsigned
short
usSize
,
void
*
pvData
)
unsigned
short
usSize
,
void
*
pvData
)
{
DEVIO_READSENDCMD
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
!=
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
;
}
}
...
...
@@ -828,19 +961,26 @@ short DevReadSendData(unsigned short usDevNumber, unsigned short usOffset,
<En> */
short
DevTriggerWatchDog
(
unsigned
short
usDevNumber
,
unsigned
short
usMode
,
unsigned
short
*
pusDevWatchDog
)
unsigned
short
*
pusDevWatchDog
)
{
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
>
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
;
}
...
...
@@ -877,19 +1020,26 @@ short DevTriggerWatchDog(unsigned short usDevNumber, unsigned short usMode,
<En> */
short
DevSpecialControl
(
unsigned
short
usDevNumber
,
unsigned
short
usMode
,
unsigned
short
*
pusCtrlAck
)
unsigned
short
*
pusCtrlAck
)
{
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
(
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
;
}
...
...
@@ -926,23 +1079,34 @@ short DevSpecialControl(unsigned short usDevNumber, unsigned short usMode,
<En> */
short
DevExtendedData
(
unsigned
short
usDevNumber
,
unsigned
short
usMode
,
unsigned
short
usSize
,
void
*
pvData
)
unsigned
short
usSize
,
void
*
pvData
)
{
DEVIO_EXTDATACMD
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
==
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
;
...
...
@@ -983,24 +1149,35 @@ short DevExtendedData(unsigned short usDevNumber, unsigned short usMode,
<En> */
short
DevGetTaskParameter
(
unsigned
short
usDevNumber
,
unsigned
short
usNumber
,
unsigned
short
usSize
,
void
*
pvData
)
unsigned
short
usSize
,
void
*
pvData
)
{
DEVIO_GETPARAMETERCMD
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
((
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,12 +1187,15 @@ 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
);
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
;
...
...
@@ -1431,20 +1690,27 @@ short DevPutMessage(
<En> */
short
DevGetMessage
(
unsigned
short
usDevNumber
,
unsigned
short
usSize
,
MSG_STRUC
*
ptMessage
,
unsigned
long
ulTimeout
)
MSG_STRUC
*
ptMessage
,
unsigned
long
ulTimeout
)
{
DEVIO_GETMESSAGECMD
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
==
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
);
...
...
@@ -1648,26 +1941,33 @@ unsigned short CreateChecksum(
// Transfer messages
//----------------------------------------------------------------------------------------
short
TransferMessage
(
unsigned
short
usDevNumber
,
MSG_STRUC
*
ptSendMsg
,
MSG_STRUC
*
ptRecvMsg
,
long
lTimeout
)
MSG_STRUC
*
ptRecvMsg
,
long
lTimeout
)
{
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
//--------------------------
...
...
@@ -1971,14 +2291,14 @@ short RunConfigDownload(
// Set HOST_READY for download, maybe it is disabled
sRet
=
DevSetHostState
(
usDevNumber
,
HOST_READY
,
0L
);
// Insert data into message
tSendMsg
.
rx
=
RCS_TASK
;
// Receiver task number
tSendMsg
.
rx
=
RCS_TASK
;
// Receiver task number
tSendMsg
.
tx
=
MSG_SYSTEM_TX
;
// Transmitter task number
tSendMsg
.
ln
=
51
;
// Message length first message
tSendMsg
.
nr
=
1
;
// Message number
tSendMsg
.
a
=
0
;
// Answer byte cleared
tSendMsg
.
f
=
0
;
// Error byte cleared
tSendMsg
.
b
=
RCS_B_LOADFKT
;
// Function code
tSendMsg
.
e
=
RCS_FIRST_MSK
;
// First message
tSendMsg
.
ln
=
51
;
// Message length first message
tSendMsg
.
nr
=
1
;
// Message number
tSendMsg
.
a
=
0
;
// Answer byte cleared
tSendMsg
.
f
=
0
;
// Error byte cleared
tSendMsg
.
b
=
RCS_B_LOADFKT
;
// Function code
tSendMsg
.
e
=
RCS_FIRST_MSK
;
// First message
tSendMsg
.
data
[
0
]
=
MODE_DOWNLOAD_DBM
;
// Download a configuration file
// Copy buffer 1st to 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
{
dwState
=
RCS_LAST_MSK
;
// Set to last mask
}
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
);
...
...
@@ -2141,22 +2471,31 @@ short ConfigDownload(
<En> */
short
DevDownload
(
unsigned
short
usDevNumber
,
unsigned
short
usMode
,
unsigned
char
*
pszFileName
,
unsigned
long
*
pdwBytes
)
unsigned
char
*
pszFileName
,
unsigned
long
*
pdwBytes
)
{
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 @
ec025559
/*
* 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 *
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone: ++49-89-4 56 56-0 *
* Fax: ++49-89-4 56 56-3 99 *
* *
* Copyright (C) SOFTING AG 1995-2003 *
* All Rights Reserved *
* *
******************************************************************************
/******************************************************************************
* *
* 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 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 @
ec025559
...
...
@@ -214,8 +214,8 @@ typedef struct DPM_SL_PRM_HEADERtag
typedef
struct
DPV0_PRMtag
{
unsigned
char
abUsr_Prm_Data
[
MAX_USR_PRM_LEN
];
/* user parameter data without
DPV1-bytes */
unsigned
char
abUsr_Prm_Data
[
MAX_USR_PRM_LEN
];
/* user parameter data without
DPV1-bytes */
}
GNUC_PACKED
DPV0_PRM
;
typedef
struct
DPV1_USR_PRMtag
...
...
profibus/lib/rt/src/dpsgdl.c
View file @
ec025559
/*
* 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 *
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone: ++49-89-4 56 56-0 *
* Fax: ++49-89-4 56 56-3 99 *
* *
* Copyright (C) SOFTING AG 1998-2003 *
* All Rights Reserved *
* *
******************************************************************************
/******************************************************************************
* *
* 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 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 @
ec025559
/*
* 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 *
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone: ++49-89-4 56 56-0 *
* Fax: ++49-89-4 56 56-3 99 *
* *
* Copyright (C) SOFTING AG 1995-2003 *
* All Rights Reserved *
* *
******************************************************************************
/******************************************************************************
* *
* 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 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,11 +70,12 @@ LOCAL_DATA
#pragma check_stack(off)
#endif
FUNCTION
PUBLIC
INT16
fdlgdl_get_data_len
(
IN
INT16
result
,
/* Service-Result */
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
,
/* Service-Primitive */
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 */
OUT
INT16
*
data_len_ptr
/* length of data */
)
/*-----------------------------------------------------------------------------
...
...
@@ -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 @
ec025559
/*
* 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 *
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone: ++49-89-4 56 56-0 *
* Fax: ++49-89-4 56 56-3 99 *
* *
* Copyright (C) SOFTING AG 1995-2003 *
* All Rights Reserved *
* *
******************************************************************************
/******************************************************************************
* *
* 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 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,7 +76,8 @@ 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 */
)
...
...
@@ -131,15 +97,19 @@ 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 */
IN
USIGN8
primitive
,
/* Service-Primitive */
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 */
)
...
...
@@ -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
)
...
...
@@ -196,8 +170,8 @@ possible return values:
}
FUNCTION
LOCAL
INT16
fm7gdl_get_s_r_value_data_len
(
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
,
/* Service-Primitive */
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
,
/* Service-Primitive */
IN
USIGN8
FAR
*
data_ptr
/* pointer to data */
)
...
...
@@ -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
);
}
...
...
@@ -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,11 +406,12 @@ possible return values:
}
}
FUNCTION
PUBLIC
INT16
fm7gdl_get_data_len
(
IN
INT16
result
,
/* Service-Result */
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
,
/* Service-Primitive */
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 */
OUT
INT16
*
data_len_ptr
/* length of data */
)
/*-----------------------------------------------------------------------------
...
...
@@ -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 @
ec025559
/*
* 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 *
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone: ++49-89-4 56 56-0 *
* Fax: ++49-89-4 56 56-3 99 *
* *
* Copyright (C) SOFTING AG 1995-2003 *
* All Rights Reserved *
* *
******************************************************************************
/******************************************************************************
* *
* 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 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,11 +70,12 @@ LOCAL_DATA
#pragma check_stack(off)
#endif
FUNCTION
PUBLIC
INT16
fmbgdl_get_data_len
(
IN
INT16
result
,
/* Service-Result */
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
,
/* Service-Primitive */
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 */
OUT
INT16
*
data_len_ptr
/* length of data */
)
/*-----------------------------------------------------------------------------
...
...
@@ -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 @
ec025559
/*
* 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 *
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone: ++49-89-4 56 56-0 *
* Fax: ++49-89-4 56 56-3 99 *
* *
* Copyright (C) SOFTING AG 1995-2003 *
* All Rights Reserved *
* *
******************************************************************************
/******************************************************************************
* *
* 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 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,7 +70,8 @@ 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 */
)
...
...
@@ -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,7 +111,8 @@ 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 */
)
...
...
@@ -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,8 +173,9 @@ possible return values:
}
}
FUNCTION
LOCAL
INT16
fmsgdl_get_od_data_len
(
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
,
/* Service-Primitive */
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 */
)
...
...
@@ -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,8 +315,9 @@ possible return values:
}
}
FUNCTION
LOCAL
INT16
fmsgdl_get_var_data_len
(
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
,
/* Service-Primitive */
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 */
)
...
...
@@ -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,8 +467,9 @@ possible return values:
}
}
FUNCTION
LOCAL
INT16
fmsgdl_get_evn_data_len
(
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
,
/* Service-Primitive */
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 */
)
...
...
@@ -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,8 +530,9 @@ possible return values:
}
}
FUNCTION
LOCAL
INT16
fmsgdl_get_dom_data_len
(
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
,
/* Service-Primitive */
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 */
)
...
...
@@ -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,8 +624,9 @@ possible return values:
}
}
FUNCTION
LOCAL
INT16
fmsgdl_get_pi_data_len
(
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
,
/* Service-Primitive */
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 */
)
...
...
@@ -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,11 +829,12 @@ possible return values:
}
}
FUNCTION
PUBLIC
INT16
fmsgdl_get_data_len
(
IN
INT16
result
,
/* Service-Result */
IN
USIGN8
service
,
/* Service */
IN
USIGN8
primitive
,
/* Service-Primitive */
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 */
OUT
INT16
*
data_len_ptr
/* length of data */
)
/*-----------------------------------------------------------------------------
...
...
@@ -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 @
ec025559
/*
* 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 @
ec025559
/*
* 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 *
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone: ++49-89-4 56 56-0 *
* Fax: ++49-89-4 56 56-3 99 *
* *
* Copyright (C) SOFTING AG 1999-2003 *
* All Rights Reserved *
* *
******************************************************************************
/******************************************************************************
* *
* 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 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
...
...
@@ -135,19 +100,22 @@ return value:
FUNCTION_BODY
if
(
ERROR_SUCCESS
==
RegOpenKeyEx
(
HKEY_LOCAL_MACHINE
,
REGPATH_PARAMETER_FROM_HLM
,
0
,
KEY_READ
,
&
keyParameters
))
{
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
);
(
LPBYTE
)
OperationMode
,
&
sizeULONG
);
if
(
!
RetVal
)
return
(
TRUE
);
...
...
@@ -183,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
);
}
...
...
@@ -219,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
);
...
...
@@ -249,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 @
ec025559
/*
* 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 @
ec025559
/*
* 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 */
...
...
@@ -608,7 +573,7 @@ typedef struct _T_DP_END_SEQ_IND /* MM: req_add --> function_num */
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 */
/* NE, AD, IP, NI, SE, SC, EA, LE */
}
T_DP_END_SEQ_RES_CON
;
...
...
@@ -649,7 +614,7 @@ typedef struct _T_DP_DOWNLOAD_IND /* MM: req_add --> function_num */
typedef
struct
_T_DP_DOWNLOAD_RES_CON
{
USIGN16
status
;
/* OK, DS, NA, RS, RR, UE, TO, FE, */
/* RE, NE, AD, EA, SC, NI, LE */
/* RE, NE, AD, EA, SC, NI, LE */
}
T_DP_DOWNLOAD_RES_CON
;
...
...
@@ -681,8 +646,8 @@ typedef struct _T_DP_UPLOAD_IND /* MM: req_add --> function_num */
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
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 */
/* OCTET data [data_len]; upload data */
...
...
@@ -715,7 +680,7 @@ typedef struct _T_DP_ACT_PARAM_IND /* MM: req_add --> function_num */
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 */
/* NE, AD, IP, SC, NI, DI, EA, LE */
}
T_DP_ACT_PARAM_RES_CON
;
...
...
@@ -741,8 +706,8 @@ typedef struct _T_DP_GET_MASTER_DIAG_IND /* MM: req_add --> function_num */
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
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 */
/* OCTET diagnostic_data [data_len]; */
...
...
profibus/lib/rt/src/pb_dps.h
View file @
ec025559
/*
* 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 ******************************************************/
/****************************************************************************/
...
...
@@ -251,7 +220,7 @@ typedef struct _T_DPS_CON_IND
typedef
struct
_T_DPS_INIT_SLAVE_REQ
{
USIGN8
slave_add
;
/* 0..125, DPS_DEFAULT_SLAVE_ADD, DPS_NON_VOLATILE_SLAVE_ADD */
slave_add
;
/* 0..125, DPS_DEFAULT_SLAVE_ADD, DPS_NON_VOLATILE_SLAVE_ADD */
USIGN8
min_tsdr
;
/* min. station delay responder, default 0, 11..255 */
PB_BOOL
auto_cfg_response
;
/* CFG check by DPS_USR ? PB_FALSE : PB_TRUE */
...
...
@@ -426,7 +395,7 @@ typedef struct _T_DPS_SET_SLAVE_ADD_IND
USIGN16
ident_number
;
/* PNO ident_number */
PB_BOOL
no_add_chg
;
/* PB_TRUE: address change after reset only */
/* rem_slave_data_len */
/* rem_slave_data_len */
USIGN8
rem_slave_data
[
DP_MAX_REM_SLAVE_DATA_LEN
];
}
T_DPS_SET_SLAVE_ADD_IND
;
...
...
profibus/lib/rt/src/pb_err.h
View file @
ec025559
/*
* 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. */
...
...
@@ -787,44 +752,45 @@
#define E_SERVICE_NOT_EXECUTABLE 25
/* service not executable */
#endif
#define E_IF_FATAL_ERROR 7
/* unrecoverable error on board */
#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 \
vers.*/
#define E_IF_INVALID_LAYER 12
/* invalid layer */
#define E_IF_INVALID_SERVICE 13
/* invalid service identifier */
#define E_IF_INVALID_PRIMITIVE 14
/* invalid service primitive */
#define E_IF_INVALID_DATA_SIZE 15
/* not enough cmi data block memory*/
#define E_IF_INVALID_COMM_REF 16
/* invalid communication reference */
#define E_IF_INVALID_CMI_CALL 19
/* invalid CMI call */
#define E_IF_CMI_ERROR 20
/* error occured in CMI */
#define E_IF_RESOURCE_UNAVAILABLE 21
/* no resource available */
#define E_IF_NO_PARALLEL_SERVICES 22
/* no parallel services allowed */
#define E_IF_SERVICE_CONSTR_CONFLICT 23
/* serv. tempor. not executable */
#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_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 */
#define E_IF_EXIT_FAILED 32
/* exit API or Controller failed */
#define E_IF_PAPI_NOT_INITIALIZED 33
/* API not initialized */
#define E_IF_FATAL_ERROR 7
/* unrecoverable error on board */
#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 \
vers.*/
#define E_IF_INVALID_LAYER 12
/* invalid layer */
#define E_IF_INVALID_SERVICE 13
/* invalid service identifier */
#define E_IF_INVALID_PRIMITIVE 14
/* invalid service primitive */
#define E_IF_INVALID_DATA_SIZE 15
/* not enough cmi data block memory*/
#define E_IF_INVALID_COMM_REF 16
/* invalid communication reference */
#define E_IF_INVALID_CMI_CALL 19
/* invalid CMI call */
#define E_IF_CMI_ERROR 20
/* error occured in CMI */
#define E_IF_RESOURCE_UNAVAILABLE 21
/* no resource available */
#define E_IF_NO_PARALLEL_SERVICES 22
/* no parallel services allowed */
#define E_IF_SERVICE_CONSTR_CONFLICT 23
/* serv. tempor. not executable */
#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 */
#define E_IF_EXIT_FAILED 32
/* exit API or Controller failed */
#define E_IF_PAPI_NOT_INITIALIZED 33
/* API not initialized */
#define E_IF_NO_DEVICE_CONNECTION 34
/* no PROFIBUS device connection */
/* error codes available only in Win NT ---------------------------------------
*/
#define E_IF_SLAVE_DIAG_DATA 0xF0
/* no data available */
/* new diagnostics data available */
#define E_IF_SLAVE_DIAG_DATA 0xF0
/* no 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) -------------------------------
*/
...
...
profibus/lib/rt/src/pb_fdl.h
View file @
ec025559
/*
* 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 */
...
...
profibus/lib/rt/src/pb_fm7.h
View file @
ec025559
/*
* 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 */
...
...
@@ -863,7 +828,7 @@ typedef struct T_SET_CONFIGURATION_REQ
USIGN16
max_nr_of_api_data_buffers
;
/* max # of abort/poll/idle PDU-Buffers
(all CR) */
USIGN16
max_nr_of_sap_buffers
;
/* max # of SAP-Buffers (all CR) */
max_nr_of_sap_buffers
;
/* max # of SAP-Buffers (all CR) */
USIGN16
max_nr_of_poll_list_entries
;
/* max # of Poll-List-Entries
(all CR) */
USIGN16
max_data_buffer_size
;
/* max size of FMS-/FMA7-PDU-Buffer */
...
...
profibus/lib/rt/src/pb_fmb.h
View file @
ec025559
/*
* 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- */
...
...
profibus/lib/rt/src/pb_fms.h
View file @
ec025559
/*
* 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 */
...
...
profibus/lib/rt/src/pb_hw.h
deleted
100644 → 0
View file @
655f779b
/*
* 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 @
ec025559
/*
* 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 */
...
...
@@ -98,20 +63,19 @@
#define DEVICE_BASIC_MANAGEMENT 8
/* --- contants for IRQ values -------------------------------- */
#define REQ_IRQ 0xF0
/* IND/CON IRQ is received */
#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_ACK_IRQ 0x0D
/* MASTER: data transfer stop Acknowldege */
#define TRC_REQ_IRQ 0xC0
/* TRACE REQ is received */
#define TRC_ACK_IRQ 0x0C
/* TRACE acknowledge */
#define EXCEPTION_REQ_IRQ 0xB0
/* Exception Request */
#define EXCEPTION_ACK_IRQ 0x0B
/* Exception Acknowledge */
#define DPS_SLAVE_INP_REQ_IRQ 0xA0
/* SLAVE: DP-SLAVE-INPUT request */
#define DPS_SLAVE_INP_ACK_IRQ 0x0A
/* SLAVE: DP-SLAVE-INPUT Acknowldege */
#define REQ_IRQ 0xF0
/* IND/CON IRQ is received */
#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_ACK_IRQ 0x0D
/* MASTER: data transfer stop Acknowldege */
#define TRC_REQ_IRQ 0xC0
/* TRACE REQ is received */
#define TRC_ACK_IRQ 0x0C
/* TRACE acknowledge */
#define EXCEPTION_REQ_IRQ 0xB0
/* Exception Request */
#define EXCEPTION_ACK_IRQ 0x0B
/* Exception Acknowledge */
#define DPS_SLAVE_INP_REQ_IRQ 0xA0
/* SLAVE: DP-SLAVE-INPUT request */
#define DPS_SLAVE_INP_ACK_IRQ 0x0A
/* SLAVE: DP-SLAVE-INPUT Acknowldege */
#define DPS_SLAVE_OUTP_REQ_IRQ 0x90
/* SLAVE: DP-SLAVE-OUTPUT request */
#define DPS_SLAVE_OUTP_ACK_IRQ 0x09
/* SLAVE: DP-SLAVE-OUTPUT Acknowldege */
...
...
@@ -185,18 +149,18 @@
* ----------------------------------------------- */
/* --- DP-MASTER
* ---------------------------------------------------------------- */
#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_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 \
*/
/* --- 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_INPUT_IMAGE 0x90
/* SLAVE: image for slave input 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,6 @@
/* 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
{
USIGN16
comm_ref
;
/* communication reference */
...
...
@@ -290,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
...
...
@@ -319,8 +270,7 @@ FUNCTION extern INT16 CALL_CONV profi_set_default(
-----------------------------------------------------------------------------*/
;
FUNCTION
extern
INT16
CALL_CONV
profi_init
(
OUT
T_PROFI_DEVICE_HANDLE
*
hDevice
,
IN
USIGN8
Board
,
FUNCTION
extern
INT16
CALL_CONV
profi_init
(
IN
USIGN8
Board
,
IN
USIGN32
ReadTimeout
,
IN
USIGN32
WriteTimeout
)
/*----------------------------------------------------------------------------
...
...
@@ -380,7 +330,7 @@ FUNCTION extern INT16 CALL_CONV init_profibus(IN USIGN32 DprAdress,
-----------------------------------------------------------------------------*/
;
FUNCTION
extern
INT16
CALL_CONV
profi_end
(
IN
T_PROFI_DEVICE_HANDLE
*
hDevice
)
FUNCTION
extern
INT16
CALL_CONV
profi_end
(
VOID
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -395,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
...
...
@@ -432,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
...
...
@@ -461,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
...
...
@@ -491,9 +441,10 @@ profi_set_data(IN T_PROFI_DEVICE_HANDLE* hDevice, IN USIGN8 DataId,
-----------------------------------------------------------------------------*/
;
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
...
...
@@ -521,9 +472,9 @@ profi_get_data(IN T_PROFI_DEVICE_HANDLE* hDevice, IN USIGN8 DataId,
-----------------------------------------------------------------------------*/
;
FUNCTION
extern
INT16
CALL_CONV
profi_set_dps_input_data
(
IN
T_PROFI_DEVICE_HANDLE
*
hDevice
,
IN
USIGN8
*
pData
,
IN
USIGN8
DataLength
,
OUT
USIGN8
*
pState
)
FUNCTION
extern
INT16
CALL_CONV
profi_set_dps_input_data
(
IN
USIGN8
*
pData
,
IN
USIGN8
DataLength
,
OUT
USIGN8
*
pState
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -545,9 +496,8 @@ profi_set_dps_input_data(IN T_PROFI_DEVICE_HANDLE* hDevice, IN USIGN8* pData,
-----------------------------------------------------------------------------*/
;
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
)
FUNCTION
extern
INT16
CALL_CONV
profi_get_dps_input_data
(
OUT
USIGN8
*
pData
,
INOUT
USIGN8
*
pDataLength
,
OUT
USIGN8
*
pState
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -566,9 +516,8 @@ profi_get_dps_input_data(IN T_PROFI_DEVICE_HANDLE* hDevice, OUT USIGN8* pData,
-----------------------------------------------------------------------------*/
;
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
)
FUNCTION
extern
INT16
CALL_CONV
profi_get_dps_output_data
(
OUT
USIGN8
*
pData
,
INOUT
USIGN8
*
pDataLength
,
OUT
USIGN8
*
pState
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -590,8 +539,7 @@ profi_get_dps_output_data(IN T_PROFI_DEVICE_HANDLE* hDevice, OUT USIGN8* pData,
;
FUNCTION
extern
INT16
CALL_CONV
profi_get_versions
(
IN
T_PROFI_DEVICE_HANDLE
*
hDevice
,
OUT
CSTRING
*
pPapiVersion
,
OUT
CSTRING
*
pFirmwareVersion
)
profi_get_versions
(
OUT
CSTRING
*
pPapiVersion
,
OUT
CSTRING
*
pFirmwareVersion
)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -610,8 +558,8 @@ profi_get_versions(IN T_PROFI_DEVICE_HANDLE* hDevice, OUT CSTRING* pPapiVersion,
-----------------------------------------------------------------------------*/
;
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
...
...
profibus/lib/rt/src/pb_ioctl.h
View file @
ec025559
/*
* 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,36 +42,43 @@
#define IOCTL_PROFI_SET_DEBUGLEVEL 0x6909
#ifdef __KERNEL__
extern
int
pb_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
);
#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 */
/*****************************************************************************/
// #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
{
void
*
InBuf
;
int
InBufLength
;
__s32
InBufLength
;
void
*
OutBuf
;
int
OutBufLength
;
}
NTIoctl
;
__s32
OutBufLength
;
}
__attribute__
((
aligned
(
8
)))
NTIoctl
;
typedef
struct
_DataImage
{
int
id
;
__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 @
ec025559
/*
* 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
*/
/* */
/*****************************************************************************/
...
...
profibus/lib/rt/src/pb_tools.h
View file @
ec025559
/*
* 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 */
...
...
profibus/lib/rt/src/pb_type.h
View file @
ec025559
/*
* 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 @
ec025559
Volume Profibus $ClassVolume 0.0.250.7
Volume Profibus $ClassVolume 0.0.250.7
Body SysBody 05-SEP-2005 17:51:40.00
Attr NextOix = "_X263"
Attr NextCix = "_X22"
...
...
@@ -1208,7 +1208,7 @@ Volume Profibus $ClassVolume 0.0.250.7
! @Summary Process that handles the slave. Plc(1), rt_io_comm(2) or application process(4).
! Process that handles the slave. All slaves belonging to the same Profiboard must be handled
! by the same process.
!
!
! 1: The slave is handled by the plc process, and by a specific
! thread in the plc, which is specified in the ThreadObject attribute.
! 2: The slave is handled by the rt_io_comm process.
...
...
@@ -1225,7 +1225,7 @@ Volume Profibus $ClassVolume 0.0.250.7
! @Summary Plc thread that handles the slave.
! The PlcThread object of the plc thread that handles the slave.
! The slave is handled with the scantime of the thread.
! All slaves
! All slaves
!*/
Object ThreadObject $Attribute 5 16-JAN-2006 09:46:40.50
Body SysBody 16-JAN-2006 09:46:40.50
...
...
@@ -1393,7 +1393,7 @@ Volume Profibus $ClassVolume 0.0.250.7
! The parameters WdFact1 and WdFact2 represent factors for setting
! the watchdog control. The watchdog control in a DP-Slave takes care
! that, if the master fails, the outputs fall in the safe state after
! the expiration of this time.
! the expiration of this time.
! t[ms] = 10*WdFact1*WdFact2
!*/
Object WdFact1 $Attribute 21 16-JAN-2006 09:46:40.50
...
...
@@ -1408,7 +1408,7 @@ Volume Profibus $ClassVolume 0.0.250.7
! The parameters WdFact1 and WdFact2 represent factors for setting
! the watchdog control. The watchdog control in a DP-Slave takes care
! that, if the master fails, the outputs fall in the safe state after
! the expiration of this time.
! the expiration of this time.
! t[ms] = 10*WdFact1*WdFact2
!*/
Object WdFact2 $Attribute 22 16-JAN-2006 09:46:40.50
...
...
@@ -2005,7 +2005,7 @@ Volume Profibus $ClassVolume 0.0.250.7
! @Group Profibus
! @Summary Configuration of a Profibus module
! Configuration of a Profibus module.
!
!
!*/
Object Pb_Module $ClassDef 11 16-JAN-2006 09:46:40.50
Body SysBody 16-JAN-2006 09:46:40.50
...
...
@@ -2048,7 +2048,7 @@ Volume Profibus $ClassVolume 0.0.250.7
!/**
! @Summary Process that handles the card. Plc(1), rt_io_comm(2) or application process(4).
! Process that handles the card.
!
!
! 1: The card is read by the plc process, and is handled by a specific
! thread in the plc, which is specified in the ThreadObject attribute.
! 2: The card is read by the rt_io_comm process.
...
...
@@ -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
...
...
@@ -2300,8 +2302,8 @@ Volume Profibus $ClassVolume 0.0.250.7
EndObject
!/**
! Baud rate for the bus in Kbit/s. Possible values are 500, 1500, 3000, 6000, 12000.
! Note that the values for some of the following attributes are depending on the
! baud rate. For further information about these bus parameters, please refer to the
! Note that the values for some of the following attributes are depending on the
! baud rate. For further information about these bus parameters, please refer to the
! documentation from Softing.
!*/
Object BaudRate $Attribute 11 16-JAN-2006 09:46:40.51
...
...
@@ -2312,9 +2314,9 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody
EndObject
!/**
! Watchdog timer for write supervision in the master card. This watchdog is
! activated at the first write operation after initialization. If the timer later
! elapses without a write operation, the master card will reset itself, and the bus
! Watchdog timer for write supervision in the master card. This watchdog is
! activated at the first write operation after initialization. If the timer later
! elapses without a write operation, the master card will reset itself, and the bus
! will stop, leaving all slaves to stall when their own stalltime elapses.
! Range 100..10000 ms
!*/
...
...
@@ -2326,7 +2328,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody
EndObject
!/**
! Slot time, the maximum time a master station must wait for a transaction response.
! Slot time, the maximum time a master station must wait for a transaction response.
! Range 37..16383 Bit Times.
! Recommended values for each baudrate:
! 500 kbit/s - 200
...
...
@@ -2343,7 +2345,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody
EndObject
!/**
! Minimum station delay time for responder, the period of time which may elapse before
! Minimum station delay time for responder, the period of time which may elapse before
! the responder can send the response frame. Range 11..1023 Bit Times.
! Recommended values for each baudrate:
! 500 kbit/s - 11
...
...
@@ -2394,7 +2396,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody
EndObject
!/**
! Setup time, the time between the occurance of an interrupt request and the necessary request
! Setup time, the time between the occurance of an interrupt request and the necessary request
! action is performed. Range 1..494-Tqui BitTimes.
! Recommended values for each baudrate:
! 500 kbit/s - 1
...
...
@@ -2412,7 +2414,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndObject
!/**
! Target rotation time, the anticipated time for one token rotation on the bus, including
! allowances for high and low priority transactions and GAP maintenance.
! allowances for high and low priority transactions and GAP maintenance.
! Range 256..2^24-1 Bit Times.
! The value is irrelevant in Profibus DP operations.
!*/
...
...
@@ -2451,7 +2453,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody
EndObject
!/**
! Maximum retry limit, indicates how often FDL has to repeat the request frame when no response
! Maximum retry limit, indicates how often FDL has to repeat the request frame when no response
! or acknowledge frame is receive from the recognized station within the slot time. Range 0..7.
! Recommended values for each baudrate:
! 500 kbit/s - 1
...
...
@@ -2691,7 +2693,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndObject
!/**
! Baud rate for the bus in Kbit/s. Possible values are 500, 1500, 3000, 6000, 12000.
! Note that the values for some of the following attributes are depending on the
! Note that the values for some of the following attributes are depending on the
! baud rate.
!*/
Object BaudRate $Attribute 37 09-DEC-2008 13:19:32.10
...
...
@@ -2702,9 +2704,9 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody
EndObject
!/**
! Watchdog timer for write supervision in the master card. This watchdog is
! activated at the first write operation after initialization. If the timer later
! elapses without a write operation, the master card will reset itself, and the bus
! Watchdog timer for write supervision in the master card. This watchdog is
! activated at the first write operation after initialization. If the timer later
! elapses without a write operation, the master card will reset itself, and the bus
! will stop, leaving all slaves to stall when their own stall time elapses.
! A value of 0 will disable the board's watchdog functionality altogether.
! Range 0..65535 ms
...
...
@@ -2717,7 +2719,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody
EndObject
!/**
! Slot time, the maximum time a master station must wait for a transaction response.
! Slot time, the maximum time a master station must wait for a transaction response.
! Range 37..16383 Bit Times.
! Recommended values for each baud rate:
! 500 kbit/s - 200
...
...
@@ -2734,7 +2736,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody
EndObject
!/**
! Minimum station delay time for responder, the period of time which may elapse before
! Minimum station delay time for responder, the period of time which may elapse before
! the responder can send the response frame. Range 11..1023 Bit Times.
! Recommended values for each baud rate:
! 500 kbit/s - 11
...
...
@@ -2785,7 +2787,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody
EndObject
!/**
! Setup time, the time between the occurrence of an interrupt request and the necessary request
! Setup time, the time between the occurrence of an interrupt request and the necessary request
! action is performed. Range 1..494-Tqui BitTimes.
! Recommended values for each baud rate:
! 500 kbit/s - 1
...
...
@@ -2803,7 +2805,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndObject
!/**
! Target rotation time, the anticipated time for one token rotation on the bus, including
! allowances for high and low priority transactions and GAP maintenance.
! allowances for high and low priority transactions and GAP maintenance.
! Range 256..2^24-1 Bit Times.
! The value is irrelevant in Profibus DP operations.
!*/
...
...
@@ -2842,7 +2844,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody
EndObject
!/**
! Maximum retry limit, indicates how often FDL has to repeat the request frame when no response
! Maximum retry limit, indicates how often FDL has to repeat the request frame when no response
! or acknowledge frame is receive from the recognized station within the slot time. Range 0..7.
! Recommended values for each baud rate:
! 500 kbit/s - 1
...
...
@@ -2985,73 +2987,73 @@ Volume Profibus $ClassVolume 0.0.250.7
Attr NextAix = "_X11"
EndBody
!/**
! Diagnosis appears Alarm
! A diagnosis appears alarm signals an event within a submodule,
! for instance overtemperature, short circuit, etc.
! The content of the alarm is defined by the Diagnosis ASE for this type.
!
! Process Alarm
! A process alarm signals the occurrence of an event in the
! connected process, for instance upper limit value exceeded.
!
! Pull Alarm
! A slot signals the withdrawal of a submodule/module or change
! in configuration (reduction).
!
! Plug Alarm
! A slot signals the insertion of a submodule/module, a new need
! for parametrization, or a change in configuration (addition).
!
! Status Alarm
! A status alarm signals a change in the state of a submodule,
! for instance run, stop or ready.
!
! Update Alarm
! An update alarm signals the change of a parameter in a submodule
! e.g. by a local operation or a remote access.
!
! Redundancy Alarm
! A redundancy alarm signals the fault of one IO controller to the
! remaining IO controller for redundant IO ARs.
!
! Controlled by supervisor
! A slot signals the logical withdrawal of a submodule by the
! IO supervisor. The actions shall be according to the Pull Alarm.
!
! Released Alarm
! A slot signals the logical insertion of a submodule by the IO supervisor.
! The actions shall be according to the Plug Alarm.
!
! Plug Wrong Submodule Alarm
! A slot signals the insertion of a wrong submodule/module or a
! change in configuration (addition).
!
! Return of Submodule Alarm
! Diagnosis appears Alarm
! A diagnosis appears alarm signals an event within a submodule,
! for instance overtemperature, short circuit, etc.
! The content of the alarm is defined by the Diagnosis ASE for this type.
!
! Process Alarm
! A process alarm signals the occurrence of an event in the
! connected process, for instance upper limit value exceeded.
!
! Pull Alarm
! A slot signals the withdrawal of a submodule/module or change
! in configuration (reduction).
!
! Plug Alarm
! A slot signals the insertion of a submodule/module, a new need
! for parametrization, or a change in configuration (addition).
!
! Status Alarm
! A status alarm signals a change in the state of a submodule,
! for instance run, stop or ready.
!
! Update Alarm
! An update alarm signals the change of a parameter in a submodule
! e.g. by a local operation or a remote access.
!
! Redundancy Alarm
! A redundancy alarm signals the fault of one IO controller to the
! remaining IO controller for redundant IO ARs.
!
! Controlled by supervisor
! A slot signals the logical withdrawal of a submodule by the
! IO supervisor. The actions shall be according to the Pull Alarm.
!
! Released Alarm
! A slot signals the logical insertion of a submodule by the IO supervisor.
! The actions shall be according to the Plug Alarm.
!
! Plug Wrong Submodule Alarm
! A slot signals the insertion of a wrong submodule/module or a
! change in configuration (addition).
!
! Return of Submodule Alarm
! A slot signals that a submodule is ready to switch its IOCS/IOPS from
! "BAD" to "GOOD" again without new parameterization.
!
! Diagnosis disappears Alarm
! A diagnosis disappears alarm signals a disappearing diagnosis event
! within a submodule. The content of the alarm is defined by the
! Diagnosis ASE for this type.
!
! Multicast Communication Mismatch
! A multicast consumer submodule signals that communication
! relationship to the associated multicast provider is failed.
!
! Port Data Change Notification Alarm
! A port submodule signals that port data has been changed.
!
! Sync Data Change Notification Alarm
! An interface submodule signals that synchronization data has been changed.
!
! Isochronous Mode Problem Notification Alarm
! The application signals that problems with isochronously execution
! have been detected.
!
! Furthermore, manufacturer specific alarms may be used and alarms
! are reserved for profile specific definitions.
!
! "BAD" to "GOOD" again without new parameterization.
!
! Diagnosis disappears Alarm
! A diagnosis disappears alarm signals a disappearing diagnosis event
! within a submodule. The content of the alarm is defined by the
! Diagnosis ASE for this type.
!
! Multicast Communication Mismatch
! A multicast consumer submodule signals that communication
! relationship to the associated multicast provider is failed.
!
! Port Data Change Notification Alarm
! A port submodule signals that port data has been changed.
!
! Sync Data Change Notification Alarm
! An interface submodule signals that synchronization data has been changed.
!
! Isochronous Mode Problem Notification Alarm
! The application signals that problems with isochronously execution
! have been detected.
!
! Furthermore, manufacturer specific alarms may be used and alarms
! are reserved for profile specific definitions.
!
!*/
Object Type $Attribute 1 10-JUN-2010 10:53:19.20
Body SysBody 21-OCT-2010 08:59:53.40
...
...
@@ -3106,7 +3108,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody
EndObject
!/**
! Module ident number identifying the module the
! Module ident number identifying the module the
! alarm comes from (see GSDML-file)
!*/
Object ModuleIdentNumber $Attribute 6 10-JUN-2010 11:49:40.15
...
...
@@ -3118,7 +3120,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody
EndObject
!/**
! Subodule ident number identifying the module the
! Subodule ident number identifying the module the
! alarm comes from (see GSDML-file)
!*/
Object SubmoduleIdentNumber $Attribute 7 10-JUN-2010 11:49:56.34
...
...
@@ -3272,31 +3274,31 @@ Volume Profibus $ClassVolume 0.0.250.7
! @Group Profinet
! @Summary Configures a Softing Profinet controller stack.
! Configures a Sofing Profinet controller stack.
!
! ProviewR has support for a Profinet stack from Softing (www.softing.com).
! The Profinet stack is implemented as three Linux kernel modules. The stack
!
! ProviewR has support for a Profinet stack from Softing (www.softing.com).
! The Profinet stack is implemented as three Linux kernel modules. The stack
! is configured by the current object and is placed below the $Node object.
!
!
! See ProviewR documentation 'Guide to I/O System' for more information. See also
! a Case Study in class help class ABB_ACS880_PnDevice
!
!
! Note due to Softing licens requirements the NIC must have a specific macadress.
!
! Example:
!
!
! Example:
!
! auto eth1
! iface eth1 inet static
! address 192.168.90.1
! netmask 255.255.254.0
! hwaddress ether xx:xx:xx:xx:xx:xx
!
!
! where xx:xx:xx:xx:xx:xx needs to be:
!
!
! AA:00:04:00:xx:14 where xx is 21-52 (hex, i.e. max 50 device available)
!
!
! See also an example 9 'Ethernet interface settings in file' /etc/network/interfaces
! in class ABB_ACS880_PnDevice.
!
!
! @b See also
! @classlink PnDevice profibus_pndevice.html
! @classlink PnModule profibus_pnmodule.html
...
...
@@ -3415,29 +3417,29 @@ Volume Profibus $ClassVolume 0.0.250.7
! @Group Profinet
! @Summary Configures a Profinet device.
! Configures a Profinet device.
!
!
! Baseobject for a profinet device. Reside below a profinet agent object.
! In the attribute GSDMfile the gsdmlfile for the current device is stated.
! When the gsdmlfile is supplied the device can be configured by the Profinet
! configurator. See ProviewR documentation 'Guide to I/O System' for more
! information. See also a Case Study class ABB_ACS880_PnDevice.
!
!
! Note 'DeviceName' is the most important setting and defines the device on
! the network. When IO communication starts the Profinet stack will first
! look up all the devices on the network by the name.
!
!
! There is a viewer tool for searching a network for Profinet devices and to set the
! 'DeviceName'. The viewer is started from a terminal window with the shell command:
!
!
! > profinet_viewer [device]
!
!
! Where 'device' is the network device, eg eth0. By default the profinet_viewer will
! connect to eth1.
!
! @bNote.
! The ProviewR runtime environment should be stopped on the current node before the
!
! @bNote.
! The ProviewR runtime environment should be stopped on the current node before the
! the viewer is started.
!
!
! @b See also
! @classlink PnControllerSoftingPNAK profibus_pncontrollersoftingpnak.html
! @classlink Hilscher_cifX_PnController otherio_hilscher_cifx_pncontroller.html
...
...
@@ -3509,7 +3511,7 @@ Volume Profibus $ClassVolume 0.0.250.7
!/**
! @Summary Process that handles the device. Plc(1), rt_io_comm(2) or application process(4).
! Process that handles the device.
!
!
! 1: The device is read by the plc process, and is handled by a specific
! thread in the plc, which is specified in the ThreadObject attribute.
! 2: The device is read by the rt_io_comm process.
...
...
@@ -3863,22 +3865,22 @@ Volume Profibus $ClassVolume 0.0.250.7
! @Group Profinet
! @Summary Configures a Profinet module.
! Configures a Profinet module.
!
!
! This object configures the data exchange between a Profinet Slave Device and a
! Profinet Master.
!
!
! The class PnModule will be valid for all types of modules. In many cases there exist
! prepared subclasses of the PnModuleclass for the specific module. This is for example
! the case for a Siemens ET200M device. For the prepared classes the IO channels will
! exist as a part of the moduleobject. The prepared classes should be used if they exist.
! See ProviewR documentation 'Guide to I/O Systemfor more information.
!
!
! @bConfiguration (prepared subclasses)
! One device object (not this module object) are placed as children to the master. For
! the device object, a profinet configurator is opened, that configures the device object
! and creates this module objects for the modules handled by the device. See
! a Case Study in class ABB_ACS880_PnDevice for more information.
!
!
! @classlink PnControllerSoftingPNAK profibus_pncontrollersoftingpnak.html
! @classlink PnDevice profibus_pndevice.html
! @classlink ABB_ACS880_PnDevice abb_abb_acs880_pndevice.html
...
...
@@ -3938,7 +3940,7 @@ Volume Profibus $ClassVolume 0.0.250.7
!/**
! @Summary Process that handles the module. Plc(1), rt_io_comm(2) or application process(4).
! Process that handles the module.
!
!
! 1: The module is read by the plc process, and is handled by a specific
! thread in the plc, which is specified in the ThreadObject attribute.
! 2: The module is read by the rt_io_comm process.
...
...
@@ -4041,34 +4043,34 @@ Volume Profibus $ClassVolume 0.0.250.7
! @Group Profibus
! @Summary Configures a Profibus FDL Service Access Point (SAP) or Remote Service Access Point (RSAP).
! Configures a Profibus FDL (R)SAP.
!
!
! With Profibus FDL Service Access Points data transfer services between nodes on a Profibus
! network is made possible.
! There are two SAP types reflecting the different characteristics of Master Stations and
! Slave Stations. Usually, "regular" SAP's are activated o Master Stations whereas Responder
! SAP's (RSAP's) are activated on Slave Stations. However both can be used on either one.
!
!
! A (R)SAP is defined by an address in the interval 0-63. A SAP is used to issue data transfers
! to a remote SAP or RSAP. A SAP can also be used to request data from a remote RSAP.
! A RSAP cannot request data from a remote (R)SAP. It is used to respond on a data request
! and to receive data.
!
!
! This object defines a SAP or RSAP and it's address. Also defined is the slave address
! of the node that this SAP will exchange data with. It should be created as a child to a
! Pb_Profiboard.
!
! Pb_Profiboard.
!
! See ProviewR documentation 'Guide to I/O Systems' for more information.
!
!
! @bConfiguration
! Instances of the class Pb_FDL_DataTransfer are created as children to the Pb_FDL_SAP object.
!
!
! For the SAP more than one instance can be created of the types SDA, SDN and SRD. These
! different type are used to send data to a remote SAP (types SDA and SDN) or to request data and
! different type are used to send data to a remote SAP (types SDA and SDN) or to request data and
! if needed, at the same time send, data (type SRD). See more on class Pb_FDL_DataTransfer.
!
!
! For a RSAP instance only one instance can be created of type RUM used to recieve data and to update
! the data that will be sent back by a SRD request.
!
!
! @classlink Pb_Profiboard profibus_pb_profiboard.html
! @classlink Pb_FDL_DataTransfer profibus_pb_fdl_datatransfer.html
!*/
...
...
@@ -4158,7 +4160,7 @@ Volume Profibus $ClassVolume 0.0.250.7
! @Summary Process that handles the slave. Plc(1), rt_io_comm(2) or application process(4).
! Process that handles the slave. All slaves belonging to the same Profiboard must be handled
! by the same process.
!
!
! 1: The slave is handled by the plc process, and by a specific
! thread in the plc, which is specified in the ThreadObject attribute.
! 2: The slave is handled by the rt_io_comm process.
...
...
@@ -4175,7 +4177,7 @@ Volume Profibus $ClassVolume 0.0.250.7
! @Summary Plc thread that handles the slave.
! The PlcThread object of the plc thread that handles the slave.
! The slave is handled with the scantime of the thread.
! All slaves
! All slaves
!*/
Object ThreadObject $Attribute 7 14-AUG-2014 13:30:57.23
Body SysBody 14-AUG-2014 13:30:57.23
...
...
@@ -4327,43 +4329,43 @@ Volume Profibus $ClassVolume 0.0.250.7
! @Group Profibus
! @Summary Configures a Profibus FDL Data Transfer Service.
! Configures a Profibus FDL Data Transfer Service.
!
!
! With Profibus FDL Service Access Points data transfer services between nodes on a Profibus
! network is made possible.
!
!
! There are two SAP types reflecting the different characteristics of Master Stations and
! Slave Stations. Usually, "regular" SAP's are activated on Master Stations whereas Responder
! SAP's (RSAP's) are activated on Slave Stations. However both can be used on either one.
!
!
! There are five types of data transfer services that can be configured. Three for sending and/or
! requesting data and two for preparing reply data (only one supported).
!
! The first three of them are used from a SAP and cannot be used with a responder SAP (RSAP). These
! requesting data and two for preparing reply data (only one supported).
!
! The first three of them are used from a SAP and cannot be used with a responder SAP (RSAP). These
! are SDA (Send Data with Acknowledge), SDN (Send Data with No acknowledge) and SRD (Send and Request
! Data with reply). When requesting data no data need to be sent.
!
! Data with reply). When requesting data no data need to be sent.
!
! The other two services are used together with a responder SAP (RSAP) to prepare the reply data
! that will be sent back to a SAP upon the receipt of a SDA, SDN or SRD. These are RU (Reply-Update,
! that will be sent back to a SAP upon the receipt of a SDA, SDN or SRD. These are RU (Reply-Update,
! this one is not supported) and RUM (Reply-Update-Multiple)
!
!
! Each data transfer is configured with the destination address (address of remote (R)SAP).
!
!
! The data that is to be sent or received are created as standard I/O channels which should be
! created as children to the Pb_FDL_DataTransfer-object. When receiveing data, the data will always
! be directed to the first (top) Pb_FDL_DataTransfer-object found as a child to the
! Pb_FDL_SAP-object.
!
! created as children to the Pb_FDL_DataTransfer-object. When receiveing data, the data will always
! be directed to the first (top) Pb_FDL_DataTransfer-object found as a child to the
! Pb_FDL_SAP-object.
!
! See ProviewR documentation 'Guide to I/O Systems' for more information.
!
!
! @bConfiguration
! Instances of the class Pb_FDL_DataTransfer are created as children to the Pb_FDL_SAP object.
!
!
! I/O-channels are created as children to the Pb_FDL_DataTransfer-object to represent the
! data being sent and/or received.
!
!
! For a RSAP instance only one instance can be created of type RUM used to recieve data and to update
! the data that will be sent back by a SRD request.
!
!
! @classlink Pb_FDL_SAP profibus_pb_fdl_sap.html
!*/
Object Pb_FDL_DataTransfer $ClassDef 21 14-AUG-2014 15:41:30.53
...
...
@@ -4414,8 +4416,8 @@ Volume Profibus $ClassVolume 0.0.250.7
! FDLIF_SRD - Send and Request Data with reply
! FDLIF_RU - Reply Update (not supprted, RUM will always be used)
! FDLIF_RUM - Reply Update Multiple
!
! SDA and SDN can also receive data explictly sent with a SDA or SDN service from a
!
! SDA and SDN can also receive data explictly sent with a SDA or SDN service from a
! remote SAP. If more than one Pb_FDL_DataTransfer objects have been created for a single
! SAP then the first child will receive the data.
!*/
...
...
@@ -4452,7 +4454,7 @@ Volume Profibus $ClassVolume 0.0.250.7
! @Summary Process that handles the slave. Plc(1), rt_io_comm(2) or application process(4).
! Process that handles the slave. All slaves belonging to the same Profiboard must be handled
! by the same process.
!
!
! 1: The slave is handled by the plc process, and by a specific
! thread in the plc, which is specified in the ThreadObject attribute.
! 2: The slave is handled by the rt_io_comm process.
...
...
@@ -4469,7 +4471,7 @@ Volume Profibus $ClassVolume 0.0.250.7
! @Summary Plc thread that handles the slave.
! The PlcThread object of the plc thread that handles the slave.
! The slave is handled with the scantime of the thread.
! All slaves
! All slaves
!*/
Object ThreadObject $Attribute 12 14-AUG-2014 15:41:08.64
Body SysBody 14-AUG-2014 15:41:08.64
...
...
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