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
df0831a3
Commit
df0831a3
authored
Jun 26, 2019
by
Marcus Nordenberg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
format code
parent
ce758cd3
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
2612 additions
and
1933 deletions
+2612
-1933
profibus/lib/rt/src/cif_dev_i.h
profibus/lib/rt/src/cif_dev_i.h
+205
-165
profibus/lib/rt/src/cif_types.h
profibus/lib/rt/src/cif_types.h
+1
-1
profibus/lib/rt/src/cif_user.h
profibus/lib/rt/src/cif_user.h
+145
-114
profibus/lib/rt/src/rcs_user.h
profibus/lib/rt/src/rcs_user.h
+56
-50
profibus/lib/rt/src/rcsdef.h
profibus/lib/rt/src/rcsdef.h
+41
-41
profibus/lib/rt/src/rt_io_m_pb_ai.c
profibus/lib/rt/src/rt_io_m_pb_ai.c
+110
-74
profibus/lib/rt/src/rt_io_m_pb_ao.c
profibus/lib/rt/src/rt_io_m_pb_ao.c
+54
-31
profibus/lib/rt/src/rt_io_m_pb_di.c
profibus/lib/rt/src/rt_io_m_pb_di.c
+32
-21
profibus/lib/rt/src/rt_io_m_pb_do.c
profibus/lib/rt/src/rt_io_m_pb_do.c
+25
-18
profibus/lib/rt/src/rt_io_m_pb_dp_slave.c
profibus/lib/rt/src/rt_io_m_pb_dp_slave.c
+62
-41
profibus/lib/rt/src/rt_io_m_pb_fdl_datatransfer.c
profibus/lib/rt/src/rt_io_m_pb_fdl_datatransfer.c
+45
-32
profibus/lib/rt/src/rt_io_m_pb_fdl_sap.c
profibus/lib/rt/src/rt_io_m_pb_fdl_sap.c
+3
-2
profibus/lib/rt/src/rt_io_m_pb_hilscher.c
profibus/lib/rt/src/rt_io_m_pb_hilscher.c
+321
-212
profibus/lib/rt/src/rt_io_m_pb_ii.c
profibus/lib/rt/src/rt_io_m_pb_ii.c
+52
-26
profibus/lib/rt/src/rt_io_m_pb_io.c
profibus/lib/rt/src/rt_io_m_pb_io.c
+28
-17
profibus/lib/rt/src/rt_io_m_pb_module.c
profibus/lib/rt/src/rt_io_m_pb_module.c
+18
-15
profibus/lib/rt/src/rt_io_m_pb_profiboard.c
profibus/lib/rt/src/rt_io_m_pb_profiboard.c
+519
-406
profibus/lib/rt/src/rt_io_pb_locals.h
profibus/lib/rt/src/rt_io_pb_locals.h
+17
-11
profibus/lib/rt/src/rt_io_pn_locals.h
profibus/lib/rt/src/rt_io_pn_locals.h
+4
-2
profibus/lib/rt/src/rt_io_pnak_locals.h
profibus/lib/rt/src/rt_io_pnak_locals.h
+34
-45
profibus/lib/rt/src/rt_pn_gsdml_data.h
profibus/lib/rt/src/rt_pn_gsdml_data.h
+33
-50
profibus/lib/rt/src/rt_pn_iface.h
profibus/lib/rt/src/rt_pn_iface.h
+17
-17
profibus/lib/rt/src/rt_pnak.h
profibus/lib/rt/src/rt_pnak.h
+245
-190
profibus/lib/rt/src/rt_profinet.h
profibus/lib/rt/src/rt_profinet.h
+545
-317
profibus/lib/rt/src/version.h
profibus/lib/rt/src/version.h
+0
-35
No files found.
profibus/lib/rt/src/cif_dev_i.h
View file @
df0831a3
...
...
@@ -67,54 +67,54 @@ extern "C" {
/* ------------------------------------------------------------------------------------
*/
#define DRV_NO_ERROR 0 // no error
#define DRV_NO_ERROR 0
// no error
#define DRV_BOARD_NOT_INITIALIZED -1 // DRIVER board not initialized
#define DRV_INIT_STATE_ERROR -2 // DRIVER error in internal init state
#define DRV_READ_STATE_ERROR -3 // DRIVER error in internal read state
#define DRV_CMD_ACTIVE -4 // DRIVER command on this chanal is activ
#define DRV_INIT_STATE_ERROR -2
// DRIVER error in internal init state
#define DRV_READ_STATE_ERROR -3
// DRIVER error in internal read state
#define DRV_CMD_ACTIVE -4
// DRIVER command on this chanal is activ
#define DRV_PARAMETER_UNKNOWN -5 // DRIVER unknown parameter in function occured
#define DRV_WRONG_DRIVER_VERSION \
-6 // DRIVER driver version is incompatible with DLL
#define DRV_PCI_SET_CONFIG_MODE -7 // DRIVER error during PCI set config mode
#define DRV_PCI_READ_DPM_LENGTH -8 // DRIVER could not read PCI DPM length
#define DRV_PCI_SET_RUN_MODE -9 // DRIVER error during PCI set run mode
#define DRV_PCI_SET_RUN_MODE -9
// DRIVER error during PCI set run mode
#define DRV_DEV_DPM_ACCESS_ERROR -10 // DEVICE dual port ram not accessable
#define DRV_DEV_NOT_READY -11 // DEVICE not ready (ready flag failed)
#define DRV_DEV_NOT_RUNNING -12 // DEVICE not running (running flag failed)
#define DRV_DEV_WATCHDOG_FAILED -13 // DEVICE watch dog test failed
#define DRV_DEV_NOT_READY -11
// DEVICE not ready (ready flag failed)
#define DRV_DEV_NOT_RUNNING -12
// DEVICE not running (running flag failed)
#define DRV_DEV_WATCHDOG_FAILED -13
// DEVICE watch dog test failed
#define DRV_DEV_OS_VERSION_ERROR -14 // DEVICE signals wrong OS version
#define DRV_DEV_SYSERR -15 // DEVICE error in dual port flags
#define DRV_DEV_MAILBOX_FULL -16 // DEVICE send mailbox is full
#define DRV_DEV_PUT_TIMEOUT -17 // DEVICE PutMessage timeout
#define DRV_DEV_GET_TIMEOUT -18 // DEVICE GetMessage timeout
#define DRV_DEV_GET_NO_MESSAGE -19 // DEVICE no message available
#define DRV_DEV_RESET_TIMEOUT -20 // DEVICE RESET command timeout
#define DRV_DEV_NO_COM_FLAG -21 // DEVICE COM-flag not set
#define DRV_DEV_EXCHANGE_FAILED -22 // DEVICE IO data exchange failed
#define DRV_DEV_SYSERR -15
// DEVICE error in dual port flags
#define DRV_DEV_MAILBOX_FULL -16
// DEVICE send mailbox is full
#define DRV_DEV_PUT_TIMEOUT -17
// DEVICE PutMessage timeout
#define DRV_DEV_GET_TIMEOUT -18
// DEVICE GetMessage timeout
#define DRV_DEV_GET_NO_MESSAGE -19
// DEVICE no message available
#define DRV_DEV_RESET_TIMEOUT -20
// DEVICE RESET command timeout
#define DRV_DEV_NO_COM_FLAG -21
// DEVICE COM-flag not set
#define DRV_DEV_EXCHANGE_FAILED -22
// DEVICE IO data exchange failed
#define DRV_DEV_EXCHANGE_TIMEOUT -23 // DEVICE IO data exchange timeout
#define DRV_DEV_COM_MODE_UNKNOWN -24 // DEVICE IO data mode unknown
#define DRV_DEV_FUNCTION_FAILED -25 // DEVICE Function call failed
#define DRV_DEV_FUNCTION_FAILED -25
// DEVICE Function call failed
#define DRV_DEV_DPMSIZE_MISMATCH \
-26 // DEVICE DPM size differs from configuration
#define DRV_DEV_STATE_MODE_UNKNOWN -27 // DEVICE State mode unknown
// Error from Interface functions
#define DRV_USR_OPEN_ERROR -30 // USER driver not opened
#define DRV_USR_INIT_DRV_ERROR -31 // USER can't connect with DEV board
#define DRV_USR_NOT_INITIALIZED -32 // USER board not initialized
#define DRV_USR_COMM_ERR -33 // USER IOCTRL function faild
#define DRV_USR_OPEN_ERROR -30
// USER driver not opened
#define DRV_USR_INIT_DRV_ERROR -31
// USER can't connect with DEV board
#define DRV_USR_NOT_INITIALIZED -32
// USER board not initialized
#define DRV_USR_COMM_ERR -33
// USER IOCTRL function faild
#define DRV_USR_DEV_NUMBER_INVALID -34 // USER parameter for DEV number invalid
#define DRV_USR_INFO_AREA_INVALID -35 // USER parameter InfoArea unknown
#define DRV_USR_NUMBER_INVALID -36 // USER parameter Number invalid
#define DRV_USR_MODE_INVALID -37 // USER parameter Mode invalid
#define DRV_USR_MSG_BUF_NULL_PTR -38 // USER NULL pointer assignment
#define DRV_USR_MSG_BUF_TOO_SHORT -39 // USER Messagebuffer too short
#define DRV_USR_SIZE_INVALID -40 // USER size parameter invalid
#define DRV_USR_SIZE_ZERO -42 // USER size parameter with zero length
#define DRV_USR_SIZE_TOO_LONG -43 // USER size parameter too long
#define DRV_USR_DEV_PTR_NULL -44 // USER device address null pointer
#define DRV_USR_INFO_AREA_INVALID -35
// USER parameter InfoArea unknown
#define DRV_USR_NUMBER_INVALID -36
// USER parameter Number invalid
#define DRV_USR_MODE_INVALID -37
// USER parameter Mode invalid
#define DRV_USR_MSG_BUF_NULL_PTR -38
// USER NULL pointer assignment
#define DRV_USR_MSG_BUF_TOO_SHORT -39
// USER Messagebuffer too short
#define DRV_USR_SIZE_INVALID -40
// USER size parameter invalid
#define DRV_USR_SIZE_ZERO -42
// USER size parameter with zero length
#define DRV_USR_SIZE_TOO_LONG -43
// USER size parameter too long
#define DRV_USR_DEV_PTR_NULL -44
// USER device address null pointer
#define DRV_USR_BUF_PTR_NULL -45 // USER pointer to buffer is a null pointer
#define DRV_USR_SENDSIZE_TOO_LONG -46 // USER SendSize parameter too long
...
...
@@ -122,13 +122,13 @@ extern "C" {
#define DRV_USR_SENDBUF_PTR_NULL -48 // USER pointer to buffer is a null pointer
#define DRV_USR_RECVBUF_PTR_NULL -49 // USER pointer to buffer is a null pointer
#define DRV_DEV_NO_VIRTUAL_MEM -60 // DEVICE Virtual memory not available
#define DRV_DEV_UNMAP_VIRTUAL_MEM -61 // DEVICE Unmap virtual memory failed
#define DRV_DEV_NO_VIRTUAL_MEM -60
// DEVICE Virtual memory not available
#define DRV_DEV_UNMAP_VIRTUAL_MEM -61
// DEVICE Unmap virtual memory failed
#define DRV_DEV_REQUEST_IRQ_FAILED -62 // DEVICE Request irq failed
#define DRV_USR_FILE_OPEN_FAILED -100 // USER file not opend
#define DRV_USR_FILE_SIZE_ZERO -101 // USER file size zero
#define DRV_USR_FILE_NO_MEMORY -102 // USER not enough memory to load file
#define DRV_USR_FILE_SIZE_ZERO -101
// USER file size zero
#define DRV_USR_FILE_NO_MEMORY -102
// USER not enough memory to load file
#define DRV_USR_FILE_READ_FAILED -103 // USER file read failed
#define DRV_USR_INVALID_FILETYPE -104 // USER file type invalid
#define DRV_USR_FILENAME_INVALID -105 // USER file name not valid
...
...
@@ -146,7 +146,8 @@ extern "C" {
#endif
/* PACKED */
// max. length is 255 + 8 Bytes
typedef
struct
tagMSG_STRUC
{
typedef
struct
tagMSG_STRUC
{
unsigned
char
rx
PACKED
;
unsigned
char
tx
PACKED
;
unsigned
char
ln
PACKED
;
...
...
@@ -165,13 +166,15 @@ typedef struct tagMSG_STRUC {
/* ------------------------------------------------------------------------------------
*/
typedef
struct
tagIOINFO
{
typedef
struct
tagIOINFO
{
unsigned
char
bComBit
PACKED
;
unsigned
char
bIOExchangeMode
PACKED
;
unsigned
int
ulIOExchangeCnt
PACKED
;
}
IOINFO
;
typedef
struct
tagVERSIONINFO
{
/* DEV serial number and OS versions */
typedef
struct
tagVERSIONINFO
{
/* DEV serial number and OS versions */
unsigned
int
ulDate
PACKED
PACKED
;
unsigned
int
ulDeviceNo
PACKED
;
unsigned
int
ulSerialNo
PACKED
;
...
...
@@ -182,33 +185,40 @@ typedef struct tagVERSIONINFO { /* DEV serial number and OS versions */
unsigned
char
OemIdentifier
[
4
]
PACKED
;
}
VERSIONINFO
;
typedef
struct
tagFIRMWAREINFO
{
typedef
struct
tagFIRMWAREINFO
{
unsigned
char
FirmwareName
[
16
]
PACKED
;
unsigned
char
FirmwareVersion
[
16
]
PACKED
;
}
FIRMWAREINFO
;
typedef
struct
tagTASKSTATE
{
typedef
struct
tagTASKSTATE
{
unsigned
char
TaskState
[
64
]
PACKED
;
}
TASKSTATE
;
typedef
struct
tagTASKPARAM
{
typedef
struct
tagTASKPARAM
{
unsigned
char
TaskParameter
[
64
]
PACKED
;
}
TASKPARAM
;
typedef
struct
tagRAWDATA
{
typedef
struct
tagRAWDATA
{
unsigned
char
abRawData
[
1022
]
PACKED
;
}
RAWDATA
;
typedef
struct
tagTASKINFO
{
struct
{
char
TaskName
[
8
]
PACKED
;
/* Task name */
typedef
struct
tagTASKINFO
{
struct
{
char
TaskName
[
8
]
PACKED
;
/* Task name */
unsigned
short
Version
PACKED
;
/* Task version */
unsigned
char
TaskCondition
PACKED
;
unsigned
char
reserved
[
5
]
PACKED
;
/* n.c. */
}
tInfo
[
7
];
}
TASKINFO
;
typedef
struct
tagRCSINFO
{
typedef
struct
tagRCSINFO
{
unsigned
short
RcsVersion
PACKED
;
/* Operationsystem Version */
unsigned
char
RcsError
PACKED
;
unsigned
char
HostWatchDog
PACKED
;
...
...
@@ -218,7 +228,8 @@ typedef struct tagRCSINFO {
unsigned
char
DriverType
PACKED
;
}
RCSINFO
;
typedef
struct
tagDEVINFO
{
typedef
struct
tagDEVINFO
{
unsigned
char
DpmSize
PACKED
;
unsigned
char
DevType
PACKED
;
unsigned
char
DevModel
PACKED
;
...
...
@@ -232,45 +243,50 @@ typedef struct tagDEVINFO {
*/
// Board information structure
typedef
struct
tagBOARD_INFO
{
typedef
struct
tagBOARD_INFO
{
unsigned
char
abDriverVersion
[
16
]
PACKED
;
// DRV driver information string
struct
{
unsigned
short
usBoard
PACKED
;
// DRV board number
unsigned
short
usAvailable
PACKED
;
// DRV board is available
struct
{
unsigned
short
usBoard
PACKED
;
// DRV board number
unsigned
short
usAvailable
PACKED
;
// DRV board is available
unsigned
long
ulPhysicalAddress
PACKED
;
// DRV physical DPM address
unsigned
short
usIrq
PACKED
;
// DRV irq number
unsigned
short
usIrq
PACKED
;
// DRV irq number
}
tBoard
[
MAX_DEV_BOARDS
];
unsigned
short
usBoards_detected
PACKED
;
}
BOARD_INFO
;
// Driver information structure
typedef
struct
tagDRIVERINFO
{
unsigned
long
OpenCnt
PACKED
;
// number of driver open
unsigned
long
CloseCnt
PACKED
;
// number of driver close
unsigned
long
ReadCnt
PACKED
;
// number of DevGetMessage commands
unsigned
long
WriteCnt
PACKED
;
// number of DevPutMessage commands
unsigned
long
IRQCnt
PACKED
;
// number of IRQs
unsigned
char
InitMsgFlag
PACKED
;
// DPM state init
unsigned
char
ReadMsgFlag
PACKED
;
// DPM state read message
typedef
struct
tagDRIVERINFO
{
unsigned
long
OpenCnt
PACKED
;
// number of driver open
unsigned
long
CloseCnt
PACKED
;
// number of driver close
unsigned
long
ReadCnt
PACKED
;
// number of DevGetMessage commands
unsigned
long
WriteCnt
PACKED
;
// number of DevPutMessage commands
unsigned
long
IRQCnt
PACKED
;
// number of IRQs
unsigned
char
InitMsgFlag
PACKED
;
// DPM state init
unsigned
char
ReadMsgFlag
PACKED
;
// DPM state read message
unsigned
char
WriteMsgFlag
PACKED
;
// DPM state write message
unsigned
char
LastFunction
PACKED
;
// DRV last function in driver
unsigned
char
WriteState
PACKED
;
// DRV actual write state
unsigned
char
ReadState
PACKED
;
// DRV actual read state
unsigned
char
HostFlags
PACKED
;
// DPM HostFlags (PcFlags)
unsigned
char
MyDevFlags
PACKED
;
// DPM (internal) DevFlags
unsigned
char
ExComBit
PACKED
;
// COM bit
unsigned
long
ExIOCnt
PACKED
;
// IO data exchange count
unsigned
char
WriteState
PACKED
;
// DRV actual write state
unsigned
char
ReadState
PACKED
;
// DRV actual read state
unsigned
char
HostFlags
PACKED
;
// DPM HostFlags (PcFlags)
unsigned
char
MyDevFlags
PACKED
;
// DPM (internal) DevFlags
unsigned
char
ExComBit
PACKED
;
// COM bit
unsigned
long
ExIOCnt
PACKED
;
// IO data exchange count
}
DRIVERINFO
;
// Extended board information structure
typedef
struct
tagBOARD_INFOEX
{
typedef
struct
tagBOARD_INFOEX
{
unsigned
char
abDriverVersion
[
16
]
PACKED
;
// DRV driver information string
struct
{
unsigned
short
usBoard
PACKED
;
// DRV board number
unsigned
short
usAvailable
PACKED
;
// DRV board is available
struct
{
unsigned
short
usBoard
PACKED
;
// DRV board number
unsigned
short
usAvailable
PACKED
;
// DRV board is available
unsigned
long
ulPhysicalAddress
PACKED
;
// DRV physical DPM address
unsigned
short
usIrq
PACKED
;
// DRV irq number
DRIVERINFO
tDriverInfo
PACKED
;
// Driver information
unsigned
short
usIrq
PACKED
;
// DRV irq number
DRIVERINFO
tDriverInfo
PACKED
;
// Driver information
FIRMWAREINFO
tFirmware
PACKED
;
DEVINFO
tDeviceInfo
PACKED
;
RCSINFO
tRcsInfo
PACKED
;
...
...
@@ -279,10 +295,11 @@ typedef struct tagBOARD_INFOEX {
}
BOARD_INFOEX
;
// State field structure
typedef
struct
tagCOMSTATE
{
unsigned
short
usMode
PACKED
;
// Actual STATE mode
typedef
struct
tagCOMSTATE
{
unsigned
short
usMode
PACKED
;
// Actual STATE mode
unsigned
short
usStateFlag
PACKED
;
// State flag
unsigned
char
abState
[
64
]
PACKED
;
// State area
unsigned
char
abState
[
64
]
PACKED
;
// State area
}
COMSTATE
;
// state information in bLastFunction
...
...
@@ -345,7 +362,8 @@ typedef struct tagCOMSTATE {
#define CIF_IOC_MAXNR 25
// interface structure for ioctl's
typedef
struct
cif_ioctl_data
{
typedef
struct
cif_ioctl_data
{
unsigned
long
lInpBuffLen
PACKED
;
unsigned
long
lOutBuffLen
PACKED
;
unsigned
char
*
pInpBuff
PACKED
;
...
...
@@ -353,7 +371,8 @@ typedef struct cif_ioctl_data {
}
cif_ioctl_data
;
// SET BOARD OPERATION MODE
typedef
struct
tagDEVIO_SETOPMODE
{
typedef
struct
tagDEVIO_SETOPMODE
{
unsigned
short
usBoard
PACKED
;
unsigned
short
usMode
PACKED
;
// Interrupt/polling mode
unsigned
short
usIrq
PACKED
;
...
...
@@ -361,17 +380,19 @@ typedef struct tagDEVIO_SETOPMODE {
}
DEVIO_SETOPMODE
;
// GETBOARDINFORMATION
typedef
struct
tagDEVIO_GETBOARDINFOCMD
{
typedef
struct
tagDEVIO_GETBOARDINFOCMD
{
unsigned
short
usDevNumber
PACKED
;
// n.a.
unsigned
short
usInfoLen
PACKED
;
// Information length
unsigned
short
usInfoLen
PACKED
;
// Information length
BOARD_INFO
*
ptBoardInfo
PACKED
;
short
sError
PACKED
;
}
DEVIO_GETBOARDINFOCMD
;
// Extnded GETBOARDINFORMATION
typedef
struct
tagDEVIO_GETBOARDINFOEXCMD
{
typedef
struct
tagDEVIO_GETBOARDINFOEXCMD
{
unsigned
short
usDevNumber
PACKED
;
// n.a.
unsigned
short
usInfoLen
PACKED
;
// Information length
unsigned
short
usInfoLen
PACKED
;
// Information length
BOARD_INFOEX
*
ptBoard
PACKED
;
short
sError
PACKED
;
}
DEVIO_GETBOARDINFOEXCMD
;
...
...
@@ -382,17 +403,19 @@ typedef struct tagDEVIO_GETBOARDINFOEXCMD {
#define WARMSTART 3
#define BOOTSTART 4
typedef
struct
tagDEVIO_RESETCMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
short
usMode
PACKED
;
// DEV function
typedef
struct
tagDEVIO_RESETCMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
short
usMode
PACKED
;
// DEV function
unsigned
long
ulTimeout
PACKED
;
// Service timeout
unsigned
long
ulDpmSize
PACKED
;
short
sError
PACKED
;
}
DEVIO_RESETCMD
;
// PUTTASKPARAMETER
typedef
struct
tagDEVIO_PUTPARAMETERCMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
typedef
struct
tagDEVIO_PUTPARAMETERCMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
short
usTaskParamNum
PACKED
;
// Number of the parameter area
unsigned
short
usTaskParamLen
PACKED
;
// Lenght of parameter data
unsigned
char
TaskParameter
[
64
]
PACKED
;
...
...
@@ -400,25 +423,28 @@ typedef struct tagDEVIO_PUTPARAMETERCMD {
}
DEVIO_PUTPARAMETERCMD
;
// PUTMESSAGE
typedef
struct
tagDEVIO_PUTMESSAGECMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
MSG_STRUC
tMsg
PACKED
;
// Message data
typedef
struct
tagDEVIO_PUTMESSAGECMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
MSG_STRUC
tMsg
PACKED
;
// Message data
unsigned
long
ulTimeout
PACKED
;
// Service timeout
short
sError
PACKED
;
}
DEVIO_PUTMESSAGECMD
;
// GETMESSAGE
typedef
struct
tagDEVIO_GETMESSAGECMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
typedef
struct
tagDEVIO_GETMESSAGECMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
long
ulTimeout
PACKED
;
// Service timeout
unsigned
long
ulMsgSize
PACKED
;
// User message buffer size
MSG_STRUC
tMsg
PACKED
;
// Message data
MSG_STRUC
tMsg
PACKED
;
// Message data
short
sError
PACKED
;
}
DEVIO_GETMESSAGECMD
;
// GETTASKSTATE
typedef
struct
tagDEVIO_GETTASKSTATECMD
{
unsigned
char
ucBoard
PACKED
;
// DEV board number
typedef
struct
tagDEVIO_GETTASKSTATECMD
{
unsigned
char
ucBoard
PACKED
;
// DEV board number
unsigned
short
usStateNum
PACKED
;
// Task state field number
unsigned
short
usStateLen
PACKED
;
// Lenght of state data
unsigned
char
TaskState
[
64
]
PACKED
;
...
...
@@ -433,9 +459,10 @@ typedef struct tagDEVIO_GETTASKSTATECMD {
#define HOST_MBX_FULL 1
#define HOST_MBX_SYSERR 2
typedef
struct
tagDEVIO_MBXINFOCMD
{
unsigned
char
ucBoard
PACKED
;
// DEV board number
unsigned
short
usDevMbxState
PACKED
;
// State of the device mailbox
typedef
struct
tagDEVIO_MBXINFOCMD
{
unsigned
char
ucBoard
PACKED
;
// DEV board number
unsigned
short
usDevMbxState
PACKED
;
// State of the device mailbox
unsigned
short
usHostMbxState
PACKED
;
// State of the host mailbox
short
sError
PACKED
;
}
DEVIO_MBXINFOCMD
;
...
...
@@ -452,10 +479,11 @@ typedef struct tagDEVIO_MBXINFOCMD {
#define SPECIAL_CONTROL_CLEAR 0
#define SPECIAL_CONTROL_SET 1
typedef
struct
tagDEVIO_TRIGGERCMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
short
usMode
PACKED
;
// DEV function
unsigned
long
ulTimeout
PACKED
;
// DEV timeout
typedef
struct
tagDEVIO_TRIGGERCMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
short
usMode
PACKED
;
// DEV function
unsigned
long
ulTimeout
PACKED
;
// DEV timeout
unsigned
short
usTriggerValue
PACKED
;
// DEV trigger value
short
sError
PACKED
;
}
DEVIO_TRIGGERCMD
;
...
...
@@ -472,24 +500,27 @@ typedef struct tagDEVIO_TRIGGERCMD {
#define GET_IO_INFO 7
#define GET_IO_SEND_DATA 8
typedef
struct
tagDEVIO_GETDEVINFOCMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
short
usInfoArea
PACKED
;
// Number of info area
unsigned
short
usInfoLen
PACKED
;
// Lenght of info data
typedef
struct
tagDEVIO_GETDEVINFOCMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
short
usInfoArea
PACKED
;
// Number of info area
unsigned
short
usInfoLen
PACKED
;
// Lenght of info data
unsigned
char
*
pabInfoData
PACKED
;
// Pointer to info data area
short
sError
PACKED
;
}
DEVIO_GETDEVINFOCMD
;
// EXITDRV
typedef
struct
tagDEVIO_EXITCMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
typedef
struct
tagDEVIO_EXITCMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
short
usDrvOpenCount
PACKED
;
// dr�er opencount
short
sError
PACKED
;
}
DEVIO_EXITCMD
;
// GETTASKPARAMETER
typedef
struct
tagDEVIO_GETPARAMETERCMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
typedef
struct
tagDEVIO_GETPARAMETERCMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
short
usTaskParamNum
PACKED
;
// Number of the parameter area
unsigned
short
usTaskParamLen
PACKED
;
// Lenght of parameter data
unsigned
char
TaskParameter
[
64
]
PACKED
;
...
...
@@ -497,30 +528,32 @@ typedef struct tagDEVIO_GETPARAMETERCMD {
}
DEVIO_GETPARAMETERCMD
;
// EXIO
typedef
struct
tagDEVIO_EXIOCMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
short
usSendOffset
PACKED
;
// Byte offset send data
unsigned
short
usSendLen
PACKED
;
// Length of send data
unsigned
char
*
pabSendData
PACKED
;
// Send data buffer
typedef
struct
tagDEVIO_EXIOCMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
short
usSendOffset
PACKED
;
// Byte offset send data
unsigned
short
usSendLen
PACKED
;
// Length of send data
unsigned
char
*
pabSendData
PACKED
;
// Send data buffer
unsigned
short
usReceiveOffset
PACKED
;
// Byte offset receive data
unsigned
short
usReceiveLen
PACKED
;
// Length of receive data
unsigned
char
*
pabReceiveData
PACKED
;
// Receive data buffer
unsigned
long
ulTimeout
PACKED
;
// Service timeout
unsigned
short
usReceiveLen
PACKED
;
// Length of receive data
unsigned
char
*
pabReceiveData
PACKED
;
// Receive data buffer
unsigned
long
ulTimeout
PACKED
;
// Service timeout
short
sError
PACKED
;
}
DEVIO_EXIOCMD
;
// EXIOEX
typedef
struct
tagDEVIO_EXIOCMDEX
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
short
usSendOffset
PACKED
;
// Byte offset send data
unsigned
short
usSendLen
PACKED
;
// Length of send data
unsigned
char
*
pabSendData
PACKED
;
// Send data buffer
typedef
struct
tagDEVIO_EXIOCMDEX
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
short
usSendOffset
PACKED
;
// Byte offset send data
unsigned
short
usSendLen
PACKED
;
// Length of send data
unsigned
char
*
pabSendData
PACKED
;
// Send data buffer
unsigned
short
usReceiveOffset
PACKED
;
// Byte offset receive data
unsigned
short
usReceiveLen
PACKED
;
// Length of receive data
unsigned
char
*
pabReceiveData
PACKED
;
// Receive data buffer
unsigned
long
ulTimeout
PACKED
;
// Service timeout
short
sError
PACKED
;
// --- Equal to "ExcahangeIOCmd"
unsigned
short
usMode
PACKED
;
// External exchange mode
unsigned
short
usReceiveLen
PACKED
;
// Length of receive data
unsigned
char
*
pabReceiveData
PACKED
;
// Receive data buffer
unsigned
long
ulTimeout
PACKED
;
// Service timeout
short
sError
PACKED
;
// --- Equal to "ExcahangeIOCmd"
unsigned
short
usMode
PACKED
;
// External exchange mode
}
DEVIO_EXIOCMDEX
;
// EXIOERR
...
...
@@ -531,65 +564,71 @@ typedef struct tagDEVIO_EXIOCMDEX {
#define STATE_MODE_3 3
#define STATE_MODE_4 4
typedef
struct
tagDEVIO_EXIOCMDERR
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
short
usSendOffset
PACKED
;
// Byte offset send data
unsigned
short
usSendLen
PACKED
;
// Length of send data
unsigned
char
*
pabSendData
PACKED
;
// Send data buffer
typedef
struct
tagDEVIO_EXIOCMDERR
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
short
usSendOffset
PACKED
;
// Byte offset send data
unsigned
short
usSendLen
PACKED
;
// Length of send data
unsigned
char
*
pabSendData
PACKED
;
// Send data buffer
unsigned
short
usReceiveOffset
PACKED
;
// Byte offset receive data
unsigned
short
usReceiveLen
PACKED
;
// Length of receive data
unsigned
char
*
pabReceiveData
PACKED
;
// Receive data buffer
unsigned
long
ulTimeout
PACKED
;
// Service timeout
short
sError
PACKED
;
// --- Equal to "ExcahangeIOCmd"
COMSTATE
*
ptStateData
PACKED
;
// State data buffer
unsigned
short
usReceiveLen
PACKED
;
// Length of receive data
unsigned
char
*
pabReceiveData
PACKED
;
// Receive data buffer
unsigned
long
ulTimeout
PACKED
;
// Service timeout
short
sError
PACKED
;
// --- Equal to "ExcahangeIOCmd"
COMSTATE
*
ptStateData
PACKED
;
// State data buffer
}
DEVIO_EXIOCMDERR
;
// READIO
typedef
struct
tagDEVIO_READSENDCMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
typedef
struct
tagDEVIO_READSENDCMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
short
usReadOffset
PACKED
;
// Byte offset send/receive data
unsigned
short
usReadLen
PACKED
;
// Length of send/receive data
unsigned
char
*
pabReadData
PACKED
;
// Read send data buffer
unsigned
short
usReadLen
PACKED
;
// Length of send/receive data
unsigned
char
*
pabReadData
PACKED
;
// Read send data buffer
short
sError
PACKED
;
}
DEVIO_READSENDCMD
;
// ExtData
#define EXTDATASIZE 20
typedef
struct
tagDEVIO_EXTDATACMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
short
usMode
PACKED
;
// DEV mode
typedef
struct
tagDEVIO_EXTDATACMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
short
usMode
PACKED
;
// DEV mode
unsigned
char
*
pabExtData
PACKED
;
// DEV Extended data
short
sError
PACKED
;
}
DEVIO_EXTDATACMD
;
// GetMbxData
typedef
struct
tagDEVIO_GETMBXCMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
short
usDevLen
PACKED
;
// DEV length of dev data
unsigned
short
usHostLen
PACKED
;
// DEV length of host data
typedef
struct
tagDEVIO_GETMBXCMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
short
usDevLen
PACKED
;
// DEV length of dev data
unsigned
short
usHostLen
PACKED
;
// DEV length of host data
unsigned
char
abHostMbx
[
288
]
PACKED
;
// DEV pointer to host data buffer
unsigned
char
abDevMbx
[
288
]
PACKED
;
// DEV pointer to device data buffer
unsigned
char
abDevMbx
[
288
]
PACKED
;
// DEV pointer to device data buffer
short
sError
PACKED
;
}
DEVIO_GETMBXCMD
;
// ReadWriteRawData
#define PARAMETER_READ 1
#define PARAMETER_WRITE 2
typedef
struct
tagDEVIO_RWRAWDATACMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
short
usMode
PACKED
;
// DEV read or write
typedef
struct
tagDEVIO_RWRAWDATACMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
short
usMode
PACKED
;
// DEV read or write
unsigned
short
usOffset
PACKED
;
// DEV offset in the DPM last kByte
unsigned
short
usLen
PACKED
;
// DEV length of data
unsigned
char
*
pabData
PACKED
;
// DEV pointer to data buffer
unsigned
short
usLen
PACKED
;
// DEV length of data
unsigned
char
*
pabData
PACKED
;
// DEV pointer to data buffer
short
sError
PACKED
;
}
DEVIO_RWRAWDATACMD
;
// ReadWriteDPMData
typedef
struct
tagDEVIO_RWDPMDATACMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
short
usMode
PACKED
;
// DEV read or write
typedef
struct
tagDEVIO_RWDPMDATACMD
{
unsigned
short
usBoard
PACKED
;
// DEV board number
unsigned
short
usMode
PACKED
;
// DEV read or write
unsigned
short
usOffset
PACKED
;
// DEV offset in the DPM last kByte
unsigned
short
usLen
PACKED
;
// DEV length of data
unsigned
char
*
pabData
PACKED
;
// DEV pointer to data buffer
unsigned
short
usLen
PACKED
;
// DEV length of data
unsigned
char
*
pabData
PACKED
;
// DEV pointer to data buffer
short
sError
PACKED
;
}
DEVIO_RWDPMDATACMD
;
...
...
@@ -598,14 +637,15 @@ typedef struct tagDEVIO_RWDPMDATACMD {
#define DPM_PTR_OPEN_USR 2
#define DPM_PTR_CLOSE 3
typedef
struct
tagDEVIO_GETDPMPTR
{
unsigned
short
usMode
PACKED
;
// DEV mode
unsigned
short
usBoard
PACKED
;
// DEV board number
void
*
pvUserData
PACKED
;
// DEV user data for pmi
typedef
struct
tagDEVIO_GETDPMPTR
{
unsigned
short
usMode
PACKED
;
// DEV mode
unsigned
short
usBoard
PACKED
;
// DEV board number
void
*
pvUserData
PACKED
;
// DEV user data for pmi
unsigned
long
*
pulDPMSize
PACKED
;
// DEV DPM size in bytes
unsigned
char
**
pDPMBase
PACKED
;
// DEV pointer to data buffer
unsigned
long
lError
PACKED
;
// DEV system error
short
sError
PACKED
;
// DEV driver error
unsigned
char
**
pDPMBase
PACKED
;
// DEV pointer to data buffer
unsigned
long
lError
PACKED
;
// DEV system error
short
sError
PACKED
;
// DEV driver error
}
DEVIO_GETDPMPTR
;
#ifdef _cplusplus
...
...
profibus/lib/rt/src/cif_types.h
View file @
df0831a3
...
...
@@ -54,7 +54,7 @@
printk(fmt, function, lineno, ##args)
#define DBG_PRN(fmt, args...) \
CIF_PRN((__FUNCTION__), (__LINE__), KERN_INFO __FILE__ "::%s(L%.4d): " fmt, \
##args)
##args)
#else
#define DBG_PRN(fmt, args...)
/* not debugging: nothing */
#endif
...
...
profibus/lib/rt/src/cif_user.h
View file @
df0831a3
...
...
@@ -72,11 +72,11 @@ extern "C" {
/* ------------------------------------------------------------------------------------
*/
#define DRV_NO_ERROR 0 // no error
#define DRV_NO_ERROR 0
// no error
#define DRV_BOARD_NOT_INITIALIZED -1 // DRIVER Board not initialized
#define DRV_INIT_STATE_ERROR -2 // DRIVER Error in internal init state
#define DRV_READ_STATE_ERROR -3 // DRIVER Error in internal read state
#define DRV_CMD_ACTIVE -4 // DRIVER Command on this channel is activ
#define DRV_INIT_STATE_ERROR -2
// DRIVER Error in internal init state
#define DRV_READ_STATE_ERROR -3
// DRIVER Error in internal read state
#define DRV_CMD_ACTIVE -4
// DRIVER Command on this channel is activ
#define DRV_PARAMETER_UNKNOWN -5 // DRIVER Unknown parameter in function occured
#define DRV_WRONG_DRIVER_VERSION -6 // DRIVER Version is incompatible with DLL
...
...
@@ -87,21 +87,21 @@ extern "C" {
#define DRV_DEV_DPM_ACCESS_ERROR \
-10 // DEVICE Dual port ram not accessable(board not found)
#define DRV_DEV_NOT_READY -11 // DEVICE Not ready (ready flag failed)
#define DRV_DEV_NOT_RUNNING -12 // DEVICE Not running (running flag failed)
#define DRV_DEV_WATCHDOG_FAILED -13 // DEVICE Watchdog test failed
#define DRV_DEV_NOT_READY -11
// DEVICE Not ready (ready flag failed)
#define DRV_DEV_NOT_RUNNING -12
// DEVICE Not running (running flag failed)
#define DRV_DEV_WATCHDOG_FAILED -13
// DEVICE Watchdog test failed
#define DRV_DEV_OS_VERSION_ERROR -14 // DEVICE Signals wrong OS version
#define DRV_DEV_SYSERR -15 // DEVICE Error in dual port flags
#define DRV_DEV_MAILBOX_FULL -16 // DEVICE Send mailbox is full
#define DRV_DEV_PUT_TIMEOUT -17 // DEVICE PutMessage timeout
#define DRV_DEV_GET_TIMEOUT -18 // DEVICE GetMessage timeout
#define DRV_DEV_GET_NO_MESSAGE -19 // DEVICE No message available
#define DRV_DEV_RESET_TIMEOUT -20 // DEVICE RESET command timeout
#define DRV_DEV_NO_COM_FLAG -21 // DEVICE COM-flag not set
#define DRV_DEV_EXCHANGE_FAILED -22 // DEVICE IO data exchange failed
#define DRV_DEV_SYSERR -15
// DEVICE Error in dual port flags
#define DRV_DEV_MAILBOX_FULL -16
// DEVICE Send mailbox is full
#define DRV_DEV_PUT_TIMEOUT -17
// DEVICE PutMessage timeout
#define DRV_DEV_GET_TIMEOUT -18
// DEVICE GetMessage timeout
#define DRV_DEV_GET_NO_MESSAGE -19
// DEVICE No message available
#define DRV_DEV_RESET_TIMEOUT -20
// DEVICE RESET command timeout
#define DRV_DEV_NO_COM_FLAG -21
// DEVICE COM-flag not set
#define DRV_DEV_EXCHANGE_FAILED -22
// DEVICE IO data exchange failed
#define DRV_DEV_EXCHANGE_TIMEOUT -23 // DEVICE IO data exchange timeout
#define DRV_DEV_COM_MODE_UNKNOWN -24 // DEVICE IO data mode unknown
#define DRV_DEV_FUNCTION_FAILED -25 // DEVICE Function call failed
#define DRV_DEV_FUNCTION_FAILED -25
// DEVICE Function call failed
#define DRV_DEV_DPMSIZE_MISMATCH \
-26 // DEVICE DPM size differs from configuration
#define DRV_DEV_STATE_MODE_UNKNOWN -27 // DEVICE State mode unknown
...
...
@@ -112,17 +112,17 @@ extern "C" {
#define DRV_USR_INIT_DRV_ERROR -31 // USER Can't connect with device
#define DRV_USR_NOT_INITIALIZED \
-32 // USER Board not initialized (DevInitBoard not called)
#define DRV_USR_COMM_ERR -33 // USER IOCTRL function failed
#define DRV_USR_COMM_ERR -33
// USER IOCTRL function failed
#define DRV_USR_DEV_NUMBER_INVALID -34 // USER Parameter DeviceNumber invalid
#define DRV_USR_INFO_AREA_INVALID -35 // USER Parameter InfoArea unknown
#define DRV_USR_NUMBER_INVALID -36 // USER Parameter Number invalid
#define DRV_USR_MODE_INVALID -37 // USER Parameter Mode invalid
#define DRV_USR_MSG_BUF_NULL_PTR -38 // USER NULL pointer assignment
#define DRV_USR_MSG_BUF_TOO_SHORT -39 // USER Message buffer too short
#define DRV_USR_SIZE_INVALID -40 // USER Parameter Size invalid
#define DRV_USR_SIZE_ZERO -42 // USER Parameter Size with zero length
#define DRV_USR_SIZE_TOO_LONG -43 // USER Parameter Size too long
#define DRV_USR_DEV_PTR_NULL -44 // USER Device address null pointer
#define DRV_USR_INFO_AREA_INVALID -35
// USER Parameter InfoArea unknown
#define DRV_USR_NUMBER_INVALID -36
// USER Parameter Number invalid
#define DRV_USR_MODE_INVALID -37
// USER Parameter Mode invalid
#define DRV_USR_MSG_BUF_NULL_PTR -38
// USER NULL pointer assignment
#define DRV_USR_MSG_BUF_TOO_SHORT -39
// USER Message buffer too short
#define DRV_USR_SIZE_INVALID -40
// USER Parameter Size invalid
#define DRV_USR_SIZE_ZERO -42
// USER Parameter Size with zero length
#define DRV_USR_SIZE_TOO_LONG -43
// USER Parameter Size too long
#define DRV_USR_DEV_PTR_NULL -44
// USER Device address null pointer
#define DRV_USR_BUF_PTR_NULL -45 // USER Pointer to buffer is a null pointer
#define DRV_USR_SENDSIZE_TOO_LONG -46 // USER Parameter SendSize too long
...
...
@@ -132,13 +132,13 @@ extern "C" {
#define DRV_USR_RECVBUF_PTR_NULL \
-49 // USER Pointer to receive buffer is a null pointer
#define DRV_DEV_NO_VIRTUAL_MEM -60 // DEVICE Virtual memory not available
#define DRV_DEV_UNMAP_VIRTUAL_MEM -61 // DEVICE Unmap virtual memory failed
#define DRV_DEV_NO_VIRTUAL_MEM -60
// DEVICE Virtual memory not available
#define DRV_DEV_UNMAP_VIRTUAL_MEM -61
// DEVICE Unmap virtual memory failed
#define DRV_DEV_REQUEST_IRQ_FAILED -62 // DEVICE Request irq failed
#define DRV_USR_FILE_OPEN_FAILED -100 // USER file not opend
#define DRV_USR_FILE_SIZE_ZERO -101 // USER file size zero
#define DRV_USR_FILE_NO_MEMORY -102 // USER not enough memory to load file
#define DRV_USR_FILE_SIZE_ZERO -101
// USER file size zero
#define DRV_USR_FILE_NO_MEMORY -102
// USER not enough memory to load file
#define DRV_USR_FILE_READ_FAILED -103 // USER file read failed
#define DRV_USR_INVALID_FILETYPE -104 // USER file type invalid
#define DRV_USR_FILENAME_INVALID -105 // USER file name not valid
...
...
@@ -156,7 +156,8 @@ extern "C" {
*/
// max. length is 288 Bytes, max message length is 255 + 8 Bytes
typedef
struct
tagMSG_STRUC
{
typedef
struct
tagMSG_STRUC
{
unsigned
char
rx
PACKED
;
unsigned
char
tx
PACKED
;
unsigned
char
ln
PACKED
;
...
...
@@ -230,14 +231,16 @@ typedef struct tagMSG_STRUC {
#define CONFIGURATION_DOWNLOAD 2
// Device exchange IO information
typedef
struct
tagIOINFO
{
typedef
struct
tagIOINFO
{
unsigned
char
bComBit
PACKED
;
/* Actual state of the COM bit */
unsigned
char
bIOExchangeMode
PACKED
;
/* Actual data exchange mode (0..5) */
unsigned
int
ulIOExchangeCnt
PACKED
;
/* Exchange IO counter */
unsigned
int
ulIOExchangeCnt
PACKED
;
/* Exchange IO counter */
}
IOINFO
;
// Device version information
typedef
struct
tagVERSIONINFO
{
/* DEV serial number and OS versions */
typedef
struct
tagVERSIONINFO
{
/* DEV serial number and OS versions */
unsigned
int
ulDate
PACKED
;
unsigned
int
ulDeviceNo
PACKED
;
unsigned
int
ulSerialNo
PACKED
;
...
...
@@ -249,52 +252,60 @@ typedef struct tagVERSIONINFO { /* DEV serial number and OS versions */
}
VERSIONINFO
;
// Device firmware information
typedef
struct
tagFIRMWAREINFO
{
unsigned
char
abFirmwareName
[
16
]
PACKED
;
/* Firmware name */
typedef
struct
tagFIRMWAREINFO
{
unsigned
char
abFirmwareName
[
16
]
PACKED
;
/* Firmware name */
unsigned
char
abFirmwareVersion
[
16
]
PACKED
;
/* Firmware version */
}
FIRMWAREINFO
;
// Device task state information
typedef
struct
tagTASKSTATE
{
typedef
struct
tagTASKSTATE
{
unsigned
char
abTaskState
[
64
]
PACKED
;
/* Task state field */
}
TASKSTATE
;
// Device task paramater data
typedef
struct
tagTASKPARAM
{
typedef
struct
tagTASKPARAM
{
unsigned
char
abTaskParameter
[
64
]
PACKED
;
/* Task parameter field */
}
TASKPARAM
;
// Device raw data structure
typedef
struct
tagRAWDATA
{
typedef
struct
tagRAWDATA
{
unsigned
char
abRawData
[
1022
]
PACKED
;
/* Definition of the last kByte */
}
RAWDATA
;
// Device task information
typedef
struct
tagTASKINFO
{
struct
{
unsigned
char
abTaskName
[
8
]
PACKED
;
/* Task name */
typedef
struct
tagTASKINFO
{
struct
{
unsigned
char
abTaskName
[
8
]
PACKED
;
/* Task name */
unsigned
short
usTaskVersion
PACKED
;
/* Task version */
unsigned
char
bTaskCondition
PACKED
;
/* Actual task condition */
unsigned
char
abreserved
[
5
]
PACKED
;
/* n.c. */
unsigned
char
abreserved
[
5
]
PACKED
;
/* n.c. */
}
tTaskInfo
[
7
];
}
TASKINFO
;
// Device operating system (RCS) information
typedef
struct
tagRCSINFO
{
typedef
struct
tagRCSINFO
{
unsigned
short
usRcsVersion
PACKED
;
/* Device operating system (RCS) version */
unsigned
char
bRcsError
PACKED
;
/* Operating system errors */
unsigned
char
bRcsError
PACKED
;
/* Operating system errors */
unsigned
char
bHostWatchDog
PACKED
;
/* Host watchdog value */
unsigned
char
bDevWatchDog
PACKED
;
/* Device watchdog value */
unsigned
char
bDevWatchDog
PACKED
;
/* Device watchdog value */
unsigned
char
bSegmentCount
PACKED
;
/* RCS segment free counter */
unsigned
char
bDeviceAdress
PACKED
;
/* RCS device base address */
unsigned
char
bDriverType
PACKED
;
/* RCS driver type */
unsigned
char
bDriverType
PACKED
;
/* RCS driver type */
}
RCSINFO
;
// Device description
typedef
struct
tagDEVINFO
{
unsigned
char
bDpmSize
PACKED
;
/* Device dpm size (2,8...) */
unsigned
char
bDevType
PACKED
;
/* Device type (manufactor code) */
typedef
struct
tagDEVINFO
{
unsigned
char
bDpmSize
PACKED
;
/* Device dpm size (2,8...) */
unsigned
char
bDevType
PACKED
;
/* Device type (manufactor code) */
unsigned
char
bDevModel
PACKED
;
/* Device model (manufactor code) */
unsigned
char
abDevIdentifier
[
3
]
PACKED
;
/* Device identification characters */
...
...
@@ -307,45 +318,50 @@ typedef struct tagDEVINFO {
*/
// Board information structure
typedef
struct
tagBOARD_INFO
{
typedef
struct
tagBOARD_INFO
{
unsigned
char
abDriverVersion
[
16
]
PACKED
;
// DRV driver information string
struct
{
unsigned
short
usBoard
PACKED
;
// DRV board number
unsigned
short
usAvailable
PACKED
;
// DRV board is available
struct
{
unsigned
short
usBoard
PACKED
;
// DRV board number
unsigned
short
usAvailable
PACKED
;
// DRV board is available
unsigned
long
ulPhysicalAddress
PACKED
;
// DRV physical DPM address
unsigned
short
usIrq
PACKED
;
// DRV irq number
unsigned
short
usIrq
PACKED
;
// DRV irq number
}
tBoard
[
MAX_DEV_BOARDS
];
unsigned
short
usBoards_detected
PACKED
;
}
BOARD_INFO
;
// Internal driver state information structure
typedef
struct
tagDRIVERINFO
{
unsigned
long
ulOpenCnt
PACKED
;
// DevOpen() counter
unsigned
long
CloseCnt
PACKED
;
// number of driver close
unsigned
long
ulReadCnt
PACKED
;
// Number of DevGetMessage commands
unsigned
long
ulWriteCnt
PACKED
;
// Number of DevPutMessage commands
unsigned
long
ulIRQCnt
PACKED
;
// Number of board interrupts
unsigned
char
bInitMsgFlag
PACKED
;
// Actual init sate
unsigned
char
bReadMsgFlag
PACKED
;
// Actual read mailbox state
typedef
struct
tagDRIVERINFO
{
unsigned
long
ulOpenCnt
PACKED
;
// DevOpen() counter
unsigned
long
CloseCnt
PACKED
;
// number of driver close
unsigned
long
ulReadCnt
PACKED
;
// Number of DevGetMessage commands
unsigned
long
ulWriteCnt
PACKED
;
// Number of DevPutMessage commands
unsigned
long
ulIRQCnt
PACKED
;
// Number of board interrupts
unsigned
char
bInitMsgFlag
PACKED
;
// Actual init sate
unsigned
char
bReadMsgFlag
PACKED
;
// Actual read mailbox state
unsigned
char
bWriteMsgFlag
PACKED
;
// Actual write mailbox state
unsigned
char
bLastFunction
PACKED
;
// Last driver function
unsigned
char
bWriteState
PACKED
;
// Actual write command state
unsigned
char
bReadState
PACKED
;
// Actual read command state
unsigned
char
bHostFlags
PACKED
;
// Actual host flags
unsigned
char
bMyDevFlags
PACKED
;
// Actual device falgs
unsigned
char
bExIOFlag
PACKED
;
// Actual IO flags
unsigned
long
ulExIOCnt
PACKED
;
// DevExchangeIO() counter
unsigned
char
bWriteState
PACKED
;
// Actual write command state
unsigned
char
bReadState
PACKED
;
// Actual read command state
unsigned
char
bHostFlags
PACKED
;
// Actual host flags
unsigned
char
bMyDevFlags
PACKED
;
// Actual device falgs
unsigned
char
bExIOFlag
PACKED
;
// Actual IO flags
unsigned
long
ulExIOCnt
PACKED
;
// DevExchangeIO() counter
}
DRIVERINFO
;
// Extended board information structure
typedef
struct
tagBOARD_INFOEX
{
typedef
struct
tagBOARD_INFOEX
{
unsigned
char
abDriverVersion
[
16
]
PACKED
;
// DRV driver information string
struct
{
unsigned
short
usBoard
PACKED
;
// DRV board number
unsigned
short
usAvailable
PACKED
;
// DRV board is available
struct
{
unsigned
short
usBoard
PACKED
;
// DRV board number
unsigned
short
usAvailable
PACKED
;
// DRV board is available
unsigned
long
ulPhysicalAddress
PACKED
;
// DRV physical DPM address
unsigned
short
usIrq
PACKED
;
// DRV irq number
DRIVERINFO
tDriverInfo
PACKED
;
// Driver information
unsigned
short
usIrq
PACKED
;
// DRV irq number
DRIVERINFO
tDriverInfo
PACKED
;
// Driver information
FIRMWAREINFO
tFirmware
PACKED
;
DEVINFO
tDeviceInfo
PACKED
;
RCSINFO
tRcsInfo
PACKED
;
...
...
@@ -357,9 +373,10 @@ typedef struct tagBOARD_INFOEX {
// 64-bit Linux machine & 32-bit Windows machine
// #ifdef CONFIG_64BIT
// Extended board information structure
typedef
struct
tagBOARD_INFOEX_32
{
typedef
struct
tagBOARD_INFOEX_32
{
unsigned
char
abDriverVersion
[
16
]
PACKED
;
// DRV driver information string
unsigned
char
abCatchall
[
484
]
PACKED
;
// catchall
unsigned
char
abCatchall
[
484
]
PACKED
;
// catchall
/*struct {
unsigned short usBoard PACKED; // DRV board number
unsigned short usAvailable PACKED; // DRV board is available
...
...
@@ -374,10 +391,11 @@ typedef struct tagBOARD_INFOEX_32 {
}
BOARD_INFOEX_32
;
// Communication state field structure
typedef
struct
tagCOMSTATE
{
unsigned
short
usMode
PACKED
;
// Actual STATE mode
typedef
struct
tagCOMSTATE
{
unsigned
short
usMode
PACKED
;
// Actual STATE mode
unsigned
short
usStateFlag
PACKED
;
// State flag
unsigned
char
abState
[
64
]
PACKED
;
// State area
unsigned
char
abState
[
64
]
PACKED
;
// State area
}
COMSTATE
;
// state information in bLastFunction
...
...
@@ -409,78 +427,91 @@ extern short DevInitBoard(unsigned short usDevNumber);
extern
short
DevExitBoard
(
unsigned
short
usDevNumber
);
extern
short
DevPutTaskParameter
(
unsigned
short
usDevNumber
,
unsigned
short
usNumber
,
unsigned
short
usSize
,
void
*
pvData
);
unsigned
short
usNumber
,
unsigned
short
usSize
,
void
*
pvData
);
extern
short
DevReset
(
unsigned
short
usDevNumber
,
unsigned
short
usMode
,
unsigned
long
ulTimeout
);
extern
short
DevReset
(
unsigned
short
usDevNumber
,
unsigned
short
usMode
,
unsigned
long
ulTimeout
);
extern
short
DevPutMessage
(
unsigned
short
usDevNumber
,
MSG_STRUC
*
ptMessage
,
unsigned
long
ulTimeout
);
extern
short
DevPutMessage
(
unsigned
short
usDevNumber
,
MSG_STRUC
*
ptMessage
,
unsigned
long
ulTimeout
);
extern
short
DevGetMessage
(
unsigned
short
usDevNumber
,
unsigned
short
usSize
,
MSG_STRUC
*
ptMessage
,
unsigned
long
ulTimeout
);
MSG_STRUC
*
ptMessage
,
unsigned
long
ulTimeout
);
extern
short
DevGetTaskState
(
unsigned
short
usDevNumber
,
unsigned
short
usNumber
,
unsigned
short
usSize
,
void
*
pvData
);
unsigned
short
usNumber
,
unsigned
short
usSize
,
void
*
pvData
);
extern
short
DevGetMBXState
(
unsigned
short
usDevNumber
,
unsigned
short
*
pusDevMBXState
,
unsigned
short
*
pusHostMBXState
);
unsigned
short
*
pusDevMBXState
,
unsigned
short
*
pusHostMBXState
);
extern
short
DevTriggerWatchDog
(
unsigned
short
usDevNumber
,
unsigned
short
usFunction
,
unsigned
short
*
usDevWatchDog
);
unsigned
short
usFunction
,
unsigned
short
*
usDevWatchDog
);
extern
short
DevGetInfo
(
unsigned
short
usDevNumber
,
unsigned
short
usFunction
,
unsigned
short
usSize
,
void
*
pvData
);
unsigned
short
usSize
,
void
*
pvData
);
extern
short
DevGetTaskParameter
(
unsigned
short
usDevNumber
,
unsigned
short
usNumber
,
unsigned
short
usSize
,
void
*
pvData
);
unsigned
short
usNumber
,
unsigned
short
usSize
,
void
*
pvData
);
extern
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
usSendOffset
,
unsigned
short
usSendSize
,
void
*
pvSendData
,
unsigned
short
usReceiveOffset
,
unsigned
short
usReceiveSize
,
void
*
pvReceiveData
,
unsigned
long
ulTimeout
);
extern
short
DevReadSendData
(
unsigned
short
usDevNumber
,
unsigned
short
usOffset
,
unsigned
short
usSize
,
void
*
pvData
);
unsigned
short
usOffset
,
unsigned
short
usSize
,
void
*
pvData
);
extern
short
DevSetHostState
(
unsigned
short
usDevNumber
,
unsigned
short
usMode
,
unsigned
long
ulTimeout
);
extern
short
DevSetHostState
(
unsigned
short
usDevNumber
,
unsigned
short
usMode
,
unsigned
long
ulTimeout
);
extern
short
DevExtendedData
(
unsigned
short
usDevNumber
,
unsigned
short
usMode
,
unsigned
short
usSize
,
void
*
pvData
);
unsigned
short
usSize
,
void
*
pvData
);
extern
short
DevGetMBXData
(
unsigned
short
usDevNumber
,
unsigned
short
usHostSize
,
void
*
pvHostData
,
unsigned
short
usDevSize
,
void
*
pvDevData
);
unsigned
short
usHostSize
,
void
*
pvHostData
,
unsigned
short
usDevSize
,
void
*
pvDevData
);
extern
short
DevGetBoardInfoEx
(
void
*
pvData
);
extern
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
);
extern
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
usSendOffset
,
unsigned
short
usSendSize
,
void
*
pvSendData
,
unsigned
short
usReceiveOffset
,
unsigned
short
usReceiveSize
,
void
*
pvReceiveData
,
COMSTATE
*
ptState
,
unsigned
long
ulTimeout
);
extern
short
DevReadWriteDPMRaw
(
unsigned
short
usDevNumber
,
unsigned
short
usMode
,
unsigned
short
usOffset
,
unsigned
short
usSize
,
void
*
pvData
);
unsigned
short
usMode
,
unsigned
short
usOffset
,
unsigned
short
usSize
,
void
*
pvData
);
extern
short
DevSpecialControl
(
unsigned
short
usDevNumber
,
unsigned
short
usMode
,
unsigned
short
*
pusCtrlAck
);
unsigned
short
usMode
,
unsigned
short
*
pusCtrlAck
);
extern
short
DevDownload
(
unsigned
short
usDevNumber
,
unsigned
short
usMode
,
unsigned
char
*
pszFileName
,
unsigned
long
*
pdwBytes
);
unsigned
char
*
pszFileName
,
unsigned
long
*
pdwBytes
);
extern
short
DevReadWriteDPMData
(
unsigned
short
usDevNumber
,
unsigned
short
usMode
,
unsigned
short
usOffset
,
unsigned
short
usSize
,
void
*
pvData
);
unsigned
short
usMode
,
unsigned
short
usOffset
,
unsigned
short
usSize
,
void
*
pvData
);
extern
short
DevSetOpMode
(
unsigned
short
usBoard
,
unsigned
short
usMode
,
unsigned
short
*
usIrq
);
extern
short
DevSetOpMode
(
unsigned
short
usBoard
,
unsigned
short
usMode
,
unsigned
short
*
usIrq
);
#ifdef __cplusplus
}
...
...
profibus/lib/rt/src/rcs_user.h
View file @
df0831a3
...
...
@@ -50,7 +50,7 @@
#endif
#if defined(_MSC_VER)
/* Microsoft C */
#pragma pack(1)
/* Byte Alignment */
#pragma pack(1)
/* Byte Alignment */
#endif
/* ======================================================================== */
...
...
@@ -171,61 +171,66 @@
/* ------------------------ RCS message definition ------------------------ */
typedef
struct
RCS_MESSAGEHEADERtag
{
typedef
struct
RCS_MESSAGEHEADERtag
{
unsigned
char
rx
;
/* receiver */
unsigned
char
tx
;
/* transmitter */
unsigned
char
ln
;
/* lenght */
unsigned
char
nr
;
/* number */
unsigned
char
a
;
/* answer */
unsigned
char
f
;
/* fault */
unsigned
char
b
;
/* command */
unsigned
char
e
;
/* extension */
unsigned
char
a
;
/* answer */
unsigned
char
f
;
/* fault */
unsigned
char
b
;
/* command */
unsigned
char
e
;
/* extension */
}
RCS_MESSAGEHEADER
;
typedef
struct
RCS_MESSAGEtag
{
typedef
struct
RCS_MESSAGEtag
{
unsigned
char
rx
;
/* receiver */
unsigned
char
tx
;
/* transmitter */
unsigned
char
ln
;
/* lenght */
unsigned
char
nr
;
/* number */
unsigned
char
a
;
/* answer */
unsigned
char
f
;
/* fault */
unsigned
char
b
;
/* command */
unsigned
char
e
;
/* extension */
unsigned
char
a
;
/* answer */
unsigned
char
f
;
/* fault */
unsigned
char
b
;
/* command */
unsigned
char
e
;
/* extension */
unsigned
char
d
[
RCS_SEGMENT_LEN
-
RCS_MESSAGEHEADER_LEN
];
/* data */
}
RCS_MESSAGE
;
/* ----------------- Standard telegram header ----------------------------- */
/* Keyword: MESSAGE, TASK_B_10 --------------------------------------------*/
typedef
struct
RCS_TELEGRAMHEADER_10tag
{
typedef
struct
RCS_TELEGRAMHEADER_10tag
{
unsigned
char
device_adr
;
/* device address */
unsigned
char
data_area
;
/* data area */
unsigned
short
data_adr
;
/* data address */
unsigned
char
data_idx
;
/* data index */
unsigned
char
data_cnt
;
/* data count */
unsigned
char
data_type
;
/* data type */
unsigned
char
function
;
/* function */
unsigned
char
data_area
;
/* data area */
unsigned
short
data_adr
;
/* data address */
unsigned
char
data_idx
;
/* data index */
unsigned
char
data_cnt
;
/* data count */
unsigned
char
data_type
;
/* data type */
unsigned
char
function
;
/* function */
}
RCS_TELEGRAMHEADER_10
;
typedef
struct
RCS_MESSAGETELEGRAMHEADER_10_tag
{
unsigned
char
rx
;
/* receiver */
unsigned
char
tx
;
/* transmitter */
unsigned
char
ln
;
/* lenght */
unsigned
char
nr
;
/* number */
unsigned
char
a
;
/* answer */
unsigned
char
f
;
/* fault */
unsigned
char
b
;
/* command */
unsigned
char
e
;
/* extension */
typedef
struct
RCS_MESSAGETELEGRAMHEADER_10_tag
{
unsigned
char
rx
;
/* receiver */
unsigned
char
tx
;
/* transmitter */
unsigned
char
ln
;
/* lenght */
unsigned
char
nr
;
/* number */
unsigned
char
a
;
/* answer */
unsigned
char
f
;
/* fault */
unsigned
char
b
;
/* command */
unsigned
char
e
;
/* extension */
unsigned
char
device_adr
;
/* device address */
unsigned
char
data_area
;
/* data area */
unsigned
short
data_adr
;
/* data address */
unsigned
char
data_idx
;
/* data index */
unsigned
char
data_cnt
;
/* data count */
unsigned
char
data_type
;
/* data type */
unsigned
char
function
;
/* function */
unsigned
char
data_area
;
/* data area */
unsigned
short
data_adr
;
/* data address */
unsigned
char
data_idx
;
/* data index */
unsigned
char
data_cnt
;
/* data count */
unsigned
char
data_type
;
/* data type */
unsigned
char
function
;
/* function */
}
RCS_MESSAGETELEGRAMHEADER_10
;
typedef
struct
RCS_TELEGRAMHEADERDATA_10tag
{
typedef
struct
RCS_TELEGRAMHEADERDATA_10tag
{
unsigned
char
device_adr
;
unsigned
char
data_area
;
unsigned
short
data_adr
;
...
...
@@ -237,28 +242,29 @@ typedef struct RCS_TELEGRAMHEADERDATA_10tag {
d
[
RCS_SEGMENT_LEN
-
RCS_MESSAGEHEADER_LEN
-
RCS_TELEGRAMHEADER_LEN
];
}
RCS_TELEGRAMHEADERDATA_10
;
typedef
struct
RCS_MESSAGETELEGRAM_10tag
{
unsigned
char
rx
;
/* receiver */
unsigned
char
tx
;
/* transmitter */
unsigned
char
ln
;
/* lenght */
unsigned
char
nr
;
/* number */
unsigned
char
a
;
/* answer */
unsigned
char
f
;
/* fault */
unsigned
char
b
;
/* command */
unsigned
char
e
;
/* extension */
typedef
struct
RCS_MESSAGETELEGRAM_10tag
{
unsigned
char
rx
;
/* receiver */
unsigned
char
tx
;
/* transmitter */
unsigned
char
ln
;
/* lenght */
unsigned
char
nr
;
/* number */
unsigned
char
a
;
/* answer */
unsigned
char
f
;
/* fault */
unsigned
char
b
;
/* command */
unsigned
char
e
;
/* extension */
unsigned
char
device_adr
;
/* device address */
unsigned
char
data_area
;
/* data area */
unsigned
short
data_adr
;
/* data address */
unsigned
char
data_idx
;
/* data index */
unsigned
char
data_cnt
;
/* data count */
unsigned
char
data_type
;
/* data type */
unsigned
char
function
;
/* function */
unsigned
char
data_area
;
/* data area */
unsigned
short
data_adr
;
/* data address */
unsigned
char
data_idx
;
/* data index */
unsigned
char
data_cnt
;
/* data count */
unsigned
char
data_type
;
/* data type */
unsigned
char
function
;
/* function */
unsigned
char
d
[
RCS_SEGMENT_LEN
-
RCS_MESSAGEHEADER_LEN
-
RCS_TELEGRAMHEADER_LEN
];
}
RCS_MESSAGETELEGRAM_10
;
#if defined(_MSC_VER)
/* Microsoft C */
#pragma pack()
/* Byte Alignment */
#pragma pack()
/* Byte Alignment */
#endif
#ifdef __cplusplus
...
...
profibus/lib/rt/src/rcsdef.h
View file @
df0831a3
...
...
@@ -91,64 +91,64 @@ extern "C" {
/* Mode definitions */
/* ------------------ */
#define MODE_NEUSTART 0
/* Command: B_SYSFKT */
#define MODE_KALTSTART 1
/* Command: B_SYSFKT */
#define MODE_WARMSTART 2
/* Command: B_SYSFKT */
#define MODE_ZYKL_STATUS_STOP 3
/* Command: B_SYSFKT */
#define MODE_FWVERSION 4
/* Command: B_SYSFKT */
#define MODE_NEUSTART 0
/* Command: B_SYSFKT */
#define MODE_KALTSTART 1
/* Command: B_SYSFKT */
#define MODE_WARMSTART 2
/* Command: B_SYSFKT */
#define MODE_ZYKL_STATUS_STOP 3
/* Command: B_SYSFKT */
#define MODE_FWVERSION 4
/* Command: B_SYSFKT */
#define MODE_GET_PROJ_WERTE_HW 5
/* Command: B_SYSFKT */
#define MODE_GET_PROJ_WERTE_SW 6
/* Command: B_SYSFKT */
#define MODE_SHOW_DYN_SYSSTAT 7
/* Command: B_SYSFKT */
#define MODE_SETTIME 9
/* not implemented yet */
#define MODE_SET_DEVICE_DATA 9
/* not implemented yet */
#define MODE_MODUL_RCS 11
/* Command: B_SYSFKT */
#define MODE_MODUL_LIB 12
/* Command: B_SYSFKT */
#define MODE_MODUL_MCL 13
/* Command: B_SYSFKT */
#define MODE_MODUL_LIB 12
/* Command: B_SYSFKT */
#define MODE_MODUL_MCL 13
/* Command: B_SYSFKT */
#define MODE_SHOW_DYN_SYSSTAT 7
/* Command: B_SYSFKT */
#define MODE_SETTIME 9
/* not implemented yet */
#define MODE_SET_DEVICE_DATA 9
/* not implemented yet */
#define MODE_MODUL_RCS 11
/* Command: B_SYSFKT */
#define MODE_MODUL_LIB 12
/* Command: B_SYSFKT */
#define MODE_MODUL_MCL 13
/* Command: B_SYSFKT */
#define MODE_MODUL_LIB 12
/* Command: B_SYSFKT */
#define MODE_MODUL_MCL 13
/* Command: B_SYSFKT */
#define MODE_DISTRIBUTOR_DRIVER \
14
/* Command: B_SYSFKT ->function 1 = insert
\
*/
#define MODE_PRINT_DRIVER 15
/* Command: B_SYSFKT */
14
/* Command: B_SYSFKT ->function 1 = insert
\
*/
#define MODE_PRINT_DRIVER 15
/* Command: B_SYSFKT */
#define MODE_GET_RCS_ERROR 16
/* Command: B_SYSFKT */
#define MODE_PRINT_DEVICE 1
/* NO mode, only for MENU.H */
#define MODE_PRINT_DEVICE 1
/* NO mode, only for MENU.H */
#define MODE_PRINT_DEVICE_DRIVER 2
/* NO mode, only for MENU.H */
#define MODE_START_STOP_STAT 0
/* Command: B_TASKFKT */
#define MODE_START_STOP 1
/* Command: B_TASKFKT */
#define MODE_TASK_VERSION 2
/* Command: B_TASKFKT */
#define MODE_ZYKL_STATUS 3
/* Command: B_TASKFKT */
#define MODE_SHOW_FUELLST 4
/* Command: B_TASKFKT */
#define MODE_SHOW_TIMER 5
/* Command: B_TASKFKT */
#define MODE_START_STOP 1
/* Command: B_TASKFKT */
#define MODE_TASK_VERSION 2
/* Command: B_TASKFKT */
#define MODE_ZYKL_STATUS 3
/* Command: B_TASKFKT */
#define MODE_SHOW_FUELLST 4
/* Command: B_TASKFKT */
#define MODE_SHOW_TIMER 5
/* Command: B_TASKFKT */
#define MODE_DIAG_MEM_READ_SINGLE 0x0
/* Command: B_DIAGNOSE */
#define MODE_DIAG_MEM_READ_SINGLE 0x0
/* Command: B_DIAGNOSE */
#define MODE_DIAG_MEM_WRITE_SINGLE 0x1
/* Command: B_DIAGNOSE */
#define MODE_DIAG_IO_READ_SINGLE 0x2
/* Command: B_STRUKTFKT */
#define MODE_DIAG_IO_WRITE_SINGLE 0x3
/* Command: B_STRUKTFKT */
#define MODE_DIAG_ZYKL 0x10
/* Command: B_STRUKTFKT */
#define MODE_DIAG_MEM_READ_ZYKL 0x10
/* Command: B_STRUKTFKT */
#define MODE_DIAG_MEM_WRITE_ZYKL 0x11
/* Command: B_STRUKTFKT */
#define MODE_DIAG_IO_READ_ZYKL 0x12
/* Command: B_STRUKTFKT */
#define MODE_DIAG_IO_WRITE_ZYKL 0x13
/* Command: B_STRUKTFKT */
#define MODE_DIAG_IO_READ_SINGLE 0x2
/* Command: B_STRUKTFKT */
#define MODE_DIAG_IO_WRITE_SINGLE 0x3
/* Command: B_STRUKTFKT */
#define MODE_DIAG_ZYKL 0x10
/* Command: B_STRUKTFKT */
#define MODE_DIAG_MEM_READ_ZYKL 0x10
/* Command: B_STRUKTFKT */
#define MODE_DIAG_MEM_WRITE_ZYKL 0x11
/* Command: B_STRUKTFKT */
#define MODE_DIAG_IO_READ_ZYKL 0x12
/* Command: B_STRUKTFKT */
#define MODE_DIAG_IO_WRITE_ZYKL 0x13
/* Command: B_STRUKTFKT */
#define MODE_ZYKL_TASK_STRUK 0
/* Command: B_STRUKTFKT */
#define MODE_INIT_INFO_STRUK 1
/* Command: B_STRUKTFKT */
#define MODE_WRITE_STRUK 2
/* Command: B_STRUKTFKT */
#define MODE_WRITE_STRUK 2
/* Command: B_STRUKTFKT */
#define MODE_START_TRACE 0
/* Command: B_TRACE */
#define MODE_START_TRACE 0
/* Command: B_TRACE */
#define MODE_DEL_TRACE_PUF 1
/* Command: B_TRACE */
#define MODE_UPLOAD_BINAER 0
/* Command: B_LOADFKT */
#define MODE_UPLOAD_BINAER 0
/* Command: B_LOADFKT */
#define MODE_DOWNLOAD_BINAER 1
/* Command: B_LOADFKT */
#define MODE_UPLOAD_DBM 2
/* Command: B_LOADFKT */
#define MODE_DOWNLOAD_DBM 3
/* Command: B_LOADFKT */
#define MODE_DEL_FLASH 4
/* Command: B_LOADFKT */
#define MODE_GET_FLASH_DIR 5
/* Command: B_LOADFKT */
#define MODE_URLADEN 6
/* Command: B_LOADFKT */
#define MODE_LONG_BINLOAD 7
/* Command: B_LOADFKT */
#define MODE_FREE_DRIVER 8
/* Command: B_LOADFKT */
#define MODE_RESET_DEVICE 10
/* Command: B_LOADFKT */
#define MODE_UPLOAD_DBM 2
/* Command: B_LOADFKT */
#define MODE_DOWNLOAD_DBM 3
/* Command: B_LOADFKT */
#define MODE_DEL_FLASH 4
/* Command: B_LOADFKT */
#define MODE_GET_FLASH_DIR 5
/* Command: B_LOADFKT */
#define MODE_URLADEN 6
/* Command: B_LOADFKT */
#define MODE_LONG_BINLOAD 7
/* Command: B_LOADFKT */
#define MODE_FREE_DRIVER 8
/* Command: B_LOADFKT */
#define MODE_RESET_DEVICE 10
/* Command: B_LOADFKT */
/* ------------------------------------------------------------------------------------
*/
...
...
profibus/lib/rt/src/rt_io_m_pb_ai.c
View file @
df0831a3
...
...
@@ -56,8 +56,8 @@
\*----------------------------------------------------------------------------*/
void
ConvertAi
(
pwr_sClass_ChanAi
*
cop
,
pwr_tInt16
nobits
,
pwr_tUInt8
rawvalue8
,
pwr_tUInt16
rawvalue16
,
pwr_tUInt32
rawvalue32
,
pwr_tFloat32
*
actvalue_p
,
pwr_tEnum
representation
)
pwr_tUInt16
rawvalue16
,
pwr_tUInt32
rawvalue32
,
pwr_tFloat32
*
actvalue_p
,
pwr_tEnum
representation
)
{
pwr_tFloat32
sigvalue
;
...
...
@@ -66,24 +66,30 @@ void ConvertAi(pwr_sClass_ChanAi* cop, pwr_tInt16 nobits, pwr_tUInt8 rawvalue8,
pwr_tFloat32
f_raw
=
0
.
0
;
int
i
;
if
(
nobits
==
32
)
{
if
(
nobits
==
32
)
{
if
(
representation
==
PB_NUMREP_SIGNEDINT
)
f_raw
=
(
float
)((
int
)
rawvalue32
);
else
f_raw
=
(
float
)
rawvalue32
;
}
else
if
(
nobits
==
16
)
{
}
else
if
(
nobits
==
16
)
{
if
(
representation
==
PB_NUMREP_SIGNEDINT
)
f_raw
=
(
float
)((
short
)
rawvalue16
);
else
f_raw
=
(
float
)
rawvalue16
;
}
else
if
(
nobits
==
8
)
{
}
else
if
(
nobits
==
8
)
{
if
(
representation
==
PB_NUMREP_SIGNEDINT
)
f_raw
=
(
float
)((
char
)
rawvalue8
);
else
f_raw
=
(
float
)
rawvalue8
;
}
switch
(
cop
->
SensorPolyType
)
{
switch
(
cop
->
SensorPolyType
)
{
case
0
:
*
actvalue_p
=
cop
->
SigValPolyCoef0
+
cop
->
SigValPolyCoef1
*
f_raw
;
break
;
...
...
@@ -94,7 +100,8 @@ void ConvertAi(pwr_sClass_ChanAi* cop, pwr_tInt16 nobits, pwr_tUInt8 rawvalue8,
sigvalue
=
cop
->
SigValPolyCoef0
+
cop
->
SigValPolyCoef1
*
f_raw
;
polycoef_p
=
&
cop
->
SensorPolyCoef2
;
actvalue
=
0
;
for
(
i
=
0
;
i
<
3
;
i
++
)
{
for
(
i
=
0
;
i
<
3
;
i
++
)
{
actvalue
=
sigvalue
*
actvalue
+
*
polycoef_p
;
polycoef_p
--
;
}
...
...
@@ -124,8 +131,9 @@ void ConvertAi(pwr_sClass_ChanAi* cop, pwr_tInt16 nobits, pwr_tUInt8 rawvalue8,
\*----------------------------------------------------------------------------*/
void
ConvertAit
(
pwr_sClass_ChanAit
*
cop
,
pwr_tInt16
nobits
,
pwr_tUInt16
rawvalue8
,
pwr_tUInt16
rawvalue16
,
pwr_tUInt32
rawvalue32
,
pwr_tFloat32
*
actvalue_p
,
pwr_tEnum
representation
)
pwr_tUInt16
rawvalue8
,
pwr_tUInt16
rawvalue16
,
pwr_tUInt32
rawvalue32
,
pwr_tFloat32
*
actvalue_p
,
pwr_tEnum
representation
)
{
pwr_tFloat32
Slope
;
pwr_tFloat32
Intercept
;
...
...
@@ -136,17 +144,22 @@ void ConvertAit(pwr_sClass_ChanAit* cop, pwr_tInt16 nobits,
pwr_tFloat32
sigvalue
;
pwr_tFloat32
f_raw
=
0
.
0
;
if
(
nobits
==
32
)
{
if
(
nobits
==
32
)
{
if
(
representation
==
PB_NUMREP_SIGNEDINT
)
f_raw
=
(
float
)((
int
)
rawvalue32
);
else
f_raw
=
(
float
)
rawvalue32
;
}
else
if
(
nobits
==
16
)
{
}
else
if
(
nobits
==
16
)
{
if
(
representation
==
PB_NUMREP_SIGNEDINT
)
f_raw
=
(
float
)((
short
)
rawvalue16
);
else
f_raw
=
(
float
)
rawvalue16
;
}
else
if
(
nobits
==
8
)
{
}
else
if
(
nobits
==
8
)
{
if
(
representation
==
PB_NUMREP_SIGNEDINT
)
f_raw
=
(
float
)((
char
)
rawvalue8
);
else
...
...
@@ -157,7 +170,8 @@ void ConvertAit(pwr_sClass_ChanAit* cop, pwr_tInt16 nobits,
Last
=
cop
->
NoOfCoordinates
;
while
((
Last
-
First
)
>
1
)
{
while
((
Last
-
First
)
>
1
)
{
Middle
=
(
First
+
Last
)
/
2
;
TransTabValue
=
cop
->
InValue
[
Middle
];
if
(
sigvalue
<
TransTabValue
)
...
...
@@ -174,8 +188,8 @@ void ConvertAit(pwr_sClass_ChanAit* cop, pwr_tInt16 nobits,
/*----------------------------------------------------------------------------*\
Init method for the Pb module Ai
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
pwr_sClass_Pb_Ai
*
op
;
...
...
@@ -185,23 +199,28 @@ static pwr_tStatus IoCardInit(
op
=
(
pwr_sClass_Pb_Ai
*
)
cp
->
op
;
local
=
(
io_sCardLocal
*
)
cp
->
Local
;
if
(
rp
->
Class
!=
pwr_cClass_Pb_DP_Slave
)
{
if
(
rp
->
Class
!=
pwr_cClass_Pb_DP_Slave
)
{
errh_Info
(
"Illegal object type %s"
,
cp
->
Name
);
return
1
;
}
if
(
op
->
Status
>=
PB_MODULE_STATE_OPERATE
)
{
for
(
i
=
0
;
i
<
IO_MAXCHAN
;
i
++
)
{
if
(
op
->
Status
>=
PB_MODULE_STATE_OPERATE
)
{
for
(
i
=
0
;
i
<
IO_MAXCHAN
;
i
++
)
{
local
->
scancount
[
i
]
=
0
;
}
// Calculate polycoeff
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
chanp
=
&
cp
->
chanlist
[
i
];
if
(
!
chanp
->
cop
)
continue
;
io_AiRangeToCoef
(
chanp
);
}
}
else
}
else
errh_Info
(
"Error initializing Pb module Ai %s"
,
cp
->
Name
);
return
IO__SUCCESS
;
...
...
@@ -210,8 +229,8 @@ static pwr_tStatus IoCardInit(
/*----------------------------------------------------------------------------*\
Read method for the Pb Ai card
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardRead
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardRead
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
pwr_sClass_Pb_Ai
*
op
;
...
...
@@ -232,8 +251,10 @@ static pwr_tStatus IoCardRead(
op
=
(
pwr_sClass_Pb_Ai
*
)
cp
->
op
;
slave
=
(
pwr_sClass_Pb_DP_Slave
*
)
rp
->
op
;
if
(
op
->
Status
>=
PB_MODULE_STATE_OPERATE
&&
slave
->
DisableSlave
!=
1
)
{
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
if
(
op
->
Status
>=
PB_MODULE_STATE_OPERATE
&&
slave
->
DisableSlave
!=
1
)
{
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
chanp
=
&
cp
->
chanlist
[
i
];
if
(
!
chanp
->
cop
||
!
chanp
->
sop
)
continue
;
...
...
@@ -244,107 +265,121 @@ static pwr_tStatus IoCardRead(
if
(
cop
->
CalculateNewCoef
)
io_AiRangeToCoef
(
chanp
);
if
(
cop
->
ConversionOn
)
{
if
(
local
->
scancount
[
i
]
<=
1
)
{
if
(
op
->
BytesPerChannel
==
4
)
{
if
(
cop
->
ConversionOn
)
{
if
(
local
->
scancount
[
i
]
<=
1
)
{
if
(
op
->
BytesPerChannel
==
4
)
{
memcpy
(
&
udata32
,
local
->
input_area
+
op
->
OffsetInputs
+
4
*
i
,
4
);
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
udata32
=
swap32
(
udata32
);
data32
=
(
pwr_tInt32
)
udata32
;
sop
->
RawValue
=
0
;
if
(
op
->
NumberRepresentation
==
PB_NUMREP_UNSIGNEDINT
)
sop
->
SigValue
=
udata32
*
cop
->
SigValPolyCoef1
+
cop
->
SigValPolyCoef0
;
sop
->
SigValue
=
udata32
*
cop
->
SigValPolyCoef1
+
cop
->
SigValPolyCoef0
;
else
sop
->
SigValue
=
data32
*
cop
->
SigValPolyCoef1
+
cop
->
SigValPolyCoef0
;
switch
(
chanp
->
ChanClass
)
{
sop
->
SigValue
=
data32
*
cop
->
SigValPolyCoef1
+
cop
->
SigValPolyCoef0
;
switch
(
chanp
->
ChanClass
)
{
case
pwr_cClass_ChanAi
:
ConvertAi
(
cop
,
32
,
0
,
0
,
udata32
,
&
actvalue
,
op
->
NumberRepresentation
);
ConvertAi
(
cop
,
32
,
0
,
0
,
udata32
,
&
actvalue
,
op
->
NumberRepresentation
);
break
;
case
pwr_cClass_ChanAit
:
ConvertAit
((
pwr_sClass_ChanAit
*
)
cop
,
32
,
0
,
0
,
udata32
,
&
actvalue
,
op
->
NumberRepresentation
);
op
->
NumberRepresentation
);
break
;
}
}
else
if
(
op
->
BytesPerChannel
==
3
)
{
}
else
if
(
op
->
BytesPerChannel
==
3
)
{
udata32
=
0
;
memcpy
(
&
udata32
,
local
->
input_area
+
op
->
OffsetInputs
+
3
*
i
,
3
);
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
{
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
{
udata32
=
swap32
(
udata32
);
udata32
=
udata32
>>
8
;
}
data32
=
(
pwr_tInt32
)
udata32
;
sop
->
RawValue
=
0
;
if
(
op
->
NumberRepresentation
==
PB_NUMREP_UNSIGNEDINT
)
sop
->
SigValue
=
udata32
*
cop
->
SigValPolyCoef1
+
cop
->
SigValPolyCoef0
;
sop
->
SigValue
=
udata32
*
cop
->
SigValPolyCoef1
+
cop
->
SigValPolyCoef0
;
else
sop
->
SigValue
=
data32
*
cop
->
SigValPolyCoef1
+
cop
->
SigValPolyCoef0
;
switch
(
chanp
->
ChanClass
)
{
sop
->
SigValue
=
data32
*
cop
->
SigValPolyCoef1
+
cop
->
SigValPolyCoef0
;
switch
(
chanp
->
ChanClass
)
{
case
pwr_cClass_ChanAi
:
ConvertAi
(
cop
,
32
,
0
,
0
,
udata32
,
&
actvalue
,
op
->
NumberRepresentation
);
ConvertAi
(
cop
,
32
,
0
,
0
,
udata32
,
&
actvalue
,
op
->
NumberRepresentation
);
break
;
case
pwr_cClass_ChanAit
:
ConvertAit
((
pwr_sClass_ChanAit
*
)
cop
,
32
,
0
,
0
,
udata32
,
&
actvalue
,
op
->
NumberRepresentation
);
op
->
NumberRepresentation
);
break
;
}
}
else
if
(
op
->
BytesPerChannel
==
2
)
{
}
else
if
(
op
->
BytesPerChannel
==
2
)
{
memcpy
(
&
udata16
,
local
->
input_area
+
op
->
OffsetInputs
+
2
*
i
,
2
);
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
udata16
=
swap16
(
udata16
);
data16
=
(
pwr_tInt16
)
udata16
;
sop
->
RawValue
=
udata16
;
if
(
op
->
NumberRepresentation
==
PB_NUMREP_UNSIGNEDINT
)
sop
->
SigValue
=
udata16
*
cop
->
SigValPolyCoef1
+
cop
->
SigValPolyCoef0
;
sop
->
SigValue
=
udata16
*
cop
->
SigValPolyCoef1
+
cop
->
SigValPolyCoef0
;
else
sop
->
SigValue
=
data16
*
cop
->
SigValPolyCoef1
+
cop
->
SigValPolyCoef0
;
switch
(
chanp
->
ChanClass
)
{
sop
->
SigValue
=
data16
*
cop
->
SigValPolyCoef1
+
cop
->
SigValPolyCoef0
;
switch
(
chanp
->
ChanClass
)
{
case
pwr_cClass_ChanAi
:
ConvertAi
(
cop
,
16
,
0
,
udata16
,
0
,
&
actvalue
,
op
->
NumberRepresentation
);
ConvertAi
(
cop
,
16
,
0
,
udata16
,
0
,
&
actvalue
,
op
->
NumberRepresentation
);
break
;
case
pwr_cClass_ChanAit
:
ConvertAit
((
pwr_sClass_ChanAit
*
)
cop
,
16
,
0
,
udata16
,
0
,
&
actvalue
,
op
->
NumberRepresentation
);
op
->
NumberRepresentation
);
break
;
}
}
else
if
(
op
->
BytesPerChannel
==
1
)
{
else
if
(
op
->
BytesPerChannel
==
1
)
{
memcpy
(
&
udata8
,
local
->
input_area
+
op
->
OffsetInputs
+
i
,
1
);
data8
=
(
pwr_tInt8
)
udata8
;
sop
->
RawValue
=
udata8
;
if
(
op
->
NumberRepresentation
==
PB_NUMREP_UNSIGNEDINT
)
sop
->
SigValue
=
udata8
*
cop
->
SigValPolyCoef1
+
cop
->
SigValPolyCoef0
;
sop
->
SigValue
=
udata8
*
cop
->
SigValPolyCoef1
+
cop
->
SigValPolyCoef0
;
else
sop
->
SigValue
=
data8
*
cop
->
SigValPolyCoef1
+
cop
->
SigValPolyCoef0
;
switch
(
chanp
->
ChanClass
)
{
sop
->
SigValue
=
data8
*
cop
->
SigValPolyCoef1
+
cop
->
SigValPolyCoef0
;
switch
(
chanp
->
ChanClass
)
{
case
pwr_cClass_ChanAi
:
ConvertAi
(
cop
,
8
,
udata8
,
0
,
0
,
&
actvalue
,
op
->
NumberRepresentation
);
ConvertAi
(
cop
,
8
,
udata8
,
0
,
0
,
&
actvalue
,
op
->
NumberRepresentation
);
break
;
case
pwr_cClass_ChanAit
:
ConvertAit
((
pwr_sClass_ChanAit
*
)
cop
,
8
,
udata8
,
0
,
0
,
&
actvalue
,
op
->
NumberRepresentation
);
op
->
NumberRepresentation
);
break
;
}
}
// Filter
if
(
sop
->
FilterType
==
1
&&
sop
->
FilterAttribute
[
0
]
>
0
&&
sop
->
FilterAttribute
[
0
]
>
ctx
->
ScanTime
)
{
actvalue
=
*
(
pwr_tFloat32
*
)
chanp
->
vbp
+
ctx
->
ScanTime
/
sop
->
FilterAttribute
[
0
]
*
(
actvalue
-
*
(
pwr_tFloat32
*
)
chanp
->
vbp
);
if
(
sop
->
FilterType
==
1
&&
sop
->
FilterAttribute
[
0
]
>
0
&&
sop
->
FilterAttribute
[
0
]
>
ctx
->
ScanTime
)
{
actvalue
=
*
(
pwr_tFloat32
*
)
chanp
->
vbp
+
ctx
->
ScanTime
/
sop
->
FilterAttribute
[
0
]
*
(
actvalue
-
*
(
pwr_tFloat32
*
)
chanp
->
vbp
);
}
*
(
pwr_tFloat32
*
)
chanp
->
vbp
=
actvalue
;
...
...
@@ -353,8 +388,8 @@ static pwr_tStatus IoCardRead(
local
->
scancount
[
i
]
--
;
}
// if ...ConversionOn
}
// for
}
// if ...op->Status
}
// for
}
// if ...op->Status
return
IO__SUCCESS
;
}
...
...
@@ -362,8 +397,8 @@ static pwr_tStatus IoCardRead(
/*----------------------------------------------------------------------------*\
Close method for the Pb Ai card
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
local
=
cp
->
Local
;
...
...
@@ -377,5 +412,6 @@ static pwr_tStatus IoCardClose(
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport
pwr_BindIoMethods
(
Pb_Ai
)
=
{
pwr_BindIoMethod
(
IoCardInit
),
pwr_BindIoMethod
(
IoCardRead
),
pwr_BindIoMethod
(
IoCardClose
),
pwr_NullMethod
};
pwr_dExport
pwr_BindIoMethods
(
Pb_Ai
)
=
{
pwr_BindIoMethod
(
IoCardInit
),
pwr_BindIoMethod
(
IoCardRead
),
pwr_BindIoMethod
(
IoCardClose
),
pwr_NullMethod
};
profibus/lib/rt/src/rt_io_m_pb_ao.c
View file @
df0831a3
...
...
@@ -52,8 +52,8 @@
/*----------------------------------------------------------------------------*\
Init method for the Pb module Ao
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
pwr_sClass_Pb_Ao
*
op
;
...
...
@@ -63,20 +63,24 @@ static pwr_tStatus IoCardInit(
op
=
(
pwr_sClass_Pb_Ao
*
)
cp
->
op
;
local
=
(
io_sCardLocal
*
)
cp
->
Local
;
if
(
rp
->
Class
!=
pwr_cClass_Pb_DP_Slave
)
{
if
(
rp
->
Class
!=
pwr_cClass_Pb_DP_Slave
)
{
errh_Info
(
"Illegal object type %s"
,
cp
->
Name
);
return
IO__SUCCESS
;
}
if
(
op
->
Status
>=
PB_MODULE_STATE_OPERATE
)
{
if
(
op
->
Status
>=
PB_MODULE_STATE_OPERATE
)
{
// Calculate polycoeff
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
chanp
=
&
cp
->
chanlist
[
i
];
if
(
!
chanp
->
cop
)
continue
;
io_AoRangeToCoef
(
chanp
);
}
}
else
}
else
errh_Info
(
"Error initializing Pb module Ao %s"
,
cp
->
Name
);
return
IO__SUCCESS
;
...
...
@@ -85,8 +89,8 @@ static pwr_tStatus IoCardInit(
/*----------------------------------------------------------------------------*\
Write method for the Pb module Ao
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardWrite
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardWrite
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
pwr_sClass_Pb_Ao
*
op
;
...
...
@@ -109,10 +113,12 @@ static pwr_tStatus IoCardWrite(
op
=
(
pwr_sClass_Pb_Ao
*
)
cp
->
op
;
slave
=
(
pwr_sClass_Pb_DP_Slave
*
)
rp
->
op
;
if
(
op
->
Status
>=
PB_MODULE_STATE_OPERATE
&&
slave
->
DisableSlave
!=
1
)
{
if
(
op
->
Status
>=
PB_MODULE_STATE_OPERATE
&&
slave
->
DisableSlave
!=
1
)
{
fixout
=
ctx
->
Node
->
EmergBreakTrue
&&
ctx
->
Node
->
EmergBreakSelect
==
FIXOUT
;
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
chanp
=
&
cp
->
chanlist
[
i
];
if
(
!
chanp
->
cop
||
!
chanp
->
sop
)
continue
;
...
...
@@ -125,7 +131,8 @@ static pwr_tStatus IoCardWrite(
value
=
cop
->
FixedOutValue
;
else
if
(
cop
->
TestOn
)
value
=
cop
->
TestValue
;
else
{
else
{
value
=
*
(
pwr_tFloat32
*
)
chanp
->
vbp
;
}
...
...
@@ -152,50 +159,66 @@ static pwr_tStatus IoCardWrite(
// Calculate signal value
sop
->
SigValue
=
cop
->
SigValPolyCoef1
*
value
+
cop
->
SigValPolyCoef0
;
if
(
op
->
BytesPerChannel
==
4
)
{
if
(
op
->
NumberRepresentation
==
PB_NUMREP_UNSIGNEDINT
)
{
if
(
op
->
BytesPerChannel
==
4
)
{
if
(
op
->
NumberRepresentation
==
PB_NUMREP_UNSIGNEDINT
)
{
udata32
=
(
pwr_tUInt32
)
rawvalue
;
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
udata32
=
swap32
(
udata32
);
memcpy
(
local
->
output_area
+
op
->
OffsetOutputs
+
4
*
i
,
&
udata32
,
4
);
}
else
if
(
op
->
NumberRepresentation
==
PB_NUMREP_SIGNEDINT
)
{
}
else
if
(
op
->
NumberRepresentation
==
PB_NUMREP_SIGNEDINT
)
{
data32
=
(
pwr_tInt32
)
rawvalue
;
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
data32
=
swap32
(
data32
);
memcpy
(
local
->
output_area
+
op
->
OffsetOutputs
+
4
*
i
,
&
data32
,
4
);
}
}
else
if
(
op
->
BytesPerChannel
==
3
)
{
if
(
op
->
NumberRepresentation
==
PB_NUMREP_UNSIGNEDINT
)
{
}
else
if
(
op
->
BytesPerChannel
==
3
)
{
if
(
op
->
NumberRepresentation
==
PB_NUMREP_UNSIGNEDINT
)
{
udata32
=
(
pwr_tUInt32
)
rawvalue
;
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
udata32
=
swap32
(
udata32
);
memcpy
(
local
->
output_area
+
op
->
OffsetOutputs
+
3
*
i
,
&
udata32
,
3
);
}
else
if
(
op
->
NumberRepresentation
==
PB_NUMREP_SIGNEDINT
)
{
}
else
if
(
op
->
NumberRepresentation
==
PB_NUMREP_SIGNEDINT
)
{
data32
=
(
pwr_tInt32
)
rawvalue
;
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
data32
=
swap32
(
data32
);
memcpy
(
local
->
output_area
+
op
->
OffsetOutputs
+
3
*
i
,
&
data32
,
3
);
}
}
else
if
(
op
->
BytesPerChannel
==
2
)
{
if
(
op
->
NumberRepresentation
==
PB_NUMREP_UNSIGNEDINT
)
{
}
else
if
(
op
->
BytesPerChannel
==
2
)
{
if
(
op
->
NumberRepresentation
==
PB_NUMREP_UNSIGNEDINT
)
{
udata16
=
(
pwr_tUInt16
)
rawvalue
;
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
udata16
=
swap16
(
udata16
);
memcpy
(
local
->
output_area
+
op
->
OffsetOutputs
+
2
*
i
,
&
udata16
,
2
);
}
else
if
(
op
->
NumberRepresentation
==
PB_NUMREP_SIGNEDINT
)
{
}
else
if
(
op
->
NumberRepresentation
==
PB_NUMREP_SIGNEDINT
)
{
data16
=
(
pwr_tInt16
)
rawvalue
;
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
data16
=
swap16
(
data16
);
memcpy
(
local
->
output_area
+
op
->
OffsetOutputs
+
2
*
i
,
&
data16
,
2
);
}
}
else
if
(
op
->
BytesPerChannel
==
1
)
{
if
(
op
->
NumberRepresentation
==
PB_NUMREP_UNSIGNEDINT
)
{
}
else
if
(
op
->
BytesPerChannel
==
1
)
{
if
(
op
->
NumberRepresentation
==
PB_NUMREP_UNSIGNEDINT
)
{
udata8
=
(
pwr_tUInt8
)
rawvalue
;
memcpy
(
local
->
output_area
+
op
->
OffsetOutputs
+
i
,
&
udata8
,
1
);
}
else
if
(
op
->
NumberRepresentation
==
PB_NUMREP_SIGNEDINT
)
{
}
else
if
(
op
->
NumberRepresentation
==
PB_NUMREP_SIGNEDINT
)
{
data8
=
(
pwr_tInt8
)
rawvalue
;
memcpy
(
local
->
output_area
+
op
->
OffsetOutputs
+
i
,
&
data8
,
1
);
}
...
...
@@ -209,8 +232,8 @@ static pwr_tStatus IoCardWrite(
/*----------------------------------------------------------------------------*\
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
local
=
cp
->
Local
;
...
...
@@ -224,6 +247,6 @@ static pwr_tStatus IoCardClose(
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport
pwr_BindIoMethods
(
Pb_Ao
)
=
{
pwr_BindIoMethod
(
IoCardInit
),
pwr_BindIoMethod
(
IoCardWrite
),
pwr_BindIoMethod
(
IoCardClose
),
pwr_NullMethod
};
pwr_dExport
pwr_BindIoMethods
(
Pb_Ao
)
=
{
pwr_BindIoMethod
(
IoCardInit
),
pwr_BindIoMethod
(
IoCardWrite
),
pwr_BindIoMethod
(
IoCardClose
),
pwr_NullMethod
};
profibus/lib/rt/src/rt_io_m_pb_di.c
View file @
df0831a3
...
...
@@ -54,8 +54,8 @@
/*----------------------------------------------------------------------------*\
Move di data word to valuebase.
\*----------------------------------------------------------------------------*/
void
pbio_DiUnpackWord
(
io_sCard
*
cp
,
pwr_tUInt16
data
,
pwr_tUInt16
mask
,
int
index
)
void
pbio_DiUnpackWord
(
io_sCard
*
cp
,
pwr_tUInt16
data
,
pwr_tUInt16
mask
,
int
index
)
{
io_sChannel
*
chanp
;
...
...
@@ -64,7 +64,8 @@ void pbio_DiUnpackWord(
else
chanp
=
&
cp
->
chanlist
[
16
];
if
(
mask
==
IO_CONVMASK_ALL
)
{
if
(
mask
==
IO_CONVMASK_ALL
)
{
/* No conversion test */
if
(
chanp
->
cop
&&
chanp
->
sop
)
*
(
pwr_tUInt16
*
)(
chanp
->
vbp
)
=
((
data
&
1
)
!=
0
);
...
...
@@ -114,7 +115,9 @@ void pbio_DiUnpackWord(
if
(
chanp
->
cop
&&
chanp
->
sop
)
*
(
pwr_tUInt16
*
)(
chanp
->
vbp
)
=
((
data
&
32768
)
!=
0
);
chanp
++
;
}
else
{
}
else
{
if
(
chanp
->
cop
&&
chanp
->
sop
&&
mask
&
1
)
*
(
pwr_tUInt16
*
)(
chanp
->
vbp
)
=
((
data
&
1
)
!=
0
);
chanp
++
;
...
...
@@ -169,8 +172,8 @@ void pbio_DiUnpackWord(
/*----------------------------------------------------------------------------*\
Init method for the Pb module Di
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
pwr_sClass_Pb_Di
*
op
;
...
...
@@ -180,8 +183,8 @@ static pwr_tStatus IoCardInit(
// Check configuration
if
(
op
->
NumberOfChannels
!=
8
&&
op
->
NumberOfChannels
!=
16
&&
op
->
NumberOfChannels
!=
32
)
if
(
op
->
NumberOfChannels
!=
8
&&
op
->
NumberOfChannels
!=
16
&&
op
->
NumberOfChannels
!=
32
)
op
->
Status
=
PB_MODULE_STATE_NOTINIT
;
if
(
op
->
Orientation
>
op
->
NumberOfChannels
)
...
...
@@ -196,8 +199,8 @@ static pwr_tStatus IoCardInit(
/*----------------------------------------------------------------------------*\
Read method for the Pb module Di
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardRead
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardRead
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
pwr_sClass_Pb_Di
*
op
;
...
...
@@ -208,22 +211,27 @@ static pwr_tStatus IoCardRead(
pwr_sClass_Di
*
sig_di
;
pwr_tUInt32
mask
=
0
;
pwr_tUInt16
data
[
2
]
=
{
0
,
0
};
pwr_tUInt16
data
[
2
]
=
{
0
,
0
};
pwr_tUInt32
*
data32
;
local
=
(
io_sCardLocal
*
)
cp
->
Local
;
op
=
(
pwr_sClass_Pb_Di
*
)
cp
->
op
;
slave
=
(
pwr_sClass_Pb_DP_Slave
*
)
rp
->
op
;
if
(
op
->
Status
>=
PB_MODULE_STATE_OPERATE
&&
slave
->
DisableSlave
!=
1
)
{
if
(
op
->
Status
>=
PB_MODULE_STATE_OPERATE
&&
slave
->
DisableSlave
!=
1
)
{
memcpy
(
&
data
,
local
->
input_area
+
op
->
OffsetInputs
,
op
->
BytesOfInput
);
data32
=
(
pwr_tUInt32
*
)
&
data
;
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
{
if
(
op
->
Orientation
==
PB_ORIENTATION_WORD
)
{
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
{
if
(
op
->
Orientation
==
PB_ORIENTATION_WORD
)
{
data
[
0
]
=
swap16
(
data
[
0
]);
data
[
1
]
=
swap16
(
data
[
1
]);
}
else
if
(
op
->
Orientation
==
PB_ORIENTATION_DWORD
)
{
}
else
if
(
op
->
Orientation
==
PB_ORIENTATION_DWORD
)
{
*
data32
=
swap32
(
*
data32
);
}
}
...
...
@@ -233,11 +241,13 @@ static pwr_tStatus IoCardRead(
data
[
1
]
=
data
[
1
]
^
op
->
InvMask2
;
// Packa upp
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
chanp
=
&
cp
->
chanlist
[
i
];
chan_di
=
(
pwr_sClass_ChanDi
*
)
chanp
->
cop
;
sig_di
=
(
pwr_sClass_Di
*
)
chanp
->
sop
;
if
(
chan_di
&&
sig_di
)
{
if
(
chan_di
&&
sig_di
)
{
mask
=
1
<<
chan_di
->
Number
;
*
(
pwr_tUInt16
*
)(
chanp
->
vbp
)
=
((
*
data32
&
mask
)
!=
0
);
}
...
...
@@ -258,8 +268,8 @@ static pwr_tStatus IoCardRead(
/*----------------------------------------------------------------------------*\
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
local
=
cp
->
Local
;
...
...
@@ -273,5 +283,6 @@ static pwr_tStatus IoCardClose(
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport
pwr_BindIoMethods
(
Pb_Di
)
=
{
pwr_BindIoMethod
(
IoCardInit
),
pwr_BindIoMethod
(
IoCardRead
),
pwr_BindIoMethod
(
IoCardClose
),
pwr_NullMethod
};
pwr_dExport
pwr_BindIoMethods
(
Pb_Di
)
=
{
pwr_BindIoMethod
(
IoCardInit
),
pwr_BindIoMethod
(
IoCardRead
),
pwr_BindIoMethod
(
IoCardClose
),
pwr_NullMethod
};
profibus/lib/rt/src/rt_io_m_pb_do.c
View file @
df0831a3
...
...
@@ -52,8 +52,8 @@
/*----------------------------------------------------------------------------*\
Init method for the Pb module Do
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
pwr_sClass_Pb_Do
*
op
;
...
...
@@ -61,8 +61,8 @@ static pwr_tStatus IoCardInit(
op
=
(
pwr_sClass_Pb_Do
*
)
cp
->
op
;
local
=
(
io_sCardLocal
*
)
cp
->
Local
;
if
(
op
->
NumberOfChannels
!=
8
&&
op
->
NumberOfChannels
!=
16
&&
op
->
NumberOfChannels
!=
32
)
if
(
op
->
NumberOfChannels
!=
8
&&
op
->
NumberOfChannels
!=
16
&&
op
->
NumberOfChannels
!=
32
)
op
->
Status
=
PB_MODULE_STATE_NOTINIT
;
if
(
op
->
Orientation
>
op
->
NumberOfChannels
)
...
...
@@ -77,8 +77,8 @@ static pwr_tStatus IoCardInit(
/*----------------------------------------------------------------------------*\
Write method for the Pb module Do
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardWrite
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardWrite
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
pwr_sClass_Pb_Do
*
op
;
...
...
@@ -90,22 +90,25 @@ static pwr_tStatus IoCardWrite(
pwr_tUInt32
mask
=
0
;
pwr_tInt32
do_actval
;
pwr_tUInt16
data
[
2
]
=
{
0
,
0
};
pwr_tUInt16
data
[
2
]
=
{
0
,
0
};
pwr_tUInt32
*
data32
;
local
=
(
io_sCardLocal
*
)
cp
->
Local
;
op
=
(
pwr_sClass_Pb_Do
*
)
cp
->
op
;
slave
=
(
pwr_sClass_Pb_DP_Slave
*
)
rp
->
op
;
if
(
op
->
Status
>=
PB_MODULE_STATE_OPERATE
&&
slave
->
DisableSlave
!=
1
)
{
if
(
op
->
Status
>=
PB_MODULE_STATE_OPERATE
&&
slave
->
DisableSlave
!=
1
)
{
data32
=
(
pwr_tUInt32
*
)
&
data
;
// Packa ner
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
chanp
=
&
cp
->
chanlist
[
i
];
chan_do
=
(
pwr_sClass_ChanDo
*
)
chanp
->
cop
;
sig_do
=
(
pwr_sClass_Do
*
)
chanp
->
sop
;
if
(
chan_do
&&
sig_do
)
{
if
(
chan_do
&&
sig_do
)
{
mask
=
1
<<
chan_do
->
Number
;
do_actval
=
*
(
pwr_tInt32
*
)
chanp
->
vbp
;
if
(
do_actval
!=
0
)
...
...
@@ -118,11 +121,15 @@ static pwr_tStatus IoCardWrite(
io_DoPackWord(cp, &data[0], 0);
if (op->NumberOfChannels > 16) io_DoPackWord(cp, &data[1], 1);
*/
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
{
if
(
op
->
Orientation
==
PB_ORIENTATION_WORD
)
{
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
{
if
(
op
->
Orientation
==
PB_ORIENTATION_WORD
)
{
data
[
0
]
=
swap16
(
data
[
0
]);
data
[
1
]
=
swap16
(
data
[
1
]);
}
else
if
(
op
->
Orientation
==
PB_ORIENTATION_DWORD
)
{
}
else
if
(
op
->
Orientation
==
PB_ORIENTATION_DWORD
)
{
*
data32
=
swap32
(
*
data32
);
}
}
...
...
@@ -135,8 +142,8 @@ static pwr_tStatus IoCardWrite(
/*----------------------------------------------------------------------------*\
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
local
=
cp
->
Local
;
...
...
@@ -150,6 +157,6 @@ static pwr_tStatus IoCardClose(
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport
pwr_BindIoMethods
(
Pb_Do
)
=
{
pwr_BindIoMethod
(
IoCardInit
),
pwr_BindIoMethod
(
IoCardWrite
),
pwr_BindIoMethod
(
IoCardClose
),
pwr_NullMethod
};
pwr_dExport
pwr_BindIoMethods
(
Pb_Do
)
=
{
pwr_BindIoMethod
(
IoCardInit
),
pwr_BindIoMethod
(
IoCardWrite
),
pwr_BindIoMethod
(
IoCardClose
),
pwr_NullMethod
};
profibus/lib/rt/src/rt_io_m_pb_dp_slave.c
View file @
df0831a3
...
...
@@ -112,7 +112,8 @@ static pwr_tStatus IoRackInit(io_tCtx ctx, io_sAgent* ap, io_sRack* rp)
latent_input_count
=
0
;
latent_output_count
=
0
;
while
(
cardp
)
{
while
(
cardp
)
{
local_card
=
calloc
(
1
,
sizeof
(
*
local_card
));
cardp
->
Local
=
local_card
;
local_card
->
input_area
=
(
void
*
)
&
(
op
->
Inputs
);
...
...
@@ -124,11 +125,12 @@ static pwr_tStatus IoRackInit(io_tCtx ctx, io_sAgent* ap, io_sRack* rp)
while
(
ODD
(
gdh_GetSuperClass
(
cid
,
&
cid
,
cardp
->
Objid
)))
;
switch
(
cid
)
{
/* Old style configuring with Pb_xx objects. Still here for combatibility
reasons.
New systems (from v4.1.3) should be build with Pb_Module objects or
subclasses */
switch
(
cid
)
{
/* Old style configuring with Pb_xx objects. Still here for combatibility
reasons.
New systems (from v4.1.3) should be build with Pb_Module objects or
subclasses */
case
pwr_cClass_Pb_Di
:
dip
=
(
pwr_sClass_Pb_Di
*
)
cardp
->
op
;
...
...
@@ -178,24 +180,27 @@ static pwr_tStatus IoRackInit(io_tCtx ctx, io_sAgent* ap, io_sRack* rp)
iop
->
Status
=
PB_MODULE_STATE_OPERATE
;
break
;
/* New style configuring (from v4.1.3) with Pb_Module objects or subclass.
Loop all channels
in the module and set channel size and offset. */
/* New style configuring (from v4.1.3) with Pb_Module objects or subclass.
Loop all channels
in the module and set channel size and offset. */
case
pwr_cClass_Pb_Module
:
mp
=
(
pwr_sClass_Pb_Module
*
)
cardp
->
op
;
mp
->
Status
=
PB__INITFAIL
;
cardp
->
offset
=
0
;
for
(
i
=
0
;
i
<
cardp
->
ChanListSize
;
i
++
)
{
for
(
i
=
0
;
i
<
cardp
->
ChanListSize
;
i
++
)
{
chanp
=
&
cardp
->
chanlist
[
i
];
if
(
is_diag
(
&
chanp
->
ChanAref
))
{
if
(
is_diag
(
&
chanp
->
ChanAref
))
{
chanp
->
udata
|=
PB_UDATA_DIAG
;
switch
(
chanp
->
ChanClass
)
{
switch
(
chanp
->
ChanClass
)
{
case
pwr_cClass_ChanIi
:
chanp
->
offset
=
((
pwr_sClass_ChanIi
*
)
chanp
->
cop
)
->
Number
;
chanp
->
size
=
GetChanSize
(((
pwr_sClass_ChanIi
*
)
chanp
->
cop
)
->
Representation
);
chanp
->
size
=
GetChanSize
(((
pwr_sClass_ChanIi
*
)
chanp
->
cop
)
->
Representation
);
break
;
default:
errh_Error
(
"Diagnostic channel class, card %s"
,
cardp
->
Name
);
...
...
@@ -203,30 +208,34 @@ static pwr_tStatus IoRackInit(io_tCtx ctx, io_sAgent* ap, io_sRack* rp)
continue
;
}
if
(
chanp
->
ChanClass
!=
pwr_cClass_ChanDi
)
{
if
(
chanp
->
ChanClass
!=
pwr_cClass_ChanDi
)
{
input_counter
+=
latent_input_count
;
latent_input_count
=
0
;
}
if
(
chanp
->
ChanClass
!=
pwr_cClass_ChanDo
)
{
if
(
chanp
->
ChanClass
!=
pwr_cClass_ChanDo
)
{
output_counter
+=
latent_output_count
;
latent_output_count
=
0
;
}
switch
(
chanp
->
ChanClass
)
{
switch
(
chanp
->
ChanClass
)
{
case
pwr_cClass_ChanDi
:
chan_di
=
(
pwr_sClass_ChanDi
*
)
chanp
->
cop
;
if
(
chan_di
->
Number
==
0
)
{
if
(
chan_di
->
Number
==
0
)
{
input_counter
+=
latent_input_count
;
latent_input_count
=
0
;
}
chanp
->
offset
=
input_counter
;
chanp
->
mask
=
1
<<
chan_di
->
Number
;
if
(
chan_di
->
Representation
==
pwr_eDataRepEnum_Bit16
&&
op
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
if
(
chan_di
->
Representation
==
pwr_eDataRepEnum_Bit16
&&
op
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
chanp
->
mask
=
swap16
(
chanp
->
mask
);
if
(
chan_di
->
Representation
==
pwr_eDataRepEnum_Bit32
&&
op
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
if
(
chan_di
->
Representation
==
pwr_eDataRepEnum_Bit32
&&
op
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
chanp
->
mask
=
swap32
(
chanp
->
mask
);
if
(
chan_di
->
Number
==
0
)
latent_input_count
=
GetChanSize
(
chan_di
->
Representation
);
...
...
@@ -269,18 +278,19 @@ static pwr_tStatus IoRackInit(io_tCtx ctx, io_sAgent* ap, io_sRack* rp)
case
pwr_cClass_ChanDo
:
chan_do
=
(
pwr_sClass_ChanDo
*
)
chanp
->
cop
;
if
(
chan_do
->
Number
==
0
)
{
if
(
chan_do
->
Number
==
0
)
{
output_counter
+=
latent_output_count
;
latent_output_count
=
0
;
}
chanp
->
offset
=
output_counter
;
chan_size
=
GetChanSize
(
chan_do
->
Representation
);
chanp
->
mask
=
1
<<
chan_do
->
Number
;
if
(
chan_do
->
Representation
==
pwr_eDataRepEnum_Bit16
&&
op
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
if
(
chan_do
->
Representation
==
pwr_eDataRepEnum_Bit16
&&
op
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
chanp
->
mask
=
swap16
(
chanp
->
mask
);
if
(
chan_do
->
Representation
==
pwr_eDataRepEnum_Bit32
&&
op
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
if
(
chan_do
->
Representation
==
pwr_eDataRepEnum_Bit32
&&
op
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
chanp
->
mask
=
swap32
(
chanp
->
mask
);
if
(
chan_do
->
Number
==
0
)
latent_output_count
=
GetChanSize
(
chan_do
->
Representation
);
...
...
@@ -342,35 +352,45 @@ static pwr_tStatus IoRackRead(io_tCtx ctx, io_sAgent* ap, io_sRack* rp)
/* The reading of the process image is now performed at the agent level,
this eliminates the need for board specific code at the rack level. */
if
(
sp
->
DisableSlave
!=
1
&&
mp
->
DisableBus
!=
1
)
{
if
(
sp
->
Status
==
PB__NORMAL
)
{
if
(
sp
->
DisableSlave
!=
1
&&
mp
->
DisableBus
!=
1
)
{
if
(
sp
->
Status
==
PB__NORMAL
)
{
sp
->
ErrorCount
=
0
;
}
else
{
}
else
{
if
(
local
->
start_cnt
>=
local
->
start_time
)
sp
->
ErrorCount
++
;
}
if
(
sp
->
ErrorCount
==
sp
->
ErrorSoftLimit
)
{
if
(
sp
->
ErrorCount
==
sp
->
ErrorSoftLimit
)
{
errh_Error
(
"IO Error soft limit reached on card '%s'"
,
rp
->
Name
);
ctx
->
IOHandler
->
CardErrorSoftLimit
=
1
;
ctx
->
IOHandler
->
ErrorSoftLimitObject
=
cdh_ObjidToAref
(
rp
->
Objid
);
}
if
(
sp
->
ErrorCount
==
sp
->
ErrorHardLimit
)
{
if
(
sp
->
ErrorCount
==
sp
->
ErrorHardLimit
)
{
errh_Error
(
"IO Error hard limit reached on card '%s', stall action %d"
,
rp
->
Name
,
sp
->
StallAction
);
rp
->
Name
,
sp
->
StallAction
);
ctx
->
IOHandler
->
CardErrorHardLimit
=
1
;
ctx
->
IOHandler
->
ErrorHardLimitObject
=
cdh_ObjidToAref
(
rp
->
Objid
);
}
if
(
sp
->
ErrorCount
>
sp
->
ErrorHardLimit
&&
sp
->
StallAction
==
pwr_ePbStallAction_ResetInputs
)
{
if
(
sp
->
ErrorCount
>
sp
->
ErrorHardLimit
&&
sp
->
StallAction
==
pwr_ePbStallAction_ResetInputs
)
{
memset
(
&
sp
->
Inputs
,
0
,
sp
->
BytesOfInput
);
}
if
(
sp
->
ErrorCount
>
sp
->
ErrorHardLimit
&&
sp
->
StallAction
==
pwr_ePbStallAction_EmergencyBreak
)
{
if
(
sp
->
ErrorCount
>
sp
->
ErrorHardLimit
&&
sp
->
StallAction
==
pwr_ePbStallAction_EmergencyBreak
)
{
ctx
->
Node
->
EmergBreakTrue
=
1
;
}
}
else
{
}
else
{
sp
->
ErrorCount
=
0
;
sp
->
Status
=
PB__DISABLED
;
}
...
...
@@ -410,6 +430,7 @@ static pwr_tStatus IoRackClose(io_tCtx ctx, io_sAgent* ap, io_sRack* rp)
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport
pwr_BindIoMethods
(
Pb_DP_Slave
)
=
{
pwr_BindIoMethod
(
IoRackInit
),
pwr_BindIoMethod
(
IoRackRead
),
pwr_BindIoMethod
(
IoRackWrite
),
pwr_BindIoMethod
(
IoRackClose
),
pwr_NullMethod
};
pwr_dExport
pwr_BindIoMethods
(
Pb_DP_Slave
)
=
{
pwr_BindIoMethod
(
IoRackInit
),
pwr_BindIoMethod
(
IoRackRead
),
pwr_BindIoMethod
(
IoRackWrite
),
pwr_BindIoMethod
(
IoRackClose
),
pwr_NullMethod
};
profibus/lib/rt/src/rt_io_m_pb_fdl_datatransfer.c
View file @
df0831a3
...
...
@@ -65,8 +65,9 @@
static
unsigned
char
req_res_buffer
[
512
];
static
short
fdlif_sda_sdn_sdr_req
(
io_sAgentLocal
*
local_agent
,
pwr_sClass_Pb_FDL_SAP
*
sap
,
pwr_sClass_Pb_FDL_DataTransfer
*
op
,
io_sFDLCardLocal
*
local
)
pwr_sClass_Pb_FDL_SAP
*
sap
,
pwr_sClass_Pb_FDL_DataTransfer
*
op
,
io_sFDLCardLocal
*
local
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -106,16 +107,20 @@ possible return values:
*/
sdb
.
comm_ref
=
0
;
sdb
.
layer
=
FDLIF
;
switch
(
op
->
Type
)
{
case
pwr_ePbFDLDataTransferTypeEnum_FDLIF_SDA
:
{
switch
(
op
->
Type
)
{
case
pwr_ePbFDLDataTransferTypeEnum_FDLIF_SDA
:
{
sdb
.
service
=
FDLIF_SDA
;
break
;
}
case
pwr_ePbFDLDataTransferTypeEnum_FDLIF_SDN
:
{
case
pwr_ePbFDLDataTransferTypeEnum_FDLIF_SDN
:
{
sdb
.
service
=
FDLIF_SDN
;
break
;
}
case
pwr_ePbFDLDataTransferTypeEnum_FDLIF_SRD
:
{
case
pwr_ePbFDLDataTransferTypeEnum_FDLIF_SRD
:
{
sdb
.
service
=
FDLIF_SRD
;
break
;
}
...
...
@@ -128,15 +133,17 @@ possible return values:
sdb
.
invoke_id
=
local
->
invoke_id
=
local_agent
->
invoke_id
;
local_agent
->
invoke_id
=
(
local_agent
->
invoke_id
+
1
)
%
128
;
result
=
profi_snd_req_res
(
(
T_PROFI_DEVICE_HANDLE
*
)
local_agent
,
&
sdb
,
(
void
*
)
req
,
PB_FALSE
);
// result = profi_snd_req_res(
// (T_PROFI_DEVICE_HANDLE*)local_agent, &sdb, (void*)req, PB_FALSE);
result
=
profi_snd_req_res
(
&
sdb
,
(
void
*
)
req
,
PB_FALSE
);
return
((
pwr_tBoolean
)(
result
==
E_OK
));
}
static
short
fdlif_reply_update_mult_req
(
io_sAgentLocal
*
local_agent
,
pwr_sClass_Pb_FDL_SAP
*
sap
,
pwr_sClass_Pb_FDL_DataTransfer
*
op
,
io_sFDLCardLocal
*
local
)
pwr_sClass_Pb_FDL_SAP
*
sap
,
pwr_sClass_Pb_FDL_DataTransfer
*
op
,
io_sFDLCardLocal
*
local
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -179,8 +186,9 @@ possible return values:
sdb
.
invoke_id
=
local
->
invoke_id
=
local_agent
->
invoke_id
;
local_agent
->
invoke_id
=
(
local_agent
->
invoke_id
+
1
)
%
128
;
result
=
profi_snd_req_res
(
(
T_PROFI_DEVICE_HANDLE
*
)
local_agent
,
&
sdb
,
(
void
*
)
req
,
PB_FALSE
);
// result = profi_snd_req_res((T_PROFI_DEVICE_HANDLE*)local_agent, &sdb,
// (void*)req, PB_FALSE);
result
=
profi_snd_req_res
(
&
sdb
,
(
void
*
)
req
,
PB_FALSE
);
return
((
pwr_tBoolean
)(
result
==
E_OK
));
}
...
...
@@ -188,8 +196,8 @@ possible return values:
/*----------------------------------------------------------------------------*\
Init method for the Pb module
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sFDLCardLocal
*
local
;
pwr_sClass_Pb_FDL_DataTransfer
*
op
=
(
pwr_sClass_Pb_FDL_DataTransfer
*
)
cp
->
op
;
...
...
@@ -206,8 +214,8 @@ static pwr_tStatus IoCardInit(
local
->
byte_ordering
=
((
pwr_sClass_Pb_FDL_SAP
*
)
rp
->
op
)
->
ByteOrdering
;
io_bus_card_init
(
ctx
,
cp
,
&
input_area_offset
,
&
input_area_chansize
,
&
output_area_offset
,
&
output_area_chansize
,
local
->
byte_ordering
,
io_eAlignment_Packed
);
&
output_area_offset
,
&
output_area_chansize
,
local
->
byte_ordering
,
io_eAlignment_Packed
);
local
->
input_area_size
=
input_area_offset
+
input_area_chansize
;
local
->
output_area_size
=
output_area_offset
+
output_area_chansize
;
...
...
@@ -227,13 +235,13 @@ static pwr_tStatus IoCardInit(
/*----------------------------------------------------------------------------*\
Read method for the Pb FDL Data transfer module
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardRead
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardRead
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sFDLCardLocal
*
local
=
(
io_sFDLCardLocal
*
)
cp
->
Local
;
io_bus_card_read
(
ctx
,
rp
,
cp
,
local
->
input_area
,
0
,
local
->
byte_ordering
,
local
->
float_representation
);
local
->
float_representation
);
return
IO__SUCCESS
;
}
...
...
@@ -241,8 +249,8 @@ static pwr_tStatus IoCardRead(
/*----------------------------------------------------------------------------*\
Write method for the Pb FDL Data transfer module
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardWrite
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardWrite
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sAgentLocal
*
local_agent
=
(
io_sAgentLocal
*
)
ap
->
Local
;
pwr_sClass_Pb_FDL_DataTransfer
*
op
=
(
pwr_sClass_Pb_FDL_DataTransfer
*
)
cp
->
op
;
...
...
@@ -251,16 +259,21 @@ static pwr_tStatus IoCardWrite(
op
->
Status
=
sap
->
Status
;
if
(
op
->
Status
==
PB__NORMAL
)
{
if
(
op
->
Status
==
PB__NORMAL
)
{
io_bus_card_write
(
ctx
,
cp
,
local
->
output_area
,
local
->
byte_ordering
,
local
->
float_representation
);
local
->
float_representation
);
if
(
op
->
SendReq
)
{
if
(
op
->
SendReq
)
{
pthread_mutex_lock
(
&
local_agent
->
mutex
);
if
(
sap
->
Responder
)
{
if
(
sap
->
Responder
)
{
fdlif_reply_update_mult_req
(
local_agent
,
sap
,
op
,
local
);
}
else
{
}
else
{
fdlif_sda_sdn_sdr_req
(
local_agent
,
sap
,
op
,
local
);
}
op
->
SendReq
=
0
;
...
...
@@ -274,8 +287,8 @@ static pwr_tStatus IoCardWrite(
/*----------------------------------------------------------------------------*\
Close method for the Pb module
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
local
=
cp
->
Local
;
...
...
@@ -290,7 +303,7 @@ static pwr_tStatus IoCardClose(
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport
pwr_BindIoMethods
(
Pb_FDL_DataTransfer
)
=
{
pwr_BindIoMethod
(
IoCardInit
),
pwr_BindIoMethod
(
IoCardRead
),
pwr_BindIoMethod
(
IoCardWrite
),
pwr_BindIoMethod
(
IoCardClose
),
pwr_NullMethod
};
pwr_dExport
pwr_BindIoMethods
(
Pb_FDL_DataTransfer
)
=
{
pwr_BindIoMethod
(
IoCardInit
),
pwr_BindIoMethod
(
IoCardRead
),
pwr_BindIoMethod
(
IoCardWrite
),
pwr_BindIoMethod
(
IoCardClose
),
pwr_NullMethod
};
profibus/lib/rt/src/rt_io_m_pb_fdl_sap.c
View file @
df0831a3
...
...
@@ -85,5 +85,6 @@ static pwr_tStatus IoRackClose(io_tCtx ctx, io_sAgent* ap, io_sRack* rp)
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport
pwr_BindIoMethods
(
Pb_FDL_SAP
)
=
{
pwr_BindIoMethod
(
IoRackInit
),
pwr_BindIoMethod
(
IoRackClose
),
pwr_NullMethod
};
pwr_dExport
pwr_BindIoMethods
(
Pb_FDL_SAP
)
=
{
pwr_BindIoMethod
(
IoRackInit
),
pwr_BindIoMethod
(
IoRackClose
),
pwr_NullMethod
};
profibus/lib/rt/src/rt_io_m_pb_hilscher.c
View file @
df0831a3
...
...
@@ -86,7 +86,8 @@ board.
#include "rt_io_pb_locals.h"
typedef
struct
{
typedef
struct
{
/* Board number. */
unsigned
short
dev_number
;
/* Number of occupied bytes in the input area of the dual port ram. */
...
...
@@ -114,7 +115,8 @@ static pwr_tStatus IoAgentClose(io_tCtx ctx, io_sAgent* ap);
/* Start segment of the database, shall be 8 for
CIF30-DPM, CIF104-DPM, COM-DPM, COM-PB, CIF104-PB and CIF 50-PB.
Shall be 0 for CIF 30-PB and CIF 60-PB. */
typedef
struct
{
typedef
struct
{
/* Used to terminate the table, se to 1 for every entry but the
last (dummy entry), which should be 0. */
unsigned
char
entry
;
...
...
@@ -129,15 +131,14 @@ typedef struct {
/* Table of known boards, consists of four fields according to the board type.
The last entry must be a null termination (entry == 0).
*/
boards
known_boards
[]
=
{
{
1
,
{
8
,
50
,
66
,
{
'C'
,
'I'
,
'F'
}
},
8
,
"Hilscher CIF 50-PB"
},
{
0
,
{},
0
,
""
}
};
boards
known_boards
[]
=
{
{
1
,
{
8
,
50
,
66
,
{
'C'
,
'I'
,
'F'
}},
8
,
"Hilscher CIF 50-PB"
},
{
0
,
{},
0
,
""
}};
#endif
/* FLASH_WRITE_ENABLE */
/* Initializes Profibus DP interface on the CIF board referred to by local.
DRV_NO_ERROR is returned upon success. */
static
short
dpm_init_master
(
io_sAgentLocalHilscher
*
local
,
pwr_sClass_Pb_Hilscher
*
op
,
io_sAgent
*
ap
)
static
short
dpm_init_master
(
io_sAgentLocalHilscher
*
local
,
pwr_sClass_Pb_Hilscher
*
op
,
io_sAgent
*
ap
)
{
short
rv
;
DPM_PLC_PARAMETER
prm
;
...
...
@@ -166,19 +167,21 @@ static short dpm_init_master(
/* Writes parameters to the board local->dev_number, task 2, size is
* hardcoded to 16 as specified in dpm_pie.pdf, page 9. */
if
((
rv
=
DevPutTaskParameter
(
local
->
dev_number
,
2
,
16
,
&
prm
))
!=
DRV_NO_ERROR
)
{
if
((
rv
=
DevPutTaskParameter
(
local
->
dev_number
,
2
,
16
,
&
prm
))
!=
DRV_NO_ERROR
)
{
errh_Error
(
"Profibus DP Master %s - "
" DevPutTaskParameter() failed with return code %d"
,
ap
->
Name
,
rv
);
ap
->
Name
,
rv
);
return
rv
;
}
/* Resets board to put new master parameters into effect. */
if
((
rv
=
DevReset
(
local
->
dev_number
,
WARMSTART
,
8000
))
!=
DRV_NO_ERROR
)
{
if
((
rv
=
DevReset
(
local
->
dev_number
,
WARMSTART
,
8000
))
!=
DRV_NO_ERROR
)
{
errh_Error
(
"Profibus DP Master %s - "
" DevReset() failed with return code %d"
,
ap
->
Name
,
rv
);
ap
->
Name
,
rv
);
return
rv
;
}
...
...
@@ -191,15 +194,18 @@ static short dpm_init(io_sAgentLocalHilscher* local, io_sAgent* ap)
{
short
rv
;
if
((
rv
=
DevOpenDriver
())
!=
DRV_NO_ERROR
)
{
if
((
rv
=
DevOpenDriver
())
!=
DRV_NO_ERROR
)
{
errh_Error
(
"Profibus DP Master %s - "
" DevOpenDriver() failed with return code %d"
,
ap
->
Name
,
rv
);
ap
->
Name
,
rv
);
return
rv
;
}
else
if
((
rv
=
DevInitBoard
(
local
->
dev_number
))
!=
DRV_NO_ERROR
)
{
}
else
if
((
rv
=
DevInitBoard
(
local
->
dev_number
))
!=
DRV_NO_ERROR
)
{
errh_Error
(
"Profibus DP Master %s - "
" DevInitBoard() failed with return code %d"
,
ap
->
Name
,
rv
);
ap
->
Name
,
rv
);
return
rv
;
}
...
...
@@ -213,16 +219,18 @@ static short dpm_exit(io_sAgentLocalHilscher* local, io_sAgent* ap)
short
rv
;
short
rv_ret
=
DRV_NO_ERROR
;
if
((
rv
=
DevExitBoard
(
local
->
dev_number
))
!=
DRV_NO_ERROR
)
{
if
((
rv
=
DevExitBoard
(
local
->
dev_number
))
!=
DRV_NO_ERROR
)
{
errh_Error
(
"Profibus DP Master %s - "
" DevExitBoard() failed with return code %d"
,
ap
->
Name
,
rv
);
ap
->
Name
,
rv
);
rv_ret
=
rv
;
}
if
((
rv
=
DevCloseDriver
())
!=
DRV_NO_ERROR
)
{
if
((
rv
=
DevCloseDriver
())
!=
DRV_NO_ERROR
)
{
errh_Error
(
"Profibus DP Master %s - "
" DevCloseDriver() failed with return code %d"
,
ap
->
Name
,
rv
);
ap
->
Name
,
rv
);
rv_ret
=
rv
;
}
...
...
@@ -251,29 +259,35 @@ static short module_cnt_inputs(io_sCard* cp)
for
(
cid
=
cp
->
Class
;
ODD
(
gdh_GetSuperClass
(
cid
,
&
cid
,
cp
->
Objid
));)
;
if
(
cid
==
pwr_cClass_Pb_Module
)
{
if
(
cid
==
pwr_cClass_Pb_Module
)
{
/* New style configuring (from v4.1.3) with Pb_Module objects or
subclass. Loop all channels in the module and set channel size and
offset. */
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
++
i
)
{
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
++
i
)
{
chanp
=
&
cp
->
chanlist
[
i
];
if
(
is_diag
(
&
chanp
->
ChanAref
))
{
if
(
is_diag
(
&
chanp
->
ChanAref
))
{
chanp
->
udata
|=
PB_UDATA_DIAG
;
if
(
chanp
->
ChanClass
!=
pwr_cClass_ChanIi
)
errh_Error
(
"Diagnostic channel class, card %s"
,
cp
->
Name
);
continue
;
}
if
(
chanp
->
ChanClass
!=
pwr_cClass_ChanDi
)
{
if
(
chanp
->
ChanClass
!=
pwr_cClass_ChanDi
)
{
input_counter
+=
latent_input_count
;
latent_input_count
=
0
;
}
switch
(
chanp
->
ChanClass
)
{
switch
(
chanp
->
ChanClass
)
{
case
pwr_cClass_ChanDi
:
chan_di
=
(
pwr_sClass_ChanDi
*
)
chanp
->
cop
;
if
(
chan_di
->
Number
==
0
)
{
if
(
chan_di
->
Number
==
0
)
{
input_counter
+=
latent_input_count
;
latent_input_count
=
0
;
}
...
...
@@ -326,29 +340,35 @@ static short module_cnt_outputs(io_sCard* cp)
for
(
cid
=
cp
->
Class
;
ODD
(
gdh_GetSuperClass
(
cid
,
&
cid
,
cp
->
Objid
));)
;
if
(
cid
==
pwr_cClass_Pb_Module
)
{
if
(
cid
==
pwr_cClass_Pb_Module
)
{
/* New style configuring (from v4.1.3) with Pb_Module objects or
subclass. Loop all channels in the module and set channel size and
offset. */
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
chanp
=
&
cp
->
chanlist
[
i
];
if
(
is_diag
(
&
chanp
->
ChanAref
))
{
if
(
is_diag
(
&
chanp
->
ChanAref
))
{
chanp
->
udata
|=
PB_UDATA_DIAG
;
if
(
chanp
->
ChanClass
!=
pwr_cClass_ChanIi
)
errh_Error
(
"Diagnostic channel class, card %s"
,
cp
->
Name
);
continue
;
}
if
(
chanp
->
ChanClass
!=
pwr_cClass_ChanDo
)
{
if
(
chanp
->
ChanClass
!=
pwr_cClass_ChanDo
)
{
output_counter
+=
latent_output_count
;
latent_output_count
=
0
;
}
switch
(
chanp
->
ChanClass
)
{
switch
(
chanp
->
ChanClass
)
{
case
pwr_cClass_ChanDo
:
chan_do
=
(
pwr_sClass_ChanDo
*
)
chanp
->
cop
;
if
(
chan_do
->
Number
==
0
)
{
if
(
chan_do
->
Number
==
0
)
{
output_counter
+=
latent_output_count
;
latent_output_count
=
0
;
}
...
...
@@ -385,7 +405,8 @@ The function will also set up the required fields in op so that Proview
may perform IO operations using the IoAgentRead() and IoAgentWrite() functions
in this module. */
static
void
dpm_set_add_tab
(
pwr_sClass_Pb_DP_Slave
*
op
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
DPM_SL_PRM_ADD_TAB
*
add_tab
,
int
add_tab_len
)
io_sRack
*
rp
,
DPM_SL_PRM_ADD_TAB
*
add_tab
,
int
add_tab_len
)
{
io_sCard
*
cardp
;
short
input_counter
;
...
...
@@ -400,10 +421,10 @@ static void dpm_set_add_tab(pwr_sClass_Pb_DP_Slave* op, io_sAgent* ap,
slaves/modules have occupied so far. */
unsigned
short
*
input_size
;
unsigned
short
*
output_size
;
input_size
=
(
unsigned
short
*
)
&
((
io_sAgentLocalHilscher
*
)
ap
->
Local
)
->
input_size
;
output_size
=
(
unsigned
short
*
)
&
((
io_sAgentLocalHilscher
*
)
ap
->
Local
)
->
output_size
;
input_size
=
(
unsigned
short
*
)
&
((
io_sAgentLocalHilscher
*
)
ap
->
Local
)
->
input_size
;
output_size
=
(
unsigned
short
*
)
&
((
io_sAgentLocalHilscher
*
)
ap
->
Local
)
->
output_size
;
/* This lets Proview find the IO-area for this module (in this case it is
actually handled at the agent level, thus in this file). The offsets
...
...
@@ -415,21 +436,24 @@ static void dpm_set_add_tab(pwr_sClass_Pb_DP_Slave* op, io_sAgent* ap,
op
->
BytesOfOutput
=
0
;
/* Finds our rack (slave). */
for
(
sl
=
rp
;
sl
!=
NULL
&&
((
pwr_sClass_Pb_DP_Slave
*
)
sl
->
op
)
->
SlaveAddress
!=
op
->
SlaveAddress
;
for
(
sl
=
rp
;
sl
!=
NULL
&&
((
pwr_sClass_Pb_DP_Slave
*
)
sl
->
op
)
->
SlaveAddress
!=
op
->
SlaveAddress
;
sl
=
sl
->
next
)
;
if
(
sl
==
NULL
||
((
pwr_sClass_Pb_DP_Slave
*
)
sl
->
op
)
->
SlaveAddress
!=
op
->
SlaveAddress
)
{
if
(
sl
==
NULL
||
((
pwr_sClass_Pb_DP_Slave
*
)
sl
->
op
)
->
SlaveAddress
!=
op
->
SlaveAddress
)
{
errh_Error
(
"Profibus DP Master %s - "
" Can't find rack for slave %d"
,
ap
->
Name
,
op
->
SlaveAddress
);
ap
->
Name
,
op
->
SlaveAddress
);
return
;
}
/* Iterates through the cards (modules in Profibus terminology) of
the current rack, counting the length of the input area as we go. */
for
(
cardp
=
sl
->
cardlist
;
cardp
;
cardp
=
cardp
->
next
)
{
for
(
cardp
=
sl
->
cardlist
;
cardp
;
cardp
=
cardp
->
next
)
{
/* Gets the size of the input area for this module. */
input_counter
=
module_cnt_inputs
(
cardp
);
...
...
@@ -438,19 +462,21 @@ static void dpm_set_add_tab(pwr_sClass_Pb_DP_Slave* op, io_sAgent* ap,
/* Only modules with and input or output area are required to
have an entry in the add tab. */
if
(
input_counter
>
0
)
{
if
(
input_counter
>
0
)
{
assert
(
add_tab
->
bInput_Count
+
4
<
add_tab_len
);
/* The MSB tells the Hilscher board whether to treat the address
as a byte (set) or word (unset) offset
(see dpm_pie.pdf, page 45). */
add_tab
->
ausEA_Offset
[
add_tab
->
bInput_Count
++
]
=
*
input_size
|
EA_OFFSET_BYTE
;
add_tab
->
ausEA_Offset
[
add_tab
->
bInput_Count
++
]
=
*
input_size
|
EA_OFFSET_BYTE
;
*
input_size
+=
input_counter
;
}
}
/* Now process the output areas. */
for
(
cardp
=
sl
->
cardlist
;
cardp
;
cardp
=
cardp
->
next
)
{
for
(
cardp
=
sl
->
cardlist
;
cardp
;
cardp
=
cardp
->
next
)
{
/* Gets the size of the output area for this module. */
output_counter
=
module_cnt_outputs
(
cardp
);
...
...
@@ -459,14 +485,15 @@ static void dpm_set_add_tab(pwr_sClass_Pb_DP_Slave* op, io_sAgent* ap,
/* Only modules with and input or output area are required to
have an entry in the add tab. */
if
(
output_counter
>
0
)
{
if
(
output_counter
>
0
)
{
assert
(
add_tab
->
bInput_Count
+
add_tab
->
bOutput_Count
+
4
<
add_tab_len
);
/* The MSB tells the Hilscher board whether to treat the address
as a byte (set) or word (unset) offset
(see dpm_pie.pdf, page 45). */
/* The input offsets precedes the output offsets. */
add_tab
->
ausEA_Offset
[
add_tab
->
bInput_Count
+
add_tab
->
bOutput_Count
++
]
=
*
output_size
|
EA_OFFSET_BYTE
;
add_tab
->
ausEA_Offset
[
add_tab
->
bInput_Count
+
add_tab
->
bOutput_Count
++
]
=
*
output_size
|
EA_OFFSET_BYTE
;
*
output_size
+=
output_counter
;
}
}
...
...
@@ -474,9 +501,10 @@ static void dpm_set_add_tab(pwr_sClass_Pb_DP_Slave* op, io_sAgent* ap,
assert
(
add_tab
->
bInput_Count
+
add_tab
->
bOutput_Count
<=
MAX_EA_OFFSET_LEN
);
/* Updates the length of the add_tab struct. */
add_tab
->
usAdd_Tab_Len
=
sizeof
(
add_tab
->
usAdd_Tab_Len
)
+
sizeof
(
add_tab
->
bInput_Count
)
+
sizeof
(
add_tab
->
bOutput_Count
)
+
2
*
add_tab
->
bInput_Count
+
2
*
add_tab
->
bOutput_Count
;
add_tab
->
usAdd_Tab_Len
=
sizeof
(
add_tab
->
usAdd_Tab_Len
)
+
sizeof
(
add_tab
->
bInput_Count
)
+
sizeof
(
add_tab
->
bOutput_Count
)
+
2
*
add_tab
->
bInput_Count
+
2
*
add_tab
->
bOutput_Count
;
}
/* Writes instructions for reflashing the board to the error log. */
...
...
@@ -499,9 +527,11 @@ static void dpm_ddlm_answer_msg_print_error(RCS_MESSAGE* msg, io_sAgent* ap)
if
(
msg
==
NULL
)
return
;
switch
(
msg
->
a
)
{
switch
(
msg
->
a
)
{
case
DDLM_Download
:
switch
(
msg
->
f
)
{
switch
(
msg
->
f
)
{
case
0
:
return
;
case
CON_NO
:
...
...
@@ -551,7 +581,8 @@ static void dpm_ddlm_answer_msg_print_error(RCS_MESSAGE* msg, io_sAgent* ap)
break
;
case
DDLM_Slave_Diag
:
switch
(
msg
->
f
)
{
switch
(
msg
->
f
)
{
case
0
:
return
;
case
CON_NA
:
...
...
@@ -567,7 +598,7 @@ static void dpm_ddlm_answer_msg_print_error(RCS_MESSAGE* msg, io_sAgent* ap)
return
;
}
errh_Info
(
"Profibus DP Master %s - Station %d - DDLM Slave Diag: %s"
,
ap
->
Name
,
((
RCS_MESSAGETELEGRAM_10
*
)
msg
)
->
device_adr
,
s
);
ap
->
Name
,
((
RCS_MESSAGETELEGRAM_10
*
)
msg
)
->
device_adr
,
s
);
break
;
default:
...
...
@@ -582,7 +613,8 @@ or 127 to set master bus parameters. The bus parameters are read from
the buffer prmdata and shall be of length prmlen. DRV_NO_ERROR is returned
if successful. */
static
short
dpm_ddlm_download
(
io_sAgentLocalHilscher
*
local
,
unsigned
char
address
,
unsigned
int
prmlen
,
void
*
prmdata
,
io_sAgent
*
ap
)
unsigned
char
address
,
unsigned
int
prmlen
,
void
*
prmdata
,
io_sAgent
*
ap
)
{
short
rv
;
int
got_response
=
0
;
...
...
@@ -613,32 +645,40 @@ static short dpm_ddlm_download(io_sAgentLocalHilscher* local,
assert
(
prmlen
<=
240
);
memcpy
(
&
(
msg
.
d
[
4
]),
prmdata
,
prmlen
);
if
((
rv
=
DevPutMessage
(
local
->
dev_number
,
(
MSG_STRUC
*
)
&
msg
,
5000
))
!=
DRV_NO_ERROR
)
{
if
((
rv
=
DevPutMessage
(
local
->
dev_number
,
(
MSG_STRUC
*
)
&
msg
,
5000
))
!=
DRV_NO_ERROR
)
{
errh_Error
(
"Profibus DP Master %s - DDLM_Download - DevPutMessage()"
" returned %d"
,
ap
->
Name
,
rv
);
ap
->
Name
,
rv
);
return
rv
;
}
/* Checks confirmation message. */
while
(
!
got_response
)
{
if
((
rv
=
DevGetMessage
(
local
->
dev_number
,
sizeof
(
rcv_msg
),
(
MSG_STRUC
*
)
&
rcv_msg
,
5000
))
!=
DRV_NO_ERROR
)
{
while
(
!
got_response
)
{
if
((
rv
=
DevGetMessage
(
local
->
dev_number
,
sizeof
(
rcv_msg
),
(
MSG_STRUC
*
)
&
rcv_msg
,
5000
))
!=
DRV_NO_ERROR
)
{
errh_Error
(
"Profibus DP Master %s - DDLM_Download - DevGetMessage()"
" returned %d"
,
ap
->
Name
,
rv
);
ap
->
Name
,
rv
);
return
rv
;
}
else
if
(
rcv_msg
.
nr
!=
local
->
cif_msgcnt
||
rcv_msg
.
rx
!=
16
||
rcv_msg
.
tx
!=
3
||
rcv_msg
.
a
!=
DDLM_Download
)
{
}
else
if
(
rcv_msg
.
nr
!=
local
->
cif_msgcnt
||
rcv_msg
.
rx
!=
16
||
rcv_msg
.
tx
!=
3
||
rcv_msg
.
a
!=
DDLM_Download
)
{
/* Discards all messages prior to our response. */
memset
(
&
rcv_msg
,
0
,
sizeof
(
rcv_msg
));
continue
;
}
else
if
(
rcv_msg
.
f
!=
0
)
{
}
else
if
(
rcv_msg
.
f
!=
0
)
{
dpm_ddlm_answer_msg_print_error
(
&
rcv_msg
,
ap
);
return
rcv_msg
.
f
;
}
else
{
}
else
{
got_response
=
1
;
}
}
...
...
@@ -648,8 +688,8 @@ static short dpm_ddlm_download(io_sAgentLocalHilscher* local,
/* Configures the master bus parameters of the board referred to by
local, the struct containing the parameters should be passed in op. */
static
short
dpm_download_master_prm
(
io_sAgentLocalHilscher
*
local
,
pwr_sClass_Pb_Hilscher
*
op
,
io_sAgent
*
ap
)
static
short
dpm_download_master_prm
(
io_sAgentLocalHilscher
*
local
,
pwr_sClass_Pb_Hilscher
*
op
,
io_sAgent
*
ap
)
{
DPM_BUS_DP
prm
;
...
...
@@ -661,14 +701,17 @@ static short dpm_download_master_prm(
prm
.
usBus_Para_Len
=
32
;
/* The master's address is hardcoded to 0. */
prm
.
bFDL_Add
=
0
;
prm
.
bBaudrate
=
((
op
->
BaudRate
==
500
)
?
(
DP_BAUD_500
)
:
(
op
->
BaudRate
==
1500
)
?
(
DP_BAUD_1500
)
:
(
op
->
BaudRate
==
3000
)
?
(
DP_BAUD_3000
)
:
(
op
->
BaudRate
==
6000
)
?
(
DP_BAUD_6000
)
:
(
op
->
BaudRate
==
12000
)
?
(
DP_BAUD_12000
)
:
(
DP_BAUD_1500
));
prm
.
bBaudrate
=
((
op
->
BaudRate
==
500
)
?
(
DP_BAUD_500
)
:
(
op
->
BaudRate
==
1500
)
?
(
DP_BAUD_1500
)
:
(
op
->
BaudRate
==
3000
)
?
(
DP_BAUD_3000
)
:
(
op
->
BaudRate
==
6000
)
?
(
DP_BAUD_6000
)
:
(
op
->
BaudRate
==
12000
)
?
(
DP_BAUD_12000
)
:
(
DP_BAUD_1500
));
prm
.
usTSL
=
op
->
Tsl
;
prm
.
usMin_TSDR
=
op
->
MinTsdr
;
prm
.
usMax_TSDR
=
op
->
MaxTsdr
;
...
...
@@ -696,7 +739,8 @@ is passed in local. op holds the slave to configure, the corresponding
agent pointer and rack pointer must be passed in ap and rp respectively.
DRV_NO_ERROR will be returned upon success. */
static
short
dpm_download_slave_prm
(
io_sAgentLocalHilscher
*
local
,
pwr_sClass_Pb_DP_Slave
*
op
,
io_sAgent
*
ap
,
io_sRack
*
rp
)
pwr_sClass_Pb_DP_Slave
*
op
,
io_sAgent
*
ap
,
io_sRack
*
rp
)
{
unsigned
char
buf
[
DPM_MAX_LEN_DATA_UNIT
];
unsigned
int
bufcnt
=
0
;
...
...
@@ -790,8 +834,8 @@ static short dpm_download_slave_prm(io_sAgentLocalHilscher* local,
board referred to by local. The function will return DRV_NO_ERROR if
the request was sent without error, however, it tells us nothing
about whether any diagnostics data was sent back. */
static
short
dpm_req_slave_diag
(
io_sAgentLocalHilscher
*
local
,
unsigned
char
address
,
io_sAgent
*
ap
)
static
short
dpm_req_slave_diag
(
io_sAgentLocalHilscher
*
local
,
unsigned
char
address
,
io_sAgent
*
ap
)
{
short
rv
;
RCS_MESSAGETELEGRAM_10
msg
;
...
...
@@ -819,11 +863,12 @@ static short dpm_req_slave_diag(
msg
.
function
=
TASK_TFC_READ
;
/* Requests diagnostic data from slave. */
if
((
rv
=
DevPutMessage
(
local
->
dev_number
,
(
MSG_STRUC
*
)
&
msg
,
0
))
!=
DRV_NO_ERROR
)
{
if
((
rv
=
DevPutMessage
(
local
->
dev_number
,
(
MSG_STRUC
*
)
&
msg
,
0
))
!=
DRV_NO_ERROR
)
{
errh_Info
(
"Profibus DP Master %s - DDLM_Slave_Diag - DevPutMessage()"
" returned %d"
,
ap
->
Name
,
rv
);
ap
->
Name
,
rv
);
return
rv
;
}
...
...
@@ -834,8 +879,8 @@ static short dpm_req_slave_diag(
to gather diagnostics data asynchronously. The desired agent's local
struct is passed via local and the associated rack list (Profibus slaves) is
passed in slave_list. */
static
void
dpm_update_slave_diag
(
io_sAgentLocalHilscher
*
local
,
io_sRack
*
slave_list
,
io_sAgent
*
ap
)
static
void
dpm_update_slave_diag
(
io_sAgentLocalHilscher
*
local
,
io_sRack
*
slave_list
,
io_sAgent
*
ap
)
{
short
rv
;
RCS_MESSAGETELEGRAM_10
rcv_msg
;
...
...
@@ -846,33 +891,40 @@ static void dpm_update_slave_diag(
memset
(
&
rcv_msg
,
0
,
sizeof
(
rcv_msg
));
/* Gets pending diagnostic messages, discards all other messages. */
while
((
rv
=
DevGetMessage
(
local
->
dev_number
,
sizeof
(
rcv_msg
),
(
MSG_STRUC
*
)
&
rcv_msg
,
0
))
==
DRV_NO_ERROR
)
{
if
(
rcv_msg
.
rx
!=
16
||
rcv_msg
.
tx
!=
3
||
rcv_msg
.
a
!=
DDLM_Slave_Diag
)
{
while
((
rv
=
DevGetMessage
(
local
->
dev_number
,
sizeof
(
rcv_msg
),
(
MSG_STRUC
*
)
&
rcv_msg
,
0
))
==
DRV_NO_ERROR
)
{
if
(
rcv_msg
.
rx
!=
16
||
rcv_msg
.
tx
!=
3
||
rcv_msg
.
a
!=
DDLM_Slave_Diag
)
{
/* Discards received message. */
memset
(
&
rcv_msg
,
0
,
sizeof
(
rcv_msg
));
continue
;
}
else
if
(
rcv_msg
.
f
!=
0
)
{
}
else
if
(
rcv_msg
.
f
!=
0
)
{
dpm_ddlm_answer_msg_print_error
((
RCS_MESSAGE
*
)
&
rcv_msg
,
ap
);
/* Discards received message. */
memset
(
&
rcv_msg
,
0
,
sizeof
(
rcv_msg
));
continue
;
}
else
{
}
else
{
/*** Updates Proview's structs with the acquired diagnostics. ***/
/* Finds our slave. */
for
(
sl
=
slave_list
;
sl
!=
NULL
;
sl
=
sl
->
next
)
{
for
(
sl
=
slave_list
;
sl
!=
NULL
;
sl
=
sl
->
next
)
{
sp
=
(
pwr_sClass_Pb_DP_Slave
*
)
sl
->
op
;
if
(
sp
->
SlaveAddress
==
rcv_msg
.
device_adr
)
break
;
}
/* The slave from which we were to read diagnostic data could not
be found -- abort. */
if
(
sp
->
SlaveAddress
!=
rcv_msg
.
device_adr
)
{
if
(
sp
->
SlaveAddress
!=
rcv_msg
.
device_adr
)
{
errh_Error
(
"Profibus DP Master %s - Received diagnostic message"
" from unknown slave %d"
,
ap
->
Name
,
rcv_msg
.
device_adr
);
ap
->
Name
,
rcv_msg
.
device_adr
);
return
;
}
...
...
@@ -888,23 +940,31 @@ static void dpm_update_slave_diag(
/* Updates the slave's status */
if
(
!
(
sp
->
StationStatus1
&
~
pwr_mPbStationStatus1Mask_ExternalDiag
)
&&
!
(
sp
->
StationStatus2
&
~
(
pwr_mPbStationStatus2Mask_Default
|
pwr_mPbStationStatus2Mask_ResponseMonitoringOn
)))
{
if
(
!
(
sp
->
StationStatus1
&
~
pwr_mPbStationStatus1Mask_ExternalDiag
)
&&
!
(
sp
->
StationStatus2
&
~
(
pwr_mPbStationStatus2Mask_Default
|
pwr_mPbStationStatus2Mask_ResponseMonitoringOn
)))
{
sp
->
Status
=
PB__NORMAL
;
}
else
if
(
sp
->
StationStatus1
&
pwr_mPbStationStatus1Mask_NonExistent
)
{
}
else
if
(
sp
->
StationStatus1
&
pwr_mPbStationStatus1Mask_NonExistent
)
{
sp
->
Status
=
PB__NOCONN
;
}
else
if
((
sp
->
StationStatus1
&
(
pwr_mPbStationStatus1Mask_ConfigFault
|
pwr_mPbStationStatus1Mask_ParamFault
))
||
(
sp
->
StationStatus2
&
pwr_mPbStationStatus2Mask_NewParamsRequested
))
{
}
else
if
((
sp
->
StationStatus1
&
(
pwr_mPbStationStatus1Mask_ConfigFault
|
pwr_mPbStationStatus1Mask_ParamFault
))
||
(
sp
->
StationStatus2
&
pwr_mPbStationStatus2Mask_NewParamsRequested
))
{
sp
->
Status
=
PB__CONFIGERR
;
}
else
if
(
sp
->
StationStatus1
&
pwr_mPbStationStatus1Mask_MasterLock
)
{
}
else
if
(
sp
->
StationStatus1
&
pwr_mPbStationStatus1Mask_MasterLock
)
{
sp
->
Status
=
PB__MASTERLOCK
;
}
else
{
/* if (sp->StationStatus1
& pwr_mPbStationStatus1Mask_NotReady) */
}
else
{
/* if (sp->StationStatus1
& pwr_mPbStationStatus1Mask_NotReady) */
sp
->
Status
=
PB__NOTREADY
;
}
}
...
...
@@ -917,10 +977,14 @@ static void dpm_print_diag(io_sAgent* ap, DPM_DIAGNOSTICS* diag)
{
char
*
s
;
if
(
diag
->
tError
.
bErr_Event
==
0
)
{
if
(
diag
->
tError
.
bErr_Event
==
0
)
{
return
;
}
else
if
(
diag
->
tError
.
bErr_Rem_Adr
==
255
)
{
switch
(
diag
->
tError
.
bErr_Event
)
{
}
else
if
(
diag
->
tError
.
bErr_Rem_Adr
==
255
)
{
switch
(
diag
->
tError
.
bErr_Event
)
{
case
TASK_F_NO_USR_TASK
:
s
=
"usr task not found"
;
break
;
...
...
@@ -993,8 +1057,11 @@ static void dpm_print_diag(io_sAgent* ap, DPM_DIAGNOSTICS* diag)
errh_Info
(
"Profibus DP Master %s - %s"
,
ap
->
Name
,
s
);
return
;
}
else
{
switch
(
diag
->
tError
.
bErr_Event
)
{
}
else
{
switch
(
diag
->
tError
.
bErr_Event
)
{
case
CON_NA
:
s
=
"no reaction of the remote station"
;
break
;
...
...
@@ -1013,7 +1080,7 @@ static void dpm_print_diag(io_sAgent* ap, DPM_DIAGNOSTICS* diag)
#ifdef SLAVE_DIAG_VERBOSE
errh_Info
(
"Profibus DP Master %s - Station %d - %s"
,
ap
->
Name
,
diag
->
tError
.
bErr_Rem_Adr
,
s
);
diag
->
tError
.
bErr_Rem_Adr
,
s
);
#endif
/* SLAVE_DIAG_VERBOSE */
return
;
}
...
...
@@ -1026,7 +1093,7 @@ static void dpm_print_diag(io_sAgent* ap, DPM_DIAGNOSTICS* diag)
If the board was found in the database, the function returns DRV_NO_ERROR
and the startsegment will be written to what db_startsegment points to. */
static
short
dpm_check_board_type
(
io_sAgentLocalHilscher
*
local
,
io_sAgent
*
ap
,
unsigned
char
*
db_startsegment
)
unsigned
char
*
db_startsegment
)
{
short
rv
;
DEVINFO
info
;
...
...
@@ -1035,16 +1102,17 @@ static short dpm_check_board_type(io_sAgentLocalHilscher* local, io_sAgent* ap,
assert
(
DRV_NO_ERROR
==
0
);
/* Gets device information from the board. */
if
((
rv
=
DevGetInfo
(
local
->
dev_number
,
GET_DEV_INFO
,
sizeof
(
info
),
&
info
))
!=
DRV_NO_ERROR
)
{
if
((
rv
=
DevGetInfo
(
local
->
dev_number
,
GET_DEV_INFO
,
sizeof
(
info
),
&
info
))
!=
DRV_NO_ERROR
)
{
errh_Error
(
"Profibus DP Master %s - Error %d while checking board type."
,
ap
->
Name
,
rv
);
ap
->
Name
,
rv
);
return
rv
;
}
errh_Info
(
"Profibus DP Master %s -"
" Selected board %d has the following device info:"
,
ap
->
Name
,
local
->
dev_number
);
ap
->
Name
,
local
->
dev_number
);
errh_Info
(
"Device DPM size: %d"
,
info
.
bDpmSize
);
errh_Info
(
"Device type: %d"
,
info
.
bDevType
);
errh_Info
(
"Device model: %d"
,
info
.
bDevModel
);
...
...
@@ -1055,7 +1123,8 @@ static short dpm_check_board_type(io_sAgentLocalHilscher* local, io_sAgent* ap,
if
(
memcmp
(
&
known_boards
[
i
].
info
,
&
info
,
sizeof
(
info
))
==
0
)
break
;
if
(
known_boards
[
i
].
entry
==
0
)
{
if
(
known_boards
[
i
].
entry
==
0
)
{
/* Board was not found in table. */
errh_Error
(
"Profibus DP Master %s - Unknown board."
,
ap
->
Name
);
errh_Error
(
"To add support for this board, look up its database start"
);
...
...
@@ -1067,8 +1136,9 @@ static short dpm_check_board_type(io_sAgentLocalHilscher* local, io_sAgent* ap,
errh_Error
(
"in the above mentioned documentation."
);
errh_Error
(
"{ 1, { %d, %d, %d, { '%c', '%c', '%c'} }, "
"<db start segment>,
\"
<board name>
\"
},"
,
info
.
bDpmSize
,
info
.
bDevType
,
info
.
bDevModel
,
info
.
abDevIdentifier
[
0
],
info
.
abDevIdentifier
[
1
],
info
.
abDevIdentifier
[
2
]);
info
.
bDpmSize
,
info
.
bDevType
,
info
.
bDevModel
,
info
.
abDevIdentifier
[
0
],
info
.
abDevIdentifier
[
1
],
info
.
abDevIdentifier
[
2
]);
return
BOARD_INIT_ERROR
;
}
...
...
@@ -1084,8 +1154,8 @@ static short dpm_check_board_type(io_sAgentLocalHilscher* local, io_sAgent* ap,
/* Deletes the "PROFIBUS" protocol settings database from the card referred
to by local, this procedure is described on page 32 -- 33 in dpm_pie.pdf. */
static
short
dpm_delete_flash_prmdb
(
io_sAgentLocalHilscher
*
local
,
io_sAgent
*
ap
)
static
short
dpm_delete_flash_prmdb
(
io_sAgentLocalHilscher
*
local
,
io_sAgent
*
ap
)
{
unsigned
char
db_startsegment
;
int
s
=
3
;
...
...
@@ -1101,7 +1171,7 @@ static short dpm_delete_flash_prmdb(
memset
(
&
msg
,
0
,
sizeof
(
msg
));
/* Defines message header. */
msg
.
rx
=
0
;
/* receiver = RCS-Task */
msg
.
rx
=
0
;
/* receiver = RCS-Task */
msg
.
tx
=
16
;
/* transmitter = user at HOST */
msg
.
ln
=
2
;
msg
.
nr
=
++
local
->
cif_msgcnt
;
...
...
@@ -1114,21 +1184,22 @@ static short dpm_delete_flash_prmdb(
msg
.
d
[
0
]
=
4
;
/* mode = delete data base */
msg
.
d
[
1
]
=
db_startsegment
;
errh_Info
(
"Profibus DP Master %s - Sending delete database request..."
,
ap
->
Name
);
errh_Info
(
"Profibus DP Master %s - Sending delete database request..."
,
ap
->
Name
);
/* Sends delete database request. */
if
((
rv
=
DevPutMessage
(
local
->
dev_number
,
(
MSG_STRUC
*
)
&
msg
,
5000
))
!=
DRV_NO_ERROR
)
{
if
((
rv
=
DevPutMessage
(
local
->
dev_number
,
(
MSG_STRUC
*
)
&
msg
,
5000
))
!=
DRV_NO_ERROR
)
{
errh_Error
(
"Profibus DP Master %s -"
" DevPutMessage failed with return code %d"
,
ap
->
Name
,
rv
);
ap
->
Name
,
rv
);
return
rv
;
}
/* Waits for controller to update flash. */
errh_Info
(
"Profibus DP Master %s -"
" Delete db request sent. Waiting %d seconds..."
,
ap
->
Name
,
s
);
ap
->
Name
,
s
);
while
((
s
=
sleep
(
s
)))
;
...
...
@@ -1136,28 +1207,33 @@ static short dpm_delete_flash_prmdb(
memset
(
&
msg
,
0
,
sizeof
(
msg
));
/* Gets response message. */
while
(
!
got_response
)
{
if
((
rv
=
DevGetMessage
(
local
->
dev_number
,
sizeof
(
msg
),
(
MSG_STRUC
*
)
&
msg
,
10000
))
!=
DRV_NO_ERROR
)
{
while
(
!
got_response
)
{
if
((
rv
=
DevGetMessage
(
local
->
dev_number
,
sizeof
(
msg
),
(
MSG_STRUC
*
)
&
msg
,
10000
))
!=
DRV_NO_ERROR
)
{
errh_Error
(
"Profibus DP Master %s -"
" DevGetMessage failed with return code %d
\n
"
,
ap
->
Name
,
rv
);
ap
->
Name
,
rv
);
return
rv
;
}
else
if
(
msg
.
nr
!=
local
->
cif_msgcnt
||
msg
.
rx
!=
16
||
msg
.
tx
!=
0
||
msg
.
a
!=
6
)
{
}
else
if
(
msg
.
nr
!=
local
->
cif_msgcnt
||
msg
.
rx
!=
16
||
msg
.
tx
!=
0
||
msg
.
a
!=
6
)
{
/* Discards all messages prior to our response. */
memset
(
&
msg
,
0
,
sizeof
(
msg
));
continue
;
}
else
{
}
else
{
if
(
msg
.
f
!=
0
)
errh_Error
(
"Profibus DP Master %s -"
" Delete db confirmation message f-flag set to %d"
,
ap
->
Name
,
msg
.
f
);
ap
->
Name
,
msg
.
f
);
else
errh_Info
(
"Profibus DP Master %s -"
" Delete database confirmation message received."
,
ap
->
Name
);
ap
->
Name
);
got_response
=
1
;
}
}
...
...
@@ -1173,8 +1249,9 @@ static short dpm_delete_flash_prmdb(
/* Wrapper for dpm_init_master(), takes care of checking for (and optionally
removing) the sycon database if present. */
static
short
dpm_init_master_check_sycon_db
(
io_sAgentLocalHilscher
*
local
,
pwr_sClass_Pb_Hilscher
*
op
,
io_sAgent
*
ap
)
static
short
dpm_init_master_check_sycon_db
(
io_sAgentLocalHilscher
*
local
,
pwr_sClass_Pb_Hilscher
*
op
,
io_sAgent
*
ap
)
{
short
rv
;
DRIVERINFO
di
;
...
...
@@ -1182,30 +1259,36 @@ static short dpm_init_master_check_sycon_db(
assert
(
DRV_NO_ERROR
==
0
);
/* Initializes DP Master. */
if
((
rv
=
dpm_init_master
(
local
,
op
,
ap
))
!=
DRV_NO_ERROR
)
{
if
((
rv
=
dpm_init_master
(
local
,
op
,
ap
))
!=
DRV_NO_ERROR
)
{
return
rv
;
}
else
if
((
rv
=
DevGetInfo
(
local
->
dev_number
,
GET_DRIVER_INFO
,
sizeof
(
di
),
&
di
))
!=
DRV_NO_ERROR
)
{
}
else
if
((
rv
=
DevGetInfo
(
local
->
dev_number
,
GET_DRIVER_INFO
,
sizeof
(
di
),
&
di
))
!=
DRV_NO_ERROR
)
{
errh_Error
(
"Profibus DP Master %s -"
" DevGetInfo failed with return code %d"
,
ap
->
Name
,
rv
);
ap
->
Name
,
rv
);
return
rv
;
}
else
if
((
di
.
bHostFlags
&
(
READY_FLAG
|
RUN_FLAG
))
==
(
READY_FLAG
|
RUN_FLAG
))
{
}
else
if
((
di
.
bHostFlags
&
(
READY_FLAG
|
RUN_FLAG
))
==
(
READY_FLAG
|
RUN_FLAG
))
{
/* RUN and RDY bits set */
errh_Info
(
"Profibus DP Master %s - Hostflags: 0x%X"
,
ap
->
Name
,
di
.
bHostFlags
);
errh_Info
(
"Profibus DP Master %s - Hostflags: 0x%X"
,
ap
->
Name
,
di
.
bHostFlags
);
errh_Info
(
"Device is configured by SyCon."
);
#ifdef FLASH_WRITE_ENABLE
errh_Info
(
"Deleting SyCon database from board's flash."
);
if
((
rv
=
dpm_delete_flash_prmdb
(
local
,
ap
))
!=
DRV_NO_ERROR
)
{
if
((
rv
=
dpm_delete_flash_prmdb
(
local
,
ap
))
!=
DRV_NO_ERROR
)
{
return
rv
;
}
else
{
}
else
{
/* Reinitializes DP Master. */
rv
=
dpm_init_master
(
local
,
op
,
ap
);
}
#else
/* FLASH_WRITE_ENABLE */
#else
/* FLASH_WRITE_ENABLE */
errh_Info
(
"Flash writing is not enabled, "
);
flashing_disabled_warning
(
ap
);
return
BOARD_INIT_ERROR
;
...
...
@@ -1231,13 +1314,14 @@ static pwr_tStatus IoAgentInit(io_tCtx ctx, io_sAgent* ap)
pwr_sClass_Pb_DP_Slave
*
sop
;
char
name
[
196
];
struct
timespec
rqtp
=
{
0
,
20000000
};
/* 20 ms */
struct
timespec
rqtp
=
{
0
,
20000000
};
/* 20 ms */
int
retry
;
/* Allocates area for local data structure */
ap
->
Local
=
calloc
(
1
,
sizeof
(
io_sAgentLocalHilscher
));
if
(
!
ap
->
Local
)
{
if
(
!
ap
->
Local
)
{
errh_Error
(
"ERROR config Profibus DP Master %s - %s"
,
ap
->
Name
,
"calloc"
);
return
IO__ERRINIDEVICE
;
}
...
...
@@ -1249,7 +1333,8 @@ static pwr_tStatus IoAgentInit(io_tCtx ctx, io_sAgent* ap)
op
->
Status
=
PB__NOTINIT
;
/* Initializes interface. */
if
(
ctx
->
Node
->
Restarts
>
0
)
{
if
(
ctx
->
Node
->
Restarts
>
0
)
{
nanosleep
(
&
rqtp
,
NULL
);
}
...
...
@@ -1263,45 +1348,52 @@ static pwr_tStatus IoAgentInit(io_tCtx ctx, io_sAgent* ap)
local
->
watchdog
=
0
;
/* Initializes Profibus driver API. */
if
(
dpm_init
(
local
,
ap
)
!=
DRV_NO_ERROR
)
{
if
(
dpm_init
(
local
,
ap
)
!=
DRV_NO_ERROR
)
{
/* Cannot open driver */
op
->
Status
=
PB__INITFAIL
;
errh_Error
(
"ERROR config Profibus DP Master %s - %s"
,
ap
->
Name
,
"open device"
);
errh_Error
(
"ERROR config Profibus DP Master %s - %s"
,
ap
->
Name
,
"open device"
);
ctx
->
Node
->
EmergBreakTrue
=
1
;
return
IO__ERRDEVICE
;
}
/* If this is not the Profibus I/O process, return */
if
((
op
->
Process
&
io_mProcess_Profibus
)
&&
(
ctx
->
Process
!=
io_mProcess_Profibus
))
{
if
((
op
->
Process
&
io_mProcess_Profibus
)
&&
(
ctx
->
Process
!=
io_mProcess_Profibus
))
{
op
->
Status
=
PB__NOTINIT
;
errh_Info
(
"Init template I/O agent for Profibus DP Master %s, %d"
,
ap
->
Name
,
ctx
->
Process
);
ctx
->
Process
);
return
IO__SUCCESS
;
}
if
(
ctx
->
Node
->
Restarts
>
0
)
{
errh_Info
(
"Warm restart - Skipping config of Profibus DP Master %s"
,
ap
->
Name
);
if
(
ctx
->
Node
->
Restarts
>
0
)
{
errh_Info
(
"Warm restart - Skipping config of Profibus DP Master %s"
,
ap
->
Name
);
op
->
Status
=
PB__NORMAL
;
return
IO__SUCCESS
;
}
errh_Info
(
"Config of Profibus DP Master %s"
,
ap
->
Name
);
if
(
op
->
DisableBus
!=
1
)
{
if
(
op
->
DisableBus
!=
1
)
{
ok
=
FALSE
;
if
(
ctx
->
Node
->
Restarts
==
0
)
{
if
(
ctx
->
Node
->
Restarts
==
0
)
{
retry
=
0
;
while
(
!
ok
)
{
while
(
!
ok
)
{
op
->
Status
=
PB__NOTINIT
;
/* Sets DP master parameters and checks for sycon database. */
if
(
dpm_init_master_check_sycon_db
(
local
,
op
,
ap
)
!=
DRV_NO_ERROR
)
{
if
(
dpm_init_master_check_sycon_db
(
local
,
op
,
ap
)
!=
DRV_NO_ERROR
)
{
op
->
Status
=
PB__INITFAIL
;
errh_Error
(
"ERROR config Profibus DP Master %s - %s"
,
ap
->
Name
,
"dp init master"
);
"dp init master"
);
return
IO__ERRINIDEVICE
;
}
...
...
@@ -1309,42 +1401,46 @@ static pwr_tStatus IoAgentInit(io_tCtx ctx, io_sAgent* ap)
and initializes them. */
op
->
NumberSlaves
=
0
;
status
=
gdh_GetChild
(
ap
->
Objid
,
&
slave_objid
);
while
(
ODD
(
status
))
{
while
(
ODD
(
status
))
{
status
=
gdh_GetObjectClass
(
slave_objid
,
&
slave_class
);
status
=
gdh_ObjidToPointer
(
slave_objid
,
(
pwr_tAddress
*
)
&
sop
);
status
=
gdh_ObjidToName
(
slave_objid
,
(
char
*
)
&
name
,
sizeof
(
name
),
cdh_mNName
);
status
=
gdh_ObjidToName
(
slave_objid
,
(
char
*
)
&
name
,
sizeof
(
name
),
cdh_mNName
);
errh_Info
(
"Download Profibus DP Slave config - %s"
,
name
);
/* Calculates IO offsets and configures the slave. */
if
(
dpm_download_slave_prm
(
local
,
sop
,
ap
,
ap
->
racklist
)
!=
DRV_NO_ERROR
)
{
if
(
dpm_download_slave_prm
(
local
,
sop
,
ap
,
ap
->
racklist
)
!=
DRV_NO_ERROR
)
{
errh_Error
(
"ERROR Init Profibus DP slave %s"
,
name
);
}
errh_Info
(
"Profibus DP slave %d: in offs %d, input size %d,"
" out offs %d, out size %d"
,
sop
->
SlaveAddress
,
sop
->
OffsetInputs
,
sop
->
BytesOfInput
,
sop
->
OffsetOutputs
,
sop
->
BytesOfOutput
);
sop
->
SlaveAddress
,
sop
->
OffsetInputs
,
sop
->
BytesOfInput
,
sop
->
OffsetOutputs
,
sop
->
BytesOfOutput
);
op
->
NumberSlaves
++
;
status
=
gdh_GetNextSibling
(
slave_objid
,
&
slave_objid
);
}
/* Downloads the DP bus parameters -- this initiates the
cyclic data exchange. */
if
(
dpm_download_master_prm
(
local
,
op
,
ap
)
!=
DRV_NO_ERROR
)
{
if
(
dpm_download_master_prm
(
local
,
op
,
ap
)
!=
DRV_NO_ERROR
)
{
op
->
Status
=
PB__INITFAIL
;
errh_Error
(
"ERROR config Profibus DP Master %s - %s"
,
ap
->
Name
,
"dp download bus"
);
"dp download bus"
);
return
IO__ERRINIDEVICE
;
}
ok
=
TRUE
;
}
/* End - While !ok */
}
/* End - Initialization only if not restart */
}
else
}
/* End - Initialization only if not restart */
}
else
op
->
Status
=
PB__DISABLED
;
return
IO__SUCCESS
;
...
...
@@ -1376,17 +1472,19 @@ static pwr_tStatus IoAgentRead(io_tCtx ctx, io_sAgent* ap)
however, keeping this code here enables us to confine all the Profibus
board specific code at the agent level. */
for
(
slave_list
=
ap
->
racklist
;
slave_list
!=
NULL
;
slave_list
=
slave_list
->
next
)
{
slave_list
=
slave_list
->
next
)
{
sp
=
(
pwr_sClass_Pb_DP_Slave
*
)
slave_list
->
op
;
mp
=
(
pwr_sClass_Pb_Hilscher
*
)
ap
->
op
;
if
(
sp
->
Status
==
PB__NORMAL
&&
mp
->
Status
==
PB__NORMAL
&&
sp
->
DisableSlave
!=
1
&&
mp
->
DisableBus
!=
1
)
{
if
(
sp
->
Status
==
PB__NORMAL
&&
mp
->
Status
==
PB__NORMAL
&&
sp
->
DisableSlave
!=
1
&&
mp
->
DisableBus
!=
1
)
{
/* Triggers the board's watchdog. */
DevTriggerWatchDog
(
local
->
dev_number
,
WATCHDOG_START
,
&
local
->
watchdog
);
/* Reads process image from the slave. */
rv
=
DevExchangeIO
(
local
->
dev_number
,
0
,
0
,
NULL
,
sp
->
OffsetInputs
,
sp
->
BytesOfInput
,
sp
->
Inputs
,
100
);
sp
->
BytesOfInput
,
sp
->
Inputs
,
100
);
}
}
...
...
@@ -1399,8 +1497,8 @@ static pwr_tStatus IoAgentRead(io_tCtx ctx, io_sAgent* ap)
Make a poll to see if there are diagnostics, the answer also tells us
if there are any hardware faults. */
if
((
op
->
Process
&
io_mProcess_Profibus
)
&&
(
ctx
->
Process
!=
io_mProcess_Profibus
))
if
((
op
->
Process
&
io_mProcess_Profibus
)
&&
(
ctx
->
Process
!=
io_mProcess_Profibus
))
return
IO__SUCCESS
;
if
(
op
->
DisableBus
==
1
)
...
...
@@ -1409,27 +1507,32 @@ static pwr_tStatus IoAgentRead(io_tCtx ctx, io_sAgent* ap)
/* Reads the protocol states and checks for errors. */
DevGetTaskState
(
local
->
dev_number
,
2
,
64
,
&
diag
);
/* Checks if master is in state OPERATE. */
switch
(
diag
.
bDPM_state
)
{
switch
(
diag
.
bDPM_state
)
{
case
OPERATE
:
if
(
op
->
Status
!=
PB__NORMAL
)
{
if
(
op
->
Status
!=
PB__NORMAL
)
{
op
->
Status
=
PB__NORMAL
;
errh_Info
(
"Profibus DP Master %s - Mode changed to OPERATE"
,
ap
->
Name
);
}
break
;
case
CLEAR
:
if
(
op
->
Status
!=
PB__CLEARED
)
{
if
(
op
->
Status
!=
PB__CLEARED
)
{
op
->
Status
=
PB__CLEARED
;
errh_Info
(
"Profibus DP Master %s - Mode changed to CLEAR"
,
ap
->
Name
);
}
break
;
case
STOP
:
if
(
op
->
Status
!=
PB__STOPPED
)
{
if
(
op
->
Status
!=
PB__STOPPED
)
{
op
->
Status
=
PB__STOPPED
;
errh_Info
(
"Profibus DP Master %s - Mode changed to STOP"
,
ap
->
Name
);
}
break
;
case
OFFLINE
:
if
(
op
->
Status
!=
PB__NOTINIT
)
{
if
(
op
->
Status
!=
PB__NOTINIT
)
{
errh_Info
(
"Profibus DP Master %s - Mode changed to OFFLINE"
,
ap
->
Name
);
op
->
Status
=
PB__NOTINIT
;
}
...
...
@@ -1443,10 +1546,12 @@ static pwr_tStatus IoAgentRead(io_tCtx ctx, io_sAgent* ap)
/* Checks if there are any new diagnostics data that we should read from
any of our slaves. */
for
(
i
=
0
;
i
<=
127
;
++
i
)
{
for
(
i
=
0
;
i
<=
127
;
++
i
)
{
/* The abSl_diag data structure is described on page 22 in
dpm_pie.pdf. */
if
(
diag
.
abSl_diag
[
i
>>
3
]
&
(
1
<<
(
i
&
7
)))
{
if
(
diag
.
abSl_diag
[
i
>>
3
]
&
(
1
<<
(
i
&
7
)))
{
/* Request diagnostics from slaves with unread diagnostic data. */
dpm_req_slave_diag
(
local
,
i
,
ap
);
}
...
...
@@ -1457,12 +1562,12 @@ static pwr_tStatus IoAgentRead(io_tCtx ctx, io_sAgent* ap)
before its watchdog times out the diagnostics would not be updated. The
following code covers that case, it is a bit ugly, but works. */
for
(
slave_list
=
ap
->
racklist
;
slave_list
!=
NULL
;
slave_list
=
slave_list
->
next
)
{
slave_list
=
slave_list
->
next
)
{
sp
=
(
pwr_sClass_Pb_DP_Slave
*
)
slave_list
->
op
;
/* The abSl_state has the same layout as the abSl_diag bitmap. */
if
(
sp
->
StationStatus1
&
pwr_mPbStationStatus1Mask_NonExistent
&&
diag
.
abSl_state
[
sp
->
SlaveAddress
>>
3
]
&
(
1
<<
(
sp
->
SlaveAddress
&
7
)))
if
(
sp
->
StationStatus1
&
pwr_mPbStationStatus1Mask_NonExistent
&&
diag
.
abSl_state
[
sp
->
SlaveAddress
>>
3
]
&
(
1
<<
(
sp
->
SlaveAddress
&
7
)))
dpm_req_slave_diag
(
local
,
sp
->
SlaveAddress
,
ap
);
}
/* Collects requested slave diagnostics. */
...
...
@@ -1489,20 +1594,23 @@ static pwr_tStatus IoAgentWrite(io_tCtx ctx, io_sAgent* ap)
however, keeping this code here enables us to confine all the Profibus
board specific code at the agent level. */
for
(
slave_list
=
ap
->
racklist
;
slave_list
!=
NULL
;
slave_list
=
slave_list
->
next
)
{
slave_list
=
slave_list
->
next
)
{
sp
=
(
pwr_sClass_Pb_DP_Slave
*
)
slave_list
->
op
;
mp
=
(
pwr_sClass_Pb_Hilscher
*
)
ap
->
op
;
if
((
sp
->
Status
==
PB__NORMAL
||
sp
->
Status
==
PB__NOCONN
)
&&
mp
->
Status
==
PB__NORMAL
&&
(
sp
->
DisableSlave
!=
1
)
&&
(
mp
->
DisableBus
!=
1
))
{
if
(
sp
->
BytesOfOutput
>
0
)
{
if
((
sp
->
Status
==
PB__NORMAL
||
sp
->
Status
==
PB__NOCONN
)
&&
mp
->
Status
==
PB__NORMAL
&&
(
sp
->
DisableSlave
!=
1
)
&&
(
mp
->
DisableBus
!=
1
))
{
if
(
sp
->
BytesOfOutput
>
0
)
{
/* Trigger the board's watchdog. */
DevTriggerWatchDog
(
local
->
dev_number
,
WATCHDOG_START
,
&
local
->
watchdog
);
/* Writes process image to the slave. */
if
(
DevExchangeIO
(
local
->
dev_number
,
sp
->
OffsetOutputs
,
sp
->
BytesOfOutput
,
sp
->
Outputs
,
0
,
0
,
NULL
,
100
)
!=
DRV_NO_ERROR
)
sp
->
BytesOfOutput
,
sp
->
Outputs
,
0
,
0
,
NULL
,
100
)
!=
DRV_NO_ERROR
)
sp
->
ErrorCount
++
;
}
}
...
...
@@ -1530,6 +1638,7 @@ static pwr_tStatus IoAgentClose(io_tCtx ctx, io_sAgent* ap)
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport
pwr_BindIoMethods
(
Pb_Hilscher
)
=
{
pwr_BindIoMethod
(
IoAgentInit
),
pwr_BindIoMethod
(
IoAgentRead
),
pwr_BindIoMethod
(
IoAgentWrite
),
pwr_BindIoMethod
(
IoAgentClose
),
pwr_NullMethod
};
pwr_dExport
pwr_BindIoMethods
(
Pb_Hilscher
)
=
{
pwr_BindIoMethod
(
IoAgentInit
),
pwr_BindIoMethod
(
IoAgentRead
),
pwr_BindIoMethod
(
IoAgentWrite
),
pwr_BindIoMethod
(
IoAgentClose
),
pwr_NullMethod
};
profibus/lib/rt/src/rt_io_m_pb_ii.c
View file @
df0831a3
...
...
@@ -51,8 +51,8 @@
/*----------------------------------------------------------------------------*\
Init method for the Pb module Ii
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
pwr_sClass_Pb_Ii
*
op
;
...
...
@@ -60,7 +60,8 @@ static pwr_tStatus IoCardInit(
op
=
(
pwr_sClass_Pb_Ii
*
)
cp
->
op
;
local
=
(
io_sCardLocal
*
)
cp
->
Local
;
if
(
rp
->
Class
!=
pwr_cClass_Pb_DP_Slave
)
{
if
(
rp
->
Class
!=
pwr_cClass_Pb_DP_Slave
)
{
errh_Info
(
"Illegal object type %s"
,
cp
->
Name
);
return
IO__SUCCESS
;
}
...
...
@@ -74,8 +75,8 @@ static pwr_tStatus IoCardInit(
/*----------------------------------------------------------------------------*\
Read method for the Pb Ii card
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardRead
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardRead
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
pwr_sClass_Pb_Ii
*
op
;
...
...
@@ -95,8 +96,10 @@ static pwr_tStatus IoCardRead(
op
=
(
pwr_sClass_Pb_Ii
*
)
cp
->
op
;
slave
=
(
pwr_sClass_Pb_DP_Slave
*
)
rp
->
op
;
if
(
op
->
Status
>=
PB_MODULE_STATE_OPERATE
&&
slave
->
DisableSlave
!=
1
)
{
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
if
(
op
->
Status
>=
PB_MODULE_STATE_OPERATE
&&
slave
->
DisableSlave
!=
1
)
{
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
chanp
=
&
cp
->
chanlist
[
i
];
if
(
!
chanp
->
cop
||
!
chanp
->
sop
)
continue
;
...
...
@@ -104,54 +107,76 @@ static pwr_tStatus IoCardRead(
cop
=
(
pwr_sClass_ChanIi
*
)
chanp
->
cop
;
sop
=
(
pwr_sClass_Ii
*
)
chanp
->
sop
;
if
(
cop
->
ConversionOn
)
{
if
(
op
->
BytesPerChannel
==
4
)
{
if
(
op
->
NumberRepresentation
==
PB_NUMREP_UNSIGNEDINT
)
{
if
(
cop
->
ConversionOn
)
{
if
(
op
->
BytesPerChannel
==
4
)
{
if
(
op
->
NumberRepresentation
==
PB_NUMREP_UNSIGNEDINT
)
{
memcpy
(
&
udata32
,
local
->
input_area
+
op
->
OffsetInputs
+
4
*
i
,
4
);
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
udata32
=
swap32
(
udata32
);
*
(
pwr_tInt32
*
)
chanp
->
vbp
=
(
pwr_tInt32
)
udata32
;
}
else
if
(
op
->
NumberRepresentation
==
PB_NUMREP_SIGNEDINT
)
{
}
else
if
(
op
->
NumberRepresentation
==
PB_NUMREP_SIGNEDINT
)
{
memcpy
(
&
data32
,
local
->
input_area
+
op
->
OffsetInputs
+
4
*
i
,
4
);
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
data32
=
swap32
(
data32
);
*
(
pwr_tInt32
*
)
chanp
->
vbp
=
data32
;
}
}
else
if
(
op
->
BytesPerChannel
==
3
)
{
if
(
op
->
NumberRepresentation
==
PB_NUMREP_UNSIGNEDINT
)
{
}
else
if
(
op
->
BytesPerChannel
==
3
)
{
if
(
op
->
NumberRepresentation
==
PB_NUMREP_UNSIGNEDINT
)
{
udata32
=
0
;
memcpy
(
&
udata32
,
local
->
input_area
+
op
->
OffsetInputs
+
3
*
i
,
3
);
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
{
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
{
udata32
=
swap32
(
udata32
);
udata32
=
udata32
>>
8
;
}
*
(
pwr_tInt32
*
)
chanp
->
vbp
=
(
pwr_tInt32
)
udata32
;
}
else
if
(
op
->
NumberRepresentation
==
PB_NUMREP_SIGNEDINT
)
{
}
else
if
(
op
->
NumberRepresentation
==
PB_NUMREP_SIGNEDINT
)
{
data32
=
0
;
memcpy
(
&
data32
,
local
->
input_area
+
op
->
OffsetInputs
+
3
*
i
,
3
);
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
{
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
{
data32
=
swap32
(
data32
);
data32
=
data32
>>
8
;
}
*
(
pwr_tInt32
*
)
chanp
->
vbp
=
data32
;
}
}
else
if
(
op
->
BytesPerChannel
==
2
)
{
if
(
op
->
NumberRepresentation
==
PB_NUMREP_UNSIGNEDINT
)
{
}
else
if
(
op
->
BytesPerChannel
==
2
)
{
if
(
op
->
NumberRepresentation
==
PB_NUMREP_UNSIGNEDINT
)
{
memcpy
(
&
udata16
,
local
->
input_area
+
op
->
OffsetInputs
+
2
*
i
,
2
);
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
udata16
=
swap16
(
udata16
);
*
(
pwr_tInt32
*
)
chanp
->
vbp
=
(
pwr_tInt32
)
udata16
;
}
else
if
(
op
->
NumberRepresentation
==
PB_NUMREP_SIGNEDINT
)
{
}
else
if
(
op
->
NumberRepresentation
==
PB_NUMREP_SIGNEDINT
)
{
memcpy
(
&
data16
,
local
->
input_area
+
op
->
OffsetInputs
+
2
*
i
,
2
);
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
data16
=
swap16
(
data16
);
*
(
pwr_tInt32
*
)
chanp
->
vbp
=
(
pwr_tInt32
)
data16
;
}
}
else
if
(
op
->
BytesPerChannel
==
1
)
{
if
(
op
->
NumberRepresentation
==
PB_NUMREP_UNSIGNEDINT
)
{
}
else
if
(
op
->
BytesPerChannel
==
1
)
{
if
(
op
->
NumberRepresentation
==
PB_NUMREP_UNSIGNEDINT
)
{
memcpy
(
&
udata8
,
local
->
input_area
+
op
->
OffsetInputs
+
i
,
1
);
*
(
pwr_tInt32
*
)
chanp
->
vbp
=
(
pwr_tInt32
)
udata8
;
}
else
if
(
op
->
NumberRepresentation
==
PB_NUMREP_SIGNEDINT
)
{
}
else
if
(
op
->
NumberRepresentation
==
PB_NUMREP_SIGNEDINT
)
{
memcpy
(
&
data8
,
local
->
input_area
+
op
->
OffsetInputs
+
i
,
1
);
*
(
pwr_tInt32
*
)
chanp
->
vbp
=
(
pwr_tInt32
)
data8
;
}
...
...
@@ -166,8 +191,8 @@ static pwr_tStatus IoCardRead(
/*----------------------------------------------------------------------------*\
Close method for the Pb Ii card
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
local
=
cp
->
Local
;
...
...
@@ -181,5 +206,6 @@ static pwr_tStatus IoCardClose(
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport
pwr_BindIoMethods
(
Pb_Ii
)
=
{
pwr_BindIoMethod
(
IoCardInit
),
pwr_BindIoMethod
(
IoCardRead
),
pwr_BindIoMethod
(
IoCardClose
),
pwr_NullMethod
};
pwr_dExport
pwr_BindIoMethods
(
Pb_Ii
)
=
{
pwr_BindIoMethod
(
IoCardInit
),
pwr_BindIoMethod
(
IoCardRead
),
pwr_BindIoMethod
(
IoCardClose
),
pwr_NullMethod
};
profibus/lib/rt/src/rt_io_m_pb_io.c
View file @
df0831a3
...
...
@@ -49,8 +49,8 @@
/*----------------------------------------------------------------------------*\
Init method for the Pb module Io
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
pwr_sClass_Pb_Io
*
op
;
...
...
@@ -58,12 +58,14 @@ static pwr_tStatus IoCardInit(
op
=
(
pwr_sClass_Pb_Io
*
)
cp
->
op
;
local
=
(
io_sCardLocal
*
)
cp
->
Local
;
if
(
rp
->
Class
!=
pwr_cClass_Pb_DP_Slave
)
{
if
(
rp
->
Class
!=
pwr_cClass_Pb_DP_Slave
)
{
errh_Info
(
"Illegal object type %s"
,
cp
->
Name
);
return
IO__SUCCESS
;
}
if
(
op
->
Status
<
PB_MODULE_STATE_OPERATE
)
{
if
(
op
->
Status
<
PB_MODULE_STATE_OPERATE
)
{
errh_Info
(
"Error initializing Pb module Io %s"
,
cp
->
Name
);
}
...
...
@@ -73,8 +75,8 @@ static pwr_tStatus IoCardInit(
/*----------------------------------------------------------------------------*\
Write method for the Pb module Io
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardWrite
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardWrite
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
pwr_sClass_Pb_Io
*
op
;
...
...
@@ -91,8 +93,10 @@ static pwr_tStatus IoCardWrite(
op
=
(
pwr_sClass_Pb_Io
*
)
cp
->
op
;
slave
=
(
pwr_sClass_Pb_DP_Slave
*
)
rp
->
op
;
if
(
op
->
Status
>=
PB_MODULE_STATE_OPERATE
&&
slave
->
DisableSlave
!=
1
)
{
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
if
(
op
->
Status
>=
PB_MODULE_STATE_OPERATE
&&
slave
->
DisableSlave
!=
1
)
{
for
(
i
=
0
;
i
<
cp
->
ChanListSize
;
i
++
)
{
chanp
=
&
cp
->
chanlist
[
i
];
if
(
!
chanp
->
cop
||
!
chanp
->
sop
)
continue
;
...
...
@@ -105,20 +109,27 @@ static pwr_tStatus IoCardWrite(
data32
=
*
(
pwr_tInt32
*
)
chanp
->
vbp
;
if
(
op
->
BytesPerChannel
==
4
)
{
if
(
op
->
BytesPerChannel
==
4
)
{
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
data32
=
swap32
(
data32
);
memcpy
(
local
->
output_area
+
op
->
OffsetOutputs
+
4
*
i
,
&
data32
,
4
);
}
else
if
(
op
->
BytesPerChannel
==
3
)
{
}
else
if
(
op
->
BytesPerChannel
==
3
)
{
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
data32
=
swap32
(
data32
);
memcpy
(
local
->
output_area
+
op
->
OffsetOutputs
+
3
*
i
,
&
data32
,
3
);
}
else
if
(
op
->
BytesPerChannel
==
2
)
{
}
else
if
(
op
->
BytesPerChannel
==
2
)
{
data16
=
(
pwr_tInt16
)
data32
;
if
(
slave
->
ByteOrdering
==
pwr_eByteOrderingEnum_BigEndian
)
data16
=
swap16
(
data16
);
memcpy
(
local
->
output_area
+
op
->
OffsetOutputs
+
2
*
i
,
&
data16
,
2
);
}
else
if
(
op
->
BytesPerChannel
==
1
)
{
}
else
if
(
op
->
BytesPerChannel
==
1
)
{
data8
=
(
pwr_tInt8
)
data32
;
memcpy
(
local
->
output_area
+
op
->
OffsetOutputs
+
i
,
&
data8
,
1
);
}
...
...
@@ -130,8 +141,8 @@ static pwr_tStatus IoCardWrite(
/*----------------------------------------------------------------------------*\
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
local
=
cp
->
Local
;
...
...
@@ -145,6 +156,6 @@ static pwr_tStatus IoCardClose(
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport
pwr_BindIoMethods
(
Pb_Io
)
=
{
pwr_BindIoMethod
(
IoCardInit
),
pwr_BindIoMethod
(
IoCardWrite
),
pwr_BindIoMethod
(
IoCardClose
),
pwr_NullMethod
};
pwr_dExport
pwr_BindIoMethods
(
Pb_Io
)
=
{
pwr_BindIoMethod
(
IoCardInit
),
pwr_BindIoMethod
(
IoCardWrite
),
pwr_BindIoMethod
(
IoCardClose
),
pwr_NullMethod
};
profibus/lib/rt/src/rt_io_m_pb_module.c
View file @
df0831a3
...
...
@@ -52,8 +52,8 @@
/*----------------------------------------------------------------------------*\
Init method for the Pb module
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
pwr_sClass_Pb_Module
*
op
;
...
...
@@ -62,7 +62,8 @@ static pwr_tStatus IoCardInit(
op
=
(
pwr_sClass_Pb_Module
*
)
cp
->
op
;
local
=
(
io_sCardLocal
*
)
cp
->
Local
;
for
(
i
=
0
;
i
<
IO_MAXCHAN
;
i
++
)
{
for
(
i
=
0
;
i
<
IO_MAXCHAN
;
i
++
)
{
local
->
scancount
[
i
]
=
0
;
}
...
...
@@ -74,8 +75,8 @@ static pwr_tStatus IoCardInit(
/*----------------------------------------------------------------------------*\
Read method for the Pb module
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardRead
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardRead
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
pwr_sClass_Pb_Module
*
op
;
...
...
@@ -92,7 +93,7 @@ static pwr_tStatus IoCardRead(
/* all inputs will be zeroed */
io_bus_card_read
(
ctx
,
rp
,
cp
,
local
->
input_area
,
slave
->
Diag
,
slave
->
ByteOrdering
,
slave
->
FloatRepresentation
);
slave
->
ByteOrdering
,
slave
->
FloatRepresentation
);
// printf("Method Pb_Module-IoCardRead\n");
return
IO__SUCCESS
;
...
...
@@ -101,8 +102,8 @@ static pwr_tStatus IoCardRead(
/*----------------------------------------------------------------------------*\
Write method for the Pb module
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardWrite
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardWrite
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
pwr_sClass_Pb_Module
*
op
;
...
...
@@ -114,9 +115,10 @@ static pwr_tStatus IoCardWrite(
op
->
Status
=
slave
->
Status
;
if
(
op
->
Status
==
PB__NORMAL
)
{
if
(
op
->
Status
==
PB__NORMAL
)
{
io_bus_card_write
(
ctx
,
cp
,
local
->
output_area
,
slave
->
ByteOrdering
,
slave
->
FloatRepresentation
);
slave
->
FloatRepresentation
);
}
// printf("Method Pb_Module-IoCardWrite\n");
return
IO__SUCCESS
;
...
...
@@ -125,8 +127,8 @@ static pwr_tStatus IoCardWrite(
/*----------------------------------------------------------------------------*\
Close method for the Pb module
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoCardClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
static
pwr_tStatus
IoCardClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
,
io_sCard
*
cp
)
{
io_sCardLocal
*
local
;
local
=
cp
->
Local
;
...
...
@@ -141,6 +143,7 @@ static pwr_tStatus IoCardClose(
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport
pwr_BindIoMethods
(
Pb_Module
)
=
{
pwr_BindIoMethod
(
IoCardInit
),
pwr_BindIoMethod
(
IoCardRead
),
pwr_BindIoMethod
(
IoCardWrite
),
pwr_BindIoMethod
(
IoCardClose
),
pwr_NullMethod
};
pwr_dExport
pwr_BindIoMethods
(
Pb_Module
)
=
{
pwr_BindIoMethod
(
IoCardInit
),
pwr_BindIoMethod
(
IoCardRead
),
pwr_BindIoMethod
(
IoCardWrite
),
pwr_BindIoMethod
(
IoCardClose
),
pwr_NullMethod
};
profibus/lib/rt/src/rt_io_m_pb_profiboard.c
View file @
df0831a3
...
...
@@ -78,23 +78,23 @@ static pwr_tStatus IoAgentInit(io_tCtx ctx, io_sAgent* ap);
static
pwr_tStatus
IoAgentRead
(
io_tCtx
ctx
,
io_sAgent
*
ap
);
static
pwr_tStatus
IoAgentWrite
(
io_tCtx
ctx
,
io_sAgent
*
ap
);
static
pwr_tStatus
IoAgentClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
);
static
pwr_tStatus
IoAgentSwap
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_eEvent
event
);
/*----------------------------------------------------------------------------*\
Sends request to Profiboard for setting FMB parameters
\*----------------------------------------------------------------------------*/
static
short
try_profi_rcv_con_ind
(
T_PROFI_
DEVICE_HANDLE
*
hDevice
,
T_PROFI_SERVICE_DESCR
*
con_ind_sdb
,
USIGN8
*
con_ind_buffer
,
USIGN16
*
con_ind_buffer_len
,
INT16
*
result
)
static
short
try_profi_rcv_con_ind
(
T_PROFI_
SERVICE_DESCR
*
con_ind_sdb
,
USIGN8
*
con_ind_buffer
,
USIGN16
*
con_ind_buffer_len
,
INT16
*
result
)
{
int
retry_counter
;
struct
timespec
rqtp
=
{
0
,
10000000
};
// 10 ms
struct
timespec
rqtp
=
{
0
,
10000000
};
// 10 ms
retry_counter
=
DP_MAX_SERVICE_RETRY
;
do
{
do
{
nanosleep
(
&
rqtp
,
NULL
);
*
result
=
profi_rcv_con_ind
(
hDevice
,
con_ind_sdb
,
con_ind_buffer
,
con_ind_buffer_len
);
*
result
=
profi_rcv_con_ind
(
con_ind_sdb
,
con_ind_buffer
,
con_ind_buffer_len
);
}
while
((
*
result
==
NO_CON_IND_RECEIVED
)
&&
(
retry_counter
--
>
0
));
if
(
*
result
==
E_IF_FATAL_ERROR
)
...
...
@@ -105,8 +105,7 @@ static short try_profi_rcv_con_ind(T_PROFI_DEVICE_HANDLE* hDevice,
/*----------------------------------------------------------------------------*\
Sends request to Profiboard for setting FMB parameters
\*----------------------------------------------------------------------------*/
static
short
fmb_set_configuration
(
T_PROFI_DEVICE_HANDLE
*
hDevice
,
io_sAgent
*
ap
)
static
short
fmb_set_configuration
(
io_sAgent
*
ap
)
{
T_PROFI_SERVICE_DESCR
sdb
;
T_FMB_SET_CONFIGURATION_REQ
data
;
...
...
@@ -126,7 +125,8 @@ static short fmb_set_configuration(
/* Iterate over the slaves. */
for
(
slave_list
=
ap
->
racklist
;
slave_list
!=
NULL
;
slave_list
=
slave_list
->
next
)
{
slave_list
=
slave_list
->
next
)
{
cid
=
slave_list
->
Class
;
while
(
ODD
(
gdh_GetSuperClass
(
cid
,
&
cid
,
pwr_cNOid
)))
...
...
@@ -167,13 +167,14 @@ static short fmb_set_configuration(
data
.
fdlif
.
receive_credits
=
20
;
data
.
fdlif
.
max_no_resp_saps
=
20
;
profi_snd_req_res
(
hDevice
,
&
sdb
,
&
data
,
PB_FALSE
);
profi_snd_req_res
(
&
sdb
,
&
data
,
PB_FALSE
);
try_profi_rcv_con_ind
(
hDevice
,
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
,
&
result
);
try_profi_rcv_con_ind
(
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
,
&
result
);
if
((
con_ind_sdb
.
service
==
FMB_SET_CONFIGURATION
)
&&
(
con_ind_sdb
.
primitive
==
CON
)
&&
(
con_ind_sdb
.
result
==
POS
))
{
if
((
con_ind_sdb
.
service
==
FMB_SET_CONFIGURATION
)
&&
(
con_ind_sdb
.
primitive
==
CON
)
&&
(
con_ind_sdb
.
result
==
POS
))
{
return
(
PB_TRUE
);
}
...
...
@@ -183,7 +184,7 @@ static short fmb_set_configuration(
/*----------------------------------------------------------------------------*\
Sends request to Profiboard for setting DP master parameters
\*----------------------------------------------------------------------------*/
static
short
dp_init_master
(
T_PROFI_DEVICE_HANDLE
*
hDevice
)
static
short
dp_init_master
()
{
T_PROFI_SERVICE_DESCR
sdb
;
T_DP_INIT_MASTER_REQ
data
;
...
...
@@ -203,19 +204,20 @@ static short dp_init_master(T_PROFI_DEVICE_HANDLE* hDevice)
data
.
master_default_address
=
0
;
data
.
master_class2
=
PB_FALSE
;
data
.
lowest_slave_address
=
2
;
data
.
slave_io_address_mode
=
DP_AAM_IO_BLOCKS
;
// only mode possible with Linux-driver DP_AAM_ARRAY;
data
.
slave_io_address_mode
=
DP_AAM_IO_BLOCKS
;
// only mode possible with Linux-driver DP_AAM_ARRAY;
data
.
clear_outputs
=
PB_TRUE
;
data
.
auto_remote_services
=
DP_AUTO_REMOTE_SERVICES
;
data
.
cyclic_data_transfer
=
PB_TRUE
;
profi_snd_req_res
(
hDevice
,
&
sdb
,
&
data
,
PB_FALSE
);
profi_snd_req_res
(
&
sdb
,
&
data
,
PB_FALSE
);
try_profi_rcv_con_ind
(
hDevice
,
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
,
&
result
);
try_profi_rcv_con_ind
(
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
,
&
result
);
if
((
con_ind_sdb
.
service
==
DP_INIT_MASTER
)
&&
(
con_ind_sdb
.
primitive
==
CON
)
&&
(
con_ind_sdb
.
result
==
POS
))
{
if
((
con_ind_sdb
.
service
==
DP_INIT_MASTER
)
&&
(
con_ind_sdb
.
primitive
==
CON
)
&&
(
con_ind_sdb
.
result
==
POS
))
{
return
(
PB_TRUE
);
}
...
...
@@ -225,11 +227,11 @@ static short dp_init_master(T_PROFI_DEVICE_HANDLE* hDevice)
/*----------------------------------------------------------------------------*\
Sends request to Profiboard for setting DP bus parameters
\*----------------------------------------------------------------------------*/
static
short
dp_download_bus
(
T_PROFI_DEVICE_HANDLE
*
hDevice
,
pwr_sClass_Pb_Profiboard
*
op
)
static
short
dp_download_bus
(
pwr_sClass_Pb_Profiboard
*
op
)
{
T_PROFI_SERVICE_DESCR
sdb
;
struct
{
struct
{
T_DP_DOWNLOAD_REQ
drp
;
T_DP_BUS_PARA_SET
dbp
;
}
data
;
...
...
@@ -255,7 +257,8 @@ static short dp_download_bus(
data
.
dbp
.
bus_para_len
=
swap16
(
66
);
data
.
dbp
.
fdl_add
=
0
;
switch
(
op
->
BaudRate
)
{
switch
(
op
->
BaudRate
)
{
case
500
:
data
.
dbp
.
baud_rate
=
DP_KBAUD_500
;
break
;
...
...
@@ -298,13 +301,14 @@ static short dp_download_bus(
for
(
i
=
0
;
i
<
32
;
i
++
)
data
.
dbp
.
master_class2_name
[
i
]
=
0
;
profi_snd_req_res
(
hDevice
,
&
sdb
,
&
data
,
PB_FALSE
);
profi_snd_req_res
(
&
sdb
,
&
data
,
PB_FALSE
);
try_profi_rcv_con_ind
(
hDevice
,
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
,
&
result
);
try_profi_rcv_con_ind
(
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
,
&
result
);
if
((
con_ind_sdb
.
service
==
DP_DOWNLOAD_LOC
)
&&
(
con_ind_sdb
.
primitive
==
CON
)
&&
(
con_ind_sdb
.
result
==
POS
))
{
if
((
con_ind_sdb
.
service
==
DP_DOWNLOAD_LOC
)
&&
(
con_ind_sdb
.
primitive
==
CON
)
&&
(
con_ind_sdb
.
result
==
POS
))
{
return
(
PB_TRUE
);
}
...
...
@@ -313,8 +317,7 @@ static short dp_download_bus(
/*********************** FMB_SET_BUSPARAMETER ******************************/
static
short
fmb_set_busparameter
(
T_PROFI_DEVICE_HANDLE
*
hDevice
,
pwr_sClass_Pb_Profiboard
*
op
)
static
short
fmb_set_busparameter
(
pwr_sClass_Pb_Profiboard
*
op
)
/* ------------------------------------------------------------------------ */
/* FUNCTIONAL_DESCRIPTION: */
/* */
...
...
@@ -337,7 +340,8 @@ static short fmb_set_busparameter(
bus_par_req
.
loc_segm
=
255
;
bus_par_req
.
medium_red
=
0
;
switch
(
op
->
BaudRate
)
{
switch
(
op
->
BaudRate
)
{
case
500
:
bus_par_req
.
baud_rate
=
DP_KBAUD_500
;
break
;
...
...
@@ -381,13 +385,14 @@ static short fmb_set_busparameter(
/* Send Request */
profi_snd_req_res
(
hDevice
,
&
sdb
,
&
bus_par_req
,
PB_FALSE
);
profi_snd_req_res
(
&
sdb
,
&
bus_par_req
,
PB_FALSE
);
try_profi_rcv_con_ind
(
hDevice
,
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
,
&
result
);
try_profi_rcv_con_ind
(
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
,
&
result
);
if
((
con_ind_sdb
.
service
==
FMB_SET_BUSPARAMETER
)
&&
(
con_ind_sdb
.
primitive
==
CON
)
&&
(
con_ind_sdb
.
result
==
POS
))
{
if
((
con_ind_sdb
.
service
==
FMB_SET_BUSPARAMETER
)
&&
(
con_ind_sdb
.
primitive
==
CON
)
&&
(
con_ind_sdb
.
result
==
POS
))
{
return
(
PB_TRUE
);
}
...
...
@@ -397,8 +402,7 @@ static short fmb_set_busparameter(
/*********************** DP_SET_BUSPARAMETER ******************************/
static
short
dp_set_busparameter
(
T_PROFI_DEVICE_HANDLE
*
hDevice
,
pwr_sClass_Pb_Profiboard
*
op
)
static
short
dp_set_busparameter
(
pwr_sClass_Pb_Profiboard
*
op
)
/* ------------------------------------------------------------------------ */
/* FUNCTIONAL_DESCRIPTION: */
/* */
...
...
@@ -432,15 +436,16 @@ static short dp_set_busparameter(
/* Send Request */
profi_snd_req_res
(
hDevice
,
&
sdb
,
&
bus_par_req
,
PB_FALSE
);
profi_snd_req_res
(
&
sdb
,
&
bus_par_req
,
PB_FALSE
);
con_ind_sdb
.
service
=
0
;
while
(
con_ind_sdb
.
service
!=
DP_SET_BUSPARAMETER
)
try_profi_rcv_con_ind
(
hDevice
,
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
,
&
result
);
try_profi_rcv_con_ind
(
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
,
&
result
);
if
((
con_ind_sdb
.
service
==
DP_SET_BUSPARAMETER
)
&&
(
con_ind_sdb
.
primitive
==
CON
)
&&
(
con_ind_sdb
.
result
==
POS
))
{
if
((
con_ind_sdb
.
service
==
DP_SET_BUSPARAMETER
)
&&
(
con_ind_sdb
.
primitive
==
CON
)
&&
(
con_ind_sdb
.
result
==
POS
))
{
return
(
PB_TRUE
);
}
...
...
@@ -448,8 +453,7 @@ static short dp_set_busparameter(
}
/* dp_set_busparameter */
static
short
fdlif_sap_activate_req
(
T_PROFI_DEVICE_HANDLE
*
hDevice
,
pwr_sClass_Pb_FDL_SAP
*
op
)
static
short
fdlif_sap_activate_req
(
pwr_sClass_Pb_FDL_SAP
*
op
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -498,24 +502,24 @@ possible return values:
/* Send Request */
profi_snd_req_res
(
hDevice
,
&
sdb
,
&
sap
,
PB_FALSE
);
profi_snd_req_res
(
&
sdb
,
&
sap
,
PB_FALSE
);
con_ind_sdb
.
service
=
0
;
while
(
con_ind_sdb
.
service
!=
FDLIF_SAP_ACTIVATE
)
try_profi_rcv_con_ind
(
hDevice
,
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
,
&
result
);
try_profi_rcv_con_ind
(
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
,
&
result
);
if
((
con_ind_sdb
.
service
==
FDLIF_SAP_ACTIVATE
)
&&
(
con_ind_sdb
.
primitive
==
CON
)
&&
(
con_ind_sdb
.
result
==
POS
))
{
if
((
con_ind_sdb
.
service
==
FDLIF_SAP_ACTIVATE
)
&&
(
con_ind_sdb
.
primitive
==
CON
)
&&
(
con_ind_sdb
.
result
==
POS
))
{
return
(
PB_TRUE
);
}
return
(
PB_FALSE
);
}
static
short
fdlif_rsap_activate_req
(
T_PROFI_DEVICE_HANDLE
*
hDevice
,
pwr_sClass_Pb_FDL_SAP
*
op
)
static
short
fdlif_rsap_activate_req
(
pwr_sClass_Pb_FDL_SAP
*
op
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -560,16 +564,17 @@ possible return values:
/* Send Request */
profi_snd_req_res
(
hDevice
,
&
sdb
,
&
rsap
,
PB_FALSE
);
profi_snd_req_res
(
&
sdb
,
&
rsap
,
PB_FALSE
);
con_ind_sdb
.
service
=
0
;
while
(
con_ind_sdb
.
service
!=
FDLIF_RSAP_ACTIVATE
)
try_profi_rcv_con_ind
(
hDevice
,
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
,
&
result
);
try_profi_rcv_con_ind
(
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
,
&
result
);
if
((
con_ind_sdb
.
service
==
FDLIF_RSAP_ACTIVATE
)
&&
(
con_ind_sdb
.
primitive
==
CON
)
&&
(
con_ind_sdb
.
result
==
POS
))
{
if
((
con_ind_sdb
.
service
==
FDLIF_RSAP_ACTIVATE
)
&&
(
con_ind_sdb
.
primitive
==
CON
)
&&
(
con_ind_sdb
.
result
==
POS
))
{
return
(
PB_TRUE
);
}
...
...
@@ -579,7 +584,7 @@ possible return values:
/*----------------------------------------------------------------------------*\
Sends request for selecting operation mode to the Profiboard
\*----------------------------------------------------------------------------*/
static
short
dp_act_param_loc
(
T_PROFI_DEVICE_HANDLE
*
hDevice
,
short
arg
)
static
short
dp_act_param_loc
(
short
arg
)
{
T_PROFI_SERVICE_DESCR
sdb
;
T_DP_ACT_PARAM_REQ
apr
;
...
...
@@ -598,7 +603,7 @@ static short dp_act_param_loc(T_PROFI_DEVICE_HANDLE* hDevice, short arg)
apr
.
activate
=
arg
;
apr
.
dummy
=
0
;
retval
=
profi_snd_req_res
(
hDevice
,
&
sdb
,
&
apr
,
PB_FALSE
);
retval
=
profi_snd_req_res
(
&
sdb
,
&
apr
,
PB_FALSE
);
return
retval
;
}
...
...
@@ -606,7 +611,7 @@ static short dp_act_param_loc(T_PROFI_DEVICE_HANDLE* hDevice, short arg)
/*----------------------------------------------------------------------------*\
Sends request for getting slave diagnostics
\*----------------------------------------------------------------------------*/
static
pwr_tBoolean
dp_get_slave_diag
(
T_PROFI_DEVICE_HANDLE
*
hDevice
)
static
pwr_tBoolean
dp_get_slave_diag
()
{
T_PROFI_SERVICE_DESCR
sdb
;
pwr_tUInt16
retval
;
...
...
@@ -619,7 +624,7 @@ static pwr_tBoolean dp_get_slave_diag(T_PROFI_DEVICE_HANDLE* hDevice)
sdb
.
invoke_id
=
0
;
sdb
.
result
=
0
;
retval
=
profi_snd_req_res
(
hDevice
,
&
sdb
,
&
sdb
,
PB_FALSE
);
retval
=
profi_snd_req_res
(
&
sdb
,
&
sdb
,
PB_FALSE
);
return
((
pwr_tBoolean
)(
retval
==
E_OK
));
}
...
...
@@ -627,50 +632,62 @@ static pwr_tBoolean dp_get_slave_diag(T_PROFI_DEVICE_HANDLE* hDevice)
/*----------------------------------------------------------------------------*\
Get slave diagnostics
\*----------------------------------------------------------------------------*/
static
void
dp_get_slave_diag_con
(
T_DP_GET_SLAVE_DIAG_CON
*
get_slave_diag_con_ptr
,
io_sRack
*
slave_list
,
char
log
)
static
void
dp_get_slave_diag_con
(
T_DP_GET_SLAVE_DIAG_CON
*
get_slave_diag_con_ptr
,
io_sRack
*
slave_list
,
char
log
)
{
T_DP_DIAG_DATA
FAR
*
diag_data_ptr
;
char
s
[
128
];
pwr_sClass_Pb_DP_Slave
*
sp
;
if
(
get_slave_diag_con_ptr
->
diag_data_len
>=
DP_MIN_SLAVE_DIAG_LEN
)
{
if
(
get_slave_diag_con_ptr
->
diag_data_len
>=
DP_MIN_SLAVE_DIAG_LEN
)
{
diag_data_ptr
=
(
T_DP_DIAG_DATA
FAR
*
)(
get_slave_diag_con_ptr
+
1
);
while
(
slave_list
!=
NULL
)
{
while
(
slave_list
!=
NULL
)
{
sp
=
(
pwr_sClass_Pb_DP_Slave
*
)
slave_list
->
op
;
if
(
sp
->
SlaveAddress
==
get_slave_diag_con_ptr
->
rem_add
)
{
if
(
sp
->
SlaveAddress
==
get_slave_diag_con_ptr
->
rem_add
)
{
sp
->
StationStatus1
=
diag_data_ptr
->
station_status_1
;
sp
->
StationStatus2
=
diag_data_ptr
->
station_status_2
;
sp
->
StationStatus3
=
diag_data_ptr
->
station_status_3
;
sp
->
BytesOfDiag
=
get_slave_diag_con_ptr
->
diag_data_len
-
DP_MIN_SLAVE_DIAG_LEN
;
sp
->
BytesOfDiag
=
get_slave_diag_con_ptr
->
diag_data_len
-
DP_MIN_SLAVE_DIAG_LEN
;
memcpy
(
sp
->
Diag
,
diag_data_ptr
+
1
,
memcpy
(
sp
->
Diag
,
diag_data_ptr
+
1
,
MIN
(
get_slave_diag_con_ptr
->
diag_data_len
-
DP_MIN_SLAVE_DIAG_LEN
,
DP_MAX_EXT_DIAG_DATA_LEN
));
/* Update slave status */
if
(
!
(
sp
->
StationStatus1
&
~
pwr_mPbStationStatus1Mask_ExternalDiag
)
&&
!
(
sp
->
StationStatus2
&
~
(
pwr_mPbStationStatus2Mask_Default
|
pwr_mPbStationStatus2Mask_ResponseMonitoringOn
)))
{
if
(
!
(
sp
->
StationStatus1
&
~
pwr_mPbStationStatus1Mask_ExternalDiag
)
&&
!
(
sp
->
StationStatus2
&
~
(
pwr_mPbStationStatus2Mask_Default
|
pwr_mPbStationStatus2Mask_ResponseMonitoringOn
)))
{
sp
->
Status
=
PB__NORMAL
;
}
else
if
(
sp
->
StationStatus1
&
pwr_mPbStationStatus1Mask_NonExistent
)
{
}
else
if
(
sp
->
StationStatus1
&
pwr_mPbStationStatus1Mask_NonExistent
)
{
sp
->
Status
=
PB__NOCONN
;
}
else
if
((
sp
->
StationStatus1
&
(
pwr_mPbStationStatus1Mask_ConfigFault
|
pwr_mPbStationStatus1Mask_ParamFault
))
||
(
sp
->
StationStatus2
&
pwr_mPbStationStatus2Mask_NewParamsRequested
))
{
}
else
if
((
sp
->
StationStatus1
&
(
pwr_mPbStationStatus1Mask_ConfigFault
|
pwr_mPbStationStatus1Mask_ParamFault
))
||
(
sp
->
StationStatus2
&
pwr_mPbStationStatus2Mask_NewParamsRequested
))
{
sp
->
Status
=
PB__CONFIGERR
;
}
else
if
(
sp
->
StationStatus1
&
pwr_mPbStationStatus1Mask_MasterLock
)
{
}
else
if
(
sp
->
StationStatus1
&
pwr_mPbStationStatus1Mask_MasterLock
)
{
sp
->
Status
=
PB__MASTERLOCK
;
}
else
// if (sp->StationStatus1 & pwr_mPbStationStatus1Mask_NotReady)
}
else
// if (sp->StationStatus1 & pwr_mPbStationStatus1Mask_NotReady)
{
sp
->
Status
=
PB__NOTREADY
;
}
...
...
@@ -681,10 +698,11 @@ static void dp_get_slave_diag_con(
slave_list
=
slave_list
->
next
;
}
if
(
log
)
{
sprintf
(
s
,
"Slave [%3hhu] [0x%04hX]: Status = 0x%02hhX 0x%02hhX 0x%02hhX, "
"Master = %3hhu, Ext = %u, Diags = %hu"
,
if
(
log
)
{
sprintf
(
s
,
"Slave [%3hhu] [0x%04hX]: Status = 0x%02hhX 0x%02hhX 0x%02hhX, "
"Master = %3hhu, Ext = %u, Diags = %hu"
,
get_slave_diag_con_ptr
->
rem_add
,
swap16
(
diag_data_ptr
->
ident_number
),
diag_data_ptr
->
station_status_1
,
diag_data_ptr
->
station_status_2
,
diag_data_ptr
->
station_status_3
,
diag_data_ptr
->
master_add
,
...
...
@@ -697,8 +715,9 @@ static void dp_get_slave_diag_con(
}
/* diag_data_len */
}
static
void
fdlif_sda_sdn_srd_ind
(
INT8
invoke_id
,
T_FDLIF_SDN_SDA_SRD_REQ
*
ind_ptr
,
io_sRack
*
slave_list
)
static
void
fdlif_sda_sdn_srd_ind
(
INT8
invoke_id
,
T_FDLIF_SDN_SDA_SRD_REQ
*
ind_ptr
,
io_sRack
*
slave_list
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -713,26 +732,31 @@ possible return values:
USIGN8
*
data_ptr
;
pwr_sClass_Pb_FDL_SAP
*
sp
;
if
(
ind_ptr
->
length
>
0
)
{
if
(
ind_ptr
->
length
>
0
)
{
data_ptr
=
(
USIGN8
*
)(
ind_ptr
+
1
);
// print_data (data_ptr, cnf_ptr->length);
while
(
slave_list
!=
NULL
)
{
if
(((
io_sRackLocal
*
)
slave_list
->
Local
)
->
fdl
)
{
while
(
slave_list
!=
NULL
)
{
if
(((
io_sRackLocal
*
)
slave_list
->
Local
)
->
fdl
)
{
sp
=
(
pwr_sClass_Pb_FDL_SAP
*
)
slave_list
->
op
;
if
(
sp
->
SAP_Nr
==
ind_ptr
->
ssap
)
{
if
(
sp
->
SAP_Nr
==
ind_ptr
->
ssap
)
{
io_sCard
*
card_list
=
slave_list
->
cardlist
;
pwr_sClass_Pb_FDL_DataTransfer
*
cp
;
io_sFDLCardLocal
*
local_card
;
if
(
card_list
!=
NULL
)
{
if
(
card_list
!=
NULL
)
{
cp
=
(
pwr_sClass_Pb_FDL_DataTransfer
*
)
card_list
->
op
;
local_card
=
(
io_sFDLCardLocal
*
)
card_list
->
Local
;
if
(
local_card
->
input_area_size
>
0
)
memcpy
(
local_card
->
input_area
,
data_ptr
,
MIN
(
local_card
->
input_area_size
,
ind_ptr
->
length
));
MIN
(
local_card
->
input_area_size
,
ind_ptr
->
length
));
}
break
;
...
...
@@ -746,7 +770,7 @@ possible return values:
}
static
void
fdlif_srd_con
(
INT16
result
,
INT8
invoke_id
,
T_FDLIF_SRD_CNF
*
cnf_ptr
,
io_sRack
*
slave_list
)
T_FDLIF_SRD_CNF
*
cnf_ptr
,
io_sRack
*
slave_list
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
...
...
@@ -764,33 +788,41 @@ possible return values:
pwr_sClass_Pb_FDL_SAP
*
sp
;
USIGN8
res
;
if
(
result
==
POS
)
{
if
(
result
==
POS
)
{
res
=
0
;
}
else
{
}
else
{
res
=
cnf_ptr
->
status
;
}
data_ptr
=
(
USIGN8
*
)(
cnf_ptr
+
1
);
while
(
slave_list
!=
NULL
)
{
if
(((
io_sRackLocal
*
)
slave_list
->
Local
)
->
fdl
)
{
while
(
slave_list
!=
NULL
)
{
if
(((
io_sRackLocal
*
)
slave_list
->
Local
)
->
fdl
)
{
sp
=
(
pwr_sClass_Pb_FDL_SAP
*
)
slave_list
->
op
;
if
(
!
sp
->
Responder
)
{
if
(
!
sp
->
Responder
)
{
io_sCard
*
card_list
=
slave_list
->
cardlist
;
pwr_sClass_Pb_FDL_DataTransfer
*
cp
;
io_sFDLCardLocal
*
local_card
;
while
(
card_list
!=
NULL
)
{
while
(
card_list
!=
NULL
)
{
cp
=
(
pwr_sClass_Pb_FDL_DataTransfer
*
)
card_list
->
op
;
local_card
=
(
io_sFDLCardLocal
*
)
card_list
->
Local
;
if
((
local_card
->
invoke_id
==
invoke_id
)
&&
(
cp
->
Type
==
pwr_ePbFDLDataTransferTypeEnum_FDLIF_SRD
))
{
if
((
local_card
->
invoke_id
==
invoke_id
)
&&
(
cp
->
Type
==
pwr_ePbFDLDataTransferTypeEnum_FDLIF_SRD
))
{
cp
->
Result
=
res
;
if
(
cnf_ptr
->
length
>
0
)
memcpy
(
local_card
->
input_area
,
data_ptr
,
MIN
(
local_card
->
input_area_size
,
cnf_ptr
->
length
));
MIN
(
local_card
->
input_area_size
,
cnf_ptr
->
length
));
break
;
}
card_list
=
card_list
->
next
;
...
...
@@ -806,33 +838,41 @@ possible return values:
return
;
}
static
void
fdlif_sda_sdn_con
(
INT8
invoke_id
,
INT16
result
,
T_FDLIF_ERROR
*
err_ptr
,
io_sRack
*
slave_list
)
static
void
fdlif_sda_sdn_con
(
INT8
invoke_id
,
INT16
result
,
T_FDLIF_ERROR
*
err_ptr
,
io_sRack
*
slave_list
)
{
pwr_sClass_Pb_FDL_SAP
*
sp
;
USIGN8
res
;
if
(
result
==
POS
)
{
if
(
result
==
POS
)
{
res
=
0
;
}
else
{
}
else
{
res
=
err_ptr
->
result
;
}
// print_data (data_ptr, cnf_ptr->length);
while
(
slave_list
!=
NULL
)
{
if
(((
io_sRackLocal
*
)
slave_list
->
Local
)
->
fdl
)
{
while
(
slave_list
!=
NULL
)
{
if
(((
io_sRackLocal
*
)
slave_list
->
Local
)
->
fdl
)
{
sp
=
(
pwr_sClass_Pb_FDL_SAP
*
)
slave_list
->
op
;
if
(
!
sp
->
Responder
)
{
if
(
!
sp
->
Responder
)
{
io_sCard
*
card_list
=
slave_list
->
cardlist
;
pwr_sClass_Pb_FDL_DataTransfer
*
cp
;
io_sFDLCardLocal
*
local_card
;
while
(
card_list
!=
NULL
)
{
while
(
card_list
!=
NULL
)
{
cp
=
(
pwr_sClass_Pb_FDL_DataTransfer
*
)
card_list
->
op
;
local_card
=
(
io_sFDLCardLocal
*
)
card_list
->
Local
;
if
(
local_card
->
invoke_id
==
invoke_id
)
{
if
(
local_card
->
invoke_id
==
invoke_id
)
{
cp
->
Result
=
res
;
break
;
}
...
...
@@ -852,8 +892,7 @@ static void fdlif_sda_sdn_con(
/*----------------------------------------------------------------------------*\
Starts download sequence of prm data to one slave
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
start_download_seq
(
T_PROFI_DEVICE_HANDLE
*
hDevice
,
pwr_sClass_Pb_DP_Slave
*
op
)
static
pwr_tStatus
start_download_seq
(
pwr_sClass_Pb_DP_Slave
*
op
)
{
T_PROFI_SERVICE_DESCR
sdb
;
T_DP_START_SEQ_REQ
ssrp
;
...
...
@@ -875,13 +914,14 @@ static pwr_tStatus start_download_seq(
ssrp
.
area_code
=
op
->
SlaveAddress
;
ssrp
.
timeout
=
timeout
;
profi_snd_req_res
(
hDevice
,
&
sdb
,
&
ssrp
,
PB_FALSE
);
profi_snd_req_res
(
&
sdb
,
&
ssrp
,
PB_FALSE
);
try_profi_rcv_con_ind
(
hDevice
,
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
,
&
result
);
try_profi_rcv_con_ind
(
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
,
&
result
);
if
((
con_ind_sdb
.
service
==
DP_START_SEQ_LOC
)
&&
(
con_ind_sdb
.
primitive
==
CON
)
&&
(
con_ind_sdb
.
result
==
POS
))
{
if
((
con_ind_sdb
.
service
==
DP_START_SEQ_LOC
)
&&
(
con_ind_sdb
.
primitive
==
CON
)
&&
(
con_ind_sdb
.
result
==
POS
))
{
op
->
Status
=
PB__NOCONN
;
return
(
PB_TRUE
);
}
...
...
@@ -894,8 +934,7 @@ static pwr_tStatus start_download_seq(
/*----------------------------------------------------------------------------*\
Starts download sequence of prm data to one slave
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
end_download_seq
(
T_PROFI_DEVICE_HANDLE
*
hDevice
,
pwr_sClass_Pb_DP_Slave
*
op
)
static
pwr_tStatus
end_download_seq
(
pwr_sClass_Pb_DP_Slave
*
op
)
{
T_PROFI_SERVICE_DESCR
sdb
;
T_DP_END_SEQ_REQ
esrp
;
...
...
@@ -915,13 +954,14 @@ static pwr_tStatus end_download_seq(
esrp
.
rem_add
=
0
;
esrp
.
dummy
=
0
;
profi_snd_req_res
(
hDevice
,
&
sdb
,
&
esrp
,
PB_FALSE
);
profi_snd_req_res
(
&
sdb
,
&
esrp
,
PB_FALSE
);
try_profi_rcv_con_ind
(
hDevice
,
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
,
&
result
);
try_profi_rcv_con_ind
(
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
,
&
result
);
if
((
con_ind_sdb
.
service
==
DP_END_SEQ_LOC
)
&&
(
con_ind_sdb
.
primitive
==
CON
)
&&
(
con_ind_sdb
.
result
==
POS
))
{
if
((
con_ind_sdb
.
service
==
DP_END_SEQ_LOC
)
&&
(
con_ind_sdb
.
primitive
==
CON
)
&&
(
con_ind_sdb
.
result
==
POS
))
{
op
->
Status
=
PB__NOCONN
;
return
(
PB_TRUE
);
}
...
...
@@ -934,12 +974,12 @@ static pwr_tStatus end_download_seq(
/*----------------------------------------------------------------------------*\
Initializes one DP slave in the master card
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
dp_download_slave
(
T_PROFI_DEVICE_HANDLE
*
hDevice
,
pwr_sClass_Pb_DP_Slave
*
op
)
static
pwr_tStatus
dp_download_slave
(
pwr_sClass_Pb_DP_Slave
*
op
)
{
int
i
;
T_PROFI_SERVICE_DESCR
sdb
;
struct
{
struct
{
T_DP_DOWNLOAD_REQ
drp
;
unsigned
char
param
[
512
];
}
slave_data
;
...
...
@@ -961,8 +1001,9 @@ static pwr_tStatus dp_download_slave(
op
->
Status
=
PB__NOTINIT
;
download_data_size
=
sizeof
(
prm_head
)
+
sizeof
(
prm_data
)
+
op
->
PrmUserDataLen
+
op
->
ConfigDataLen
+
sizeof
(
aat_data
)
+
sizeof
(
user_data
);
download_data_size
=
sizeof
(
prm_head
)
+
sizeof
(
prm_data
)
+
op
->
PrmUserDataLen
+
op
->
ConfigDataLen
+
sizeof
(
aat_data
)
+
sizeof
(
user_data
);
data_len
=
download_data_size
;
...
...
@@ -1020,42 +1061,53 @@ static pwr_tStatus dp_download_slave(
send_buf
=
(
char
*
)
slave_data
.
param
;
if
(
data_len
>
DP_MAX_DOWNLOAD_DATA_LEN
)
{
if
(
!
start_download_seq
(
hDevice
,
op
))
{
if
(
data_len
>
DP_MAX_DOWNLOAD_DATA_LEN
)
{
if
(
!
start_download_seq
(
op
))
{
op
->
Status
=
PB__INITFAIL
;
return
(
PB_FALSE
);
}
}
while
(
download_data_size
>
0
)
{
while
(
download_data_size
>
0
)
{
slave_data
.
drp
.
data_len
=
MIN
(
download_data_size
,
DP_MAX_DOWNLOAD_DATA_LEN
);
profi_snd_req_res
(
hDevice
,
&
sdb
,
&
slave_data
,
PB_FALSE
);
profi_snd_req_res
(
&
sdb
,
&
slave_data
,
PB_FALSE
);
try_profi_rcv_con_ind
(
hDevice
,
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
,
&
result
);
try_profi_rcv_con_ind
(
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
,
&
result
);
if
(
con_ind_sdb
.
service
==
DP_DOWNLOAD_LOC
)
{
if
((
con_ind_sdb
.
primitive
==
CON
)
&&
(
con_ind_sdb
.
result
==
POS
))
{
if
(
con_ind_sdb
.
service
==
DP_DOWNLOAD_LOC
)
{
if
((
con_ind_sdb
.
primitive
==
CON
)
&&
(
con_ind_sdb
.
result
==
POS
))
{
op
->
Status
=
PB__NOCONN
;
}
else
{
}
else
{
op
->
Status
=
PB__INITFAIL
;
failure
=
TRUE
;
break
;
}
}
if
(
download_data_size
>
DP_MAX_DOWNLOAD_DATA_LEN
)
{
if
(
download_data_size
>
DP_MAX_DOWNLOAD_DATA_LEN
)
{
download_data_size
-=
DP_MAX_DOWNLOAD_DATA_LEN
;
slave_data
.
drp
.
add_offset
+=
DP_MAX_DOWNLOAD_DATA_LEN
;
send_buf
+=
DP_MAX_DOWNLOAD_DATA_LEN
;
memcpy
(
slave_data
.
param
,
send_buf
,
MIN
(
download_data_size
,
DP_MAX_DOWNLOAD_DATA_LEN
));
}
else
MIN
(
download_data_size
,
DP_MAX_DOWNLOAD_DATA_LEN
));
}
else
download_data_size
=
0
;
}
if
(
data_len
>
DP_MAX_DOWNLOAD_DATA_LEN
)
{
if
(
!
end_download_seq
(
hDevice
,
op
))
{
if
(
data_len
>
DP_MAX_DOWNLOAD_DATA_LEN
)
{
if
(
!
end_download_seq
(
op
))
{
op
->
Status
=
PB__INITFAIL
;
return
(
PB_FALSE
);
}
...
...
@@ -1070,8 +1122,7 @@ static pwr_tStatus dp_download_slave(
/*----------------------------------------------------------------------------*\
Calculate offsets of inputs and outputs for a slave
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
dp_io_offsets
(
T_PROFI_DEVICE_HANDLE
*
hDevice
,
pwr_sClass_Pb_DP_Slave
*
op
)
static
pwr_tStatus
dp_io_offsets
(
pwr_sClass_Pb_DP_Slave
*
op
)
{
T_PROFI_SERVICE_DESCR
sdb
;
T_DP_GET_SLAVE_PARAM_REQ
get_slave_param_req
;
...
...
@@ -1093,20 +1144,21 @@ static pwr_tStatus dp_io_offsets(
get_slave_param_req
.
identifier
=
DP_SLAVE_PARAM_SLAVE_INFO
;
get_slave_param_req
.
rem_add
=
op
->
SlaveAddress
;
result
=
profi_snd_req_res
(
hDevice
,
&
sdb
,
&
get_slave_param_req
,
PB_FALSE
);
result
=
profi_snd_req_res
(
&
sdb
,
&
get_slave_param_req
,
PB_FALSE
);
if
(
result
!=
E_OK
)
return
(
result
);
try_profi_rcv_con_ind
(
hDevice
,
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
,
&
result
);
try_profi_rcv_con_ind
(
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
,
&
result
);
get_slave_param_con_ptr
=
(
T_DP_GET_SLAVE_PARAM_CON
FAR
*
)
con_ind_buffer
;
if
((
con_ind_sdb
.
service
==
DP_GET_SLAVE_PARAM
)
&&
(
con_ind_sdb
.
primitive
==
CON
)
&&
(
con_ind_sdb
.
result
==
POS
))
{
slave_info_ptr
=
(
T_DP_SLAVE_PARAM_SLAVE_INFO
FAR
*
)(
get_slave_param_con_ptr
+
1
);
if
((
con_ind_sdb
.
service
==
DP_GET_SLAVE_PARAM
)
&&
(
con_ind_sdb
.
primitive
==
CON
)
&&
(
con_ind_sdb
.
result
==
POS
))
{
slave_info_ptr
=
(
T_DP_SLAVE_PARAM_SLAVE_INFO
FAR
*
)(
get_slave_param_con_ptr
+
1
);
op
->
BytesOfInput
=
slave_info_ptr
->
number_inputs
;
op
->
BytesOfOutput
=
slave_info_ptr
->
number_outputs
;
...
...
@@ -1127,7 +1179,6 @@ void* handle_events(void* ptr)
io_sAgentLocal
*
local
;
io_sAgent
*
ap
;
short
sts
;
T_PROFI_DEVICE_HANDLE
*
hDevice
;
pwr_sClass_Pb_Profiboard
*
op
;
char
s
[
128
];
...
...
@@ -1135,13 +1186,12 @@ void* handle_events(void* ptr)
USIGN16
con_ind_buffer_len
=
256
;
T_PROFI_SERVICE_DESCR
con_ind_sdb
;
T_DP_GET_SLAVE_DIAG_CON
*
get_slave_diag_con_ptr
;
struct
timespec
rqtp
=
{
0
,
10000000
};
// 10 ms
struct
timespec
rqtp
=
{
0
,
10000000
};
// 10 ms
args
=
(
agent_args
*
)
ptr
;
local
=
(
io_sAgentLocal
*
)
args
->
local
;
ap
=
args
->
ap
;
hDevice
=
(
T_PROFI_DEVICE_HANDLE
*
)
ap
->
Local
;
op
=
(
pwr_sClass_Pb_Profiboard
*
)
ap
->
op
;
/* If everything is fine we should be in state OPERATE
...
...
@@ -1149,39 +1199,53 @@ void* handle_events(void* ptr)
if there are any hardware faults. In that case, make a reset and a new
init. */
while
(
1
)
{
while
(
1
)
{
if
(
op
->
DisableBus
)
exit
(
0
);
pthread_mutex_lock
(
&
local
->
mutex
);
con_ind_buffer_len
=
256
;
sts
=
profi_rcv_con_ind
(
hDevice
,
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
);
if
(
sts
==
CON_IND_RECEIVED
)
{
switch
(
con_ind_sdb
.
layer
)
{
case
DP_USR
:
{
if
(
con_ind_sdb
.
primitive
==
CON
)
{
if
(
con_ind_sdb
.
result
==
POS
)
{
switch
(
con_ind_sdb
.
service
)
{
/*--------------------------------------------------------------*/
case
DP_ACT_PARAM_LOC
:
{
if
(
op
->
Status
==
PB__NOTINIT
)
{
sts
=
profi_rcv_con_ind
(
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
);
if
(
sts
==
CON_IND_RECEIVED
)
{
switch
(
con_ind_sdb
.
layer
)
{
case
DP_USR
:
{
if
(
con_ind_sdb
.
primitive
==
CON
)
{
if
(
con_ind_sdb
.
result
==
POS
)
{
switch
(
con_ind_sdb
.
service
)
{
/*--------------------------------------------------------------*/
case
DP_ACT_PARAM_LOC
:
{
if
(
op
->
Status
==
PB__NOTINIT
)
{
op
->
Status
=
PB__STOPPED
;
errh_Info
(
"Profibus DP Master %s to state STOPPED"
,
ap
->
Name
);
dp_act_param_loc
(
hDevice
,
DP_OP_MODE_CLEAR
);
}
else
if
(
op
->
Status
==
PB__STOPPED
)
{
dp_act_param_loc
(
DP_OP_MODE_CLEAR
);
}
else
if
(
op
->
Status
==
PB__STOPPED
)
{
op
->
Status
=
PB__CLEARED
;
errh_Info
(
"Profibus DP Master %s to state CLEARED"
,
ap
->
Name
);
dp_act_param_loc
(
hDevice
,
DP_OP_MODE_OPERATE
);
}
else
if
(
op
->
Status
==
PB__CLEARED
)
{
dp_act_param_loc
(
DP_OP_MODE_OPERATE
);
}
else
if
(
op
->
Status
==
PB__CLEARED
)
{
errh_Info
(
"Profibus DP Master %s to state OPERATE"
,
ap
->
Name
);
op
->
Status
=
PB__NORMAL
;
if
(
!
local
->
slave_diag_requested
&&
local
->
parallel_service
)
{
if
(
dp_get_slave_diag
(
hDevice
))
{
if
(
!
local
->
slave_diag_requested
&&
local
->
parallel_service
)
{
if
(
dp_get_slave_diag
())
{
local
->
slave_diag_requested
=
op
->
Diag
[
3
]
=
PB_TRUE
;
local
->
parallel_service
=
PB_FALSE
;
}
...
...
@@ -1191,63 +1255,76 @@ void* handle_events(void* ptr)
break
;
}
/* case DP_ACT_PARAM_LOC */
/*--------------------------------------------------------------*/
/*--------------------------------------------------------------*/
case
DP_GET_SLAVE_DIAG
:
{
get_slave_diag_con_ptr
=
(
T_DP_GET_SLAVE_DIAG_CON
FAR
*
)
con_ind_buffer
;
case
DP_GET_SLAVE_DIAG
:
{
get_slave_diag_con_ptr
=
(
T_DP_GET_SLAVE_DIAG_CON
FAR
*
)
con_ind_buffer
;
dp_get_slave_diag_con
(
get_slave_diag_con_ptr
,
ap
->
racklist
,
op
->
Diag
[
1
]);
dp_get_slave_diag_con
(
get_slave_diag_con_ptr
,
ap
->
racklist
,
op
->
Diag
[
1
]);
op
->
Diag
[
2
]
++
;
local
->
slave_diag_requested
=
op
->
Diag
[
3
]
=
PB_FALSE
;
if
(
get_slave_diag_con_ptr
->
diag_entries
<
0
)
{
if
(
get_slave_diag_con_ptr
->
diag_entries
<
0
)
{
errh_Warning
(
"Profibus - diagnostic circular buffer owerflow."
);
}
if
(
get_slave_diag_con_ptr
->
diag_entries
)
{
if
(
get_slave_diag_con_ptr
->
diag_entries
)
{
local
->
slave_diag_requested
=
op
->
Diag
[
3
]
=
PB_TRUE
;
dp_get_slave_diag
(
hDevice
);
dp_get_slave_diag
();
}
break
;
}
/* case DP_GET_SLAVE_DIAG */
/*--------------------------------------------------------------*/
/*--------------------------------------------------------------*/
default:
{
default:
{
break
;
}
/* deafult service */
}
/* switch */
}
/* if POS */
else
{
}
/* if POS */
else
{
op
->
Status
=
PB__NOTINIT
;
errh_Error
(
"Profibus DP Master %s - %x neg con rec"
,
ap
->
Name
,
*
((
unsigned
short
*
)
con_ind_buffer
));
*
((
unsigned
short
*
)
con_ind_buffer
));
}
/* else POS */
}
/* if CON */
else
if
(
con_ind_sdb
.
primitive
==
IND
)
{
if
(
con_ind_sdb
.
result
==
POS
)
{
switch
(
con_ind_sdb
.
service
)
{
/*--------------------------------------------------------------*/
case
DP_ACT_PARAM_LOC
:
{
}
/* if CON */
else
if
(
con_ind_sdb
.
primitive
==
IND
)
{
if
(
con_ind_sdb
.
result
==
POS
)
{
switch
(
con_ind_sdb
.
service
)
{
/*--------------------------------------------------------------*/
case
DP_ACT_PARAM_LOC
:
{
USIGN8
usif_state
;
usif_state
=
((
T_DP_ACT_PARAM_IND
FAR
*
)
con_ind_buffer
)
->
activate
;
switch
(
usif_state
)
{
case
DP_OP_MODE_STOP
:
{
switch
(
usif_state
)
{
case
DP_OP_MODE_STOP
:
{
op
->
Status
=
PB__STOPPED
;
sprintf
(
s
,
"Mode changed to STOP"
);
break
;
}
case
DP_OP_MODE_CLEAR
:
{
case
DP_OP_MODE_CLEAR
:
{
op
->
Status
=
PB__CLEARED
;
sprintf
(
s
,
"Mode changed to CLEAR"
);
break
;
}
case
DP_OP_MODE_OPERATE
:
{
case
DP_OP_MODE_OPERATE
:
{
op
->
Status
=
PB__NORMAL
;
sprintf
(
s
,
"Mode changed to OPERATE"
);
break
;
...
...
@@ -1256,43 +1333,55 @@ void* handle_events(void* ptr)
errh_Info
(
"Profibus DP Master %s - %s"
,
ap
->
Name
,
s
);
if
(
usif_state
==
DP_OP_MODE_STOP
)
{
if
(
usif_state
==
DP_OP_MODE_STOP
)
{
usif_state
=
DP_OP_MODE_CLEAR
;
dp_act_param_loc
(
hDevice
,
DP_OP_MODE_CLEAR
);
}
else
if
(
usif_state
==
DP_OP_MODE_CLEAR
)
{
dp_act_param_loc
(
DP_OP_MODE_CLEAR
);
}
else
if
(
usif_state
==
DP_OP_MODE_CLEAR
)
{
usif_state
=
DP_OP_MODE_OPERATE
;
dp_act_param_loc
(
hDevice
,
DP_OP_MODE_OPERATE
);
dp_act_param_loc
(
DP_OP_MODE_OPERATE
);
}
break
;
}
/* case DP_ACT_PARAM_LOC */
/*--------------------------------------------------------------*/
/*--------------------------------------------------------------*/
case
DP_GET_SLAVE_DIAG
:
{
get_slave_diag_con_ptr
=
(
T_DP_GET_SLAVE_DIAG_CON
FAR
*
)
con_ind_buffer
;
case
DP_GET_SLAVE_DIAG
:
{
get_slave_diag_con_ptr
=
(
T_DP_GET_SLAVE_DIAG_CON
FAR
*
)
con_ind_buffer
;
dp_get_slave_diag_con
(
get_slave_diag_con_ptr
,
ap
->
racklist
,
op
->
Diag
[
1
]);
dp_get_slave_diag_con
(
get_slave_diag_con_ptr
,
ap
->
racklist
,
op
->
Diag
[
1
]);
op
->
Diag
[
0
]
++
;
if
(
get_slave_diag_con_ptr
->
diag_entries
<
0
)
{
if
(
get_slave_diag_con_ptr
->
diag_entries
<
0
)
{
errh_Warning
(
"Profibus - diagnostic circular buffer owerflow."
);
}
if
((
get_slave_diag_con_ptr
->
diag_entries
)
&&
(
!
local
->
slave_diag_requested
))
{
if
(
op
->
Status
==
PB__NORMAL
)
{
if
(
dp_get_slave_diag
(
hDevice
))
{
if
((
get_slave_diag_con_ptr
->
diag_entries
)
&&
(
!
local
->
slave_diag_requested
))
{
if
(
op
->
Status
==
PB__NORMAL
)
{
if
(
dp_get_slave_diag
())
{
local
->
slave_diag_requested
=
op
->
Diag
[
3
]
=
PB_TRUE
;
}
else
{
}
else
{
errh_Warning
(
"Profibus - Request for diag failed."
);
}
}
else
{
}
else
{
local
->
parallel_service
=
PB_TRUE
;
}
}
...
...
@@ -1300,33 +1389,40 @@ void* handle_events(void* ptr)
break
;
}
/* case DP_GET_SLAVE_DIAG */
/*--------------------------------------------------------------*/
/*--------------------------------------------------------------*/
default:
{
default:
{
break
;
}
/* deafult service */
}
/* switch */
}
/* if POS */
else
{
}
/* if POS */
else
{
op
->
Status
=
PB__NOTINIT
;
errh_Error
(
"Profibus DP Master %s - %x neg ind rec"
,
ap
->
Name
,
*
((
unsigned
short
*
)
con_ind_buffer
));
*
((
unsigned
short
*
)
con_ind_buffer
));
}
/* else POS */
}
/* if IND */
}
/* if IND */
break
;
}
case
FMB_USR
:
{
switch
(
con_ind_sdb
.
service
)
{
case
FMB_USR
:
{
switch
(
con_ind_sdb
.
service
)
{
/*--------------------------------------------------------------*/
/*--------------------------------------------------------------*/
case
FMB_SET_CONFIGURATION
:
case
FMB_EXIT
:
case
FMB_RESET
:
{
case
FMB_RESET
:
{
break
;
}
case
FMB_FM2_EVENT
:
{
switch
(((
T_FMB_FM2_EVENT_IND
FAR
*
)
con_ind_buffer
)
->
reason
)
{
case
FMB_FM2_EVENT
:
{
switch
(((
T_FMB_FM2_EVENT_IND
FAR
*
)
con_ind_buffer
)
->
reason
)
{
case
FM2_FAULT_ADDRESS
:
sprintf
(
s
,
"Duplicate address recognized"
);
break
;
...
...
@@ -1356,17 +1452,20 @@ void* handle_events(void* ptr)
break
;
}
/* case FMB_FM2_EVENT */
default:
{
default:
{
printf
(
"
\n
not supported FMB service received
\n
"
);
printf
(
"service: %d primitive: %d
\n
"
,
con_ind_sdb
.
service
,
con_ind_sdb
.
primitive
);
con_ind_sdb
.
primitive
);
break
;
}
/* deafult service */
}
/* switch */
break
;
}
case
FDLIF_USR
:
{
switch
(
con_ind_sdb
.
service
)
{
case
FDLIF_USR
:
{
switch
(
con_ind_sdb
.
service
)
{
case
FDLIF_EVENT
:
case
FDLIF_SET_BUSPARAMETER
:
case
FDLIF_READ_BUSPARAMETER
:
...
...
@@ -1380,39 +1479,51 @@ void* handle_events(void* ptr)
break
;
case
FDLIF_SDN
:
if
(
con_ind_sdb
.
primitive
==
IND
)
{
if
(
con_ind_sdb
.
primitive
==
IND
)
{
fdlif_sda_sdn_srd_ind
(
con_ind_sdb
.
invoke_id
,
(
T_FDLIF_SDN_SDA_SRD_REQ
FAR
*
)
con_ind_buffer
,
ap
->
racklist
);
}
else
{
(
T_FDLIF_SDN_SDA_SRD_REQ
FAR
*
)
con_ind_buffer
,
ap
->
racklist
);
}
else
{
fdlif_sda_sdn_con
(
con_ind_sdb
.
invoke_id
,
con_ind_sdb
.
result
,
(
T_FDLIF_ERROR
*
)
con_ind_buffer
,
ap
->
racklist
);
(
T_FDLIF_ERROR
*
)
con_ind_buffer
,
ap
->
racklist
);
}
break
;
case
FDLIF_SDA
:
if
(
con_ind_sdb
.
primitive
==
IND
)
{
if
(
con_ind_sdb
.
primitive
==
IND
)
{
fdlif_sda_sdn_srd_ind
(
con_ind_sdb
.
invoke_id
,
(
T_FDLIF_SDN_SDA_SRD_REQ
FAR
*
)
con_ind_buffer
,
ap
->
racklist
);
}
else
{
(
T_FDLIF_SDN_SDA_SRD_REQ
FAR
*
)
con_ind_buffer
,
ap
->
racklist
);
}
else
{
fdlif_sda_sdn_con
(
con_ind_sdb
.
invoke_id
,
con_ind_sdb
.
result
,
(
T_FDLIF_ERROR
*
)
con_ind_buffer
,
ap
->
racklist
);
(
T_FDLIF_ERROR
*
)
con_ind_buffer
,
ap
->
racklist
);
}
break
;
case
FDLIF_SRD
:
if
(
con_ind_sdb
.
primitive
==
IND
)
{
if
(
con_ind_sdb
.
primitive
==
IND
)
{
fdlif_sda_sdn_srd_ind
(
con_ind_sdb
.
invoke_id
,
(
T_FDLIF_SDN_SDA_SRD_REQ
FAR
*
)
con_ind_buffer
,
ap
->
racklist
);
}
else
{
(
T_FDLIF_SDN_SDA_SRD_REQ
FAR
*
)
con_ind_buffer
,
ap
->
racklist
);
}
else
{
fdlif_srd_con
(
con_ind_sdb
.
result
,
con_ind_sdb
.
invoke_id
,
(
T_FDLIF_SRD_CNF
*
)
con_ind_buffer
,
ap
->
racklist
);
(
T_FDLIF_SRD_CNF
*
)
con_ind_buffer
,
ap
->
racklist
);
}
break
;
default:
printf
(
"
\n
not supported FDLIF service received
\n
"
);
printf
(
"service: %d primitive: %d
\n
"
,
con_ind_sdb
.
service
,
con_ind_sdb
.
primitive
);
con_ind_sdb
.
primitive
);
}
break
;
}
...
...
@@ -1420,14 +1531,18 @@ void* handle_events(void* ptr)
default:
printf
(
"
\n
not supported layer service received
\n
"
);
printf
(
"layer: %d service: %d primitive: %d
\n
"
,
con_ind_sdb
.
layer
,
con_ind_sdb
.
service
,
con_ind_sdb
.
primitive
);
con_ind_sdb
.
service
,
con_ind_sdb
.
primitive
);
break
;
}
}
else
if
(
sts
!=
NO_CON_IND_RECEIVED
)
{
}
else
if
(
sts
!=
NO_CON_IND_RECEIVED
)
{
op
->
Status
=
PB__NOTINIT
;
}
else
{
if
(
local
->
slave_diag_requested
)
{
}
else
{
if
(
local
->
slave_diag_requested
)
{
// errh_Info( "Profibus - Diag re-request");
// dp_get_slave_diag(hDevice);
}
...
...
@@ -1445,7 +1560,6 @@ static pwr_tStatus IoAgentInit(io_tCtx ctx, io_sAgent* ap)
pwr_sClass_Pb_Profiboard
*
op
;
pwr_tUInt16
sts
;
pwr_tStatus
status
;
T_PROFI_DEVICE_HANDLE
*
hDevice
;
io_sAgentLocal
*
local
;
pwr_tCid
cid
;
...
...
@@ -1459,7 +1573,7 @@ static pwr_tStatus IoAgentInit(io_tCtx ctx, io_sAgent* ap)
char
name
[
196
];
struct
timespec
rqtp
=
{
0
,
20000000
};
// 20 ms
struct
timespec
rqtp
=
{
0
,
20000000
};
// 20 ms
int
retry
;
...
...
@@ -1467,13 +1581,12 @@ static pwr_tStatus IoAgentInit(io_tCtx ctx, io_sAgent* ap)
/* Allocate area for local data structure */
ap
->
Local
=
calloc
(
1
,
sizeof
(
io_sAgentLocal
));
if
(
!
ap
->
Local
)
{
if
(
!
ap
->
Local
)
{
errh_Error
(
"ERROR config Profibus DP Master %s - %s"
,
ap
->
Name
,
"calloc"
);
return
IO__ERRINIDEVICE
;
}
hDevice
=
(
T_PROFI_DEVICE_HANDLE
*
)
ap
->
Local
;
local
=
(
io_sAgentLocal
*
)
ap
->
Local
;
op
=
(
pwr_sClass_Pb_Profiboard
*
)
ap
->
op
;
...
...
@@ -1482,58 +1595,67 @@ static pwr_tStatus IoAgentInit(io_tCtx ctx, io_sAgent* ap)
/* Initialize interface */
if
(
ctx
->
Node
->
Restarts
>
0
)
{
if
(
ctx
->
Node
->
Restarts
>
0
)
{
nanosleep
(
&
rqtp
,
NULL
);
}
errh_Info
(
"Initializing interface for Profibus DP Master %s"
,
ap
->
Name
);
sts
=
profi_init
(
hDevice
,
(
unsigned
char
)
op
->
BusNumber
-
1
,
0
,
0
);
sts
=
profi_init
((
unsigned
char
)
op
->
BusNumber
-
1
,
0
,
0
);
if
(
sts
!=
E_OK
)
{
if
(
sts
!=
E_OK
)
{
/* Can't open driver */
op
->
Status
=
PB__INITFAIL
;
errh_Error
(
"ERROR config Profibus DP Master %s - %s"
,
ap
->
Name
,
"open device"
);
errh_Error
(
"ERROR config Profibus DP Master %s - %s"
,
ap
->
Name
,
"open device"
);
ctx
->
Node
->
EmergBreakTrue
=
1
;
return
IO__ERRDEVICE
;
}
/* If this is not the Profibus I/O process, return */
if
((
op
->
Process
&
io_mProcess_Profibus
)
&&
(
ctx
->
Process
!=
io_mProcess_Profibus
))
{
if
((
op
->
Process
&
io_mProcess_Profibus
)
&&
(
ctx
->
Process
!=
io_mProcess_Profibus
))
{
op
->
Status
=
PB__NOTINIT
;
errh_Info
(
"Init template I/O agent for Profibus DP Master %s, %d"
,
ap
->
Name
,
ctx
->
Process
);
ctx
->
Process
);
return
IO__SUCCESS
;
}
if
(
ctx
->
Node
->
Restarts
>
0
)
{
errh_Info
(
"Warm restart - Skipping config of Profibus DP Master %s"
,
ap
->
Name
);
if
(
ctx
->
Node
->
Restarts
>
0
)
{
errh_Info
(
"Warm restart - Skipping config of Profibus DP Master %s"
,
ap
->
Name
);
op
->
Status
=
PB__NORMAL
;
// return IO__SUCCESS;
}
errh_Info
(
"Config of Profibus DP Master %s"
,
ap
->
Name
);
if
(
op
->
DisableBus
!=
1
)
{
if
(
op
->
DisableBus
!=
1
)
{
ok
=
FALSE
;
if
(
ctx
->
Node
->
Restarts
==
0
)
{
if
(
ctx
->
Node
->
Restarts
==
0
)
{
retry
=
0
;
while
(
!
ok
)
{
while
(
!
ok
)
{
op
->
Status
=
PB__NOTINIT
;
/* Set FMB configuration */
sts
=
fmb_set_configuration
(
hDevice
,
ap
);
if
(
!
sts
)
{
sts
=
fmb_set_configuration
(
ap
);
if
(
!
sts
)
{
op
->
Status
=
PB__INITFAIL
;
errh_Error
(
"ERROR config Profibus DP Master %s - %s"
,
ap
->
Name
,
"fmb set configuration"
);
"fmb set configuration"
);
retry
++
;
if
(
retry
<
2
)
{
if
(
retry
<
2
)
{
nanosleep
(
&
rqtp
,
NULL
);
continue
;
}
...
...
@@ -1542,48 +1664,60 @@ static pwr_tStatus IoAgentInit(io_tCtx ctx, io_sAgent* ap)
/* Set DP master parameters */
if
(
local
->
dp
)
{
sts
=
dp_init_master
(
hDevice
);
if
(
!
sts
)
{
if
(
local
->
dp
)
{
sts
=
dp_init_master
();
if
(
!
sts
)
{
op
->
Status
=
PB__INITFAIL
;
errh_Error
(
"ERROR config Profibus DP Master %s - %s"
,
ap
->
Name
,
"dp init master"
);
"dp init master"
);
return
IO__ERRINIDEVICE
;
}
}
/* Download DP bus parameters */
if
(
local
->
dp
&&
!
local
->
fdl
)
{
sts
=
dp_download_bus
(
hDevice
,
op
);
if
(
!
sts
)
{
if
(
local
->
dp
&&
!
local
->
fdl
)
{
sts
=
dp_download_bus
(
op
);
if
(
!
sts
)
{
op
->
Status
=
PB__INITFAIL
;
errh_Error
(
"ERROR config Profibus DP Master %s - %s"
,
ap
->
Name
,
"dp download bus"
);
"dp download bus"
);
return
IO__ERRINIDEVICE
;
}
}
else
if
(
!
local
->
dp
&&
local
->
fdl
)
{
sts
=
fmb_set_busparameter
(
hDevice
,
op
);
if
(
!
sts
)
{
}
else
if
(
!
local
->
dp
&&
local
->
fdl
)
{
sts
=
fmb_set_busparameter
(
op
);
if
(
!
sts
)
{
op
->
Status
=
PB__INITFAIL
;
errh_Error
(
"ERROR config Profibus FDL Master %s - %s"
,
ap
->
Name
,
"fmb set busparam"
);
"fmb set busparam"
);
return
IO__ERRINIDEVICE
;
}
else
}
else
op
->
Status
=
PB__NORMAL
;
}
else
{
sts
=
fmb_set_busparameter
(
hDevice
,
op
);
if
(
!
sts
)
{
}
else
{
sts
=
fmb_set_busparameter
(
op
);
if
(
!
sts
)
{
op
->
Status
=
PB__INITFAIL
;
errh_Error
(
"ERROR config Profibus Master %s - %s"
,
ap
->
Name
,
"fmb set busparam"
);
"fmb set busparam"
);
return
IO__ERRINIDEVICE
;
}
sts
=
dp_set_busparameter
(
hDevice
,
op
);
if
(
!
sts
)
{
sts
=
dp_set_busparameter
(
op
);
if
(
!
sts
)
{
op
->
Status
=
PB__INITFAIL
;
errh_Error
(
"ERROR config Profibus DP Master %s - %s"
,
ap
->
Name
,
"dp set busparam"
);
"dp set busparam"
);
return
IO__ERRINIDEVICE
;
}
}
...
...
@@ -1594,7 +1728,8 @@ static pwr_tStatus IoAgentInit(io_tCtx ctx, io_sAgent* ap)
op
->
NumberSlaves
=
0
;
status
=
gdh_GetChild
(
ap
->
Objid
,
&
slave_objid
);
while
(
ODD
(
status
))
{
while
(
ODD
(
status
))
{
status
=
gdh_GetObjectClass
(
slave_objid
,
&
slave_class
);
cid
=
slave_class
;
...
...
@@ -1603,35 +1738,38 @@ static pwr_tStatus IoAgentInit(io_tCtx ctx, io_sAgent* ap)
;
status
=
gdh_ObjidToPointer
(
slave_objid
,
(
pwr_tAddress
*
)
&
sop
);
status
=
gdh_ObjidToName
(
slave_objid
,
(
char
*
)
&
name
,
sizeof
(
name
),
cdh_mNName
);
status
=
gdh_ObjidToName
(
slave_objid
,
(
char
*
)
&
name
,
sizeof
(
name
),
cdh_mNName
);
if
(
cid
==
pwr_cClass_Pb_DP_Slave
)
{
if
(
cid
==
pwr_cClass_Pb_DP_Slave
)
{
errh_Info
(
"Download Profibus DP Slave config - %s"
,
name
);
status
=
dp_download_slave
(
hDevice
,
(
pwr_sClass_Pb_DP_Slave
*
)
sop
);
status
=
dp_download_slave
((
pwr_sClass_Pb_DP_Slave
*
)
sop
);
if
(
!
status
)
{
if
(
!
status
)
{
errh_Error
(
"ERROR Init Profibus DP slave %s"
,
name
);
}
op
->
NumberSlaves
++
;
}
if
(
cid
==
pwr_cClass_Pb_FDL_SAP
)
{
if
(
cid
==
pwr_cClass_Pb_FDL_SAP
)
{
errh_Info
(
"Download Profibus FDL SAP config - %s"
,
name
);
if
(
!
((
pwr_sClass_Pb_FDL_SAP
*
)
sop
)
->
Responder
)
status
=
fdlif_sap_activate_req
(
hDevice
,
(
pwr_sClass_Pb_FDL_SAP
*
)
sop
);
status
=
fdlif_sap_activate_req
((
pwr_sClass_Pb_FDL_SAP
*
)
sop
);
else
status
=
fdlif_rsap_activate_req
(
hDevice
,
(
pwr_sClass_Pb_FDL_SAP
*
)
sop
);
status
=
fdlif_rsap_activate_req
((
pwr_sClass_Pb_FDL_SAP
*
)
sop
);
if
(
!
status
)
{
if
(
!
status
)
{
((
pwr_sClass_Pb_FDL_SAP
*
)
sop
)
->
Status
=
PB__INITFAIL
;
errh_Error
(
"ERROR Init Profibus FDL SAP %s"
,
name
);
}
else
}
else
((
pwr_sClass_Pb_FDL_SAP
*
)
sop
)
->
Status
=
PB__NORMAL
;
}
...
...
@@ -1642,7 +1780,8 @@ static pwr_tStatus IoAgentInit(io_tCtx ctx, io_sAgent* ap)
status
=
gdh_GetChild
(
ap
->
Objid
,
&
slave_objid
);
while
(
ODD
(
status
))
{
while
(
ODD
(
status
))
{
status
=
gdh_GetObjectClass
(
slave_objid
,
&
slave_class
);
cid
=
slave_class
;
...
...
@@ -1650,21 +1789,24 @@ static pwr_tStatus IoAgentInit(io_tCtx ctx, io_sAgent* ap)
while
(
ODD
(
gdh_GetSuperClass
(
cid
,
&
cid
,
pwr_cNOid
)))
;
if
(
cid
==
pwr_cClass_Pb_DP_Slave
)
{
if
(
cid
==
pwr_cClass_Pb_DP_Slave
)
{
status
=
gdh_ObjidToPointer
(
slave_objid
,
(
pwr_tAddress
*
)
&
sop
);
status
=
dp_io_offsets
(
hDevice
,
sop
);
status
=
dp_io_offsets
(
sop
);
}
status
=
gdh_GetNextSibling
(
slave_objid
,
&
slave_objid
);
}
/* Move to STOP mode, this will fix the DPRAM layout */
if
(
local
->
dp
)
{
sts
=
dp_act_param_loc
(
hDevice
,
DP_OP_MODE_STOP
);
if
(
sts
!=
E_OK
)
{
if
(
local
->
dp
)
{
sts
=
dp_act_param_loc
(
DP_OP_MODE_STOP
);
if
(
sts
!=
E_OK
)
{
op
->
Status
=
PB__INITFAIL
;
errh_Error
(
"ERROR config Profibus DP Master %s - %s"
,
ap
->
Name
,
"act param loc to STOPPED"
);
"act param loc to STOPPED"
);
return
IO__ERRINIDEVICE
;
}
}
...
...
@@ -1672,7 +1814,7 @@ static pwr_tStatus IoAgentInit(io_tCtx ctx, io_sAgent* ap)
ok
=
TRUE
;
}
/* End - While !ok */
}
/* End - Initialization only if not restart */
}
/* End - Initialization only if not restart */
/* else {
Move to STOP mode, this will fix the DPRAM layout
...
...
@@ -1684,55 +1826,9 @@ static pwr_tStatus IoAgentInit(io_tCtx ctx, io_sAgent* ap)
return IO__ERRINIDEVICE;
}
} */
}
else
op
->
Status
=
PB__DISABLED
;
return
IO__SUCCESS
;
}
/*----------------------------------------------------------------------------*\
Swap method for the Pb_profiboard agent
\*----------------------------------------------------------------------------*/
static
pwr_tStatus
IoAgentSwap
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_eEvent
event
)
{
switch
(
event
)
{
case
io_eEvent_IoCommSwapInit
:
case
io_eEvent_IoCommSwap
:
{
pwr_sClass_Pb_Profiboard
*
op
;
char
DeviceName
[
64
];
io_sAgentLocal
*
local
;
if
(
ap
->
Local
==
NULL
)
{
/* Allocate area for local data structure */
ap
->
Local
=
calloc
(
1
,
sizeof
(
io_sAgentLocal
));
if
(
!
ap
->
Local
)
{
errh_Error
(
"ERROR swap init Profibus DP Master %s - %s"
,
ap
->
Name
,
"calloc"
);
return
IO__ERRINIDEVICE
;
}
local
=
(
io_sAgentLocal
*
)
ap
->
Local
;
errh_Info
(
"Swap init interface for Profibus DP Master %s"
,
ap
->
Name
);
op
=
(
pwr_sClass_Pb_Profiboard
*
)
ap
->
op
;
sprintf
(
DeviceName
,
"/dev/pbboard%u"
,
op
->
BusNumber
-
1
);
local
->
hDpsBoardDevice
=
open
(
DeviceName
,
O_RDONLY
|
O_NONBLOCK
);
if
(
local
->
hDpsBoardDevice
==
-
1
)
{
errh_Error
(
"ERROR swap init Profibus DP Master %s - %s"
,
ap
->
Name
,
"open"
);
return
IO__ERRINIDEVICE
;
}
}
break
;
}
case
io_eEvent_EmergencyBreak
:
case
io_eEvent_IoCommEmergencyBreak
:
IoAgentClose
(
ctx
,
ap
);
break
;
}
else
op
->
Status
=
PB__DISABLED
;
return
IO__SUCCESS
;
}
...
...
@@ -1743,7 +1839,6 @@ static pwr_tStatus IoAgentSwap(io_tCtx ctx, io_sAgent* ap, io_eEvent event)
static
pwr_tStatus
IoAgentRead
(
io_tCtx
ctx
,
io_sAgent
*
ap
)
{
io_sAgentLocal
*
local
;
T_PROFI_DEVICE_HANDLE
*
hDevice
;
pwr_sClass_Pb_Profiboard
*
op
;
pwr_tUInt16
sts
;
...
...
@@ -1752,18 +1847,19 @@ static pwr_tStatus IoAgentRead(io_tCtx ctx, io_sAgent* ap)
pwr_tUInt16
data_len
;
io_sRack
*
slave_list
;
hDevice
=
(
T_PROFI_DEVICE_HANDLE
*
)
ap
->
Local
;
local
=
(
io_sAgentLocal
*
)
ap
->
Local
;
op
=
(
pwr_sClass_Pb_Profiboard
*
)
ap
->
op
;
/* Activate supervision thread, first cycle */
if
(
!
local
->
args
.
local
)
{
if
(
!
local
->
args
.
local
)
{
pthread_attr_t
attr
;
pthread_mutexattr_t
mutexattr
;
local
->
args
.
local
=
local
;
local
->
args
.
ap
=
ap
;
local
->
args
.
ctx
=
ctx
;
pthread_mutexattr_init
(
&
mutexattr
);
pthread_mutex_init
(
&
local
->
mutex
,
&
mutexattr
);
...
...
@@ -1777,17 +1873,20 @@ static pwr_tStatus IoAgentRead(io_tCtx ctx, io_sAgent* ap)
/* Iterate over the slaves. */
for
(
slave_list
=
ap
->
racklist
;
slave_list
!=
NULL
;
slave_list
=
slave_list
->
next
)
{
if
(((
io_sRackLocal
*
)
slave_list
->
Local
)
->
dp
)
{
slave_list
=
slave_list
->
next
)
{
if
(((
io_sRackLocal
*
)
slave_list
->
Local
)
->
dp
)
{
sp
=
(
pwr_sClass_Pb_DP_Slave
*
)
slave_list
->
op
;
mp
=
(
pwr_sClass_Pb_Profiboard
*
)
ap
->
op
;
/* Read process data. */
if
(
sp
->
Status
==
PB__NORMAL
&&
mp
->
Status
==
PB__NORMAL
&&
sp
->
DisableSlave
!=
1
&&
mp
->
DisableBus
!=
1
)
{
if
(
sp
->
Status
==
PB__NORMAL
&&
mp
->
Status
==
PB__NORMAL
&&
sp
->
DisableSlave
!=
1
&&
mp
->
DisableBus
!=
1
)
{
data_len
=
sp
->
BytesOfInput
;
sts
=
profi_get_data
(
hDevice
,
ID_DP_SLAVE_IO_IMAGE
,
sp
->
OffsetInputs
,
&
data_len
,
&
sp
->
Inputs
);
sts
=
profi_get_data
(
ID_DP_SLAVE_IO_IMAGE
,
sp
->
OffsetInputs
,
&
data_len
,
&
sp
->
Inputs
);
}
}
}
...
...
@@ -1803,33 +1902,35 @@ static pwr_tStatus IoAgentRead(io_tCtx ctx, io_sAgent* ap)
static
pwr_tStatus
IoAgentWrite
(
io_tCtx
ctx
,
io_sAgent
*
ap
)
{
io_sAgentLocal
*
local
;
T_PROFI_DEVICE_HANDLE
*
hDevice
;
pwr_tUInt16
sts
;
pwr_sClass_Pb_Profiboard
*
mp
;
pwr_sClass_Pb_DP_Slave
*
sp
;
io_sRack
*
slave_list
;
hDevice
=
(
T_PROFI_DEVICE_HANDLE
*
)
ap
->
Local
;
local
=
(
io_sAgentLocal
*
)
ap
->
Local
;
pthread_mutex_lock
(
&
local
->
mutex
);
/* Iterate over the slaves. */
for
(
slave_list
=
ap
->
racklist
;
slave_list
!=
NULL
;
slave_list
=
slave_list
->
next
)
{
if
(((
io_sRackLocal
*
)
slave_list
->
Local
)
->
dp
)
{
slave_list
=
slave_list
->
next
)
{
if
(((
io_sRackLocal
*
)
slave_list
->
Local
)
->
dp
)
{
sp
=
(
pwr_sClass_Pb_DP_Slave
*
)
slave_list
->
op
;
mp
=
(
pwr_sClass_Pb_Profiboard
*
)
ap
->
op
;
// Write the whole I/O output area from local area
if
((
sp
->
Status
==
PB__NORMAL
||
sp
->
Status
==
PB__NOCONN
)
&&
mp
->
Status
==
PB__NORMAL
&&
(
sp
->
DisableSlave
!=
1
)
&&
(
mp
->
DisableBus
!=
1
))
{
if
(
sp
->
BytesOfOutput
>
0
)
{
sts
=
profi_set_data
(
hDevice
,
ID_DP_SLAVE_IO_IMAGE
,
sp
->
OffsetOutputs
,
sp
->
BytesOfOutput
,
&
sp
->
Outputs
);
if
((
sp
->
Status
==
PB__NORMAL
||
sp
->
Status
==
PB__NOCONN
)
&&
mp
->
Status
==
PB__NORMAL
&&
(
sp
->
DisableSlave
!=
1
)
&&
(
mp
->
DisableBus
!=
1
))
{
if
(
sp
->
BytesOfOutput
>
0
)
{
sts
=
profi_set_data
(
ID_DP_SLAVE_IO_IMAGE
,
sp
->
OffsetOutputs
,
sp
->
BytesOfOutput
,
&
sp
->
Outputs
);
if
(
sts
!=
E_OK
)
sp
->
ErrorCount
++
;
...
...
@@ -1849,7 +1950,6 @@ static pwr_tStatus IoAgentWrite(io_tCtx ctx, io_sAgent* ap)
static
pwr_tStatus
IoAgentClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
)
{
io_sAgentLocal
*
local
;
T_PROFI_DEVICE_HANDLE
*
hDevice
;
pwr_tStatus
sts
=
PB_FALSE
;
T_PROFI_SERVICE_DESCR
sdb
;
...
...
@@ -1867,7 +1967,6 @@ static pwr_tStatus IoAgentClose(io_tCtx ctx, io_sAgent* ap)
pthread_mutex_lock
(
&
local
->
mutex
);
hDevice
=
(
T_PROFI_DEVICE_HANDLE
*
)
ap
->
Local
;
sdb
.
comm_ref
=
0
;
sdb
.
layer
=
DP
;
sdb
.
service
=
DP_EXIT_MASTER
;
...
...
@@ -1875,35 +1974,49 @@ static pwr_tStatus IoAgentClose(io_tCtx ctx, io_sAgent* ap)
sdb
.
invoke_id
=
0
;
sdb
.
result
=
0
;
profi_snd_req_res
(
hDevice
,
&
sdb
,
&
sdb
,
PB_FALSE
);
profi_snd_req_res
(
&
sdb
,
&
sdb
,
PB_FALSE
);
try_profi_rcv_con_ind
(
hDevice
,
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
,
&
result
);
try_profi_rcv_con_ind
(
&
con_ind_sdb
,
con_ind_buffer
,
&
con_ind_buffer_len
,
&
result
);
if
((
con_ind_sdb
.
service
==
DP_EXIT_MASTER
)
&&
(
con_ind_sdb
.
primitive
==
CON
)
&&
(
con_ind_sdb
.
result
==
POS
))
{
if
((
con_ind_sdb
.
service
==
DP_EXIT_MASTER
)
&&
(
con_ind_sdb
.
primitive
==
CON
)
&&
(
con_ind_sdb
.
result
==
POS
))
{
sts
=
PB_TRUE
;
}
close
(
local
->
hServiceReadDevice
);
close
(
local
->
hServiceWriteDevice
);
close
(
local
->
hDpDataDevice
);
close
(
local
->
hDpsInputDataDevice
);
close
(
local
->
hDpsOutputDataDevice
);
close
(
local
->
hDpsBoardDevice
);
profi_end
();
pthread_mutex_unlock
(
&
local
->
mutex
);
free
((
char
*
)
local
);
if
(
ctx
->
Node
->
EmergBreakTrue
==
1
)
errh_Fatal
(
"Emergency break detected shutting down profibus"
);
return
sts
;
}
static
pwr_tStatus
IoAgentSwap
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_eEvent
event
)
{
switch
(
event
)
{
case
io_eEvent_EmergencyBreak
:
case
io_eEvent_IoCommEmergencyBreak
:
IoAgentClose
(
ctx
,
ap
);
break
;
default:
break
;
}
return
IO__SUCCESS
;
}
/*----------------------------------------------------------------------------*\
Every method to be exported to the workbench should be registred here.
\*----------------------------------------------------------------------------*/
pwr_dExport
pwr_BindIoMethods
(
Pb_Profiboard
)
=
{
pwr_BindIoMethod
(
IoAgentInit
),
pwr_BindIoMethod
(
IoAgentRead
),
pwr_BindIoMethod
(
IoAgentWrite
),
pwr_BindIoMethod
(
IoAgentClose
),
pwr_BindIoMethod
(
IoAgentSwap
),
pwr_NullMethod
};
pwr_dExport
pwr_BindIoMethods
(
Pb_Profiboard
)
=
{
pwr_BindIoMethod
(
IoAgentInit
),
pwr_BindIoMethod
(
IoAgentRead
),
pwr_BindIoMethod
(
IoAgentWrite
),
pwr_BindIoMethod
(
IoAgentClose
),
pwr_BindIoMethod
(
IoAgentSwap
),
pwr_NullMethod
};
profibus/lib/rt/src/rt_io_pb_locals.h
View file @
df0831a3
...
...
@@ -72,20 +72,23 @@
/* io_sAgentLocal now lives in the respective agent modules. */
typedef
struct
_io_sRackLocal
{
typedef
struct
_io_sRackLocal
{
unsigned
char
fdl
;
unsigned
char
dp
;
unsigned
int
start_time
;
unsigned
int
start_cnt
;
}
io_sRackLocal
;
typedef
struct
{
typedef
struct
{
void
*
input_area
;
void
*
output_area
;
int
scancount
[
IO_MAXCHAN
];
}
io_sCardLocal
;
typedef
struct
{
typedef
struct
{
unsigned
short
invoke_id
;
unsigned
short
input_area_size
;
unsigned
short
output_area_size
;
...
...
@@ -95,21 +98,24 @@ typedef struct {
unsigned
short
float_representation
;
}
io_sFDLCardLocal
;
typedef
struct
_agent_args
{
typedef
struct
_agent_args
{
void
*
local
;
io_sAgent
*
ap
;
io_tCtx
ctx
;
}
agent_args
;
typedef
struct
{
int
hServiceReadDevice
;
// Handle for Service device
int
hServiceWriteDevice
;
// Handle for Service device
int
hDpDataDevice
;
// Handle for DP-Data device
int
hDpsInputDataDevice
;
// Handle for DP-Slave Input-Data device
typedef
struct
{
int
hServiceReadDevice
;
// Handle for Service device
int
hServiceWriteDevice
;
// Handle for Service device
int
hDpDataDevice
;
// Handle for DP-Data device
int
hDpsInputDataDevice
;
// Handle for DP-Slave Input-Data device
int
hDpsOutputDataDevice
;
// Handle for DP-Slave Output-Data device
unsigned
char
CurrentBoardNumber
;
int
slave_diag_requested
;
// Slave diag requested
int
parallel_service
;
// parallel activity
int
hDpsBoardDevice
;
// Handle for DP-Slave Output-Data device
int
parallel_service
;
// parallel activity
int
hDpsBoardDevice
;
// Handle for DP-Slave Output-Data device
pthread_t
events
;
pthread_mutex_t
mutex
;
agent_args
args
;
...
...
profibus/lib/rt/src/rt_io_pn_locals.h
View file @
df0831a3
...
...
@@ -39,7 +39,8 @@
/* rt_io_pn_locals.h -- Profinet io handling locals. */
typedef
struct
_io_sPnRackLocal
{
typedef
struct
_io_sPnRackLocal
{
unsigned
short
bytes_of_input
;
unsigned
short
bytes_of_output
;
unsigned
char
*
inputs
;
...
...
@@ -49,7 +50,8 @@ typedef struct _io_sPnRackLocal {
unsigned
int
start_cnt
;
}
io_sPnRackLocal
;
typedef
struct
_io_sPnCardLocal
{
typedef
struct
_io_sPnCardLocal
{
unsigned
int
input_area_size
;
unsigned
int
output_area_size
;
unsigned
char
*
input_area
;
...
...
profibus/lib/rt/src/rt_io_pnak_locals.h
View file @
df0831a3
...
...
@@ -45,7 +45,8 @@
/* rt_io_pnak_locals.h -- Profinet io handling locals. */
typedef
struct
_PN_Alarm_Data
{
typedef
struct
_PN_Alarm_Data
{
unsigned
short
alarm_type
;
unsigned
short
alarm_prio
;
unsigned
short
rem_alarms
;
...
...
@@ -58,12 +59,10 @@ typedef struct _PN_Alarm_Data {
unsigned
char
*
data
;
}
PN_Alarm_Data
;
class
PnApiData
{
class
PnApiData
{
public:
PnApiData
()
:
api
(
0
)
{
}
PnApiData
()
:
api
(
0
)
{}
unsigned
int
api
;
std
::
vector
<
unsigned
int
>
module_index
;
...
...
@@ -73,21 +72,19 @@ public:
int
print
(
std
::
ofstream
&
fp
);
};
class
PnIOCRData
{
class
PnIOCRData
{
public:
PnIOCRData
()
:
type
(
0
)
,
number_modules
(
0
)
,
identifier
(
0
)
,
io_data_length
(
0
)
,
clean_io_data_length
(
0
)
:
type
(
0
),
number_modules
(
0
),
identifier
(
0
),
io_data_length
(
0
),
clean_io_data_length
(
0
)
{
}
unsigned
short
type
;
unsigned
short
number_modules
;
unsigned
short
identifier
;
unsigned
short
io_data_length
;
// bytes of io-data including status;
unsigned
short
io_data_length
;
// bytes of io-data including status;
unsigned
short
clean_io_data_length
;
// bytes of io-data including status;
unsigned
char
*
io_data
;
unsigned
char
*
clean_io_data
;
...
...
@@ -97,16 +94,12 @@ public:
int
print
(
std
::
ofstream
&
fp
);
};
class
PnSubmoduleData
{
class
PnSubmoduleData
{
public:
PnSubmoduleData
()
:
subslot_number
(
0
)
,
subslot_idx
(
0
)
,
type
(
0
)
,
state
(
0
)
,
ident_number
(
0
)
,
phys_ident_number
(
0
)
,
api
(
0
)
:
subslot_number
(
0
),
subslot_idx
(
0
),
type
(
0
),
state
(
0
),
ident_number
(
0
),
phys_ident_number
(
0
),
api
(
0
)
{
}
...
...
@@ -118,29 +111,27 @@ public:
unsigned
int
phys_ident_number
;
unsigned
int
api
;
unsigned
short
io_in_data_length
;
// bytes of pure io-data
unsigned
short
offset_io_in
;
// offset in io-data area for this iocr
unsigned
short
io_in_data_length
;
// bytes of pure io-data
unsigned
short
offset_io_in
;
// offset in io-data area for this iocr
unsigned
short
offset_clean_io_in
;
// offset in io-data area for this iocr
unsigned
short
offset_status_in
;
// offset in io-data area for this iocr
unsigned
short
offset_status_in
;
// offset in io-data area for this iocr
unsigned
short
io_out_data_length
;
// bytes of pure io-data
unsigned
short
offset_io_out
;
// offset in io-data area for this iocr
unsigned
short
io_out_data_length
;
// bytes of pure io-data
unsigned
short
offset_io_out
;
// offset in io-data area for this iocr
unsigned
short
offset_clean_io_out
;
// offset in io-data area for this iocr
unsigned
short
offset_status_out
;
// offset in io-data area for this iocr
unsigned
short
offset_status_out
;
// offset in io-data area for this iocr
~
PnSubmoduleData
()
{}
int
print
(
std
::
ofstream
&
fp
);
};
class
PnModuleData
{
class
PnModuleData
{
public:
PnModuleData
()
:
slot_number
(
0
)
,
slot_idx
(
0
)
,
state
(
0
)
,
ident_number
(
0
)
,
phys_ident_number
(
0
)
:
slot_number
(
0
),
slot_idx
(
0
),
state
(
0
),
ident_number
(
0
),
phys_ident_number
(
0
)
{
}
...
...
@@ -161,13 +152,11 @@ public:
int
print
(
std
::
ofstream
&
fp
);
};
class
PnDeviceData
{
class
PnDeviceData
{
public:
PnDeviceData
()
:
device_ref
(
0
)
,
alarm_ref
(
0
)
,
device_state
(
0
)
,
no_diff_modules
(
0
)
:
device_ref
(
0
),
alarm_ref
(
0
),
device_state
(
0
),
no_diff_modules
(
0
)
{
memset
(
&
alarm_data
,
0
,
sizeof
(
PN_Alarm_Data
));
}
...
...
@@ -182,10 +171,7 @@ public:
std
::
vector
<
PnModuleData
*>
module_data
;
std
::
vector
<
PnIOCRData
*>
iocr_data
;
~
PnDeviceData
()
{
device_reset
();
}
~
PnDeviceData
()
{
device_reset
();
}
void
device_reset
()
{
for
(
unsigned
int
i
=
0
;
i
<
module_data
.
size
();
i
++
)
...
...
@@ -201,7 +187,8 @@ public:
int
paste_slot
(
unsigned
int
slot_idx
);
};
class
PnDeviceInfo
{
class
PnDeviceInfo
{
public:
PnDeviceInfo
()
{}
unsigned
char
ipaddress
[
4
];
...
...
@@ -212,12 +199,14 @@ public:
int
deviceid
;
};
typedef
struct
_agent_args
{
typedef
struct
_agent_args
{
void
*
local
;
io_sAgent
*
ap
;
}
agent_args
;
class
io_sAgentLocal
{
class
io_sAgentLocal
{
public:
io_sAgentLocal
()
{}
...
...
profibus/lib/rt/src/rt_pn_gsdml_data.h
View file @
df0831a3
...
...
@@ -43,15 +43,12 @@
#include "co_xml_parser.h"
class
GsdmlDataRecord
{
class
GsdmlDataRecord
{
public:
GsdmlDataRecord
()
:
record_idx
(
0
)
,
data
(
0
)
,
data_reversed_endianess
(
0
)
,
data_length
(
0
)
,
index
(
0
)
,
transfer_sequence
(
0
)
:
record_idx
(
0
),
data
(
0
),
data_reversed_endianess
(
0
),
data_length
(
0
),
index
(
0
),
transfer_sequence
(
0
)
{
}
...
...
@@ -74,14 +71,11 @@ public:
int
print
(
std
::
ofstream
&
fp
,
bool
reverse_endianess
);
};
class
GsdmlIOCRData
{
class
GsdmlIOCRData
{
public:
GsdmlIOCRData
()
:
type
(
0
)
,
properties
(
0
)
,
send_clock_factor
(
0
)
,
phase
(
0
)
,
api
(
0
)
:
type
(
0
),
properties
(
0
),
send_clock_factor
(
0
),
phase
(
0
),
api
(
0
)
{
}
...
...
@@ -95,16 +89,13 @@ public:
int
print
(
std
::
ofstream
&
fp
);
};
class
GsdmlSubslotData
{
class
GsdmlSubslotData
{
public:
GsdmlSubslotData
()
:
subslot_number
(
0
)
,
subslot_idx
(
0
)
,
submodule_enum_number
(
0
)
,
submodule_ident_number
(
0
)
,
api
(
0
)
,
io_input_length
(
0
)
,
io_output_length
(
0
)
:
subslot_number
(
0
),
subslot_idx
(
0
),
submodule_enum_number
(
0
),
submodule_ident_number
(
0
),
api
(
0
),
io_input_length
(
0
),
io_output_length
(
0
)
{
}
...
...
@@ -123,24 +114,22 @@ public:
delete
data_record
[
i
];
}
GsdmlSubslotData
(
const
GsdmlSubslotData
&
x
)
:
subslot_number
(
x
.
subslot_number
)
,
subslot_idx
(
x
.
subslot_idx
)
:
subslot_number
(
x
.
subslot_number
),
subslot_idx
(
x
.
subslot_idx
)
{
for
(
unsigned
int
i
=
0
;
i
<
x
.
data_record
.
size
();
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
x
.
data_record
.
size
();
i
++
)
{
data_record
.
push_back
(
new
GsdmlDataRecord
(
*
x
.
data_record
[
i
]));
}
}
int
print
(
std
::
ofstream
&
fp
,
bool
reverse_endianess
);
};
class
GsdmlSlotData
{
class
GsdmlSlotData
{
public:
GsdmlSlotData
()
:
module_enum_number
(
0
)
,
module_class
(
0
)
,
module_oid
(
pwr_cNOid
)
,
slot_number
(
0
)
,
slot_idx
(
0
)
:
module_enum_number
(
0
),
module_class
(
0
),
module_oid
(
pwr_cNOid
),
slot_number
(
0
),
slot_idx
(
0
)
{
module_text
[
0
]
=
0
;
}
...
...
@@ -165,20 +154,20 @@ public:
subslot_data
.
clear
();
}
GsdmlSlotData
(
const
GsdmlSlotData
&
x
)
:
module_enum_number
(
x
.
module_enum_number
)
,
module_class
(
x
.
module_class
)
,
module_oid
(
pwr_cNObjid
)
,
slot_number
(
x
.
slot_number
)
,
slot_idx
(
x
.
slot_idx
)
:
module_enum_number
(
x
.
module_enum_number
),
module_class
(
x
.
module_class
),
module_oid
(
pwr_cNObjid
),
slot_number
(
x
.
slot_number
),
slot_idx
(
x
.
slot_idx
)
{
for
(
unsigned
int
i
=
0
;
i
<
x
.
subslot_data
.
size
();
i
++
)
{
for
(
unsigned
int
i
=
0
;
i
<
x
.
subslot_data
.
size
();
i
++
)
{
subslot_data
.
push_back
(
new
GsdmlSubslotData
(
*
x
.
subslot_data
[
i
]));
}
}
int
print
(
std
::
ofstream
&
fp
,
bool
reverse_endianess
);
};
class
GsdmlChannelDiag
{
class
GsdmlChannelDiag
{
public:
GsdmlChannelDiag
();
unsigned
short
error_type
;
...
...
@@ -189,15 +178,12 @@ public:
int
print
(
std
::
ofstream
&
fp
);
};
class
GsdmlDeviceData
{
class
GsdmlDeviceData
{
public:
GsdmlDeviceData
()
:
device_num
(
0
)
,
vendor_id
(
0
)
,
device_id
(
0
)
,
byte_order
(
0
)
,
read_data_is_native_ordered
(
1
)
,
instance
(
0
)
:
device_num
(
0
),
vendor_id
(
0
),
device_id
(
0
),
byte_order
(
0
),
read_data_is_native_ordered
(
1
),
instance
(
0
)
{
device_name
[
0
]
=
0
;
ip_address
[
0
]
=
0
;
...
...
@@ -254,13 +240,10 @@ public:
int
get_value
(
const
char
*
attr
,
char
*
buf
,
int
bufsize
);
};
class
GsdmlDataReader
:
public
co_xml_interpreter
{
class
GsdmlDataReader
:
public
co_xml_interpreter
{
public:
GsdmlDataReader
(
GsdmlDeviceData
*
d
)
:
data
(
d
)
,
new_filename
(
0
)
{
}
GsdmlDataReader
(
GsdmlDeviceData
*
d
)
:
data
(
d
),
new_filename
(
0
)
{}
int
tag
(
const
char
*
name
);
int
metatag
(
const
char
*
name
);
int
tag_end
(
const
char
*
name
);
...
...
profibus/lib/rt/src/rt_pn_iface.h
View file @
df0831a3
...
...
@@ -47,42 +47,42 @@
#define PN_MAX_MANU_SPEC_DIAGS 200
void
pack_set_ip_settings_req
(
T_PNAK_SERVICE_REQ_RES
*
ServiceReqRes
,
PnDeviceInfo
*
dev_info
);
void
pack_set_ip_settings_req
(
T_PNAK_SERVICE_REQ_RES
*
ServiceReqRes
,
PnDeviceInfo
*
dev_info
);
void
pack_set_device_name_req
(
T_PNAK_SERVICE_REQ_RES
*
ServiceReqRes
,
PnDeviceInfo
*
dev_info
);
void
pack_set_device_name_req
(
T_PNAK_SERVICE_REQ_RES
*
ServiceReqRes
,
PnDeviceInfo
*
dev_info
);
void
pack_set_identification_req
(
T_PNAK_SERVICE_REQ_RES
*
ServiceReqRes
);
void
pack_get_device_state_req
(
T_PNAK_SERVICE_REQ_RES
*
ServiceReqRes
,
unsigned
short
device_ref
);
void
pack_get_device_state_req
(
T_PNAK_SERVICE_REQ_RES
*
ServiceReqRes
,
unsigned
short
device_ref
);
void
pack_write_req
(
T_PNAK_SERVICE_REQ_RES
*
ServiceReqRes
,
unsigned
short
device_ref
,
pwr_sClass_PnWriteReq
*
wr_req
);
unsigned
short
device_ref
,
pwr_sClass_PnWriteReq
*
wr_req
);
void
pack_get_los_req
(
T_PNAK_SERVICE_REQ_RES
*
ServiceReqRes
);
void
pack_get_alarm_req
(
T_PNAK_SERVICE_REQ_RES
*
ServiceReqRes
,
unsigned
short
ref
);
void
pack_get_alarm_req
(
T_PNAK_SERVICE_REQ_RES
*
ServiceReqRes
,
unsigned
short
ref
);
void
pack_alarm_ack_req
(
T_PNAK_SERVICE_REQ_RES
*
ServiceReqRes
,
unsigned
short
ref
,
unsigned
short
prio
);
unsigned
short
ref
,
unsigned
short
prio
);
void
pack_download_req
(
T_PNAK_SERVICE_REQ_RES
*
ServiceReqRes
,
GsdmlDeviceData
*
dev_data
,
unsigned
short
device_ref
);
GsdmlDeviceData
*
dev_data
,
unsigned
short
device_ref
);
int
unpack_write_con
(
T_PNAK_SERVICE_DESCRIPTION
*
pSdb
,
io_sAgentLocal
*
local
);
int
unpack_get_los_con
(
T_PNAK_SERVICE_DESCRIPTION
*
pSdb
,
io_sAgentLocal
*
local
);
int
unpack_get_alarm_con
(
T_PNAK_SERVICE_DESCRIPTION
*
pSdb
,
io_sAgentLocal
*
local
,
io_sAgent
*
ap
);
int
unpack_get_device_state_con
(
T_PNAK_SERVICE_DESCRIPTION
*
pSdb
,
io_sAgentLocal
*
local
,
io_sAgent
*
ap
);
int
unpack_get_alarm_con
(
T_PNAK_SERVICE_DESCRIPTION
*
pSdb
,
io_sAgentLocal
*
local
,
io_sAgent
*
ap
);
int
unpack_get_device_state_con
(
T_PNAK_SERVICE_DESCRIPTION
*
pSdb
,
io_sAgentLocal
*
local
,
io_sAgent
*
ap
);
int
unpack_download_con
(
T_PNAK_SERVICE_DESCRIPTION
*
pSdb
,
io_sAgentLocal
*
local
);
int
unpack_download_con
(
T_PNAK_SERVICE_DESCRIPTION
*
pSdb
,
io_sAgentLocal
*
local
);
int
handle_service_con
(
io_sAgentLocal
*
local
,
io_sAgent
*
ap
);
...
...
profibus/lib/rt/src/rt_pnak.h
View file @
df0831a3
...
...
@@ -174,7 +174,8 @@ typedef unsigned short T_PNAK_EXCEPTION_SOURCE;
#define PNAK_EXCEPTION_SOURCE_IS_PNAK 1u
#define PNAK_EXCEPTION_SOURCE_IS_APPL 2u
typedef
struct
_T_PNAK_EXCEPTION
{
typedef
struct
_T_PNAK_EXCEPTION
{
T_PNAK_EXCEPTION_SOURCE
Source
;
unsigned
short
ChannelId
;
...
...
@@ -204,7 +205,8 @@ typedef unsigned short T_PNAK_MODE_ID;
#define PNAK_VERSION_STRING_LENGTH 42
typedef
struct
_T_PNAK_VERSION
{
typedef
struct
_T_PNAK_VERSION
{
unsigned
short
IfId
;
unsigned
short
HostIfId
;
unsigned
short
HostConfigIfId
;
...
...
@@ -218,7 +220,8 @@ typedef struct _T_PNAK_VERSION {
}
PACK_WORD_ALIGNMENT
(
T_PNAK_VERSION
);
typedef
struct
_T_PNAK_VERSIONS
{
typedef
struct
_T_PNAK_VERSIONS
{
T_PNAK_VERSION
Firmware
;
T_PNAK_VERSION
Pnak
;
...
...
@@ -264,32 +267,31 @@ typedef PN_U32 T_PNAK_WAIT_OBJECT;
#define PNAK_WAIT_TIMEOUT ((T_PNAK_WAIT_OBJECT)0x80000000uL)
#define PNAK_WAIT_OBJECTS_SERVICE \
(PNAK_WAIT_OBJECT_SERVICE_CON | PNAK_WAIT_OBJECT_SERVICE_IND
\
|
PNAK_WAIT_OBJECT_SERVICE_REQ_RES_HANDLED)
(PNAK_WAIT_OBJECT_SERVICE_CON | PNAK_WAIT_OBJECT_SERVICE_IND
|
\
PNAK_WAIT_OBJECT_SERVICE_REQ_RES_HANDLED)
#define PNAK_WAIT_OBJECTS_EVENT_IND \
(PNAK_WAIT_OBJECT_STATE_CHANGED | PNAK_WAIT_OBJECT_ALARM
\
| PNAK_WAIT_OBJECT_ALARM_ACK | PNAK_WAIT_OBJECT_DEVICE_STATE_CHANGED
\
| PNAK_WAIT_OBJECT_ETHERNET_STATE_CHANGED | PNAK_WAIT_OBJECT_PTCP
\
|
PNAK_WAIT_OBJECT_MRPD)
(PNAK_WAIT_OBJECT_STATE_CHANGED | PNAK_WAIT_OBJECT_ALARM
|
\
PNAK_WAIT_OBJECT_ALARM_ACK | PNAK_WAIT_OBJECT_DEVICE_STATE_CHANGED |
\
PNAK_WAIT_OBJECT_ETHERNET_STATE_CHANGED | PNAK_WAIT_OBJECT_PTCP |
\
PNAK_WAIT_OBJECT_MRPD)
#define PNAK_WAIT_OBJECTS_DATA_IND \
(PNAK_WAIT_OBJECT_PROVIDER_DATA_UPDATED
\
|
PNAK_WAIT_OBJECT_CONSUMER_DATA_CHANGED)
(PNAK_WAIT_OBJECT_PROVIDER_DATA_UPDATED
|
\
PNAK_WAIT_OBJECT_CONSUMER_DATA_CHANGED)
#define PNAK_WAIT_OBJECTS_SOCKET_IND \
(PNAK_WAIT_OBJECT_SOCKET_STATE_CHANGED
\
|
PNAK_WAIT_OBJECT_SOCKET_DATA_RECEIVED)
(PNAK_WAIT_OBJECT_SOCKET_STATE_CHANGED
|
\
PNAK_WAIT_OBJECT_SOCKET_DATA_RECEIVED)
#define PNAK_WAIT_OBJECTS_OTHER \
(PNAK_WAIT_OBJECT_EXCEPTION | PNAK_WAIT_OBJECT_CHANNEL_CLOSED
\
|
PNAK_WAIT_OBJECT_INTERRUPTED)
(PNAK_WAIT_OBJECT_EXCEPTION | PNAK_WAIT_OBJECT_CHANNEL_CLOSED
|
\
PNAK_WAIT_OBJECT_INTERRUPTED)
#define PNAK_WAIT_OBJECTS_USER \
(PNAK_USER_WAIT_OBJECT_1 | PNAK_USER_WAIT_OBJECT_2 |
PNAK_USER_WAIT_OBJECT_3
\
| PNAK_USER_WAIT_OBJECT_4 | PNAK_USER_WAIT_OBJECT_5
\
| PNAK_USER_WAIT_OBJECT_6 | PNAK_USER_WAIT_OBJECT_7
\
| PNAK_USER_WAIT_OBJECT_8)
(PNAK_USER_WAIT_OBJECT_1 | PNAK_USER_WAIT_OBJECT_2 |
\
PNAK_USER_WAIT_OBJECT_3 | PNAK_USER_WAIT_OBJECT_4 |
\
PNAK_USER_WAIT_OBJECT_5 | PNAK_USER_WAIT_OBJECT_6 |
\
PNAK_USER_WAIT_OBJECT_7
| PNAK_USER_WAIT_OBJECT_8)
#define PNAK_WAIT_OBJECTS_ALL \
(PNAK_WAIT_OBJECTS_OTHER | PNAK_WAIT_OBJECTS_EVENT_IND \
| PNAK_WAIT_OBJECTS_DATA_IND | PNAK_WAIT_OBJECTS_SERVICE \
| PNAK_WAIT_OBJECTS_SOCKET_IND | PNAK_WAIT_OBJECTS_USER \
| PNAK_WAIT_TIMEOUT)
(PNAK_WAIT_OBJECTS_OTHER | PNAK_WAIT_OBJECTS_EVENT_IND | \
PNAK_WAIT_OBJECTS_DATA_IND | PNAK_WAIT_OBJECTS_SERVICE | \
PNAK_WAIT_OBJECTS_SOCKET_IND | PNAK_WAIT_OBJECTS_USER | PNAK_WAIT_TIMEOUT)
/*---------------------------------------------------------------------------*/
...
...
@@ -317,7 +319,8 @@ typedef unsigned char T_PNAK_SERVICE_RESULT;
#define PNAK_RESULT_POS (T_PNAK_SERVICE_RESULT)0x00u
#define PNAK_RESULT_NEG (T_PNAK_SERVICE_RESULT)0x01u
typedef
struct
_T_PNAK_SERVICE_DESCRIPTION
{
typedef
struct
_T_PNAK_SERVICE_DESCRIPTION
{
unsigned
short
DeviceRef
;
unsigned
char
Instance
;
...
...
@@ -353,14 +356,16 @@ typedef struct _T_PNAK_SERVICE_DESCRIPTION {
/*=== SERVICE REQUEST/RESPONSE ==============================================*/
typedef
struct
_T_PNAK_SERVICE_REQ_RES_ENTRY
{
typedef
struct
_T_PNAK_SERVICE_REQ_RES_ENTRY
{
unsigned
short
ServiceOffset
;
}
PACK_WORD_ALIGNMENT
(
T_PNAK_SERVICE_REQ_RES_ENTRY
);
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PNAK_SERVICE_REQ_RES
{
typedef
struct
_T_PNAK_SERVICE_REQ_RES
{
unsigned
short
NumberEntries
;
T_PNAK_SERVICE_REQ_RES_ENTRY
ServiceEntry
[
PNAK_MAX_NUMBER_REQ_SERVICES
];
...
...
@@ -370,14 +375,16 @@ typedef struct _T_PNAK_SERVICE_REQ_RES {
/*=== SERVICE CONFIRMATION ==================================================*/
typedef
struct
_T_PNAK_SERVICE_CON_ENTRY
{
typedef
struct
_T_PNAK_SERVICE_CON_ENTRY
{
unsigned
short
ServiceOffset
;
}
PACK_WORD_ALIGNMENT
(
T_PNAK_SERVICE_CON_ENTRY
);
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PNAK_SERVICE_CON
{
typedef
struct
_T_PNAK_SERVICE_CON
{
unsigned
short
NumberEntries
;
T_PNAK_SERVICE_CON_ENTRY
ServiceEntry
[
PNAK_MAX_NUMBER_CON_SERVICES
];
...
...
@@ -387,14 +394,16 @@ typedef struct _T_PNAK_SERVICE_CON {
/*=== SERVICE INDICATION ====================================================*/
typedef
struct
_T_PNAK_SERVICE_IND_ENTRY
{
typedef
struct
_T_PNAK_SERVICE_IND_ENTRY
{
unsigned
short
ServiceOffset
;
}
PACK_WORD_ALIGNMENT
(
T_PNAK_SERVICE_IND_ENTRY
);
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PNAK_SERVICE_IND
{
typedef
struct
_T_PNAK_SERVICE_IND
{
unsigned
short
NumberEntries
;
T_PNAK_SERVICE_IND_ENTRY
ServiceEntry
[
PNAK_MAX_NUMBER_IND_SERVICES
];
...
...
@@ -413,14 +422,16 @@ typedef unsigned short T_PNAK_MODE;
/*=== EVENT REQUEST ==========================================================*/
typedef
struct
_T_PNAK_EVENT_SET_MODE
{
typedef
struct
_T_PNAK_EVENT_SET_MODE
{
T_PNAK_MODE
Mode
;
}
PACK_WORD_ALIGNMENT
(
T_PNAK_EVENT_SET_MODE
);
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PNAK_EVENT_SET_DEVICE_STATE
{
typedef
struct
_T_PNAK_EVENT_SET_DEVICE_STATE
{
T_BITSET_256
ActivateDeviceReference
;
T_BITSET_256
DeactivateDeviceReference
;
...
...
@@ -444,7 +455,8 @@ typedef enum _T_PNAK_STATE {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PNAK_EVENT_STATE
{
typedef
struct
_T_PNAK_EVENT_STATE
{
T_PNAK_MODE
Mode
;
T_PNAK_STATE
State
;
...
...
@@ -452,14 +464,16 @@ typedef struct _T_PNAK_EVENT_STATE {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PNAK_EVENT_ALARM
{
typedef
struct
_T_PNAK_EVENT_ALARM
{
T_BITSET_256
DeviceReference
;
}
PACK_WORD_ALIGNMENT
(
T_PNAK_EVENT_ALARM
);
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PNAK_EVENT_ALARM_ACK
{
typedef
struct
_T_PNAK_EVENT_ALARM_ACK
{
T_BITSET_256
DeviceReference
;
}
PACK_WORD_ALIGNMENT
(
T_PNAK_EVENT_ALARM_ACK
);
...
...
@@ -475,16 +489,16 @@ typedef struct _T_PNAK_EVENT_ALARM_ACK {
#define PNAK_DEVICE_STATE_CONTROL_ERROR 0x40u
#define PNAK_DEVICE_STATE_CLOSE_PENDING 0x80u
#define PNAK_DEVICE_STATE_MASK \
(PNAK_DEVICE_STATE_DEACTIVATED | PNAK_DEVICE_STATE_FIND_DEVICE \
| PNAK_DEVICE_STATE_CONNECTION_ESTABLISHMENT \
| PNAK_DEVICE_STATE_CONNECTED)
(PNAK_DEVICE_STATE_DEACTIVATED | PNAK_DEVICE_STATE_FIND_DEVICE | \
PNAK_DEVICE_STATE_CONNECTION_ESTABLISHMENT | PNAK_DEVICE_STATE_CONNECTED)
#define PNAK_DEVICE_STATE_MASK_CONNECTING \
(PNAK_DEVICE_STATE_FIND_DEVICE | PNAK_DEVICE_STATE_CONNECTION_ESTABLISHMENT)
#define PNAK_DEVICE_STATE_ERROR_MASK \
(PNAK_DEVICE_STATE_CONNECT_ERROR | PNAK_DEVICE_STATE_WRITE_ERROR
\
|
PNAK_DEVICE_STATE_CONTROL_ERROR)
(PNAK_DEVICE_STATE_CONNECT_ERROR | PNAK_DEVICE_STATE_WRITE_ERROR
|
\
PNAK_DEVICE_STATE_CONTROL_ERROR)
typedef
struct
_T_PNAK_EVENT_DEVICE_STATE
{
typedef
struct
_T_PNAK_EVENT_DEVICE_STATE
{
unsigned
char
State
[
MAX_NUMBER_SUPPORTED_DEVICES
];
}
PACK_WORD_ALIGNMENT
(
T_PNAK_EVENT_DEVICE_STATE
);
...
...
@@ -500,12 +514,14 @@ typedef struct _T_PNAK_EVENT_DEVICE_STATE {
#define PNAK_MRPD_MISSING_APPEARS 0x8000u
#define PNAK_MRPD_MISSING_DISAPPEARS 0x0000u
typedef
struct
_T_PNAK_EVENT_MRPD_IOCR
{
typedef
struct
_T_PNAK_EVENT_MRPD_IOCR
{
PN_U16
FrameId
[
PN_SERVICE_DOWNLOAD_MAX_NUMBER_IOCRS
];
}
PACK_WORD_ALIGNMENT
(
T_PNAK_EVENT_MRPD_IOCR
);
typedef
struct
_T_PNAK_EVENT_MRPD
{
typedef
struct
_T_PNAK_EVENT_MRPD
{
T_PNAK_EVENT_MRPD_IOCR
AR
[
MAX_NUMBER_CMDEV_CONNECTIONS
];
}
PACK_WORD_ALIGNMENT
(
T_PNAK_EVENT_MRPD
);
...
...
@@ -520,13 +536,14 @@ typedef struct _T_PNAK_EVENT_MRPD {
#define PNAK_EVENT_PTCP 0x00000020uL
#define PNAK_EVENT_MRPD 0x00000040uL
#define PNAK_EVENT_MASK \
(PNAK_EVENT_STATE_CHANGED | PNAK_EVENT_DEVICE_STATE_CHANGED
\
| PNAK_EVENT_ALARM | PNAK_EVENT_ALARM_ACK
\
|
PNAK_EVENT_ETHERNET_STATE_CHANGED | PNAK_EVENT_PTCP | PNAK_EVENT_MRPD)
(PNAK_EVENT_STATE_CHANGED | PNAK_EVENT_DEVICE_STATE_CHANGED
|
\
PNAK_EVENT_ALARM | PNAK_EVENT_ALARM_ACK |
\
PNAK_EVENT_ETHERNET_STATE_CHANGED | PNAK_EVENT_PTCP | PNAK_EVENT_MRPD)
typedef
PN_U32
T_PNAK_EVENT_REG
;
typedef
struct
_T_PNAK_EVENT_IND_MASK
{
typedef
struct
_T_PNAK_EVENT_IND_MASK
{
T_PNAK_EVENT_REG
EventMaskReg
;
}
PACK_WORD_ALIGNMENT
(
T_PNAK_EVENT_IND_MASK
);
...
...
@@ -553,7 +570,8 @@ STATISTIC INTERFACE
#define PNIO_STATUS_ENCODING_LITTLE_ENDIAN 0x10u
#define PNIO_STATUS_ENCODING_MASK 0xF0u
typedef
struct
_T_PNAK_CONNECTION_STATISTIC
{
typedef
struct
_T_PNAK_CONNECTION_STATISTIC
{
PN_U32
Coding
;
PN_U8
Encoding
;
...
...
@@ -563,7 +581,8 @@ typedef struct _T_PNAK_CONNECTION_STATISTIC {
}
T_PNAK_CONNECTION_STATISTIC
;
typedef
struct
_T_PNAK_CMCTL_STATISTIC
{
typedef
struct
_T_PNAK_CMCTL_STATISTIC
{
PN_U32
NumberDevicesInStartup
;
PN_U32
NumberDevicesConnected
;
...
...
@@ -576,7 +595,8 @@ typedef struct _T_PNAK_CMCTL_STATISTIC {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PNAK_CMDEV_STATISTIC
{
typedef
struct
_T_PNAK_CMDEV_STATISTIC
{
T_PNAK_CONNECTION_STATISTIC
Cmdev
[
MAX_NUMBER_CMDEV_CONNECTIONS
];
}
T_PNAK_CMDEV_STATISTIC
;
...
...
@@ -587,14 +607,16 @@ DATA INTERFACE
/*=== DATA INDICATION =======================================================*/
typedef
struct
_T_PNAK_DATA_CONSUMER_DATA_CHANGED
{
typedef
struct
_T_PNAK_DATA_CONSUMER_DATA_CHANGED
{
T_BITSET_256
DeviceReference
;
}
PACK_WORD_ALIGNMENT
(
T_PNAK_DATA_CONSUMER_DATA_CHANGED
);
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PNAK_DATA_PROVIDER_DATA_UPDATED
{
typedef
struct
_T_PNAK_DATA_PROVIDER_DATA_UPDATED
{
T_BITSET_256
DeviceReference
;
}
PACK_WORD_ALIGNMENT
(
T_PNAK_DATA_PROVIDER_DATA_UPDATED
);
...
...
@@ -607,7 +629,8 @@ typedef struct _T_PNAK_DATA_PROVIDER_DATA_UPDATED {
typedef
PN_U32
T_PNAK_DATA_EVENT_REG
;
typedef
struct
_T_PNAK_DATA_IND_MASK
{
typedef
struct
_T_PNAK_DATA_IND_MASK
{
T_PNAK_DATA_EVENT_REG
EventMaskReg
;
}
PACK_WORD_ALIGNMENT
(
T_PNAK_DATA_IND_MASK
);
...
...
@@ -645,62 +668,69 @@ extern T_PNAK_RESULT pnak_stop_stack(unsigned short);
/*--- General interface functions -------------------------------------------*/
extern
T_PNAK_RESULT
pnak_wait_for_multiple_objects
(
unsigned
short
,
T_PNAK_WAIT_OBJECT
*
,
T_PNAK_TIMEOUT
);
extern
T_PNAK_RESULT
pnak_set_multiple_objects
(
unsigned
short
,
const
T_PNAK_WAIT_OBJECT
);
extern
T_PNAK_RESULT
pnak_mask_multiple_objects
(
unsigned
short
,
const
T_PNAK_WAIT_OBJECT
);
extern
T_PNAK_RESULT
pnak_wait_for_multiple_objects
(
unsigned
short
,
T_PNAK_WAIT_OBJECT
*
,
T_PNAK_TIMEOUT
);
extern
T_PNAK_RESULT
pnak_set_multiple_objects
(
unsigned
short
,
const
T_PNAK_WAIT_OBJECT
);
extern
T_PNAK_RESULT
pnak_mask_multiple_objects
(
unsigned
short
,
const
T_PNAK_WAIT_OBJECT
);
extern
T_PNAK_RESULT
pnak_get_exception
(
unsigned
short
,
T_PNAK_EXCEPTION
*
);
extern
T_PNAK_RESULT
pnak_get_version
(
unsigned
short
,
T_PNAK_VERSIONS
*
);
extern
T_PNAK_RESULT
pnak_snmp_get_data
(
unsigned
short
,
T_PNAK_OID
*
,
void
*
,
PN_U32
*
,
PN_U32
*
,
unsigned
char
,
PN_BOOL
);
extern
T_PNAK_RESULT
pnak_snmp_check_data
(
unsigned
short
,
T_PNAK_OID
*
,
void
*
,
PN_U32
,
PN_U32
,
unsigned
char
);
extern
T_PNAK_RESULT
pnak_snmp_set_data
(
unsigned
short
,
T_PNAK_OID
*
,
void
*
,
PN_U32
,
PN_U32
);
PN_U32
*
,
PN_U32
*
,
unsigned
char
,
PN_BOOL
);
extern
T_PNAK_RESULT
pnak_snmp_check_data
(
unsigned
short
,
T_PNAK_OID
*
,
void
*
,
PN_U32
,
PN_U32
,
unsigned
char
);
extern
T_PNAK_RESULT
pnak_snmp_set_data
(
unsigned
short
,
T_PNAK_OID
*
,
void
*
,
PN_U32
,
PN_U32
);
extern
T_PNAK_RESULT
pnak_retrigger_watchdog
(
unsigned
short
,
PN_U32
);
/*--- Service interface functions -------------------------------------------*/
extern
T_PNAK_RESULT
pnak_limit_number_parallel_services
(
unsigned
short
,
unsigned
short
,
unsigned
short
);
extern
T_PNAK_RESULT
pnak_limit_number_parallel_services
(
unsigned
short
,
unsigned
short
,
unsigned
short
);
extern
T_PNAK_RESULT
pnak_send_service_req_res
(
unsigned
short
,
const
T_PNAK_SERVICE_REQ_RES
*
);
extern
T_PNAK_RESULT
pnak_send_service_req_res
(
unsigned
short
,
const
T_PNAK_SERVICE_REQ_RES
*
);
extern
T_PNAK_RESULT
pnak_get_service_ind
(
unsigned
short
,
T_PNAK_SERVICE_IND
*
);
extern
T_PNAK_RESULT
pnak_get_service_con
(
unsigned
short
,
T_PNAK_SERVICE_CON
*
);
/*--- Event interface functions ---------------------------------------------*/
extern
T_PNAK_RESULT
pnak_set_mode
(
unsigned
short
,
const
T_PNAK_EVENT_SET_MODE
*
);
extern
T_PNAK_RESULT
pnak_set_device_state
(
unsigned
short
,
const
T_PNAK_EVENT_SET_DEVICE_STATE
*
);
extern
T_PNAK_RESULT
pnak_set_mode
(
unsigned
short
,
const
T_PNAK_EVENT_SET_MODE
*
);
extern
T_PNAK_RESULT
pnak_set_device_state
(
unsigned
short
,
const
T_PNAK_EVENT_SET_DEVICE_STATE
*
);
extern
T_PNAK_RESULT
pnak_get_state
(
unsigned
short
,
T_PNAK_EVENT_STATE
*
);
extern
T_PNAK_RESULT
pnak_get_device_state_ind
(
unsigned
short
,
T_PNAK_EVENT_DEVICE_STATE
*
);
extern
T_PNAK_RESULT
pnak_get_device_state_ind
(
unsigned
short
,
T_PNAK_EVENT_DEVICE_STATE
*
);
extern
T_PNAK_RESULT
pnak_get_alarm_ind
(
unsigned
short
,
T_PNAK_EVENT_ALARM
*
);
extern
T_PNAK_RESULT
pnak_get_alarm_ack_ind
(
unsigned
short
,
T_PNAK_EVENT_ALARM_ACK
*
);
extern
T_PNAK_RESULT
pnak_get_alarm_ack_ind
(
unsigned
short
,
T_PNAK_EVENT_ALARM_ACK
*
);
extern
T_PNAK_RESULT
pnak_get_ptcp_ind
(
unsigned
short
,
PN_U32
*
);
extern
T_PNAK_RESULT
pnak_get_mrpd_ind
(
unsigned
short
,
T_PNAK_EVENT_MRPD
*
);
/*--- Data interface functions ----------------------------------------------*/
extern
T_PNAK_RESULT
pnak_set_iocr_data
(
unsigned
short
,
unsigned
short
,
const
unsigned
char
*
,
unsigned
short
,
unsigned
char
);
const
unsigned
char
*
,
unsigned
short
,
unsigned
char
);
extern
T_PNAK_RESULT
pnak_get_iocr_data
(
unsigned
short
,
unsigned
short
,
unsigned
char
*
,
unsigned
short
*
,
unsigned
char
*
,
unsigned
char
*
);
extern
T_PNAK_RESULT
pnak_get_consumer_data_changed_ind
(
unsigned
short
,
T_PNAK_DATA_CONSUMER_DATA_CHANGED
*
);
extern
T_PNAK_RESULT
pnak_get_provider_data_updated
(
unsigned
short
,
T_PNAK_DATA_PROVIDER_DATA_UPDATED
*
);
unsigned
char
*
,
unsigned
short
*
,
unsigned
char
*
,
unsigned
char
*
);
extern
T_PNAK_RESULT
pnak_get_consumer_data_changed_ind
(
unsigned
short
,
T_PNAK_DATA_CONSUMER_DATA_CHANGED
*
);
extern
T_PNAK_RESULT
pnak_get_provider_data_updated
(
unsigned
short
,
T_PNAK_DATA_PROVIDER_DATA_UPDATED
*
);
/*=============================================================================
CALLBACK INTERFACE
...
...
@@ -710,36 +740,40 @@ typedef int (*T_PNAK_WAIT_OBJECT_CALLBACK)(unsigned short, T_PNAK_WAIT_OBJECT);
typedef
int
(
*
T_PNAK_HW_START_CALLBACK
)(
unsigned
short
,
T_PNAK_MODE_ID
,
void
*
);
typedef
void
(
*
T_PROVIDER_CALLBACK
)(
unsigned
short
,
unsigned
short
,
unsigned
char
*
,
unsigned
short
,
unsigned
char
*
);
unsigned
char
*
,
unsigned
short
,
unsigned
char
*
);
typedef
void
(
*
T_CONSUMER_CALLBACK
)(
unsigned
short
,
unsigned
short
,
const
unsigned
char
*
,
unsigned
short
,
unsigned
char
,
unsigned
char
);
const
unsigned
char
*
,
unsigned
short
,
unsigned
char
,
unsigned
char
);
extern
T_PNAK_RESULT
pnak_register_provider_callback
(
unsigned
short
,
T_PROVIDER_CALLBACK
);
extern
T_PNAK_RESULT
pnak_register_provider_callback
(
unsigned
short
,
T_PROVIDER_CALLBACK
);
extern
T_PNAK_RESULT
pnak_unregister_provider_callback
(
unsigned
short
);
extern
T_PNAK_RESULT
pnak_register_consumer_callback
(
unsigned
short
,
T_CONSUMER_CALLBACK
);
extern
T_PNAK_RESULT
pnak_register_consumer_callback
(
unsigned
short
,
T_CONSUMER_CALLBACK
);
extern
T_PNAK_RESULT
pnak_unregister_consumer_callback
(
unsigned
short
);
extern
T_PNAK_RESULT
pnak_register_ethernet_provider_hook
(
unsigned
short
,
T_PROVIDER_CALLBACK
);
extern
T_PNAK_RESULT
pnak_register_ethernet_provider_hook
(
unsigned
short
,
T_PROVIDER_CALLBACK
);
extern
T_PNAK_RESULT
pnak_unregister_ethernet_provider_hook
(
unsigned
short
);
/*---------------------------------------------------------------------------*/
typedef
void
(
*
T_PNAK_CMCTL_STATISTIC_CALLBACK
)(
unsigned
short
,
T_PNAK_CMCTL_STATISTIC
*
);
typedef
void
(
*
T_PNAK_CMCTL_STATISTIC_CALLBACK
)(
unsigned
short
,
T_PNAK_CMCTL_STATISTIC
*
);
extern
T_PNAK_RESULT
pnak_register_cmctl_statistic_callback
(
unsigned
short
,
T_PNAK_CMCTL_STATISTIC_CALLBACK
);
extern
T_PNAK_RESULT
pnak_register_cmctl_statistic_callback
(
unsigned
short
,
T_PNAK_CMCTL_STATISTIC_CALLBACK
);
extern
T_PNAK_RESULT
pnak_unregister_cmctl_statistic_callback
(
unsigned
short
);
typedef
void
(
*
T_PNAK_CMDEV_STATISTIC_CALLBACK
)(
unsigned
short
,
T_PNAK_CMDEV_STATISTIC
*
);
typedef
void
(
*
T_PNAK_CMDEV_STATISTIC_CALLBACK
)(
unsigned
short
,
T_PNAK_CMDEV_STATISTIC
*
);
extern
T_PNAK_RESULT
pnak_register_cmdev_statistic_callback
(
unsigned
short
,
T_PNAK_CMDEV_STATISTIC_CALLBACK
);
extern
T_PNAK_RESULT
pnak_register_cmdev_statistic_callback
(
unsigned
short
,
T_PNAK_CMDEV_STATISTIC_CALLBACK
);
extern
T_PNAK_RESULT
pnak_unregister_cmdev_statistic_callback
(
unsigned
short
);
#endif
/* __DOXYGEN__ */
...
...
@@ -838,13 +872,13 @@ SOCKET USER INTERFACE
(SOCK_FLAG_TYPE_TCP | 0x00000001uL)
/**< Enables keep-alive packets to \
supervise a TCP connection */
#define SOCK_FLAG_ENABLE_BROADCAST \
(SOCK_FLAG_TYPE_UDP
\
| 0x00000002uL)
/**< Enables the transmission of broadcast messages over
\
a UDP socket */
(SOCK_FLAG_TYPE_UDP
|
\
0x00000002uL)
/**< Enables the transmission of broadcast messages over
\
a UDP socket */
#define SOCK_FLAG_ENABLE_MULTICAST \
(SOCK_FLAG_TYPE_UDP
\
| 0x00000004uL)
/**< Enables the transmission of multicast messages over
\
a UDP socket */
(SOCK_FLAG_TYPE_UDP
|
\
0x00000004uL)
/**< Enables the transmission of multicast messages over
\
a UDP socket */
#define SOCK_FLAG_USER_MASK \
0x0000FFFFuL
/**< Specifies the bits wich are valid for the socket \
application */
...
...
@@ -859,12 +893,12 @@ SOCKET USER INTERFACE
*/
typedef
enum
_T_SOCKET_RESULT
{
SOCK_SUCCESS
=
0u
,
/**< General success return value */
SOCK_ERR_INVALID_ARGUMENT
,
/**< Passed argument is invalid */
SOCK_SUCCESS
=
0u
,
/**< General success return value */
SOCK_ERR_INVALID_ARGUMENT
,
/**< Passed argument is invalid */
SOCK_ERR_API_ALREADY_INITIALIZED
,
/**< Socket Interface already initialized */
SOCK_ERR_API_NOT_INITIALIZED
,
/**< Socket Interface not initialized */
SOCK_ERR_INVALID_SOCKET_ID
,
/**< The passed socket ID is invalid */
SOCK_ERR_OUT_OF_SOCKETS
,
/**< No free socket available */
SOCK_ERR_API_NOT_INITIALIZED
,
/**< Socket Interface not initialized */
SOCK_ERR_INVALID_SOCKET_ID
,
/**< The passed socket ID is invalid */
SOCK_ERR_OUT_OF_SOCKETS
,
/**< No free socket available */
SOCK_ERR_SOCKET_NOT_CREATED
,
/**< The specified socket has not been created.
*/
SOCK_ERR_SOCKET_OFFLINE
,
/**< The local port associated with the socket is not
...
...
@@ -879,15 +913,15 @@ typedef enum _T_SOCKET_RESULT {
SOCK_ERR_SOCKET_CONNECTED
,
/**< The request is rejected because the specified
TCP connection has established a connection
before the filter was activated. */
SOCK_ERR_ADDR_IN_USE
,
/**< The passed local address is already in use by
another socket. */
SOCK_ERR_INVALID_LOCAL_ADDR
,
/**< The passed local IP address is invalid. It
is not possible to bind the socket to this
address. Which IP addresses are allowed
depends on the socket configuration (e.g.
socket type UDP or TCP) and the network
settings adjusted by calling the function
sock_init(). */
SOCK_ERR_ADDR_IN_USE
,
/**< The passed local address is already in use by
another socket. */
SOCK_ERR_INVALID_LOCAL_ADDR
,
/**< The passed local IP address is invalid. It
is not possible to bind the socket to this
address. Which IP addresses are allowed
depends on the socket configuration (e.g.
socket type UDP or TCP) and the network
settings adjusted by calling the function
sock_init(). */
SOCK_ERR_INVALID_REMOTE_ADDR
,
/**< The passed remote IP address is invalid. It
is not possible to send or connect to this
address. Which IP addresses are allowed
...
...
@@ -895,15 +929,15 @@ typedef enum _T_SOCKET_RESULT {
socket type UDP or TCP) and the network
settings adjusted by calling the function
sock_init(). */
SOCK_ERR_NO_DATA_RECEIVED
,
/**< No data has been received on the specfied
socket or TCP connection. */
SOCK_ERR_NO_DATA_RECEIVED
,
/**< No data has been received on the specfied
socket or TCP connection. */
SOCK_ERR_NOT_SUPPORTED
,
/**< The requested action is not supported on the
specified socket. */
SOCK_ERR_TEMPORARY_NOT_EXECUTABLE
,
/**< The requested action is temporary not
executable on the specified socket due a
concurrent pending request. */
SOCK_ERR_FATAL_ERROR
,
/**< A fatal error is reported during execution of
function. */
SOCK_ERR_FATAL_ERROR
,
/**< A fatal error is reported during execution of
function. */
SOCK_ERR_LIBRARY_NOT_LOADED
/**< Can not load socket library */
}
T_SOCKET_RESULT
;
...
...
@@ -918,7 +952,7 @@ typedef enum _T_SOCKET_RESULT {
unknown. */
#define SOCK_PORT_ANY \
0u
/**< Can be used as local port when creating a TCP Client socket to let \
the TCP/IP stack select a unique local port from the dynamic client
\
the TCP/IP stack select a unique local port from the dynamic client \
port range. */
/** @} */
...
...
@@ -931,7 +965,8 @@ typedef enum _T_SOCKET_RESULT {
* (big-endian).
*/
typedef
struct
_T_PNAK_SOCK_ADDR
{
typedef
struct
_T_PNAK_SOCK_ADDR
{
PN_U32
IpAddress
;
/**< IP address */
unsigned
short
Port
;
/**< port number */
...
...
@@ -948,18 +983,19 @@ typedef struct _T_PNAK_SOCK_ADDR {
* @{
* \brief Configurable Options for the socket interface
*/
typedef
struct
_T_PNAK_SOCK_CONFIG_OPTIONS
{
typedef
struct
_T_PNAK_SOCK_CONFIG_OPTIONS
{
PN_U32
Timeout
;
/**< Keep-Alive Timeout in milliseconds. The Keep-Alive Timeout
will be used for the supervision of TCP connections. The
connection will be aborted if the remote connection partner
did not show activity within this timeout. The supervision of
TCP connections can be enabled/disabled socket-specific when
creating the socket by calling sock_create(). For UDP
sockets the application needs to perform a supervision if
necessary. If the timeout value is set to 0 and
#SOCK_FLAG_ENABLE_KEEPALIVE is set when creating a socket, a
default value for the Keep-Alive Timeout will be used. */
Timeout
;
/**< Keep-Alive Timeout in milliseconds. The Keep-Alive Timeout
will be used for the supervision of TCP connections. The
connection will be aborted if the remote connection partner
did not show activity within this timeout. The supervision of
TCP connections can be enabled/disabled socket-specific when
creating the socket by calling sock_create(). For UDP
sockets the application needs to perform a supervision if
necessary. If the timeout value is set to 0 and
#SOCK_FLAG_ENABLE_KEEPALIVE is set when creating a socket, a
default value for the Keep-Alive Timeout will be used. */
}
PACK_WORD_ALIGNMENT
(
T_PNAK_SOCK_CONFIG_OPTIONS
);
...
...
@@ -973,8 +1009,9 @@ typedef struct _T_PNAK_SOCK_CONFIG_OPTIONS {
* All of the structure data must be specified in network-byte-order
* (big-endian).
*/
typedef
struct
_T_PNAK_SOCK_NETWORK_SETTINGS
{
PN_U32
IpAddress
;
/**< The IP-Address of the Device. For future use only. */
typedef
struct
_T_PNAK_SOCK_NETWORK_SETTINGS
{
PN_U32
IpAddress
;
/**< The IP-Address of the Device. For future use only. */
PN_U32
SubnetMask
;
/**< The Netmask of the Device. For future use only. */
PN_U32
GatewayAddress
;
/**< The Gateway of the Device. For future use only. */
...
...
@@ -992,11 +1029,12 @@ typedef struct _T_PNAK_SOCK_NETWORK_SETTINGS {
* @{
* \brief This structure holds the initialization data for the socket interface
*/
typedef
struct
_T_PNAK_SOCK_INIT
{
typedef
struct
_T_PNAK_SOCK_INIT
{
T_PNAK_SOCK_NETWORK_SETTINGS
NetworkSettings
;
/**< Network specific parameter */
NetworkSettings
;
/**< Network specific parameter */
T_PNAK_SOCK_CONFIG_OPTIONS
ConfigOptions
;
/**< Configurable Options for the socket interface */
ConfigOptions
;
/**< Configurable Options for the socket interface */
}
PACK_WORD_ALIGNMENT
(
T_PNAK_SOCK_INIT
);
/** @} */
...
...
@@ -1037,14 +1075,14 @@ typedef struct _T_PNAK_SOCK_INIT {
crashed. */
#define SOCK_TCP_CONNECTION_STATUS_CODE_TIMEOUT \
0x00000004uL
/**< The connection has been aborted because of a network \
failure or because the remote connection partner failed to
\
failure or because the remote connection partner failed to \
respond within the configured supervision timeout (see also \
T_PNAK_SOCK_CONFIG_OPTIONS). */
#define SOCK_TCP_CONNECTION_STATUS_CODE_CONNECT_REJECTED \
0x00000005uL
/**< It was not possible to establish a connection because the \
destination host rejected the connect request, e.g. because
\
destination host rejected the connect request, e.g. because \
the remote port is closed. This error only occurs for a TCP \
client socket. To retry connection establishment the
\
client socket. To retry connection establishment the \
application has to close the socket and re-create the socket \
again. */
/** @} */
...
...
@@ -1054,14 +1092,15 @@ typedef struct _T_PNAK_SOCK_INIT {
* @{
* \brief This structure holds status informations about a single TCP connection
*/
typedef
struct
_T_PNAK_SOCK_TCP_CONNECTION_LOCAL_STATUS
{
PN_U32
Status
;
/**< Local status of the TCP connection. Valid values: \ref
ConnectionStatus */
typedef
struct
_T_PNAK_SOCK_TCP_CONNECTION_LOCAL_STATUS
{
PN_U32
Status
;
/**< Local status of the TCP connection. Valid values: \ref
ConnectionStatus */
PN_U32
StatusCode
;
/**< Indicates the last error of the TCP connection. Valid
values: \ref ConnectionStatusCode */
T_PNAK_SOCK_ADDR
RemoteAddr
;
/**< Address information of the remote connection partner */
RemoteAddr
;
/**< Address information of the remote connection partner */
}
PACK_WORD_ALIGNMENT
(
T_PNAK_SOCK_TCP_CONNECTION_LOCAL_STATUS
);
...
...
@@ -1072,7 +1111,8 @@ typedef struct _T_PNAK_SOCK_TCP_CONNECTION_LOCAL_STATUS {
* \brief This structure holds status informations about all TCP connections of
* a socket
*/
typedef
struct
_T_PNAK_SOCK_TCP_LOCAL_STATUS_DATA
{
typedef
struct
_T_PNAK_SOCK_TCP_LOCAL_STATUS_DATA
{
PN_U32
NumberConnections
;
/**< Number of TCP connection for which status info
is provided */
...
...
@@ -1088,8 +1128,9 @@ typedef struct _T_PNAK_SOCK_TCP_LOCAL_STATUS_DATA {
* Status of a socket
* @{
*/
#define SOCK_LOCAL_STATUS_CLOSED 0x00000001uL
/**< The local socket is closed \
*/
#define SOCK_LOCAL_STATUS_CLOSED \
0x00000001uL
/**< The local socket is closed \
*/
#define SOCK_LOCAL_STATUS_OFFLINE \
0x00000002uL
/**< The local port associated with the socket is not open. \
Sending/Receiving of messages is not possible. */
...
...
@@ -1116,15 +1157,16 @@ typedef struct _T_PNAK_SOCK_TCP_LOCAL_STATUS_DATA {
* @{
* \brief This structure holds status informations about a socket
*/
typedef
struct
_T_PNAK_SOCK_IOC_GET_LOCAL_STATUS
{
PN_U32
Status
;
/**< Common socket status information. Valid values: \ref
SocketStatus */
typedef
struct
_T_PNAK_SOCK_IOC_GET_LOCAL_STATUS
{
PN_U32
Status
;
/**< Common socket status information. Valid values: \ref
SocketStatus */
PN_U32
StatusCode
;
/**< Common socket error code. Valid values: \ref
SocketStatusCode */
union
{
T_PNAK_SOCK_TCP_LOCAL_STATUS_DATA
Tcp
;
/**< TCP specific socket status information */
Tcp
;
/**< TCP specific socket status information */
/* UDP specific socket status information not existing */
}
UseAs
;
...
...
@@ -1160,7 +1202,7 @@ typedef struct _T_PNAK_SOCK_IOC_GET_LOCAL_STATUS {
host is down */
#define SOCK_SEND_STATUS_CODE_REJECTED \
0x00000003uL
/**< The destination host rejected the message, e.g. remote \
port is closed. This error can only be returned by TCP
\
port is closed. This error can only be returned by TCP \
sockets. */
#define SOCK_SEND_STATUS_CODE_SEND_ERROR \
0x00000004uL
/**< The TCP/IP stack reported a general problem sending the \
...
...
@@ -1172,9 +1214,10 @@ typedef struct _T_PNAK_SOCK_IOC_GET_LOCAL_STATUS {
* @{
* \brief This structure holds TCP specific send status informations
*/
typedef
struct
_T_PNAK_SOCK_TCP_SEND_STATUS_DATA
{
typedef
struct
_T_PNAK_SOCK_TCP_SEND_STATUS_DATA
{
T_PNAK_SOCK_ADDR
RemoteAddr
;
/**< Address information of the remote connection partner */
RemoteAddr
;
/**< Address information of the remote connection partner */
}
PACK_WORD_ALIGNMENT
(
T_PNAK_SOCK_TCP_SEND_STATUS_DATA
);
...
...
@@ -1184,15 +1227,16 @@ typedef struct _T_PNAK_SOCK_TCP_SEND_STATUS_DATA {
* @{
* \brief This structure holds send status informations
*/
typedef
struct
_T_PNAK_SOCK_IOC_GET_SEND_STATUS
{
PN_U32
Status
;
/**< Common send status information. Valid values: \ref
SendStatus */
typedef
struct
_T_PNAK_SOCK_IOC_GET_SEND_STATUS
{
PN_U32
Status
;
/**< Common send status information. Valid values: \ref
SendStatus */
PN_U32
StatusCode
;
/**< Common send error code. Valid values: \ref
SendStatusCode */
union
{
T_PNAK_SOCK_TCP_SEND_STATUS_DATA
Tcp
;
/**< TCP specific send status information */
Tcp
;
/**< TCP specific send status information */
/* UDP specific send status information not existing */
}
UseAs
;
...
...
@@ -1221,8 +1265,9 @@ typedef struct _T_PNAK_SOCK_IOC_GET_SEND_STATUS {
* Receive Error Codes
* @{
*/
#define SOCK_RECEIVE_STATUS_CODE_NO_ERROR 0x00000000uL
/**< No error detected \
*/
#define SOCK_RECEIVE_STATUS_CODE_NO_ERROR \
0x00000000uL
/**< No error detected \
*/
/** @} */
/** @} */
...
...
@@ -1230,9 +1275,10 @@ typedef struct _T_PNAK_SOCK_IOC_GET_SEND_STATUS {
* @{
* \brief This structure holds TCP specific receive status informations
*/
typedef
struct
_T_PNAK_SOCK_TCP_RECEIVE_STATUS_DATA
{
typedef
struct
_T_PNAK_SOCK_TCP_RECEIVE_STATUS_DATA
{
T_PNAK_SOCK_ADDR
RemoteAddr
;
/**< Address information of the remote connection partner */
RemoteAddr
;
/**< Address information of the remote connection partner */
}
PACK_WORD_ALIGNMENT
(
T_PNAK_SOCK_TCP_RECEIVE_STATUS_DATA
);
...
...
@@ -1242,15 +1288,16 @@ typedef struct _T_PNAK_SOCK_TCP_RECEIVE_STATUS_DATA {
* @{
* \brief This structure holds receive status informations
*/
typedef
struct
_T_PNAK_SOCK_IOC_GET_RECEIVE_STATUS
{
PN_U32
Status
;
/**< Common receive status information. Valid values: \ref
ReceiveStatus */
typedef
struct
_T_PNAK_SOCK_IOC_GET_RECEIVE_STATUS
{
PN_U32
Status
;
/**< Common receive status information. Valid values: \ref
ReceiveStatus */
PN_U32
StatusCode
;
/**< Common receive error code. Valid values: \ref
ReceiveStatusCode */
union
{
T_PNAK_SOCK_TCP_RECEIVE_STATUS_DATA
Tcp
;
/**< TCP specific receive status information */
Tcp
;
/**< TCP specific receive status information */
/* UDP specific send status information not existing */
}
UseAs
;
...
...
@@ -1265,9 +1312,10 @@ typedef struct _T_PNAK_SOCK_IOC_GET_RECEIVE_STATUS {
* @{
* \brief This structure specifies the TCP connection which shall be aborted
*/
typedef
struct
_T_PNAK_SOCK_IOC_CLOSE_TCP_CONNECTION
{
typedef
struct
_T_PNAK_SOCK_IOC_CLOSE_TCP_CONNECTION
{
T_PNAK_SOCK_ADDR
RemoteAddr
;
/**< Address information of the remote connection partner */
RemoteAddr
;
/**< Address information of the remote connection partner */
}
PACK_WORD_ALIGNMENT
(
T_PNAK_SOCK_IOC_CLOSE_TCP_CONNECTION
);
...
...
@@ -1282,7 +1330,8 @@ typedef struct _T_PNAK_SOCK_IOC_CLOSE_TCP_CONNECTION {
* \brief This structure specifies the IP addresses from which a connection
* establishment shall be accepted
*/
typedef
struct
_T_PNAK_SOCK_IOC_TCP_ACCEPT_FILTER
{
typedef
struct
_T_PNAK_SOCK_IOC_TCP_ACCEPT_FILTER
{
PN_U16
NumberEntries
;
/**< number of filter entries */
PN_U16
Alignment
;
...
...
@@ -1299,7 +1348,8 @@ typedef struct _T_PNAK_SOCK_IOC_TCP_ACCEPT_FILTER {
* \brief This structure specifies the IP addresses of the multicast group the
* application wants to join or leave
*/
typedef
struct
_T_PNAK_SOCK_IOC_MULTICAST
{
typedef
struct
_T_PNAK_SOCK_IOC_MULTICAST
{
PN_U32
IpAddress
;
}
PACK_WORD_ALIGNMENT
(
T_PNAK_SOCK_IOC_MULTICAST
);
...
...
@@ -1323,8 +1373,9 @@ typedef struct _T_PNAK_SOCK_IOC_MULTICAST {
#define SOCK_IOC_TCP_ACCEPT_FILTER \
0x00000005uL
/**< Defines which IP Addresses are accepted by the socket */
#define SOCK_IOC_UDP_ADD_MULTICAST 0x00000006uL
/**< Join a multicast group */
#define SOCK_IOC_UDP_DEL_MULTICAST 0x00000007uL
/**< Leave a multicast group \
*/
#define SOCK_IOC_UDP_DEL_MULTICAST \
0x00000007uL
/**< Leave a multicast group \
*/
/** @} */
/** @} */
...
...
@@ -1332,22 +1383,23 @@ typedef struct _T_PNAK_SOCK_IOC_MULTICAST {
* @{
* \brief This structure holds the data for an IO Control Command
*/
typedef
struct
_T_PNAK_SOCK_IO_CONTROL
{
typedef
struct
_T_PNAK_SOCK_IO_CONTROL
{
PN_U32
Command
;
/**< Specifies the IO Control Command. Valid values: \ref
IoctlCommand */
union
{
T_PNAK_SOCK_IOC_GET_LOCAL_STATUS
GetLocalStatus
;
/**< Local Socket Status informations */
GetLocalStatus
;
/**< Local Socket Status informations */
T_PNAK_SOCK_IOC_GET_SEND_STATUS
GetSendStatus
;
/**< Send Status informations */
GetSendStatus
;
/**< Send Status informations */
T_PNAK_SOCK_IOC_GET_RECEIVE_STATUS
GetReceiveStatus
;
/**< Receive Status informations */
GetReceiveStatus
;
/**< Receive Status informations */
T_PNAK_SOCK_IOC_CLOSE_TCP_CONNECTION
CloseTcpConnection
;
/**< TCP connection which shall be closed */
CloseTcpConnection
;
/**< TCP connection which shall be closed */
T_PNAK_SOCK_IOC_TCP_ACCEPT_FILTER
TcpAcceptFilter
;
/**< IP Address which shall be able to connect to the
server */
TcpAcceptFilter
;
/**< IP Address which shall be able to connect to the
server */
T_PNAK_SOCK_IOC_MULTICAST
AddMulticast
;
/**< Multicast group to join */
T_PNAK_SOCK_IOC_MULTICAST
DelMulticast
;
/**< Multicast group to leave */
...
...
@@ -1375,19 +1427,22 @@ extern T_SOCKET_RESULT pnak_sock_term(unsigned short);
/*--- socket interface functions --------------------------------------------*/
extern
T_SOCKET_RESULT
pnak_sock_create
(
unsigned
short
,
PN_U32
,
T_PNAK_SOCK_ADDR
*
,
T_PNAK_SOCK_ADDR
*
,
unsigned
short
*
);
T_PNAK_SOCK_ADDR
*
,
T_PNAK_SOCK_ADDR
*
,
unsigned
short
*
);
extern
T_SOCKET_RESULT
pnak_sock_close
(
unsigned
short
,
unsigned
short
);
extern
T_SOCKET_RESULT
pnak_sock_send
(
unsigned
short
,
unsigned
short
,
T_PNAK_SOCK_ADDR
*
,
PN_U16
,
const
unsigned
char
*
);
extern
T_SOCKET_RESULT
pnak_sock_receive
(
unsigned
short
,
unsigned
short
,
T_PNAK_SOCK_ADDR
*
,
PN_U16
*
,
unsigned
char
*
);
extern
T_SOCKET_RESULT
pnak_sock_ioctl
(
unsigned
short
,
unsigned
short
,
T_PNAK_SOCK_IO_CONTROL
*
);
T_PNAK_SOCK_ADDR
*
,
PN_U16
,
const
unsigned
char
*
);
extern
T_SOCKET_RESULT
pnak_sock_receive
(
unsigned
short
,
unsigned
short
,
T_PNAK_SOCK_ADDR
*
,
PN_U16
*
,
unsigned
char
*
);
extern
T_SOCKET_RESULT
pnak_sock_ioctl
(
unsigned
short
,
unsigned
short
,
T_PNAK_SOCK_IO_CONTROL
*
);
/*--- socket interface helper functions -------------------------------------*/
extern
T_SOCKET_RESULT
pnak_sock_get_receive_status
(
unsigned
short
,
T_BITSET_64
*
);
extern
T_SOCKET_RESULT
pnak_sock_get_receive_status
(
unsigned
short
,
T_BITSET_64
*
);
#endif
/* __DOXYGEN__ */
...
...
profibus/lib/rt/src/rt_profinet.h
View file @
df0831a3
...
...
@@ -160,10 +160,10 @@ DEFINES
#define PROFINET_AR_PROPERTY_DATA_RATE_1GBIT 0x00000040uL
#define PROFINET_AR_PROPERTY_DATA_RATE_10GBIT 0x00000060uL
#define PROFINET_AR_PROPERTY_DATA_RATE_MASK \
(PROFINET_AR_PROPERTY_DATA_RATE_AT_LEAST_100MBIT
\
| PROFINET_AR_PROPERTY_DATA_RATE_100MBIT
\
| PROFINET_AR_PROPERTY_DATA_RATE_1GBIT
\
|
PROFINET_AR_PROPERTY_DATA_RATE_10GBIT)
(PROFINET_AR_PROPERTY_DATA_RATE_AT_LEAST_100MBIT
|
\
PROFINET_AR_PROPERTY_DATA_RATE_100MBIT |
\
PROFINET_AR_PROPERTY_DATA_RATE_1GBIT |
\
PROFINET_AR_PROPERTY_DATA_RATE_10GBIT)
#define PROFINET_AR_PROPERTY_ACCESS_BY_EXP_SUB_BLOCK 0x00000000uL
#define PROFINET_AR_PROPERTY_ACCESS_BY_DEVICE 0x00000100uL
#define PROFINET_AR_PROPERTY_COMPANION_SINGLE_AR 0x00000000uL
...
...
@@ -174,21 +174,22 @@ DEFINES
#define PROFINET_AR_PROPERTY_STARTUP_MODE_LEGACY 0x00000000uL
#define PROFINET_AR_PROPERTY_STARTUP_MODE_ADVANCED 0x40000000uL
#define PROFINET_AR_PROPERTY_STARTUP_MODE_MASK \
(PROFINET_AR_PROPERTY_STARTUP_MODE_LEGACY
\
|
PROFINET_AR_PROPERTY_STARTUP_MODE_ADVANCED)
(PROFINET_AR_PROPERTY_STARTUP_MODE_LEGACY
|
\
PROFINET_AR_PROPERTY_STARTUP_MODE_ADVANCED)
#define PROFINET_AR_PROPERTY_PULL_MODULE_ALARM_ALLOWED 0x80000000uL
#define PROFINET_AR_PROPERTY_MASK \
(PROFINET_AR_PROPERTY_STATE_MASK | PROFINET_AR_PROPERTY_TAKEOVER_NOT_ALLOWED \
| PROFINET_AR_PROPERTY_TAKEOVER_ALLOWED \
| PROFINET_AR_PROPERTY_PARAMETER_SERVER_EXT \
| PROFINET_AR_PROPERTY_PARAMETER_SERVER_CM \
| PROFINET_AR_PROPERTY_DATA_RATE_MASK \
| PROFINET_AR_PROPERTY_ACCESS_BY_EXP_SUB_BLOCK \
| PROFINET_AR_PROPERTY_ACCESS_BY_DEVICE \
| PROFINET_AR_PROPERTY_COMPANION_SINGLE_AR \
| PROFINET_AR_PROPERTY_COMPANION_AR_WITHOUT_ACK \
| PROFINET_AR_PROPERTY_STARTUP_MODE_MASK \
| PROFINET_AR_PROPERTY_PULL_MODULE_ALARM_ALLOWED)
(PROFINET_AR_PROPERTY_STATE_MASK | \
PROFINET_AR_PROPERTY_TAKEOVER_NOT_ALLOWED | \
PROFINET_AR_PROPERTY_TAKEOVER_ALLOWED | \
PROFINET_AR_PROPERTY_PARAMETER_SERVER_EXT | \
PROFINET_AR_PROPERTY_PARAMETER_SERVER_CM | \
PROFINET_AR_PROPERTY_DATA_RATE_MASK | \
PROFINET_AR_PROPERTY_ACCESS_BY_EXP_SUB_BLOCK | \
PROFINET_AR_PROPERTY_ACCESS_BY_DEVICE | \
PROFINET_AR_PROPERTY_COMPANION_SINGLE_AR | \
PROFINET_AR_PROPERTY_COMPANION_AR_WITHOUT_ACK | \
PROFINET_AR_PROPERTY_STARTUP_MODE_MASK | \
PROFINET_AR_PROPERTY_PULL_MODULE_ALARM_ALLOWED)
/*===========================================================================*/
...
...
@@ -204,8 +205,8 @@ DEFINES
#define PROFINET_IO_CR_RT_CLASS3 0x00000003uL
#define PROFINET_IO_CR_RT_CLASS_UDP 0x00000004uL
#define PROFINET_IO_CR_RT_CLASS_MASK \
(PROFINET_IO_CR_RT_CLASS1 | PROFINET_IO_CR_RT_CLASS2
\
|
PROFINET_IO_CR_RT_CLASS3 | PROFINET_IO_CR_RT_CLASS_UDP)
(PROFINET_IO_CR_RT_CLASS1 | PROFINET_IO_CR_RT_CLASS2
|
\
PROFINET_IO_CR_RT_CLASS3 | PROFINET_IO_CR_RT_CLASS_UDP)
#define PROFINET_IO_CR_PROPERTIES_RESERVED_MASK 0xFF001FF0uL
/*---------------------------------------------------------------------------*/
...
...
@@ -242,8 +243,8 @@ DEFINES
#define PROFINET_IO_CR_TAG_DEFAULT_VLAN 0x0001uL
#define PROFINET_IO_CR_TAG_USER_PRIORITY 0xC000uL
#define PROFINET_IO_CR_TAG_MASK \
(PROFINET_IO_CR_TAG_NO_VLAN | PROFINET_IO_CR_TAG_DEFAULT_VLAN
\
|
PROFINET_IO_CR_TAG_USER_PRIORITY)
(PROFINET_IO_CR_TAG_NO_VLAN | PROFINET_IO_CR_TAG_DEFAULT_VLAN
|
\
PROFINET_IO_CR_TAG_USER_PRIORITY)
#define PROFINET_IO_CR_MIN_FRAME_SEND_OFFSET 0x00000000uL
#define PROFINET_IO_CR_MAX_FRAME_SEND_OFFSET 0x003D08FFuL
...
...
@@ -281,9 +282,9 @@ DEFINES
#define PROFINET_MODULE_STATE_PROPER_MODULE 0x0002u
#define PROFINET_MODULE_STATE_SUBSTITUTE_MODULE 0x0003u
#define PROFINET_MODULE_STATE_MASK \
(PROFINET_MODULE_STATE_NO_MODULE | PROFINET_MODULE_STATE_WRONG_MODULE
\
| PROFINET_MODULE_STATE_PROPER_MODULE
\
|
PROFINET_MODULE_STATE_SUBSTITUTE_MODULE)
(PROFINET_MODULE_STATE_NO_MODULE | PROFINET_MODULE_STATE_WRONG_MODULE
|
\
PROFINET_MODULE_STATE_PROPER_MODULE |
\
PROFINET_MODULE_STATE_SUBSTITUTE_MODULE)
/*===========================================================================*/
...
...
@@ -307,9 +308,9 @@ DEFINES
#define PROFINET_IO_SUBMODULE_TYPE_OUTPUT 0x0002u
#define PROFINET_IO_SUBMODULE_TYPE_INPUT_AND_OUTPUT 0x0003u
#define PROFINET_IO_SUBMODULE_TYPE_IO_MASK \
(PROFINET_IO_SUBMODULE_TYPE_NO_INPUT_NO_OUTPUT
\
| PROFINET_IO_SUBMODULE_TYPE_INPUT | PROFINET_IO_SUBMODULE_TYPE_OUTPUT
\
|
PROFINET_IO_SUBMODULE_TYPE_INPUT_AND_OUTPUT)
(PROFINET_IO_SUBMODULE_TYPE_NO_INPUT_NO_OUTPUT
|
\
PROFINET_IO_SUBMODULE_TYPE_INPUT | PROFINET_IO_SUBMODULE_TYPE_OUTPUT |
\
PROFINET_IO_SUBMODULE_TYPE_INPUT_AND_OUTPUT)
#define PROFINET_IO_SUBMODULE_TYPE_SHARED_INPUT 0x0004u
#define PROFINET_IO_SUBMODULE_TYPE_NORMAL_INPUT 0x0000u
...
...
@@ -320,14 +321,14 @@ DEFINES
#define PROFINET_IO_SUBMODULE_TYPE_DISCARD_IOXS 0x0020u
#define PROFINET_IO_SUBMODULE_TYPE_MASK \
(PROFINET_IO_SUBMODULE_TYPE_IO_MASK
\
| PROFINET_IO_SUBMODULE_TYPE_SHARED_INPUT
\
| PROFINET_IO_SUBMODULE_TYPE_NORMAL_INPUT
\
| PROFINET_IO_SUBMODULE_TYPE_REDUCED_INPUT
\
| PROFINET_IO_SUBMODULE_TYPE_NORMAL_OUTPUT
\
| PROFINET_IO_SUBMODULE_TYPE_REDUCED_OUTPUT
\
| PROFINET_IO_SUBMODULE_TYPE_NORMAL_IOXS
\
|
PROFINET_IO_SUBMODULE_TYPE_DISCARD_IOXS)
(PROFINET_IO_SUBMODULE_TYPE_IO_MASK
|
\
PROFINET_IO_SUBMODULE_TYPE_SHARED_INPUT |
\
PROFINET_IO_SUBMODULE_TYPE_NORMAL_INPUT |
\
PROFINET_IO_SUBMODULE_TYPE_REDUCED_INPUT |
\
PROFINET_IO_SUBMODULE_TYPE_NORMAL_OUTPUT |
\
PROFINET_IO_SUBMODULE_TYPE_REDUCED_OUTPUT |
\
PROFINET_IO_SUBMODULE_TYPE_NORMAL_IOXS |
\
PROFINET_IO_SUBMODULE_TYPE_DISCARD_IOXS)
/*===========================================================================*/
...
...
@@ -350,11 +351,10 @@ DEFINES
#define CYCLIC_DATA_STATUS_NORMAL_OPERATION 0x20u
#define CYCLIC_DATA_STATUS_PROBLEM_DETECTED 0x00u
#define CYCLIC_DATA_STATUS_MASK \
(CYCLIC_DATA_STATUS_STATE_PRIMARY | CYCLIC_DATA_STATUS_STATE_BACKUP \
| CYCLIC_DATA_STATUS_DATA_VALID | CYCLIC_DATA_STATUS_DATA_INVALID \
| CYCLIC_DATA_STATUS_STATE_RUN | CYCLIC_DATA_STATUS_STATE_STOP \
| CYCLIC_DATA_STATUS_NORMAL_OPERATION \
| CYCLIC_DATA_STATUS_PROBLEM_DETECTED)
(CYCLIC_DATA_STATUS_STATE_PRIMARY | CYCLIC_DATA_STATUS_STATE_BACKUP | \
CYCLIC_DATA_STATUS_DATA_VALID | CYCLIC_DATA_STATUS_DATA_INVALID | \
CYCLIC_DATA_STATUS_STATE_RUN | CYCLIC_DATA_STATUS_STATE_STOP | \
CYCLIC_DATA_STATUS_NORMAL_OPERATION | CYCLIC_DATA_STATUS_PROBLEM_DETECTED)
/*===========================================================================*/
...
...
@@ -404,12 +404,12 @@ DEFINES
#define PROFINET_MC_CR_ADDR_RESOLUTION_MIN_FACTOR 0x00010000uL
#define PROFINET_MC_CR_ADDR_RESOLUTION_MAX_FACTOR 0xFFFF0000uL
#define PROFINET_MC_CR_ADDR_RESOLUTION_FACTOR_MASK \
(PROFINET_MC_CR_ADDR_RESOLUTION_MIN_FACTOR
\
|
PROFINET_MC_CR_ADDR_RESOLUTION_MAX_FACTOR)
(PROFINET_MC_CR_ADDR_RESOLUTION_MIN_FACTOR
|
\
PROFINET_MC_CR_ADDR_RESOLUTION_MAX_FACTOR)
#define PROFINET_MC_CR_MASK \
(PROFINET_MC_CR_ADDR_RESOLUTION_MASK
\
|
PROFINET_MC_CR_ADDR_RESOLUTION_FACTOR_MASK)
(PROFINET_MC_CR_ADDR_RESOLUTION_MASK
|
\
PROFINET_MC_CR_ADDR_RESOLUTION_FACTOR_MASK)
/*---------------------------------------------------------------------------*/
...
...
@@ -482,7 +482,8 @@ DEFINES
/*===========================================================================*/
typedef
struct
_T_PN_MAC_ADDRESS
{
typedef
struct
_T_PN_MAC_ADDRESS
{
PN_U8
HighAndVersionHighByte
;
PN_U8
HighAndVersionLowByte
;
...
...
@@ -496,7 +497,8 @@ typedef struct _T_PN_MAC_ADDRESS {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_UUID
{
typedef
struct
_T_PROFINET_UUID
{
PN_U8
TimeLowHighWordHighByte
;
PN_U8
TimeLowHighWordLowByte
;
PN_U8
TimeLowLowWordHighByte
;
...
...
@@ -625,7 +627,8 @@ typedef struct _T_PROFINET_UUID {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_ERROR_CON
{
typedef
struct
_T_PN_SERVICE_ERROR_CON
{
PN_U8
Code
;
PN_U8
Detail
;
...
...
@@ -639,15 +642,16 @@ typedef struct _T_PN_SERVICE_ERROR_CON {
#define PROFINET_IO_MCR_FRAME_ID_RT_CLASS1_BASE (PN_U16)0xF800u
#define PROFINET_IO_MCR_FRAME_ID_RT_CLASS1_NUMBER_IDS (PN_U16)0x03FFu
#define PROFINET_IO_MCR_FRAME_ID_RT_CLASS1_HIGHEST_FRAME_ID \
(PN_U16)(PROFINET_IO_MCR_FRAME_ID_RT_CLASS1_BASE
\
+
PROFINET_IO_MCR_FRAME_ID_RT_CLASS1_NUMBER_IDS)
(PN_U16)(PROFINET_IO_MCR_FRAME_ID_RT_CLASS1_BASE
+
\
PROFINET_IO_MCR_FRAME_ID_RT_CLASS1_NUMBER_IDS)
#define PROFINET_IO_MCR_FRAME_ID_RT_CLASS2_BASE (PN_U16)0xBC00u
#define PROFINET_IO_MCR_FRAME_ID_RT_CLASS2_NUMBER_IDS (PN_U16)0x03FFu
#define PROFINET_IO_MCR_FRAME_ID_RT_CLASS2_HIGHEST_FRAME_ID \
(PN_U16)(PROFINET_IO_MCR_FRAME_ID_RT_CLASS2_BASE
\
+
PROFINET_IO_MCR_FRAME_ID_RT_CLASS2_NUMBER_IDS)
(PN_U16)(PROFINET_IO_MCR_FRAME_ID_RT_CLASS2_BASE
+
\
PROFINET_IO_MCR_FRAME_ID_RT_CLASS2_NUMBER_IDS)
typedef
struct
_T_PN_MCR_PROVIDER
{
typedef
struct
_T_PN_MCR_PROVIDER
{
PN_U8
FrameIdHighByte
;
PN_U8
FrameIdLowByte
;
...
...
@@ -655,7 +659,8 @@ typedef struct _T_PN_MCR_PROVIDER {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_MCR_CONSUMER
{
typedef
struct
_T_PN_MCR_CONSUMER
{
PN_U8
FrameIdHighByte
;
PN_U8
FrameIdLowByte
;
...
...
@@ -680,20 +685,21 @@ typedef struct _T_PN_MCR_CONSUMER {
#define PROFINET_IO_CR_FRAME_ID_RT_CLASS3_BASE (PN_U16)0x0100u
#define PROFINET_IO_CR_FRAME_ID_RT_CLASS3_NUMBER_IDS (PN_U16)0x05FFu
#define PROFINET_IO_CR_FRAME_ID_RT_CLASS3_HIGHEST_FRAME_ID \
(PN_U16)(PROFINET_IO_CR_FRAME_ID_RT_CLASS3_BASE
\
+
PROFINET_IO_CR_FRAME_ID_RT_CLASS3_NUMBER_IDS)
(PN_U16)(PROFINET_IO_CR_FRAME_ID_RT_CLASS3_BASE
+
\
PROFINET_IO_CR_FRAME_ID_RT_CLASS3_NUMBER_IDS)
#define PROFINET_IO_CR_FRAME_ID_RT_CLASS3_MRPD_BASE (PN_U16)0x0700u
#define PROFINET_IO_CR_FRAME_ID_RT_CLASS3_MRPD_NUMBER_IDS (PN_U16)0x08FFu
#define PROFINET_IO_CR_FRAME_ID_RT_CLASS3_MRPD_HIGHEST_FRAME_ID \
(PN_U16)(PROFINET_IO_CR_FRAME_ID_RT_CLASS3_MRPD_BASE
\
+
PROFINET_IO_CR_FRAME_ID_RT_CLASS3_MRPD_NUMBER_IDS)
(PN_U16)(PROFINET_IO_CR_FRAME_ID_RT_CLASS3_MRPD_BASE
+
\
PROFINET_IO_CR_FRAME_ID_RT_CLASS3_MRPD_NUMBER_IDS)
typedef
T_PN_MCR_PROVIDER
T_PN_RTC3_PROVIDER
;
typedef
T_PN_MCR_PROVIDER
T_PN_RTC3_CONSUMER
;
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_ALARM_CR
{
typedef
struct
_T_PN_ALARM_CR
{
PN_U8
VersionHighByte
;
PN_U8
VersionLowByte
;
...
...
@@ -721,7 +727,8 @@ typedef struct _T_PN_ALARM_CR {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_REFERENCE
{
typedef
struct
_T_PN_REFERENCE
{
PN_U8
ReferenceHighByte
;
PN_U8
ReferenceLowByte
;
...
...
@@ -731,7 +738,8 @@ typedef struct _T_PN_REFERENCE {
#define PROFINET_IO_CR_IO_STATUS_LENGTH 0x0001u
typedef
struct
_T_PN_SUBMODULE
{
typedef
struct
_T_PN_SUBMODULE
{
PN_U8
SubSlotNumberHighByte
;
PN_U8
SubSlotNumberLowByte
;
...
...
@@ -763,7 +771,8 @@ typedef struct _T_PN_SUBMODULE {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_MODULE
{
typedef
struct
_T_PN_MODULE
{
PN_U8
VersionHighByte
;
PN_U8
VersionLowByte
;
...
...
@@ -789,7 +798,8 @@ typedef struct _T_PN_MODULE {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_DATA_RECORD
{
typedef
struct
_T_PN_DATA_RECORD
{
PN_U8
VersionHighByte
;
PN_U8
VersionLowByte
;
...
...
@@ -815,7 +825,8 @@ typedef struct _T_PN_DATA_RECORD {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_API
{
typedef
struct
_T_PN_API
{
PN_U8
APIHighWordHighByte
;
PN_U8
APIHighWordLowByte
;
PN_U8
APILowWordHighByte
;
...
...
@@ -832,7 +843,8 @@ typedef struct _T_PN_API {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_IOCR
{
typedef
struct
_T_PN_IOCR
{
PN_U8
VersionHighByte
;
PN_U8
VersionLowByte
;
...
...
@@ -972,7 +984,8 @@ typedef struct _T_PN_IOCR {
#define PN_SERVICE_DOWNLOAD_LITTLE_ENDIAN 0u
#define PN_SERVICE_DOWNLOAD_BIG_ENDIAN 1u
typedef
struct
_T_PN_SERVICE_DOWNLOAD_REQ
{
typedef
struct
_T_PN_SERVICE_DOWNLOAD_REQ
{
PN_U8
IpAddressHighWordHighByte
;
PN_U8
IpAddressHighWordLowByte
;
PN_U8
IpAddressLowWordHighByte
;
...
...
@@ -1037,7 +1050,8 @@ typedef struct _T_PN_SERVICE_DOWNLOAD_REQ {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_DATA_INFO
{
typedef
struct
_T_PN_DATA_INFO
{
PN_U8
SlotNumberHighByte
;
PN_U8
SlotNumberLowByte
;
...
...
@@ -1051,7 +1065,8 @@ typedef struct _T_PN_DATA_INFO {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_API_INFO
{
typedef
struct
_T_PN_API_INFO
{
PN_U8
APIHighWordHighByte
;
PN_U8
APIHighWordLowByte
;
PN_U8
APILowWordHighByte
;
...
...
@@ -1078,8 +1093,8 @@ typedef struct _T_PN_API_INFO {
#define PN_IOCR_CMDEV_AR_MASK 0x00FFu
#define PN_IOCR_NUMBER_MASK 0x7E00u
#define PN_IOCR_IDENTIFIER_MASK \
(PN_IOCR_DEVICE_REF_MASK | PN_IOCR_CMDEV_AR_MASK | PN_IOCR_NUMBER_MASK
\
|
PN_IOCR_CMDEV_MASK)
(PN_IOCR_DEVICE_REF_MASK | PN_IOCR_CMDEV_AR_MASK | PN_IOCR_NUMBER_MASK
|
\
PN_IOCR_CMDEV_MASK)
#define _PN_IOCR_NUMBER_TO_DEVICE_REF(IOCRIdentifier) \
(IOCRIdentifier & PN_IOCR_DEVICE_REF_MASK)
...
...
@@ -1089,7 +1104,8 @@ typedef struct _T_PN_API_INFO {
((IOCRIdentifier & PN_IOCR_NUMBER_MASK) >> 9u)
#define _PN_IOCR_CMDEV(IOCRIdentifier) (IOCRIdentifier & PN_IOCR_CMDEV_MASK)
typedef
struct
_T_PN_IOCR_INFO
{
typedef
struct
_T_PN_IOCR_INFO
{
PN_U8
IOCRIdentifierHighByte
;
PN_U8
IOCRIdentifierLowByte
;
...
...
@@ -1110,7 +1126,8 @@ typedef struct _T_PN_IOCR_INFO {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_DOWNLOAD_CON
{
typedef
struct
_T_PN_SERVICE_DOWNLOAD_CON
{
PN_U8
AlarmRefHighByte
;
PN_U8
AlarmRefLowByte
;
...
...
@@ -1136,7 +1153,8 @@ typedef struct _T_PN_SERVICE_DOWNLOAD_CON {
#define PN_IDENT_MAINTENANCE_3_SUPPORTED (PN_U16)0x0008u
#define PN_IDENT_MAINTENANCE_4_SUPPORTED (PN_U16)0x0010u
typedef
struct
_T_PN_SERVICE_SET_IDENTIFICATION_REQ
{
typedef
struct
_T_PN_SERVICE_SET_IDENTIFICATION_REQ
{
PN_U8
TypeOfStation
[
SERVICE_SET_IDENTIFICATION_TYPE_OF_STATION_LENGTH
];
PN_U8
OrderId
[
PROFINET_IDENT_MAINTENANCE_ORDER_ID_LENGTH
];
PN_U8
SerialNumber
[
PROFINET_IDENT_MAINTENANCE_SR_NUMBER_LENGTH
];
...
...
@@ -1168,7 +1186,8 @@ typedef struct _T_PN_SERVICE_SET_IDENTIFICATION_REQ {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_SET_IDENTIFICATION_CON
{
typedef
struct
_T_PN_SERVICE_SET_IDENTIFICATION_CON
{
PN_U16
DummyForCompiler
;
}
PACK_BYTE_ALIGNMENT
(
T_PN_SERVICE_SET_IDENTIFICATION_CON
);
...
...
@@ -1185,7 +1204,8 @@ typedef struct _T_PN_SERVICE_SET_IDENTIFICATION_CON {
#define MIN_WATCHDOG_INTERVAL (PN_U32)3uL
#define MAX_WATCHDOG_INTERVAL (PN_U32)60000uL
typedef
struct
_T_PN_SERVICE_CONFIGURE_WATCHDOG_REQ
{
typedef
struct
_T_PN_SERVICE_CONFIGURE_WATCHDOG_REQ
{
PN_U8
WatchdogExpirationAction
;
PN_U8
Alignment
;
...
...
@@ -1198,7 +1218,8 @@ typedef struct _T_PN_SERVICE_CONFIGURE_WATCHDOG_REQ {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_CONFIGURE_WATCHDOG_CON
{
typedef
struct
_T_PN_SERVICE_CONFIGURE_WATCHDOG_CON
{
PN_U16
DummyForCompiler
;
}
PACK_BYTE_ALIGNMENT
(
T_PN_SERVICE_CONFIGURE_WATCHDOG_CON
);
...
...
@@ -1268,14 +1289,15 @@ typedef struct _T_PN_SERVICE_CONFIGURE_WATCHDOG_CON {
#define PROFINET_SYNC_MODE_CABLE_DELAY_CHECK_ON (PN_U16)0x0001u
#define PROFINET_SYNC_MODE_SYNC_MASTER_CHECK_ON (PN_U16)0x0002u
#define PROFINET_SYNC_MODE_MASK \
(PN_U16)(PROFINET_SYNC_MODE_CABLE_DELAY_CHECK_ON
\
|
PROFINET_SYNC_MODE_SYNC_MASTER_CHECK_ON)
(PN_U16)(PROFINET_SYNC_MODE_CABLE_DELAY_CHECK_ON
|
\
PROFINET_SYNC_MODE_SYNC_MASTER_CHECK_ON)
#define PROFINET_MAU_TYPE_MODE_DIFFERENCE_CHECK_ON (PN_U16)0x0001u
#define PROFINET_MAU_TYPE_MODE_MASK \
(PN_U16)(PROFINET_MAU_TYPE_MODE_DIFFERENCE_CHECK_ON)
typedef
struct
_T_PN_NEIGHBOUR_PORT_DATA
{
typedef
struct
_T_PN_NEIGHBOUR_PORT_DATA
{
PN_U8
Flags
;
PN_U8
Alignment
;
...
...
@@ -1312,7 +1334,8 @@ typedef struct _T_PN_NEIGHBOUR_PORT_DATA {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_DOWNLOAD_NEIGHBOUR_DATA_REQ
{
typedef
struct
_T_PN_SERVICE_DOWNLOAD_NEIGHBOUR_DATA_REQ
{
PN_U8
NumberPorts
;
PN_U8
Alignment
;
...
...
@@ -1322,7 +1345,8 @@ typedef struct _T_PN_SERVICE_DOWNLOAD_NEIGHBOUR_DATA_REQ {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_DOWNLOAD_NEIGHBOUR_DATA_CON
{
typedef
struct
_T_PN_SERVICE_DOWNLOAD_NEIGHBOUR_DATA_CON
{
PN_U16
DummyForCompiler
;
}
PACK_BYTE_ALIGNMENT
(
T_PN_SERVICE_DOWNLOAD_NEIGHBOUR_DATA_CON
);
...
...
@@ -1334,7 +1358,8 @@ typedef struct _T_PN_SERVICE_DOWNLOAD_NEIGHBOUR_DATA_CON {
#define MAX_LICENCE_DATA_LENGTH (PN_U16)256u
typedef
struct
_T_PN_SERVICE_CONFIGURE_LICENCE_REQ
{
typedef
struct
_T_PN_SERVICE_CONFIGURE_LICENCE_REQ
{
PN_U8
DataLengthHighByte
;
PN_U8
DataLengthLowByte
;
...
...
@@ -1344,7 +1369,8 @@ typedef struct _T_PN_SERVICE_CONFIGURE_LICENCE_REQ {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_CONFIGURE_LICENCE_CON
{
typedef
struct
_T_PN_SERVICE_CONFIGURE_LICENCE_CON
{
PN_U16
DummyForCompiler
;
}
PACK_BYTE_ALIGNMENT
(
T_PN_SERVICE_CONFIGURE_LICENCE_CON
);
...
...
@@ -1363,12 +1389,12 @@ typedef struct _T_PN_SERVICE_CONFIGURE_LICENCE_CON {
#define PN_SYNC_DOMAIN_PRIORITY1_LEVEL7 0x38u
#define PN_SYNC_DOMAIN_PRIORITY1_MASTER_ACTIVE 0x80u
#define PN_SYNC_DOMAIN_PRIORITY1_MASK \
(PN_SYNC_DOMAIN_PRIORITY1_PRIMARY_MASTER
\
| PN_SYNC_DOMAIN_PRIORITY1_SECONDARY_MASTER
\
| PN_SYNC_DOMAIN_PRIORITY1_LEVEL0 | PN_SYNC_DOMAIN_PRIORITY1_LEVEL1
\
| PN_SYNC_DOMAIN_PRIORITY1_LEVEL2 | PN_SYNC_DOMAIN_PRIORITY1_LEVEL3
\
| PN_SYNC_DOMAIN_PRIORITY1_LEVEL4 | PN_SYNC_DOMAIN_PRIORITY1_LEVEL5
\
|
PN_SYNC_DOMAIN_PRIORITY1_LEVEL6 | PN_SYNC_DOMAIN_PRIORITY1_LEVEL7)
(PN_SYNC_DOMAIN_PRIORITY1_PRIMARY_MASTER
|
\
PN_SYNC_DOMAIN_PRIORITY1_SECONDARY_MASTER |
\
PN_SYNC_DOMAIN_PRIORITY1_LEVEL0 | PN_SYNC_DOMAIN_PRIORITY1_LEVEL1 |
\
PN_SYNC_DOMAIN_PRIORITY1_LEVEL2 | PN_SYNC_DOMAIN_PRIORITY1_LEVEL3 |
\
PN_SYNC_DOMAIN_PRIORITY1_LEVEL4 | PN_SYNC_DOMAIN_PRIORITY1_LEVEL5 |
\
PN_SYNC_DOMAIN_PRIORITY1_LEVEL6 | PN_SYNC_DOMAIN_PRIORITY1_LEVEL7)
#define PN_SYNC_DOMAIN_PRIORITY2_DEFAULT 0xFFu
...
...
@@ -1416,7 +1442,8 @@ typedef struct _T_PN_SERVICE_CONFIGURE_LICENCE_CON {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_DEFAULT_API_DATA_RECORD
{
typedef
struct
_T_PN_DEFAULT_API_DATA_RECORD
{
PN_U8
VersionHighByte
;
PN_U8
VersionLowByte
;
...
...
@@ -1441,7 +1468,8 @@ typedef struct _T_PN_DEFAULT_API_DATA_RECORD {
}
PACK_BYTE_ALIGNMENT
(
T_PN_DEFAULT_API_DATA_RECORD
);
typedef
struct
_T_PN_SERVICE_DOWNLOAD_IRT_DOMAIN_REQ
{
typedef
struct
_T_PN_SERVICE_DOWNLOAD_IRT_DOMAIN_REQ
{
PN_U8
NumberOfDataRecordsHighByte
;
PN_U8
NumberOfDataRecordsLowByte
;
...
...
@@ -1453,7 +1481,8 @@ typedef struct _T_PN_SERVICE_DOWNLOAD_IRT_DOMAIN_REQ {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_DOWNLOAD_IRT_DOMAIN_CON
{
typedef
struct
_T_PN_SERVICE_DOWNLOAD_IRT_DOMAIN_CON
{
PN_U16
DummyForCompiler
;
}
PACK_BYTE_ALIGNMENT
(
T_PN_SERVICE_DOWNLOAD_IRT_DOMAIN_CON
);
...
...
@@ -1478,7 +1507,8 @@ typedef T_PN_SERVICE_DOWNLOAD_IRT_DOMAIN_CON
/*===========================================================================*/
typedef
struct
_T_PROFINET_BLOCK_HEADER
{
typedef
struct
_T_PROFINET_BLOCK_HEADER
{
PN_U8
TypeHighByte
;
PN_U8
TypeLowByte
;
...
...
@@ -1492,7 +1522,8 @@ typedef struct _T_PROFINET_BLOCK_HEADER {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_EXTENDED_BLOCK
{
typedef
struct
_T_PN_EXTENDED_BLOCK
{
T_PROFINET_BLOCK_HEADER
Header
;
/*
...
...
@@ -1509,11 +1540,12 @@ typedef struct _T_PN_EXTENDED_BLOCK {
#define CONFIG_ID_SELECTOR_AR_SET_4 (PN_U16)0x0004u
#define CONFIG_ID_SELECTOR_NUMBER_AR_PER_SET (PN_U16)0x0010u
#define CONFIG_ID_SELECTOR_MASK \
(PN_U16)(CONFIG_ID_SELECTOR_AR_SET_1 | CONFIG_ID_SELECTOR_AR_SET_2
\
| CONFIG_ID_SELECTOR_AR_SET_3 | CONFIG_ID_SELECTOR_AR_SET_4
\
|
CONFIG_ID_SELECTOR_NUMBER_AR_PER_SET)
(PN_U16)(CONFIG_ID_SELECTOR_AR_SET_1 | CONFIG_ID_SELECTOR_AR_SET_2
|
\
CONFIG_ID_SELECTOR_AR_SET_3 | CONFIG_ID_SELECTOR_AR_SET_4 |
\
CONFIG_ID_SELECTOR_NUMBER_AR_PER_SET)
typedef
struct
_T_PN_EXTENDED_BLOCK_CONFIG_ID
{
typedef
struct
_T_PN_EXTENDED_BLOCK_CONFIG_ID
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Reserved
[
2
];
...
...
@@ -1547,7 +1579,8 @@ typedef struct _T_PN_EXTENDED_BLOCK_CONFIG_ID {
#define PN_SERVICE_ERROR_DOWNLOAD_EXTENDED_INVALID_RESERVED_BYTE 0x08u
#define PN_SERVICE_ERROR_DOWNLOAD_EXTENDED_INVALID_SELECTOR 0x09u
typedef
struct
_T_PN_SERVICE_DOWNLOAD_EXTENDED_REQ
{
typedef
struct
_T_PN_SERVICE_DOWNLOAD_EXTENDED_REQ
{
PN_U8
NumberOfBlocksHighByte
;
PN_U8
NumberOfBlocksLowByte
;
...
...
@@ -1561,7 +1594,8 @@ typedef struct _T_PN_SERVICE_DOWNLOAD_EXTENDED_REQ {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_DOWNLOAD_EXTENDED_CON
{
typedef
struct
_T_PN_SERVICE_DOWNLOAD_EXTENDED_CON
{
PN_U16
DummyForCompiler
;
}
PACK_BYTE_ALIGNMENT
(
T_PN_SERVICE_DOWNLOAD_EXTENDED_CON
);
...
...
@@ -1608,11 +1642,11 @@ typedef struct _T_PN_SERVICE_DOWNLOAD_EXTENDED_CON {
#define PROFINET_ALARM_SPECIFIER_SUBMODULE_DIAGNOSIS_STATE (PN_U16)0x2000u
#define PROFINET_ALARM_SPECIFIER_AR_DIAGNOSIS_STATE (PN_U16)0x8000u
#define PROFINET_ALARM_SPECIFIER_MASK \
(PROFINET_ALARM_SPECIFIER_SEQUENCE_MASK
\
| PROFINET_ALARM_SPECIFIER_CHANNEL_DIAGNOSIS
\
| PROFINET_ALARM_SPECIFIER_MANUFACTURER_DIAGNOSIS
\
| PROFINET_ALARM_SPECIFIER_SUBMODULE_DIAGNOSIS_STATE
\
|
PROFINET_ALARM_SPECIFIER_AR_DIAGNOSIS_STATE)
(PROFINET_ALARM_SPECIFIER_SEQUENCE_MASK
|
\
PROFINET_ALARM_SPECIFIER_CHANNEL_DIAGNOSIS |
\
PROFINET_ALARM_SPECIFIER_MANUFACTURER_DIAGNOSIS |
\
PROFINET_ALARM_SPECIFIER_SUBMODULE_DIAGNOSIS_STATE |
\
PROFINET_ALARM_SPECIFIER_AR_DIAGNOSIS_STATE)
#define PROFINET_ALARM_USER_STRUCTURE_IDENT_MANUFACTURER_LOWER_LIMIT \
(PN_U16)0x0000u
...
...
@@ -1648,8 +1682,8 @@ typedef struct _T_PN_SERVICE_DOWNLOAD_EXTENDED_CON {
#define PROFINET_ALARM_CHANNEL_PROPERTIES_DIRECTION_IN (PN_U16)0x2000u
#define PROFINET_ALARM_CHANNEL_PROPERTIES_DIRECTION_OUT (PN_U16)0x4000u
#define PROFINET_ALARM_CHANNEL_PROPERTIES_DIRECTION_IN_OUT \
(PROFINET_ALARM_CHANNEL_PROPERTIES_DIRECTION_IN
\
|
PROFINET_ALARM_CHANNEL_PROPERTIES_DIRECTION_OUT)
(PROFINET_ALARM_CHANNEL_PROPERTIES_DIRECTION_IN
|
\
PROFINET_ALARM_CHANNEL_PROPERTIES_DIRECTION_OUT)
#define PROFINET_CH_ERR_TYPE_SHORT_CIRCUIT (PN_U16)0x0001u
#define PROFINET_CH_ERR_TYPE_UNDERVOLTAGE (PN_U16)0x0002u
...
...
@@ -1775,7 +1809,8 @@ typedef struct _T_PN_SERVICE_DOWNLOAD_EXTENDED_CON {
/* used with channel error type 0x800E */
#define PROFINET_EXT_CH_ERR_TYPE_SUBORDINATED_ENTITY_INFO (PN_U16)0x8000u
typedef
struct
_T_PN_SERVICE_GET_ALARM_REQ
{
typedef
struct
_T_PN_SERVICE_GET_ALARM_REQ
{
PN_U8
AlarmRefHighByte
;
PN_U8
AlarmRefLowByte
;
...
...
@@ -1783,7 +1818,8 @@ typedef struct _T_PN_SERVICE_GET_ALARM_REQ {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_GET_ALARM_CON
{
typedef
struct
_T_PN_SERVICE_GET_ALARM_CON
{
PN_U8
AlarmRefHighByte
;
PN_U8
AlarmRefLowByte
;
...
...
@@ -1828,7 +1864,8 @@ typedef struct _T_PN_SERVICE_GET_ALARM_CON {
/*===========================================================================*/
typedef
struct
_T_PN_SERVICE_ALARM_ACK_REQ
{
typedef
struct
_T_PN_SERVICE_ALARM_ACK_REQ
{
PN_U8
AlarmRefHighByte
;
PN_U8
AlarmRefLowByte
;
...
...
@@ -1839,7 +1876,8 @@ typedef struct _T_PN_SERVICE_ALARM_ACK_REQ {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_ALARM_ACK_CON
{
typedef
struct
_T_PN_SERVICE_ALARM_ACK_CON
{
PN_U8
AlarmRefHighByte
;
PN_U8
AlarmRefLowByte
;
...
...
@@ -1847,7 +1885,8 @@ typedef struct _T_PN_SERVICE_ALARM_ACK_CON {
/*===========================================================================*/
typedef
struct
_T_PROFINET_MAINTENANCE_ITEM
{
typedef
struct
_T_PROFINET_MAINTENANCE_ITEM
{
PN_U8
UserStructureIdentifierHighByte
;
PN_U8
UserStructureIdentifierLowByte
;
...
...
@@ -1864,7 +1903,8 @@ typedef struct _T_PROFINET_MAINTENANCE_ITEM {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_UPLOAD_RETRIEVAL_ITEM
{
typedef
struct
_T_PROFINET_UPLOAD_RETRIEVAL_ITEM
{
PN_U8
UserStructureIdentifierHighByte
;
PN_U8
UserStructureIdentifierLowByte
;
...
...
@@ -1888,7 +1928,8 @@ typedef struct _T_PROFINET_UPLOAD_RETRIEVAL_ITEM {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_IPARAMETER_ITEM
{
typedef
struct
_T_PROFINET_IPARAMETER_ITEM
{
PN_U8
UserStructureIdentifierHighByte
;
PN_U8
UserStructureIdentifierLowByte
;
...
...
@@ -1920,7 +1961,8 @@ typedef struct _T_PROFINET_IPARAMETER_ITEM {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_CHANNEL_DIAG
{
typedef
struct
_T_PROFINET_CHANNEL_DIAG
{
PN_U8
UserStructureIdentifierHighByte
;
PN_U8
UserStructureIdentifierLowByte
;
...
...
@@ -1937,7 +1979,8 @@ typedef struct _T_PROFINET_CHANNEL_DIAG {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_EXT_CHANNEL_DIAG
{
typedef
struct
_T_PROFINET_EXT_CHANNEL_DIAG
{
PN_U8
UserStructureIdentifierHighByte
;
PN_U8
UserStructureIdentifierLowByte
;
...
...
@@ -1980,7 +2023,8 @@ typedef struct _T_PROFINET_EXT_CHANNEL_DIAG {
#define PROFINET_QUALIFIED_CHANNEL_DIAG_QUALIFIER_27 \
(PN_U32)0x08000000u
/* Start of Fault */
typedef
struct
_T_PROFINET_QUALIFIED_CHANNEL_DIAG
{
typedef
struct
_T_PROFINET_QUALIFIED_CHANNEL_DIAG
{
PN_U8
UserStructureIdentifierHighByte
;
PN_U8
UserStructureIdentifierLowByte
;
...
...
@@ -2017,7 +2061,8 @@ typedef struct _T_PROFINET_QUALIFIED_CHANNEL_DIAG {
#define PN_SERVICE_ALARM_INVALID_SPECIFIER 0x05u
#define PN_SERVICE_ALARM_INVALID_LENGTH 0x06u
typedef
struct
_T_PN_SERVICE_ALARM_REQ
{
typedef
struct
_T_PN_SERVICE_ALARM_REQ
{
PN_U8
AlarmRefHighByte
;
PN_U8
AlarmRefLowByte
;
...
...
@@ -2062,7 +2107,8 @@ typedef struct _T_PN_SERVICE_ALARM_REQ {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_ALARM_CON
{
typedef
struct
_T_PN_SERVICE_ALARM_CON
{
PN_U8
AlarmRefHighByte
;
PN_U8
AlarmRefLowByte
;
...
...
@@ -2070,7 +2116,8 @@ typedef struct _T_PN_SERVICE_ALARM_CON {
/*===========================================================================*/
typedef
struct
_T_PN_SERVICE_GET_ALARM_ACK_REQ
{
typedef
struct
_T_PN_SERVICE_GET_ALARM_ACK_REQ
{
PN_U8
AlarmRefHighByte
;
PN_U8
AlarmRefLowByte
;
...
...
@@ -2078,7 +2125,8 @@ typedef struct _T_PN_SERVICE_GET_ALARM_ACK_REQ {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_GET_ALARM_ACK_CON
{
typedef
struct
_T_PN_SERVICE_GET_ALARM_ACK_CON
{
PN_U8
AlarmRefHighByte
;
PN_U8
AlarmRefLowByte
;
...
...
@@ -2112,14 +2160,16 @@ typedef struct _T_PN_SERVICE_GET_ALARM_ACK_CON {
/*===========================================================================*/
typedef
struct
_T_PN_SERVICE_GET_DEVICE_STATE_REQ
{
typedef
struct
_T_PN_SERVICE_GET_DEVICE_STATE_REQ
{
PN_U16
DummyForCompiler
;
}
PACK_BYTE_ALIGNMENT
(
T_PN_SERVICE_GET_DEVICE_STATE_REQ
);
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_ERROR_CODE
{
typedef
struct
_T_PN_ERROR_CODE
{
PN_U8
Reason
;
PN_U8
Decode
;
...
...
@@ -2134,7 +2184,8 @@ typedef T_PN_ERROR_CODE T_PROFINET_ERROR_CODE;
#define PROFINET_STATUS_OK 0uL
typedef
struct
_T_PROFINET_STATUS
{
typedef
struct
_T_PROFINET_STATUS
{
union
{
PN_U32
Status
;
PN_U32
RpcError
;
...
...
@@ -2147,7 +2198,8 @@ typedef struct _T_PROFINET_STATUS {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_DIFF_MODULE_API
{
typedef
struct
_T_PN_DIFF_MODULE_API
{
PN_U8
APIHighWordHighByte
;
PN_U8
APIHighWordLowByte
;
PN_U8
APILowWordHighByte
;
...
...
@@ -2169,11 +2221,12 @@ typedef struct _T_PN_DIFF_MODULE_API {
#define PROFINET_MODULE_STATE_PROPER_MODULE 0x0002u
#define PROFINET_MODULE_STATE_SUBSTITUTE_MODULE 0x0003u
#define PROFINET_MODULE_STATE_MASK \
(PROFINET_MODULE_STATE_NO_MODULE | PROFINET_MODULE_STATE_WRONG_MODULE
\
| PROFINET_MODULE_STATE_PROPER_MODULE
\
|
PROFINET_MODULE_STATE_SUBSTITUTE_MODULE)
(PROFINET_MODULE_STATE_NO_MODULE | PROFINET_MODULE_STATE_WRONG_MODULE
|
\
PROFINET_MODULE_STATE_PROPER_MODULE |
\
PROFINET_MODULE_STATE_SUBSTITUTE_MODULE)
typedef
struct
_T_PN_DIFF_MODULE_SLOT
{
typedef
struct
_T_PN_DIFF_MODULE_SLOT
{
PN_U8
SlotNumberHighByte
;
PN_U8
SlotNumberLowByte
;
...
...
@@ -2243,7 +2296,8 @@ typedef struct _T_PN_DIFF_MODULE_SLOT {
#define PROFINET_SUBMODULE_STATE_IDENT_INFO_RESRERVED \
(PROFINET_SUBMODULE_STATE_FORMAT_INDICATOR | 0x6000u)
typedef
struct
_T_PN_DIFF_MODULE_SUBSLOT
{
typedef
struct
_T_PN_DIFF_MODULE_SUBSLOT
{
PN_U8
SubSlotNumberHighByte
;
PN_U8
SubSlotNumberLowByte
;
...
...
@@ -2259,7 +2313,8 @@ typedef struct _T_PN_DIFF_MODULE_SUBSLOT {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_DIFF_MODULE
{
typedef
struct
_T_PN_DIFF_MODULE
{
PN_U8
NumberOfAPIsHighByte
;
PN_U8
NumberOfAPIsLowByte
;
...
...
@@ -2271,7 +2326,8 @@ typedef struct _T_PN_DIFF_MODULE {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_GET_DEVICE_STATE_CON
{
typedef
struct
_T_PN_SERVICE_GET_DEVICE_STATE_CON
{
PN_U8
StateHighByte
;
PN_U8
StateLowByte
;
...
...
@@ -2289,14 +2345,16 @@ typedef struct _T_PN_SERVICE_GET_DEVICE_STATE_CON {
/*===========================================================================*/
typedef
struct
_T_PN_SERVICE_GET_LIST_OF_STATION_REQ
{
typedef
struct
_T_PN_SERVICE_GET_LIST_OF_STATION_REQ
{
PN_U16
DummyForCompiler
;
}
PACK_BYTE_ALIGNMENT
(
T_PN_SERVICE_GET_LIST_OF_STATION_REQ
);
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_DEVICE_IP_INFO
{
typedef
struct
_T_PN_DEVICE_IP_INFO
{
PN_U8
AddressHighWordHighByte
;
PN_U8
AddressHighWordLowByte
;
PN_U8
AddressLowWordHighByte
;
...
...
@@ -2321,7 +2379,8 @@ typedef struct _T_PN_DEVICE_IP_INFO {
#define DEVICE_TYPE_IO_MULTI_DEVICE 0x04u
#define DEVICE_TYPE_IO_SUPERVISOR 0x08u
typedef
struct
_T_PN_DEVICE_PROPERTY_INFO
{
typedef
struct
_T_PN_DEVICE_PROPERTY_INFO
{
PN_U8
DeviceIdHighByte
;
PN_U8
DeviceIdLowByte
;
...
...
@@ -2335,7 +2394,8 @@ typedef struct _T_PN_DEVICE_PROPERTY_INFO {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_DEVICE_INFO
{
typedef
struct
_T_PN_DEVICE_INFO
{
T_PN_MAC_ADDRESS
MacAddress
;
T_PN_DEVICE_IP_INFO
Ip
;
T_PN_DEVICE_PROPERTY_INFO
Property
;
...
...
@@ -2351,7 +2411,8 @@ typedef struct _T_PN_DEVICE_INFO {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_GET_LIST_OF_STATION_CON
{
typedef
struct
_T_PN_SERVICE_GET_LIST_OF_STATION_CON
{
PN_U8
NumberOfDevicesHighByte
;
PN_U8
NumberOfDevicesLowByte
;
...
...
@@ -2386,7 +2447,8 @@ typedef struct _T_PN_SERVICE_GET_LIST_OF_STATION_CON {
#define PN_SERVICE_SET_IP_SETTINGS_RESPONSE_TIMEOUT \
PN_SERVICE_SET_RESPONSE_TIMEOUT
typedef
struct
_T_PN_SERVICE_SET_NAME_REQ
{
typedef
struct
_T_PN_SERVICE_SET_NAME_REQ
{
T_PN_MAC_ADDRESS
DestMacAddress
;
PN_U8
NameLengthHighByte
;
...
...
@@ -2398,14 +2460,16 @@ typedef struct _T_PN_SERVICE_SET_NAME_REQ {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_SET_NAME_CON
{
typedef
struct
_T_PN_SERVICE_SET_NAME_CON
{
PN_U16
DummyForCompiler
;
}
PACK_BYTE_ALIGNMENT
(
T_PN_SERVICE_SET_NAME_CON
);
/*===========================================================================*/
typedef
struct
_T_PN_SERVICE_SET_IP_SETTINGS_REQ
{
typedef
struct
_T_PN_SERVICE_SET_IP_SETTINGS_REQ
{
T_PN_MAC_ADDRESS
DestMacAddress
;
PN_U8
AddressHighWordHighByte
;
...
...
@@ -2427,7 +2491,8 @@ typedef struct _T_PN_SERVICE_SET_IP_SETTINGS_REQ {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_SET_IP_SETTINGS_CON
{
typedef
struct
_T_PN_SERVICE_SET_IP_SETTINGS_CON
{
PN_U16
DummyForCompiler
;
}
PACK_BYTE_ALIGNMENT
(
T_PN_SERVICE_SET_IP_SETTINGS_CON
);
...
...
@@ -2489,7 +2554,8 @@ typedef struct _T_PN_SERVICE_SET_IP_SETTINGS_CON {
#define SOFTING_CONFIGURATION_LAST_FRAGMENT (PN_U32)0x80000000uL
typedef
struct
_T_PN_STORE_SOFTING_CONFIGURATION
{
typedef
struct
_T_PN_STORE_SOFTING_CONFIGURATION
{
PN_U8
ConfigLengthHighWordHighByte
;
PN_U8
ConfigLengthHighWordLowByte
;
PN_U8
ConfigLengthLowWordHighByte
;
...
...
@@ -2515,7 +2581,8 @@ typedef struct _T_PN_STORE_SOFTING_CONFIGURATION {
#define PROFILE_INFO_TASK_PROFILING (PN_U8)255u
typedef
struct
_T_PN_PROFILE_INFO
{
typedef
struct
_T_PN_PROFILE_INFO
{
PN_U8
Action
;
PN_U8
ModuleId
;
...
...
@@ -2525,7 +2592,8 @@ typedef struct _T_PN_PROFILE_INFO {
#define PN_SERVICE_DCP_SET_RESPONSE_TIMEOUT PN_SERVICE_SET_RESPONSE_TIMEOUT
typedef
struct
_T_PN_SERVICE_DCP_SET_REQ
{
typedef
struct
_T_PN_SERVICE_DCP_SET_REQ
{
T_PN_MAC_ADDRESS
DestMacAddress
;
PN_U8
Option
;
...
...
@@ -2548,7 +2616,8 @@ typedef struct _T_PN_SERVICE_DCP_SET_REQ {
#define DCP_RESULT_RESOURCE_ERROR (PN_U8)4u
#define DCP_RESULT_SET_NOT_POSSIBLE (PN_U8)5u
typedef
struct
_T_PN_SERVICE_DCP_SET_CON
{
typedef
struct
_T_PN_SERVICE_DCP_SET_CON
{
PN_U16
DummyForCompiler
;
}
PACK_BYTE_ALIGNMENT
(
T_PN_SERVICE_DCP_SET_CON
);
...
...
@@ -2557,7 +2626,8 @@ typedef struct _T_PN_SERVICE_DCP_SET_CON {
#define PN_SERVICE_DCP_GET_RESPONSE_TIMEOUT PN_SERVICE_SET_RESPONSE_TIMEOUT
typedef
struct
_T_PN_SERVICE_DCP_GET_REQ
{
typedef
struct
_T_PN_SERVICE_DCP_GET_REQ
{
T_PN_MAC_ADDRESS
DestMacAddress
;
PN_U8
Option
;
...
...
@@ -2567,13 +2637,15 @@ typedef struct _T_PN_SERVICE_DCP_GET_REQ {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SYS_TIME
{
typedef
struct
_T_PN_SYS_TIME
{
PN_U32
HighPart
;
PN_U32
LowPart
;
}
PACK_BYTE_ALIGNMENT
(
T_PN_SYS_TIME
);
typedef
struct
_T_PN_PROFILE_ENTRY
{
typedef
struct
_T_PN_PROFILE_ENTRY
{
PN_U32
Identifier
;
T_PN_SYS_TIME
Time
;
...
...
@@ -2584,7 +2656,8 @@ typedef struct _T_PN_PROFILE_ENTRY {
#define PROFILE_DATA_ENCODING_BIG_ENDIAN 0x00u
#define PROFILE_DATA_ENCODING_LITTLE_ENDIAN 0x01u
typedef
struct
_T_PN_PROFILE_INFO_HEADER
{
typedef
struct
_T_PN_PROFILE_INFO_HEADER
{
PN_U32
Version
;
PN_U32
CountsPer1ms
;
...
...
@@ -2600,7 +2673,8 @@ typedef struct _T_PN_PROFILE_INFO_HEADER {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_DCP_BLOCK_INFO
{
typedef
struct
_T_PROFINET_DCP_BLOCK_INFO
{
PN_U8
BlockInfoHighByte
;
PN_U8
BlockInfoLowByte
;
...
...
@@ -2611,7 +2685,8 @@ typedef struct _T_PROFINET_DCP_BLOCK_INFO {
#define STORE_CONFIGURATION_RESULT_OK 0x00u
#define STORE_CONFIGURATION_RESULT_BUSY 0xFFu
typedef
struct
_T_PN_STORE_SOFTING_CONFIGURATION_RESULT
{
typedef
struct
_T_PN_STORE_SOFTING_CONFIGURATION_RESULT
{
PN_U8
Result
;
PN_U8
Alignment
;
...
...
@@ -2619,7 +2694,8 @@ typedef struct _T_PN_STORE_SOFTING_CONFIGURATION_RESULT {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_DCP_GET_CON
{
typedef
struct
_T_PN_SERVICE_DCP_GET_CON
{
PN_U8
Option
;
PN_U8
Suboption
;
...
...
@@ -2658,7 +2734,8 @@ typedef struct _T_PN_SERVICE_DCP_GET_CON {
#define APPLICATION_DATA_OPTION_RESULT_RESOURCE_ERROR (PN_U8)4u
#define APPLICATION_DATA_OPTION_RESULT_SET_NOT_POSSIBLE (PN_U8)5u
typedef
struct
_T_PN_APPLICATION_OPTION
{
typedef
struct
_T_PN_APPLICATION_OPTION
{
PN_U8
Option
;
PN_U8
Suboption
;
...
...
@@ -2666,7 +2743,8 @@ typedef struct _T_PN_APPLICATION_OPTION {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_APPLICATION_OPTION_DATA
{
typedef
struct
_T_PN_APPLICATION_OPTION_DATA
{
PN_U8
Option
;
PN_U8
Suboption
;
...
...
@@ -2680,7 +2758,8 @@ typedef struct _T_PN_APPLICATION_OPTION_DATA {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_APPLICATION_OPTION_RESULT
{
typedef
struct
_T_PN_APPLICATION_OPTION_RESULT
{
PN_U8
Option
;
PN_U8
Suboption
;
...
...
@@ -2692,7 +2771,8 @@ typedef struct _T_PN_APPLICATION_OPTION_RESULT {
typedef
T_PN_APPLICATION_OPTION
T_PN_APPLICATION_OPTION_GET
;
typedef
struct
_T_PN_SERVICE_APPLICATION_DATA_GET_IND
{
typedef
struct
_T_PN_SERVICE_APPLICATION_DATA_GET_IND
{
PN_U8
NumberOptionsHighByte
;
PN_U8
NumberOptionsLowByte
;
...
...
@@ -2705,7 +2785,8 @@ typedef struct _T_PN_SERVICE_APPLICATION_DATA_GET_IND {
typedef
T_PN_APPLICATION_OPTION_DATA
T_PN_APPLICATION_OPTION_DATA_GET
;
typedef
struct
_T_PN_SERVICE_APPLICATION_DATA_GET_RES
{
typedef
struct
_T_PN_SERVICE_APPLICATION_DATA_GET_RES
{
PN_U8
NumberOptionsHighByte
;
PN_U8
NumberOptionsLowByte
;
...
...
@@ -2720,7 +2801,8 @@ typedef T_PN_APPLICATION_OPTION_DATA T_PN_APPLICATION_OPTION_DATA_SET;
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_APPLICATION_DATA_SET_IND
{
typedef
struct
_T_PN_SERVICE_APPLICATION_DATA_SET_IND
{
PN_U8
NumberOptionsHighByte
;
PN_U8
NumberOptionsLowByte
;
...
...
@@ -2733,7 +2815,8 @@ typedef struct _T_PN_SERVICE_APPLICATION_DATA_SET_IND {
typedef
T_PN_APPLICATION_OPTION_RESULT
T_PN_APPLICATION_OPTION_SET
;
typedef
struct
_T_PN_SERVICE_APPLICATION_DATA_SET_RES
{
typedef
struct
_T_PN_SERVICE_APPLICATION_DATA_SET_RES
{
PN_U8
NumberOptionsHighByte
;
PN_U8
NumberOptionsLowByte
;
...
...
@@ -2744,7 +2827,8 @@ typedef struct _T_PN_SERVICE_APPLICATION_DATA_SET_RES {
/*===========================================================================*/
typedef
struct
_T_PN_SERVICE_GET_ETHERNET_DATA_REQ
{
typedef
struct
_T_PN_SERVICE_GET_ETHERNET_DATA_REQ
{
PN_U16
DummyForCompiler
;
}
PACK_BYTE_ALIGNMENT
(
T_PN_SERVICE_GET_ETHERNET_DATA_REQ
);
...
...
@@ -2777,7 +2861,8 @@ typedef struct _T_PN_SERVICE_GET_ETHERNET_DATA_REQ {
#define PN_LINE_LENGTH_UNKNOWN (PN_U16)0xFFFFu
#define PN_DELAY_UNKNOWN (PN_U32)0uL
typedef
struct
_T_PN_PORT_DATA
{
typedef
struct
_T_PN_PORT_DATA
{
PN_U8
LinkState
;
PN_U8
Autonegotiation
;
...
...
@@ -2834,7 +2919,8 @@ typedef struct _T_PN_PORT_DATA {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_GET_ETHERNET_DATA_CON
{
typedef
struct
_T_PN_SERVICE_GET_ETHERNET_DATA_CON
{
PN_U8
Flags
;
PN_U8
AdditionalFlags
;
...
...
@@ -2865,7 +2951,8 @@ typedef struct _T_PN_SERVICE_GET_ETHERNET_DATA_CON {
/*===========================================================================*/
typedef
struct
_T_PN_CONNECT_IO_LOCATION
{
typedef
struct
_T_PN_CONNECT_IO_LOCATION
{
PN_U8
SlotNumberHighByte
;
PN_U8
SlotNumberLowByte
;
...
...
@@ -2879,7 +2966,8 @@ typedef struct _T_PN_CONNECT_IO_LOCATION {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_CONNECT_IOCR_API
{
typedef
struct
_T_PN_CONNECT_IOCR_API
{
PN_U8
APIHighWordHighByte
;
PN_U8
APIHighWordLowByte
;
PN_U8
APILowWordHighByte
;
...
...
@@ -2900,7 +2988,8 @@ typedef struct _T_PN_CONNECT_IOCR_API {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_CONNECT_IOCR
{
typedef
struct
_T_PN_CONNECT_IOCR
{
PN_U8
IOCRIdentifierHighByte
;
PN_U8
IOCRIdentifierLowByte
;
...
...
@@ -2927,7 +3016,8 @@ typedef struct _T_PN_CONNECT_IOCR {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_CONNECT_SUBMODULE
{
typedef
struct
_T_PN_CONNECT_SUBMODULE
{
PN_U8
SubSlotNumberHighByte
;
PN_U8
SubSlotNumberLowByte
;
...
...
@@ -2952,7 +3042,8 @@ typedef struct _T_PN_CONNECT_SUBMODULE {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_CONNECT_MODULE_API
{
typedef
struct
_T_PN_CONNECT_MODULE_API
{
PN_U8
APIHighWordHighByte
;
PN_U8
APIHighWordLowByte
;
PN_U8
APILowWordHighByte
;
...
...
@@ -2976,7 +3067,8 @@ typedef struct _T_PN_CONNECT_MODULE_API {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_CONNECT_MODULE
{
typedef
struct
_T_PN_CONNECT_MODULE
{
PN_U8
NumberOfAPIsHighByte
;
PN_U8
NumberOfAPIsLowByte
;
...
...
@@ -2988,7 +3080,8 @@ typedef struct _T_PN_CONNECT_MODULE {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_CONNECT_AR_VENDOR_BLOCK
{
typedef
struct
_T_PN_CONNECT_AR_VENDOR_BLOCK
{
PN_U8
VersionHighByte
;
PN_U8
VersionLowByte
;
...
...
@@ -3011,7 +3104,8 @@ typedef struct _T_PN_CONNECT_AR_VENDOR_BLOCK {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_CONNECT_REDUNDANCY_BLOCK
{
typedef
struct
_T_PN_CONNECT_REDUNDANCY_BLOCK
{
PN_U8
VersionHighByte
;
PN_U8
VersionLowByte
;
...
...
@@ -3032,7 +3126,8 @@ typedef struct _T_PN_CONNECT_REDUNDANCY_BLOCK {
#define PROFINET_AR_TYPE_IOCARSINGLE_RT3 (PN_U16)0x0010u
#define PROFINET_AR_TYPE_IOCAR_SR (PN_U16)0x0020u
typedef
struct
_T_PN_SERVICE_CONNECT_IND
{
typedef
struct
_T_PN_SERVICE_CONNECT_IND
{
PN_U8
ARIdentifierHighByte
;
PN_U8
ARIdentifierLowByte
;
...
...
@@ -3078,7 +3173,8 @@ typedef struct _T_PN_SERVICE_CONNECT_IND {
#define CONNECT_RES_ERROR_CODE1_AR_OUT_OF_RESOURCE 0x40u
#define CONNECT_RES_ERROR_CODE2_AR_OUT_OF_RESOURCE 0x04u
typedef
struct
_T_PN_SERVICE_CONNECT_RES
{
typedef
struct
_T_PN_SERVICE_CONNECT_RES
{
PN_U8
ARIdentifierHighByte
;
PN_U8
ARIdentifierLowByte
;
...
...
@@ -3100,7 +3196,8 @@ typedef struct _T_PN_SERVICE_CONNECT_RES {
/*===========================================================================*/
typedef
struct
_T_PN_SERVICE_WRITE_IND
{
typedef
struct
_T_PN_SERVICE_WRITE_IND
{
PN_U8
ARIdentifierHighByte
;
PN_U8
ARIdentifierLowByte
;
...
...
@@ -3138,7 +3235,8 @@ typedef struct _T_PN_SERVICE_WRITE_IND {
#define PN_SERVICE_WRITE_INVALID_SEQUENCE_NUMBER 0x07u
#define PN_SERVICE_WRITE_INVALID_AR_UUID 0x08u
typedef
struct
_T_PN_SERVICE_WRITE_REQ
{
typedef
struct
_T_PN_SERVICE_WRITE_REQ
{
PN_U8
VersionHighByte
;
PN_U8
VersionLowByte
;
...
...
@@ -3181,7 +3279,8 @@ typedef struct _T_PN_SERVICE_WRITE_REQ {
#define WRITE_RES_ERROR_CODE1_INVALID_SLOT_SUBSLOT 0xB2u
#define WRITE_RES_ERROR_CODE2_INVALID_SLOT_SUBSLOT 7u
typedef
struct
_T_PN_SERVICE_WRITE_RES
{
typedef
struct
_T_PN_SERVICE_WRITE_RES
{
PN_U8
ARIdentifierHighByte
;
PN_U8
ARIdentifierLowByte
;
...
...
@@ -3192,7 +3291,8 @@ typedef struct _T_PN_SERVICE_WRITE_RES {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_WRITE_CON
{
typedef
struct
_T_PN_SERVICE_WRITE_CON
{
PN_U16
DummyForCompiler
;
}
PACK_BYTE_ALIGNMENT
(
T_PN_SERVICE_WRITE_CON
);
...
...
@@ -3353,7 +3453,8 @@ typedef struct _T_PN_SERVICE_WRITE_CON {
PN_SERVICE_WRITE_INVALID_SEQUENCE_NUMBER
#define PN_SERVICE_READ_INVALID_AR_UUID PN_SERVICE_WRITE_INVALID_AR_UUID
typedef
struct
_T_PN_SERVICE_READ_IND
{
typedef
struct
_T_PN_SERVICE_READ_IND
{
PN_U8
ARIdentifierHighByte
;
PN_U8
ARIdentifierLowByte
;
...
...
@@ -3378,7 +3479,8 @@ typedef struct _T_PN_SERVICE_READ_IND {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_READ_REQ
{
typedef
struct
_T_PN_SERVICE_READ_REQ
{
PN_U8
VersionHighByte
;
PN_U8
VersionLowByte
;
...
...
@@ -3403,7 +3505,8 @@ typedef struct _T_PN_SERVICE_READ_REQ {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_READ_CON
{
typedef
struct
_T_PN_SERVICE_READ_CON
{
PN_U8
APIHighWordHighByte
;
PN_U8
APIHighWordLowByte
;
PN_U8
APILowWordHighByte
;
...
...
@@ -3445,7 +3548,8 @@ typedef struct _T_PN_SERVICE_READ_CON {
#define READ_RES_ERROR_CODE2_INVALID_SLOT_SUBSLOT \
WRITE_RES_ERROR_CODE2_INVALID_SLOT_SUBSLOT
typedef
struct
_T_PN_SERVICE_READ_RES
{
typedef
struct
_T_PN_SERVICE_READ_RES
{
PN_U8
ARIdentifierHighByte
;
PN_U8
ARIdentifierLowByte
;
...
...
@@ -3595,7 +3699,8 @@ typedef T_PN_SERVICE_READ_IND T_PN_SERVICE_IMPLICIT_READ_IND;
#define PN_SERVICE_IMPLICIT_READ_INVALID_TARGET_UUID \
(PN_SERVICE_IMPLICIT_READ_RESPONSE_TIMEOUT + 0x06u)
typedef
struct
_T_PN_SERVICE_IMPLICIT_READ_REQ
{
typedef
struct
_T_PN_SERVICE_IMPLICIT_READ_REQ
{
PN_U8
IpAddressHighWordHighByte
;
PN_U8
IpAddressHighWordLowByte
;
PN_U8
IpAddressLowWordHighByte
;
...
...
@@ -3635,7 +3740,8 @@ typedef struct _T_PN_SERVICE_IMPLICIT_READ_REQ {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_IMIPLICIT_READ_CON
{
typedef
struct
_T_PN_SERVICE_IMIPLICIT_READ_CON
{
PN_U8
TypeHighByte
;
PN_U8
TypeLowByte
;
...
...
@@ -3674,7 +3780,8 @@ typedef T_PN_SERVICE_READ_RES T_PN_SERVICE_IMPLICIT_READ_RES;
#define PN_SERVICE_LOOKUP_INVALID_RESPONSE \
(PN_SERVICE_LOOKUP_RESPONSE_TIMEOUT + 0x02u)
typedef
struct
_T_PN_SERVICE_LOOKUP_REQ
{
typedef
struct
_T_PN_SERVICE_LOOKUP_REQ
{
PN_U8
IpAddressHighWordHighByte
;
PN_U8
IpAddressHighWordLowByte
;
PN_U8
IpAddressLowWordHighByte
;
...
...
@@ -3684,7 +3791,8 @@ typedef struct _T_PN_SERVICE_LOOKUP_REQ {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_LOOKUP_CON
{
typedef
struct
_T_PN_SERVICE_LOOKUP_CON
{
PN_U8
InstanceHighByte
;
PN_U8
InstanceLowByte
;
...
...
@@ -3708,7 +3816,8 @@ typedef struct _T_PN_SERVICE_LOOKUP_CON {
#define PN_SERVICE_DISCOVER_INVALID_MAC_ADDRESS 0x01u
#define PN_SERVICE_DISCOVER_DCP_TIMEOUT 0x02u
typedef
struct
_T_PN_SERVICE_DISCOVER_REQ
{
typedef
struct
_T_PN_SERVICE_DISCOVER_REQ
{
PN_U8
Flags
;
PN_U8
Alignment
;
...
...
@@ -3729,7 +3838,8 @@ typedef struct _T_PN_SERVICE_DISCOVER_REQ {
#define PN_DISCOVER_BLOCK_TYPE_NODE_LOCAL_DATA 0x0001u
#define PN_DISCOVER_BLOCK_TYPE_NODE_REMOTE_DATA 0x0002u
typedef
struct
_T_PN_DISCOVER_BLOCK_HEADER
{
typedef
struct
_T_PN_DISCOVER_BLOCK_HEADER
{
PN_U8
TypeHighByte
;
PN_U8
TypeLowByte
;
...
...
@@ -3745,7 +3855,8 @@ typedef struct _T_PN_DISCOVER_BLOCK_HEADER {
typedef
T_PROFINET_UUID
T_MRP_UUID
;
typedef
struct
_T_PN_DISCOVER_NODE_LOCAL_IF_DATA_V10
{
typedef
struct
_T_PN_DISCOVER_NODE_LOCAL_IF_DATA_V10
{
PN_U8
InterfaceNumber
;
PN_U8
Alignment
;
...
...
@@ -3792,7 +3903,8 @@ typedef struct _T_PN_DISCOVER_NODE_LOCAL_IF_DATA_V10 {
#define PN_FEATURE_FRAGMENTATION_ENABLED 0x00000010uL
#define PN_FEATURE_FRAGMENTATION_SUPPORTED 0x00000020uL
typedef
struct
_T_PN_DISCOVER_NODE_LOCAL_PORT_DATA_V10
{
typedef
struct
_T_PN_DISCOVER_NODE_LOCAL_PORT_DATA_V10
{
PN_U8
InterfaceNumber
;
PN_U8
PortNumber
;
...
...
@@ -3840,7 +3952,8 @@ typedef struct _T_PN_DISCOVER_NODE_LOCAL_PORT_DATA_V10 {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_DISCOVER_NODE_LOCAL_DATA_V10
{
typedef
struct
_T_PN_DISCOVER_NODE_LOCAL_DATA_V10
{
T_PN_DISCOVER_BLOCK_HEADER
Header
;
PN_U8
ChassisIdTypeHighByte
;
...
...
@@ -3865,7 +3978,8 @@ typedef struct _T_PN_DISCOVER_NODE_LOCAL_DATA_V10 {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_DISCOVER_NODE_REMOTE_PEER_DATA_V10
{
typedef
struct
_T_PN_DISCOVER_NODE_REMOTE_PEER_DATA_V10
{
PN_U8
LocalInterfaceNumber
;
PN_U8
LocalPortNumber
;
...
...
@@ -3898,7 +4012,8 @@ typedef struct _T_PN_DISCOVER_NODE_REMOTE_PEER_DATA_V10 {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_DISCOVER_NODE_REMOTE_DATA_V10
{
typedef
struct
_T_PN_DISCOVER_NODE_REMOTE_DATA_V10
{
T_PN_DISCOVER_BLOCK_HEADER
Header
;
PN_U8
NumberOfPeerHighByte
;
...
...
@@ -3911,7 +4026,8 @@ typedef struct _T_PN_DISCOVER_NODE_REMOTE_DATA_V10 {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_DISCOVER_CON
{
typedef
struct
_T_PN_SERVICE_DISCOVER_CON
{
PN_U8
RemainingLengthHighByte
;
PN_U8
RemainingLengthLowByte
;
...
...
@@ -3938,7 +4054,8 @@ typedef T_PN_DIFF_MODULE_SUBSLOT T_PROFINET_MODULE_SUBSLOT_RES;
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_MODULE_RES
{
typedef
struct
_T_PROFINET_MODULE_RES
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
NumberOfAPIsHighByte
;
...
...
@@ -3952,7 +4069,8 @@ typedef struct _T_PROFINET_MODULE_RES {
/*===========================================================================*/
typedef
struct
_T_PROFINET_IOCR
{
typedef
struct
_T_PROFINET_IOCR
{
PN_U8
PropertiesHighWordHighByte
;
PN_U8
PropertiesHighWordLowByte
;
PN_U8
PropertiesLowWordHighByte
;
...
...
@@ -3974,7 +4092,8 @@ typedef struct _T_PROFINET_IOCR {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_API
{
typedef
struct
_T_PROFINET_API
{
PN_U8
APIHighWordHighByte
;
PN_U8
APIHighWordLowByte
;
PN_U8
APILowWordHighByte
;
...
...
@@ -3984,7 +4103,8 @@ typedef struct _T_PROFINET_API {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_AR_VENDOR
{
typedef
struct
_T_PROFINET_AR_VENDOR
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
APStructureIdentifierHighByte
;
...
...
@@ -4004,7 +4124,8 @@ typedef struct _T_PROFINET_AR_VENDOR {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_IOCR_DFP
{
typedef
struct
_T_PROFINET_IOCR_DFP
{
PN_U8
IOCRReferenceHighByte
;
PN_U8
IOCRReferenceLowByte
;
...
...
@@ -4020,7 +4141,8 @@ typedef struct _T_PROFINET_IOCR_DFP {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_IR_INFO
{
typedef
struct
_T_PROFINET_IR_INFO
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding1
[
2
];
...
...
@@ -4049,7 +4171,8 @@ typedef struct _T_PROFINET_IR_INFO {
#define PROFINET_SR_PROPERTIES_SET_INVALID_INPUT_INVALID 0x00000004u
#define PROFINET_SR_PROPERTIES_RESERVED2 0x0000FFF8u
typedef
struct
_T_PROFINET_SR_INFO
{
typedef
struct
_T_PROFINET_SR_INFO
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
DataHoldFactorHighByte
;
...
...
@@ -4068,8 +4191,8 @@ typedef struct _T_PROFINET_SR_INFO {
#define PROFINET_FSU_HELLO_ON_LINK_UP 0x00000001uL
#define PROFINET_FSU_HELLO_DELAYED_ON_LINK_UP 0x00000002uL
#define PROFINET_FSU_HELLO_MODE_MASK \
(PROFINET_FSU_HELLO_MODE_OFF | PROFINET_FSU_HELLO_ON_LINK_UP
\
|
PROFINET_FSU_HELLO_DELAYED_ON_LINK_UP)
(PROFINET_FSU_HELLO_MODE_OFF | PROFINET_FSU_HELLO_ON_LINK_UP
|
\
PROFINET_FSU_HELLO_DELAYED_ON_LINK_UP)
#define PROFINET_FSU_HELLO_INTERVAL_30MS 0x0000001EuL
#define PROFINET_FSU_HELLO_INTERVAL_50MS 0x00000032uL
...
...
@@ -4084,7 +4207,8 @@ typedef struct _T_PROFINET_SR_INFO {
#define PROFINET_FSU_HELLO_DELAY_500MS 0x000001F4uL
#define PROFINET_FSU_HELLO_DELAY_1S 0x000003E8uL
typedef
struct
_T_PROFINET_FS_HELLO
{
typedef
struct
_T_PROFINET_FS_HELLO
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -4116,7 +4240,8 @@ typedef struct _T_PROFINET_FS_HELLO {
#define PROFINET_FSU_PRM_MODE_OFF 0x00000000uL
#define PROFINET_FSU_PRM_MODE_ON 0x00000001uL
typedef
struct
_T_PROFINET_FS_PRM
{
typedef
struct
_T_PROFINET_FS_PRM
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding1
[
2
];
...
...
@@ -4133,7 +4258,8 @@ typedef struct _T_PROFINET_FS_PRM {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_FS
{
typedef
struct
_T_PROFINET_FS
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -4147,7 +4273,8 @@ typedef struct _T_PROFINET_FS {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_AR_FSU_ADJUST
{
typedef
struct
_T_PROFINET_AR_FSU_ADJUST
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -4163,7 +4290,8 @@ typedef T_PROFINET_AR_FSU_ADJUST T_PROFINET_AR_FSU;
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_INTERFACE_FSU_ADJUST
{
typedef
struct
_T_PROFINET_INTERFACE_FSU_ADJUST
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -4177,7 +4305,8 @@ typedef struct _T_PROFINET_INTERFACE_FSU_ADJUST {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_SRL_DATA
{
typedef
struct
_T_PROFINET_SRL_DATA
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
RedundancyInfoHighByte
;
...
...
@@ -4187,7 +4316,8 @@ typedef struct _T_PROFINET_SRL_DATA {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_AR_DATA_INFO
{
typedef
struct
_T_PROFINET_AR_DATA_INFO
{
PN_U8
NumberEntriesHighByte
;
PN_U8
NumberEntriesLowByte
;
...
...
@@ -4204,7 +4334,8 @@ typedef struct _T_PROFINET_AR_DATA_INFO {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_AR
{
typedef
struct
_T_PROFINET_AR
{
T_PROFINET_UUID
ARUUID
;
T_PROFINET_UUID
InitiatorUUID
;
T_PROFINET_UUID
PrmServerUUID
;
...
...
@@ -4263,7 +4394,8 @@ typedef struct _T_PROFINET_AR {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_AR_DATA
{
typedef
struct
_T_PROFINET_AR_DATA
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
NumberOfARsHighByte
;
...
...
@@ -4277,7 +4409,8 @@ typedef struct _T_PROFINET_AR_DATA {
/*===========================================================================*/
typedef
struct
_T_PROFINET_IM0_FILTER_SUBMODULE
{
typedef
struct
_T_PROFINET_IM0_FILTER_SUBMODULE
{
PN_U8
SubSlotNumberHighByte
;
PN_U8
SubSlotNumberLowByte
;
...
...
@@ -4293,7 +4426,8 @@ typedef T_PROFINET_IM0_FILTER_SUBMODULE T_PROFINET_EXPECTED_IDENT_SUBMODULE;
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_IM0_FILTER_MODULE
{
typedef
struct
_T_PROFINET_IM0_FILTER_MODULE
{
PN_U8
SlotNumberHighByte
;
PN_U8
SlotNumberLowByte
;
...
...
@@ -4316,7 +4450,8 @@ typedef T_PROFINET_IM0_FILTER_MODULE T_PROFINET_EXPECTED_IDENT_MODULE;
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_IM0_FILTER_API
{
typedef
struct
_T_PROFINET_IM0_FILTER_API
{
PN_U8
APIHighWordHighByte
;
PN_U8
APIHighWordLowByte
;
PN_U8
APILowWordHighByte
;
...
...
@@ -4336,7 +4471,8 @@ typedef T_PROFINET_IM0_FILTER_API T_PROFINET_EXPECTED_IDENT_API;
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_IM0_FILTER_DATA
{
typedef
struct
_T_PROFINET_IM0_FILTER_DATA
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
NumberOfAPIsHighByte
;
...
...
@@ -4350,7 +4486,8 @@ typedef struct _T_PROFINET_IM0_FILTER_DATA {
/*===========================================================================*/
typedef
struct
_T_PROFINET_API_DATA
{
typedef
struct
_T_PROFINET_API_DATA
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
NumberOfAPIsHighByte
;
...
...
@@ -4367,7 +4504,8 @@ typedef struct _T_PROFINET_API_DATA {
#define PROFINET_SUBMODULE_DATA_DESCRIPTION_INPUT (PN_U16)0x0001u
#define PROFINET_SUBMODULE_DATA_DESCRIPTION_OUTPUT (PN_U16)0x0002u
typedef
struct
_T_PROFINET_SUBMODULE_DATA
{
typedef
struct
_T_PROFINET_SUBMODULE_DATA
{
PN_U8
SubSlotNumberHighByte
;
PN_U8
SubSlotNumberLowByte
;
...
...
@@ -4383,7 +4521,8 @@ typedef struct _T_PROFINET_SUBMODULE_DATA {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_SUBMODULE_IO_DATA
{
typedef
struct
_T_PROFINET_SUBMODULE_IO_DATA
{
PN_U8
DataDescriptionHighByte
;
PN_U8
DataDescriptionLowByte
;
...
...
@@ -4397,7 +4536,8 @@ typedef struct _T_PROFINET_SUBMODULE_IO_DATA {
/*===========================================================================*/
typedef
struct
_T_PROFINET_MODULE_API
{
typedef
struct
_T_PROFINET_MODULE_API
{
PN_U8
APIHighWordHighByte
;
PN_U8
APIHighWordLowByte
;
PN_U8
APILowWordHighByte
;
...
...
@@ -4426,7 +4566,8 @@ typedef struct _T_PROFINET_MODULE_API {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_MODULE_REQ
{
typedef
struct
_T_PROFINET_MODULE_REQ
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
NumberOfAPIsHighByte
;
...
...
@@ -4444,7 +4585,8 @@ typedef T_PROFINET_MODULE_REQ T_PROFINET_MODULE_DIFF_DATA;
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_RECORD_INPUT_DATA
{
typedef
struct
_T_PROFINET_RECORD_INPUT_DATA
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
ConsumerStatusLength
;
...
...
@@ -4464,7 +4606,8 @@ typedef struct _T_PROFINET_RECORD_INPUT_DATA {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_OUTPUT_DATA_ITEM
{
typedef
struct
_T_PROFINET_OUTPUT_DATA_ITEM
{
PN_U8
ConsumerStatus
;
/*
PN_U8 Data [DataLength];
...
...
@@ -4481,7 +4624,8 @@ typedef struct _T_PROFINET_OUTPUT_DATA_ITEM {
#define PROFINET_FAIL_SAFE_SUBSTITUTION_ACTIVE (PN_U16)0x0001u
typedef
struct
_T_PROFINET_SUBSTITUTE_VALUE
{
typedef
struct
_T_PROFINET_SUBSTITUTE_VALUE
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
SubstitutionModeHighByte
;
...
...
@@ -4495,7 +4639,8 @@ typedef struct _T_PROFINET_SUBSTITUTE_VALUE {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_RECORD_OUTPUT_DATA
{
typedef
struct
_T_PROFINET_RECORD_OUTPUT_DATA
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
SubstituteActiveHighByte
;
...
...
@@ -4516,7 +4661,8 @@ typedef struct _T_PROFINET_RECORD_OUTPUT_DATA {
/*===========================================================================*/
typedef
struct
_T_PROFINET_TIMESTAMP
{
typedef
struct
_T_PROFINET_TIMESTAMP
{
PN_U8
HighPartHighWordHighByte
;
PN_U8
HighPartHighWordLowByte
;
PN_U8
HighPartLowWordHighByte
;
...
...
@@ -4531,7 +4677,8 @@ typedef struct _T_PROFINET_TIMESTAMP {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_LOG_ENTRY
{
typedef
struct
_T_PROFINET_LOG_ENTRY
{
T_PROFINET_TIMESTAMP
TimeStamp
;
T_PROFINET_UUID
ARUUID
;
...
...
@@ -4546,7 +4693,8 @@ typedef struct _T_PROFINET_LOG_ENTRY {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_LOG_DATA
{
typedef
struct
_T_PROFINET_LOG_DATA
{
T_PROFINET_BLOCK_HEADER
Header
;
T_PROFINET_TIMESTAMP
CurrentTimeStamp
;
...
...
@@ -4562,7 +4710,8 @@ typedef struct _T_PROFINET_LOG_DATA {
/*===========================================================================*/
typedef
struct
_T_PROFINET_PD_PEER_PORT
{
typedef
struct
_T_PROFINET_PD_PEER_PORT
{
PN_U8
LengthPeerPortId
;
/*
PN_U8 PeerPortId [LengthPeerPortId];
...
...
@@ -4572,7 +4721,8 @@ typedef struct _T_PROFINET_PD_PEER_PORT {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_PD_PEER_CHASSIS
{
typedef
struct
_T_PROFINET_PD_PEER_CHASSIS
{
PN_U8
LengthPeerChassisId
;
/*
PN_U8 PeerChassisId [LengthPeerChassisId];
...
...
@@ -4584,7 +4734,8 @@ typedef struct _T_PROFINET_PD_PEER_CHASSIS {
#define PROFINET_CABLE_DELAY_FORMAT_INDICATOR 0x80000000uL
typedef
struct
_T_PROFINET_PD_LINE_DELAY
{
typedef
struct
_T_PROFINET_PD_LINE_DELAY
{
PN_U8
DelayHighWordHighByte
;
PN_U8
DelayHighWordLowByte
;
PN_U8
DelayLowWordHighByte
;
...
...
@@ -4594,7 +4745,8 @@ typedef struct _T_PROFINET_PD_LINE_DELAY {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_PD_PEER_REAL
{
typedef
struct
_T_PROFINET_PD_PEER_REAL
{
T_PROFINET_PD_PEER_PORT
PeerPort
;
/*
T_PROFINET_PD_PEER_CHASSIS PeerChassis;
...
...
@@ -4607,7 +4759,8 @@ typedef struct _T_PROFINET_PD_PEER_REAL {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_PD_PEERS_REAL
{
typedef
struct
_T_PROFINET_PD_PEERS_REAL
{
PN_U8
NumberOfPeers
;
/*
PN_U8 Padding []; align to 32-Bit
...
...
@@ -4620,7 +4773,8 @@ typedef struct _T_PROFINET_PD_PEERS_REAL {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_PD_MAU_TYPE
{
typedef
struct
_T_PROFINET_PD_MAU_TYPE
{
PN_U8
TypeHighByte
;
PN_U8
TypeLowByte
;
...
...
@@ -4628,7 +4782,8 @@ typedef struct _T_PROFINET_PD_MAU_TYPE {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_PD_LINK_STATE
{
typedef
struct
_T_PROFINET_PD_LINK_STATE
{
PN_U8
StateHighByte
;
PN_U8
StateLowByte
;
...
...
@@ -4641,7 +4796,8 @@ typedef struct _T_PROFINET_PD_LINK_STATE {
#define PROFINET_MEDIA_TYPE_FIBER_OPTIC_CABLE (PN_U32)0x00000002uL
#define PROFINET_MEDIA_TYPE_RADIO (PN_U32)0x00000003uL
typedef
struct
_T_PROFINET_PD_MEDIA_TYPE
{
typedef
struct
_T_PROFINET_PD_MEDIA_TYPE
{
PN_U8
TypeHighWordHighByte
;
PN_U8
TypeHighWordLowByte
;
PN_U8
TypeLowWordHighByte
;
...
...
@@ -4655,14 +4811,15 @@ typedef struct _T_PROFINET_PD_MEDIA_TYPE {
#define PROFINET_RTC3_STATUS_UP (PN_U16)0x0002uL
#define PROFINET_RTC3_STATUS_RUN (PN_U16)0x0004uL
#define PROFINET_RTC3_STATUS_MASK_STATE \
(PN_U16)(PROFINET_RTC3_STATUS_OFF | PROFINET_RTC3_STATUS_UP
\
|
PROFINET_RTC3_STATUS_RUN)
(PN_U16)(PROFINET_RTC3_STATUS_OFF | PROFINET_RTC3_STATUS_UP
|
\
PROFINET_RTC3_STATUS_RUN)
#define PROFINET_RTC3_STATUS_FRAG_OFF (PN_U16)0x0000uL
#define PROFINET_RTC3_STATUS_FRAG_ON (PN_U16)0x1000uL
#define PROFINET_RTC3_STATUS_SHORTEN_PREAMBLE (PN_U16)0x2000uL
#define PROFINET_RTC3_STATUS_OPTIMIZED (PN_U16)0x8000uL
typedef
struct
_T_PROFINET_PD_PORT_SETTINGS
{
typedef
struct
_T_PROFINET_PD_PORT_SETTINGS
{
T_PROFINET_PD_MAU_TYPE
MAU
;
PN_U8
Padding1
[
2
];
/* align to 32-Bit */
...
...
@@ -4685,7 +4842,8 @@ typedef struct _T_PROFINET_PD_PORT_SETTINGS {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_PD_PORT_DATA_REAL
{
typedef
struct
_T_PROFINET_PD_PORT_DATA_REAL
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -4711,7 +4869,8 @@ typedef struct _T_PROFINET_PD_PORT_DATA_REAL {
typedef
T_PN_DEVICE_IP_INFO
T_PROFINET_IP_PARAMETER
;
typedef
struct
_T_PROFINET_PD_INTERFACE_DATA_REAL
{
typedef
struct
_T_PROFINET_PD_INTERFACE_DATA_REAL
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
LengthChassisId
;
...
...
@@ -4730,7 +4889,8 @@ typedef struct _T_PROFINET_PD_INTERFACE_DATA_REAL {
/*===========================================================================*/
typedef
struct
_T_PROFINET_PD_PEER_CHECK_DATA
{
typedef
struct
_T_PROFINET_PD_PEER_CHECK_DATA
{
T_PROFINET_PD_PEER_PORT
PeerPort
;
/*
T_PROFINET_PD_PEER_CHASSIS PeerChassis;
...
...
@@ -4740,7 +4900,8 @@ typedef struct _T_PROFINET_PD_PEER_CHECK_DATA {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_PD_PEER_CHECK
{
typedef
struct
_T_PROFINET_PD_PEER_CHECK
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
NumberOfPeers
;
...
...
@@ -4754,7 +4915,8 @@ typedef struct _T_PROFINET_PD_PEER_CHECK {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_PD_LINE_DELAY_CHECK
{
typedef
struct
_T_PROFINET_PD_LINE_DELAY_CHECK
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -4765,7 +4927,8 @@ typedef struct _T_PROFINET_PD_LINE_DELAY_CHECK {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_PD_MAU_TYPE_CHECK
{
typedef
struct
_T_PROFINET_PD_MAU_TYPE_CHECK
{
T_PROFINET_BLOCK_HEADER
Header
;
T_PROFINET_PD_MAU_TYPE
MAUType
;
...
...
@@ -4774,7 +4937,8 @@ typedef struct _T_PROFINET_PD_MAU_TYPE_CHECK {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_PD_LINK_STATE_CHECK
{
typedef
struct
_T_PROFINET_PD_LINK_STATE_CHECK
{
T_PROFINET_BLOCK_HEADER
Header
;
T_PROFINET_PD_LINK_STATE
Link
;
...
...
@@ -4788,7 +4952,8 @@ typedef struct _T_PROFINET_PD_LINK_STATE_CHECK {
#define PROFINET_DISABLE_SYNC_MASTER_CHECK (PN_U16)0x0000u
#define PROFINET_ENABLE_SYNC_MASTER_CHECK (PN_U16)0x0002u
typedef
struct
_T_PROFINET_PD_SYNC_DIFF_CHECK
{
typedef
struct
_T_PROFINET_PD_SYNC_DIFF_CHECK
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
SyncModeHighByte
;
...
...
@@ -4801,7 +4966,8 @@ typedef struct _T_PROFINET_PD_SYNC_DIFF_CHECK {
#define PROFINET_DISABLE_MAU_TYPE_CHECK (PN_U16)0x0000u
#define PROFINET_ENABLE_MAU_TYPE_CHECK (PN_U16)0x0001u
typedef
struct
_T_PROFINET_PD_MAU_TYPE_DIFF_CHECK
{
typedef
struct
_T_PROFINET_PD_MAU_TYPE_DIFF_CHECK
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
MAUTypeModeHighByte
;
...
...
@@ -4811,7 +4977,8 @@ typedef struct _T_PROFINET_PD_MAU_TYPE_DIFF_CHECK {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_PD_PORT_DATA_CHECK
{
typedef
struct
_T_PROFINET_PD_PORT_DATA_CHECK
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -4835,7 +5002,8 @@ typedef struct _T_PROFINET_PD_PORT_DATA_CHECK {
/*===========================================================================*/
typedef
struct
_T_PROFINET_PD_PORT_STATISTIC
{
typedef
struct
_T_PROFINET_PD_PORT_STATISTIC
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -4874,7 +5042,8 @@ typedef struct _T_PROFINET_PD_PORT_STATISTIC {
/*===========================================================================*/
typedef
struct
_T_PROFINET_NC_DATA_CHECK
{
typedef
struct
_T_PROFINET_NC_DATA_CHECK
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -4908,7 +5077,8 @@ typedef struct _T_PROFINET_NC_DATA_CHECK {
#define DEFAULT_MRP_LINK_CHANGE_COUNT (PN_U16)4u
#define MAX_MRP_LINK_CHANGE_COUNT (PN_U16)5u
typedef
struct
_T_PROFINET_MRP_CLIENT_PARAMS
{
typedef
struct
_T_PROFINET_MRP_CLIENT_PARAMS
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
LinkDownTimeHighByte
;
...
...
@@ -4924,7 +5094,8 @@ typedef struct _T_PROFINET_MRP_CLIENT_PARAMS {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_MRP_MANAGER_PARAMS
{
typedef
struct
_T_PROFINET_MRP_MANAGER_PARAMS
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
PriorityHighByte
;
...
...
@@ -4949,7 +5120,8 @@ typedef struct _T_PROFINET_MRP_MANAGER_PARAMS {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_MRP_PARAMS
{
typedef
struct
_T_PROFINET_MRP_PARAMS
{
union
{
T_PROFINET_MRP_CLIENT_PARAMS
Client
;
T_PROFINET_MRP_MANAGER_PARAMS
Manager
;
...
...
@@ -4963,7 +5135,8 @@ typedef struct _T_PROFINET_MRP_PARAMS {
#define MULTIPLE_INTERFACE_MODE_LEGACY 0x00000000uL
#define MULTIPLE_INTERFACE_MODE_LOCAL_CHASSIS_ID 0x00000001uL
typedef
struct
_T_PROFINET_PD_INTERFACE_DATA_ADJUST
{
typedef
struct
_T_PROFINET_PD_INTERFACE_DATA_ADJUST
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -4977,7 +5150,8 @@ typedef struct _T_PROFINET_PD_INTERFACE_DATA_ADJUST {
/*===========================================================================*/
typedef
struct
_T_PROFINET_PD_PORT_FO_ADJUST
{
typedef
struct
_T_PROFINET_PD_PORT_FO_ADJUST
{
T_PROFINET_BLOCK_HEADER
Header
;
/* TODO: define structure */
...
...
@@ -4986,7 +5160,8 @@ typedef struct _T_PROFINET_PD_PORT_FO_ADJUST {
/*===========================================================================*/
typedef
struct
_T_PROFINET_DOMAIN_BOUNDARY_ADJUST
{
typedef
struct
_T_PROFINET_DOMAIN_BOUNDARY_ADJUST
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding1
[
2
];
...
...
@@ -5010,7 +5185,8 @@ typedef struct _T_PROFINET_DOMAIN_BOUNDARY_ADJUST {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_MULTICAST_BOUNDARY_ADJUST
{
typedef
struct
_T_PROFINET_MULTICAST_BOUNDARY_ADJUST
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding1
[
2
];
...
...
@@ -5033,7 +5209,8 @@ typedef T_PROFINET_MULTICAST_BOUNDARY_ADJUST T_PROFINET_DCP_BOUNDARY_ADJUST;
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_MAU_TYPE_ADJUST
{
typedef
struct
_T_PROFINET_MAU_TYPE_ADJUST
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -5048,7 +5225,8 @@ typedef struct _T_PROFINET_MAU_TYPE_ADJUST {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_LINK_STATE_ADJUST
{
typedef
struct
_T_PROFINET_LINK_STATE_ADJUST
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -5065,7 +5243,8 @@ typedef struct _T_PROFINET_LINK_STATE_ADJUST {
#define PROFINET_ADJUST_SHORTEN_PREAMBLE (PN_U16)0x0001uL
typedef
struct
_T_PROFINET_PREAMBLE_LENGTH_ADJUST
{
typedef
struct
_T_PROFINET_PREAMBLE_LENGTH_ADJUST
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -5080,7 +5259,8 @@ typedef struct _T_PROFINET_PREAMBLE_LENGTH_ADJUST {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_PD_PORT_DATA_ADJUST
{
typedef
struct
_T_PROFINET_PD_PORT_DATA_ADJUST
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -5107,7 +5287,8 @@ typedef struct _T_PROFINET_PD_PORT_DATA_ADJUST {
#define MAX_MRP_DOMAIN_NAME_LENGTH PN_MAX_DEVICE_NAME_LENGTH
typedef
struct
_T_PROFINET_PD_INTERFACE_MRP_DATA_ADJUST
{
typedef
struct
_T_PROFINET_PD_INTERFACE_MRP_DATA_ADJUST
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding1
[
2
];
...
...
@@ -5130,7 +5311,8 @@ typedef struct _T_PROFINET_PD_INTERFACE_MRP_DATA_ADJUST {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_MRP_INSTANCE_DATA_ADJUST
{
typedef
struct
_T_PROFINET_MRP_INSTANCE_DATA_ADJUST
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding1
;
...
...
@@ -5154,7 +5336,8 @@ typedef struct _T_PROFINET_MRP_INSTANCE_DATA_ADJUST {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_PD_INTERFACE_MRP_DATA_ADJUST_V1_1
{
typedef
struct
_T_PROFINET_PD_INTERFACE_MRP_DATA_ADJUST_V1_1
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
;
...
...
@@ -5167,7 +5350,8 @@ typedef struct _T_PROFINET_PD_INTERFACE_MRP_DATA_ADJUST_V1_1 {
/*===========================================================================*/
typedef
struct
_T_PROFINET_MRP_RING_STATE
{
typedef
struct
_T_PROFINET_MRP_RING_STATE
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
StateHighByte
;
...
...
@@ -5177,7 +5361,8 @@ typedef struct _T_PROFINET_MRP_RING_STATE {
/*===========================================================================*/
typedef
struct
_T_PROFINET_PD_INTERFACE_MRP_DATA_REAL
{
typedef
struct
_T_PROFINET_PD_INTERFACE_MRP_DATA_REAL
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -5202,7 +5387,8 @@ typedef struct _T_PROFINET_PD_INTERFACE_MRP_DATA_REAL {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_MRP_INSTANCE_DATA_REAL
{
typedef
struct
_T_PROFINET_MRP_INSTANCE_DATA_REAL
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
;
...
...
@@ -5228,7 +5414,8 @@ typedef struct _T_PROFINET_MRP_INSTANCE_DATA_REAL {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_PD_INTERFACE_MRP_DATA_REAL_V1_1
{
typedef
struct
_T_PROFINET_PD_INTERFACE_MRP_DATA_REAL_V1_1
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
;
...
...
@@ -5246,7 +5433,8 @@ typedef struct _T_PROFINET_PD_INTERFACE_MRP_DATA_REAL_V1_1 {
#define MRP_CHECK_DOMAIN_UUID_DISABLE (PN_U32)0x00000000
#define MRP_CHECK_DOMAIN_UUID_ENABLE (PN_U32)0x00000002
typedef
struct
_T_PROFINET_PD_INTERFACE_MRP_DATA_CHECK
{
typedef
struct
_T_PROFINET_PD_INTERFACE_MRP_DATA_CHECK
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -5262,7 +5450,8 @@ typedef struct _T_PROFINET_PD_INTERFACE_MRP_DATA_CHECK {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_MRP_INSTANCE_DATA_CHECK
{
typedef
struct
_T_PROFINET_MRP_INSTANCE_DATA_CHECK
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
;
...
...
@@ -5277,7 +5466,8 @@ typedef struct _T_PROFINET_MRP_INSTANCE_DATA_CHECK {
}
PACK_BYTE_ALIGNMENT
(
T_PROFINET_MRP_INSTANCE_DATA_CHECK
);
typedef
struct
_T_PROFINET_PD_INTERFACE_MRP_DATA_CHECK_V1_1
{
typedef
struct
_T_PROFINET_PD_INTERFACE_MRP_DATA_CHECK_V1_1
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
;
...
...
@@ -5289,7 +5479,8 @@ typedef struct _T_PROFINET_PD_INTERFACE_MRP_DATA_CHECK_V1_1 {
/*===========================================================================*/
typedef
struct
_T_PROFINET_PD_PORT_MRP_DATA_ADJUST
{
typedef
struct
_T_PROFINET_PD_PORT_MRP_DATA_ADJUST
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -5305,7 +5496,8 @@ typedef T_PROFINET_PD_PORT_MRP_DATA_ADJUST T_PROFINET_PD_PORT_MRP_DATA_REAL;
#define PROFINET_MAX_LINE_RX_DELAY_UNKNOWN 0uL
#define PROFINET_YELLOW_TIME_DISABLE 0uL
typedef
struct
_T_PROFINET_PORT_GLOBAL_DATA_V1_1
{
typedef
struct
_T_PROFINET_PORT_GLOBAL_DATA_V1_1
{
PN_U8
MaxTxDelayHighWordHighByte
;
PN_U8
MaxTxDelayHighWordLowByte
;
PN_U8
MaxTxDelayLowWordHighByte
;
...
...
@@ -5322,7 +5514,8 @@ typedef struct _T_PROFINET_PORT_GLOBAL_DATA_V1_1 {
#define PROFINET_DEFAULT_YELLOW_TIME 0x0001E848uL
typedef
struct
_T_PROFINET_PORT_GLOBAL_DATA_V1_2
{
typedef
struct
_T_PROFINET_PORT_GLOBAL_DATA_V1_2
{
PN_U8
MaxTxDelayHighWordHighByte
;
PN_U8
MaxTxDelayHighWordLowByte
;
PN_U8
MaxTxDelayLowWordHighByte
;
...
...
@@ -5347,7 +5540,8 @@ typedef struct _T_PROFINET_PORT_GLOBAL_DATA_V1_2 {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_PDIR_GLOBAL_DATA
{
typedef
struct
_T_PROFINET_PDIR_GLOBAL_DATA
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -5382,12 +5576,13 @@ typedef struct _T_PROFINET_PDIR_GLOBAL_DATA {
#define PROFINET_TX_PORT_GROUP_6 0x40u
#define PROFINET_TX_PORT_GROUP_7 0x80u
#define PROFINET_TX_PORT_GROUP_ALL \
(PROFINET_TX_PORT_GROUP_LOCAL | PROFINET_TX_PORT_GROUP_1
\
| PROFINET_TX_PORT_GROUP_2 | PROFINET_TX_PORT_GROUP_3
\
| PROFINET_TX_PORT_GROUP_4 | PROFINET_TX_PORT_GROUP_5
\
|
PROFINET_TX_PORT_GROUP_6 | PROFINET_TX_PORT_GROUP_7)
(PROFINET_TX_PORT_GROUP_LOCAL | PROFINET_TX_PORT_GROUP_1
|
\
PROFINET_TX_PORT_GROUP_2 | PROFINET_TX_PORT_GROUP_3 |
\
PROFINET_TX_PORT_GROUP_4 | PROFINET_TX_PORT_GROUP_5 |
\
PROFINET_TX_PORT_GROUP_6 | PROFINET_TX_PORT_GROUP_7)
typedef
struct
_T_PROFINET_PDIR_FRAME_DATA_DETAIL
{
typedef
struct
_T_PROFINET_PDIR_FRAME_DATA_DETAIL
{
PN_U8
FrameSendOffsetHighWordHighByte
;
PN_U8
FrameSendOffsetHighWordLowByte
;
PN_U8
FrameSendOffsetLowWordHighByte
;
...
...
@@ -5430,19 +5625,20 @@ typedef struct _T_PROFINET_PDIR_FRAME_DATA_DETAIL {
#define PROFINET_RTC3_MULTICAST_ADDRESS 0x00000002uL
#define PROFINET_FF_MULTICAST_ADDRESS 0x00000004uL
#define PROFINET_MULTICAST_ADDRESS_MASK \
(PROFINET_LEGACY_MULTICAST_ADDRESS | PROFINET_RTC3_MULTICAST_ADDRESS
\
|
PROFINET_FF_MULTICAST_ADDRESS)
(PROFINET_LEGACY_MULTICAST_ADDRESS | PROFINET_RTC3_MULTICAST_ADDRESS
|
\
PROFINET_FF_MULTICAST_ADDRESS)
#define PROFINET_FRAGMENTATION_DISABLED 0x00000000uL
#define PROFINET_MAX_128_BYTE_FRAGMENTS 0x00000008uL
#define PROFINET_MAX_256_BYTE_FRAGMENTS 0x00000010uL
#define PROFINET_FRAGMENTATION_MASK \
(PROFINET_FRAGMENTATION_DISABLED | PROFINET_MAX_128_BYTE_FRAGMENTS
\
|
PROFINET_MAX_256_BYTE_FRAGMENTS)
(PROFINET_FRAGMENTATION_DISABLED | PROFINET_MAX_128_BYTE_FRAGMENTS
|
\
PROFINET_MAX_256_BYTE_FRAGMENTS)
#define PROFINET_PDIR_FRAME_PROPERTY_MASK 0x0000FFFFuL
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_PDIR_FRAME_DATA_V1_0
{
typedef
struct
_T_PROFINET_PDIR_FRAME_DATA_V1_0
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -5455,7 +5651,8 @@ typedef struct _T_PROFINET_PDIR_FRAME_DATA_V1_0 {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_PDIR_FRAME_DATA_V1_1
{
typedef
struct
_T_PROFINET_PDIR_FRAME_DATA_V1_1
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -5473,7 +5670,8 @@ typedef struct _T_PROFINET_PDIR_FRAME_DATA_V1_1 {
/*===========================================================================*/
typedef
struct
_T_PROFINET_RED_GUARD
{
typedef
struct
_T_PROFINET_RED_GUARD
{
PN_U8
StartOfRedFrameIdHighByte
;
PN_U8
StartOfRedFrameIdLowByte
;
...
...
@@ -5484,7 +5682,8 @@ typedef struct _T_PROFINET_RED_GUARD {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_PDIR_PERIOD_ASSIGNMENT
{
typedef
struct
_T_PROFINET_PDIR_PERIOD_ASSIGNMENT
{
PN_U8
RedOrangeHighWordHighByte
;
PN_U8
RedOrangeHighWordLowByte
;
PN_U8
RedOrangeLowWordHighByte
;
...
...
@@ -5504,7 +5703,8 @@ typedef struct _T_PROFINET_PDIR_PERIOD_ASSIGNMENT {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_PDIR_PHASE
{
typedef
struct
_T_PROFINET_PDIR_PHASE
{
PN_U8
AssignmentHighByte
;
PN_U8
AssignmentLowByte
;
...
...
@@ -5512,7 +5712,8 @@ typedef struct _T_PROFINET_PDIR_PHASE {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_PDIR_PHASE_ASSIGNMENT
{
typedef
struct
_T_PROFINET_PDIR_PHASE_ASSIGNMENT
{
T_PROFINET_PDIR_PHASE
Tx
;
T_PROFINET_PDIR_PHASE
Rx
;
...
...
@@ -5520,7 +5721,8 @@ typedef struct _T_PROFINET_PDIR_PHASE_ASSIGNMENT {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_PDIR_PORT_PHASE_DATA
{
typedef
struct
_T_PROFINET_PDIR_PORT_PHASE_DATA
{
PN_U8
NumberOfPhasesHighWordHighByte
;
PN_U8
NumberOfPhasesHighWordLowByte
;
PN_U8
NumberOfPhasesLowWordHighByte
;
...
...
@@ -5534,7 +5736,8 @@ typedef struct _T_PROFINET_PDIR_PORT_PHASE_DATA {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_PDIR_BEGIN_END_ASSIGNMENT
{
typedef
struct
_T_PROFINET_PDIR_BEGIN_END_ASSIGNMENT
{
T_PROFINET_PDIR_PERIOD_ASSIGNMENT
Tx
;
T_PROFINET_PDIR_PERIOD_ASSIGNMENT
Rx
;
...
...
@@ -5544,7 +5747,8 @@ typedef struct _T_PROFINET_PDIR_BEGIN_END_ASSIGNMENT {
#define MAX_NUMBER_PDIR_BEGIN_END_ASSIGNMENTS 0x00000010uL
typedef
struct
_T_PROFINET_PDIR_PORT_BEGIN_END_DATA
{
typedef
struct
_T_PROFINET_PDIR_PORT_BEGIN_END_DATA
{
PN_U8
NumberOfAssignmentsHighWordHighByte
;
PN_U8
NumberOfAssignmentsHighWordLowByte
;
PN_U8
NumberOfAssignmentsLowWordHighByte
;
...
...
@@ -5558,7 +5762,8 @@ typedef struct _T_PROFINET_PDIR_PORT_BEGIN_END_DATA {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_PDIR_BEGIN_END_DATA
{
typedef
struct
_T_PROFINET_PDIR_BEGIN_END_DATA
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -5579,7 +5784,8 @@ typedef struct _T_PROFINET_PDIR_BEGIN_END_DATA {
/*===========================================================================*/
typedef
struct
_T_PROFINET_PDIR_DATA
{
typedef
struct
_T_PROFINET_PDIR_DATA
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -5622,7 +5828,8 @@ typedef struct _T_PROFINET_PDIR_DATA {
#define PROFINET_SYNC_PROPERTY_ROLE_SLAVE 0x0001u
#define PROFINET_SYNC_PROPERTY_ROLE_MASTER 0x0002u
typedef
struct
_T_PROFINET_PD_SYNC_DATA
{
typedef
struct
_T_PROFINET_PD_SYNC_DATA
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -5678,7 +5885,8 @@ typedef struct _T_PROFINET_PD_SYNC_DATA {
/*===========================================================================*/
typedef
struct
_T_PROFINET_SUBFRAME_BLOCK
{
typedef
struct
_T_PROFINET_SUBFRAME_BLOCK
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
FrameIdHighByte
;
...
...
@@ -5700,7 +5908,8 @@ typedef struct _T_PROFINET_SUBFRAME_BLOCK {
#define PROFINET_MAX_NUMBER_SUBFRAME_BLOCKS 255u
typedef
struct
_T_PROFINET_PDIR_SUBFRAME_DATA
{
typedef
struct
_T_PROFINET_PDIR_SUBFRAME_DATA
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
NumberOfBlocksHighByte
;
...
...
@@ -5714,7 +5923,8 @@ typedef struct _T_PROFINET_PDIR_SUBFRAME_DATA {
/*===========================================================================*/
typedef
struct
_T_PROFINET_PDEV_DATA
{
typedef
struct
_T_PROFINET_PDEV_DATA
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -5729,7 +5939,8 @@ typedef struct _T_PROFINET_PDEV_DATA {
/*===========================================================================*/
typedef
struct
_T_PROFINET_IDENT_MAINTENANCE
{
typedef
struct
_T_PROFINET_IDENT_MAINTENANCE
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
VendorIdHighByte
;
...
...
@@ -5765,7 +5976,8 @@ typedef struct _T_PROFINET_IDENT_MAINTENANCE {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_IDENT_MAINTENANCE_1
{
typedef
struct
_T_PROFINET_IDENT_MAINTENANCE_1
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Function
[
PROFINET_IDENT_MAINTENANCE_FUNCTION_LENGTH
];
...
...
@@ -5775,7 +5987,8 @@ typedef struct _T_PROFINET_IDENT_MAINTENANCE_1 {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_IDENT_MAINTENANCE_2
{
typedef
struct
_T_PROFINET_IDENT_MAINTENANCE_2
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Date
[
PROFINET_IDENT_MAINTENANCE_DATE_LENGTH
];
...
...
@@ -5784,7 +5997,8 @@ typedef struct _T_PROFINET_IDENT_MAINTENANCE_2 {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_IDENT_MAINTENANCE_3
{
typedef
struct
_T_PROFINET_IDENT_MAINTENANCE_3
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Description
[
PROFINET_IDENT_MAINTENANCE_DESCRIPTION_LENGTH
];
...
...
@@ -5793,7 +6007,8 @@ typedef struct _T_PROFINET_IDENT_MAINTENANCE_3 {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_IDENT_MAINTENANCE_4
{
typedef
struct
_T_PROFINET_IDENT_MAINTENANCE_4
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Signature
[
PROFINET_IDENT_MAINTENANCE_SIGNATURE_LENGTH
];
...
...
@@ -5802,7 +6017,8 @@ typedef struct _T_PROFINET_IDENT_MAINTENANCE_4 {
/*===========================================================================*/
typedef
struct
_T_PROFINET_MULTIPLE_HEADER
{
typedef
struct
_T_PROFINET_MULTIPLE_HEADER
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
Padding
[
2
];
...
...
@@ -5825,7 +6041,8 @@ typedef T_PROFINET_MULTIPLE_HEADER T_PROFINET_PD_EXPECTED_DATA;
/*===========================================================================*/
typedef
struct
_T_PROFINET_RECORD_DIAGNOSIS
{
typedef
struct
_T_PROFINET_RECORD_DIAGNOSIS
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
APIHighWordHighByte
;
...
...
@@ -5859,7 +6076,8 @@ typedef struct _T_PROFINET_RECORD_DIAGNOSIS {
/*===========================================================================*/
typedef
struct
_T_PROFINET_SUBMODULE_LIST_ENTRY
{
typedef
struct
_T_PROFINET_SUBMODULE_LIST_ENTRY
{
PN_U8
APIHighWordHighByte
;
PN_U8
APIHighWordLowByte
;
PN_U8
APILowWordHighByte
;
...
...
@@ -5875,7 +6093,8 @@ typedef struct _T_PROFINET_SUBMODULE_LIST_ENTRY {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PROFINET_SUBMODULE_LIST
{
typedef
struct
_T_PROFINET_SUBMODULE_LIST
{
T_PROFINET_BLOCK_HEADER
Header
;
PN_U8
NumberEntriesHighByte
;
...
...
@@ -5896,7 +6115,8 @@ typedef struct _T_PROFINET_SUBMODULE_LIST {
#define C_CONTROL_COMMAND_READYFORRTCLASS3 0x0020u
#define C_CONTROL_COMMAND_PRM_BEGIN 0x0040u
typedef
struct
_T_PN_SERVICE_CONTROL_IND
{
typedef
struct
_T_PN_SERVICE_CONTROL_IND
{
PN_U8
ARIdentifierHighByte
;
PN_U8
ARIdentifierLowByte
;
...
...
@@ -5917,7 +6137,8 @@ typedef struct _T_PN_SERVICE_CONTROL_IND {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_CONTROL_RES_ERROR
{
typedef
struct
_T_PN_CONTROL_RES_ERROR
{
PN_U8
ErrorCode1
;
PN_U8
ErrorCode2
;
...
...
@@ -5930,7 +6151,8 @@ typedef struct _T_PN_CONTROL_RES_ERROR {
#define PROFINET_ERROR_CODE1_SUBMODULE_LIST_BLOCK_FAULTY 25u
typedef
struct
_T_PN_SERVICE_CONTROL_RES
{
typedef
struct
_T_PN_SERVICE_CONTROL_RES
{
PN_U8
ARIdentifierHighByte
;
PN_U8
ARIdentifierLowByte
;
...
...
@@ -5956,7 +6178,8 @@ typedef struct _T_PN_SERVICE_CONTROL_RES {
/*===========================================================================*/
typedef
struct
_T_PN_SERVICE_WRITE_MULTIPLE_IND
{
typedef
struct
_T_PN_SERVICE_WRITE_MULTIPLE_IND
{
PN_U8
ARIdentifierHighByte
;
PN_U8
ARIdentifierLowByte
;
...
...
@@ -5971,7 +6194,8 @@ typedef struct _T_PN_SERVICE_WRITE_MULTIPLE_IND {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_WRITE_MULTIPLE_REQ
{
typedef
struct
_T_PN_SERVICE_WRITE_MULTIPLE_REQ
{
PN_U8
NumberOfBlocksHighByte
;
PN_U8
NumberOfBlocksLowByte
;
...
...
@@ -5983,7 +6207,8 @@ typedef struct _T_PN_SERVICE_WRITE_MULTIPLE_REQ {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_WRITE_MULTIPLE_RES
{
typedef
struct
_T_WRITE_MULTIPLE_RES
{
PN_U8
ARIdentifierHighByte
;
PN_U8
ARIdentifierLowByte
;
...
...
@@ -6008,7 +6233,8 @@ typedef struct _T_WRITE_MULTIPLE_RES {
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_WRITE_MULTIPLE_RES
{
typedef
struct
_T_PN_SERVICE_WRITE_MULTIPLE_RES
{
PN_U8
ARIdentifierHighByte
;
PN_U8
ARIdentifierLowByte
;
...
...
@@ -6027,7 +6253,8 @@ typedef T_WRITE_MULTIPLE_RES T_WRITE_MULTIPLE_CON;
/*---------------------------------------------------------------------------*/
typedef
struct
_T_PN_SERVICE_WRITE_MULTIPLE_CON
{
typedef
struct
_T_PN_SERVICE_WRITE_MULTIPLE_CON
{
PN_U8
NumberOfBlocksHighByte
;
PN_U8
NumberOfBlocksLowByte
;
...
...
@@ -6041,10 +6268,11 @@ typedef struct _T_PN_SERVICE_WRITE_MULTIPLE_CON {
#define MAX_NUMBER_MISMATCH_ENTRIES \
((MAX_NUMBER_LOCAL_MISMATCH_ENTRIES > MAX_NUMBER_PEER_MISMATCH_ENTRIES) \
? MAX_NUMBER_LOCAL_MISMATCH_ENTRIES
\
: MAX_NUMBER_PEER_MISMATCH_ENTRIES)
? MAX_NUMBER_LOCAL_MISMATCH_ENTRIES
\
: MAX_NUMBER_PEER_MISMATCH_ENTRIES)
typedef
struct
_T_PN_SERVICE_LOCAL_AND_PEER_CHECK_IND
{
typedef
struct
_T_PN_SERVICE_LOCAL_AND_PEER_CHECK_IND
{
PN_U8
ARIdentifierHighByte
;
PN_U8
ARIdentifierLowByte
;
...
...
profibus/lib/rt/src/version.h
View file @
df0831a3
/*
* 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 */
...
...
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