Commit ec025559 authored by Marcus Nordenberg's avatar Marcus Nordenberg Committed by Claes Sjöfors

update profibus api

parent 655f779b
/* /******************************************************************************
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*******************************************************************************
* * * *
* SOFTING AG * * SOFTING Industrial Automation GmbH *
* Richard-Reitzner-Allee 6 * * Richard-Reitzner-Allee 6 *
* D-85540 Haar * * D-85540 Haar *
* Phone: (++49)-(0)89-45656-0 * * Phone: (++49)-(0)89-45656-0 *
* Fax: (++49)-(0)89-45656-399 * * Fax: (++49)-(0)89-45656-399 *
* * * *
* Copyright (C) SOFTING AG 1995-2003 * * Copyright (C) SOFTING Industrial Automation GmbH 1995-2012 *
* All Rights Reserved * * All Rights Reserved *
* * * *
******************************************************************************* *******************************************************************************
...@@ -55,11 +20,11 @@ MODULE PAPI ...@@ -55,11 +20,11 @@ MODULE PAPI
COMPONENT_LIBRARY PAPI Lib COMPONENT_LIBRARY PAPI Lib
PAPI DLL PAPI DLL
AUTHOR SOFTING AG AUTHOR SOFTING
VERSION 5.26.1.00.release VERSION 5.46.0.00.release
DATE 27-June-2003 DATE October-2011
STATUS finished STATUS finished
...@@ -67,12 +32,12 @@ STATUS finished ...@@ -67,12 +32,12 @@ STATUS finished
FUNCTIONAL_MODULE_DESCRIPTION FUNCTIONAL_MODULE_DESCRIPTION
PROFIBUS FMS/DPV1 Master and DP-Slave Application Program Interface (PAPI) for PROFIBUS DP Master, FMS/DPV1 Master and DP-Slave Application Program Interface
WinXP/Win2K/WinNT (PAPI) for Linux
------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------
This modul contains the PROFIBUS FMS/DPV1 Master and DP-Slave Application This modul contains the PROFIBUS DP Master, FMS/DPV1 Master and DP-Slave
Program Interface Application Program Interface
functions. functions.
...@@ -142,14 +107,35 @@ extern INT16 fmbgdl_get_data_len(INT16, USIGN8, USIGN8, USIGN8*, INT16*); ...@@ -142,14 +107,35 @@ extern INT16 fmbgdl_get_data_len(INT16, USIGN8, USIGN8, USIGN8*, INT16*);
EXPORT_DATA EXPORT_DATA
// --- global variables used for compatibility mode
HANDLE hServiceReadDevice = 0; // Handle for Service device
HANDLE hServiceWriteDevice = (HANDLE)0; // Handle for Service device
HANDLE hDpDataDevice = (HANDLE)0; // Handle for DP-Data device
HANDLE hDpsInputDataDevice = (HANDLE)0; // Handle for DP-Slave Input-Data device
HANDLE hDpsOutputDataDevice =
(HANDLE)0; // Handle for DP-Slave Output-Data device
USIGN8 CurrentBoardNumber = 0;
USIGN16 last_error = 0;
IMPORT_DATA IMPORT_DATA
LOCAL_DATA LOCAL_DATA
// --- copyright // --- copyright
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16) #if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
static const char copyright[] = "PROFIBUS WinXP/Win2K/WinNT API (c) Copyright "
"1995-2005. SOFTING AG. All Rights Reserved.";
// --- Operation Mode // --- Operation Mode
static USIGN32 OperationMode; static USIGN32 OperationMode;
#endif
#ifdef _LINUX
static const char copyright[] = "PROFIBUS Linux API (c) Copyright 1995-2005. "
"SOFTING AG. All Rights Reserved.";
#endif #endif
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16) #if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
...@@ -240,12 +226,12 @@ Possible return values: ...@@ -240,12 +226,12 @@ Possible return values:
Channel = 0; // for future use Channel = 0; // for future use
// --- open basic management device // --- open basic management device
sprintf( sprintf(DeviceName, "\\\\.\\PROFIBUS\\Board%u\\Pb%u\\Management", Board,
DeviceName, "\\\\.\\PROFIBUS\\Board%u\\Pb%u\\Management", Board, Channel); Channel);
return ( return (CreateFile(DeviceName, DesiredAccess,
CreateFile(DeviceName, DesiredAccess, FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)); FILE_ATTRIBUTE_NORMAL, NULL));
} }
#endif #endif
...@@ -253,7 +239,9 @@ Possible return values: ...@@ -253,7 +239,9 @@ Possible return values:
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16) #if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
FUNCTION GLOBAL HANDLE CALL_CONV profi_open(IN HANDLE hBasicMgmtDevice, FUNCTION GLOBAL HANDLE CALL_CONV profi_open(IN HANDLE hBasicMgmtDevice,
IN INT32 DeviceType, IN USIGN32 Index, IN INT32 DesiredAccess) IN INT32 DeviceType,
IN USIGN32 Index,
IN INT32 DesiredAccess)
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -293,7 +281,8 @@ Possible return values: ...@@ -293,7 +281,8 @@ Possible return values:
FUNCTION_BODY FUNCTION_BODY
// --- select IOCTL code specified by device type // --- select IOCTL code specified by device type
switch (DeviceType) { switch (DeviceType)
{
case DEVICE_DP_MANAGEMENT: case DEVICE_DP_MANAGEMENT:
IOControlCode = (DWORD)IOCTL_PROFI_CREATE_DP_MANAGEMENT; IOControlCode = (DWORD)IOCTL_PROFI_CREATE_DP_MANAGEMENT;
break; break;
...@@ -333,15 +322,16 @@ Possible return values: ...@@ -333,15 +322,16 @@ Possible return values:
// --- get device name // --- get device name
if (!DeviceIoControl((HANDLE)hBasicMgmtDevice, (DWORD)IOControlCode, if (!DeviceIoControl((HANDLE)hBasicMgmtDevice, (DWORD)IOControlCode,
(LPVOID)&Index, (DWORD)sizeof(ULONG), (LPVOID)DeviceName, (DWORD)128, (LPVOID)&Index, (DWORD)sizeof(ULONG), (LPVOID)DeviceName,
(LPDWORD)&BytesReturned, NULL)) { (DWORD)128, (LPDWORD)&BytesReturned, NULL))
{
return (INVALID_HANDLE_VALUE); return (INVALID_HANDLE_VALUE);
} }
// --- open device // --- open device
return ( return (CreateFile(DeviceName, DesiredAccess,
CreateFile(DeviceName, DesiredAccess, FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_ALWAYS,
NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)); FILE_ATTRIBUTE_NORMAL, NULL));
} }
#endif #endif
...@@ -376,9 +366,9 @@ Possible return values: ...@@ -376,9 +366,9 @@ Possible return values:
#endif #endif
FUNCTION GLOBAL INT16 CALL_CONV profi_read_service(IN HANDLE hDevice, FUNCTION GLOBAL INT16 CALL_CONV
OUT T_PROFI_SERVICE_DESCR* pSdb, OUT VOID* pData, profi_read_service(IN HANDLE hDevice, OUT T_PROFI_SERVICE_DESCR* pSdb,
INOUT USIGN16* pDataLength) OUT VOID* pData, INOUT USIGN16* pDataLength)
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -415,19 +405,25 @@ received ...@@ -415,19 +405,25 @@ received
// printf("papi: profi_read_service\n"); // printf("papi: profi_read_service\n");
// --- allocate memory for SDB and DATABLOCK // --- allocate memory for SDB and DATABLOCK
if (!(pSdbData = malloc((*pDataLength + sizeof(T_PROFI_SERVICE_DESCR))))) { if (!(pSdbData = malloc((*pDataLength + sizeof(T_PROFI_SERVICE_DESCR)))))
{
return (E_IF_OS_ERROR); return (E_IF_OS_ERROR);
} }
while ((BytesRead = read(hDevice, pSdbData, while ((BytesRead =
(int)(*pDataLength + sizeof(T_PROFI_SERVICE_DESCR)))) read(hDevice, pSdbData,
< 0) { (int)(*pDataLength + sizeof(T_PROFI_SERVICE_DESCR)))) < 0)
if (errno != EAGAIN) { {
if (errno != EAGAIN)
{
free(pSdbData); free(pSdbData);
printf("%s\n", strerror(errno)); printf("%s\n", strerror(errno));
// printf("bytesRead=%u\n",BytesRead); // printf("bytesRead=%u\n",BytesRead);
return (papi_get_last_error()); return (papi_get_last_error());
} else { }
else
{
*pDataLength = 0; *pDataLength = 0;
free(pSdbData); free(pSdbData);
// printf("bytesRead=%u\n",BytesRead); // printf("bytesRead=%u\n",BytesRead);
...@@ -439,12 +435,15 @@ received ...@@ -439,12 +435,15 @@ received
// printf("bytesRead=%u\n",BytesRead); // printf("bytesRead=%u\n",BytesRead);
// --- check if IND or CON is available // --- check if IND or CON is available
if (BytesRead == 0) { if (BytesRead == 0)
{
*pDataLength = 0; *pDataLength = 0;
// printf ("%s 3\n", strerror (errno)); // printf ("%s 3\n", strerror (errno));
free(pSdbData); free(pSdbData);
return (NO_CON_IND_RECEIVED); return (NO_CON_IND_RECEIVED);
} else { }
else
{
// printf("bytesRead=%u\n",BytesRead); // printf("bytesRead=%u\n",BytesRead);
} }
...@@ -456,7 +455,8 @@ received ...@@ -456,7 +455,8 @@ received
*pDataLength = (USIGN16)BytesRead - sizeof(T_PROFI_SERVICE_DESCR); *pDataLength = (USIGN16)BytesRead - sizeof(T_PROFI_SERVICE_DESCR);
// --- copy DATABLOCK // --- copy DATABLOCK
if (*pDataLength) { if (*pDataLength)
{
memcpy(pData, &pSdbData[sizeof(T_PROFI_SERVICE_DESCR)], *pDataLength); memcpy(pData, &pSdbData[sizeof(T_PROFI_SERVICE_DESCR)], *pDataLength);
} }
...@@ -504,7 +504,7 @@ RES ...@@ -504,7 +504,7 @@ RES
{ {
LOCAL_VARIABLES LOCAL_VARIABLES
INT16 RetVal; // return value INT16 RetVal; // return value
INT16 DataLength; // size of DATABLOCK INT16 DataLength; // size of DATABLOCK
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16) #if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
DWORD BytesWritten; DWORD BytesWritten;
...@@ -519,7 +519,8 @@ RES ...@@ -519,7 +519,8 @@ RES
pSdb->comm_ref &= 0x00FF; // clear all BITs in upper byte pSdb->comm_ref &= 0x00FF; // clear all BITs in upper byte
// --- check Service-Primitive // --- check Service-Primitive
if ((pSdb->primitive == IND) || (pSdb->primitive == CON)) { if ((pSdb->primitive == IND) || (pSdb->primitive == CON))
{
return (E_IF_INVALID_PRIMITIVE); return (E_IF_INVALID_PRIMITIVE);
} }
...@@ -528,35 +529,36 @@ RES ...@@ -528,35 +529,36 @@ RES
pSdb->result = POS; pSdb->result = POS;
// --- get service specific data length // --- get service specific data length
switch (pSdb->layer) { switch (pSdb->layer)
{
case FMS: case FMS:
RetVal = fmsgdl_get_data_len( RetVal = fmsgdl_get_data_len(pSdb->result, pSdb->service, pSdb->primitive,
pSdb->result, pSdb->service, pSdb->primitive, pData, &DataLength); pData, &DataLength);
break; break;
case FM7: case FM7:
RetVal = fm7gdl_get_data_len( RetVal = fm7gdl_get_data_len(pSdb->result, pSdb->service, pSdb->primitive,
pSdb->result, pSdb->service, pSdb->primitive, pData, &DataLength); pData, &DataLength);
break; break;
case FDLIF: case FDLIF:
RetVal = fdlgdl_get_data_len( RetVal = fdlgdl_get_data_len(pSdb->result, pSdb->service, pSdb->primitive,
pSdb->result, pSdb->service, pSdb->primitive, pData, &DataLength); pData, &DataLength);
break; break;
case DP: case DP:
RetVal = dpgdl_get_data_len( RetVal = dpgdl_get_data_len(pSdb->result, pSdb->service, pSdb->primitive,
pSdb->result, pSdb->service, pSdb->primitive, pData, &DataLength); pData, &DataLength);
break; break;
case FMB: case FMB:
RetVal = fmbgdl_get_data_len( RetVal = fmbgdl_get_data_len(pSdb->result, pSdb->service, pSdb->primitive,
pSdb->result, pSdb->service, pSdb->primitive, pData, &DataLength); pData, &DataLength);
break; break;
case DPS: case DPS:
RetVal = dpsgdl_get_data_len( RetVal = dpsgdl_get_data_len(pSdb->result, pSdb->service, pSdb->primitive,
pSdb->result, pSdb->service, pSdb->primitive, pData, &DataLength); pData, &DataLength);
break; break;
default: default:
...@@ -564,10 +566,12 @@ RES ...@@ -564,10 +566,12 @@ RES
break; break;
} }
if (RetVal == E_OK) { if (RetVal == E_OK)
{
// allocate memory for SDB and DATABLOCK // allocate memory for SDB and DATABLOCK
if (!(pSdbData if (!(pSdbData =
= (USIGN8*)malloc((DataLength + sizeof(T_PROFI_SERVICE_DESCR))))) { (USIGN8*)malloc((DataLength + sizeof(T_PROFI_SERVICE_DESCR)))))
{
return (E_IF_OS_ERROR); return (E_IF_OS_ERROR);
} }
...@@ -578,13 +582,13 @@ RES ...@@ -578,13 +582,13 @@ RES
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16) #if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
// write SDB and DATABLOCK // write SDB and DATABLOCK
if (!WriteFile((HANDLE)hDevice, (LPVOID)pSdbData, if (!WriteFile((HANDLE)hDevice, (LPVOID)pSdbData,
(DWORD)(DataLength + sizeof(T_PROFI_SERVICE_DESCR)), (DWORD)(DataLength + sizeof(T_PROFI_SERVICE_DESCR)),
(LPDWORD)&BytesWritten, NULL)) (LPDWORD)&BytesWritten, NULL))
#endif #endif
#ifdef _LINUX #ifdef _LINUX
if ((write(hDevice, pSdbData, DataLength + sizeof(T_PROFI_SERVICE_DESCR))) if ((write(hDevice, pSdbData,
< 0) DataLength + sizeof(T_PROFI_SERVICE_DESCR))) < 0)
#endif #endif
{ {
free(pSdbData); free(pSdbData);
...@@ -639,22 +643,25 @@ received ...@@ -639,22 +643,25 @@ received
FUNCTION_BODY FUNCTION_BODY
// --- allocate memory for SDB and DATABLOCK // --- allocate memory for SDB and DATABLOCK
if (!(pSdbData = malloc((*pDataLength + sizeof(T_PROFI_SERVICE_DESCR))))) { if (!(pSdbData = malloc((*pDataLength + sizeof(T_PROFI_SERVICE_DESCR)))))
{
return (E_IF_OS_ERROR); return (E_IF_OS_ERROR);
} }
// --- read service data from device // --- read service data from device
if (!DeviceIoControl((HANDLE)*phDevices, (DWORD)IOCTL_PROFI_READ_MULTI, if (!DeviceIoControl((HANDLE)*phDevices, (DWORD)IOCTL_PROFI_READ_MULTI,
(LPVOID)phDevices, (DWORD)NrOfHandles * sizeof(HANDLE), (LPVOID)phDevices, (DWORD)NrOfHandles * sizeof(HANDLE),
(LPVOID)pSdbData, (LPVOID)pSdbData,
(DWORD)(*pDataLength + sizeof(T_PROFI_SERVICE_DESCR)), (DWORD)(*pDataLength + sizeof(T_PROFI_SERVICE_DESCR)),
(LPDWORD)&BytesRead, NULL)) { (LPDWORD)&BytesRead, NULL))
{
free(pSdbData); free(pSdbData);
return (papi_get_last_error()); return (papi_get_last_error());
} }
// --- check if IND or CON is available // --- check if IND or CON is available
if (BytesRead == 0) { if (BytesRead == 0)
{
*pDataLength = 0; *pDataLength = 0;
free(pSdbData); free(pSdbData);
return (NO_CON_IND_RECEIVED); return (NO_CON_IND_RECEIVED);
...@@ -668,7 +675,8 @@ received ...@@ -668,7 +675,8 @@ received
*pDataLength = (USIGN16)BytesRead - sizeof(T_PROFI_SERVICE_DESCR); *pDataLength = (USIGN16)BytesRead - sizeof(T_PROFI_SERVICE_DESCR);
// --- copy DATABLOCK // --- copy DATABLOCK
if (*pDataLength) { if (*pDataLength)
{
memcpy(pData, &pSdbData[sizeof(T_PROFI_SERVICE_DESCR)], *pDataLength); memcpy(pData, &pSdbData[sizeof(T_PROFI_SERVICE_DESCR)], *pDataLength);
} }
...@@ -680,94 +688,10 @@ received ...@@ -680,94 +688,10 @@ received
#endif #endif
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
FUNCTION GLOBAL INT16 CALL_CONV profi_read_data(
IN HANDLE hDevice, OUT VOID* pData, INOUT USIGN16* pDataLength)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
This function is used to read DP-Slave-I/O-Data from a DP SLAVE DATA DEVICE.
IN: hDevice -> device handle
OUT: pData -> pointer to data buffer
INOUT: pDataLength -> IN: length of data buffer
OUT: length of received data
Possible return values:
- E_OK -> no error occured
- E_IF_INVALID_DP_STATE -> DP is not in operational state
- E_IF_SLAVE_ERROR -> no valid communication with DP-Slave
- E_IF_SLAVE_DIAG_DATA -> new DP diagnostics data available
- E_IF_INVALID_CMI_CALL -> invalid offset inside data image
- E_IF_CMI_ERROR -> serious CMI error
- E_IF_INVALID_DATA_SIZE -> size of data block provided not sufficient
- E_IF_SERVICE_CONSTR_CONFLICT -> service not executable at time
- E_IF_OS_ERROR -> NT system error
-----------------------------------------------------------------------------*/
{
LOCAL_VARIABLES
DWORD BytesRead = 0;
FUNCTION_BODY
if (!ReadFile(hDevice, pData, *pDataLength, &BytesRead, NULL)) {
*pDataLength = 0;
return (papi_get_last_error());
} else {
*pDataLength = (USIGN16)BytesRead;
return (E_OK);
}
}
#endif
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
FUNCTION GLOBAL INT16 CALL_CONV profi_write_data(
IN HANDLE hDevice, IN VOID* pData, IN USIGN16 DataLength)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
This function is used to write DP-Slave-I/O-Data to a DP SLAVE DATA DEVICE.
IN: hDevice -> device handle
IN: pData -> pointer to data buffer
IN: DataLength -> length of data to write
Possible return values:
- E_OK -> no error occured
- E_IF_INVALID_DP_STATE -> DP is not in operational state
- E_IF_SLAVE_ERROR -> no valid communication with DP-Slave
- E_IF_SLAVE_DIAG_DATA -> new DP diagnostics data available
- E_IF_INVALID_CMI_CALL -> invalid offset inside data image
- E_IF_CMI_ERROR -> serious CMI error
- E_IF_INVALID_DATA_SIZE -> size of data block provided not sufficient
- E_IF_SERVICE_CONSTR_CONFLICT -> service not executable at time
- E_IF_OS_ERROR -> NT system error
-----------------------------------------------------------------------------*/
{
LOCAL_VARIABLES
DWORD BytesWritten = 0;
FUNCTION_BODY
// write data
if (!WriteFile(hDevice, pData, DataLength, &BytesWritten, NULL)) {
return (papi_get_last_error());
} else {
return (E_OK);
}
}
#endif
FUNCTION GLOBAL INT16 CALL_CONV profi_read_dps_data(IN HANDLE hDevice, FUNCTION GLOBAL INT16 CALL_CONV profi_read_dps_data(IN HANDLE hDevice,
OUT USIGN8* pData, INOUT USIGN8* pDataLength, OUT USIGN8* pState) OUT USIGN8* pData,
INOUT USIGN8* pDataLength,
OUT USIGN8* pState)
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -810,7 +734,7 @@ Possible return values: ...@@ -810,7 +734,7 @@ Possible return values:
// --- read DPS input/output data and status // --- read DPS input/output data and status
if (ReadFile(hDevice, (LPVOID)DataBuffer, (DWORD)(*pDataLength + 1), if (ReadFile(hDevice, (LPVOID)DataBuffer, (DWORD)(*pDataLength + 1),
(LPDWORD)&BytesRead, NULL)) (LPDWORD)&BytesRead, NULL))
#endif #endif
#ifdef _LINUX #ifdef _LINUX
...@@ -821,14 +745,18 @@ Possible return values: ...@@ -821,14 +745,18 @@ Possible return values:
*pDataLength = (USIGN8)(BytesRead - 1); *pDataLength = (USIGN8)(BytesRead - 1);
memcpy(pData, DataBuffer, *pDataLength); memcpy(pData, DataBuffer, *pDataLength);
return (E_OK); return (E_OK);
} else { }
else
{
*pDataLength = 0; *pDataLength = 0;
return (papi_get_last_error()); return (papi_get_last_error());
} }
} }
FUNCTION GLOBAL INT16 CALL_CONV profi_write_dps_data(IN HANDLE hDevice, FUNCTION GLOBAL INT16 CALL_CONV profi_write_dps_data(IN HANDLE hDevice,
IN USIGN8* pData, IN USIGN8 DataLength, OUT USIGN8* pState) IN USIGN8* pData,
IN USIGN8 DataLength,
OUT USIGN8* pState)
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -857,6 +785,7 @@ data size ...@@ -857,6 +785,7 @@ data size
#ifdef _LINUX #ifdef _LINUX
NTIoctl SlaveInput; NTIoctl SlaveInput;
char FirstByte;
#endif #endif
FUNCTION_BODY FUNCTION_BODY
...@@ -865,8 +794,8 @@ data size ...@@ -865,8 +794,8 @@ data size
// --- write DPS input data and read status // --- write DPS input data and read status
if (!DeviceIoControl((HANDLE)hDevice, (DWORD)IOCTL_PROFI_SET_DPS_DATA, if (!DeviceIoControl((HANDLE)hDevice, (DWORD)IOCTL_PROFI_SET_DPS_DATA,
(LPVOID)pData, (DWORD)DataLength, (LPVOID)pState, (LPVOID)pData, (DWORD)DataLength, (LPVOID)pState,
(DWORD)sizeof(USIGN8), (LPDWORD)&BytesReturned, NULL)) (DWORD)sizeof(USIGN8), (LPDWORD)&BytesReturned, NULL))
#endif #endif
#ifdef _LINUX #ifdef _LINUX
...@@ -875,271 +804,31 @@ data size ...@@ -875,271 +804,31 @@ data size
SlaveInput.OutBuf = (USIGN8*)pData; SlaveInput.OutBuf = (USIGN8*)pData;
SlaveInput.OutBufLength = DataLength; SlaveInput.OutBufLength = DataLength;
if (ioctl(hDevice, IOCTL_PROFI_SET_SLAVE_IN, &SlaveInput) == -1) if (DataLength)
#endif
{ {
return (papi_get_last_error()); FirstByte = pData[0];
} else {
return (E_OK);
}
}
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
FUNCTION GLOBAL BOOL CALL_CONV profi_get_cntrl_info(IN USIGN8 Board,
OUT char* pFirmwareVersion, OUT USIGN32* pSerialDeviceNumber)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
This function is used to get the version of the firmware and the serial
device number of PROFIBUS controller.
IN: Board -> board number
OUT: pFirmwareVersion -> data buffer for firmware version string
OUT: pSerialDeviceNumber -> serial device number
NOTE: There must be at least 100 Bytes (VERSION_STRING_LENGTH) free space for
firmware version buffer.
Possible return values:
- TRUE -> function returns sucessfully
- FALSE -> function returns not successfully
-----------------------------------------------------------------------------*/
{
LOCAL_VARIABLES
DWORD BytesRead = 0;
HANDLE hDevice;
PROFI_DATA_IMAGE_DESCR DataImageDescr;
char DeviceName[64];
FUNCTION_BODY
// --- open BOARD device
sprintf(DeviceName, "\\\\.\\PROFIBUS\\Board%u\\Board", Board);
if (INVALID_HANDLE_VALUE
== (hDevice = CreateFile(DeviceName, GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL))) {
return (FALSE);
}
// --- get FIRMWARE VERSION
DataImageDescr.imageId = ID_FW_VERS_IMAGE;
DataImageDescr.offset = 0;
DataImageDescr.bus = 0;
if (!DeviceIoControl((HANDLE)hDevice, (DWORD)IOCTL_PROFI_GET_DATA_IMAGE,
(LPVOID)&DataImageDescr, (DWORD)sizeof(DataImageDescr),
(LPVOID)pFirmwareVersion, (DWORD)VERSION_STRING_LENGTH,
(LPDWORD)&BytesRead, NULL)) {
CloseHandle(hDevice);
return (FALSE);
} }
// printf("\nprofi_get_data: buf=%p, len=%u, size=%lu\n",
// SlaveInput.InBuf,
// SlaveInput.InBufLength,
// sizeof(SlaveInput));
// --- get SERIAL DEVICE NUMBER if (ioctl(hDevice, IOCTL_PROFI_SET_SLAVE_IN, &SlaveInput) == -1)
DataImageDescr.imageId = ID_SERIAL_DEVICE_NUMBER;
DataImageDescr.offset = 0;
DataImageDescr.bus = 0;
if (!DeviceIoControl((HANDLE)hDevice, (DWORD)IOCTL_PROFI_GET_DATA_IMAGE,
(LPVOID)(VOID*)&DataImageDescr, (DWORD)sizeof(DataImageDescr),
(LPVOID)pSerialDeviceNumber, (DWORD)sizeof(USIGN32),
(LPDWORD)&BytesRead, NULL)) {
CloseHandle(hDevice);
return (FALSE);
}
CloseHandle(hDevice);
return (TRUE);
}
#endif
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
FUNCTION GLOBAL BOOL CALL_CONV profi_set_timeout(
IN HANDLE hBasicMgmtDevice, IN USIGN32 ReadTimeout, IN USIGN32 WriteTimeout)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
This function is used to set send and receive TIMEOUTs for SEND/RECEIVE
interface
functions
IN: hBasicMgmtDevice -> basic management device handle
IN: ReadTimeout -> receive timeout in ms (WAIT_FOREVER for infinite wait)
IN: WriteTimeout -> send timeout in ms (WAIT_FOREVER for infinite wait)
Possible return values:
- TRUE -> function returns sucessfully
- FALSE -> function returns not successfully
-----------------------------------------------------------------------------*/
{
LOCAL_VARIABLES
DWORD BytesReturned;
USIGN32 ReadWriteTimeout[2];
FUNCTION_BODY
ReadWriteTimeout[0] = ReadTimeout;
ReadWriteTimeout[1] = WriteTimeout;
return (
DeviceIoControl((HANDLE)hBasicMgmtDevice, (DWORD)IOCTL_PROFI_SET_TIMEOUT,
(LPVOID)ReadWriteTimeout, (DWORD)2 * sizeof(USIGN32), (LPVOID)NULL,
(DWORD)0, (LPDWORD)&BytesReturned, NULL));
}
#endif #endif
{
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16) return (papi_get_last_error());
FUNCTION GLOBAL BOOL CALL_CONV profi_get_timeout(IN HANDLE hBasicMgmtDevice,
OUT USIGN32* pReadTimeout, OUT USIGN32* pWriteTimeout)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
This function is used to get the set send and receive TIMEOUTs for SEND/RECEIVE
interface functions
IN: hBasicMgmtDevice -> basic management device handle
OUT: pReadTimeout -> pointer to receive timeout in ms (WAIT_FOREVER for
infinite wait)
OUT: pWriteTimeout -> pointer to send timeout in ms (WAIT_FOREVER for
infinite wait)
Possible return values:
- TRUE -> function returns sucessfully
- FALSE -> function returns not successfully
-----------------------------------------------------------------------------*/
{
LOCAL_VARIABLES
DWORD BytesReturned;
USIGN32 ReadWriteTimeout[2];
FUNCTION_BODY
if (!DeviceIoControl((HANDLE)hBasicMgmtDevice, (DWORD)IOCTL_PROFI_GET_TIMEOUT,
(LPVOID)NULL, (DWORD)0, (LPVOID)ReadWriteTimeout,
(DWORD)2 * sizeof(USIGN32), (LPDWORD)&BytesReturned, NULL)) {
return (FALSE);
} }
else
{
if (DataLength)
{
pData[0] = FirstByte;
}
if (BytesReturned == 8) { return (E_OK);
*pReadTimeout = ReadWriteTimeout[0];
*pWriteTimeout = ReadWriteTimeout[1];
return (TRUE);
} else {
SetLastError(ERROR_INVALID_DATA);
return (FALSE);
} }
} }
#endif
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
FUNCTION GLOBAL BOOL CALL_CONV profi_set_queue_size(
IN HANDLE hBasicMgmtDevice, IN USIGN32 QueueSize)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
This function is used to set the max. receive queue size for the PROFIBUS
driver.
IN: hBasicMgmtDevice -> basic management device handle
IN: QueueSize -> max. receive queue size
Possible return values:
- TRUE -> function returns sucessfully
- FALSE -> function returns not successfully
-----------------------------------------------------------------------------*/
{
LOCAL_VARIABLES
DWORD BytesReturned;
FUNCTION_BODY
return (DeviceIoControl((HANDLE)hBasicMgmtDevice,
(DWORD)IOCTL_PROFI_SET_QUEUE_SIZE, (LPVOID)&QueueSize,
(DWORD)sizeof(USIGN32), (LPVOID)NULL, (DWORD)0, (LPDWORD)&BytesReturned,
NULL));
}
#endif
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
FUNCTION GLOBAL BOOL CALL_CONV profi_get_queue_size(
IN HANDLE hBasicMgmtDevice, OUT USIGN32* pQueueSize)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
This function is used to get the set max. receive queue size for the PROFIBUS
driver.
IN: hBasicMgmtDevice -> basic management device handle
OUT: pQueueSize -> pointer to max. receive queue size
Possible return values:
- TRUE -> function returns sucessfully
- FALSE -> function returns not successfully
-----------------------------------------------------------------------------*/
{
LOCAL_VARIABLES
DWORD BytesReturned;
FUNCTION_BODY
return (DeviceIoControl((HANDLE)hBasicMgmtDevice,
(DWORD)IOCTL_PROFI_GET_QUEUE_SIZE, (LPVOID)NULL, (DWORD)0,
(LPVOID)pQueueSize, (DWORD)sizeof(USIGN32), (LPDWORD)&BytesReturned,
NULL));
}
#endif
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
FUNCTION GLOBAL BOOL CALL_CONV profi_get_overrun_count(
IN HANDLE hBasicMgmtDevice, OUT USIGN32* pOverrunCount)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
IN: hBasicMgmtDevice -> basic management device handle
OUT: pOverrunCount -> pointer to overrun counts
Possible return values:
- TRUE -> function returns sucessfully
- FALSE -> function returns not successfully
-----------------------------------------------------------------------------*/
{
LOCAL_VARIABLES
DWORD BytesReturned;
FUNCTION_BODY
return (DeviceIoControl((HANDLE)hBasicMgmtDevice,
(DWORD)IOCTL_PROFI_GET_OVERRUN_COUNT, (LPVOID)NULL, (DWORD)0,
(LPVOID)pOverrunCount, (DWORD)sizeof(USIGN32), (LPDWORD)&BytesReturned,
NULL));
}
#endif
// *************************************************************************** // ***************************************************************************
// *************************************************************************** // ***************************************************************************
// * // *
...@@ -1149,9 +838,10 @@ Possible return values: ...@@ -1149,9 +838,10 @@ Possible return values:
// *************************************************************************** // ***************************************************************************
// *************************************************************************** // ***************************************************************************
FUNCTION GLOBAL INT16 CALL_CONV profi_set_default( FUNCTION GLOBAL INT16 CALL_CONV profi_set_default(IN USIGN8 Board,
OUT T_PROFI_DEVICE_HANDLE* hDevice, IN USIGN8 Board, IN USIGN8 Channel, IN USIGN8 Channel,
IN USIGN32 ReadTimeout, IN USIGN32 WriteTimeout) IN USIGN32 ReadTimeout,
IN USIGN32 WriteTimeout)
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -1182,55 +872,63 @@ version ...@@ -1182,55 +872,63 @@ version
USIGN32 ReadWriteTimeout[2]; USIGN32 ReadWriteTimeout[2];
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16) #if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
DWORD BytesReturned; DWORD BytesReturned;
#endif #endif
FUNCTION_BODY FUNCTION_BODY
if (hDevice->hServiceReadDevice || hDevice->hServiceWriteDevice if (hServiceReadDevice || hServiceWriteDevice || hDpDataDevice)
|| hDevice->hDpDataDevice) { {
return E_IF_SERVICE_NOT_EXECUTABLE; // Application has called init_profibus return E_IF_SERVICE_NOT_EXECUTABLE; // Application has called init_profibus
// before // before
} }
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16) #if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
if (!ReadBoardRegistryEntries(Board, &OperationMode)) { if (!ReadBoardRegistryEntries(Board, &OperationMode))
{
return (E_IF_READING_REGISTRY); return (E_IF_READING_REGISTRY);
} }
// get service device name // get service device name
sprintf( sprintf(DeviceName, "\\\\.\\PROFIBUS\\Board%u\\Pb%u\\Service", Board,
DeviceName, "\\\\.\\PROFIBUS\\Board%u\\Pb%u\\Service", Board, Channel); Channel);
// Open service device for read access // Open service device for read access
hServiceReadDevice = CreateFile(DeviceName, GENERIC_READ | GENERIC_WRITE, 0, hServiceReadDevice =
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); CreateFile(DeviceName, GENERIC_READ | GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hServiceReadDevice == INVALID_HANDLE_VALUE) { if (hServiceReadDevice == INVALID_HANDLE_VALUE)
{
hServiceReadDevice = NULL; hServiceReadDevice = NULL;
return (E_IF_OS_ERROR); return (E_IF_OS_ERROR);
} }
// Open service device for write access // Open service device for write access
hServiceWriteDevice = CreateFile(DeviceName, GENERIC_WRITE, 0, NULL, hServiceWriteDevice = CreateFile(DeviceName, GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hServiceWriteDevice == INVALID_HANDLE_VALUE) { if (hServiceWriteDevice == INVALID_HANDLE_VALUE)
{
CloseHandle(hServiceReadDevice); CloseHandle(hServiceReadDevice);
hServiceReadDevice = NULL; hServiceReadDevice = NULL;
hServiceWriteDevice = NULL; hServiceWriteDevice = NULL;
return (E_IF_OS_ERROR); return (E_IF_OS_ERROR);
} }
if (OperationMode == FMS_DPV1_MASTER_MODE) { if (OperationMode == FMS_DPV1_MASTER_MODE)
{
// --- get DP-Master's Data device name // --- get DP-Master's Data device name
sprintf( sprintf(DeviceName, "\\\\.\\PROFIBUS\\Board%u\\Pb%u\\DpData", Board,
DeviceName, "\\\\.\\PROFIBUS\\Board%u\\Pb%u\\DpData", Board, Channel); Channel);
hDpDataDevice = CreateFile(DeviceName, GENERIC_READ | GENERIC_WRITE, 0, hDpDataDevice =
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); CreateFile(DeviceName, GENERIC_READ | GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hDpDataDevice == INVALID_HANDLE_VALUE) { if (hDpDataDevice == INVALID_HANDLE_VALUE)
{
CloseHandle(hServiceReadDevice); CloseHandle(hServiceReadDevice);
CloseHandle(hServiceWriteDevice); CloseHandle(hServiceWriteDevice);
hServiceReadDevice = NULL; hServiceReadDevice = NULL;
...@@ -1238,15 +936,19 @@ version ...@@ -1238,15 +936,19 @@ version
hDpDataDevice = NULL; hDpDataDevice = NULL;
return (E_IF_OS_ERROR); return (E_IF_OS_ERROR);
} }
} else { }
else
{
// get DP-Slave Input-Data device name // get DP-Slave Input-Data device name
sprintf(DeviceName, "\\\\.\\PROFIBUS\\Board%u\\Pb%u\\DpSlaveInputData", sprintf(DeviceName, "\\\\.\\PROFIBUS\\Board%u\\Pb%u\\DpSlaveInputData",
Board, Channel); Board, Channel);
hDpsInputDataDevice = CreateFile(DeviceName, GENERIC_READ | GENERIC_WRITE, hDpsInputDataDevice =
0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); CreateFile(DeviceName, GENERIC_READ | GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hDpsInputDataDevice == INVALID_HANDLE_VALUE) { if (hDpsInputDataDevice == INVALID_HANDLE_VALUE)
{
CloseHandle(hServiceReadDevice); CloseHandle(hServiceReadDevice);
CloseHandle(hServiceWriteDevice); CloseHandle(hServiceWriteDevice);
hServiceReadDevice = NULL; hServiceReadDevice = NULL;
...@@ -1257,12 +959,14 @@ version ...@@ -1257,12 +959,14 @@ version
// get DP-Slave Output-Data device name // get DP-Slave Output-Data device name
sprintf(DeviceName, "\\\\.\\PROFIBUS\\Board%u\\Pb%u\\DpSlaveOutputData", sprintf(DeviceName, "\\\\.\\PROFIBUS\\Board%u\\Pb%u\\DpSlaveOutputData",
Board, Channel); Board, Channel);
hDpsOutputDataDevice = CreateFile(DeviceName, GENERIC_READ | GENERIC_WRITE, hDpsOutputDataDevice =
0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); CreateFile(DeviceName, GENERIC_READ | GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hDpsOutputDataDevice == INVALID_HANDLE_VALUE) { if (hDpsOutputDataDevice == INVALID_HANDLE_VALUE)
{
CloseHandle(hServiceReadDevice); CloseHandle(hServiceReadDevice);
CloseHandle(hServiceWriteDevice); CloseHandle(hServiceWriteDevice);
CloseHandle(hDpsInputDataDevice); CloseHandle(hDpsInputDataDevice);
...@@ -1278,9 +982,10 @@ version ...@@ -1278,9 +982,10 @@ version
ReadWriteTimeout[1] = WriteTimeout; ReadWriteTimeout[1] = WriteTimeout;
if (!DeviceIoControl((HANDLE)hServiceReadDevice, if (!DeviceIoControl((HANDLE)hServiceReadDevice,
(DWORD)IOCTL_PROFI_SET_TIMEOUT, (LPVOID)ReadWriteTimeout, (DWORD)IOCTL_PROFI_SET_TIMEOUT, (LPVOID)ReadWriteTimeout,
(DWORD)2 * sizeof(USIGN32), (LPVOID)NULL, (DWORD)0, (DWORD)2 * sizeof(USIGN32), (LPVOID)NULL, (DWORD)0,
(LPDWORD)&BytesReturned, NULL)) { (LPDWORD)&BytesReturned, NULL))
{
CloseHandle(hServiceReadDevice); CloseHandle(hServiceReadDevice);
CloseHandle(hServiceWriteDevice); CloseHandle(hServiceWriteDevice);
if (hDpDataDevice) if (hDpDataDevice)
...@@ -1310,56 +1015,59 @@ version ...@@ -1310,56 +1015,59 @@ version
sprintf(DeviceName, "/dev/pbservice%u", Board + Channel); sprintf(DeviceName, "/dev/pbservice%u", Board + Channel);
// Open service device for read access // Open service device for read access
hDevice->hServiceReadDevice = open(DeviceName, O_RDWR | O_NONBLOCK); hServiceReadDevice = open(DeviceName, O_RDWR | O_NONBLOCK);
if (hDevice->hServiceReadDevice == INVALID_HANDLE_VALUE) { if (hServiceReadDevice == INVALID_HANDLE_VALUE)
hDevice->hServiceReadDevice = (HANDLE)NULL; {
hServiceReadDevice = (HANDLE)0;
return (E_IF_OS_ERROR); return (E_IF_OS_ERROR);
} }
// Open service device for write access // Open service device for write access
hDevice->hServiceWriteDevice = hDevice->hServiceReadDevice; hServiceWriteDevice = hServiceReadDevice;
// --- get DP-Master's Data device name // --- get DP-Master's Data device name
sprintf(DeviceName, "/dev/pbdata%u", Board + Channel); sprintf(DeviceName, "/dev/pbdata%u", Board + Channel);
hDevice->hDpDataDevice = open(DeviceName, O_RDWR | O_NONBLOCK); hDpDataDevice = open(DeviceName, O_RDWR | O_NONBLOCK);
// get DP-Slave Input-Data device name // get DP-Slave Input-Data device name
sprintf(DeviceName, "/dev/pbslin%u", Board + Channel); sprintf(DeviceName, "/dev/pbslin%u", Board + Channel);
hDevice->hDpsInputDataDevice = open(DeviceName, O_RDWR | O_NONBLOCK); hDpsInputDataDevice = open(DeviceName, O_RDWR | O_NONBLOCK);
// get DP-Slave Output-Data device name // get DP-Slave Output-Data device name
sprintf(DeviceName, "/dev/pbslout%u", Board + Channel); sprintf(DeviceName, "/dev/pbslout%u", Board + Channel);
hDevice->hDpsOutputDataDevice = open(DeviceName, O_RDWR | O_NONBLOCK); hDpsOutputDataDevice = open(DeviceName, O_RDWR | O_NONBLOCK);
if ((hDevice->hDpDataDevice == INVALID_HANDLE_VALUE) if ((hDpDataDevice == INVALID_HANDLE_VALUE) &&
&& (hDevice->hDpsInputDataDevice == INVALID_HANDLE_VALUE) (hDpsInputDataDevice == INVALID_HANDLE_VALUE) &&
&& (hDevice->hDpsOutputDataDevice == INVALID_HANDLE_VALUE)) { (hDpsOutputDataDevice == INVALID_HANDLE_VALUE))
close(hDevice->hServiceReadDevice); {
close(hDevice->hServiceWriteDevice); close(hServiceReadDevice);
close(hDevice->hDpDataDevice); close(hServiceWriteDevice);
close(hDevice->hDpsInputDataDevice); close(hDpDataDevice);
close(hDevice->hDpsOutputDataDevice); close(hDpsInputDataDevice);
hDevice->hServiceReadDevice = (HANDLE)NULL; close(hDpsOutputDataDevice);
hDevice->hServiceWriteDevice = (HANDLE)NULL; hServiceReadDevice = (HANDLE)0;
hDevice->hDpDataDevice = (HANDLE)NULL; hServiceWriteDevice = (HANDLE)0;
hDevice->hDpsInputDataDevice = (HANDLE)NULL; hDpDataDevice = (HANDLE)0;
hDevice->hDpsOutputDataDevice = (HANDLE)NULL; hDpsInputDataDevice = (HANDLE)0;
hDpsOutputDataDevice = (HANDLE)0;
return (E_IF_OS_ERROR); return (E_IF_OS_ERROR);
} }
hDevice->CurrentBoardNumber = Board + Channel; CurrentBoardNumber = Board + Channel;
#endif #endif
return (E_OK); return (E_OK);
} }
FUNCTION GLOBAL INT16 CALL_CONV profi_init(OUT T_PROFI_DEVICE_HANDLE* hDevice, FUNCTION GLOBAL INT16 CALL_CONV profi_init(IN USIGN8 Board,
IN USIGN8 Board, IN USIGN32 ReadTimeout, IN USIGN32 WriteTimeout) IN USIGN32 ReadTimeout,
IN USIGN32 WriteTimeout)
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -1388,18 +1096,21 @@ version ...@@ -1388,18 +1096,21 @@ version
FUNCTION_BODY FUNCTION_BODY
if ((hDevice->hServiceReadDevice && hDevice->hServiceWriteDevice) if ((hServiceReadDevice && hServiceWriteDevice) &&
&& (hDevice->hDpDataDevice || (hDevice->hDpsInputDataDevice (hDpDataDevice || (hDpsInputDataDevice && hDpsOutputDataDevice)))
&& hDevice->hDpsOutputDataDevice))) { {
return (E_OK); // PAPI is already initialized return (E_OK); // PAPI is already initialized
} else { }
return (profi_set_default( else
hDevice, Board, 0, ReadTimeout, WriteTimeout)); // initalize PAPI {
return (profi_set_default(Board, 0, ReadTimeout,
WriteTimeout)); // initalize PAPI
} }
} }
FUNCTION GLOBAL INT16 CALL_CONV init_profibus( FUNCTION GLOBAL INT16 CALL_CONV init_profibus(IN USIGN32 DprAdress,
IN USIGN32 DprAdress, IN USIGN16 IoPortAdress, IN PB_BOOL Dummy) IN USIGN16 IoPortAdress,
IN PB_BOOL Dummy)
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -1426,20 +1137,20 @@ version ...@@ -1426,20 +1137,20 @@ version
{ {
LOCAL_VARIABLES LOCAL_VARIABLES
T_PROFI_DEVICE_HANDLE hDevice;
FUNCTION_BODY FUNCTION_BODY
if ((hDevice.hServiceReadDevice && hDevice.hServiceWriteDevice) if ((hServiceReadDevice && hServiceWriteDevice) &&
&& (hDevice.hDpDataDevice || (hDevice.hDpsInputDataDevice (hDpDataDevice || (hDpsInputDataDevice && hDpsOutputDataDevice)))
&& hDevice.hDpsOutputDataDevice))) { {
return (E_OK); // PAPI is already initialized return (E_OK); // PAPI is already initialized
} else { }
return (profi_set_default(&hDevice, 0, 0, 0, 0)); // initalize PAPI else
{
return (profi_set_default(0, 0, 0, 0)); // initalize PAPI
} }
} }
FUNCTION GLOBAL INT16 CALL_CONV profi_end(IN T_PROFI_DEVICE_HANDLE* hDevice) FUNCTION GLOBAL INT16 CALL_CONV profi_end(VOID)
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -1457,75 +1168,79 @@ Possible return values: ...@@ -1457,75 +1168,79 @@ Possible return values:
FUNCTION_BODY FUNCTION_BODY
// close service device // close service device
if (hDevice->hServiceReadDevice) { if (hServiceReadDevice)
{
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16) #if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
CloseHandle(hServiceReadDevice); CloseHandle(hServiceReadDevice);
#endif #endif
#ifdef _LINUX #ifdef _LINUX
close(hDevice->hServiceReadDevice); close(hServiceReadDevice);
#endif #endif
hDevice->hServiceReadDevice = (HANDLE)NULL; hServiceReadDevice = (HANDLE)0;
} }
if (hDevice->hServiceWriteDevice) { if (hServiceWriteDevice)
{
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16) #if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
CloseHandle(hServiceWriteDevice); CloseHandle(hServiceWriteDevice);
#endif #endif
#ifdef _LINUX #ifdef _LINUX
close(hDevice->hServiceWriteDevice); close(hServiceWriteDevice);
#endif #endif
hDevice->hServiceWriteDevice = (HANDLE)NULL; hServiceWriteDevice = (HANDLE)0;
} }
// close DP-Data device // close DP-Data device
if (hDevice->hDpDataDevice) { if (hDpDataDevice)
{
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16) #if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
CloseHandle(hDpDataDevice); CloseHandle(hDpDataDevice);
#endif #endif
#ifdef _LINUX #ifdef _LINUX
close(hDevice->hDpDataDevice); close(hDpDataDevice);
#endif #endif
hDevice->hDpDataDevice = (HANDLE)NULL; hDpDataDevice = (HANDLE)0;
} }
// close DP-Slave Input-Data device // close DP-Slave Input-Data device
if (hDevice->hDpsInputDataDevice) { if (hDpsInputDataDevice)
{
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16) #if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
CloseHandle(hDpsInputDataDevice); CloseHandle(hDpsInputDataDevice);
#endif #endif
#ifdef _LINUX #ifdef _LINUX
close(hDevice->hDpsInputDataDevice); close(hDpsInputDataDevice);
#endif #endif
hDevice->hDpsInputDataDevice = (HANDLE)NULL; hDpsInputDataDevice = (HANDLE)0;
} }
// close DP-Slave Output-Data device // close DP-Slave Output-Data device
if (hDevice->hDpsOutputDataDevice) { if (hDpsOutputDataDevice)
{
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16) #if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
CloseHandle(hDpsOutputDataDevice); CloseHandle(hDpsOutputDataDevice);
#endif #endif
#ifdef _LINUX #ifdef _LINUX
close(hDevice->hDpsOutputDataDevice); close(hDpsOutputDataDevice);
#endif #endif
hDevice->hDpsOutputDataDevice = (HANDLE)NULL; hDpsOutputDataDevice = (HANDLE)0;
} }
return (E_OK); return (E_OK);
} }
FUNCTION GLOBAL INT16 CALL_CONV profi_snd_req_res( FUNCTION GLOBAL INT16 CALL_CONV profi_snd_req_res(
IN T_PROFI_DEVICE_HANDLE* hDevice, IN T_PROFI_SERVICE_DESCR* pSdb, IN T_PROFI_SERVICE_DESCR* pSdb, IN VOID* pData, IN PB_BOOL dummy)
IN VOID* pData, IN PB_BOOL dummy)
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -1564,15 +1279,15 @@ RES ...@@ -1564,15 +1279,15 @@ RES
FUNCTION_BODY FUNCTION_BODY
// --- check if service device is open // --- check if service device is open
if (!hDevice || !hDevice->hServiceWriteDevice) if (!hServiceWriteDevice)
return (E_IF_PAPI_NOT_INITIALIZED); return (E_IF_PAPI_NOT_INITIALIZED);
return (profi_write_service(hDevice->hServiceWriteDevice, pSdb, pData)); return (profi_write_service(hServiceWriteDevice, pSdb, pData));
} }
FUNCTION GLOBAL INT16 CALL_CONV profi_rcv_con_ind( FUNCTION GLOBAL INT16 CALL_CONV
IN T_PROFI_DEVICE_HANDLE* hDevice, OUT T_PROFI_SERVICE_DESCR* pSdb, profi_rcv_con_ind(OUT T_PROFI_SERVICE_DESCR* pSdb, OUT VOID* pData,
OUT VOID* pData, INOUT USIGN16* pDataLength) INOUT USIGN16* pDataLength)
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -1600,16 +1315,16 @@ Possible return values: ...@@ -1600,16 +1315,16 @@ Possible return values:
FUNCTION_BODY FUNCTION_BODY
// --- check if service device is open // --- check if service device is open
if (!hDevice || !hDevice->hServiceReadDevice) if (!hServiceReadDevice)
return (E_IF_PAPI_NOT_INITIALIZED); return (E_IF_PAPI_NOT_INITIALIZED);
return (profi_read_service( return (profi_read_service(hServiceReadDevice, pSdb, pData, pDataLength));
hDevice->hServiceReadDevice, pSdb, pData, pDataLength));
} }
FUNCTION GLOBAL INT16 CALL_CONV profi_set_data( FUNCTION GLOBAL INT16 CALL_CONV profi_set_data(IN USIGN8 DataId,
IN T_PROFI_DEVICE_HANDLE* hDevice, IN USIGN8 DataId, IN USIGN16 Offset, IN USIGN16 Offset,
IN USIGN16 DataLength, IN VOID* pData) IN USIGN16 DataLength,
IN VOID* pData)
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -1645,7 +1360,7 @@ possible return values: ...@@ -1645,7 +1360,7 @@ possible return values:
FUNCTION_BODY FUNCTION_BODY
// --- check if DP-Data device is open // --- check if DP-Data device is open
if (!hDevice->hDpDataDevice) if (!hDpDataDevice)
return (E_IF_PAPI_NOT_INITIALIZED); return (E_IF_PAPI_NOT_INITIALIZED);
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16) #if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
...@@ -1654,18 +1369,22 @@ possible return values: ...@@ -1654,18 +1369,22 @@ possible return values:
overlapped.Offset = Offset; overlapped.Offset = Offset;
// write data // write data
if (!WriteFile( if (!WriteFile(hDpDataDevice, pData, DataLength, &BytesWritten, &overlapped))
hDpDataDevice, pData, DataLength, &BytesWritten, &overlapped)) { {
return (papi_get_last_error()); return (papi_get_last_error());
} }
#endif #endif
#ifdef _LINUX #ifdef _LINUX
if (lseek(hDevice->hDpDataDevice, Offset, SEEK_SET) < 0) { if (lseek(hDpDataDevice, Offset, SEEK_SET) < 0)
{
printf("lseek error\n");
return (papi_get_last_error()); return (papi_get_last_error());
} }
if (write(hDevice->hDpDataDevice, pData, DataLength) < 0) { if (write(hDpDataDevice, pData, DataLength) < 0)
{
printf("write error\n");
return (papi_get_last_error()); return (papi_get_last_error());
} }
#endif #endif
...@@ -1673,9 +1392,10 @@ possible return values: ...@@ -1673,9 +1392,10 @@ possible return values:
return (E_OK); return (E_OK);
} }
FUNCTION GLOBAL INT16 CALL_CONV profi_get_data( FUNCTION GLOBAL INT16 CALL_CONV profi_get_data(IN USIGN8 DataId,
IN T_PROFI_DEVICE_HANDLE* hDevice, IN USIGN8 DataId, IN USIGN16 Offset, IN USIGN16 Offset,
INOUT USIGN16* pDataLength, OUT VOID* pData) INOUT USIGN16* pDataLength,
OUT VOID* pData)
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -1707,66 +1427,31 @@ possible return values: ...@@ -1707,66 +1427,31 @@ possible return values:
FUNCTION_BODY FUNCTION_BODY
INT16 RetVal = E_OK; INT16 RetVal = E_OK;
HANDLE hBoard = (HANDLE)NULL; HANDLE hBoard = (HANDLE)0;
char DeviceName[64]; char DeviceName[64];
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
DWORD BytesRead = 0;
T_PROFI_DATA_IMAGE_DESCR DataImageDescr;
OVERLAPPED Overlapped;
#endif
#ifdef _LINUX #ifdef _LINUX
ssize_t BytesRead = 0; ssize_t BytesRead = 0;
DataImage DataImageDescr; DataImage DataImageDescr;
#endif #endif
switch (DataId) { switch (DataId)
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16) {
case ID_SERIAL_DEVICE_NUMBER:
case ID_FW_VERS_IMAGE:
case ID_EXCEPTION_IMAGE:
// --- open BOARD-Device
sprintfprofi_get_data(
DeviceName, "\\\\.\\PROFIBUS\\Board%u\\Board", CurrentBoardNumber);
if (INVALID_HANDLE_VALUE
== (hBoard = CreateFile(DeviceName, 0, 0, NULL, OPEN_ALWAYS,
profi_get_data FILE_ATTRIBUTE_NORMAL, NULL))) {
BytesRead return (E_IF_OS_ERROR);
}
// --- set input IOCTL data structure
DataImageDescr.imageId = DataId;
DataImageDescr.offset = Offset;
DataImageDescr.bus = 0;
// --- read DATA-Image
if (DeviceIoprofi_get_dataControl((HANDLE)hBoard,
(DWORD)IOCTL_PROFI_GET_DATA_IMAGE, (LPVOID)&DataImageDescr,
BytesRead(DWORD) sizeof(DataImageDescr), (LPVOID)pData,
(DWORD)*pDataLength, (LPDWORD)&BytesRead, NULL)) {
profi_get_data* pDataLength = (USIGN16)BytesRead;
RetVal = E_OK;
} else {
*pDataLength = 0;
RetVal = papi_get_last_error();
}
CloseHandle(hBoard);
#endif // BytesRead
#ifdef _LINUX #ifdef _LINUX
case ID_SERIAL_DEVICE_NUMBER: case ID_SERIAL_DEVICE_NUMBER:
case ID_FW_VERS_IMAGE: case ID_FW_VERS_IMAGE:
sprintf(DeviceName, "/dev/pbboard%u", hDevice->CurrentBoardNumber); sprintf(DeviceName, "/dev/pbboard%u", CurrentBoardNumber);
if ((hBoard = open(DeviceName, O_RDONLY)) < 0) { if ((hBoard = open(DeviceName, O_RDONLY)) < 0)
{
return (papi_get_last_error()); return (papi_get_last_error());
} }
if (DataId == ID_SERIAL_DEVICE_NUMBER) { if (DataId == ID_SERIAL_DEVICE_NUMBER)
if (lseek(hBoard, Offset, SEEK_SET) < 0) { {
if (lseek(hBoard, Offset, SEEK_SET) < 0)
{
return (papi_get_last_error()); return (papi_get_last_error());
} }
...@@ -1774,21 +1459,34 @@ possible return values: ...@@ -1774,21 +1459,34 @@ possible return values:
DataImageDescr.Buf = pData; DataImageDescr.Buf = pData;
DataImageDescr.Length = *pDataLength; DataImageDescr.Length = *pDataLength;
if (ioctl(hBoard, IOCTL_PROFI_SERIAL_NUMBER, &DataImageDescr) == -1) { // printf("\nprofi_get_data: buf=%p, len=%u, size=%lu\n",
// DataImageDescr.Buf,
// DataImageDescr.Length,
// sizeof(DataImageDescr));
if (ioctl(hBoard, IOCTL_PROFI_SERIAL_NUMBER, &DataImageDescr) == -1)
{
*pDataLength = 0; *pDataLength = 0;
RetVal = papi_get_last_error(); RetVal = papi_get_last_error();
} else { }
else
{
*pDataLength = (USIGN16)4; *pDataLength = (USIGN16)4;
*(USIGN32*)pData = *(USIGN32*)&DataImageDescr; *(USIGN32*)pData = *(USIGN32*)&DataImageDescr;
RetVal = E_OK; RetVal = E_OK;
// printf("papi: Serialnumber = %lu len = %hu\n",*(USIGN32*)pData, // printf("papi: Serialnumber = %lu len = %hu\n",*(USIGN32*)pData,
// BytesRead); // BytesRead);
} }
} else { }
if ((BytesRead = read(hBoard, pData, *pDataLength)) < 0) { else
{
if ((BytesRead = read(hBoard, pData, *pDataLength)) < 0)
{
*pDataLength = 0; *pDataLength = 0;
RetVal = papi_get_last_error(); RetVal = papi_get_last_error();
} else { }
else
{
*pDataLength = (USIGN16)BytesRead; *pDataLength = (USIGN16)BytesRead;
RetVal = E_OK; RetVal = E_OK;
} }
...@@ -1801,24 +1499,13 @@ possible return values: ...@@ -1801,24 +1499,13 @@ possible return values:
case ID_DP_SLAVE_IO_IMAGE: case ID_DP_SLAVE_IO_IMAGE:
// --- check if DP-Data device is open // --- check if DP-Data device is open
if (!hDevice->hDpDataDevice) if (!hDpDataDevice)
return (E_IF_PAPI_NOT_INITIALIZED); return (E_IF_PAPI_NOT_INITIALIZED);
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
// --- init overlapped structure
memset(&Overlapped, 0, sizeof(OVERLAPPED));
Overlapped.OfhBoardfset = Offset;
if (!ReadFile(
hDpDataDevice, pData, *pDataLength, &BytesRead, &Overlapped)) {
return (papi_get_last_error());
}
#endif
#ifdef _LINUX #ifdef _LINUX
if (lseek(hDevice->hDpDataDevice, Offset, SEEK_SET) < 0) { if (lseek(hDpDataDevice, Offset, SEEK_SET) < 0)
{
return (papi_get_last_error()); return (papi_get_last_error());
} }
...@@ -1832,13 +1519,21 @@ possible return values: ...@@ -1832,13 +1519,21 @@ possible return values:
&DataImageDescr, &DataImageDescr,
CurrentBoardNumber); CurrentBoardNumber);
*/ */
// printf("\nprofi_get_data: buf=%p, IOCTL_PROFI_GET_DATA_IMAGE
if (ioctl( // len=%u, size=%lu\n",
hDevice->hDpDataDevice, IOCTL_PROFI_GET_DATA_IMAGE, &DataImageDescr) // DataImageDescr.Buf,
== -1) { // DataImageDescr.Length,
// sizeof(DataImageDescr));
if (ioctl((int)hDpDataDevice, (int)IOCTL_PROFI_GET_DATA_IMAGE,
&DataImageDescr) == -1)
{
BytesRead = 0; BytesRead = 0;
RetVal = papi_get_last_error(); RetVal = papi_get_last_error();
} else { }
else
{
BytesRead = (USIGN16)DataImageDescr.Length; BytesRead = (USIGN16)DataImageDescr.Length;
// printf("papi data length = %u\n", BytesRead); // printf("papi data length = %u\n", BytesRead);
RetVal = E_OK; RetVal = E_OK;
...@@ -1854,9 +1549,9 @@ possible return values: ...@@ -1854,9 +1549,9 @@ possible return values:
} }
} }
FUNCTION GLOBAL INT16 CALL_CONV profi_set_dps_input_data( FUNCTION GLOBAL INT16 CALL_CONV profi_set_dps_input_data(IN USIGN8* pData,
IN T_PROFI_DEVICE_HANDLE* hDevice, IN USIGN8* pData, IN USIGN8 DataLength, IN USIGN8 DataLength,
OUT USIGN8* pState) OUT USIGN8* pState)
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -1881,17 +1576,16 @@ data size ...@@ -1881,17 +1576,16 @@ data size
FUNCTION_BODY FUNCTION_BODY
if (hDevice->hDpsInputDataDevice == (HANDLE)NULL) { if (hDpsInputDataDevice == (HANDLE)0)
{
return (E_IF_PAPI_NOT_INITIALIZED); return (E_IF_PAPI_NOT_INITIALIZED);
} }
return (profi_write_dps_data( return (profi_write_dps_data(hDpsInputDataDevice, pData, DataLength, pState));
hDevice->hDpsInputDataDevice, pData, DataLength, pState));
} }
FUNCTION GLOBAL INT16 CALL_CONV profi_get_dps_input_data( FUNCTION GLOBAL INT16 CALL_CONV profi_get_dps_input_data(
IN T_PROFI_DEVICE_HANDLE* hDevice, OUT USIGN8* pData, OUT USIGN8* pData, INOUT USIGN8* pDataLength, OUT USIGN8* pState)
INOUT USIGN8* pDataLength, OUT USIGN8* pState)
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -1913,17 +1607,16 @@ possible return values: ...@@ -1913,17 +1607,16 @@ possible return values:
FUNCTION_BODY FUNCTION_BODY
if (hDevice->hDpsInputDataDevice == (HANDLE)NULL) { if (hDpsInputDataDevice == (HANDLE)0)
{
return (E_IF_PAPI_NOT_INITIALIZED); return (E_IF_PAPI_NOT_INITIALIZED);
} }
return (profi_read_dps_data( return (profi_read_dps_data(hDpsInputDataDevice, pData, pDataLength, pState));
hDevice->hDpsInputDataDevice, pData, pDataLength, pState));
} }
FUNCTION GLOBAL INT16 CALL_CONV profi_get_dps_output_data( FUNCTION GLOBAL INT16 CALL_CONV profi_get_dps_output_data(
IN T_PROFI_DEVICE_HANDLE* hDevice, OUT USIGN8* pData, OUT USIGN8* pData, INOUT USIGN8* pDataLength, OUT USIGN8* pState)
INOUT USIGN8* pDataLength, OUT USIGN8* pState)
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -1947,17 +1640,17 @@ possible return values: ...@@ -1947,17 +1640,17 @@ possible return values:
FUNCTION_BODY FUNCTION_BODY
if (hDevice->hDpsOutputDataDevice == (HANDLE)NULL) { if (hDpsOutputDataDevice == (HANDLE)0)
{
return (E_IF_PAPI_NOT_INITIALIZED); return (E_IF_PAPI_NOT_INITIALIZED);
} }
return (profi_read_dps_data( return (
hDevice->hDpsOutputDataDevice, pData, pDataLength, pState)); profi_read_dps_data(hDpsOutputDataDevice, pData, pDataLength, pState));
} }
FUNCTION GLOBAL INT16 CALL_CONV profi_get_versions( FUNCTION GLOBAL INT16 CALL_CONV
IN T_PROFI_DEVICE_HANDLE* hDevice, OUT CSTRING* pPapiVersion, profi_get_versions(OUT CSTRING* pPapiVersion, OUT CSTRING* pFirmwareVersion)
OUT CSTRING* pFirmwareVersion)
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -1995,14 +1688,15 @@ Possible return values: ...@@ -1995,14 +1688,15 @@ Possible return values:
// --- get PROFIBUS firmware version // --- get PROFIBUS firmware version
DataLength = (USIGN16)VERSION_STRING_LENGTH; DataLength = (USIGN16)VERSION_STRING_LENGTH;
if (profi_get_data( if (profi_get_data(ID_FW_VERS_IMAGE, 0, &DataLength, pFirmwareVersion) !=
hDevice, ID_FW_VERS_IMAGE, 0, &DataLength, pFirmwareVersion) E_OK)
!= E_OK) { {
strcpy(pFirmwareVersion, (CSTRING*)"controller not initialized"); strcpy(pFirmwareVersion, (CSTRING*)"controller not initialized");
} }
// --- convert \n to ' ' // --- convert \n to ' '
for (i = 0; i < VERSION_STRING_LENGTH; i++) { for (i = 0; i < VERSION_STRING_LENGTH; i++)
{
if (pFirmwareVersion[i] == '\n') if (pFirmwareVersion[i] == '\n')
pFirmwareVersion[i] = ' '; pFirmwareVersion[i] = ' ';
else if (pFirmwareVersion[i] == '\0') else if (pFirmwareVersion[i] == '\0')
...@@ -2014,8 +1708,8 @@ Possible return values: ...@@ -2014,8 +1708,8 @@ Possible return values:
return (E_OK); return (E_OK);
} }
FUNCTION GLOBAL INT16 CALL_CONV profi_get_serial_device_number( FUNCTION GLOBAL INT16 CALL_CONV
IN T_PROFI_DEVICE_HANDLE* hDevice, OUT USIGN32* pSerialDeviceNumber) profi_get_serial_device_number(OUT USIGN32* pSerialDeviceNumber)
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -2039,8 +1733,8 @@ Possible return values: ...@@ -2039,8 +1733,8 @@ Possible return values:
DataLength = (USIGN16)sizeof(USIGN32); DataLength = (USIGN16)sizeof(USIGN32);
// --- get serial device number // --- get serial device number
return (profi_get_data( return (profi_get_data(ID_SERIAL_DEVICE_NUMBER, 0, &DataLength,
hDevice, ID_SERIAL_DEVICE_NUMBER, 0, &DataLength, pSerialDeviceNumber)); pSerialDeviceNumber));
} }
FUNCTION GLOBAL INT16 CALL_CONV profi_get_last_error(VOID) FUNCTION GLOBAL INT16 CALL_CONV profi_get_last_error(VOID)
...@@ -2078,55 +1772,6 @@ Possible return values: ...@@ -2078,55 +1772,6 @@ Possible return values:
#endif #endif
} }
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
FUNCTION BOOL WINAPI DllMain(
IN HINSTANCE hInstDLL, IN ULONG Reason, IN LPVOID pReserved)
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
32Bit-DLL main function.
The function is called by MS-Windows during loading DLL.
Possible return values:
- TRUE
-----------------------------------------------------------------------------*/
{
LOCAL_VARIABLES
FUNCTION_BODY
switch (Reason) {
case DLL_PROCESS_ATTACH:
hServiceReadDevice = NULL;
hServiceWriteDevice = NULL;
hDpDataDevice = NULL;
hDpsInputDataDevice = NULL;
hDpsOutputDataDevice = NULL;
CurrentBoardNumber = 0;
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
case DLL_PROCESS_DETACH:
profi_end();
break;
default:
break;
}
return TRUE;
}
#endif
#if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16) #if defined(WIN32) || defined(_WIN32) || defined(WIN16) || defined(_WIN16)
#pragma check_stack #pragma check_stack
#endif #endif
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
#define BUILD_NUMBER 52 #define BUILD_NUMBER 52
#define BUILD_NUMBER_STR "52" #define BUILD_NUMBER_STR "52"
......
/* /******************************************************************************
* ProviewR Open Source Process Control. * *
* Copyright (C) 2005-2019 SSAB EMEA AB. * SOFTING Industrial Automation GmbH *
* * Richard-Reitzner-Allee 6 *
* This file is part of ProviewR. * D-85540 Haar *
* * Phone: (++49)-(0)89-45656-0 *
* This program is free software; you can redistribute it and/or * Fax: (++49)-(0)89-45656-399 *
* modify it under the terms of the GNU General Public License as * *
* published by the Free Software Foundation, either version 2 of * Copyright (C) SOFTING Industrial Automation GmbH 1995-2012 *
* the License, or (at your option) any later version. * All Rights Reserved *
* * *
* This program is distributed in the hope that it will be useful *******************************************************************************
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************
* *
* SOFTING AG *
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone: ++49-89-4 56 56-0 *
* Fax: ++49-89-4 56 56-3 99 *
* *
* Copyright (C) SOFTING AG 1995-2003 *
* All Rights Reserved *
* *
******************************************************************************
FILE_NAME BUSPARAM.C FILE_NAME BUSPARAM.C
...@@ -55,25 +20,11 @@ MODULE BUSPARAM ...@@ -55,25 +20,11 @@ MODULE BUSPARAM
COMPONENT_LIBRARY PBT LIBs and DLL (16-Bit) COMPONENT_LIBRARY PBT LIBs and DLL (16-Bit)
PBTOOLS DLL (32-Bit) PBTOOLS DLL (32-Bit)
AUTHOR SOFTING AG AUTHOR SOFTING
VERSION 5.00 VERSION 5.21.0.00.release
5.01
5.02 DATE February-1998
5.10
5.11
5.20.0.00.alpha
5.20.0.00.release
5.21.0.00.release
DATE 24-November-1995
31-January-1996
14-July-1996
20-Febrary-1997
18-March-1997
30-July-1997
17-October-1997
27-February-1998
STATUS finished STATUS finished
...@@ -138,7 +89,8 @@ possible return values: ...@@ -138,7 +89,8 @@ possible return values:
FUNCTION_BODY FUNCTION_BODY
switch (baud_rate) { switch (baud_rate)
{
case 0: /* 9,6 KBaud */ case 0: /* 9,6 KBaud */
case 1: /* 19,2 KBaud */ case 1: /* 19,2 KBaud */
case 2: /* 93,75 KBaud */ case 2: /* 93,75 KBaud */
...@@ -242,7 +194,8 @@ possible return values: ...@@ -242,7 +194,8 @@ possible return values:
FUNCTION_BODY FUNCTION_BODY
switch (baud_rate) { switch (baud_rate)
{
case 0: /* 9,6 KBaud */ case 0: /* 9,6 KBaud */
bus_param_ptr->tsl = 100; bus_param_ptr->tsl = 100;
bus_param_ptr->min_tsdr = 30; bus_param_ptr->min_tsdr = 30;
...@@ -365,7 +318,8 @@ possible return values: ...@@ -365,7 +318,8 @@ possible return values:
FUNCTION_BODY FUNCTION_BODY
switch (baud_rate) { switch (baud_rate)
{
case 0: /* 9,6 KBaud */ case 0: /* 9,6 KBaud */
bus_param_ptr->tsl = 125; bus_param_ptr->tsl = 125;
bus_param_ptr->min_tsdr = 30; bus_param_ptr->min_tsdr = 30;
...@@ -481,8 +435,8 @@ possible return values: ...@@ -481,8 +435,8 @@ possible return values:
} }
} }
FUNCTION GLOBAL PB_BOOL CALL_CONV pbt_get_dp_def_bus_param(IN USIGN8 baud_rate, FUNCTION GLOBAL PB_BOOL CALL_CONV pbt_get_dp_def_bus_param(
IN USIGN8 station_addr, IN USIGN16 mode, IN USIGN8 baud_rate, IN USIGN8 station_addr, IN USIGN16 mode,
OUT T_DP_BUS_PARA_SET FAR* bus_param_ptr) OUT T_DP_BUS_PARA_SET FAR* bus_param_ptr)
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
...@@ -510,7 +464,8 @@ possible return values: ...@@ -510,7 +464,8 @@ possible return values:
FUNCTION_BODY FUNCTION_BODY
ret_val = PB_TRUE; ret_val = PB_TRUE;
switch (mode) { switch (mode)
{
case DP_MODE: /* only DP mode */ case DP_MODE: /* only DP mode */
ret_val = pbt_get_bus_param_for_dp(baud_rate, &bus_param); ret_val = pbt_get_bus_param_for_dp(baud_rate, &bus_param);
break; break;
...@@ -524,7 +479,8 @@ possible return values: ...@@ -524,7 +479,8 @@ possible return values:
break; break;
} }
if (ret_val == PB_TRUE) { if (ret_val == PB_TRUE)
{
/* -- set variable busparametes ---------------------------------------- */ /* -- set variable busparametes ---------------------------------------- */
bus_param_ptr->tsl = bus_param.tsl; bus_param_ptr->tsl = bus_param.tsl;
bus_param_ptr->min_tsdr = bus_param.min_tsdr; bus_param_ptr->min_tsdr = bus_param.min_tsdr;
...@@ -542,11 +498,11 @@ possible return values: ...@@ -542,11 +498,11 @@ possible return values:
bus_param_ptr->hsa = HSA; bus_param_ptr->hsa = HSA;
bus_param_ptr->bp_flag = 0x00; bus_param_ptr->bp_flag = 0x00;
bus_param_ptr->min_slave_interval = 200; /* [100us] */ bus_param_ptr->min_slave_interval = 200; /* [100us] */
bus_param_ptr->poll_timeout = 1000; /* [ 1ms] */ bus_param_ptr->poll_timeout = 1000; /* [ 1ms] */
bus_param_ptr->data_control_time = 100; /* [ 10ms] */ bus_param_ptr->data_control_time = 100; /* [ 10ms] */
bus_param_ptr->master_user_data_len = 34; bus_param_ptr->master_user_data_len = 34;
memcpy((USIGN8 FAR*)bus_param_ptr->master_class2_name, memcpy((USIGN8 FAR*)bus_param_ptr->master_class2_name,
(USIGN8 FAR*)"SOFTING PROFIBUS DP MASTER ", 32); (USIGN8 FAR*)"SOFTING PROFIBUS DP MASTER ", 32);
bus_param_ptr->bus_para_len += bus_param_ptr->master_user_data_len; bus_param_ptr->bus_para_len += bus_param_ptr->master_user_data_len;
} }
...@@ -583,7 +539,8 @@ possible return values: ...@@ -583,7 +539,8 @@ possible return values:
FUNCTION_BODY FUNCTION_BODY
if (pbt_get_bus_param_for_fms(baud_rate, &bus_param)) { if (pbt_get_bus_param_for_fms(baud_rate, &bus_param))
{
/* -- set variable busparametes -------------------------------------- */ /* -- set variable busparametes -------------------------------------- */
bus_param_ptr->tsl = bus_param.tsl; bus_param_ptr->tsl = bus_param.tsl;
bus_param_ptr->min_tsdr = bus_param.min_tsdr; bus_param_ptr->min_tsdr = bus_param.min_tsdr;
...@@ -607,7 +564,9 @@ possible return values: ...@@ -607,7 +564,9 @@ possible return values:
bus_param_ptr->ident[3] = 0; bus_param_ptr->ident[3] = 0;
return (PB_TRUE); return (PB_TRUE);
} else { }
else
{
return (PB_FALSE); return (PB_FALSE);
} }
} }
...@@ -644,7 +603,8 @@ possible return values: ...@@ -644,7 +603,8 @@ possible return values:
FUNCTION_BODY FUNCTION_BODY
switch (mode) { switch (mode)
{
case DP_MODE: /* only DP mode */ case DP_MODE: /* only DP mode */
ret_val = pbt_get_bus_param_for_dp(baud_rate, &bus_param); ret_val = pbt_get_bus_param_for_dp(baud_rate, &bus_param);
break; break;
...@@ -662,7 +622,8 @@ possible return values: ...@@ -662,7 +622,8 @@ possible return values:
break; break;
} }
if (ret_val == PB_TRUE) { if (ret_val == PB_TRUE)
{
/* -- set variable busparametes ---------------------------------------- */ /* -- set variable busparametes ---------------------------------------- */
bus_param_ptr->tsl = bus_param.tsl; bus_param_ptr->tsl = bus_param.tsl;
bus_param_ptr->min_tsdr = bus_param.min_tsdr; bus_param_ptr->min_tsdr = bus_param.min_tsdr;
...@@ -689,9 +650,9 @@ possible return values: ...@@ -689,9 +650,9 @@ possible return values:
return (ret_val); return (ret_val);
} }
FUNCTION GLOBAL PB_BOOL CALL_CONV pbt_get_fmb_def_bus_param(IN USIGN8 baud_rate, FUNCTION GLOBAL PB_BOOL CALL_CONV pbt_get_fmb_def_bus_param(
IN USIGN8 station_addr, IN PB_BOOL in_ring_desired, IN USIGN16 mode, IN USIGN8 baud_rate, IN USIGN8 station_addr, IN PB_BOOL in_ring_desired,
OUT T_FMB_SET_BUSPARAMETER_REQ FAR* bus_param_ptr) IN USIGN16 mode, OUT T_FMB_SET_BUSPARAMETER_REQ FAR* bus_param_ptr)
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -720,7 +681,8 @@ possible return values: ...@@ -720,7 +681,8 @@ possible return values:
FUNCTION_BODY FUNCTION_BODY
switch (mode) { switch (mode)
{
case DP_MODE: /* only DP mode */ case DP_MODE: /* only DP mode */
ret_val = pbt_get_bus_param_for_dp(baud_rate, &bus_param); ret_val = pbt_get_bus_param_for_dp(baud_rate, &bus_param);
break; break;
...@@ -738,7 +700,8 @@ possible return values: ...@@ -738,7 +700,8 @@ possible return values:
break; break;
} }
if (ret_val == PB_TRUE) { if (ret_val == PB_TRUE)
{
/* -- set variable busparametes ---------------------------------------- */ /* -- set variable busparametes ---------------------------------------- */
bus_param_ptr->tsl = bus_param.tsl; bus_param_ptr->tsl = bus_param.tsl;
bus_param_ptr->min_tsdr = bus_param.min_tsdr; bus_param_ptr->min_tsdr = bus_param.min_tsdr;
......
/* /******************************************************************************
* ProviewR Open Source Process Control. * *
* Copyright (C) 2005-2019 SSAB EMEA AB. * SOFTING Industrial Automation GmbH *
* * Richard-Reitzner-Allee 6 *
* This file is part of ProviewR. * D-85540 Haar *
* * Phone: (++49)-(0)89-45656-0 *
* This program is free software; you can redistribute it and/or * Fax: (++49)-(0)89-45656-399 *
* modify it under the terms of the GNU General Public License as * *
* published by the Free Software Foundation, either version 2 of * Copyright (C) SOFTING Industrial Automation GmbH 1995-2012 *
* the License, or (at your option) any later version. * All Rights Reserved *
* * *
* This program is distributed in the hope that it will be useful *******************************************************************************
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************
* *
* SOFTING AG *
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone: ++49-89-4 56 56-0 *
* Fax: ++49-89-4 56 56-3 99 *
* *
* Copyright (C) SOFTING AG 1995-2003 *
* All Rights Reserved *
* *
******************************************************************************
FILE_NAME CCRL.C FILE_NAME CCRL.C
PROJECT_NAME PROFIBUS PROJECT_NAME PROFIBUS
...@@ -54,25 +20,11 @@ MODULE CCRL ...@@ -54,25 +20,11 @@ MODULE CCRL
COMPONENT_LIBRARY PBT LIBs and DLL (16-Bit) COMPONENT_LIBRARY PBT LIBs and DLL (16-Bit)
PBTOOLS.DLL (32-Bit) PBTOOLS.DLL (32-Bit)
AUTHOR SOFTING AG AUTHOR SOFTING
VERSION 5.00 VERSION 5.21.0.00.release
5.01
5.02 DATE February-1998
5.10
5.11
5.20.0.00.alpha
5.20.0.00.release
5.21.0.00.release
DATE 24-November-1995
31-January-1996
14-July-1996
20-Febrary-1997
18-March-1997
30-July-1997
17-October-1997
27-February-1998
STATUS finished STATUS finished
...@@ -133,14 +85,12 @@ INCLUDES ...@@ -133,14 +85,12 @@ INCLUDES
#include <windows.h> #include <windows.h>
#endif #endif
#include "co_math.h" #include <pb_type.h>
#include <pb_if.h>
#include "pb_type.h" #include <pb_fmb.h>
#include "pb_if.h" #include <pb_fm7.h>
#include "pb_fmb.h" #include <pb_err.h>
#include "pb_fm7.h" #include <pb_tools.h>
#include "pb_err.h"
#include "pb_tools.h"
LOCAL_DEFINES LOCAL_DEFINES
...@@ -156,17 +106,29 @@ LOCAL_DEFINES ...@@ -156,17 +106,29 @@ LOCAL_DEFINES
#define _IS_I_CONN(x) ((x & 0x03) == I_CONN) #define _IS_I_CONN(x) ((x & 0x03) == I_CONN)
#define _IS_CYCLIC(type) (type & 0x02) #define _IS_CYCLIC(type) (type & 0x02)
#define _WITHOUT_SLAVE_INITIATIVE(type) (!(type & 0x04)) #define _WITHOUT_SLAVE_INITIATIVE(type) (!(type & 0x04))
#define _IS_CONN_LESS(x) ((x & 0x09) == BRCT)
#define _IS_CONN_ORIENTED(x) (!_IS_CONN_LESS(x))
#ifndef min
#define min(a, b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef max
#define max(a, b) (((a) > (b)) ? (a) : (b))
#endif
LOCAL_TYPEDEFS LOCAL_TYPEDEFS
typedef struct _T_CCRL_CONN_RESRCES { typedef struct _T_CCRL_CONN_RESRCES
{
USIGN8 no_of_fal_sdbs; USIGN8 no_of_fal_sdbs;
USIGN8 no_of_fdl_sdbs; USIGN8 no_of_fdl_sdbs;
USIGN8 no_of_data_buffer; USIGN8 no_of_data_buffer;
USIGN8 no_of_api_buffer; USIGN8 no_of_api_buffer;
} T_CCRL_CONN_RESRCES; } T_CCRL_CONN_RESRCES;
typedef struct _T_CCRL { typedef struct _T_CCRL
{
T_FMB_CONFIG_CRL ccrl; T_FMB_CONFIG_CRL ccrl;
USIGN8 poll_sap; USIGN8 poll_sap;
PB_BOOL mms_exist; PB_BOOL mms_exist;
...@@ -188,8 +150,8 @@ static T_CCRL ccrl_obj; ...@@ -188,8 +150,8 @@ static T_CCRL ccrl_obj;
#pragma check_stack(off) #pragma check_stack(off)
#endif #endif
FUNCTION LOCAL USIGN16 ccrl_determine_role( FUNCTION LOCAL USIGN16 ccrl_determine_role(IN T_CRL_STATIC FAR* crl_ptr,
IN T_CRL_STATIC FAR* crl_ptr, IN USIGN8* role_ptr) IN USIGN8* role_ptr)
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -210,7 +172,8 @@ R_CL -> Receiver of multicast/broadcast messages ...@@ -210,7 +172,8 @@ R_CL -> Receiver of multicast/broadcast messages
FUNCTION_BODY FUNCTION_BODY
switch ((USIGN8)(crl_ptr->conn_type & 0x0F)) { switch ((USIGN8)(crl_ptr->conn_type & 0x0F))
{
case MMAC: case MMAC:
*role_ptr = M_MM; *role_ptr = M_MM;
return (E_OK); return (E_OK);
...@@ -238,8 +201,8 @@ R_CL -> Receiver of multicast/broadcast messages ...@@ -238,8 +201,8 @@ R_CL -> Receiver of multicast/broadcast messages
} }
} }
FUNCTION LOCAL VOID ccrl_correct_crl_entry( FUNCTION LOCAL VOID ccrl_correct_crl_entry(IN USIGN16 cr, IN USIGN8 role,
IN USIGN16 cr, IN USIGN8 role, INOUT T_CRL_STATIC FAR* crl_ptr) INOUT T_CRL_STATIC FAR* crl_ptr)
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -250,15 +213,18 @@ FUNCTIONAL_DESCRIPTION ...@@ -250,15 +213,18 @@ FUNCTIONAL_DESCRIPTION
FUNCTION_BODY FUNCTION_BODY
if (crl_ptr->lli_sap == 1) { if (crl_ptr->lli_sap == 1)
if (cr > 1) { {
if (cr > 1)
{
/* There is a management client ----------------------------------------- /* There is a management client -----------------------------------------
*/ */
crl_ptr->max_scc = 1; crl_ptr->max_scc = 1;
crl_ptr->max_sac = 0; crl_ptr->max_sac = 0;
crl_ptr->max_rcc = 0; crl_ptr->max_rcc = 0;
crl_ptr->max_rac = 0; crl_ptr->max_rac = 0;
} else /* (cr == 1) */ }
else /* (cr == 1) */
{ {
/* There is a management server ----------------------------------------- /* There is a management server -----------------------------------------
*/ */
...@@ -269,14 +235,17 @@ FUNCTIONAL_DESCRIPTION ...@@ -269,14 +235,17 @@ FUNCTIONAL_DESCRIPTION
} }
} }
if (role == M_MS) { if (role == M_MS)
{
crl_ptr->max_rcc = 0; crl_ptr->max_rcc = 0;
if (_IS_CYCLIC(crl_ptr->conn_type)) if (_IS_CYCLIC(crl_ptr->conn_type))
crl_ptr->max_scc = 0; crl_ptr->max_scc = 0;
if (_WITHOUT_SLAVE_INITIATIVE(crl_ptr->conn_type)) if (_WITHOUT_SLAVE_INITIATIVE(crl_ptr->conn_type))
crl_ptr->max_rac = 0; crl_ptr->max_rac = 0;
} else if (role == S_MS) { }
else if (role == S_MS)
{
crl_ptr->max_scc = 0; crl_ptr->max_scc = 0;
if (_IS_CYCLIC(crl_ptr->conn_type)) if (_IS_CYCLIC(crl_ptr->conn_type))
...@@ -288,8 +257,8 @@ FUNCTIONAL_DESCRIPTION ...@@ -288,8 +257,8 @@ FUNCTIONAL_DESCRIPTION
return; return;
} }
FUNCTION LOCAL VOID ccrl_update_resrc_ctr( FUNCTION LOCAL VOID ccrl_update_resrc_ctr(INOUT USIGN8* stored_number_ptr,
INOUT USIGN8* stored_number_ptr, INOUT USIGN8* current_number_ptr) INOUT USIGN8* current_number_ptr)
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -302,19 +271,23 @@ FUNCTIONAL_DESCRIPTION ...@@ -302,19 +271,23 @@ FUNCTIONAL_DESCRIPTION
FUNCTION_BODY FUNCTION_BODY
if (*stored_number_ptr < *current_number_ptr) { if (*stored_number_ptr < *current_number_ptr)
{
diff = (USIGN8)(*current_number_ptr - *stored_number_ptr); diff = (USIGN8)(*current_number_ptr - *stored_number_ptr);
*stored_number_ptr = *current_number_ptr; *stored_number_ptr = *current_number_ptr;
*current_number_ptr = diff; *current_number_ptr = diff;
} else { }
else
{
*current_number_ptr = 0; *current_number_ptr = 0;
} }
return; return;
} }
FUNCTION LOCAL VOID ccrl_adapt_resrces(IN T_CCRL_CONN_RESRCES* in_resrces_ptr, FUNCTION LOCAL VOID
INOUT T_CCRL_CONN_RESRCES* out_resrces_ptr) ccrl_adapt_resrces(IN T_CCRL_CONN_RESRCES* in_resrces_ptr,
INOUT T_CCRL_CONN_RESRCES* out_resrces_ptr)
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -325,14 +298,14 @@ FUNCTIONAL_DESCRIPTION ...@@ -325,14 +298,14 @@ FUNCTIONAL_DESCRIPTION
FUNCTION_BODY FUNCTION_BODY
ccrl_update_resrc_ctr( ccrl_update_resrc_ctr(&in_resrces_ptr->no_of_fal_sdbs,
&in_resrces_ptr->no_of_fal_sdbs, &out_resrces_ptr->no_of_fal_sdbs); &out_resrces_ptr->no_of_fal_sdbs);
ccrl_update_resrc_ctr( ccrl_update_resrc_ctr(&in_resrces_ptr->no_of_fdl_sdbs,
&in_resrces_ptr->no_of_fdl_sdbs, &out_resrces_ptr->no_of_fdl_sdbs); &out_resrces_ptr->no_of_fdl_sdbs);
ccrl_update_resrc_ctr( ccrl_update_resrc_ctr(&in_resrces_ptr->no_of_data_buffer,
&in_resrces_ptr->no_of_data_buffer, &out_resrces_ptr->no_of_data_buffer); &out_resrces_ptr->no_of_data_buffer);
ccrl_update_resrc_ctr( ccrl_update_resrc_ctr(&in_resrces_ptr->no_of_api_buffer,
&in_resrces_ptr->no_of_api_buffer, &out_resrces_ptr->no_of_api_buffer); &out_resrces_ptr->no_of_api_buffer);
return; return;
} }
...@@ -370,7 +343,8 @@ possible return values: ...@@ -370,7 +343,8 @@ possible return values:
ccrl_obj.poll_sap = crl_hdr_ptr->poll_sap; ccrl_obj.poll_sap = crl_hdr_ptr->poll_sap;
ccrl_obj.mms_exist = PB_FALSE; ccrl_obj.mms_exist = PB_FALSE;
for (i = 0; i < 65; i++) { for (i = 0; i < 65; i++)
{
ccrl_obj.isap_resrces[i].no_of_fal_sdbs = 0; ccrl_obj.isap_resrces[i].no_of_fal_sdbs = 0;
ccrl_obj.isap_resrces[i].no_of_fdl_sdbs = 0; ccrl_obj.isap_resrces[i].no_of_fdl_sdbs = 0;
ccrl_obj.isap_resrces[i].no_of_data_buffer = 0; ccrl_obj.isap_resrces[i].no_of_data_buffer = 0;
...@@ -380,8 +354,9 @@ possible return values: ...@@ -380,8 +354,9 @@ possible return values:
return; return;
} }
FUNCTION GLOBAL USIGN16 CALL_CONV ccrl_resrces_add_entry(IN USIGN16 cr, FUNCTION GLOBAL USIGN16 CALL_CONV
IN T_CRL_STATIC FAR* crl_ptr, OUT T_FMB_CONFIG_CRL FAR* config_ptr) ccrl_resrces_add_entry(IN USIGN16 cr, IN T_CRL_STATIC FAR* crl_ptr,
OUT T_FMB_CONFIG_CRL FAR* config_ptr)
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -461,93 +436,97 @@ possible return values: ...@@ -461,93 +436,97 @@ possible return values:
ci = crl_ptr->ci; ci = crl_ptr->ci;
multiplier = crl_ptr->multiplier; multiplier = crl_ptr->multiplier;
snd_req = 0; /* (FAL + DATA) + FDL */ snd_req = 0; /* (FAL + DATA) + FDL */
snd_req_csrd = 0; /* (FAL + DATA) */ snd_req_csrd = 0; /* (FAL + DATA) */
snd_req_srd = 0; /* (FDL + DATA) */ snd_req_srd = 0; /* (FDL + DATA) */
rcv_res = 0; /* (FDL + DATA) */ rcv_res = 0; /* (FDL + DATA) */
rcv_ind = 0; /* (FDL + DATA) + FAL */ rcv_ind = 0; /* (FDL + DATA) + FAL */
rcv_ind_csrd = 0; /* (FAL + DATA) */ rcv_ind_csrd = 0; /* (FAL + DATA) */
snd_res_srd = 0; /* (FDL + API) */ snd_res_srd = 0; /* (FDL + API) */
lli_api_resrc = 0; /* (FAL + API) */ lli_api_resrc = 0; /* (FAL + API) */
lli_api_snd_resrc = 0; /* (FAL + API) + FDL */ lli_api_snd_resrc = 0; /* (FAL + API) + FDL */
lli_sr_snd_resrc = 0; /* (FAL + DATA) + FDL */ lli_sr_snd_resrc = 0; /* (FAL + DATA) + FDL */
lli_rcv_ind = 0; /* (FDL + DATA) */ lli_rcv_ind = 0; /* (FDL + DATA) */
lli_poll_elem = 0; /* (POLL + API) + (FDL + DATA) */ lli_poll_elem = 0; /* (POLL + API) + (FDL + DATA) */
lli_idm = 0; /* (DATA) */ lli_idm = 0; /* (DATA) */
lli_evt_resrc = 0; /* (FAL + DATA) */ lli_evt_resrc = 0; /* (FAL + DATA) */
fdl_sap = 0; /* (FDL) */ fdl_sap = 0; /* (FDL) */
fdl_rsap = 0; /* (DATA or FDL + DATA) */ fdl_rsap = 0; /* (DATA or FDL + DATA) */
switch (role) { switch (role)
{
case M_MM: case M_MM:
/* Master in Master/Master Connection ----------------------------- */ /* Master in Master/Master Connection ----------------------------- */
snd_req = (USIGN8)(MAX(1, /* snd ASS.req */ snd_req = (USIGN8)(max(1, /* snd ASS.req */
(max_scc /* snd DTC.req */ (max_scc /* snd DTC.req */
+ max_sac)) /* snd DTA.req */ + max_sac)) /* snd DTA.req */
+ 1 /* snd ABT.req */ + 1 /* snd ABT.req */
); );
lli_api_snd_resrc = (USIGN8)(MIN(ci, 1) /* snd IDLE.req */ lli_api_snd_resrc = (USIGN8)(min(ci, 1) /* snd IDLE.req */
+ 1 /* LLI abort resrc */ + 1 /* LLI abort resrc */
); );
rcv_res = (USIGN8)(MAX(1, /* rcv ASS_RES_PDU */ rcv_res = (USIGN8)(max(1, /* rcv ASS_RES_PDU */
(max_scc /* rcv DTC_RES_PDU */ (max_scc /* rcv DTC_RES_PDU */
+ max_sac)) /* rcv DTA_ACK_PDU */ + max_sac)) /* rcv DTA_ACK_PDU */
); );
rcv_ind = (USIGN8)(MAX(1, /* rcv ASS_REQ_PDU */ rcv_ind = (USIGN8)(max(1, /* rcv ASS_REQ_PDU */
(max_rcc /* rcv DTC_REQ_PDU */ (max_rcc /* rcv DTC_REQ_PDU */
+ max_rac)) /* rcv DTA_REQ_PDU */ + max_rac)) /* rcv DTA_REQ_PDU */
+ 1 /* rcv ABT_REQ_PDU */ + 1 /* rcv ABT_REQ_PDU */
); );
lli_rcv_ind = (USIGN8)MIN(ci, 1); /* rcv IDLE_REQ_PDU */ lli_rcv_ind = (USIGN8)min(ci, 1); /* rcv IDLE_REQ_PDU */
fdl_sap = 1; /* act/deact LSAP */ fdl_sap = 1; /* act/deact LSAP */
break; break;
case M_MS: case M_MS:
/* Master in a cyclic master/slave connection --------------------- */ /* Master in a cyclic master/slave connection --------------------- */
if (_IS_CYCLIC(crl_ptr->conn_type)) { if (_IS_CYCLIC(crl_ptr->conn_type))
{
max_scc = 1; max_scc = 1;
ci = 0; ci = 0;
lli_idm = 1; /* image data memory */ lli_idm = 1; /* image data memory */
if (crl_ptr->conn_type & LLI_EVT_BIT) if (crl_ptr->conn_type & LLI_EVT_BIT)
lli_evt_resrc = 1; lli_evt_resrc = 1;
} else /* _IS_ACYCLIC (crl_ptr->conn_type) */ }
else /* _IS_ACYCLIC (crl_ptr->conn_type) */
{ {
multiplier = 1; multiplier = 1;
} }
lli_poll_elem = (USIGN8)(MAX(multiplier, 1)); /* poll_list_element */ lli_poll_elem = (USIGN8)(max(multiplier, 1)); /* poll_list_element */
lli_api_resrc = (USIGN8)(MIN(ci, 1) /* snd IDLE_REQ_PDU */ lli_api_resrc = (USIGN8)(min(ci, 1) /* snd IDLE_REQ_PDU */
+ 1 /* LLI abort resrc */ + 1 /* LLI abort resrc */
); );
snd_req_csrd = (USIGN8)(MAX(1, /* snd ASS.req */ snd_req_csrd = (USIGN8)(max(1, /* snd ASS.req */
(max_scc /* snd DTC.req */ (max_scc /* snd DTC.req */
+ max_sac)) /* snd DTA.req */ + max_sac)) /* snd DTA.req */
+ 1 /* snd ABT.req */ + 1 /* snd ABT.req */
); );
snd_req_srd = max_sac; /* snd DTA.req (high) */ snd_req_srd = max_sac; /* snd DTA.req (high) */
rcv_ind_csrd = (USIGN8)(max_rac /* rcv DTA_REQ_PDU */ rcv_ind_csrd = (USIGN8)(max_rac /* rcv DTA_REQ_PDU */
+ 1 /* rcv ABT_REQ_PDU */ + 1 /* rcv ABT_REQ_PDU */
); );
snd_res_srd = max_rac; /* snd DTA.ack (high)*/ snd_res_srd = max_rac; /* snd DTA.ack (high)*/
if (!ccrl_obj.mms_exist) { if (!ccrl_obj.mms_exist)
{
fdl_sap = 1; fdl_sap = 1;
ccrl_obj.mms_exist = PB_TRUE; ccrl_obj.mms_exist = PB_TRUE;
} }
...@@ -558,69 +537,74 @@ possible return values: ...@@ -558,69 +537,74 @@ possible return values:
fdl_rsap = 1; /* reply update buffer */ fdl_rsap = 1; /* reply update buffer */
if (_IS_CYCLIC(crl_ptr->conn_type)) { if (_IS_CYCLIC(crl_ptr->conn_type))
{
max_rcc = 1; max_rcc = 1;
ci = 0; ci = 0;
lli_idm = 1; /* image data memory */ lli_idm = 1; /* image data memory */
} }
snd_req = (USIGN8)(max_sac /* snd DTA.req */ snd_req = (USIGN8)(max_sac /* snd DTA.req */
+ 1 /* snd ABT.req */ + 1 /* snd ABT.req */
); );
rcv_res = max_sac; /* rcv DTA_ACK_PDU */ rcv_res = max_sac; /* rcv DTA_ACK_PDU */
lli_sr_snd_resrc = (USIGN8)(MIN(ci, 1) /* snd IDLE.req */ lli_sr_snd_resrc = (USIGN8)(min(ci, 1) /* snd IDLE.req */
+ 1 /* LLI abort resrc */ + 1 /* LLI abort resrc */
); );
rcv_ind = (USIGN8)(MAX(1, /* rcv ASS_REQ_PDU */ rcv_ind = (USIGN8)(max(1, /* rcv ASS_REQ_PDU */
(max_rcc /* rcv DTC_REQ_PDU */ (max_rcc /* rcv DTC_REQ_PDU */
+ max_rac)) /* rcv DTA_REQ_PDU */ + max_rac)) /* rcv DTA_REQ_PDU */
+ 1 /* rcv ABT_REQ_PDU */ + 1 /* rcv ABT_REQ_PDU */
); );
lli_rcv_ind = (USIGN8)(MIN(ci, 1) /* rcv IDLE_REQ_PDU */ lli_rcv_ind = (USIGN8)(min(ci, 1) /* rcv IDLE_REQ_PDU */
+ 2 /* rcv poll telegrams */ + 2 /* rcv poll telegrams */
); );
fdl_sap = 1; /* act/deact LSAP */ fdl_sap = 1; /* act/deact LSAP */
break; break;
case S_CL: case S_CL:
/* Broadcast/Multicast Sender ------------------------------------- */ /* Broadcast/Multicast Sender ------------------------------------- */
snd_req = (USIGN8)MAX(1, max_sac); /* snd DTU.req */ snd_req = (USIGN8)max(1, max_sac); /* snd DTU.req */
fdl_sap = 1; /* act/deact LSAP */ fdl_sap = 1; /* act/deact LSAP */
break; break;
case R_CL: case R_CL:
/* Broadcast/Multicast Receiver ----------------------------------- */ /* Broadcast/Multicast Receiver ----------------------------------- */
rcv_ind = (USIGN8)MAX(1, max_rac); /* rcv DTU_REQ_PDU */ rcv_ind = (USIGN8)max(1, max_rac); /* rcv DTU_REQ_PDU */
fdl_sap = 1; /* act/deact LSAP */ fdl_sap = 1; /* act/deact LSAP */
break; break;
default: default:
return (E_FM7_CRL_INVALID_ENTRY); return (E_FM7_CRL_INVALID_ENTRY);
} }
no_of_fal_sdbs = (USIGN16)(snd_req + snd_req_csrd + rcv_ind + rcv_ind_csrd no_of_fal_sdbs = (USIGN16)(snd_req + snd_req_csrd + rcv_ind + rcv_ind_csrd +
+ lli_api_resrc + lli_api_snd_resrc + lli_sr_snd_resrc + lli_evt_resrc); lli_api_resrc + lli_api_snd_resrc +
lli_sr_snd_resrc + lli_evt_resrc);
no_of_fdl_sdbs = (USIGN16)(snd_req + snd_req_srd + rcv_res + rcv_ind no_of_fdl_sdbs =
+ snd_res_srd + lli_api_snd_resrc + lli_sr_snd_resrc + lli_rcv_ind (USIGN16)(snd_req + snd_req_srd + rcv_res + rcv_ind + snd_res_srd +
+ fdl_sap + lli_poll_elem); lli_api_snd_resrc + lli_sr_snd_resrc + lli_rcv_ind + fdl_sap +
lli_poll_elem);
no_of_fdl_sdbs = (USIGN16)(no_of_fdl_sdbs + fdl_rsap); no_of_fdl_sdbs = (USIGN16)(no_of_fdl_sdbs + fdl_rsap);
no_of_data_buffer = (USIGN16)(snd_req + snd_req_csrd + snd_req_srd + rcv_res no_of_data_buffer =
+ rcv_ind + rcv_ind_csrd + lli_sr_snd_resrc + lli_poll_elem + lli_idm (USIGN16)(snd_req + snd_req_csrd + snd_req_srd + rcv_res + rcv_ind +
+ lli_rcv_ind + fdl_rsap + lli_evt_resrc); rcv_ind_csrd + lli_sr_snd_resrc + lli_poll_elem + lli_idm +
lli_rcv_ind + fdl_rsap + lli_evt_resrc);
no_of_api_buffer = (USIGN16)( no_of_api_buffer = (USIGN16)(snd_res_srd + lli_api_resrc + lli_api_snd_resrc +
snd_res_srd + lli_api_resrc + lli_api_snd_resrc + lli_poll_elem); lli_poll_elem);
if ((no_of_fal_sdbs > 0xFF) || (no_of_fdl_sdbs > 0xFF) if ((no_of_fal_sdbs > 0xFF) || (no_of_fdl_sdbs > 0xFF) ||
|| (no_of_data_buffer > 0xFF) || (no_of_api_buffer > 0xFF)) { (no_of_data_buffer > 0xFF) || (no_of_api_buffer > 0xFF))
{
return (E_FM7_CRL_INVALID_ENTRY); return (E_FM7_CRL_INVALID_ENTRY);
} }
...@@ -631,26 +615,27 @@ possible return values: ...@@ -631,26 +615,27 @@ possible return values:
conn_resrc.no_of_data_buffer = (USIGN8)no_of_data_buffer; conn_resrc.no_of_data_buffer = (USIGN8)no_of_data_buffer;
conn_resrc.no_of_api_buffer = (USIGN8)no_of_api_buffer; conn_resrc.no_of_api_buffer = (USIGN8)no_of_api_buffer;
if ((role == M_MM) && (_IS_I_CONN(crl_ptr->conn_attr))) { if ((role == M_MM) && (_IS_I_CONN(crl_ptr->conn_attr)))
{
ccrl_adapt_resrces( ccrl_adapt_resrces(
&ccrl_obj.isap_resrces[_CCRL_MAP_SAP_NR(crl_ptr->loc_lsap)], &ccrl_obj.isap_resrces[_CCRL_MAP_SAP_NR(crl_ptr->loc_lsap)],
&conn_resrc); &conn_resrc);
} }
ccrl_obj.ccrl.max_no_fal_sdbs ccrl_obj.ccrl.max_no_fal_sdbs =
= (USIGN16)(ccrl_obj.ccrl.max_no_fal_sdbs + conn_resrc.no_of_fal_sdbs); (USIGN16)(ccrl_obj.ccrl.max_no_fal_sdbs + conn_resrc.no_of_fal_sdbs);
ccrl_obj.ccrl.max_no_fdl_sdbs ccrl_obj.ccrl.max_no_fdl_sdbs =
= (USIGN16)(ccrl_obj.ccrl.max_no_fdl_sdbs + conn_resrc.no_of_fdl_sdbs); (USIGN16)(ccrl_obj.ccrl.max_no_fdl_sdbs + conn_resrc.no_of_fdl_sdbs);
ccrl_obj.ccrl.max_no_data_buffer = (USIGN16)( ccrl_obj.ccrl.max_no_data_buffer = (USIGN16)(
ccrl_obj.ccrl.max_no_data_buffer + conn_resrc.no_of_data_buffer); ccrl_obj.ccrl.max_no_data_buffer + conn_resrc.no_of_data_buffer);
ccrl_obj.ccrl.max_no_api_buffer = (USIGN16)( ccrl_obj.ccrl.max_no_api_buffer =
ccrl_obj.ccrl.max_no_api_buffer + conn_resrc.no_of_api_buffer); (USIGN16)(ccrl_obj.ccrl.max_no_api_buffer + conn_resrc.no_of_api_buffer);
ccrl_obj.ccrl.max_no_poll_entries ccrl_obj.ccrl.max_no_poll_entries =
= (USIGN16)(ccrl_obj.ccrl.max_no_poll_entries + lli_poll_elem); (USIGN16)(ccrl_obj.ccrl.max_no_poll_entries + lli_poll_elem);
*config_ptr = ccrl_obj.ccrl; *config_ptr = ccrl_obj.ccrl;
......
...@@ -59,16 +59,17 @@ Discription ...@@ -59,16 +59,17 @@ Discription
#include "rcsdef.h" #include "rcsdef.h"
#define INVALID_HANDLE_VALUE -1 #define INVALID_HANDLE_VALUE -1
int hDevDrv = INVALID_HANDLE_VALUE; // handle to cifDevDrv int hDevDrv = INVALID_HANDLE_VALUE; // handle to cifDevDrv
static unsigned short DrvOpenCount = 0; // no Application is logged in static unsigned short DrvOpenCount = 0; // no Application is logged in
typedef struct DEV_DPM_SIZEtag { typedef struct DEV_DPM_SIZEtag
{
unsigned int ulDpmSize; unsigned int ulDpmSize;
unsigned int ulDpmIOSize; unsigned int ulDpmIOSize;
} DEV_DPM_SIZE; } DEV_DPM_SIZE;
DEV_DPM_SIZE tDevDPMSize[MAX_DEV_BOARDS] = { { 0L, 0L }, { 0L, 0L }, { 0L, 0L }, DEV_DPM_SIZE tDevDPMSize[MAX_DEV_BOARDS] = {
{ 0L, 0L } }; // DPM size of each board {0L, 0L}, {0L, 0L}, {0L, 0L}, {0L, 0L}}; // DPM size of each board
/* <ST> /* <ST>
================================================================================= =================================================================================
...@@ -86,17 +87,22 @@ short DevOpenDriver() ...@@ -86,17 +87,22 @@ short DevOpenDriver()
{ {
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
// first application, search CIF device driver // first application, search CIF device driver
if ((hDevDrv = open("/dev/cif", O_RDONLY)) if ((hDevDrv = open("/dev/cif", O_RDONLY)) == -1)
== -1) { // handle of file with attributes to copy { // handle of file with attributes to copy
// error open CIF driver // error open CIF driver
sRet = DRV_USR_OPEN_ERROR; sRet = DRV_USR_OPEN_ERROR;
} else { }
else
{
// driver is opend for the 1st. time, store application in DrvOpencount // driver is opend for the 1st. time, store application in DrvOpencount
DrvOpenCount = 1; DrvOpenCount = 1;
} }
} else { }
else
{
// driver is already opend, store application in DrvOpencount // driver is already opend, store application in DrvOpencount
DrvOpenCount++; DrvOpenCount++;
} }
...@@ -122,14 +128,20 @@ short DevCloseDriver() ...@@ -122,14 +128,20 @@ short DevCloseDriver()
{ {
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else { }
else
{
// test if other applications are logged in // test if other applications are logged in
if (DrvOpenCount > 1) { if (DrvOpenCount > 1)
{
// there are more applications logged in, do not close the driver // there are more applications logged in, do not close the driver
DrvOpenCount--; DrvOpenCount--;
} else { }
else
{
// no more application are logged in, close File Handle // no more application are logged in, close File Handle
close(hDevDrv); // handle of object to close close(hDevDrv); // handle of object to close
DrvOpenCount = 0; DrvOpenCount = 0;
...@@ -160,15 +172,18 @@ short DevGetBoardInfo(BOARD_INFO* pvData) ...@@ -160,15 +172,18 @@ short DevGetBoardInfo(BOARD_INFO* pvData)
BOARD_INFO* ptBoardInfo = NULL; BOARD_INFO* ptBoardInfo = NULL;
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else { }
if ((ptBuffer else
= (DEVIO_GETBOARDINFOCMD*)malloc(sizeof(DEVIO_GETBOARDINFOCMD))) {
== NULL) if ((ptBuffer = (DEVIO_GETBOARDINFOCMD*)malloc(
sizeof(DEVIO_GETBOARDINFOCMD))) == NULL)
return DRV_USR_SENDBUF_PTR_NULL; return DRV_USR_SENDBUF_PTR_NULL;
if ((ptBuffer->ptBoardInfo = (BOARD_INFO*)malloc(sizeof(BOARD_INFO))) if ((ptBuffer->ptBoardInfo = (BOARD_INFO*)malloc(sizeof(BOARD_INFO))) ==
== NULL) { NULL)
{
free(ptBuffer); free(ptBuffer);
return DRV_USR_SENDBUF_PTR_NULL; return DRV_USR_SENDBUF_PTR_NULL;
} }
...@@ -176,10 +191,13 @@ short DevGetBoardInfo(BOARD_INFO* pvData) ...@@ -176,10 +191,13 @@ short DevGetBoardInfo(BOARD_INFO* pvData)
ptBuffer->usInfoLen = sizeof(BOARD_INFO); ptBuffer->usInfoLen = sizeof(BOARD_INFO);
ptBoardInfo = ptBuffer->ptBoardInfo; ptBoardInfo = ptBuffer->ptBoardInfo;
if (!ioctl(hDevDrv, CIF_IOCTLBOARDINFO, (unsigned long)ptBuffer)) { if (!ioctl(hDevDrv, CIF_IOCTLBOARDINFO, (unsigned long)ptBuffer))
{
// fprintf(stderr, "CIF_IOCTLBOARDINFO: %s\n", strerror(errno)); // fprintf(stderr, "CIF_IOCTLBOARDINFO: %s\n", strerror(errno));
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
} else { }
else
{
ptBuffer->ptBoardInfo = ptBoardInfo; ptBuffer->ptBoardInfo = ptBoardInfo;
// printf("sRet=%X, &tBuffer=%lX, ->ptBI=%lX\n",sRet,(unsigned // printf("sRet=%X, &tBuffer=%lX, ->ptBI=%lX\n",sRet,(unsigned
// long)tBuffer,(unsigned long)ptBoardInfo); // long)tBuffer,(unsigned long)ptBoardInfo);
...@@ -217,16 +235,19 @@ short DevGetBoardInfoEx(BOARD_INFOEX* pvData) ...@@ -217,16 +235,19 @@ short DevGetBoardInfoEx(BOARD_INFOEX* pvData)
BOARD_INFOEX* ptBoardInfoEx = NULL; BOARD_INFOEX* ptBoardInfoEx = NULL;
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else { }
if ((ptBuffer else
= (DEVIO_GETBOARDINFOEXCMD*)malloc(sizeof(DEVIO_GETBOARDINFOEXCMD))) {
== NULL) if ((ptBuffer = (DEVIO_GETBOARDINFOEXCMD*)malloc(
sizeof(DEVIO_GETBOARDINFOEXCMD))) == NULL)
return DRV_USR_SENDBUF_PTR_NULL; return DRV_USR_SENDBUF_PTR_NULL;
ptBuffer->usInfoLen = sizeof(BOARD_INFOEX); ptBuffer->usInfoLen = sizeof(BOARD_INFOEX);
if ((ptBuffer->ptBoard = (BOARD_INFOEX*)malloc(sizeof(BOARD_INFOEX))) if ((ptBuffer->ptBoard = (BOARD_INFOEX*)malloc(sizeof(BOARD_INFOEX))) ==
== NULL) { NULL)
{
free(ptBuffer); free(ptBuffer);
return DRV_USR_SENDBUF_PTR_NULL; return DRV_USR_SENDBUF_PTR_NULL;
} }
...@@ -234,10 +255,13 @@ short DevGetBoardInfoEx(BOARD_INFOEX* pvData) ...@@ -234,10 +255,13 @@ short DevGetBoardInfoEx(BOARD_INFOEX* pvData)
ptBuffer->usInfoLen = sizeof(BOARD_INFOEX); ptBuffer->usInfoLen = sizeof(BOARD_INFOEX);
ptBuffer->sError = sRet; ptBuffer->sError = sRet;
if (!ioctl(hDevDrv, CIF_IOCTLBOARDINFOEX, (unsigned long)ptBuffer)) { if (!ioctl(hDevDrv, CIF_IOCTLBOARDINFOEX, (unsigned long)ptBuffer))
{
// fprintf(stderr, "CIF_IOCTLBOARDINFOEX: %s\n", strerror(errno)); // fprintf(stderr, "CIF_IOCTLBOARDINFOEX: %s\n", strerror(errno));
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
} else { }
else
{
sRet = ptBuffer->sError; sRet = ptBuffer->sError;
ptBuffer->ptBoard = ptBoardInfoEx; ptBuffer->ptBoard = ptBoardInfoEx;
memcpy(pvData, ptBoardInfoEx, sizeof(BOARD_INFOEX)); memcpy(pvData, ptBoardInfoEx, sizeof(BOARD_INFOEX));
...@@ -260,27 +284,35 @@ short DevGetBoardInfoEx(BOARD_INFOEX* pvData) ...@@ -260,27 +284,35 @@ short DevGetBoardInfoEx(BOARD_INFOEX* pvData)
================================================================================= =================================================================================
<En> */ <En> */
short DevSetOpMode( short DevSetOpMode(unsigned short usBoard, unsigned short usMode,
unsigned short usBoard, unsigned short usMode, unsigned short* usIrq) unsigned short* usIrq)
{ {
DEVIO_SETOPMODE tBuffer; DEVIO_SETOPMODE tBuffer;
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else if (usBoard >= MAX_DEV_BOARDS) { }
else if (usBoard >= MAX_DEV_BOARDS)
{
// number is invalid // number is invalid
sRet = DRV_USR_DEV_NUMBER_INVALID; sRet = DRV_USR_DEV_NUMBER_INVALID;
} else { }
else
{
// clear all data buffers // clear all data buffers
tBuffer.usBoard = usBoard; tBuffer.usBoard = usBoard;
tBuffer.usMode = usMode; tBuffer.usMode = usMode;
tBuffer.sError = sRet; tBuffer.sError = sRet;
if (!ioctl(hDevDrv, CIF_IOCTL_IRQ_POLL, (unsigned long)(&tBuffer))) { if (!ioctl(hDevDrv, CIF_IOCTL_IRQ_POLL, (unsigned long)(&tBuffer)))
{
// fprintf(stderr, "CIFAPI (CIF_IOCTL_IRQ_POLL): %s\n", strerror(errno)); // fprintf(stderr, "CIFAPI (CIF_IOCTL_IRQ_POLL): %s\n", strerror(errno));
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
} else { }
else
{
sRet = tBuffer.sError; sRet = tBuffer.sError;
*usIrq = tBuffer.usIrq; *usIrq = tBuffer.usIrq;
} }
...@@ -307,28 +339,37 @@ short DevInitBoard(unsigned short usDevNumber) ...@@ -307,28 +339,37 @@ short DevInitBoard(unsigned short usDevNumber)
DEVIO_RESETCMD tBuffer; DEVIO_RESETCMD tBuffer;
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else if (usDevNumber >= MAX_DEV_BOARDS) { }
else if (usDevNumber >= MAX_DEV_BOARDS)
{
// number is invalid // number is invalid
sRet = DRV_USR_DEV_NUMBER_INVALID; sRet = DRV_USR_DEV_NUMBER_INVALID;
} else { }
else
{
// clear all data buffers // clear all data buffers
tBuffer.usBoard = usDevNumber; tBuffer.usBoard = usDevNumber;
tBuffer.sError = sRet; tBuffer.sError = sRet;
if (!ioctl(hDevDrv, CIF_IOCTLINITDRV, (unsigned long)(&tBuffer))) { if (!ioctl(hDevDrv, CIF_IOCTLINITDRV, (unsigned long)(&tBuffer)))
{
// fprintf(stderr, "CIFAPI (CIF_IOCTLINITDRV): %s\n", strerror(errno)); // fprintf(stderr, "CIFAPI (CIF_IOCTLINITDRV): %s\n", strerror(errno));
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
} else { }
else
{
sRet = tBuffer.sError; sRet = tBuffer.sError;
// printf("CIFAPI (CIF_IOCTLINITDRV): sRet = %d\n", sRet); // printf("CIFAPI (CIF_IOCTLINITDRV): sRet = %d\n", sRet);
if (sRet == DRV_NO_ERROR) { if (sRet == DRV_NO_ERROR)
{
// Save the DPM size for further function calls and calculate the length // Save the DPM size for further function calls and calculate the length
// of the DPM-IO data area // of the DPM-IO data area
tDevDPMSize[usDevNumber].ulDpmSize = tBuffer.ulDpmSize; tDevDPMSize[usDevNumber].ulDpmSize = tBuffer.ulDpmSize;
tDevDPMSize[usDevNumber].ulDpmIOSize tDevDPMSize[usDevNumber].ulDpmIOSize =
= ((tBuffer.ulDpmSize * 1024) - 1024) / 2; ((tBuffer.ulDpmSize * 1024) - 1024) / 2;
} }
} }
} }
...@@ -350,22 +391,29 @@ short DevInitBoard(unsigned short usDevNumber) ...@@ -350,22 +391,29 @@ short DevInitBoard(unsigned short usDevNumber)
================================================================================= =================================================================================
<En> */ <En> */
short DevReset( short DevReset(unsigned char usDevNumber, unsigned short usMode,
unsigned char usDevNumber, unsigned short usMode, unsigned long ulTimeout) unsigned long ulTimeout)
{ {
DEVIO_RESETCMD tBuffer; DEVIO_RESETCMD tBuffer;
unsigned int lBytesReturned; unsigned int lBytesReturned;
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
// valid handle available, driver is open // valid handle available, driver is open
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else if (usDevNumber >= MAX_DEV_BOARDS) { }
else if (usDevNumber >= MAX_DEV_BOARDS)
{
sRet = DRV_USR_DEV_NUMBER_INVALID; sRet = DRV_USR_DEV_NUMBER_INVALID;
} else if ((usMode != COLDSTART) && (usMode != WARMSTART) }
&& (usMode != BOOTSTART)) { else if ((usMode != COLDSTART) && (usMode != WARMSTART) &&
(usMode != BOOTSTART))
{
sRet = DRV_USR_MODE_INVALID; sRet = DRV_USR_MODE_INVALID;
} else { }
else
{
// fill in parameter data // fill in parameter data
lBytesReturned = 0; lBytesReturned = 0;
// set output buffer // set output buffer
...@@ -376,10 +424,13 @@ short DevReset( ...@@ -376,10 +424,13 @@ short DevReset(
// printf("CIF_IOCTLRESETDEV: BOARD = %d, mode = %d, tout = %ld\n", // printf("CIF_IOCTLRESETDEV: BOARD = %d, mode = %d, tout = %ld\n",
// tBuffer.ucBoard, tBuffer.usMode, tBuffer.ulTimeout); // tBuffer.ucBoard, tBuffer.usMode, tBuffer.ulTimeout);
if (!ioctl(hDevDrv, CIF_IOCTLRESETDEV, (unsigned long)(&tBuffer))) { if (!ioctl(hDevDrv, CIF_IOCTLRESETDEV, (unsigned long)(&tBuffer)))
{
// fprintf(stderr, "CIF_IOCTLRESETDEV: %s\n", strerror(errno)); // fprintf(stderr, "CIF_IOCTLRESETDEV: %s\n", strerror(errno));
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
} else { }
else
{
sRet = tBuffer.sError; sRet = tBuffer.sError;
} }
} }
...@@ -403,66 +454,83 @@ short DevReset( ...@@ -403,66 +454,83 @@ short DevReset(
<En> */ <En> */
short DevGetInfo(unsigned short usDevNumber, unsigned short usInfoArea, short DevGetInfo(unsigned short usDevNumber, unsigned short usInfoArea,
unsigned short usSize, void* pvData) unsigned short usSize, void* pvData)
{ {
DEVIO_GETDEVINFOCMD tBuffer; DEVIO_GETDEVINFOCMD tBuffer;
unsigned int lBytesReturned; unsigned int lBytesReturned;
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
// valid handle available, driver is open // valid handle available, driver is open
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else if (usDevNumber >= MAX_DEV_BOARDS) { }
else if (usDevNumber >= MAX_DEV_BOARDS)
{
sRet = DRV_USR_DEV_NUMBER_INVALID; sRet = DRV_USR_DEV_NUMBER_INVALID;
} else if (usSize == 0) { }
else if (usSize == 0)
{
sRet = DRV_USR_SIZE_ZERO; sRet = DRV_USR_SIZE_ZERO;
} else { }
else
{
// test area spezific data // test area spezific data
switch (usInfoArea) { switch (usInfoArea)
{
case GET_VERSION_INFO: case GET_VERSION_INFO:
if (usSize > sizeof(VERSIONINFO)) { if (usSize > sizeof(VERSIONINFO))
{
sRet = DRV_USR_SIZE_TOO_LONG; sRet = DRV_USR_SIZE_TOO_LONG;
} }
break; break;
case GET_DRIVER_INFO: case GET_DRIVER_INFO:
if (usSize > sizeof(DRIVERINFO)) { if (usSize > sizeof(DRIVERINFO))
{
sRet = DRV_USR_SIZE_TOO_LONG; sRet = DRV_USR_SIZE_TOO_LONG;
} }
break; break;
case GET_FIRMWARE_INFO: case GET_FIRMWARE_INFO:
if (usSize > sizeof(FIRMWAREINFO)) { if (usSize > sizeof(FIRMWAREINFO))
{
sRet = DRV_USR_SIZE_TOO_LONG; sRet = DRV_USR_SIZE_TOO_LONG;
} }
break; break;
case GET_RCS_INFO: case GET_RCS_INFO:
if (usSize > sizeof(RCSINFO)) { if (usSize > sizeof(RCSINFO))
{
sRet = DRV_USR_SIZE_TOO_LONG; sRet = DRV_USR_SIZE_TOO_LONG;
} }
break; break;
case GET_DEV_INFO: case GET_DEV_INFO:
if (usSize > sizeof(DEVINFO)) { if (usSize > sizeof(DEVINFO))
{
sRet = DRV_USR_SIZE_TOO_LONG; sRet = DRV_USR_SIZE_TOO_LONG;
} }
break; break;
case GET_TASK_INFO: case GET_TASK_INFO:
if (usSize > sizeof(TASKINFO)) { if (usSize > sizeof(TASKINFO))
{
sRet = DRV_USR_SIZE_TOO_LONG; sRet = DRV_USR_SIZE_TOO_LONG;
} }
break; break;
case GET_IO_INFO: case GET_IO_INFO:
if (usSize > sizeof(IOINFO)) { if (usSize > sizeof(IOINFO))
{
sRet = DRV_USR_SIZE_TOO_LONG; sRet = DRV_USR_SIZE_TOO_LONG;
} }
break; break;
case GET_IO_SEND_DATA: case GET_IO_SEND_DATA:
if (usSize > tDevDPMSize[usDevNumber].ulDpmIOSize) { if (usSize > tDevDPMSize[usDevNumber].ulDpmIOSize)
{
sRet = DRV_USR_SIZE_TOO_LONG; sRet = DRV_USR_SIZE_TOO_LONG;
} }
break; break;
default: default:
sRet = DRV_USR_INFO_AREA_INVALID; sRet = DRV_USR_INFO_AREA_INVALID;
} /* end switch */ } /* end switch */
if (sRet == DRV_NO_ERROR) { if (sRet == DRV_NO_ERROR)
{
// complete buffer length with return data // complete buffer length with return data
// usDataBufferLen = usSize; // usDataBufferLen = usSize;
// fill in parameter data // fill in parameter data
...@@ -471,15 +539,18 @@ short DevGetInfo(unsigned short usDevNumber, unsigned short usInfoArea, ...@@ -471,15 +539,18 @@ short DevGetInfo(unsigned short usDevNumber, unsigned short usInfoArea,
tBuffer.usBoard = usDevNumber; tBuffer.usBoard = usDevNumber;
tBuffer.usInfoArea = usInfoArea; tBuffer.usInfoArea = usInfoArea;
tBuffer.usInfoLen = usSize; tBuffer.usInfoLen = usSize;
tBuffer.pabInfoData tBuffer.pabInfoData =
= pvData; // needed in kernel-space to copy data back to it! pvData; // needed in kernel-space to copy data back to it!
tBuffer.sError = sRet; tBuffer.sError = sRet;
// activate function // activate function
if (!ioctl(hDevDrv, CIF_IOCTLGETINFO, (unsigned long)(&tBuffer))) { if (!ioctl(hDevDrv, CIF_IOCTLGETINFO, (unsigned long)(&tBuffer)))
{
// fprintf(stderr, "(CIFAPI: (CIF_IOCTLGETINFO): %s\n", // fprintf(stderr, "(CIFAPI: (CIF_IOCTLGETINFO): %s\n",
// strerror(errno)); // strerror(errno));
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
} else { }
else
{
// memcpy(pvData, tBuffer.pabInfoData, usSize); already copied by // memcpy(pvData, tBuffer.pabInfoData, usSize); already copied by
// driver direct !!! // driver direct !!!
sRet = tBuffer.sError; sRet = tBuffer.sError;
...@@ -506,24 +577,34 @@ short DevGetInfo(unsigned short usDevNumber, unsigned short usInfoArea, ...@@ -506,24 +577,34 @@ short DevGetInfo(unsigned short usDevNumber, unsigned short usInfoArea,
<En> */ <En> */
short DevPutTaskParameter(unsigned short usDevNumber, unsigned short usNumber, short DevPutTaskParameter(unsigned short usDevNumber, unsigned short usNumber,
unsigned short usSize, void* pvData) unsigned short usSize, void* pvData)
{ {
DEVIO_PUTPARAMETERCMD tBuffer; DEVIO_PUTPARAMETERCMD tBuffer;
unsigned int lBytesReturned; unsigned int lBytesReturned;
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
// valid handle available, driver is open // valid handle available, driver is open
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else if (usDevNumber >= MAX_DEV_BOARDS) { }
else if (usDevNumber >= MAX_DEV_BOARDS)
{
sRet = DRV_USR_DEV_NUMBER_INVALID; sRet = DRV_USR_DEV_NUMBER_INVALID;
} else if ((usNumber < 1) }
|| (usNumber > 7)) { // 3...7 wird in MailBox memory area geschrieben else if ((usNumber < 1) || (usNumber > 7))
{ // 3...7 wird in MailBox memory area geschrieben
sRet = DRV_USR_NUMBER_INVALID; sRet = DRV_USR_NUMBER_INVALID;
} else if (usSize == 0) { }
else if (usSize == 0)
{
sRet = DRV_USR_SIZE_ZERO; sRet = DRV_USR_SIZE_ZERO;
} else if (usSize > sizeof(TASKPARAM)) { }
else if (usSize > sizeof(TASKPARAM))
{
sRet = DRV_USR_SIZE_TOO_LONG; sRet = DRV_USR_SIZE_TOO_LONG;
} else { }
else
{
// fill in parameter data // fill in parameter data
lBytesReturned = 0; lBytesReturned = 0;
// set command buffer // set command buffer
...@@ -531,13 +612,15 @@ short DevPutTaskParameter(unsigned short usDevNumber, unsigned short usNumber, ...@@ -531,13 +612,15 @@ short DevPutTaskParameter(unsigned short usDevNumber, unsigned short usNumber,
tBuffer.usTaskParamNum = usNumber; tBuffer.usTaskParamNum = usNumber;
tBuffer.usTaskParamLen = usSize; tBuffer.usTaskParamLen = usSize;
memcpy((unsigned char*)&(tBuffer.TaskParameter), (unsigned char*)pvData, memcpy((unsigned char*)&(tBuffer.TaskParameter), (unsigned char*)pvData,
usSize); usSize);
tBuffer.sError = sRet; tBuffer.sError = sRet;
// activate function // activate function
if (!ioctl(hDevDrv, CIF_IOCTLPARAMETER, (unsigned long)(&tBuffer))) { if (!ioctl(hDevDrv, CIF_IOCTLPARAMETER, (unsigned long)(&tBuffer)))
{
// fprintf(stderr, "CIF_IOCTLRESETDEV: %s\n", strerror(errno)); // fprintf(stderr, "CIF_IOCTLRESETDEV: %s\n", strerror(errno));
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
} else }
else
sRet = tBuffer.sError; sRet = tBuffer.sError;
} }
return sRet; return sRet;
...@@ -560,24 +643,35 @@ short DevPutTaskParameter(unsigned short usDevNumber, unsigned short usNumber, ...@@ -560,24 +643,35 @@ short DevPutTaskParameter(unsigned short usDevNumber, unsigned short usNumber,
<En> */ <En> */
short DevGetTaskState(unsigned short usDevNumber, unsigned short usNumber, short DevGetTaskState(unsigned short usDevNumber, unsigned short usNumber,
unsigned short usSize, void* pvData) unsigned short usSize, void* pvData)
{ {
DEVIO_GETTASKSTATECMD tBuffer; DEVIO_GETTASKSTATECMD tBuffer;
unsigned int lBytesReturned; unsigned int lBytesReturned;
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
// valid handle available, driver is open // valid handle available, driver is open
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else if (usDevNumber >= MAX_DEV_BOARDS) { }
else if (usDevNumber >= MAX_DEV_BOARDS)
{
sRet = DRV_USR_DEV_NUMBER_INVALID; sRet = DRV_USR_DEV_NUMBER_INVALID;
} else if (usNumber < 1 || usNumber > 2) { }
else if (usNumber < 1 || usNumber > 2)
{
sRet = DRV_USR_NUMBER_INVALID; sRet = DRV_USR_NUMBER_INVALID;
} else if (usSize == 0) { }
else if (usSize == 0)
{
sRet = DRV_USR_SIZE_ZERO; sRet = DRV_USR_SIZE_ZERO;
} else if (usSize > sizeof(TASKSTATE)) { }
else if (usSize > sizeof(TASKSTATE))
{
sRet = DRV_USR_SIZE_TOO_LONG; sRet = DRV_USR_SIZE_TOO_LONG;
} else { }
else
{
// fill in parameter data // fill in parameter data
lBytesReturned = 0; lBytesReturned = 0;
...@@ -588,10 +682,13 @@ short DevGetTaskState(unsigned short usDevNumber, unsigned short usNumber, ...@@ -588,10 +682,13 @@ short DevGetTaskState(unsigned short usDevNumber, unsigned short usNumber,
// memcpy( tBuffer.TaskState, pvData, usSize); // memcpy( tBuffer.TaskState, pvData, usSize);
tBuffer.sError = sRet; tBuffer.sError = sRet;
// activate function // activate function
if (!ioctl(hDevDrv, CIF_IOCTLTASKSTATE, (unsigned long)(&tBuffer))) { if (!ioctl(hDevDrv, CIF_IOCTLTASKSTATE, (unsigned long)(&tBuffer)))
{
// fprintf(stderr, "CIF_IOCTLTASKSTATE: %s\n", strerror(errno)); // fprintf(stderr, "CIF_IOCTLTASKSTATE: %s\n", strerror(errno));
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
} else { }
else
{
memcpy(pvData, tBuffer.TaskState, usSize); memcpy(pvData, tBuffer.TaskState, usSize);
sRet = tBuffer.sError; sRet = tBuffer.sError;
} }
...@@ -614,30 +711,38 @@ short DevGetTaskState(unsigned short usDevNumber, unsigned short usNumber, ...@@ -614,30 +711,38 @@ short DevGetTaskState(unsigned short usDevNumber, unsigned short usNumber,
<En> */ <En> */
short DevGetMBXState(unsigned short usDevNumber, unsigned short* pusDevMbxState, short DevGetMBXState(unsigned short usDevNumber, unsigned short* pusDevMbxState,
unsigned short* pusHostMbxState) unsigned short* pusHostMbxState)
{ {
DEVIO_MBXINFOCMD tBuffer; DEVIO_MBXINFOCMD tBuffer;
unsigned int lBytesReturned; unsigned int lBytesReturned;
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
// valid handle available, driver is open // valid handle available, driver is open
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else if (usDevNumber >= MAX_DEV_BOARDS) { }
else if (usDevNumber >= MAX_DEV_BOARDS)
{
sRet = DRV_USR_DEV_NUMBER_INVALID; sRet = DRV_USR_DEV_NUMBER_INVALID;
} else { }
else
{
// fill in parameter data // fill in parameter data
lBytesReturned = 0; lBytesReturned = 0;
// set output buffer // set output buffer
tBuffer.ucBoard = usDevNumber; tBuffer.ucBoard = usDevNumber;
tBuffer.usDevMbxState = 0x00; //*pusDevMbxState; tBuffer.usDevMbxState = 0x00; //*pusDevMbxState;
tBuffer.usHostMbxState = 0x00; //*pusHostMbxState; tBuffer.usHostMbxState = 0x00; //*pusHostMbxState;
tBuffer.sError = sRet; tBuffer.sError = sRet;
// activate function // activate function
if (!ioctl(hDevDrv, CIF_IOCTLMBXINFO, (unsigned long)(&tBuffer))) { if (!ioctl(hDevDrv, CIF_IOCTLMBXINFO, (unsigned long)(&tBuffer)))
{
// fprintf(stderr, "CIF_IOCTLMBXINFO: %s\n", strerror(errno)); // fprintf(stderr, "CIF_IOCTLMBXINFO: %s\n", strerror(errno));
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
} else { }
else
{
*pusDevMbxState = tBuffer.usDevMbxState; *pusDevMbxState = tBuffer.usDevMbxState;
*pusHostMbxState = tBuffer.usHostMbxState; *pusHostMbxState = tBuffer.usHostMbxState;
sRet = tBuffer.sError; sRet = tBuffer.sError;
...@@ -662,23 +767,31 @@ short DevGetMBXState(unsigned short usDevNumber, unsigned short* pusDevMbxState, ...@@ -662,23 +767,31 @@ short DevGetMBXState(unsigned short usDevNumber, unsigned short* pusDevMbxState,
================================================================================= =================================================================================
<En> */ <En> */
short DevGetMBXData(unsigned short usDevNumber, unsigned short usHostSize, short DevGetMBXData(unsigned short usDevNumber, unsigned short usHostSize,
void* pvHostData, unsigned short usDevSize, void* pvDevData) void* pvHostData, unsigned short usDevSize, void* pvDevData)
{ {
DEVIO_GETMBXCMD tBuffer; DEVIO_GETMBXCMD tBuffer;
unsigned int lBytesReturned; unsigned int lBytesReturned;
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
// valid handle available, driver is open // valid handle available, driver is open
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else if (usDevNumber >= MAX_DEV_BOARDS) { }
else if (usDevNumber >= MAX_DEV_BOARDS)
{
sRet = DRV_USR_DEV_NUMBER_INVALID; sRet = DRV_USR_DEV_NUMBER_INVALID;
} else if ((usHostSize == 0) || (usDevSize == 0)) { }
else if ((usHostSize == 0) || (usDevSize == 0))
{
sRet = DRV_USR_SIZE_ZERO; sRet = DRV_USR_SIZE_ZERO;
} else if ((usHostSize > sizeof(MSG_STRUC)) }
|| (usDevSize > sizeof(MSG_STRUC))) { else if ((usHostSize > sizeof(MSG_STRUC)) || (usDevSize > sizeof(MSG_STRUC)))
{
sRet = DRV_USR_SIZE_TOO_LONG; sRet = DRV_USR_SIZE_TOO_LONG;
} else { }
else
{
// fill in parameter data // fill in parameter data
lBytesReturned = 0; lBytesReturned = 0;
...@@ -687,9 +800,9 @@ short DevGetMBXData(unsigned short usDevNumber, unsigned short usHostSize, ...@@ -687,9 +800,9 @@ short DevGetMBXData(unsigned short usDevNumber, unsigned short usHostSize,
tBuffer.usDevLen = usDevSize; tBuffer.usDevLen = usDevSize;
tBuffer.sError = sRet; tBuffer.sError = sRet;
// activate function // activate function
if (!ioctl(hDevDrv, // handle of the device if (!ioctl(hDevDrv, // handle of the device
CIF_IOCTLGETMBX, // control code of operation to perform CIF_IOCTLGETMBX, // control code of operation to perform
(unsigned long)(&tBuffer))) (unsigned long)(&tBuffer)))
/*, // address of buffer for input data /*, // address of buffer for input data
sizeof(tBuffer), sizeof(tBuffer),
// size of input buffer // size of input buffer
...@@ -705,7 +818,9 @@ short DevGetMBXData(unsigned short usDevNumber, unsigned short usHostSize, ...@@ -705,7 +818,9 @@ short DevGetMBXData(unsigned short usDevNumber, unsigned short usHostSize,
// fprintf(stderr, "CIF_IOCTLGETMBX: %s\n", strerror(errno)); // fprintf(stderr, "CIF_IOCTLGETMBX: %s\n", strerror(errno));
// function error // function error
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
} else { }
else
{
printf("cif_api::DevGetMBXData: after CIF_IOCTLGETMBX ...\n"); printf("cif_api::DevGetMBXData: after CIF_IOCTLGETMBX ...\n");
memcpy(pvDevData, tBuffer.abDevMbx, usDevSize); memcpy(pvDevData, tBuffer.abDevMbx, usDevSize);
printf("cif_api::DevGetMBXData: after memcpy ...\n"); printf("cif_api::DevGetMBXData: after memcpy ...\n");
...@@ -736,12 +851,17 @@ short DevExitBoard(unsigned short usDevNumber) ...@@ -736,12 +851,17 @@ short DevExitBoard(unsigned short usDevNumber)
unsigned short usDrvOpenCount = 0; unsigned short usDrvOpenCount = 0;
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else if (usDevNumber >= MAX_DEV_BOARDS) { }
else if (usDevNumber >= MAX_DEV_BOARDS)
{
// number is invalid // number is invalid
sRet = DRV_USR_DEV_NUMBER_INVALID; sRet = DRV_USR_DEV_NUMBER_INVALID;
} else { }
else
{
// valid handle available, driver is open // valid handle available, driver is open
// clear all data buffers // clear all data buffers
lBytesReturned = 0; lBytesReturned = 0;
...@@ -749,12 +869,15 @@ short DevExitBoard(unsigned short usDevNumber) ...@@ -749,12 +869,15 @@ short DevExitBoard(unsigned short usDevNumber)
// tBuffer.usDrvOpenCount = usDrvOpenCount; // [out] // tBuffer.usDrvOpenCount = usDrvOpenCount; // [out]
// tBuffer.sError = sRet; // [out] // tBuffer.sError = sRet; // [out]
if (!ioctl(hDevDrv, CIF_IOCTLEXITDRV, (unsigned long)(&tBuffer))) { if (!ioctl(hDevDrv, CIF_IOCTLEXITDRV, (unsigned long)(&tBuffer)))
{
// fprintf(stderr, "CIF_IOCTLEXITDRV: %s\n", strerror(errno)); // fprintf(stderr, "CIF_IOCTLEXITDRV: %s\n", strerror(errno));
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
} else { }
else
{
tBuffer.usDrvOpenCount = usDrvOpenCount; // [out] tBuffer.usDrvOpenCount = usDrvOpenCount; // [out]
sRet = tBuffer.sError; // [out] sRet = tBuffer.sError; // [out]
} }
} }
...@@ -777,22 +900,29 @@ short DevExitBoard(unsigned short usDevNumber) ...@@ -777,22 +900,29 @@ short DevExitBoard(unsigned short usDevNumber)
<En> */ <En> */
short DevReadSendData(unsigned short usDevNumber, unsigned short usOffset, short DevReadSendData(unsigned short usDevNumber, unsigned short usOffset,
unsigned short usSize, void* pvData) unsigned short usSize, void* pvData)
{ {
DEVIO_READSENDCMD tBuffer; DEVIO_READSENDCMD tBuffer;
unsigned int lBytesReturned; unsigned int lBytesReturned;
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
// valid handle available, driver is open // valid handle available, driver is open
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else if (usDevNumber >= MAX_DEV_BOARDS) { }
else if (usDevNumber >= MAX_DEV_BOARDS)
{
sRet = DRV_USR_DEV_NUMBER_INVALID; sRet = DRV_USR_DEV_NUMBER_INVALID;
} else if ((usSize != 0) }
&& ((usSize + usOffset) else if ((usSize != 0) &&
> (unsigned short)tDevDPMSize[usDevNumber].ulDpmIOSize)) { ((usSize + usOffset) >
(unsigned short)tDevDPMSize[usDevNumber].ulDpmIOSize))
{
sRet = DRV_USR_SIZE_TOO_LONG; sRet = DRV_USR_SIZE_TOO_LONG;
} else { }
else
{
// fill in parameter data // fill in parameter data
lBytesReturned = 0; lBytesReturned = 0;
// set output buffer // set output buffer
...@@ -803,10 +933,13 @@ short DevReadSendData(unsigned short usDevNumber, unsigned short usOffset, ...@@ -803,10 +933,13 @@ short DevReadSendData(unsigned short usDevNumber, unsigned short usOffset,
tBuffer.sError = sRet; tBuffer.sError = sRet;
// activate function // activate function
if (!ioctl(hDevDrv, CIF_IOCTLREADSEND, (unsigned long)(&tBuffer))) { if (!ioctl(hDevDrv, CIF_IOCTLREADSEND, (unsigned long)(&tBuffer)))
{
// fprintf(stderr, "CIF_IOCTLREADSEND: %s\n", strerror(errno)); // fprintf(stderr, "CIF_IOCTLREADSEND: %s\n", strerror(errno));
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
} else { }
else
{
sRet = tBuffer.sError; sRet = tBuffer.sError;
} }
} }
...@@ -828,19 +961,26 @@ short DevReadSendData(unsigned short usDevNumber, unsigned short usOffset, ...@@ -828,19 +961,26 @@ short DevReadSendData(unsigned short usDevNumber, unsigned short usOffset,
<En> */ <En> */
short DevTriggerWatchDog(unsigned short usDevNumber, unsigned short usMode, short DevTriggerWatchDog(unsigned short usDevNumber, unsigned short usMode,
unsigned short* pusDevWatchDog) unsigned short* pusDevWatchDog)
{ {
DEVIO_TRIGGERCMD tBuffer; DEVIO_TRIGGERCMD tBuffer;
unsigned int lBytesReturned; unsigned int lBytesReturned;
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
// valid handle available, driver is open // valid handle available, driver is open
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else if (usDevNumber >= MAX_DEV_BOARDS) { }
else if (usDevNumber >= MAX_DEV_BOARDS)
{
sRet = DRV_USR_DEV_NUMBER_INVALID; sRet = DRV_USR_DEV_NUMBER_INVALID;
} else if (usMode > WATCHDOG_START) { }
else if (usMode > WATCHDOG_START)
{
sRet = DRV_USR_MODE_INVALID; sRet = DRV_USR_MODE_INVALID;
} else { }
else
{
// fill in parameter data // fill in parameter data
lBytesReturned = 0; lBytesReturned = 0;
// set output buffer // set output buffer
...@@ -850,10 +990,13 @@ short DevTriggerWatchDog(unsigned short usDevNumber, unsigned short usMode, ...@@ -850,10 +990,13 @@ short DevTriggerWatchDog(unsigned short usDevNumber, unsigned short usMode,
tBuffer.sError = sRet; tBuffer.sError = sRet;
// activate function // activate function
if (!ioctl(hDevDrv, CIF_IOCTLTRIGGERWD, (unsigned long)(&tBuffer))) { if (!ioctl(hDevDrv, CIF_IOCTLTRIGGERWD, (unsigned long)(&tBuffer)))
{
// fprintf(stderr, "CIF_IOCTLREADSEND: %s\n", strerror(errno)); // fprintf(stderr, "CIF_IOCTLREADSEND: %s\n", strerror(errno));
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
} else { }
else
{
*pusDevWatchDog = tBuffer.usTriggerValue; *pusDevWatchDog = tBuffer.usTriggerValue;
sRet = tBuffer.sError; sRet = tBuffer.sError;
} }
...@@ -877,19 +1020,26 @@ short DevTriggerWatchDog(unsigned short usDevNumber, unsigned short usMode, ...@@ -877,19 +1020,26 @@ short DevTriggerWatchDog(unsigned short usDevNumber, unsigned short usMode,
<En> */ <En> */
short DevSpecialControl(unsigned short usDevNumber, unsigned short usMode, short DevSpecialControl(unsigned short usDevNumber, unsigned short usMode,
unsigned short* pusCtrlAck) unsigned short* pusCtrlAck)
{ {
DEVIO_TRIGGERCMD tBuffer; DEVIO_TRIGGERCMD tBuffer;
unsigned int lBytesReturned; unsigned int lBytesReturned;
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
// valid handle available, driver is open // valid handle available, driver is open
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else if (usDevNumber >= MAX_DEV_BOARDS) { }
else if (usDevNumber >= MAX_DEV_BOARDS)
{
sRet = DRV_USR_DEV_NUMBER_INVALID; sRet = DRV_USR_DEV_NUMBER_INVALID;
} else if (pusCtrlAck == NULL) { }
else if (pusCtrlAck == NULL)
{
sRet = DRV_USR_BUF_PTR_NULL; sRet = DRV_USR_BUF_PTR_NULL;
} else { }
else
{
// fill in parameter data // fill in parameter data
lBytesReturned = 0; lBytesReturned = 0;
// set output buffer // set output buffer
...@@ -898,10 +1048,13 @@ short DevSpecialControl(unsigned short usDevNumber, unsigned short usMode, ...@@ -898,10 +1048,13 @@ short DevSpecialControl(unsigned short usDevNumber, unsigned short usMode,
tBuffer.sError = sRet; tBuffer.sError = sRet;
// activate function // activate function
if (!ioctl(hDevDrv, CIF_IOCTLSPCONTROL, (unsigned long)(&tBuffer))) { if (!ioctl(hDevDrv, CIF_IOCTLSPCONTROL, (unsigned long)(&tBuffer)))
{
// fprintf(stderr, "CIF_IOCTLREADSEND: %s\n", strerror(errno)); // fprintf(stderr, "CIF_IOCTLREADSEND: %s\n", strerror(errno));
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
} else { }
else
{
*pusCtrlAck = tBuffer.usTriggerValue; *pusCtrlAck = tBuffer.usTriggerValue;
sRet = tBuffer.sError; sRet = tBuffer.sError;
} }
...@@ -926,23 +1079,34 @@ short DevSpecialControl(unsigned short usDevNumber, unsigned short usMode, ...@@ -926,23 +1079,34 @@ short DevSpecialControl(unsigned short usDevNumber, unsigned short usMode,
<En> */ <En> */
short DevExtendedData(unsigned short usDevNumber, unsigned short usMode, short DevExtendedData(unsigned short usDevNumber, unsigned short usMode,
unsigned short usSize, void* pvData) unsigned short usSize, void* pvData)
{ {
DEVIO_EXTDATACMD tBuffer; DEVIO_EXTDATACMD tBuffer;
unsigned int lBytesReturned; unsigned int lBytesReturned;
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
// valid handle available, driver is open // valid handle available, driver is open
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else if (usDevNumber >= MAX_DEV_BOARDS) { }
else if (usDevNumber >= MAX_DEV_BOARDS)
{
sRet = DRV_USR_DEV_NUMBER_INVALID; sRet = DRV_USR_DEV_NUMBER_INVALID;
} else if (usSize == 0) { }
else if (usSize == 0)
{
sRet = DRV_USR_SIZE_ZERO; sRet = DRV_USR_SIZE_ZERO;
} else if (usSize > EXTDATASIZE) { }
else if (usSize > EXTDATASIZE)
{
sRet = DRV_USR_SIZE_TOO_LONG; sRet = DRV_USR_SIZE_TOO_LONG;
} else if ((usMode == 0) || (usMode > 100)) { }
else if ((usMode == 0) || (usMode > 100))
{
sRet = DRV_USR_MODE_INVALID; sRet = DRV_USR_MODE_INVALID;
} else { }
else
{
// fill in parameter data // fill in parameter data
lBytesReturned = 0; lBytesReturned = 0;
...@@ -957,10 +1121,12 @@ short DevExtendedData(unsigned short usDevNumber, unsigned short usMode, ...@@ -957,10 +1121,12 @@ short DevExtendedData(unsigned short usDevNumber, unsigned short usMode,
// error into the tDataBuffer. // error into the tDataBuffer.
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
// activate function // activate function
if (!ioctl(hDevDrv, CIF_IOCTLEXTDATA, (unsigned long)(&tBuffer))) { if (!ioctl(hDevDrv, CIF_IOCTLEXTDATA, (unsigned long)(&tBuffer)))
{
// fprintf(stderr, "CIF_IOCTLEXTDATA: %s\n", strerror(errno)); // fprintf(stderr, "CIF_IOCTLEXTDATA: %s\n", strerror(errno));
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
} else }
else
sRet = tBuffer.sError; sRet = tBuffer.sError;
} }
return sRet; return sRet;
...@@ -983,24 +1149,35 @@ short DevExtendedData(unsigned short usDevNumber, unsigned short usMode, ...@@ -983,24 +1149,35 @@ short DevExtendedData(unsigned short usDevNumber, unsigned short usMode,
<En> */ <En> */
short DevGetTaskParameter(unsigned short usDevNumber, unsigned short usNumber, short DevGetTaskParameter(unsigned short usDevNumber, unsigned short usNumber,
unsigned short usSize, void* pvData) unsigned short usSize, void* pvData)
{ {
DEVIO_GETPARAMETERCMD tBuffer; DEVIO_GETPARAMETERCMD tBuffer;
unsigned int lBytesReturned; unsigned int lBytesReturned;
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
// valid handle available, driver is open // valid handle available, driver is open
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else if (usDevNumber >= MAX_DEV_BOARDS) { }
else if (usDevNumber >= MAX_DEV_BOARDS)
{
sRet = DRV_USR_DEV_NUMBER_INVALID; sRet = DRV_USR_DEV_NUMBER_INVALID;
} else if ((usNumber < 1) || (usNumber > 2)) { }
else if ((usNumber < 1) || (usNumber > 2))
{
sRet = DRV_USR_NUMBER_INVALID; sRet = DRV_USR_NUMBER_INVALID;
} else if (usSize == 0) { }
else if (usSize == 0)
{
sRet = DRV_USR_SIZE_ZERO; sRet = DRV_USR_SIZE_ZERO;
} else if (usSize > sizeof(TASKPARAM)) { }
else if (usSize > sizeof(TASKPARAM))
{
sRet = DRV_USR_SIZE_TOO_LONG; sRet = DRV_USR_SIZE_TOO_LONG;
} else { }
else
{
// fill in parameter data // fill in parameter data
lBytesReturned = 0; lBytesReturned = 0;
// set command buffer // set command buffer
...@@ -1010,12 +1187,15 @@ short DevGetTaskParameter(unsigned short usDevNumber, unsigned short usNumber, ...@@ -1010,12 +1187,15 @@ short DevGetTaskParameter(unsigned short usDevNumber, unsigned short usNumber,
// tBuffer.ptTaskParam = pvData; // tBuffer.ptTaskParam = pvData;
tBuffer.sError = sRet; tBuffer.sError = sRet;
// activate function // activate function
if (!ioctl(hDevDrv, CIF_IOCTLGETPARAMETER, (unsigned long)(&tBuffer))) { if (!ioctl(hDevDrv, CIF_IOCTLGETPARAMETER, (unsigned long)(&tBuffer)))
{
// fprintf(stderr, "CIF_IOCTLGETPARAMETER: %s\n", strerror(errno)); // fprintf(stderr, "CIF_IOCTLGETPARAMETER: %s\n", strerror(errno));
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
} else { }
else
{
memcpy((unsigned char*)pvData, (unsigned char*)&(tBuffer.TaskParameter), memcpy((unsigned char*)pvData, (unsigned char*)&(tBuffer.TaskParameter),
usSize); usSize);
sRet = tBuffer.sError; sRet = tBuffer.sError;
} }
} }
...@@ -1036,25 +1216,35 @@ short DevGetTaskParameter(unsigned short usDevNumber, unsigned short usNumber, ...@@ -1036,25 +1216,35 @@ short DevGetTaskParameter(unsigned short usDevNumber, unsigned short usNumber,
<En> */ <En> */
short DevReadWriteDPMData(unsigned short usDevNumber, unsigned short usMode, short DevReadWriteDPMData(unsigned short usDevNumber, unsigned short usMode,
unsigned short usOffset, unsigned short usSize, void* pvData) unsigned short usOffset, unsigned short usSize,
void* pvData)
{ {
DEVIO_RWDPMDATACMD tBuffer; DEVIO_RWDPMDATACMD tBuffer;
unsigned int lBytesReturned; unsigned int lBytesReturned;
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
// valid handle available, driver is open // valid handle available, driver is open
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else if (usDevNumber >= MAX_DEV_BOARDS) { }
else if (usDevNumber >= MAX_DEV_BOARDS)
{
sRet = DRV_USR_DEV_NUMBER_INVALID; sRet = DRV_USR_DEV_NUMBER_INVALID;
} else if ((usMode != PARAMETER_READ) && (usMode != PARAMETER_WRITE)) { }
else if ((usMode != PARAMETER_READ) && (usMode != PARAMETER_WRITE))
{
sRet = DRV_USR_MODE_INVALID; sRet = DRV_USR_MODE_INVALID;
} else if ((usSize != 0) }
&& ((usSize + usOffset) else if ((usSize != 0) &&
> (unsigned short)(tDevDPMSize[usDevNumber].ulDpmSize * 1024))) { ((usSize + usOffset) >
(unsigned short)(tDevDPMSize[usDevNumber].ulDpmSize * 1024)))
{
sRet = DRV_USR_SIZE_TOO_LONG; sRet = DRV_USR_SIZE_TOO_LONG;
; ;
} else { }
else
{
// fill in parameter data // fill in parameter data
lBytesReturned = 0; lBytesReturned = 0;
tBuffer.usBoard = usDevNumber; tBuffer.usBoard = usDevNumber;
...@@ -1065,10 +1255,12 @@ short DevReadWriteDPMData(unsigned short usDevNumber, unsigned short usMode, ...@@ -1065,10 +1255,12 @@ short DevReadWriteDPMData(unsigned short usDevNumber, unsigned short usMode,
tBuffer.sError = sRet; tBuffer.sError = sRet;
// activate function // activate function
if (!ioctl(hDevDrv, CIF_IOCTLRWDPMDATA, (unsigned long)(&tBuffer))) { if (!ioctl(hDevDrv, CIF_IOCTLRWDPMDATA, (unsigned long)(&tBuffer)))
{
// fprintf(stderr, "CIF_IOCTLRWDPMDATA: %s\n", strerror(errno)); // fprintf(stderr, "CIF_IOCTLRWDPMDATA: %s\n", strerror(errno));
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
} else }
else
sRet = tBuffer.sError; sRet = tBuffer.sError;
} /* endif */ } /* endif */
return sRet; return sRet;
...@@ -1091,22 +1283,32 @@ short DevReadWriteDPMData(unsigned short usDevNumber, unsigned short usMode, ...@@ -1091,22 +1283,32 @@ short DevReadWriteDPMData(unsigned short usDevNumber, unsigned short usMode,
<En> */ <En> */
short DevReadWriteDPMRaw(unsigned short usDevNumber, unsigned short usMode, short DevReadWriteDPMRaw(unsigned short usDevNumber, unsigned short usMode,
unsigned short usOffset, unsigned short usSize, void* pvData) unsigned short usOffset, unsigned short usSize,
void* pvData)
{ {
DEVIO_RWRAWDATACMD tBuffer; DEVIO_RWRAWDATACMD tBuffer;
unsigned int lBytesReturned; unsigned int lBytesReturned;
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
// valid handle available, driver is open // valid handle available, driver is open
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else if (usDevNumber >= MAX_DEV_BOARDS) { }
else if (usDevNumber >= MAX_DEV_BOARDS)
{
sRet = DRV_USR_DEV_NUMBER_INVALID; sRet = DRV_USR_DEV_NUMBER_INVALID;
} else if ((usSize + usOffset) > sizeof(RAWDATA)) { }
else if ((usSize + usOffset) > sizeof(RAWDATA))
{
sRet = DRV_USR_SIZE_TOO_LONG; sRet = DRV_USR_SIZE_TOO_LONG;
} else if ((usMode != PARAMETER_READ) && (usMode != PARAMETER_WRITE)) { }
else if ((usMode != PARAMETER_READ) && (usMode != PARAMETER_WRITE))
{
sRet = DRV_USR_MODE_INVALID; sRet = DRV_USR_MODE_INVALID;
} else { }
else
{
// fill in parameter data // fill in parameter data
lBytesReturned = 0; lBytesReturned = 0;
tBuffer.usBoard = usDevNumber; tBuffer.usBoard = usDevNumber;
...@@ -1117,10 +1319,12 @@ short DevReadWriteDPMRaw(unsigned short usDevNumber, unsigned short usMode, ...@@ -1117,10 +1319,12 @@ short DevReadWriteDPMRaw(unsigned short usDevNumber, unsigned short usMode,
tBuffer.sError = sRet; tBuffer.sError = sRet;
// activate function // activate function
if (!ioctl(hDevDrv, CIF_IOCTLRWRAW, (unsigned long)(&tBuffer))) { if (!ioctl(hDevDrv, CIF_IOCTLRWRAW, (unsigned long)(&tBuffer)))
{
// fprintf(stderr, "CIF_IOCTLRWRAW: %s\n", strerror(errno)); // fprintf(stderr, "CIF_IOCTLRWRAW: %s\n", strerror(errno));
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
} else }
else
sRet = tBuffer.sError; sRet = tBuffer.sError;
} /* endif */ } /* endif */
return sRet; return sRet;
...@@ -1142,27 +1346,38 @@ short DevReadWriteDPMRaw(unsigned short usDevNumber, unsigned short usMode, ...@@ -1142,27 +1346,38 @@ short DevReadWriteDPMRaw(unsigned short usDevNumber, unsigned short usMode,
<En> */ <En> */
short DevExchangeIO(unsigned short usDevNumber, unsigned short usSendOffset, short DevExchangeIO(unsigned short usDevNumber, unsigned short usSendOffset,
unsigned short usSendSize, void* pvSendData, unsigned short usReceiveOffset, unsigned short usSendSize, void* pvSendData,
unsigned short usReceiveSize, void* pvReceiveData, unsigned long ulTimeout) unsigned short usReceiveOffset,
unsigned short usReceiveSize, void* pvReceiveData,
unsigned long ulTimeout)
{ {
DEVIO_EXIOCMD tBuffer; DEVIO_EXIOCMD tBuffer;
unsigned int lBytesReturned; unsigned int lBytesReturned;
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
int lRet = 0; int lRet = 0;
// valid handle available, driver is open // valid handle available, driver is open
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else if (usDevNumber >= MAX_DEV_BOARDS) { }
else if (usDevNumber >= MAX_DEV_BOARDS)
{
sRet = DRV_USR_DEV_NUMBER_INVALID; sRet = DRV_USR_DEV_NUMBER_INVALID;
} else if ((usSendSize != 0) }
&& ((usSendSize + usSendOffset) else if ((usSendSize != 0) &&
> (unsigned short)tDevDPMSize[usDevNumber].ulDpmIOSize)) { ((usSendSize + usSendOffset) >
(unsigned short)tDevDPMSize[usDevNumber].ulDpmIOSize))
{
sRet = DRV_USR_SENDSIZE_TOO_LONG; sRet = DRV_USR_SENDSIZE_TOO_LONG;
} else if ((usReceiveSize != 0) }
&& ((usReceiveSize + usReceiveOffset) else if ((usReceiveSize != 0) &&
> (unsigned short)tDevDPMSize[usDevNumber].ulDpmIOSize)) { ((usReceiveSize + usReceiveOffset) >
(unsigned short)tDevDPMSize[usDevNumber].ulDpmIOSize))
{
sRet = DRV_USR_RECVSIZE_TOO_LONG; sRet = DRV_USR_RECVSIZE_TOO_LONG;
} else { }
else
{
// fill in parameter data // fill in parameter data
lBytesReturned = 0; lBytesReturned = 0;
// set output buffer // set output buffer
...@@ -1178,10 +1393,12 @@ short DevExchangeIO(unsigned short usDevNumber, unsigned short usSendOffset, ...@@ -1178,10 +1393,12 @@ short DevExchangeIO(unsigned short usDevNumber, unsigned short usSendOffset,
// activate function // activate function
lRet = ioctl(hDevDrv, CIF_IOCTLEXIO, (unsigned long)(&tBuffer)); lRet = ioctl(hDevDrv, CIF_IOCTLEXIO, (unsigned long)(&tBuffer));
if (lRet <= 0) { if (lRet <= 0)
{
// fprintf(stderr, "CIF_IOCTLEXIO: %s\n", strerror(errno)); // fprintf(stderr, "CIF_IOCTLEXIO: %s\n", strerror(errno));
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
} else }
else
sRet = tBuffer.sError; sRet = tBuffer.sError;
} }
return sRet; return sRet;
...@@ -1204,9 +1421,10 @@ short DevExchangeIO(unsigned short usDevNumber, unsigned short usSendOffset, ...@@ -1204,9 +1421,10 @@ short DevExchangeIO(unsigned short usDevNumber, unsigned short usSendOffset,
<En> */ <En> */
short DevExchangeIOEx(unsigned short usDevNumber, unsigned short usMode, short DevExchangeIOEx(unsigned short usDevNumber, unsigned short usMode,
unsigned short usSendOffset, unsigned short usSendSize, void* pvSendData, unsigned short usSendOffset, unsigned short usSendSize,
unsigned short usReceiveOffset, unsigned short usReceiveSize, void* pvSendData, unsigned short usReceiveOffset,
void* pvReceiveData, unsigned long ulTimeout) unsigned short usReceiveSize, void* pvReceiveData,
unsigned long ulTimeout)
{ {
DEVIO_EXIOCMDEX tBuffer; DEVIO_EXIOCMDEX tBuffer;
unsigned int lBytesReturned; unsigned int lBytesReturned;
...@@ -1214,21 +1432,32 @@ short DevExchangeIOEx(unsigned short usDevNumber, unsigned short usMode, ...@@ -1214,21 +1432,32 @@ short DevExchangeIOEx(unsigned short usDevNumber, unsigned short usMode,
int lRet = 0; int lRet = 0;
// valid handle available, driver is open // valid handle available, driver is open
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else if (usDevNumber >= MAX_DEV_BOARDS) { }
else if (usDevNumber >= MAX_DEV_BOARDS)
{
sRet = DRV_USR_DEV_NUMBER_INVALID; sRet = DRV_USR_DEV_NUMBER_INVALID;
} else if ((usSendSize != 0) }
&& ((usSendSize + usSendOffset) else if ((usSendSize != 0) &&
> (unsigned short)tDevDPMSize[usDevNumber].ulDpmIOSize)) { ((usSendSize + usSendOffset) >
(unsigned short)tDevDPMSize[usDevNumber].ulDpmIOSize))
{
sRet = DRV_USR_SENDSIZE_TOO_LONG; sRet = DRV_USR_SENDSIZE_TOO_LONG;
} else if ((usReceiveSize != 0) }
&& ((usReceiveSize + usReceiveOffset) else if ((usReceiveSize != 0) &&
> (unsigned short)tDevDPMSize[usDevNumber].ulDpmIOSize)) { ((usReceiveSize + usReceiveOffset) >
(unsigned short)tDevDPMSize[usDevNumber].ulDpmIOSize))
{
sRet = DRV_USR_RECVSIZE_TOO_LONG; sRet = DRV_USR_RECVSIZE_TOO_LONG;
} else if (usMode > 4) { }
else if (usMode > 4)
{
sRet = DRV_USR_MODE_INVALID; sRet = DRV_USR_MODE_INVALID;
} else { }
else
{
// fill in parameter data // fill in parameter data
lBytesReturned = 0; lBytesReturned = 0;
...@@ -1246,10 +1475,12 @@ short DevExchangeIOEx(unsigned short usDevNumber, unsigned short usMode, ...@@ -1246,10 +1475,12 @@ short DevExchangeIOEx(unsigned short usDevNumber, unsigned short usMode,
// activate function // activate function
lRet = ioctl(hDevDrv, CIF_IOCTLEXIOEX, (unsigned long)(&tBuffer)); lRet = ioctl(hDevDrv, CIF_IOCTLEXIOEX, (unsigned long)(&tBuffer));
if (lRet <= 0) { if (lRet <= 0)
{
// fprintf(stderr, "CIF_IOCTLEXIO: %s\n", strerror(errno)); // fprintf(stderr, "CIF_IOCTLEXIO: %s\n", strerror(errno));
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
} else }
else
sRet = tBuffer.sError; sRet = tBuffer.sError;
} }
return sRet; return sRet;
...@@ -1272,9 +1503,10 @@ short DevExchangeIOEx(unsigned short usDevNumber, unsigned short usMode, ...@@ -1272,9 +1503,10 @@ short DevExchangeIOEx(unsigned short usDevNumber, unsigned short usMode,
<En> */ <En> */
short DevExchangeIOErr(unsigned short usDevNumber, unsigned short usSendOffset, short DevExchangeIOErr(unsigned short usDevNumber, unsigned short usSendOffset,
unsigned short usSendSize, void* pvSendData, unsigned short usReceiveOffset, unsigned short usSendSize, void* pvSendData,
unsigned short usReceiveSize, void* pvReceiveData, COMSTATE* ptState, unsigned short usReceiveOffset,
unsigned long ulTimeout) unsigned short usReceiveSize, void* pvReceiveData,
COMSTATE* ptState, unsigned long ulTimeout)
{ {
DEVIO_EXIOCMDERR tBuffer; DEVIO_EXIOCMDERR tBuffer;
unsigned int lBytesReturned; unsigned int lBytesReturned;
...@@ -1282,19 +1514,28 @@ short DevExchangeIOErr(unsigned short usDevNumber, unsigned short usSendOffset, ...@@ -1282,19 +1514,28 @@ short DevExchangeIOErr(unsigned short usDevNumber, unsigned short usSendOffset,
int lRet = 0; int lRet = 0;
// valid handle available, driver is open // valid handle available, driver is open
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else if (usDevNumber >= MAX_DEV_BOARDS) { }
else if (usDevNumber >= MAX_DEV_BOARDS)
{
sRet = DRV_USR_DEV_NUMBER_INVALID; sRet = DRV_USR_DEV_NUMBER_INVALID;
} else if ((usSendSize != 0) }
&& ((usSendSize + usSendOffset) else if ((usSendSize != 0) &&
> (unsigned short)tDevDPMSize[usDevNumber].ulDpmIOSize)) { ((usSendSize + usSendOffset) >
(unsigned short)tDevDPMSize[usDevNumber].ulDpmIOSize))
{
sRet = DRV_USR_SENDSIZE_TOO_LONG; sRet = DRV_USR_SENDSIZE_TOO_LONG;
} else if ((usReceiveSize != 0) }
&& ((usReceiveSize + usReceiveOffset) else if ((usReceiveSize != 0) &&
> (unsigned short)tDevDPMSize[usDevNumber].ulDpmIOSize)) { ((usReceiveSize + usReceiveOffset) >
(unsigned short)tDevDPMSize[usDevNumber].ulDpmIOSize))
{
sRet = DRV_USR_RECVSIZE_TOO_LONG; sRet = DRV_USR_RECVSIZE_TOO_LONG;
} else { }
else
{
// fill in parameter data // fill in parameter data
lBytesReturned = 0; lBytesReturned = 0;
// set output buffer // set output buffer
...@@ -1311,10 +1552,12 @@ short DevExchangeIOErr(unsigned short usDevNumber, unsigned short usSendOffset, ...@@ -1311,10 +1552,12 @@ short DevExchangeIOErr(unsigned short usDevNumber, unsigned short usSendOffset,
// activate function // activate function
lRet = ioctl(hDevDrv, CIF_IOCTLEXIOERR, (unsigned long)(&tBuffer)); lRet = ioctl(hDevDrv, CIF_IOCTLEXIOERR, (unsigned long)(&tBuffer));
if (lRet <= 0) { if (lRet <= 0)
{
// fprintf(stderr, "CIF_IOCTLEXIO: %s\n", strerror(errno)); // fprintf(stderr, "CIF_IOCTLEXIO: %s\n", strerror(errno));
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
} else }
else
sRet = tBuffer.sError; sRet = tBuffer.sError;
} }
return sRet; return sRet;
...@@ -1334,21 +1577,28 @@ short DevExchangeIOErr(unsigned short usDevNumber, unsigned short usSendOffset, ...@@ -1334,21 +1577,28 @@ short DevExchangeIOErr(unsigned short usDevNumber, unsigned short usSendOffset,
================================================================================= =================================================================================
<En> */ <En> */
short DevSetHostState( short DevSetHostState(unsigned short usDevNumber, unsigned short usMode,
unsigned short usDevNumber, unsigned short usMode, unsigned long ulTimeout) unsigned long ulTimeout)
{ {
DEVIO_TRIGGERCMD tBuffer; DEVIO_TRIGGERCMD tBuffer;
unsigned int lBytesReturned; unsigned int lBytesReturned;
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
// valid handle available, driver is open // valid handle available, driver is open
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else if (usDevNumber >= MAX_DEV_BOARDS) { }
else if (usDevNumber >= MAX_DEV_BOARDS)
{
sRet = DRV_USR_DEV_NUMBER_INVALID; sRet = DRV_USR_DEV_NUMBER_INVALID;
} else if (usMode > HOST_READY) { }
else if (usMode > HOST_READY)
{
sRet = DRV_USR_MODE_INVALID; sRet = DRV_USR_MODE_INVALID;
} else { }
else
{
// fill in parameter data // fill in parameter data
lBytesReturned = 0; lBytesReturned = 0;
...@@ -1358,10 +1608,12 @@ short DevSetHostState( ...@@ -1358,10 +1608,12 @@ short DevSetHostState(
tBuffer.ulTimeout = ulTimeout; tBuffer.ulTimeout = ulTimeout;
tBuffer.sError = sRet; tBuffer.sError = sRet;
// activate function // activate function
if (!ioctl(hDevDrv, CIF_IOCTLSETHOST, (unsigned long)(&tBuffer))) { if (!ioctl(hDevDrv, CIF_IOCTLSETHOST, (unsigned long)(&tBuffer)))
{
// fprintf(stderr, "CIF_IOCTLSETHOST: %s\n", strerror(errno)); // fprintf(stderr, "CIF_IOCTLSETHOST: %s\n", strerror(errno));
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
} else }
else
sRet = tBuffer.sError; sRet = tBuffer.sError;
} }
return sRet; return sRet;
...@@ -1382,19 +1634,24 @@ short DevSetHostState( ...@@ -1382,19 +1634,24 @@ short DevSetHostState(
================================================================================= =================================================================================
<En> */ <En> */
short DevPutMessage( short DevPutMessage(unsigned short usDevNumber, MSG_STRUC* ptMessage,
unsigned short usDevNumber, MSG_STRUC* ptMessage, unsigned long ulTimeout) unsigned long ulTimeout)
{ {
DEVIO_PUTMESSAGECMD tBuffer; DEVIO_PUTMESSAGECMD tBuffer;
unsigned int lBytesReturned; unsigned int lBytesReturned;
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
// valid handle available, driver is open // valid handle available, driver is open
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else if (usDevNumber >= MAX_DEV_BOARDS) { }
else if (usDevNumber >= MAX_DEV_BOARDS)
{
sRet = DRV_USR_DEV_NUMBER_INVALID; sRet = DRV_USR_DEV_NUMBER_INVALID;
} else { }
else
{
// fill in parameter data // fill in parameter data
lBytesReturned = 0; lBytesReturned = 0;
// set output buffer // set output buffer
...@@ -1404,10 +1661,12 @@ short DevPutMessage( ...@@ -1404,10 +1661,12 @@ short DevPutMessage(
tBuffer.sError = sRet; tBuffer.sError = sRet;
// activate function // activate function
if (!ioctl(hDevDrv, CIF_IOCTLPUTMSG, (unsigned long)(&tBuffer))) { if (!ioctl(hDevDrv, CIF_IOCTLPUTMSG, (unsigned long)(&tBuffer)))
{
// fprintf(stderr, "CIF_IOCTLPUTMSG: %s\n", strerror(errno)); // fprintf(stderr, "CIF_IOCTLPUTMSG: %s\n", strerror(errno));
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
} else }
else
sRet = tBuffer.sError; sRet = tBuffer.sError;
} }
return sRet; return sRet;
...@@ -1431,20 +1690,27 @@ short DevPutMessage( ...@@ -1431,20 +1690,27 @@ short DevPutMessage(
<En> */ <En> */
short DevGetMessage(unsigned short usDevNumber, unsigned short usSize, short DevGetMessage(unsigned short usDevNumber, unsigned short usSize,
MSG_STRUC* ptMessage, unsigned long ulTimeout) MSG_STRUC* ptMessage, unsigned long ulTimeout)
{ {
DEVIO_GETMESSAGECMD tBuffer; DEVIO_GETMESSAGECMD tBuffer;
unsigned int lBytesReturned; unsigned int lBytesReturned;
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
// valid handle available, driver is open // valid handle available, driver is open
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else if (usDevNumber >= MAX_DEV_BOARDS) { }
else if (usDevNumber >= MAX_DEV_BOARDS)
{
sRet = DRV_USR_DEV_NUMBER_INVALID; sRet = DRV_USR_DEV_NUMBER_INVALID;
} else if (usSize == 0 || usSize > sizeof(MSG_STRUC)) { }
else if (usSize == 0 || usSize > sizeof(MSG_STRUC))
{
sRet = DRV_USR_SIZE_INVALID; sRet = DRV_USR_SIZE_INVALID;
} else { }
else
{
// fill in parameter data // fill in parameter data
lBytesReturned = 0; lBytesReturned = 0;
// set output buffer // set output buffer
...@@ -1452,10 +1718,13 @@ short DevGetMessage(unsigned short usDevNumber, unsigned short usSize, ...@@ -1452,10 +1718,13 @@ short DevGetMessage(unsigned short usDevNumber, unsigned short usSize,
tBuffer.ulTimeout = ulTimeout; tBuffer.ulTimeout = ulTimeout;
tBuffer.sError = sRet; tBuffer.sError = sRet;
// activate function // activate function
if (!ioctl(hDevDrv, CIF_IOCTLGETMSG, (unsigned long)(&tBuffer))) { if (!ioctl(hDevDrv, CIF_IOCTLGETMSG, (unsigned long)(&tBuffer)))
{
// fprintf(stderr, "CIF_IOCTLGETMSG: %s\n", strerror(errno)); // fprintf(stderr, "CIF_IOCTLGETMSG: %s\n", strerror(errno));
sRet = DRV_USR_COMM_ERR; sRet = DRV_USR_COMM_ERR;
} else { }
else
{
memcpy(ptMessage, &tBuffer.tMsg, sizeof(MSG_STRUC)); memcpy(ptMessage, &tBuffer.tMsg, sizeof(MSG_STRUC));
sRet = tBuffer.sError; sRet = tBuffer.sError;
} }
...@@ -1481,14 +1750,16 @@ short DevGetMessage(unsigned short usDevNumber, unsigned short usSize, ...@@ -1481,14 +1750,16 @@ short DevGetMessage(unsigned short usDevNumber, unsigned short usSize,
#define TO_LAST_MSG 15000L #define TO_LAST_MSG 15000L
// File data structure // File data structure
typedef struct tagFILEDATA { typedef struct tagFILEDATA
{
int fd; int fd;
// struct stat *Info;//struct _stat *Info; // struct stat *Info;//struct _stat *Info;
char* pabBuffer; char* pabBuffer;
int lSize; int lSize;
} FILEDATA; } FILEDATA;
typedef struct tagDEVICE_TYPE_INFO { typedef struct tagDEVICE_TYPE_INFO
{
unsigned char bHerstellerkennung; unsigned char bHerstellerkennung;
unsigned char bDeviceType; unsigned char bDeviceType;
unsigned char bDeviceModel; unsigned char bDeviceModel;
...@@ -1508,8 +1779,10 @@ typedef struct tagDEVICE_TYPE_INFO { ...@@ -1508,8 +1779,10 @@ typedef struct tagDEVICE_TYPE_INFO {
<En> */ <En> */
void closeFile(FILEDATA* ptFile) void closeFile(FILEDATA* ptFile)
{ {
if (ptFile->fd >= 0) { if (ptFile->fd >= 0)
if (ptFile->pabBuffer != NULL) { {
if (ptFile->pabBuffer != NULL)
{
free(ptFile->pabBuffer); free(ptFile->pabBuffer);
} }
close(ptFile->fd); close(ptFile->fd);
...@@ -1539,30 +1812,41 @@ short openFile(const char* fileName, FILEDATA* ptFile) ...@@ -1539,30 +1812,41 @@ short openFile(const char* fileName, FILEDATA* ptFile)
// open the existing file // open the existing file
ptFile->fd = open(fileName, O_RDONLY); ptFile->fd = open(fileName, O_RDONLY);
if (ptFile->fd < 0) { if (ptFile->fd < 0)
{
// File not opend // File not opend
sRet = DRV_USR_FILE_OPEN_FAILED; sRet = DRV_USR_FILE_OPEN_FAILED;
} else { }
else
{
// Get the file size // Get the file size
ptFile->lSize = lseek(ptFile->fd, 0, SEEK_END); ptFile->lSize = lseek(ptFile->fd, 0, SEEK_END);
if (ptFile->lSize <= 0) { if (ptFile->lSize <= 0)
{
// File size is zero // File size is zero
sRet = DRV_USR_FILE_SIZE_ZERO; sRet = DRV_USR_FILE_SIZE_ZERO;
} else { }
else
{
if (lseek(ptFile->fd, 0, SEEK_SET) < 0) if (lseek(ptFile->fd, 0, SEEK_SET) < 0)
sRet = DRV_USR_FILE_READ_FAILED; sRet = DRV_USR_FILE_READ_FAILED;
else { else
{
// Allocate memory for file data // Allocate memory for file data
if ((ptFile->pabBuffer = (char*)malloc(ptFile->lSize)) == NULL) { if ((ptFile->pabBuffer = (char*)malloc(ptFile->lSize)) == NULL)
{
// Error by memory allocation // Error by memory allocation
sRet = DRV_USR_FILE_NO_MEMORY; sRet = DRV_USR_FILE_NO_MEMORY;
closeFile(ptFile); closeFile(ptFile);
} else { }
else
{
// Read file data into memory // Read file data into memory
if ((lNumberOfBytesRead = read(ptFile->fd, // handle of file to read if ((lNumberOfBytesRead = read(
ptFile->fd, // handle of file to read
ptFile->pabBuffer, // address of buffer that receives data ptFile->pabBuffer, // address of buffer that receives data
ptFile->lSize)) ptFile->lSize)) < 0)
< 0) { // number of bytes to read { // number of bytes to read
// File read into memory failed // File read into memory failed
sRet = DRV_USR_FILE_READ_FAILED; sRet = DRV_USR_FILE_READ_FAILED;
closeFile(ptFile); closeFile(ptFile);
...@@ -1586,17 +1870,24 @@ short FreeRecvMailbox(unsigned short usDevNumber) ...@@ -1586,17 +1870,24 @@ short FreeRecvMailbox(unsigned short usDevNumber)
// Read until no msg available // Read until no msg available
usIdx = 0; usIdx = 0;
do { do
if ((sRet = DevGetMBXState(usDevNumber, &usDevState, &usHostState)) {
!= DRV_NO_ERROR) { if ((sRet = DevGetMBXState(usDevNumber, &usDevState, &usHostState)) !=
DRV_NO_ERROR)
{
// Something wrong, end function // Something wrong, end function
break; break;
} else { }
else
{
// Check if message available // Check if message available
if (usHostState == HOST_MBX_FULL) { if (usHostState == HOST_MBX_FULL)
{
// Read message and throw away // Read message and throw away
DevGetMessage(usDevNumber, sizeof(MSG_STRUC), &tRecvMsg, 100L); DevGetMessage(usDevNumber, sizeof(MSG_STRUC), &tRecvMsg, 100L);
} else { }
else
{
break; break;
} }
} }
...@@ -1609,8 +1900,8 @@ short FreeRecvMailbox(unsigned short usDevNumber) ...@@ -1609,8 +1900,8 @@ short FreeRecvMailbox(unsigned short usDevNumber)
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
// Create checksum // Create checksum
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
unsigned short CreateChecksum( unsigned short CreateChecksum(unsigned char* pabData, int lDataLen,
unsigned char* pabData, int lDataLen, MSG_STRUC* ptSendMsg) MSG_STRUC* ptSendMsg)
{ {
int lIdx, lTempLen; int lIdx, lTempLen;
unsigned short usCheckSum, usTemp; unsigned short usCheckSum, usTemp;
...@@ -1623,7 +1914,8 @@ unsigned short CreateChecksum( ...@@ -1623,7 +1914,8 @@ unsigned short CreateChecksum(
pByte = &ptSendMsg->data[3]; pByte = &ptSendMsg->data[3];
// Calculate the Checksum, start with the first message Msg.d[3] up to // Calculate the Checksum, start with the first message Msg.d[3] up to
// Msg.d[64] // Msg.d[64]
for (lIdx = 0; lIdx < 31; lIdx++) { for (lIdx = 0; lIdx < 31; lIdx++)
{
usTemp = (*(pByte + 1)); usTemp = (*(pByte + 1));
usTemp = (unsigned short)((usTemp << 8) | (*pByte)); usTemp = (unsigned short)((usTemp << 8) | (*pByte));
usCheckSum = (unsigned short)(usCheckSum + usTemp); usCheckSum = (unsigned short)(usCheckSum + usTemp);
...@@ -1632,7 +1924,8 @@ unsigned short CreateChecksum( ...@@ -1632,7 +1924,8 @@ unsigned short CreateChecksum(
pByte = &pabData[64]; pByte = &pabData[64];
// Create cheksum for the rest of the file // Create cheksum for the rest of the file
do { do
{
usTemp = (*(pByte + 1)); usTemp = (*(pByte + 1));
usTemp = (unsigned short)((usTemp << 8) | (*pByte)); usTemp = (unsigned short)((usTemp << 8) | (*pByte));
usCheckSum = (unsigned short)(usCheckSum + usTemp); usCheckSum = (unsigned short)(usCheckSum + usTemp);
...@@ -1648,26 +1941,33 @@ unsigned short CreateChecksum( ...@@ -1648,26 +1941,33 @@ unsigned short CreateChecksum(
// Transfer messages // Transfer messages
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
short TransferMessage(unsigned short usDevNumber, MSG_STRUC* ptSendMsg, short TransferMessage(unsigned short usDevNumber, MSG_STRUC* ptSendMsg,
MSG_STRUC* ptRecvMsg, long lTimeout) MSG_STRUC* ptRecvMsg, long lTimeout)
{ {
int lCount = 0; int lCount = 0;
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
if ((sRet = DevPutMessage(usDevNumber, ptSendMsg, TO_SEND_MSG)) if ((sRet = DevPutMessage(usDevNumber, ptSendMsg, TO_SEND_MSG)) ==
== DRV_NO_ERROR) { DRV_NO_ERROR)
do { {
if ((sRet = DevGetMessage( do
usDevNumber, sizeof(MSG_STRUC), ptRecvMsg, lTimeout)) {
== DRV_NO_ERROR) { if ((sRet = DevGetMessage(usDevNumber, sizeof(MSG_STRUC), ptRecvMsg,
lTimeout)) == DRV_NO_ERROR)
{
// Check on message errors // Check on message errors
if ((ptRecvMsg->tx == ptSendMsg->rx) && (ptRecvMsg->rx == ptSendMsg->tx) if ((ptRecvMsg->tx == ptSendMsg->rx) &&
&& (ptRecvMsg->a == ptSendMsg->b) && (ptRecvMsg->b == 0) (ptRecvMsg->rx == ptSendMsg->tx) &&
&& (ptRecvMsg->nr == ptSendMsg->nr)) { (ptRecvMsg->a == ptSendMsg->b) && (ptRecvMsg->b == 0) &&
(ptRecvMsg->nr == ptSendMsg->nr))
{
// Check on message error // Check on message error
if (ptRecvMsg->f != 0) { if (ptRecvMsg->f != 0)
{
sRet = (short)(ptRecvMsg->f + DRV_RCS_ERROR_OFFSET); sRet = (short)(ptRecvMsg->f + DRV_RCS_ERROR_OFFSET);
break; break;
} else { }
else
{
break; break;
} }
} }
...@@ -1692,7 +1992,8 @@ short ReadDeviceInformation(unsigned short usDevNumber, const char* fileName) ...@@ -1692,7 +1992,8 @@ short ReadDeviceInformation(unsigned short usDevNumber, const char* fileName)
memset(&tSendMsg, 0, sizeof(MSG_STRUC)); memset(&tSendMsg, 0, sizeof(MSG_STRUC));
memset(&tRecvMsg, 0, sizeof(MSG_STRUC)); memset(&tRecvMsg, 0, sizeof(MSG_STRUC));
if ((sRet = FreeRecvMailbox(usDevNumber)) == DRV_NO_ERROR) { if ((sRet = FreeRecvMailbox(usDevNumber)) == DRV_NO_ERROR)
{
// Insert data into message // Insert data into message
tSendMsg.rx = RCS_TASK; tSendMsg.rx = RCS_TASK;
tSendMsg.tx = MSG_SYSTEM_TX; tSendMsg.tx = MSG_SYSTEM_TX;
...@@ -1704,14 +2005,17 @@ short ReadDeviceInformation(unsigned short usDevNumber, const char* fileName) ...@@ -1704,14 +2005,17 @@ short ReadDeviceInformation(unsigned short usDevNumber, const char* fileName)
tSendMsg.e = 0; tSendMsg.e = 0;
// Insert data // Insert data
tSendMsg.data[0] = MODE_GET_PROJ_WERTE_HW; tSendMsg.data[0] = MODE_GET_PROJ_WERTE_HW;
if ((sRet = TransferMessage(usDevNumber, &tSendMsg, &tRecvMsg, TO_SEND_MSG)) if ((sRet = TransferMessage(usDevNumber, &tSendMsg, &tRecvMsg,
== DRV_NO_ERROR) { TO_SEND_MSG)) == DRV_NO_ERROR)
{
// Check entry // Check entry
dwStrLen = strlen(fileName); dwStrLen = strlen(fileName);
pInfo = (DEVICE_TYPE_INFO*)&tRecvMsg.data[0]; pInfo = (DEVICE_TYPE_INFO*)&tRecvMsg.data[0];
if ((pInfo->bHerstellerkennung != (char)(toupper(fileName[dwStrLen - 3]))) if ((pInfo->bHerstellerkennung !=
|| (pInfo->bDeviceType != (char)(toupper(fileName[dwStrLen - 2]))) (char)(toupper(fileName[dwStrLen - 3]))) ||
|| (pInfo->bDeviceModel != (char)(toupper(fileName[dwStrLen - 1])))) { (pInfo->bDeviceType != (char)(toupper(fileName[dwStrLen - 2]))) ||
(pInfo->bDeviceModel != (char)(toupper(fileName[dwStrLen - 1]))))
{
sRet = DRV_USR_INVALID_FILETYPE; sRet = DRV_USR_INVALID_FILETYPE;
} }
} }
...@@ -1732,8 +2036,8 @@ short ReadDeviceInformation(unsigned short usDevNumber, const char* fileName) ...@@ -1732,8 +2036,8 @@ short ReadDeviceInformation(unsigned short usDevNumber, const char* fileName)
Return : DRV_NO_ERROR - Download successfully Return : DRV_NO_ERROR - Download successfully
================================================================================= =================================================================================
<En> */ <En> */
short RunFirmwareDownload( short RunFirmwareDownload(unsigned short usDevNumber, FILEDATA* ptFile,
unsigned short usDevNumber, FILEDATA* ptFile, unsigned long* pdwByte) unsigned long* pdwByte)
{ {
int lFileLength, lSendLen, lActIdx; int lFileLength, lSendLen, lActIdx;
unsigned short usCheckSum, usTemp; unsigned short usCheckSum, usTemp;
...@@ -1764,8 +2068,10 @@ short RunFirmwareDownload( ...@@ -1764,8 +2068,10 @@ short RunFirmwareDownload(
dwState = RCS_FIRST_MSK; dwState = RCS_FIRST_MSK;
fRet = TRUE; fRet = TRUE;
// Run download // Run download
do { do
switch (dwState) { {
switch (dwState)
{
//-------------------------- //--------------------------
// Send first message // Send first message
//-------------------------- //--------------------------
...@@ -1799,12 +2105,14 @@ short RunFirmwareDownload( ...@@ -1799,12 +2105,14 @@ short RunFirmwareDownload(
tSendMsg.data[2] = (unsigned char)((usCheckSum >> 8) & 0x00FF); tSendMsg.data[2] = (unsigned char)((usCheckSum >> 8) & 0x00FF);
// Process message // Process message
if ((sRet if ((sRet = TransferMessage(usDevNumber, &tSendMsg, &tRecvMsg,
= TransferMessage(usDevNumber, &tSendMsg, &tRecvMsg, TO_1ST_MSG)) TO_1ST_MSG)) != DRV_NO_ERROR)
!= DRV_NO_ERROR) { {
// Could not process this message // Could not process this message
fRet = FALSE; fRet = FALSE;
} else { }
else
{
// ---------------------------- // ----------------------------
// Message send second message // Message send second message
// ---------------------------- // ----------------------------
...@@ -1826,25 +2134,30 @@ short RunFirmwareDownload( ...@@ -1826,25 +2134,30 @@ short RunFirmwareDownload(
memcpy(&tSendMsg.data[0], &tSendMsg.data[1], 64); memcpy(&tSendMsg.data[0], &tSendMsg.data[1], 64);
// Insert byte 64 to 239 from the abData[64] // Insert byte 64 to 239 from the abData[64]
memcpy( memcpy(&tSendMsg.data[64], &pabData[64],
&tSendMsg.data[64], &pabData[64], (unsigned char)(lSendLen - 64)); (unsigned char)(lSendLen - 64));
// Process message // Process message
if ((sRet = TransferMessage( if ((sRet = TransferMessage(usDevNumber, &tSendMsg, &tRecvMsg,
usDevNumber, &tSendMsg, &tRecvMsg, TO_1ST_MSG)) TO_1ST_MSG)) != DRV_NO_ERROR)
!= DRV_NO_ERROR) { {
// Could not process this message // Could not process this message
fRet = FALSE; fRet = FALSE;
} else { }
else
{
// No error, send next message // No error, send next message
lActIdx += lSendLen; // Add send size to actual index lActIdx += lSendLen; // Add send size to actual index
*pdwByte = lActIdx; *pdwByte = lActIdx;
// Calculate next message length // Calculate next message length
if (lFileLength <= (lSendLen + lActIdx)) { if (lFileLength <= (lSendLen + lActIdx))
{
lSendLen = lFileLength - lActIdx; // Set length to rest of data lSendLen = lFileLength - lActIdx; // Set length to rest of data
dwState = RCS_LAST_MSK; dwState = RCS_LAST_MSK;
} else { }
else
{
dwState = RCS_CONT_MSK; dwState = RCS_CONT_MSK;
} }
} }
...@@ -1862,12 +2175,14 @@ short RunFirmwareDownload( ...@@ -1862,12 +2175,14 @@ short RunFirmwareDownload(
memcpy(&tSendMsg.data[0], &pabData[lActIdx], lSendLen); memcpy(&tSendMsg.data[0], &pabData[lActIdx], lSendLen);
// Process message // Process message
if ((sRet if ((sRet = TransferMessage(usDevNumber, &tSendMsg, &tRecvMsg,
= TransferMessage(usDevNumber, &tSendMsg, &tRecvMsg, TO_CONT_MSG)) TO_CONT_MSG)) != DRV_NO_ERROR)
!= DRV_NO_ERROR) { {
// Could not process this message // Could not process this message
fRet = FALSE; fRet = FALSE;
} else { }
else
{
// printf("(A)===========================flen = %ld, Sndlen = %ld, // printf("(A)===========================flen = %ld, Sndlen = %ld,
// ActIdx = %ld\n", lFileLength, lSendLen, lActIdx); // ActIdx = %ld\n", lFileLength, lSendLen, lActIdx);
// No error, send next message // No error, send next message
...@@ -1875,10 +2190,13 @@ short RunFirmwareDownload( ...@@ -1875,10 +2190,13 @@ short RunFirmwareDownload(
*pdwByte = lActIdx; *pdwByte = lActIdx;
// Calculate next message length // Calculate next message length
if (lFileLength <= (lSendLen + lActIdx)) { if (lFileLength <= (lSendLen + lActIdx))
{
lSendLen = lFileLength - lActIdx; // Set length to rest of data lSendLen = lFileLength - lActIdx; // Set length to rest of data
dwState = RCS_LAST_MSK; dwState = RCS_LAST_MSK;
} else { }
else
{
dwState = RCS_CONT_MSK; dwState = RCS_CONT_MSK;
} }
} }
...@@ -1921,8 +2239,8 @@ short RunFirmwareDownload( ...@@ -1921,8 +2239,8 @@ short RunFirmwareDownload(
Return : DRV_NO_ERROR - Download successfully Return : DRV_NO_ERROR - Download successfully
================================================================================= =================================================================================
<En> */ <En> */
short RunConfigDownload( short RunConfigDownload(unsigned short usDevNumber, FILEDATA* ptFile,
unsigned short usDevNumber, FILEDATA* ptFile, unsigned long* pdwByte) unsigned long* pdwByte)
{ {
unsigned int dwState; unsigned int dwState;
int lSendLen, lActIdx, lOffset, lFileLength; int lSendLen, lActIdx, lOffset, lFileLength;
...@@ -1962,8 +2280,10 @@ short RunConfigDownload( ...@@ -1962,8 +2280,10 @@ short RunConfigDownload(
// Set program state // Set program state
dwState = RCS_FIRST_MSK; dwState = RCS_FIRST_MSK;
fRet = TRUE; fRet = TRUE;
do { do
switch (dwState) { {
switch (dwState)
{
//-------------------------- //--------------------------
// Send first message // Send first message
//-------------------------- //--------------------------
...@@ -1971,14 +2291,14 @@ short RunConfigDownload( ...@@ -1971,14 +2291,14 @@ short RunConfigDownload(
// Set HOST_READY for download, maybe it is disabled // Set HOST_READY for download, maybe it is disabled
sRet = DevSetHostState(usDevNumber, HOST_READY, 0L); sRet = DevSetHostState(usDevNumber, HOST_READY, 0L);
// Insert data into message // Insert data into message
tSendMsg.rx = RCS_TASK; // Receiver task number tSendMsg.rx = RCS_TASK; // Receiver task number
tSendMsg.tx = MSG_SYSTEM_TX; // Transmitter task number tSendMsg.tx = MSG_SYSTEM_TX; // Transmitter task number
tSendMsg.ln = 51; // Message length first message tSendMsg.ln = 51; // Message length first message
tSendMsg.nr = 1; // Message number tSendMsg.nr = 1; // Message number
tSendMsg.a = 0; // Answer byte cleared tSendMsg.a = 0; // Answer byte cleared
tSendMsg.f = 0; // Error byte cleared tSendMsg.f = 0; // Error byte cleared
tSendMsg.b = RCS_B_LOADFKT; // Function code tSendMsg.b = RCS_B_LOADFKT; // Function code
tSendMsg.e = RCS_FIRST_MSK; // First message tSendMsg.e = RCS_FIRST_MSK; // First message
tSendMsg.data[0] = MODE_DOWNLOAD_DBM; // Download a configuration file tSendMsg.data[0] = MODE_DOWNLOAD_DBM; // Download a configuration file
// Copy buffer 1st to message // Copy buffer 1st to message
...@@ -1988,12 +2308,14 @@ short RunConfigDownload( ...@@ -1988,12 +2308,14 @@ short RunConfigDownload(
// printf("cifAPI: %ld\n", dwState); // printf("cifAPI: %ld\n", dwState);
// Process message // Process message
if ((sRet if ((sRet = TransferMessage(usDevNumber, &tSendMsg, &tRecvMsg,
= TransferMessage(usDevNumber, &tSendMsg, &tRecvMsg, TO_1ST_MSG)) TO_1ST_MSG)) != DRV_NO_ERROR)
!= DRV_NO_ERROR) { {
// Could not process this message // Could not process this message
fRet = FALSE; fRet = FALSE;
} else { }
else
{
// Set Index for next message, start at offset 44 // Set Index for next message, start at offset 44
lActIdx = 44; lActIdx = 44;
*pdwByte = lActIdx; *pdwByte = lActIdx;
...@@ -2020,20 +2342,25 @@ short RunConfigDownload( ...@@ -2020,20 +2342,25 @@ short RunConfigDownload(
memcpy(&tSendMsg.data[0], &pabData[lActIdx], lSendLen); memcpy(&tSendMsg.data[0], &pabData[lActIdx], lSendLen);
// Process message // Process message
if ((sRet if ((sRet = TransferMessage(usDevNumber, &tSendMsg, &tRecvMsg,
= TransferMessage(usDevNumber, &tSendMsg, &tRecvMsg, TO_CONT_MSG)) TO_CONT_MSG)) != DRV_NO_ERROR)
!= DRV_NO_ERROR) { {
// Could not process this message // Could not process this message
fRet = FALSE; fRet = FALSE;
} else { }
else
{
// No error, send next message // No error, send next message
lActIdx += lSendLen; // Add send size to actual index lActIdx += lSendLen; // Add send size to actual index
*pdwByte = lActIdx; *pdwByte = lActIdx;
// Calculate next message length // Calculate next message length
if (lFileLength <= (lSendLen + lActIdx)) { if (lFileLength <= (lSendLen + lActIdx))
{
lSendLen = lFileLength - lActIdx; // Set length to rest of data lSendLen = lFileLength - lActIdx; // Set length to rest of data
dwState = RCS_LAST_MSK; // Set to last mask dwState = RCS_LAST_MSK; // Set to last mask
} else { }
else
{
// Continue message // Continue message
dwState = RCS_CONT_MSK; dwState = RCS_CONT_MSK;
} }
...@@ -2082,16 +2409,18 @@ short RunConfigDownload( ...@@ -2082,16 +2409,18 @@ short RunConfigDownload(
Return : DRV_NO_ERROR - Download successfully Return : DRV_NO_ERROR - Download successfully
================================================================================= =================================================================================
<En> */ <En> */
short FirmwareDownload( short FirmwareDownload(unsigned short usDevNumber, const char* fileName,
unsigned short usDevNumber, const char* fileName, unsigned long* pdwByte) unsigned long* pdwByte)
{ {
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
FILEDATA tFileData; FILEDATA tFileData;
// Read Device Information // Read Device Information
if ((sRet = ReadDeviceInformation(usDevNumber, fileName)) == DRV_NO_ERROR) { if ((sRet = ReadDeviceInformation(usDevNumber, fileName)) == DRV_NO_ERROR)
{
// Firmware name is OK // Firmware name is OK
if ((sRet = openFile(fileName, &tFileData)) == DRV_NO_ERROR) { if ((sRet = openFile(fileName, &tFileData)) == DRV_NO_ERROR)
{
// Firmware file opened and loaded into RAM // Firmware file opened and loaded into RAM
sRet = RunFirmwareDownload(usDevNumber, &tFileData, pdwByte); sRet = RunFirmwareDownload(usDevNumber, &tFileData, pdwByte);
closeFile(&tFileData); closeFile(&tFileData);
...@@ -2112,13 +2441,14 @@ short FirmwareDownload( ...@@ -2112,13 +2441,14 @@ short FirmwareDownload(
Return : DRV_NO_ERROR - Download successfully Return : DRV_NO_ERROR - Download successfully
================================================================================= =================================================================================
<En> */ <En> */
short ConfigDownload( short ConfigDownload(unsigned short usDevNumber, const char* fileName,
unsigned short usDevNumber, const char* fileName, unsigned long* pdwByte) unsigned long* pdwByte)
{ {
unsigned short sRet = DRV_NO_ERROR; unsigned short sRet = DRV_NO_ERROR;
FILEDATA tFileData; FILEDATA tFileData;
if ((sRet = openFile(fileName, &tFileData)) == DRV_NO_ERROR) { if ((sRet = openFile(fileName, &tFileData)) == DRV_NO_ERROR)
{
// Configuration file opened and loaded into RAM // Configuration file opened and loaded into RAM
sRet = RunConfigDownload(usDevNumber, &tFileData, pdwByte); sRet = RunConfigDownload(usDevNumber, &tFileData, pdwByte);
closeFile(&tFileData); closeFile(&tFileData);
...@@ -2141,22 +2471,31 @@ short ConfigDownload( ...@@ -2141,22 +2471,31 @@ short ConfigDownload(
<En> */ <En> */
short DevDownload(unsigned short usDevNumber, unsigned short usMode, short DevDownload(unsigned short usDevNumber, unsigned short usMode,
unsigned char* pszFileName, unsigned long* pdwBytes) unsigned char* pszFileName, unsigned long* pdwBytes)
{ {
short sRet = DRV_NO_ERROR; short sRet = DRV_NO_ERROR;
// valid handle available, driver is open // valid handle available, driver is open
if (hDevDrv == INVALID_HANDLE_VALUE) { if (hDevDrv == INVALID_HANDLE_VALUE)
{
sRet = DRV_USR_NOT_INITIALIZED; sRet = DRV_USR_NOT_INITIALIZED;
} else if (usDevNumber >= MAX_DEV_BOARDS) { }
else if (usDevNumber >= MAX_DEV_BOARDS)
{
sRet = DRV_USR_DEV_NUMBER_INVALID; sRet = DRV_USR_DEV_NUMBER_INVALID;
} else if ((pdwBytes == NULL) || (pszFileName == NULL) }
|| (pdwBytes == NULL)) { else if ((pdwBytes == NULL) || (pszFileName == NULL) || (pdwBytes == NULL))
{
sRet = DRV_USR_BUF_PTR_NULL; sRet = DRV_USR_BUF_PTR_NULL;
} else if (strlen((const char*)pszFileName) == 0) { }
else if (strlen((const char*)pszFileName) == 0)
{
sRet = DRV_USR_FILENAME_INVALID; sRet = DRV_USR_FILENAME_INVALID;
} else { }
switch (usMode) { else
{
switch (usMode)
{
case FIRMWARE_DOWNLOAD: case FIRMWARE_DOWNLOAD:
sRet = FirmwareDownload(usDevNumber, (const char*)pszFileName, pdwBytes); sRet = FirmwareDownload(usDevNumber, (const char*)pszFileName, pdwBytes);
break; break;
......
/* /******************************************************************************
* ProviewR Open Source Process Control. * *
* Copyright (C) 2005-2019 SSAB EMEA AB. * SOFTING Industrial Automation GmbH *
* * Richard-Reitzner-Allee 6 *
* This file is part of ProviewR. * D-85540 Haar *
* * Phone: (++49)-(0)89-45656-0 *
* This program is free software; you can redistribute it and/or * Fax: (++49)-(0)89-45656-399 *
* modify it under the terms of the GNU General Public License as * *
* published by the Free Software Foundation, either version 2 of * Copyright (C) SOFTING Industrial Automation GmbH 1995-2012 *
* the License, or (at your option) any later version. * All Rights Reserved *
* * *
* This program is distributed in the hope that it will be useful *******************************************************************************
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************
* *
* SOFTING AG *
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone: ++49-89-4 56 56-0 *
* Fax: ++49-89-4 56 56-3 99 *
* *
* Copyright (C) SOFTING AG 1995-2003 *
* All Rights Reserved *
* *
******************************************************************************
FILE_NAME DPGDL.C FILE_NAME DPGDL.C
PROJECT_NAME PROFIBUS PROJECT_NAME PROFIBUS
...@@ -54,11 +20,11 @@ MODULE DPGDL ...@@ -54,11 +20,11 @@ MODULE DPGDL
COMPONENT_LIBRARY PAPI Lib COMPONENT_LIBRARY PAPI Lib
PAPI DLL PAPI DLL
AUTHOR SOFTING AG AUTHOR SOFTING
VERSION 5.22.0.00.release VERSION 5.45.0.00.release
DATE 26-February-1999 DATE Dezember-2009
STATUS finished STATUS finished
...@@ -103,7 +69,9 @@ LOCAL_DATA ...@@ -103,7 +69,9 @@ LOCAL_DATA
#endif #endif
FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service, FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service,
IN USIGN8 primitive, IN USIGN8 FAR* data_ptr, OUT INT16 FAR* data_len_ptr) IN USIGN8 primitive,
IN USIGN8 FAR* data_ptr,
OUT INT16 FAR* data_len_ptr)
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/* FUNCTIONAL_DESCRIPTION */ /* FUNCTIONAL_DESCRIPTION */
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
...@@ -116,11 +84,14 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service, ...@@ -116,11 +84,14 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service,
FUNCTION_BODY FUNCTION_BODY
switch (primitive) { switch (primitive)
{
/*--- USER REQUESTS ----------------------------------------------------*/ /*--- USER REQUESTS ----------------------------------------------------*/
case REQ: { case REQ:
switch (service) { {
switch (service)
{
case DP_DATA_TRANSFER: case DP_DATA_TRANSFER:
*data_len_ptr = 0; *data_len_ptr = 0;
break; break;
...@@ -144,15 +115,16 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service, ...@@ -144,15 +115,16 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service,
break; break;
case DP_DOWNLOAD_LOC: case DP_DOWNLOAD_LOC:
case DP_DOWNLOAD: { case DP_DOWNLOAD:
if (((T_DP_DOWNLOAD_REQ FAR*)(data_ptr))->data_len {
> DP_MAX_DOWNLOAD_DATA_LEN) { if (((T_DP_DOWNLOAD_REQ FAR*)(data_ptr))->data_len >
result = E_IF_INVALID_DATA_SIZE; DP_MAX_DOWNLOAD_DATA_LEN)
{
return (E_IF_INVALID_DATA_SIZE); return (E_IF_INVALID_DATA_SIZE);
} }
*data_len_ptr = sizeof(T_DP_DOWNLOAD_REQ) *data_len_ptr = sizeof(T_DP_DOWNLOAD_REQ) +
+ ((T_DP_DOWNLOAD_REQ FAR*)(data_ptr))->data_len; ((T_DP_DOWNLOAD_REQ FAR*)(data_ptr))->data_len;
break; break;
} }
...@@ -171,31 +143,33 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service, ...@@ -171,31 +143,33 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service,
break; break;
case DP_SET_PRM: case DP_SET_PRM:
case DP_SET_PRM_LOC: { case DP_SET_PRM_LOC:
{
service_data_len = swap_16_intel_motorola( service_data_len = swap_16_intel_motorola(
((T_DP_SET_PRM_REQ FAR*)(data_ptr))->prm_data.prm_data_len); ((T_DP_SET_PRM_REQ FAR*)(data_ptr))->prm_data.prm_data_len);
if (service_data_len > DP_MAX_PRM_DATA_LEN) { if (service_data_len > DP_MAX_PRM_DATA_LEN)
result = E_IF_INVALID_DATA_SIZE; {
return (E_IF_INVALID_DATA_SIZE); return (E_IF_INVALID_DATA_SIZE);
} }
*data_len_ptr *data_len_ptr =
= sizeof(T_DP_SET_PRM_REQ) - sizeof(T_DP_PRM_DATA) + service_data_len; sizeof(T_DP_SET_PRM_REQ) - sizeof(T_DP_PRM_DATA) + service_data_len;
break; break;
} }
case DP_CHK_CFG: { case DP_CHK_CFG:
{
service_data_len = swap_16_intel_motorola( service_data_len = swap_16_intel_motorola(
((T_DP_CHK_CFG_REQ FAR*)(data_ptr))->cfg_data.cfg_data_len); ((T_DP_CHK_CFG_REQ FAR*)(data_ptr))->cfg_data.cfg_data_len);
if (service_data_len > DP_MAX_CFG_DATA_LEN) { if (service_data_len > DP_MAX_CFG_DATA_LEN)
result = E_IF_INVALID_DATA_SIZE; {
return (E_IF_INVALID_DATA_SIZE); return (E_IF_INVALID_DATA_SIZE);
} }
*data_len_ptr *data_len_ptr =
= sizeof(T_DP_CHK_CFG_REQ) - sizeof(T_DP_CFG_DATA) + service_data_len; sizeof(T_DP_CHK_CFG_REQ) - sizeof(T_DP_CFG_DATA) + service_data_len;
break; break;
} }
...@@ -212,27 +186,30 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service, ...@@ -212,27 +186,30 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service,
*data_len_ptr = sizeof(T_DP_RD_OUTP_REQ); *data_len_ptr = sizeof(T_DP_RD_OUTP_REQ);
break; break;
case DP_DATA_EXCHANGE: { case DP_DATA_EXCHANGE:
if (((T_DP_DATA_EXCHANGE_REQ FAR*)(data_ptr))->outp_data_len {
> DP_MAX_OUTPUT_DATA_LEN) { if (((T_DP_DATA_EXCHANGE_REQ FAR*)(data_ptr))->outp_data_len >
result = E_IF_INVALID_DATA_SIZE; DP_MAX_OUTPUT_DATA_LEN)
{
return (E_IF_INVALID_DATA_SIZE); return (E_IF_INVALID_DATA_SIZE);
} }
*data_len_ptr = sizeof(T_DP_DATA_EXCHANGE_REQ) *data_len_ptr = sizeof(T_DP_DATA_EXCHANGE_REQ) +
+ ((T_DP_DATA_EXCHANGE_REQ FAR*)(data_ptr))->outp_data_len; ((T_DP_DATA_EXCHANGE_REQ FAR*)(data_ptr))->outp_data_len;
break; break;
} }
case DP_SET_SLAVE_ADD: { case DP_SET_SLAVE_ADD:
if (((T_DP_SET_SLAVE_ADD_REQ FAR*)(data_ptr))->rem_slave_data_len {
> DP_MAX_REM_SLAVE_DATA_LEN) { if (((T_DP_SET_SLAVE_ADD_REQ FAR*)(data_ptr))->rem_slave_data_len >
result = E_IF_INVALID_DATA_SIZE; DP_MAX_REM_SLAVE_DATA_LEN)
{
return (E_IF_INVALID_DATA_SIZE); return (E_IF_INVALID_DATA_SIZE);
} }
*data_len_ptr = sizeof(T_DP_SET_SLAVE_ADD_REQ) *data_len_ptr =
+ ((T_DP_SET_SLAVE_ADD_REQ FAR*)(data_ptr))->rem_slave_data_len; sizeof(T_DP_SET_SLAVE_ADD_REQ) +
((T_DP_SET_SLAVE_ADD_REQ FAR*)(data_ptr))->rem_slave_data_len;
break; break;
} }
...@@ -249,37 +226,41 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service, ...@@ -249,37 +226,41 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service,
*data_len_ptr = 0; *data_len_ptr = 0;
break; break;
case DP_SET_BUSPARAMETER: { case DP_SET_BUSPARAMETER:
if ((((T_DP_SET_BUSPARAMETER_REQ FAR*)(data_ptr))->master_user_data_len {
> DP_MAX_SET_BUSPARAMETER_LEN) if ((((T_DP_SET_BUSPARAMETER_REQ FAR*)(data_ptr))->master_user_data_len >
|| (((T_DP_SET_BUSPARAMETER_REQ FAR*)(data_ptr))->master_user_data_len DP_MAX_SET_BUSPARAMETER_LEN) ||
< DP_MASTER_USER_DATA_LEN)) { (((T_DP_SET_BUSPARAMETER_REQ FAR*)(data_ptr))->master_user_data_len <
result = E_IF_INVALID_DATA_SIZE; DP_MASTER_USER_DATA_LEN))
{
return (E_IF_INVALID_DATA_SIZE); return (E_IF_INVALID_DATA_SIZE);
} }
*data_len_ptr = sizeof(T_DP_SET_BUSPARAMETER_REQ) *data_len_ptr =
+ ((T_DP_SET_BUSPARAMETER_REQ FAR*)(data_ptr))->master_user_data_len sizeof(T_DP_SET_BUSPARAMETER_REQ) +
- DP_MASTER_USER_DATA_LEN; ((T_DP_SET_BUSPARAMETER_REQ FAR*)(data_ptr))->master_user_data_len -
DP_MASTER_USER_DATA_LEN;
break; break;
} }
case DP_SET_MASTER_PARAM: { case DP_SET_MASTER_PARAM:
if (((T_DP_SET_MASTER_PARAM_REQ FAR*)(data_ptr))->data_len {
> DP_MAX_TELEGRAM_LEN) { if (((T_DP_SET_MASTER_PARAM_REQ FAR*)(data_ptr))->data_len >
result = E_IF_INVALID_DATA_SIZE; DP_MAX_TELEGRAM_LEN)
{
return (E_IF_INVALID_DATA_SIZE); return (E_IF_INVALID_DATA_SIZE);
} }
*data_len_ptr = sizeof(T_DP_SET_MASTER_PARAM_REQ) *data_len_ptr = sizeof(T_DP_SET_MASTER_PARAM_REQ) +
+ ((T_DP_SET_MASTER_PARAM_REQ FAR*)(data_ptr))->data_len; ((T_DP_SET_MASTER_PARAM_REQ FAR*)(data_ptr))->data_len;
break; break;
} }
case DP_INITIATE: case DP_INITIATE:
*data_len_ptr = sizeof(T_DP_INITIATE_REQ) *data_len_ptr =
+ ((T_DP_INITIATE_REQ FAR*)(data_ptr))->add_addr_param.s_len sizeof(T_DP_INITIATE_REQ) +
+ ((T_DP_INITIATE_REQ FAR*)(data_ptr))->add_addr_param.d_len; ((T_DP_INITIATE_REQ FAR*)(data_ptr))->add_addr_param.s_len +
((T_DP_INITIATE_REQ FAR*)(data_ptr))->add_addr_param.d_len;
break; break;
case DP_ABORT: case DP_ABORT:
...@@ -291,17 +272,16 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service, ...@@ -291,17 +272,16 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service,
break; break;
case DP_WRITE: case DP_WRITE:
*data_len_ptr *data_len_ptr =
= sizeof(T_DP_WRITE_REQ) + ((T_DP_WRITE_REQ FAR*)(data_ptr))->length; sizeof(T_DP_WRITE_REQ) + ((T_DP_WRITE_REQ FAR*)(data_ptr))->length;
break; break;
case DP_DATA_TRANSPORT: case DP_DATA_TRANSPORT:
*data_len_ptr = sizeof(T_DP_DATA_TRANSPORT_REQ) *data_len_ptr = sizeof(T_DP_DATA_TRANSPORT_REQ) +
+ ((T_DP_DATA_TRANSPORT_REQ FAR*)(data_ptr))->length; ((T_DP_DATA_TRANSPORT_REQ FAR*)(data_ptr))->length;
break; break;
default: default:
result = E_IF_INVALID_SERVICE;
return (E_IF_INVALID_SERVICE); return (E_IF_INVALID_SERVICE);
} /* switch serivce */ } /* switch serivce */
...@@ -310,8 +290,10 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service, ...@@ -310,8 +290,10 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service,
/*---- USER RESPONSES --------------------------------------------------*/ /*---- USER RESPONSES --------------------------------------------------*/
case RES: { case RES:
switch (service) { {
switch (service)
{
case DP_ACT_PARAM: case DP_ACT_PARAM:
*data_len_ptr = sizeof(T_DP_ACT_PARAM_RES_CON); *data_len_ptr = sizeof(T_DP_ACT_PARAM_RES_CON);
break; break;
...@@ -325,32 +307,33 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service, ...@@ -325,32 +307,33 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service,
*data_len_ptr = sizeof(T_DP_END_SEQ_RES_CON); *data_len_ptr = sizeof(T_DP_END_SEQ_RES_CON);
break; break;
case DP_UPLOAD: { case DP_UPLOAD:
if (((T_DP_UPLOAD_RES_CON FAR*)(data_ptr))->data_len {
> DP_MAX_UPLOAD_DATA_LEN) { if (((T_DP_UPLOAD_RES_CON FAR*)(data_ptr))->data_len >
result = E_IF_INVALID_DATA_SIZE; DP_MAX_UPLOAD_DATA_LEN)
{
return (E_IF_INVALID_DATA_SIZE); return (E_IF_INVALID_DATA_SIZE);
} }
*data_len_ptr = sizeof(T_DP_UPLOAD_RES_CON) *data_len_ptr = sizeof(T_DP_UPLOAD_RES_CON) +
+ ((T_DP_UPLOAD_RES_CON FAR*)(data_ptr))->data_len; ((T_DP_UPLOAD_RES_CON FAR*)(data_ptr))->data_len;
break; break;
} }
case DP_GET_MASTER_DIAG: { case DP_GET_MASTER_DIAG:
if (((T_DP_GET_MASTER_DIAG_RES_CON FAR*)(data_ptr))->data_len {
> DP_MAX_TELEGRAM_LEN) { if (((T_DP_GET_MASTER_DIAG_RES_CON FAR*)(data_ptr))->data_len >
result = E_IF_INVALID_DATA_SIZE; DP_MAX_TELEGRAM_LEN)
{
return (E_IF_INVALID_DATA_SIZE); return (E_IF_INVALID_DATA_SIZE);
} }
*data_len_ptr = sizeof(T_DP_GET_MASTER_DIAG_RES_CON) *data_len_ptr = sizeof(T_DP_GET_MASTER_DIAG_RES_CON) +
+ ((T_DP_GET_MASTER_DIAG_RES_CON FAR*)(data_ptr))->data_len; ((T_DP_GET_MASTER_DIAG_RES_CON FAR*)(data_ptr))->data_len;
break; break;
} }
default: default:
result = E_IF_INVALID_SERVICE;
return (E_IF_INVALID_SERVICE); return (E_IF_INVALID_SERVICE);
} /* switch serivce */ } /* switch serivce */
...@@ -360,12 +343,9 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service, ...@@ -360,12 +343,9 @@ FUNCTION PUBLIC INT16 dpgdl_get_data_len(IN INT16 result, IN USIGN8 service,
/*---- WRONG PRIMITIVE -------------------------------------------------*/ /*---- WRONG PRIMITIVE -------------------------------------------------*/
default: default:
result = E_IF_INVALID_PRIMITIVE;
return (E_IF_INVALID_PRIMITIVE); return (E_IF_INVALID_PRIMITIVE);
} /* switch primitive */ } /* switch primitive */
result = E_OK;
return (E_OK); return (E_OK);
} /* dp_get_data_len */ } /* dp_get_data_len */
......
...@@ -214,8 +214,8 @@ typedef struct DPM_SL_PRM_HEADERtag ...@@ -214,8 +214,8 @@ typedef struct DPM_SL_PRM_HEADERtag
typedef struct DPV0_PRMtag typedef struct DPV0_PRMtag
{ {
unsigned char abUsr_Prm_Data unsigned char abUsr_Prm_Data[MAX_USR_PRM_LEN]; /* user parameter data without
[MAX_USR_PRM_LEN]; /* user parameter data without DPV1-bytes */ DPV1-bytes */
} GNUC_PACKED DPV0_PRM; } GNUC_PACKED DPV0_PRM;
typedef struct DPV1_USR_PRMtag typedef struct DPV1_USR_PRMtag
......
/* /******************************************************************************
* ProviewR Open Source Process Control. * *
* Copyright (C) 2005-2019 SSAB EMEA AB. * SOFTING Industrial Automation GmbH *
* * Richard-Reitzner-Allee 6 *
* This file is part of ProviewR. * D-85540 Haar *
* * Phone: (++49)-(0)89-45656-0 *
* This program is free software; you can redistribute it and/or * Fax: (++49)-(0)89-45656-399 *
* modify it under the terms of the GNU General Public License as * *
* published by the Free Software Foundation, either version 2 of * Copyright (C) SOFTING Industrial Automation GmbH 1995-2012 *
* the License, or (at your option) any later version. * All Rights Reserved *
* * *
* This program is distributed in the hope that it will be useful *******************************************************************************
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************
* *
* SOFTING AG *
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone: ++49-89-4 56 56-0 *
* Fax: ++49-89-4 56 56-3 99 *
* *
* Copyright (C) SOFTING AG 1998-2003 *
* All Rights Reserved *
* *
******************************************************************************
FILE_NAME DPSGDL.C FILE_NAME DPSGDL.C
...@@ -55,12 +20,12 @@ MODULE DPSGDL ...@@ -55,12 +20,12 @@ MODULE DPSGDL
COMPONENT_LIBRARY PAPI Lib COMPONENT_LIBRARY PAPI Lib
PAPI DLL PAPI DLL
AUTHOR SOFTING AG AUTHOR SOFTING
VERSION 1.20.0.00.release (DP-Slave Stand-Alone for DOS) VERSION 1.30.0.00.release (DP-Slave Stand-Alone for DOS)
5.22.0.00.release (WIN95/WIN98 and WinNT) 5.22.0.00.release (WIN95/WIN98 and WinNT)
DATE 26-February-1999 DATE February-1999
STATUS finished STATUS finished
...@@ -107,7 +72,9 @@ LOCAL_DATA ...@@ -107,7 +72,9 @@ LOCAL_DATA
#pragma check_stack(off) #pragma check_stack(off)
#endif #endif
FUNCTION PUBLIC INT16 dpsgdl_get_data_len(IN INT16 result, IN USIGN8 service, FUNCTION PUBLIC INT16 dpsgdl_get_data_len(IN INT16 result, IN USIGN8 service,
IN USIGN8 primitive, IN USIGN8 FAR* data_ptr, OUT INT16 FAR* data_len_ptr) IN USIGN8 primitive,
IN USIGN8 FAR* data_ptr,
OUT INT16 FAR* data_len_ptr)
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/* FUNCTIONAL_DESCRIPTION */ /* FUNCTIONAL_DESCRIPTION */
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
...@@ -121,29 +88,33 @@ FUNCTION PUBLIC INT16 dpsgdl_get_data_len(IN INT16 result, IN USIGN8 service, ...@@ -121,29 +88,33 @@ FUNCTION PUBLIC INT16 dpsgdl_get_data_len(IN INT16 result, IN USIGN8 service,
FUNCTION_BODY FUNCTION_BODY
switch (primitive) { switch (primitive)
{
/*--- USER REQUESTS ----------------------------------------------------*/ /*--- USER REQUESTS ----------------------------------------------------*/
case REQ: { case REQ:
switch (service) { {
case DPS_INIT_SLAVE: { switch (service)
{
case DPS_INIT_SLAVE:
{
init_slave_req_ptr = (T_DPS_INIT_SLAVE_REQ FAR*)data_ptr; init_slave_req_ptr = (T_DPS_INIT_SLAVE_REQ FAR*)data_ptr;
if ((init_slave_req_ptr->cfg_data_len == 0) if ((init_slave_req_ptr->cfg_data_len == 0) ||
|| (init_slave_req_ptr->cfg_data_len > DP_MAX_CFG_DATA_LEN)) { (init_slave_req_ptr->cfg_data_len > DP_MAX_CFG_DATA_LEN))
result = E_IF_INVALID_DATA_SIZE; {
return (E_IF_INVALID_DATA_SIZE); return (E_IF_INVALID_DATA_SIZE);
} }
if (init_slave_req_ptr->enhanced_init_data_len if (init_slave_req_ptr->enhanced_init_data_len >
> sizeof(init_slave_req_ptr->enhanced_init_data)) { sizeof(init_slave_req_ptr->enhanced_init_data))
result = E_IF_INVALID_DATA_SIZE; {
return (E_IF_INVALID_DATA_SIZE); return (E_IF_INVALID_DATA_SIZE);
} }
*data_len_ptr = sizeof(T_DPS_INIT_SLAVE_REQ) *data_len_ptr = sizeof(T_DPS_INIT_SLAVE_REQ) -
- (sizeof(init_slave_req_ptr->enhanced_init_data) (sizeof(init_slave_req_ptr->enhanced_init_data) -
- init_slave_req_ptr->enhanced_init_data_len); init_slave_req_ptr->enhanced_init_data_len);
break; break;
} /* case DPS_INIT_SLAVE */ } /* case DPS_INIT_SLAVE */
...@@ -151,16 +122,18 @@ FUNCTION PUBLIC INT16 dpsgdl_get_data_len(IN INT16 result, IN USIGN8 service, ...@@ -151,16 +122,18 @@ FUNCTION PUBLIC INT16 dpsgdl_get_data_len(IN INT16 result, IN USIGN8 service,
*data_len_ptr = 0; *data_len_ptr = 0;
break; break;
case DPS_SLAVE_DIAG: { case DPS_SLAVE_DIAG:
{
slave_diag_req_ptr = (T_DPS_SLAVE_DIAG_REQ FAR*)data_ptr; slave_diag_req_ptr = (T_DPS_SLAVE_DIAG_REQ FAR*)data_ptr;
if (slave_diag_req_ptr->ext_diag_data_len > DP_MAX_EXT_DIAG_DATA_LEN) { if (slave_diag_req_ptr->ext_diag_data_len > DP_MAX_EXT_DIAG_DATA_LEN)
result = E_IF_INVALID_DATA_SIZE; {
return (E_IF_INVALID_DATA_SIZE); return (E_IF_INVALID_DATA_SIZE);
} }
*data_len_ptr = sizeof(T_DPS_SLAVE_DIAG_REQ) *data_len_ptr =
- (DP_MAX_EXT_DIAG_DATA_LEN - slave_diag_req_ptr->ext_diag_data_len); sizeof(T_DPS_SLAVE_DIAG_REQ) -
(DP_MAX_EXT_DIAG_DATA_LEN - slave_diag_req_ptr->ext_diag_data_len);
break; break;
} }
...@@ -171,11 +144,9 @@ FUNCTION PUBLIC INT16 dpsgdl_get_data_len(IN INT16 result, IN USIGN8 service, ...@@ -171,11 +144,9 @@ FUNCTION PUBLIC INT16 dpsgdl_get_data_len(IN INT16 result, IN USIGN8 service,
case DPS_CHK_CFG: case DPS_CHK_CFG:
case DPS_SET_PRM: case DPS_SET_PRM:
case DPS_SET_SLAVE_ADD: case DPS_SET_SLAVE_ADD:
result = E_IF_INVALID_PRIMITIVE;
return (E_IF_INVALID_PRIMITIVE); return (E_IF_INVALID_PRIMITIVE);
default: default:
result = E_IF_INVALID_SERVICE;
return (E_IF_INVALID_SERVICE); return (E_IF_INVALID_SERVICE);
} /* switch serivce */ } /* switch serivce */
...@@ -185,8 +156,10 @@ FUNCTION PUBLIC INT16 dpsgdl_get_data_len(IN INT16 result, IN USIGN8 service, ...@@ -185,8 +156,10 @@ FUNCTION PUBLIC INT16 dpsgdl_get_data_len(IN INT16 result, IN USIGN8 service,
/*---- USER RESPONSES --------------------------------------------------*/ /*---- USER RESPONSES --------------------------------------------------*/
case RES: { case RES:
switch (service) { {
switch (service)
{
case DPS_CHK_CFG: case DPS_CHK_CFG:
*data_len_ptr = sizeof(T_DPS_CHK_CFG_RES); *data_len_ptr = sizeof(T_DPS_CHK_CFG_RES);
break; break;
...@@ -195,7 +168,6 @@ FUNCTION PUBLIC INT16 dpsgdl_get_data_len(IN INT16 result, IN USIGN8 service, ...@@ -195,7 +168,6 @@ FUNCTION PUBLIC INT16 dpsgdl_get_data_len(IN INT16 result, IN USIGN8 service,
break; break;
default: default:
result = E_IF_INVALID_SERVICE;
return (E_IF_INVALID_SERVICE); return (E_IF_INVALID_SERVICE);
} /* switch serivce */ } /* switch serivce */
...@@ -206,12 +178,10 @@ FUNCTION PUBLIC INT16 dpsgdl_get_data_len(IN INT16 result, IN USIGN8 service, ...@@ -206,12 +178,10 @@ FUNCTION PUBLIC INT16 dpsgdl_get_data_len(IN INT16 result, IN USIGN8 service,
/*---- WRONG PRIMITIVE -------------------------------------------------*/ /*---- WRONG PRIMITIVE -------------------------------------------------*/
default: default:
result = E_IF_INVALID_PRIMITIVE;
return (E_IF_INVALID_PRIMITIVE); return (E_IF_INVALID_PRIMITIVE);
} /* switch primitive */ } /* switch primitive */
result = E_OK;
return (E_OK); return (E_OK);
} /* dpsgdl_get_data_len */ } /* dpsgdl_get_data_len */
......
/* /******************************************************************************
* ProviewR Open Source Process Control. * *
* Copyright (C) 2005-2019 SSAB EMEA AB. * SOFTING Industrial Automation GmbH *
* * Richard-Reitzner-Allee 6 *
* This file is part of ProviewR. * D-85540 Haar *
* * Phone: (++49)-(0)89-45656-0 *
* This program is free software; you can redistribute it and/or * Fax: (++49)-(0)89-45656-399 *
* modify it under the terms of the GNU General Public License as * *
* published by the Free Software Foundation, either version 2 of * Copyright (C) SOFTING Industrial Automation GmbH 1995-2012 *
* the License, or (at your option) any later version. * All Rights Reserved *
* * *
* This program is distributed in the hope that it will be useful *******************************************************************************
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************
* *
* SOFTING AG *
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone: ++49-89-4 56 56-0 *
* Fax: ++49-89-4 56 56-3 99 *
* *
* Copyright (C) SOFTING AG 1995-2003 *
* All Rights Reserved *
* *
******************************************************************************
FILE_NAME FDLGDL.C FILE_NAME FDLGDL.C
...@@ -55,11 +20,11 @@ MODULE FDLGDL ...@@ -55,11 +20,11 @@ MODULE FDLGDL
COMPONENT_LIBRARY PAPI Lib COMPONENT_LIBRARY PAPI Lib
PAPI DLL PAPI DLL
AUTHOR SOFTING AG AUTHOR SOFTING
VERSION 5.23.0.00.release VERSION 5.23.0.00.release
DATE 30-October-2000 DATE October-2000
STATUS finished STATUS finished
...@@ -105,11 +70,12 @@ LOCAL_DATA ...@@ -105,11 +70,12 @@ LOCAL_DATA
#pragma check_stack(off) #pragma check_stack(off)
#endif #endif
FUNCTION PUBLIC INT16 fdlgdl_get_data_len(IN INT16 result, /* Service-Result */ FUNCTION PUBLIC INT16 fdlgdl_get_data_len(
IN USIGN8 service, /* Service */ IN INT16 result, /* Service-Result */
IN USIGN8 primitive, /* Service-Primitive */ IN USIGN8 service, /* Service */
IN USIGN8 primitive, /* Service-Primitive */
IN USIGN8 FAR* data_ptr, /* pointer to data */ IN USIGN8 FAR* data_ptr, /* pointer to data */
OUT INT16* data_len_ptr /* length of data */ OUT INT16* data_len_ptr /* length of data */
) )
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
...@@ -129,20 +95,26 @@ possible return values: ...@@ -129,20 +95,26 @@ possible return values:
*data_len_ptr = 0; *data_len_ptr = 0;
result = E_OK; result = E_OK;
if (primitive == REQ) { if (primitive == REQ)
switch (service) { {
switch (service)
{
case FDLIF_SDA: case FDLIF_SDA:
case FDLIF_SDN: case FDLIF_SDN:
case FDLIF_SRD: { case FDLIF_SRD:
{
T_FDLIF_SDN_SDA_SRD_REQ FAR* req = (T_FDLIF_SDN_SDA_SRD_REQ FAR*)data_ptr; T_FDLIF_SDN_SDA_SRD_REQ FAR* req = (T_FDLIF_SDN_SDA_SRD_REQ FAR*)data_ptr;
*data_len_ptr = sizeof(T_FDLIF_SDN_SDA_SRD_REQ) + req->length; *data_len_ptr = sizeof(T_FDLIF_SDN_SDA_SRD_REQ) + req->length;
} break; }
break;
case FDLIF_REPLY_UPDATE: case FDLIF_REPLY_UPDATE:
case FDLIF_REPLY_UPDATE_MULTIPLE: { case FDLIF_REPLY_UPDATE_MULTIPLE:
{
T_FDLIF_RUP_REQ FAR* req = (T_FDLIF_RUP_REQ FAR*)data_ptr; T_FDLIF_RUP_REQ FAR* req = (T_FDLIF_RUP_REQ FAR*)data_ptr;
*data_len_ptr = sizeof(T_FDLIF_RUP_REQ) + req->length; *data_len_ptr = sizeof(T_FDLIF_RUP_REQ) + req->length;
} break; }
break;
case FDLIF_SET_BUSPARAMETER: case FDLIF_SET_BUSPARAMETER:
*data_len_ptr = sizeof(T_FDLIF_SET_BUSPARAMETER_REQ); *data_len_ptr = sizeof(T_FDLIF_SET_BUSPARAMETER_REQ);
...@@ -177,7 +149,9 @@ possible return values: ...@@ -177,7 +149,9 @@ possible return values:
result = E_IF_INVALID_SERVICE; result = E_IF_INVALID_SERVICE;
break; break;
} }
} else { }
else
{
result = E_IF_INVALID_PRIMITIVE; result = E_IF_INVALID_PRIMITIVE;
} }
......
/* /******************************************************************************
* ProviewR Open Source Process Control. * *
* Copyright (C) 2005-2019 SSAB EMEA AB. * SOFTING Industrial Automation GmbH *
* * Richard-Reitzner-Allee 6 *
* This file is part of ProviewR. * D-85540 Haar *
* * Phone: (++49)-(0)89-45656-0 *
* This program is free software; you can redistribute it and/or * Fax: (++49)-(0)89-45656-399 *
* modify it under the terms of the GNU General Public License as * *
* published by the Free Software Foundation, either version 2 of * Copyright (C) SOFTING Industrial Automation GmbH 1995-2012 *
* the License, or (at your option) any later version. * All Rights Reserved *
* * *
* This program is distributed in the hope that it will be useful *******************************************************************************
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************
* *
* SOFTING AG *
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone: ++49-89-4 56 56-0 *
* Fax: ++49-89-4 56 56-3 99 *
* *
* Copyright (C) SOFTING AG 1995-2003 *
* All Rights Reserved *
* *
******************************************************************************
FILE_NAME FM7GDL.C FILE_NAME FM7GDL.C
...@@ -55,11 +20,11 @@ MODULE FM7GDL ...@@ -55,11 +20,11 @@ MODULE FM7GDL
COMPONENT_LIBRARY PAPI Lib COMPONENT_LIBRARY PAPI Lib
PAPI DLL PAPI DLL
AUTHOR SOFTING AG AUTHOR SOFTING
VERSION 5.21.0.00.release VERSION 5.21.0.00.release
DATE 27-February-1998 DATE February-1998
STATUS finished STATUS finished
...@@ -111,7 +76,8 @@ LOCAL_DATA ...@@ -111,7 +76,8 @@ LOCAL_DATA
#pragma check_stack(off) #pragma check_stack(off)
#endif #endif
FUNCTION LOCAL INT16 fm7gdl_get_ctxt_data_len(IN USIGN8 service, /* Service */ FUNCTION LOCAL INT16 fm7gdl_get_ctxt_data_len(
IN USIGN8 service, /* Service */
IN USIGN8 primitive /* Service-Primitive */ IN USIGN8 primitive /* Service-Primitive */
) )
...@@ -131,15 +97,19 @@ possible return values: ...@@ -131,15 +97,19 @@ possible return values:
FUNCTION_BODY FUNCTION_BODY
if (service == FM7_ABORT && primitive == REQ) { if (service == FM7_ABORT && primitive == REQ)
{
return (sizeof(T_FM7_ABORT_REQ)); return (sizeof(T_FM7_ABORT_REQ));
} else { }
else
{
return (0); return (0);
} }
} }
FUNCTION LOCAL INT16 fm7gdl_get_crl_data_len(IN USIGN8 service, /* Service */ FUNCTION LOCAL INT16 fm7gdl_get_crl_data_len(
IN USIGN8 primitive, /* Service-Primitive */ IN USIGN8 service, /* Service */
IN USIGN8 primitive, /* Service-Primitive */
IN USIGN8 FAR* data_ptr /* pointer to data */ IN USIGN8 FAR* data_ptr /* pointer to data */
) )
...@@ -169,7 +139,8 @@ possible return values: ...@@ -169,7 +139,8 @@ possible return values:
FUNCTION_BODY FUNCTION_BODY
switch (service) { switch (service)
{
case FM7_LOAD_CRL_LOC: case FM7_LOAD_CRL_LOC:
case FM7_LOAD_CRL_REM: case FM7_LOAD_CRL_REM:
if (primitive == REQ) if (primitive == REQ)
...@@ -179,9 +150,12 @@ possible return values: ...@@ -179,9 +150,12 @@ possible return values:
case FM7_READ_CRL_LOC: case FM7_READ_CRL_LOC:
case FM7_READ_CRL_REM: case FM7_READ_CRL_REM:
if (primitive == REQ) { if (primitive == REQ)
{
return (sizeof(T_READ_CRL_REQ)); return (sizeof(T_READ_CRL_REQ));
} else { }
else
{
T_READ_CRL_CNF FAR* rsp = (T_READ_CRL_CNF FAR*)data_ptr; T_READ_CRL_CNF FAR* rsp = (T_READ_CRL_CNF FAR*)data_ptr;
if (rsp->desired_cr == 0) if (rsp->desired_cr == 0)
...@@ -196,8 +170,8 @@ possible return values: ...@@ -196,8 +170,8 @@ possible return values:
} }
FUNCTION LOCAL INT16 fm7gdl_get_s_r_value_data_len( FUNCTION LOCAL INT16 fm7gdl_get_s_r_value_data_len(
IN USIGN8 service, /* Service */ IN USIGN8 service, /* Service */
IN USIGN8 primitive, /* Service-Primitive */ IN USIGN8 primitive, /* Service-Primitive */
IN USIGN8 FAR* data_ptr /* pointer to data */ IN USIGN8 FAR* data_ptr /* pointer to data */
) )
...@@ -224,13 +198,16 @@ possible return values: ...@@ -224,13 +198,16 @@ possible return values:
FUNCTION_BODY FUNCTION_BODY
switch (service) { switch (service)
{
case FM7_SET_VALUE_LOC: case FM7_SET_VALUE_LOC:
case FM7_SET_VALUE_REM: case FM7_SET_VALUE_REM:
if (primitive == REQ) { if (primitive == REQ)
{
T_SET_VALUE_REQ FAR* req = (T_SET_VALUE_REQ FAR*)data_ptr; T_SET_VALUE_REQ FAR* req = (T_SET_VALUE_REQ FAR*)data_ptr;
return (sizeof(T_SET_VALUE_REQ) + req->length); return (sizeof(T_SET_VALUE_REQ) + req->length);
} else }
else
return (0); return (0);
case FM7_SET_BUSPARAMETER: case FM7_SET_BUSPARAMETER:
...@@ -241,9 +218,12 @@ possible return values: ...@@ -241,9 +218,12 @@ possible return values:
case FM7_READ_VALUE_LOC: case FM7_READ_VALUE_LOC:
case FM7_READ_VALUE_REM: case FM7_READ_VALUE_REM:
if (primitive == REQ) { if (primitive == REQ)
{
return (sizeof(T_READ_VALUE_REQ)); return (sizeof(T_READ_VALUE_REQ));
} else { }
else
{
T_READ_VALUE_CNF FAR* rsp = (T_READ_VALUE_CNF FAR*)data_ptr; T_READ_VALUE_CNF FAR* rsp = (T_READ_VALUE_CNF FAR*)data_ptr;
return (sizeof(T_READ_VALUE_CNF) + rsp->length); return (sizeof(T_READ_VALUE_CNF) + rsp->length);
} }
...@@ -349,7 +329,7 @@ possible return values: ...@@ -349,7 +329,7 @@ possible return values:
} }
FUNCTION LOCAL INT16 fm7gdl_get_error_data_len(IN USIGN8 service /* Service */ FUNCTION LOCAL INT16 fm7gdl_get_error_data_len(IN USIGN8 service /* Service */
) )
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -389,7 +369,8 @@ possible return values: ...@@ -389,7 +369,8 @@ possible return values:
FUNCTION_BODY FUNCTION_BODY
switch (service) { switch (service)
{
case FM7_INITIATE: case FM7_INITIATE:
return (sizeof(T_FM7_INIT_ERR_CNF)); return (sizeof(T_FM7_INIT_ERR_CNF));
...@@ -425,11 +406,12 @@ possible return values: ...@@ -425,11 +406,12 @@ possible return values:
} }
} }
FUNCTION PUBLIC INT16 fm7gdl_get_data_len(IN INT16 result, /* Service-Result */ FUNCTION PUBLIC INT16 fm7gdl_get_data_len(
IN USIGN8 service, /* Service */ IN INT16 result, /* Service-Result */
IN USIGN8 primitive, /* Service-Primitive */ IN USIGN8 service, /* Service */
IN USIGN8 primitive, /* Service-Primitive */
IN USIGN8 FAR* data_ptr, /* pointer to data */ IN USIGN8 FAR* data_ptr, /* pointer to data */
OUT INT16* data_len_ptr /* length of data */ OUT INT16* data_len_ptr /* length of data */
) )
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
...@@ -448,7 +430,8 @@ possible return values: ...@@ -448,7 +430,8 @@ possible return values:
*data_len_ptr = 0; *data_len_ptr = 0;
switch (service) { switch (service)
{
case FM7_READ_CRL_LOC: case FM7_READ_CRL_LOC:
case FM7_INIT_LOAD_CRL_LOC: case FM7_INIT_LOAD_CRL_LOC:
case FM7_LOAD_CRL_LOC: case FM7_LOAD_CRL_LOC:
...@@ -470,8 +453,8 @@ possible return values: ...@@ -470,8 +453,8 @@ possible return values:
case FM7_SET_VALUE_REM: case FM7_SET_VALUE_REM:
case FM7_READ_VALUE_REM: case FM7_READ_VALUE_REM:
if (result == POS) if (result == POS)
*data_len_ptr *data_len_ptr =
= fm7gdl_get_s_r_value_data_len(service, primitive, data_ptr); fm7gdl_get_s_r_value_data_len(service, primitive, data_ptr);
else else
*data_len_ptr = fm7gdl_get_error_data_len(service); *data_len_ptr = fm7gdl_get_error_data_len(service);
break; break;
...@@ -518,6 +501,7 @@ possible return values: ...@@ -518,6 +501,7 @@ possible return values:
default: default:
return (E_IF_INVALID_SERVICE); return (E_IF_INVALID_SERVICE);
break;
} }
return (E_OK); return (E_OK);
......
/* /******************************************************************************
* ProviewR Open Source Process Control. * *
* Copyright (C) 2005-2019 SSAB EMEA AB. * SOFTING Industrial Automation GmbH *
* * Richard-Reitzner-Allee 6 *
* This file is part of ProviewR. * D-85540 Haar *
* * Phone: (++49)-(0)89-45656-0 *
* This program is free software; you can redistribute it and/or * Fax: (++49)-(0)89-45656-399 *
* modify it under the terms of the GNU General Public License as * *
* published by the Free Software Foundation, either version 2 of * Copyright (C) SOFTING Industrial Automation GmbH 1995-2012 *
* the License, or (at your option) any later version. * All Rights Reserved *
* * *
* This program is distributed in the hope that it will be useful *******************************************************************************
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************
* *
* SOFTING AG *
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone: ++49-89-4 56 56-0 *
* Fax: ++49-89-4 56 56-3 99 *
* *
* Copyright (C) SOFTING AG 1995-2003 *
* All Rights Reserved *
* *
******************************************************************************
FILE_NAME FMBGDL.C FILE_NAME FMBGDL.C
...@@ -55,11 +20,11 @@ MODULE FMBGDL ...@@ -55,11 +20,11 @@ MODULE FMBGDL
COMPONENT_LIBRARY PAPI Lib COMPONENT_LIBRARY PAPI Lib
PAPI DLL PAPI DLL
AUTHOR SOFTING AG AUTHOR SOFTING
VERSION 5.21.0.00.release VERSION 5.45.0.00.release
DATE 27-February-1998 DATE October-2009
STATUS finished STATUS finished
...@@ -105,11 +70,12 @@ LOCAL_DATA ...@@ -105,11 +70,12 @@ LOCAL_DATA
#pragma check_stack(off) #pragma check_stack(off)
#endif #endif
FUNCTION PUBLIC INT16 fmbgdl_get_data_len(IN INT16 result, /* Service-Result */ FUNCTION PUBLIC INT16 fmbgdl_get_data_len(
IN USIGN8 service, /* Service */ IN INT16 result, /* Service-Result */
IN USIGN8 primitive, /* Service-Primitive */ IN USIGN8 service, /* Service */
IN USIGN8 primitive, /* Service-Primitive */
IN USIGN8 FAR* data_ptr, /* pointer to data */ IN USIGN8 FAR* data_ptr, /* pointer to data */
OUT INT16* data_len_ptr /* length of data */ OUT INT16* data_len_ptr /* length of data */
) )
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
...@@ -129,24 +95,29 @@ possible return values: ...@@ -129,24 +95,29 @@ possible return values:
FUNCTION_BODY FUNCTION_BODY
if (primitive == REQ) { if (primitive == REQ)
switch (service) { {
case FMB_SET_CONFIGURATION: { switch (service)
T_FMB_SET_CONFIGURATION_REQ FAR* req_ptr {
= (T_FMB_SET_CONFIGURATION_REQ FAR*)data_ptr; case FMB_SET_CONFIGURATION:
{
T_FMB_SET_CONFIGURATION_REQ FAR* req_ptr =
(T_FMB_SET_CONFIGURATION_REQ FAR*)data_ptr;
#ifdef WIN32 #ifdef WIN32
req_ptr->sm7_active &= 0xFE; req_ptr->sm7_active &= 0xFE;
#else #else
req_ptr->sm7_active = PB_FALSE; req_ptr->sm7_active = PB_FALSE;
#endif #endif
*data_len_ptr = sizeof(T_FMB_SET_CONFIGURATION_REQ); *data_len_ptr = sizeof(T_FMB_SET_CONFIGURATION_REQ);
} break; }
break;
case FMB_SET_BUSPARAMETER: case FMB_SET_BUSPARAMETER:
*data_len_ptr = sizeof(T_FMB_SET_BUSPARAMETER_REQ); *data_len_ptr = sizeof(T_FMB_SET_BUSPARAMETER_REQ);
break; break;
case FMB_SET_VALUE: { case FMB_SET_VALUE:
{
T_FMB_SET_VALUE_REQ FAR* req = (T_FMB_SET_VALUE_REQ FAR*)data_ptr; T_FMB_SET_VALUE_REQ FAR* req = (T_FMB_SET_VALUE_REQ FAR*)data_ptr;
*data_len_ptr = (sizeof(T_FMB_SET_VALUE_REQ) + req->length); *data_len_ptr = (sizeof(T_FMB_SET_VALUE_REQ) + req->length);
break; break;
...@@ -160,6 +131,10 @@ possible return values: ...@@ -160,6 +131,10 @@ possible return values:
*data_len_ptr = sizeof(T_FMB_LSAP_STATUS_REQ); *data_len_ptr = sizeof(T_FMB_LSAP_STATUS_REQ);
break; break;
case FMB_VALIDATE_MASTER:
*data_len_ptr = sizeof(T_FMB_VALIDATE_MASTER_REQ);
break;
case FMB_GET_LIVE_LIST: case FMB_GET_LIVE_LIST:
case FMB_READ_BUSPARAMETER: case FMB_READ_BUSPARAMETER:
case FMB_EXIT: case FMB_EXIT:
...@@ -172,7 +147,9 @@ possible return values: ...@@ -172,7 +147,9 @@ possible return values:
ret_val = E_IF_INVALID_SERVICE; ret_val = E_IF_INVALID_SERVICE;
break; break;
} }
} else { }
else
{
ret_val = E_IF_INVALID_PRIMITIVE; ret_val = E_IF_INVALID_PRIMITIVE;
} }
......
/* /******************************************************************************
* ProviewR Open Source Process Control. * *
* Copyright (C) 2005-2019 SSAB EMEA AB. * SOFTING Industrial Automation GmbH *
* * Richard-Reitzner-Allee 6 *
* This file is part of ProviewR. * D-85540 Haar *
* * Phone: (++49)-(0)89-45656-0 *
* This program is free software; you can redistribute it and/or * Fax: (++49)-(0)89-45656-399 *
* modify it under the terms of the GNU General Public License as * *
* published by the Free Software Foundation, either version 2 of * Copyright (C) SOFTING Industrial Automation GmbH 1995-2012 *
* the License, or (at your option) any later version. * All Rights Reserved *
* * *
* This program is distributed in the hope that it will be useful *******************************************************************************
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************
* *
* SOFTING AG *
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone: ++49-89-4 56 56-0 *
* Fax: ++49-89-4 56 56-3 99 *
* *
* Copyright (C) SOFTING AG 1995-2003 *
* All Rights Reserved *
* *
******************************************************************************
FILE_NAME FMSGDL.C FILE_NAME FMSGDL.C
...@@ -55,11 +20,11 @@ MODULE FMSGDL ...@@ -55,11 +20,11 @@ MODULE FMSGDL
COMPONENT_LIBRARY PAPI Lib COMPONENT_LIBRARY PAPI Lib
PAPI DLL PAPI DLL
AUTHOR SOFTING AG AUTHOR SOFTING
VERSION 5.21.0.00.release VERSION 5.21.0.00.release
DATE 27-February-1998 DATE February-1998
STATUS finished STATUS finished
...@@ -105,7 +70,8 @@ LOCAL_DATA ...@@ -105,7 +70,8 @@ LOCAL_DATA
#pragma check_stack(off) #pragma check_stack(off)
#endif #endif
FUNCTION LOCAL INT16 fmsgdl_get_ctxt_data_len(IN USIGN8 service, /* Service */ FUNCTION LOCAL INT16 fmsgdl_get_ctxt_data_len(
IN USIGN8 service, /* Service */
IN USIGN8 primitive /* Service-Primitive */ IN USIGN8 primitive /* Service-Primitive */
) )
...@@ -126,7 +92,8 @@ possible return values: ...@@ -126,7 +92,8 @@ possible return values:
FUNCTION_BODY FUNCTION_BODY
switch (service) { switch (service)
{
case FMS_INITIATE: case FMS_INITIATE:
if (primitive == REQ) if (primitive == REQ)
return (sizeof(T_CTXT_INIT_REQ)); return (sizeof(T_CTXT_INIT_REQ));
...@@ -144,7 +111,8 @@ possible return values: ...@@ -144,7 +111,8 @@ possible return values:
} }
} }
FUNCTION LOCAL INT16 fmsgdl_get_vfd_data_len(IN USIGN8 service, /* Service */ FUNCTION LOCAL INT16 fmsgdl_get_vfd_data_len(
IN USIGN8 service, /* Service */
IN USIGN8 primitive /* Service-Primitive */ IN USIGN8 primitive /* Service-Primitive */
) )
...@@ -168,7 +136,8 @@ possible return values: ...@@ -168,7 +136,8 @@ possible return values:
FUNCTION_BODY FUNCTION_BODY
switch (service) { switch (service)
{
case FMS_STATUS: case FMS_STATUS:
if (primitive == RES) if (primitive == RES)
return (sizeof(T_VFD_STATUS_CNF)); return (sizeof(T_VFD_STATUS_CNF));
...@@ -204,8 +173,9 @@ possible return values: ...@@ -204,8 +173,9 @@ possible return values:
} }
} }
FUNCTION LOCAL INT16 fmsgdl_get_od_data_len(IN USIGN8 service, /* Service */ FUNCTION LOCAL INT16 fmsgdl_get_od_data_len(
IN USIGN8 primitive, /* Service-Primitive */ IN USIGN8 service, /* Service */
IN USIGN8 primitive, /* Service-Primitive */
IN USIGN8 FAR* data_ptr /* pointer to data */ IN USIGN8 FAR* data_ptr /* pointer to data */
) )
...@@ -233,24 +203,32 @@ possible return values: ...@@ -233,24 +203,32 @@ possible return values:
FUNCTION_BODY FUNCTION_BODY
switch (service) { switch (service)
{
case FMS_GET_OD: case FMS_GET_OD:
if (primitive == REQ) { if (primitive == REQ)
{
return (sizeof(T_GET_OD_REQ)); return (sizeof(T_GET_OD_REQ));
} else { }
else
{
T_GET_OD_CNF FAR* rsp = (T_GET_OD_CNF FAR*)data_ptr; T_GET_OD_CNF FAR* rsp = (T_GET_OD_CNF FAR*)data_ptr;
USIGN8 FAR* obj_descr_ptr = (USIGN8 FAR*)(rsp + 1); USIGN8 FAR* obj_descr_ptr = (USIGN8 FAR*)(rsp + 1);
USIGN16 offset = 0; USIGN16 offset = 0;
USIGN16 size = 0; USIGN16 size = 0;
USIGN8 i; USIGN8 i;
if (rsp->no_of_od_descr != 0) { if (rsp->no_of_od_descr != 0)
for (i = 0; i < rsp->no_of_od_descr; i++) { {
for (i = 0; i < rsp->no_of_od_descr; i++)
{
size += (obj_descr_ptr[offset] + 1); size += (obj_descr_ptr[offset] + 1);
offset = size; offset = size;
} }
return (sizeof(T_GET_OD_CNF) + size); return (sizeof(T_GET_OD_CNF) + size);
} else { }
else
{
return (0); return (0);
} }
} }
...@@ -262,19 +240,22 @@ possible return values: ...@@ -262,19 +240,22 @@ possible return values:
return (0); return (0);
case FMS_PUT_OD: case FMS_PUT_OD:
if (primitive == REQ) { if (primitive == REQ)
{
T_PUT_OD_REQ FAR* req = (T_PUT_OD_REQ FAR*)data_ptr; T_PUT_OD_REQ FAR* req = (T_PUT_OD_REQ FAR*)data_ptr;
USIGN8 FAR* obj_descr_ptr = (USIGN8 FAR*)(req + 1); USIGN8 FAR* obj_descr_ptr = (USIGN8 FAR*)(req + 1);
USIGN16 offset = 0; USIGN16 offset = 0;
USIGN16 size = 0; USIGN16 size = 0;
USIGN8 i; USIGN8 i;
for (i = 0; i < req->no_of_od_descr; i++) { for (i = 0; i < req->no_of_od_descr; i++)
{
size += (obj_descr_ptr[offset] + 1); size += (obj_descr_ptr[offset] + 1);
offset = size; offset = size;
} }
return (sizeof(T_PUT_OD_REQ) + size); return (sizeof(T_PUT_OD_REQ) + size);
} else }
else
return (0); return (0);
case FMS_INIT_LOAD_OD_LOC: case FMS_INIT_LOAD_OD_LOC:
...@@ -290,33 +271,37 @@ possible return values: ...@@ -290,33 +271,37 @@ possible return values:
return (0); return (0);
case FMS_LOAD_OD_LOC: case FMS_LOAD_OD_LOC:
if (primitive == REQ) { if (primitive == REQ)
{
T_LOAD_OD_REQ FAR* req = (T_LOAD_OD_REQ FAR*)data_ptr; T_LOAD_OD_REQ FAR* req = (T_LOAD_OD_REQ FAR*)data_ptr;
T_OD_NULL_OBJECT FAR* object T_OD_NULL_OBJECT FAR* object =
= (T_OD_NULL_OBJECT FAR*)&req->obj_descr.id.null_obj_descr; (T_OD_NULL_OBJECT FAR*)&req->obj_descr.id.null_obj_descr;
switch (object->obj_code) { switch (object->obj_code)
{
case TYPE_STRUCT_OBJECT: case TYPE_STRUCT_OBJECT:
return (sizeof(T_LOAD_OD_REQ) return (sizeof(T_LOAD_OD_REQ) +
+ (req->obj_descr.id.ds_obj_descr.no_of_elements (req->obj_descr.id.ds_obj_descr.no_of_elements *
* sizeof(T_OD_DT_LIST))); sizeof(T_OD_DT_LIST)));
case RECORD_OBJECT: case RECORD_OBJECT:
return (sizeof(T_LOAD_OD_REQ) return (sizeof(T_LOAD_OD_REQ) +
+ (req->obj_descr.id.r_var_obj_descr.no_of_address (req->obj_descr.id.r_var_obj_descr.no_of_address *
* sizeof(USIGN32))); sizeof(USIGN32)));
case VAR_LIST_OBJECT: case VAR_LIST_OBJECT:
return (sizeof(T_LOAD_OD_REQ) return (
+ (req->obj_descr.id.vlist_obj_descr.no_of_var * sizeof(USIGN16))); sizeof(T_LOAD_OD_REQ) +
(req->obj_descr.id.vlist_obj_descr.no_of_var * sizeof(USIGN16)));
case INVOCATION_OBJECT: case INVOCATION_OBJECT:
return (sizeof(T_LOAD_OD_REQ) return (sizeof(T_LOAD_OD_REQ) +
+ (req->obj_descr.id.pi_obj_descr.cnt_dom * sizeof(USIGN16))); (req->obj_descr.id.pi_obj_descr.cnt_dom * sizeof(USIGN16)));
default: default:
return (sizeof(T_LOAD_OD_REQ)); return (sizeof(T_LOAD_OD_REQ));
} }
} else }
else
return (0); return (0);
case FMS_OD_READ_LOC: case FMS_OD_READ_LOC:
...@@ -330,8 +315,9 @@ possible return values: ...@@ -330,8 +315,9 @@ possible return values:
} }
} }
FUNCTION LOCAL INT16 fmsgdl_get_var_data_len(IN USIGN8 service, /* Service */ FUNCTION LOCAL INT16 fmsgdl_get_var_data_len(
IN USIGN8 primitive, /* Service-Primitive */ IN USIGN8 service, /* Service */
IN USIGN8 primitive, /* Service-Primitive */
IN USIGN8 FAR* data_ptr /* pointer to data */ IN USIGN8 FAR* data_ptr /* pointer to data */
) )
...@@ -360,89 +346,113 @@ possible return values: ...@@ -360,89 +346,113 @@ possible return values:
FUNCTION_BODY FUNCTION_BODY
switch (service) { switch (service)
{
case FMS_READ: case FMS_READ:
if (primitive == REQ) { if (primitive == REQ)
{
return (sizeof(T_VAR_READ_REQ)); return (sizeof(T_VAR_READ_REQ));
} else { }
else
{
T_VAR_READ_CNF FAR* rsp = (T_VAR_READ_CNF FAR*)data_ptr; T_VAR_READ_CNF FAR* rsp = (T_VAR_READ_CNF FAR*)data_ptr;
return (sizeof(T_VAR_READ_CNF) + rsp->length); return (sizeof(T_VAR_READ_CNF) + rsp->length);
} }
case FMS_READ_WITH_TYPE: case FMS_READ_WITH_TYPE:
if (primitive == REQ) { if (primitive == REQ)
{
return (sizeof(T_VAR_READ_WITH_TYPE_REQ)); return (sizeof(T_VAR_READ_WITH_TYPE_REQ));
} else { }
T_VAR_READ_WITH_TYPE_CNF FAR* rsp else
= (T_VAR_READ_WITH_TYPE_CNF FAR*)data_ptr; {
return (sizeof(T_VAR_READ_WITH_TYPE_CNF) T_VAR_READ_WITH_TYPE_CNF FAR* rsp =
+ (sizeof(T_TYPE_DESCR) * rsp->no_of_type_descr) + rsp->length); (T_VAR_READ_WITH_TYPE_CNF FAR*)data_ptr;
return (sizeof(T_VAR_READ_WITH_TYPE_CNF) +
(sizeof(T_TYPE_DESCR) * rsp->no_of_type_descr) + rsp->length);
} }
case FMS_WRITE: case FMS_WRITE:
if (primitive == REQ) { if (primitive == REQ)
{
T_VAR_WRITE_REQ FAR* req = (T_VAR_WRITE_REQ FAR*)data_ptr; T_VAR_WRITE_REQ FAR* req = (T_VAR_WRITE_REQ FAR*)data_ptr;
return (sizeof(T_VAR_WRITE_REQ) + req->length); return (sizeof(T_VAR_WRITE_REQ) + req->length);
} else }
else
return (0); return (0);
case FMS_WRITE_WITH_TYPE: case FMS_WRITE_WITH_TYPE:
if (primitive == REQ) { if (primitive == REQ)
T_VAR_WRITE_WITH_TYPE_REQ FAR* req {
= (T_VAR_WRITE_WITH_TYPE_REQ FAR*)data_ptr; T_VAR_WRITE_WITH_TYPE_REQ FAR* req =
return (sizeof(T_VAR_WRITE_WITH_TYPE_REQ) (T_VAR_WRITE_WITH_TYPE_REQ FAR*)data_ptr;
+ (sizeof(T_TYPE_DESCR) * req->no_of_type_descr) + req->length); return (sizeof(T_VAR_WRITE_WITH_TYPE_REQ) +
} else (sizeof(T_TYPE_DESCR) * req->no_of_type_descr) + req->length);
}
else
return (0); return (0);
case FMS_INFO_RPT: case FMS_INFO_RPT:
if (primitive == REQ) { if (primitive == REQ)
{
T_VAR_INFO_RPT_REQ FAR* req = (T_VAR_INFO_RPT_REQ FAR*)data_ptr; T_VAR_INFO_RPT_REQ FAR* req = (T_VAR_INFO_RPT_REQ FAR*)data_ptr;
return (sizeof(T_VAR_INFO_RPT_REQ) + req->length); return (sizeof(T_VAR_INFO_RPT_REQ) + req->length);
} else }
else
return (0); return (0);
case FMS_INFO_RPT_WITH_TYPE: case FMS_INFO_RPT_WITH_TYPE:
if (primitive == REQ) { if (primitive == REQ)
T_VAR_INFO_RPT_WITH_TYPE_REQ FAR* req {
= (T_VAR_INFO_RPT_WITH_TYPE_REQ FAR*)data_ptr; T_VAR_INFO_RPT_WITH_TYPE_REQ FAR* req =
return (sizeof(T_VAR_INFO_RPT_WITH_TYPE_REQ) (T_VAR_INFO_RPT_WITH_TYPE_REQ FAR*)data_ptr;
+ (sizeof(T_TYPE_DESCR) * req->no_of_type_descr) + req->length); return (sizeof(T_VAR_INFO_RPT_WITH_TYPE_REQ) +
} else (sizeof(T_TYPE_DESCR) * req->no_of_type_descr) + req->length);
}
else
return (0); return (0);
case FMS_PHYS_READ: case FMS_PHYS_READ:
if (primitive == REQ) { if (primitive == REQ)
{
return (sizeof(T_VAR_PHYS_READ_REQ)); return (sizeof(T_VAR_PHYS_READ_REQ));
} else { }
else
{
T_VAR_PHYS_READ_CNF FAR* rsp = (T_VAR_PHYS_READ_CNF FAR*)data_ptr; T_VAR_PHYS_READ_CNF FAR* rsp = (T_VAR_PHYS_READ_CNF FAR*)data_ptr;
return (sizeof(T_VAR_PHYS_READ_CNF) + rsp->length); return (sizeof(T_VAR_PHYS_READ_CNF) + rsp->length);
} }
case FMS_PHYS_WRITE: case FMS_PHYS_WRITE:
if (primitive == REQ) { if (primitive == REQ)
{
T_VAR_PHYS_WRITE_REQ FAR* req = (T_VAR_PHYS_WRITE_REQ FAR*)data_ptr; T_VAR_PHYS_WRITE_REQ FAR* req = (T_VAR_PHYS_WRITE_REQ FAR*)data_ptr;
return (sizeof(T_VAR_PHYS_WRITE_REQ) + req->length); return (sizeof(T_VAR_PHYS_WRITE_REQ) + req->length);
} else }
else
return (0); return (0);
case FMS_DEF_VAR_LIST: case FMS_DEF_VAR_LIST:
if (primitive == REQ) { if (primitive == REQ)
T_VAR_DEFINE_VAR_LIST_REQ FAR* req {
= (T_VAR_DEFINE_VAR_LIST_REQ FAR*)data_ptr; T_VAR_DEFINE_VAR_LIST_REQ FAR* req =
(T_VAR_DEFINE_VAR_LIST_REQ FAR*)data_ptr;
USIGN8 FAR* d_acc_spec_list = (USIGN8 FAR*)(req + 1); USIGN8 FAR* d_acc_spec_list = (USIGN8 FAR*)(req + 1);
USIGN16 offset = 0; USIGN16 offset = 0;
USIGN16 acc_spec_list_size = 0; USIGN16 acc_spec_list_size = 0;
USIGN8 i = 0; USIGN8 i = 0;
for (i = 0; i < req->no_of_var; i++) { for (i = 0; i < req->no_of_var; i++)
{
offset++; /* offset to length of acc_spec */ offset++; /* offset to length of acc_spec */
acc_spec_list_size += sizeof(T_DYN_ACC_SPEC) + d_acc_spec_list[offset]; acc_spec_list_size += sizeof(T_DYN_ACC_SPEC) + d_acc_spec_list[offset];
offset = acc_spec_list_size; offset = acc_spec_list_size;
} }
return (sizeof(T_VAR_DEFINE_VAR_LIST_REQ) + acc_spec_list_size); return (sizeof(T_VAR_DEFINE_VAR_LIST_REQ) + acc_spec_list_size);
} else { }
else
{
return (sizeof(T_VAR_DEFINE_VAR_LIST_CNF)); return (sizeof(T_VAR_DEFINE_VAR_LIST_CNF));
} }
...@@ -457,8 +467,9 @@ possible return values: ...@@ -457,8 +467,9 @@ possible return values:
} }
} }
FUNCTION LOCAL INT16 fmsgdl_get_evn_data_len(IN USIGN8 service, /* Service */ FUNCTION LOCAL INT16 fmsgdl_get_evn_data_len(
IN USIGN8 primitive, /* Service-Primitive */ IN USIGN8 service, /* Service */
IN USIGN8 primitive, /* Service-Primitive */
IN USIGN8 FAR* data_ptr /* pointer to data */ IN USIGN8 FAR* data_ptr /* pointer to data */
) )
...@@ -481,20 +492,25 @@ possible return values: ...@@ -481,20 +492,25 @@ possible return values:
FUNCTION_BODY FUNCTION_BODY
switch (service) { switch (service)
{
case FMS_EVN_NOTIFY: case FMS_EVN_NOTIFY:
if (primitive == REQ) { if (primitive == REQ)
{
T_EVENT_NOTIFY_REQ FAR* req = (T_EVENT_NOTIFY_REQ FAR*)data_ptr; T_EVENT_NOTIFY_REQ FAR* req = (T_EVENT_NOTIFY_REQ FAR*)data_ptr;
return (sizeof(T_EVENT_NOTIFY_REQ) + req->data_length); return (sizeof(T_EVENT_NOTIFY_REQ) + req->data_length);
} else }
else
return (0); return (0);
case FMS_EVN_NOTIFY_WITH_TYPE: case FMS_EVN_NOTIFY_WITH_TYPE:
if (primitive == REQ) { if (primitive == REQ)
T_EVENT_NOTIFY_WITH_TYPE_REQ FAR* req {
= (T_EVENT_NOTIFY_WITH_TYPE_REQ FAR*)data_ptr; T_EVENT_NOTIFY_WITH_TYPE_REQ FAR* req =
(T_EVENT_NOTIFY_WITH_TYPE_REQ FAR*)data_ptr;
return (sizeof(T_EVENT_NOTIFY_WITH_TYPE_REQ) + req->data_length); return (sizeof(T_EVENT_NOTIFY_WITH_TYPE_REQ) + req->data_length);
} else }
else
return (0); return (0);
case FMS_ALT_EVN_CND_MNT: case FMS_ALT_EVN_CND_MNT:
...@@ -514,8 +530,9 @@ possible return values: ...@@ -514,8 +530,9 @@ possible return values:
} }
} }
FUNCTION LOCAL INT16 fmsgdl_get_dom_data_len(IN USIGN8 service, /* Service */ FUNCTION LOCAL INT16 fmsgdl_get_dom_data_len(
IN USIGN8 primitive, /* Service-Primitive */ IN USIGN8 service, /* Service */
IN USIGN8 primitive, /* Service-Primitive */
IN USIGN8 FAR* data_ptr /* pointer to data */ IN USIGN8 FAR* data_ptr /* pointer to data */
) )
...@@ -548,7 +565,8 @@ possible return values: ...@@ -548,7 +565,8 @@ possible return values:
FUNCTION_BODY FUNCTION_BODY
switch (service) { switch (service)
{
case FMS_INIT_DOWNL_SEQ: case FMS_INIT_DOWNL_SEQ:
case FMS_GEN_INIT_DOWNL_SEQ: case FMS_GEN_INIT_DOWNL_SEQ:
case FMS_INIT_UPL_SEQ: case FMS_INIT_UPL_SEQ:
...@@ -560,9 +578,12 @@ possible return values: ...@@ -560,9 +578,12 @@ possible return values:
case FMS_DOWNL_SEG: case FMS_DOWNL_SEG:
case FMS_UPL_SEG: case FMS_UPL_SEG:
if (primitive == REQ) { if (primitive == REQ)
{
return (sizeof(T_DOM_REQ)); return (sizeof(T_DOM_REQ));
} else { }
else
{
T_DNL_UPL_SEG_CNF FAR* rsp = (T_DNL_UPL_SEG_CNF FAR*)data_ptr; T_DNL_UPL_SEG_CNF FAR* rsp = (T_DNL_UPL_SEG_CNF FAR*)data_ptr;
return (sizeof(T_DNL_UPL_SEG_CNF) + rsp->data_len); return (sizeof(T_DNL_UPL_SEG_CNF) + rsp->data_len);
} }
...@@ -574,10 +595,12 @@ possible return values: ...@@ -574,10 +595,12 @@ possible return values:
return (0); return (0);
case FMS_GEN_DOWNL_SEG: case FMS_GEN_DOWNL_SEG:
if (primitive == REQ) { if (primitive == REQ)
{
T_GEN_DNL_SEG_REQ FAR* req = (T_GEN_DNL_SEG_REQ FAR*)data_ptr; T_GEN_DNL_SEG_REQ FAR* req = (T_GEN_DNL_SEG_REQ FAR*)data_ptr;
return (sizeof(T_GEN_DNL_SEG_REQ) + req->data_len); return (sizeof(T_GEN_DNL_SEG_REQ) + req->data_len);
} else }
else
return (0); return (0);
case FMS_GEN_TERM_DOWNL_SEQ: case FMS_GEN_TERM_DOWNL_SEQ:
...@@ -588,10 +611,12 @@ possible return values: ...@@ -588,10 +611,12 @@ possible return values:
case FMS_REQ_DOM_DOWNL: case FMS_REQ_DOM_DOWNL:
case FMS_REQ_DOM_UPL: case FMS_REQ_DOM_UPL:
if (primitive == REQ) { if (primitive == REQ)
{
T_REQUEST_DOM_REQ FAR* req = (T_REQUEST_DOM_REQ FAR*)data_ptr; T_REQUEST_DOM_REQ FAR* req = (T_REQUEST_DOM_REQ FAR*)data_ptr;
return (sizeof(T_REQUEST_DOM_REQ) + req->add_info_length); return (sizeof(T_REQUEST_DOM_REQ) + req->add_info_length);
} else }
else
return (0); return (0);
default: default:
...@@ -599,8 +624,9 @@ possible return values: ...@@ -599,8 +624,9 @@ possible return values:
} }
} }
FUNCTION LOCAL INT16 fmsgdl_get_pi_data_len(IN USIGN8 service, /* Service */ FUNCTION LOCAL INT16 fmsgdl_get_pi_data_len(
IN USIGN8 primitive, /* Service-Primitive */ IN USIGN8 service, /* Service */
IN USIGN8 primitive, /* Service-Primitive */
IN USIGN8 FAR* data_ptr /* pointer to data */ IN USIGN8 FAR* data_ptr /* pointer to data */
) )
...@@ -627,9 +653,11 @@ possible return values: ...@@ -627,9 +653,11 @@ possible return values:
FUNCTION_BODY FUNCTION_BODY
switch (service) { switch (service)
{
case FMS_PI_CREATE: case FMS_PI_CREATE:
if (primitive == REQ) { if (primitive == REQ)
{
T_PI_CR8_REQ FAR* req = (T_PI_CR8_REQ FAR*)data_ptr; T_PI_CR8_REQ FAR* req = (T_PI_CR8_REQ FAR*)data_ptr;
USIGN8 FAR* d_acc_spec_list = (USIGN8 FAR*)(req + 1); USIGN8 FAR* d_acc_spec_list = (USIGN8 FAR*)(req + 1);
USIGN16 offset = 0; USIGN16 offset = 0;
...@@ -637,13 +665,16 @@ possible return values: ...@@ -637,13 +665,16 @@ possible return values:
USIGN8 i = 0; USIGN8 i = 0;
/* - dynamic access specification list --------------------------*/ /* - dynamic access specification list --------------------------*/
for (i = 0; i < req->cnt_dom; i++) { for (i = 0; i < req->cnt_dom; i++)
{
offset++; /* offset to length of acc_spec */ offset++; /* offset to length of acc_spec */
acc_spec_list_size += sizeof(T_DYN_ACC_SPEC) + d_acc_spec_list[offset]; acc_spec_list_size += sizeof(T_DYN_ACC_SPEC) + d_acc_spec_list[offset];
offset = acc_spec_list_size; offset = acc_spec_list_size;
} }
return (sizeof(T_PI_CR8_REQ) + acc_spec_list_size); return (sizeof(T_PI_CR8_REQ) + acc_spec_list_size);
} else { }
else
{
return (sizeof(T_PI_CR8_CNF)); return (sizeof(T_PI_CR8_CNF));
} }
...@@ -695,7 +726,7 @@ possible return values: ...@@ -695,7 +726,7 @@ possible return values:
} }
FUNCTION LOCAL INT16 fmsgdl_get_error_data_len(IN USIGN8 service /* Service */ FUNCTION LOCAL INT16 fmsgdl_get_error_data_len(IN USIGN8 service /* Service */
) )
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -748,7 +779,8 @@ possible return values: ...@@ -748,7 +779,8 @@ possible return values:
FUNCTION_BODY FUNCTION_BODY
switch (service) { switch (service)
{
case FMS_INITIATE: case FMS_INITIATE:
return (sizeof(T_CTXT_INIT_ERR_CNF)); return (sizeof(T_CTXT_INIT_ERR_CNF));
...@@ -797,11 +829,12 @@ possible return values: ...@@ -797,11 +829,12 @@ possible return values:
} }
} }
FUNCTION PUBLIC INT16 fmsgdl_get_data_len(IN INT16 result, /* Service-Result */ FUNCTION PUBLIC INT16 fmsgdl_get_data_len(
IN USIGN8 service, /* Service */ IN INT16 result, /* Service-Result */
IN USIGN8 primitive, /* Service-Primitive */ IN USIGN8 service, /* Service */
IN USIGN8 primitive, /* Service-Primitive */
IN USIGN8 FAR* data_ptr, /* pointer to data */ IN USIGN8 FAR* data_ptr, /* pointer to data */
OUT INT16* data_len_ptr /* length of data */ OUT INT16* data_len_ptr /* length of data */
) )
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
...@@ -820,7 +853,8 @@ possible return values: ...@@ -820,7 +853,8 @@ possible return values:
*data_len_ptr = 0; *data_len_ptr = 0;
switch (service) { switch (service)
{
case FMS_INITIATE: case FMS_INITIATE:
case FMS_ABORT: case FMS_ABORT:
if (result == POS) if (result == POS)
......
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/ /*****************************************************************************/
/* */ /* */
/* SOFTING AG */ /* SOFTING Industrial Automation GmbH */
/* Richard-Reitzner-Allee 6 */ /* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */ /* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */ /* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */ /* Fax: (++49)-(0)89-45656-399 */
/* */ /* */
/* Copyright (C) SOFTING AG 1995-2003 */ /* Copyright (C) SOFTING Industrial Automation GmbH 1995-2012 */
/* All Rights Reserved */ /* All Rights Reserved */
/* */ /* */
/*****************************************************************************/ /*****************************************************************************/
...@@ -50,8 +15,8 @@ ...@@ -50,8 +15,8 @@
/* */ /* */
/* Filename : KEYWORDS.H */ /* Filename : KEYWORDS.H */
/* Version : 5.21.0.00.release */ /* Version : 5.21.0.00.release */
/* Date : 27-February-1998 */ /* Date : February-1998 */
/* Author : SOFTING AG */ /* Author : SOFTING */
/* */ /* */
/* Description : This include file defines some keywords which are used */ /* Description : This include file defines some keywords which are used */
/* for structuring and formatting the PROFIBUS source files. These */ /* for structuring and formatting the PROFIBUS source files. These */
......
/* /******************************************************************************
* ProviewR Open Source Process Control. * *
* Copyright (C) 2005-2019 SSAB EMEA AB. * SOFTING Industrial Automation GmbH *
* * Richard-Reitzner-Allee 6 *
* This file is part of ProviewR. * D-85540 Haar *
* * Phone: (++49)-(0)89-45656-0 *
* This program is free software; you can redistribute it and/or * Fax: (++49)-(0)89-45656-399 *
* modify it under the terms of the GNU General Public License as * *
* published by the Free Software Foundation, either version 2 of * Copyright (C) SOFTING Industrial Automation GmbH 1995-2012 *
* the License, or (at your option) any later version. * All Rights Reserved *
* * *
* This program is distributed in the hope that it will be useful *******************************************************************************
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************
* *
* SOFTING AG *
* Richard-Reitzner-Allee 6 *
* D-85540 Haar *
* Phone: ++49-89-4 56 56-0 *
* Fax: ++49-89-4 56 56-3 99 *
* *
* Copyright (C) SOFTING AG 1999-2003 *
* All Rights Reserved *
* *
******************************************************************************
FILE_NAME PAPIAUX.C FILE_NAME PAPIAUX.C
...@@ -55,11 +20,11 @@ MODULE PAPIAUX ...@@ -55,11 +20,11 @@ MODULE PAPIAUX
COMPONENT_LIBRARY PAPI Lib COMPONENT_LIBRARY PAPI Lib
PAPI DLL PAPI DLL
AUTHOR SOFTING GmbH AUTHOR SOFTING
VERSION 5.22.0.00.release VERSION 5.22.0.00.release
DATE 26-February-1999 DATE February-1999
STATUS finished STATUS finished
...@@ -109,8 +74,8 @@ LOCAL_DATA ...@@ -109,8 +74,8 @@ LOCAL_DATA
// *************************************************************************** // ***************************************************************************
#if defined(WIN32) || defined(_WIN32) #if defined(WIN32) || defined(_WIN32)
FUNCTION PUBLIC BOOL ReadBoardRegistryEntries( FUNCTION PUBLIC BOOL ReadBoardRegistryEntries(IN USIGN8 BoardNumber,
IN USIGN8 BoardNumber, OUT USIGN32* OperationMode) OUT USIGN32* OperationMode)
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -135,19 +100,22 @@ return value: ...@@ -135,19 +100,22 @@ return value:
FUNCTION_BODY FUNCTION_BODY
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE,
REGPATH_PARAMETER_FROM_HLM, 0, KEY_READ, REGPATH_PARAMETER_FROM_HLM, 0, KEY_READ,
&keyParameters)) { &keyParameters))
{
sprintf(szKeyBoard, "%s\\%d", REGPATH_PARAMETER_FROM_HLM, BoardNumber); sprintf(szKeyBoard, "%s\\%d", REGPATH_PARAMETER_FROM_HLM, BoardNumber);
if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKeyBoard, 0, if (ERROR_SUCCESS ==
KEY_READ, &keyBoard)) { RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKeyBoard, 0, KEY_READ, &keyBoard))
{
SizeofBoardType = sizeof(szBoardType); SizeofBoardType = sizeof(szBoardType);
szBoardType[0] = '\0'; szBoardType[0] = '\0';
if ((RetVal = RegQueryValueEx(keyBoard, "Type", NULL, NULL, if ((RetVal = RegQueryValueEx(keyBoard, "Type", NULL, NULL,
(LPBYTE)szBoardType, &SizeofBoardType)) (LPBYTE)szBoardType, &SizeofBoardType)) ==
== ERROR_SUCCESS) { ERROR_SUCCESS)
{
RetVal |= RegQueryValueEx(keyBoard, "OperationMode", NULL, NULL, RetVal |= RegQueryValueEx(keyBoard, "OperationMode", NULL, NULL,
(LPBYTE)OperationMode, &sizeULONG); (LPBYTE)OperationMode, &sizeULONG);
if (!RetVal) if (!RetVal)
return (TRUE); return (TRUE);
...@@ -183,7 +151,8 @@ FUNCTION PUBLIC int kbhit(VOID) ...@@ -183,7 +151,8 @@ FUNCTION PUBLIC int kbhit(VOID)
timeout.tv_sec = 0L; timeout.tv_sec = 0L;
timeout.tv_usec = 1000L; /* wait 1 ms */ timeout.tv_usec = 1000L; /* wait 1 ms */
if (select(1, &rd_fds, NULL, NULL, &timeout) > 0) { if (select(1, &rd_fds, NULL, NULL, &timeout) > 0)
{
return (1); return (1);
} }
...@@ -219,8 +188,7 @@ return value: ...@@ -219,8 +188,7 @@ return value:
FUNCTION_BODY FUNCTION_BODY
((USIGN8*)&inp16) ((USIGN8*)&inp16)
[0] [0] = ((USIGN8*)&input16)[1];
= ((USIGN8*)&input16)[1];
((USIGN8*)&inp16)[1] = ((USIGN8*)&input16)[0]; ((USIGN8*)&inp16)[1] = ((USIGN8*)&input16)[0];
return (inp16); return (inp16);
...@@ -249,8 +217,7 @@ return value: ...@@ -249,8 +217,7 @@ return value:
FUNCTION_BODY FUNCTION_BODY
((USIGN8*)&inp32) ((USIGN8*)&inp32)
[0] [0] = ((USIGN8*)&input32)[3];
= ((USIGN8*)&input32)[3];
((USIGN8*)&inp32)[1] = ((USIGN8*)&input32)[2]; ((USIGN8*)&inp32)[1] = ((USIGN8*)&input32)[2];
((USIGN8*)&inp32)[2] = ((USIGN8*)&input32)[1]; ((USIGN8*)&inp32)[2] = ((USIGN8*)&input32)[1];
((USIGN8*)&inp32)[3] = ((USIGN8*)&input32)[0]; ((USIGN8*)&inp32)[3] = ((USIGN8*)&input32)[0];
......
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/ /*****************************************************************************/
/* */ /* */
/* SOFTING AG */ /* SOFTING Industrial Automation GmbH */
/* Richard-Reitzner-Allee 6 */ /* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */ /* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */ /* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */ /* Fax: (++49)-(0)89-45656-399 */
/* */ /* */
/* Copyright (C) SOFTING AG 1995-2003 */ /* Copyright (C) SOFTING Industrial Automation GmbH 1995-2012 */
/* All Rights Reserved */ /* All Rights Reserved */
/* */ /* */
/*****************************************************************************/ /*****************************************************************************/
...@@ -49,13 +14,12 @@ ...@@ -49,13 +14,12 @@
/* PROFIBUS CONFIGURATION AND IMPLEMENTATION DEFINITIONS */ /* PROFIBUS CONFIGURATION AND IMPLEMENTATION DEFINITIONS */
/* */ /* */
/* Filename : PB_CONF.H */ /* Filename : PB_CONF.H */
/* Version : 5.26.0.00.release */ /* Version : 5.45.0.00.release */
/* Date : 14-February-2002 */ /* Date : December-2009 */
/* Author : SOFTING AG */ /* Author : SOFTING */
/* */ /* */
/* Description : This file contains the PROFIBUS configuration and */ /* Description : This file contains the PROFIBUS configuration and */
/* implementation definitions using Windows ME/98/95 or */ /* implementation definitions using Linux operating system */
/* Windows XP / 2000 / NT operating system */
/* */ /* */
/*****************************************************************************/ /*****************************************************************************/
...@@ -67,7 +31,7 @@ ...@@ -67,7 +31,7 @@
/*****************************************************************************/ /*****************************************************************************/
#ifndef PB_VER #ifndef PB_VER
#define PB_VER 526 #define PB_VER 545
#endif #endif
/*****************************************************************************/ /*****************************************************************************/
...@@ -99,9 +63,9 @@ ...@@ -99,9 +63,9 @@
#define HUGE #define HUGE
#define CALL_CONV #define CALL_CONV
#define CALLBACK #define CALLBACK
#define INVALID_HANDLE_VALUE ((HANDLE)NULL) #define INVALID_HANDLE_VALUE 0
#define getch() getchar() #define getch() getchar()
typedef long int HANDLE; typedef int HANDLE;
typedef unsigned long DWORD; typedef unsigned long DWORD;
#ifdef PB_API_FUNC_NOT_USED #ifdef PB_API_FUNC_NOT_USED
#undef CALL_CONV #undef CALL_CONV
......
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/ /*****************************************************************************/
/* */ /* */
/* SOFTING AG */ /* SOFTING Industrial Automation GmbH */
/* Richard-Reitzner-Allee 6 */ /* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */ /* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */ /* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */ /* Fax: (++49)-(0)89-45656-399 */
/* */ /* */
/* Copyright (C) SOFTING AG 1995-2003 */ /* Copyright (C) SOFTING Industrial Automation GmbH 1995-2012 */
/* All Rights Reserved */ /* All Rights Reserved */
/* */ /* */
/*****************************************************************************/ /*****************************************************************************/
...@@ -50,8 +15,8 @@ ...@@ -50,8 +15,8 @@
/* */ /* */
/* Filename : PB_DP.H */ /* Filename : PB_DP.H */
/* Version : 5.22.0.00.release */ /* Version : 5.22.0.00.release */
/* Date : 26-February-1999 */ /* Date : February-1999 */
/* Author : SOFTING AG */ /* Author : SOFTING */
/* */ /* */
/* Description : This file contains the global defines and types of */ /* Description : This file contains the global defines and types of */
/* component DP */ /* component DP */
...@@ -608,7 +573,7 @@ typedef struct _T_DP_END_SEQ_IND /* MM: req_add --> function_num */ ...@@ -608,7 +573,7 @@ typedef struct _T_DP_END_SEQ_IND /* MM: req_add --> function_num */
typedef struct _T_DP_END_SEQ_RES_CON typedef struct _T_DP_END_SEQ_RES_CON
{ {
USIGN16 status; /* OK, DS, NA, RS, RR, UE, TO, FE, RE, */ USIGN16 status; /* OK, DS, NA, RS, RR, UE, TO, FE, RE, */
/* NE, AD, IP, NI, SE, SC, EA, LE */ /* NE, AD, IP, NI, SE, SC, EA, LE */
} T_DP_END_SEQ_RES_CON; } T_DP_END_SEQ_RES_CON;
...@@ -649,7 +614,7 @@ typedef struct _T_DP_DOWNLOAD_IND /* MM: req_add --> function_num */ ...@@ -649,7 +614,7 @@ typedef struct _T_DP_DOWNLOAD_IND /* MM: req_add --> function_num */
typedef struct _T_DP_DOWNLOAD_RES_CON typedef struct _T_DP_DOWNLOAD_RES_CON
{ {
USIGN16 status; /* OK, DS, NA, RS, RR, UE, TO, FE, */ USIGN16 status; /* OK, DS, NA, RS, RR, UE, TO, FE, */
/* RE, NE, AD, EA, SC, NI, LE */ /* RE, NE, AD, EA, SC, NI, LE */
} T_DP_DOWNLOAD_RES_CON; } T_DP_DOWNLOAD_RES_CON;
...@@ -681,8 +646,8 @@ typedef struct _T_DP_UPLOAD_IND /* MM: req_add --> function_num */ ...@@ -681,8 +646,8 @@ typedef struct _T_DP_UPLOAD_IND /* MM: req_add --> function_num */
typedef struct _T_DP_UPLOAD_RES_CON typedef struct _T_DP_UPLOAD_RES_CON
{ {
USIGN16 status; /* OK, DS, NA, RS, RR, UE, TO, FE, */ USIGN16 status; /* OK, DS, NA, RS, RR, UE, TO, FE, */
/* RE, NE, AD, EA, SC, NI, LE */ /* RE, NE, AD, EA, SC, NI, LE */
USIGN16 data_len; /* 1..DP_MAX_UPLOAD_DATA_LEN */ USIGN16 data_len; /* 1..DP_MAX_UPLOAD_DATA_LEN */
/* OCTET data [data_len]; upload data */ /* OCTET data [data_len]; upload data */
...@@ -715,7 +680,7 @@ typedef struct _T_DP_ACT_PARAM_IND /* MM: req_add --> function_num */ ...@@ -715,7 +680,7 @@ typedef struct _T_DP_ACT_PARAM_IND /* MM: req_add --> function_num */
typedef struct _T_DP_ACT_PARAM_RES_CON typedef struct _T_DP_ACT_PARAM_RES_CON
{ {
USIGN16 status; /* OK, DS, NA, RS, RR, UE, TO, FE, RE, */ USIGN16 status; /* OK, DS, NA, RS, RR, UE, TO, FE, RE, */
/* NE, AD, IP, SC, NI, DI, EA, LE */ /* NE, AD, IP, SC, NI, DI, EA, LE */
} T_DP_ACT_PARAM_RES_CON; } T_DP_ACT_PARAM_RES_CON;
...@@ -741,8 +706,8 @@ typedef struct _T_DP_GET_MASTER_DIAG_IND /* MM: req_add --> function_num */ ...@@ -741,8 +706,8 @@ typedef struct _T_DP_GET_MASTER_DIAG_IND /* MM: req_add --> function_num */
typedef struct _T_DP_GET_MASTER_DIAG_RES_CON typedef struct _T_DP_GET_MASTER_DIAG_RES_CON
{ {
USIGN16 status; /* OK, DS, NA, RS, RR, UE, TO, */ USIGN16 status; /* OK, DS, NA, RS, RR, UE, TO, */
/* FE, RE, NE, AD, IP, EA, LE */ /* FE, RE, NE, AD, IP, EA, LE */
USIGN16 data_len; /* 1..DP_MAX_MASTER_DIAG_DATA_LEN */ USIGN16 data_len; /* 1..DP_MAX_MASTER_DIAG_DATA_LEN */
/* OCTET diagnostic_data [data_len]; */ /* OCTET diagnostic_data [data_len]; */
......
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/ /*****************************************************************************/
/* */ /* */
/* SOFTING AG */ /* SOFTING Industrial Automation GmbH */
/* Richard-Reitzner-Allee 6 */ /* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */ /* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */ /* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */ /* Fax: (++49)-(0)89-45656-399 */
/* */ /* */
/* Copyright (C) SOFTING AG 1995-2003 */ /* Copyright (C) SOFTING Industrial Automation GmbH 1995-2012 */
/* All Rights Reserved */ /* All Rights Reserved */
/* */ /* */
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
/* */ /* */
/* Filename : PB_DPS.H */ /* Filename : PB_DPS.H */
/* Version : 5.22.0.00.release */ /* Version : 1.30.0.00.release SPC3 based */
/* Date : 26-February-1999 */ /* : 2.06.0.00.release ASPC2 based */
/* Author : SOFTING AG */ /* Date : July-2009 */
/* Author : SOFTING */
/* */ /* */
/* Description : This file contains the global defines and types of DPS */ /* Description : This file contains the global defines and types of DPS */
/* */ /* */
...@@ -111,6 +77,9 @@ ...@@ -111,6 +77,9 @@
#define DPS_MAX_CFG_DATA_LEN DP_MAX_CFG_DATA_LEN #define DPS_MAX_CFG_DATA_LEN DP_MAX_CFG_DATA_LEN
#define DPS_MIN_SSA_DATA_LEN 4 #define DPS_MIN_SSA_DATA_LEN 4
#define DPS_MAX_OUTPUT_DATA_LEN 244
#define DPS_MAX_INPUT_DATA_LEN 244
/****************************************************************************/ /****************************************************************************/
/*** DPS SERVICE CODES ******************************************************/ /*** DPS SERVICE CODES ******************************************************/
/****************************************************************************/ /****************************************************************************/
...@@ -251,7 +220,7 @@ typedef struct _T_DPS_CON_IND ...@@ -251,7 +220,7 @@ typedef struct _T_DPS_CON_IND
typedef struct _T_DPS_INIT_SLAVE_REQ typedef struct _T_DPS_INIT_SLAVE_REQ
{ {
USIGN8 USIGN8
slave_add; /* 0..125, DPS_DEFAULT_SLAVE_ADD, DPS_NON_VOLATILE_SLAVE_ADD */ slave_add; /* 0..125, DPS_DEFAULT_SLAVE_ADD, DPS_NON_VOLATILE_SLAVE_ADD */
USIGN8 min_tsdr; /* min. station delay responder, default 0, 11..255 */ USIGN8 min_tsdr; /* min. station delay responder, default 0, 11..255 */
PB_BOOL auto_cfg_response; /* CFG check by DPS_USR ? PB_FALSE : PB_TRUE */ PB_BOOL auto_cfg_response; /* CFG check by DPS_USR ? PB_FALSE : PB_TRUE */
...@@ -426,7 +395,7 @@ typedef struct _T_DPS_SET_SLAVE_ADD_IND ...@@ -426,7 +395,7 @@ typedef struct _T_DPS_SET_SLAVE_ADD_IND
USIGN16 ident_number; /* PNO ident_number */ USIGN16 ident_number; /* PNO ident_number */
PB_BOOL no_add_chg; /* PB_TRUE: address change after reset only */ PB_BOOL no_add_chg; /* PB_TRUE: address change after reset only */
/* rem_slave_data_len */ /* rem_slave_data_len */
USIGN8 rem_slave_data[DP_MAX_REM_SLAVE_DATA_LEN]; USIGN8 rem_slave_data[DP_MAX_REM_SLAVE_DATA_LEN];
} T_DPS_SET_SLAVE_ADD_IND; } T_DPS_SET_SLAVE_ADD_IND;
......
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/ /*****************************************************************************/
/* */ /* */
/* SOFTING AG */ /* SOFTING Industrial Automation GmbH */
/* Richard-Reitzner-Allee 6 */ /* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */ /* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */ /* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */ /* Fax: (++49)-(0)89-45656-399 */
/* */ /* */
/* Copyright (C) SOFTING AG 1995-2003 */ /* Copyright (C) SOFTING Industrial Automation GmbH 1995-2012 */
/* All Rights Reserved */ /* All Rights Reserved */
/* */ /* */
/*****************************************************************************/ /*****************************************************************************/
...@@ -49,9 +14,9 @@ ...@@ -49,9 +14,9 @@
/* PROFIBUS ABORT-, REJECT-, EVENT- and ERROR DEFINES and -TYPES */ /* PROFIBUS ABORT-, REJECT-, EVENT- and ERROR DEFINES and -TYPES */
/* */ /* */
/* Filename : PB_ERR.H */ /* Filename : PB_ERR.H */
/* Version : 5.26.1.00.release */ /* Version : 5.46.0.00.release */
/* Date : 27-June-2003 */ /* Date : October-2011 */
/* Author : SOFTING AG */ /* Author : SOFTING */
/* */ /* */
/* Description : This file contains the ABORT, REJECT, EVENT and ERROR */ /* Description : This file contains the ABORT, REJECT, EVENT and ERROR */
/* types and defines and the according reason codes. */ /* types and defines and the according reason codes. */
...@@ -787,44 +752,45 @@ ...@@ -787,44 +752,45 @@
#define E_SERVICE_NOT_EXECUTABLE 25 /* service not executable */ #define E_SERVICE_NOT_EXECUTABLE 25 /* service not executable */
#endif #endif
#define E_IF_FATAL_ERROR 7 /* unrecoverable error on board */ #define E_IF_FATAL_ERROR 7 /* unrecoverable error on board */
#define E_IF_INIT_INVALID_PARAMETER 8 /* invalid initialize parameter */ #define E_IF_INIT_INVALID_PARAMETER 8 /* invalid initialize parameter */
#define E_IF_LOADER_ERROR 9 /* download firmware error */ #define E_IF_LOADER_ERROR 9 /* download firmware error */
#define E_IF_NO_CNTRL_RES 10 /* controller does not respond */ #define E_IF_NO_CNTRL_RES 10 /* controller does not respond */
#define E_IF_INVALID_CNTRL_TYPE_VERSION \ #define E_IF_INVALID_CNTRL_TYPE_VERSION 11 /* inv. controller type or SW \
11 /* inv. controller type or SW \ vers.*/
vers.*/ #define E_IF_INVALID_LAYER 12 /* invalid layer */
#define E_IF_INVALID_LAYER 12 /* invalid layer */ #define E_IF_INVALID_SERVICE 13 /* invalid service identifier */
#define E_IF_INVALID_SERVICE 13 /* invalid service identifier */ #define E_IF_INVALID_PRIMITIVE 14 /* invalid service primitive */
#define E_IF_INVALID_PRIMITIVE 14 /* invalid service primitive */ #define E_IF_INVALID_DATA_SIZE 15 /* not enough cmi data block memory*/
#define E_IF_INVALID_DATA_SIZE 15 /* not enough cmi data block memory*/ #define E_IF_INVALID_COMM_REF 16 /* invalid communication reference */
#define E_IF_INVALID_COMM_REF 16 /* invalid communication reference */ #define E_IF_INVALID_CMI_CALL 19 /* invalid CMI call */
#define E_IF_INVALID_CMI_CALL 19 /* invalid CMI call */ #define E_IF_CMI_ERROR 20 /* error occured in CMI */
#define E_IF_CMI_ERROR 20 /* error occured in CMI */ #define E_IF_RESOURCE_UNAVAILABLE 21 /* no resource available */
#define E_IF_RESOURCE_UNAVAILABLE 21 /* no resource available */ #define E_IF_NO_PARALLEL_SERVICES 22 /* no parallel services allowed */
#define E_IF_NO_PARALLEL_SERVICES 22 /* no parallel services allowed */ #define E_IF_SERVICE_CONSTR_CONFLICT 23 /* serv. tempor. not executable */
#define E_IF_SERVICE_CONSTR_CONFLICT 23 /* serv. tempor. not executable */ #define E_IF_SERVICE_NOT_SUPPORTED 24 /* service not supported */
#define E_IF_SERVICE_NOT_SUPPORTED 24 /* service not supported */ #define E_IF_SERVICE_NOT_EXECUTABLE 25 /* service not executable */
#define E_IF_SERVICE_NOT_EXECUTABLE 25 /* service not executable */ #define E_IF_INVALID_VERSION 26 /* invalid version */
#define E_IF_INVALID_VERSION 26 /* invalid version */ #define E_IF_STATE_CONFLICT 27 /* state conflict */
#define E_IF_NO_CNTRL_PRESENT 28 /* controller not available */
#define E_IF_NO_CNTRL_PRESENT 28 /* controller not available */ #define E_IF_INVALID_PARAMETER 30 /* wrong parameter in REQ or RES */
#define E_IF_INVALID_PARAMETER 30 /* wrong parameter in REQ or RES */ #define E_IF_INIT_FAILED 31 /* init. API or Controller failed */
#define E_IF_INIT_FAILED 31 /* init. API or Controller failed */ #define E_IF_EXIT_FAILED 32 /* exit API or Controller failed */
#define E_IF_EXIT_FAILED 32 /* exit API or Controller failed */ #define E_IF_PAPI_NOT_INITIALIZED 33 /* API not initialized */
#define E_IF_PAPI_NOT_INITIALIZED 33 /* API not initialized */
#define E_IF_NO_DEVICE_CONNECTION 34 /* no PROFIBUS device connection */ #define E_IF_NO_DEVICE_CONNECTION 34 /* no PROFIBUS device connection */
/* error codes available only in Win NT --------------------------------------- /* error codes available only in Win NT ---------------------------------------
*/ */
#define E_IF_SLAVE_DIAG_DATA 0xF0 /* no data available */ #define E_IF_SLAVE_DIAG_DATA 0xF0 /* no data available */
/* new diagnostics data available */ /* new diagnostics data available */
#define E_IF_SLAVE_ERROR 0xF1 /* no data exchange */ #define E_IF_SLAVE_ERROR 0xF1 /* no data exchange */
#define E_IF_INVALID_DP_STATE 0xF2 /* DP is not in state clear/operate*/ #define E_IF_INVALID_DP_STATE 0xF2 /* DP is not in state clear/operate*/
#define E_IF_READING_REGISTRY 0xF3 /* error reading registry */ #define E_IF_READING_REGISTRY 0xF3 /* error reading registry */
#define E_IF_SOCKET_ERROR 0xFE /* TCP socket error */
/* get detail with WSAGetLastError */
#define E_IF_OS_ERROR 0xFF /* OS system (WIN,DOS) error */ #define E_IF_OS_ERROR 0xFF /* OS system (WIN,DOS) error */
/* get detail with GetLastError */ /* get detail with GetLastError */
/* INTERFACE ERROR DETAIL CODES (only Win95/98) ------------------------------- /* INTERFACE ERROR DETAIL CODES (only Win95/98) -------------------------------
*/ */
......
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/ /*****************************************************************************/
/* */ /* */
/* SOFTING AG */ /* SOFTING Industrial Automation GmbH */
/* Richard-Reitzner-Allee 6 */ /* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */ /* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */ /* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */ /* Fax: (++49)-(0)89-45656-399 */
/* */ /* */
/* Copyright (C) SOFTING AG 1995-2003 */ /* Copyright (C) SOFTING Industrial Automation GmbH 1995-2012 */
/* All Rights Reserved */ /* All Rights Reserved */
/* */ /* */
/*****************************************************************************/ /*****************************************************************************/
...@@ -50,8 +15,8 @@ ...@@ -50,8 +15,8 @@
/* */ /* */
/* Filename : PB_FDL.H */ /* Filename : PB_FDL.H */
/* Version : 5.21.0.00.release */ /* Version : 5.21.0.00.release */
/* Date : 27-February-1998 */ /* Date : February-1998 */
/* Author : SOFTING AG */ /* Author : SOFTING */
/* */ /* */
/* Description : This file contains the types and defines of the FDL-User- */ /* Description : This file contains the types and defines of the FDL-User- */
/* Interface */ /* Interface */
......
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/ /*****************************************************************************/
/* */ /* */
/* SOFTING AG */ /* SOFTING Industrial Automation GmbH */
/* Richard-Reitzner-Allee 6 */ /* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */ /* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */ /* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */ /* Fax: (++49)-(0)89-45656-399 */
/* */ /* */
/* Copyright (C) SOFTING AG 1995-2003 */ /* Copyright (C) SOFTING Industrial Automation GmbH 1995-2012 */
/* All Rights Reserved */ /* All Rights Reserved */
/* */ /* */
/*****************************************************************************/ /*****************************************************************************/
...@@ -50,8 +15,8 @@ ...@@ -50,8 +15,8 @@
/* */ /* */
/* Filename : PB_FM7.H */ /* Filename : PB_FM7.H */
/* Version : 5.21.0.00.release */ /* Version : 5.21.0.00.release */
/* Date : 27-February-1998 */ /* Date : February-1998 */
/* Author : SOFTING AG */ /* Author : SOFTING */
/* */ /* */
/* Description : This file contains the types and defines of the FM7-User- */ /* Description : This file contains the types and defines of the FM7-User- */
/* Interface */ /* Interface */
...@@ -863,7 +828,7 @@ typedef struct T_SET_CONFIGURATION_REQ ...@@ -863,7 +828,7 @@ typedef struct T_SET_CONFIGURATION_REQ
USIGN16 max_nr_of_api_data_buffers; /* max # of abort/poll/idle PDU-Buffers USIGN16 max_nr_of_api_data_buffers; /* max # of abort/poll/idle PDU-Buffers
(all CR) */ (all CR) */
USIGN16 USIGN16
max_nr_of_sap_buffers; /* max # of SAP-Buffers (all CR) */ max_nr_of_sap_buffers; /* max # of SAP-Buffers (all CR) */
USIGN16 max_nr_of_poll_list_entries; /* max # of Poll-List-Entries USIGN16 max_nr_of_poll_list_entries; /* max # of Poll-List-Entries
(all CR) */ (all CR) */
USIGN16 max_data_buffer_size; /* max size of FMS-/FMA7-PDU-Buffer */ USIGN16 max_data_buffer_size; /* max size of FMS-/FMA7-PDU-Buffer */
......
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/ /*****************************************************************************/
/* */ /* */
/* SOFTING AG */ /* SOFTING Industrial Automation GmbH */
/* Richard-Reitzner-Allee 6 */ /* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */ /* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */ /* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */ /* Fax: (++49)-(0)89-45656-399 */
/* */ /* */
/* Copyright (C) SOFTING AG 1995-2003 */ /* Copyright (C) SOFTING Industrial Automation GmbH 1995-2012 */
/* All Rights Reserved */ /* All Rights Reserved */
/* */ /* */
/*****************************************************************************/ /*****************************************************************************/
...@@ -50,8 +15,8 @@ ...@@ -50,8 +15,8 @@
/* */ /* */
/* Filename : PB_FMB.H */ /* Filename : PB_FMB.H */
/* Version : 5.21.0.00.release */ /* Version : 5.21.0.00.release */
/* Date : 27-February-1998 */ /* Date : February-1998 */
/* Author : SOFTING AG */ /* Author : SOFTING */
/* */ /* */
/* */ /* */
/* Description : This file contains the types and defines of the Fieldbus- */ /* Description : This file contains the types and defines of the Fieldbus- */
......
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/ /*****************************************************************************/
/* */ /* */
/* SOFTING AG */ /* SOFTING Industrial Automation GmbH */
/* Richard-Reitzner-Allee 6 */ /* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */ /* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */ /* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */ /* Fax: (++49)-(0)89-45656-399 */
/* */ /* */
/* Copyright (C) SOFTING AG 1995-2003 */ /* Copyright (C) SOFTING Industrial Automation GmbH 1995-2012 */
/* All Rights Reserved */ /* All Rights Reserved */
/* */ /* */
/*****************************************************************************/ /*****************************************************************************/
...@@ -50,8 +15,8 @@ ...@@ -50,8 +15,8 @@
/* */ /* */
/* Filename : PB_FMS.H */ /* Filename : PB_FMS.H */
/* Version : 5.21.0.00.release */ /* Version : 5.21.0.00.release */
/* Date : 27-February-1998 */ /* Date : February-1998 */
/* Author : SOFTING AG */ /* Author : SOFTING */
/* */ /* */
/* Description : This file contains the types and defines of the FMS-User- */ /* Description : This file contains the types and defines of the FMS-User- */
/* Interface */ /* Interface */
......
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2011 SSAB Oxelosund AB.
*
* This file is part of Proview.
* Copyright (C) SOFTING GmbH 1995-1999.
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/*****************************************************************************/
/* */
/* SOFTING GmbH */
/* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */
/* */
/* Copyright (C) SOFTING GmbH 1995-1999 */
/* */
/*****************************************************************************/
/*****************************************************************************/
/* PROFIBoard SPECIFIC DEFINES */
/* Filename : PB_HW.H */
/* Version : 5.22.0.00.release */
/* Date : 26-February-1999 */
/* Author : SOFTING-BG2 */
/* */
/* Description : This file contains the PROFIboard specific defines */
/* */
/* CHANGE_NOTES */
/* */
/* date name change */
/* ----------------------------------------------------------------------- */
/* 03.03.98 BOE new/modify #defines for DPRAM SIZES and IRQ-VAL */
/* offset in DPR */
/* */
/*****************************************************************************/
/*****************************************************************************/
/*****************************************************************************/
#ifndef __PB_HW__
#define __PB_HW__
/* --- macros to access DPR ----------------------------------------------- */
#define _GET_DPR_BYTE(var) var
#define _SET_DPR_BYTE(out_var, in_var) out_var = in_var
#define _GET_DPR_WORD(var) var
#define _SET_DPR_WORD(out_var, in_var) out_var = in_var
#define _SET_CHIP_SELECT_ADDR(addr)
/* --- DPRAM SIZES / IRQ-VAL offset in DPR --------------------------------- */
#define DPRAM_SIZE_PROFIBOARD 0x4000 /* 16 KB DPRAM */
#define DPRAM_SIZE_PROFI_104 0x4000 /* 16 KB DPRAM */
#define DPRAM_H_TO_C_IRQ_OFFSET 0x2 /* IRQ memory cells at DPRAM end */
#define DPRAM_C_TO_H_IRQ_OFFSET 0x4
/* --- IRQ-VALUE ----------------------------------------------------------- */
#define RST_IRQ_VALUE 0xAA /* Reset */
#define REQ_IRQ_VALUE 0xF0 /* SND/RCV Request */
#define ACK_IRQ_VALUE 0x0F /* SND/RCV Acknowledge */
#define DP_SLAVE_IO_REQ_IRQ_VALUE 0xE0 /* DP-SLAVE-IO Request */
#define DP_SLAVE_IO_ACK_IRQ_VALUE 0x0E /* DP-SLAVE-IO Acknowldege */
#define DP_DATA_STOP_REQ_IRQ_VALUE 0xD0 /* data transfer stop Request */
#define DP_DATA_STOP_ACK_IRQ_VALUE 0x0D /* data transfer stop Acknowldege */
/* --- Read Registers in the I/O Area of the PC ---------------------------- */
#define IDENT_1 (IO_BASE_ADD + 0) /* Identification Byte 1 */
#define IDENT_2 (IO_BASE_ADD + 1) /* Identification Byte 2 */
#define IDENT_3 (IO_BASE_ADD + 2) /* Identification Byte 3 */
#define IDENT_4 (IO_BASE_ADD + 3) /* Identification Byte 4 */
/* --- Write Registers in the I/O Area of the PC --------------------------- */
#define BOARD_CTRL (IO_BASE_ADD + 0) /* Board Control Register */
#define BASE_ADD (IO_BASE_ADD + 1) /* DPRAM Base Address Register */
#define PAGE_SEL (IO_BASE_ADD + 2) /* Page Select Register */
#define CP_IRQ (IO_BASE_ADD + 3) /* Interrupt Register */
/* -- Pindefinition of the Board Control Register -------------------------- */
#define C165_RESET 0x01 /* Reset of the C165 (low active)*/
#define EN_DPRAM 0x02 /* Enable DPRAM for PC (high active)*/
#define SIZE_16_64 0x04 /* DPRAM size 1:16 kByte 0:64kByte*/
/* 64 kByte (low) */
#define BASE_A14 0x08 /* Address low within the 64 kByte */
#define BASE_A15 0x10 /* Address high within the 64 kByte */
#define DPR_WIDTH_8_16 0x20 /* DPRAM width 0:16Bit 1:8Bit */
#define MEMCS16_LA_SA 0x40 /* MEMCS16 generation 0:LA 1:SA */
/* --- Pindefinition of the DPRAM Base Adress Register --------------------- */
/* Bit 7: Base Address 23 (MSB) to */
/* Bit 0: Base Address 16 (LSB) */
/* --- Pindefinition of the Page Select Register --------------------------- */
#define PAGE_A0 0x01 /* Page Address low within the 64 kByte window */
#define PAGE_A1 0x02 /* Page Address high within the 64 kByte window */
#define PAGE_0 0x00 /* Page 0 0KB - 16KB */
#define PAGE_1 0x01 /* Page 1 16KB - 32KB */
#define PAGE_2 0x02 /* Page 2 32KB - 48KB */
#define PAGE_3 0x03 /* Page 3 48KB - 64KB */
/* --- Macros to Set or Clear Page ----------------------------------------- */
#define CLEAR_PAGE(reg) ((reg) & ~(PAGE_A0 | PAGE_A1))
#define SET_PAGE(reg, page) (CLEAR_PAGE(reg) | page)
/* --- Board I/O identifier ------------------------------------------------ */
#define HW_IO_ID_PROFIBOARD_0 0x96
#define HW_IO_ID_PROFIBOARD_1 0x26
#define HW_IO_ID_PROFIBOARD_2 0x6B
#define HW_IO_ID_PROFI104_0 0x2C
#define HW_IO_ID_PROFI104_1 0x12
#define HW_IO_ID_PROFI104_2 0x41
#endif
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/ /*****************************************************************************/
/* */ /* */
/* SOFTING AG */ /* SOFTING Industrial Automation GmbH */
/* Richard-Reitzner-Allee 6 */ /* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */ /* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */ /* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */ /* Fax: (++49)-(0)89-45656-399 */
/* */ /* */
/* Copyright (C) SOFTING AG 1995-2003 */ /* Copyright (C) SOFTING Industrial Automation GmbH 1995-2012 */
/* All Rights Reserved */ /* All Rights Reserved */
/* */ /* */
/*****************************************************************************/ /*****************************************************************************/
...@@ -49,9 +14,9 @@ ...@@ -49,9 +14,9 @@
/* PROFIBUS APPLICATION PROGRAM INTERFACE */ /* PROFIBUS APPLICATION PROGRAM INTERFACE */
/* */ /* */
/* Filename : PB_IF.H */ /* Filename : PB_IF.H */
/* Version : 5.26.1.00.release */ /* Version : 5.46.0.00.release */
/* Date : 27-June-2003 */ /* Date : October-2011 */
/* Author : SOFTING AG */ /* Author : SOFTING */
/* */ /* */
/* Description : This file contains the extern function declarations, */ /* Description : This file contains the extern function declarations, */
/* defines and types of the PROFIBUS Communication Interface */ /* defines and types of the PROFIBUS Communication Interface */
...@@ -98,20 +63,19 @@ ...@@ -98,20 +63,19 @@
#define DEVICE_BASIC_MANAGEMENT 8 #define DEVICE_BASIC_MANAGEMENT 8
/* --- contants for IRQ values -------------------------------- */ /* --- contants for IRQ values -------------------------------- */
#define REQ_IRQ 0xF0 /* IND/CON IRQ is received */ #define REQ_IRQ 0xF0 /* IND/CON IRQ is received */
#define ACK_IRQ 0x0F /* acknowledge REQ/RES */ #define ACK_IRQ 0x0F /* acknowledge REQ/RES */
#define DP_SLAVE_IO_REQ_IRQ 0xE0 /* MASTER: DP-SLAVE-IO IND/REQ */ #define DP_SLAVE_IO_REQ_IRQ 0xE0 /* MASTER: DP-SLAVE-IO IND/REQ */
#define DP_SLAVE_IO_ACK_IRQ 0x0E /* MASTER: DP-SLAVE-IO acknowldege IND/REQ */ #define DP_SLAVE_IO_ACK_IRQ 0x0E /* MASTER: DP-SLAVE-IO acknowldege IND/REQ */
#define DP_DATA_STOP_REQ_IRQ \ #define DP_DATA_STOP_REQ_IRQ 0xD0 /* MASTER: data transfer stop REQ received \
0xD0 /* MASTER: data transfer stop REQ received \ */
*/ #define DP_DATA_STOP_ACK_IRQ 0x0D /* MASTER: data transfer stop Acknowldege */
#define DP_DATA_STOP_ACK_IRQ 0x0D /* MASTER: data transfer stop Acknowldege */ #define TRC_REQ_IRQ 0xC0 /* TRACE REQ is received */
#define TRC_REQ_IRQ 0xC0 /* TRACE REQ is received */ #define TRC_ACK_IRQ 0x0C /* TRACE acknowledge */
#define TRC_ACK_IRQ 0x0C /* TRACE acknowledge */ #define EXCEPTION_REQ_IRQ 0xB0 /* Exception Request */
#define EXCEPTION_REQ_IRQ 0xB0 /* Exception Request */ #define EXCEPTION_ACK_IRQ 0x0B /* Exception Acknowledge */
#define EXCEPTION_ACK_IRQ 0x0B /* Exception Acknowledge */ #define DPS_SLAVE_INP_REQ_IRQ 0xA0 /* SLAVE: DP-SLAVE-INPUT request */
#define DPS_SLAVE_INP_REQ_IRQ 0xA0 /* SLAVE: DP-SLAVE-INPUT request */ #define DPS_SLAVE_INP_ACK_IRQ 0x0A /* SLAVE: DP-SLAVE-INPUT Acknowldege */
#define DPS_SLAVE_INP_ACK_IRQ 0x0A /* SLAVE: DP-SLAVE-INPUT Acknowldege */
#define DPS_SLAVE_OUTP_REQ_IRQ 0x90 /* SLAVE: DP-SLAVE-OUTPUT request */ #define DPS_SLAVE_OUTP_REQ_IRQ 0x90 /* SLAVE: DP-SLAVE-OUTPUT request */
#define DPS_SLAVE_OUTP_ACK_IRQ 0x09 /* SLAVE: DP-SLAVE-OUTPUT Acknowldege */ #define DPS_SLAVE_OUTP_ACK_IRQ 0x09 /* SLAVE: DP-SLAVE-OUTPUT Acknowldege */
...@@ -185,18 +149,18 @@ ...@@ -185,18 +149,18 @@
* ----------------------------------------------- */ * ----------------------------------------------- */
/* --- DP-MASTER /* --- DP-MASTER
* ---------------------------------------------------------------- */ * ---------------------------------------------------------------- */
#define ID_DP_SLAVE_IO_IMAGE 0x80 /* MASTER: image for slave io datas */ #define ID_DP_SLAVE_IO_IMAGE 0x80 /* MASTER: image for slave io datas */
#define ID_DP_STATUS_IMAGE 0x81 /* MASTER: image for status datas */ #define ID_DP_STATUS_IMAGE 0x81 /* MASTER: image for status datas */
#define ID_DP_SLAVE_IO_CONFIG_IMAGE \ #define ID_DP_SLAVE_IO_CONFIG_IMAGE 0x82 /* MASTER: DPRAM layout of slave io \
0x82 /* MASTER: DPRAM layout of slave io \ */
*/
/* --- DP-SLAVE /* --- DP-SLAVE
* ----------------------------------------------------------------- */ * ----------------------------------------------------------------- */
#define ID_DPS_SLAVE_INPUT_IMAGE 0x90 /* SLAVE: image for slave input datas */ #define ID_DPS_SLAVE_INPUT_IMAGE 0x90 /* SLAVE: image for slave input datas */
#define ID_DPS_SLAVE_OUTPUT_IMAGE \ #define ID_DPS_SLAVE_OUTPUT_IMAGE 0x91 /* SLAVE: image for slave output datas \
0x91 /* SLAVE: image for slave output datas \ */
*/ /* --- 0x92 reserved for internal use
*/
/* --- 0xA0 - 0xEF reserved for future use --- (no identifiers defined) /* --- 0xA0 - 0xEF reserved for future use --- (no identifiers defined)
* --------- */ * --------- */
...@@ -216,20 +180,6 @@ ...@@ -216,20 +180,6 @@
/* PROFI SERVICE DESCRIPTION BLOCK */ /* PROFI SERVICE DESCRIPTION BLOCK */
/**********************************************************************************/ /**********************************************************************************/
typedef struct _T_PROFI_DEVICE_HANDLE
{
HANDLE hServiceReadDevice; // Handle for Service device
HANDLE hServiceWriteDevice; // Handle for Service device
HANDLE hDpDataDevice; // Handle for DP-Data device
HANDLE hDpsInputDataDevice; // Handle for DP-Slave Input-Data device
HANDLE hDpsOutputDataDevice; // Handle for DP-Slave Output-Data device
USIGN8 CurrentBoardNumber;
} T_PROFI_DEVICE_HANDLE;
/**********************************************************************************/
/* PROFI SERVICE DESCRIPTION BLOCK */
/**********************************************************************************/
typedef struct _T_PROFI_SERVICE_DESCR typedef struct _T_PROFI_SERVICE_DESCR
{ {
USIGN16 comm_ref; /* communication reference */ USIGN16 comm_ref; /* communication reference */
...@@ -290,9 +240,10 @@ extern "C" { ...@@ -290,9 +240,10 @@ extern "C" {
#endif #endif
#if defined(WIN32) || defined(_LINUX) #if defined(WIN32) || defined(_LINUX)
FUNCTION extern INT16 CALL_CONV profi_set_default( FUNCTION extern INT16 CALL_CONV profi_set_default(IN USIGN8 Board,
OUT T_PROFI_DEVICE_HANDLE* hDevice, IN USIGN8 Board, IN USIGN8 Channel, IN USIGN8 Channel,
IN USIGN32 ReadTimeout, IN USIGN32 WriteTimeout) IN USIGN32 ReadTimeout,
IN USIGN32 WriteTimeout)
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -319,8 +270,7 @@ FUNCTION extern INT16 CALL_CONV profi_set_default( ...@@ -319,8 +270,7 @@ FUNCTION extern INT16 CALL_CONV profi_set_default(
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
; ;
FUNCTION extern INT16 CALL_CONV profi_init(OUT T_PROFI_DEVICE_HANDLE* hDevice, FUNCTION extern INT16 CALL_CONV profi_init(IN USIGN8 Board,
IN USIGN8 Board,
IN USIGN32 ReadTimeout, IN USIGN32 ReadTimeout,
IN USIGN32 WriteTimeout) IN USIGN32 WriteTimeout)
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
...@@ -380,7 +330,7 @@ FUNCTION extern INT16 CALL_CONV init_profibus(IN USIGN32 DprAdress, ...@@ -380,7 +330,7 @@ FUNCTION extern INT16 CALL_CONV init_profibus(IN USIGN32 DprAdress,
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
; ;
FUNCTION extern INT16 CALL_CONV profi_end(IN T_PROFI_DEVICE_HANDLE* hDevice) FUNCTION extern INT16 CALL_CONV profi_end(VOID)
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -395,8 +345,7 @@ FUNCTION extern INT16 CALL_CONV profi_end(IN T_PROFI_DEVICE_HANDLE* hDevice) ...@@ -395,8 +345,7 @@ FUNCTION extern INT16 CALL_CONV profi_end(IN T_PROFI_DEVICE_HANDLE* hDevice)
; ;
FUNCTION extern INT16 CALL_CONV profi_snd_req_res( FUNCTION extern INT16 CALL_CONV profi_snd_req_res(
IN T_PROFI_DEVICE_HANDLE* hDevice, IN T_PROFI_SERVICE_DESCR* pSdb, IN T_PROFI_SERVICE_DESCR* pSdb, IN VOID* pData, IN PB_BOOL dummy)
IN VOID* pData, IN PB_BOOL dummy)
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -432,9 +381,9 @@ FUNCTION extern INT16 CALL_CONV profi_snd_req_res( ...@@ -432,9 +381,9 @@ FUNCTION extern INT16 CALL_CONV profi_snd_req_res(
----------------------------------------------------------------------------*/ ----------------------------------------------------------------------------*/
; ;
FUNCTION extern INT16 CALL_CONV profi_rcv_con_ind( FUNCTION extern INT16 CALL_CONV
IN T_PROFI_DEVICE_HANDLE* hDevice, OUT T_PROFI_SERVICE_DESCR* pSdb, profi_rcv_con_ind(OUT T_PROFI_SERVICE_DESCR* pSdb, OUT VOID* pData,
OUT VOID* pData, INOUT USIGN16* pDataLength) INOUT USIGN16* pDataLength)
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -461,9 +410,10 @@ FUNCTION extern INT16 CALL_CONV profi_rcv_con_ind( ...@@ -461,9 +410,10 @@ FUNCTION extern INT16 CALL_CONV profi_rcv_con_ind(
----------------------------------------------------------------------------*/ ----------------------------------------------------------------------------*/
; ;
FUNCTION extern INT16 CALL_CONV FUNCTION extern INT16 CALL_CONV profi_set_data(IN USIGN8 DataId,
profi_set_data(IN T_PROFI_DEVICE_HANDLE* hDevice, IN USIGN8 DataId, IN USIGN16 Offset,
IN USIGN16 Offset, IN USIGN16 DataLength, IN VOID* pData) IN USIGN16 DataLength,
IN VOID* pData)
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -491,9 +441,10 @@ profi_set_data(IN T_PROFI_DEVICE_HANDLE* hDevice, IN USIGN8 DataId, ...@@ -491,9 +441,10 @@ profi_set_data(IN T_PROFI_DEVICE_HANDLE* hDevice, IN USIGN8 DataId,
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
; ;
FUNCTION extern INT16 CALL_CONV FUNCTION extern INT16 CALL_CONV profi_get_data(IN USIGN8 DataId,
profi_get_data(IN T_PROFI_DEVICE_HANDLE* hDevice, IN USIGN8 DataId, IN USIGN16 Offset,
IN USIGN16 Offset, INOUT USIGN16* pDataLength, OUT VOID* pData) INOUT USIGN16* pDataLength,
OUT VOID* pData)
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -521,9 +472,9 @@ profi_get_data(IN T_PROFI_DEVICE_HANDLE* hDevice, IN USIGN8 DataId, ...@@ -521,9 +472,9 @@ profi_get_data(IN T_PROFI_DEVICE_HANDLE* hDevice, IN USIGN8 DataId,
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
; ;
FUNCTION extern INT16 CALL_CONV FUNCTION extern INT16 CALL_CONV profi_set_dps_input_data(IN USIGN8* pData,
profi_set_dps_input_data(IN T_PROFI_DEVICE_HANDLE* hDevice, IN USIGN8* pData, IN USIGN8 DataLength,
IN USIGN8 DataLength, OUT USIGN8* pState) OUT USIGN8* pState)
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -545,9 +496,8 @@ profi_set_dps_input_data(IN T_PROFI_DEVICE_HANDLE* hDevice, IN USIGN8* pData, ...@@ -545,9 +496,8 @@ profi_set_dps_input_data(IN T_PROFI_DEVICE_HANDLE* hDevice, IN USIGN8* pData,
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
; ;
FUNCTION extern INT16 CALL_CONV FUNCTION extern INT16 CALL_CONV profi_get_dps_input_data(
profi_get_dps_input_data(IN T_PROFI_DEVICE_HANDLE* hDevice, OUT USIGN8* pData, OUT USIGN8* pData, INOUT USIGN8* pDataLength, OUT USIGN8* pState)
INOUT USIGN8* pDataLength, OUT USIGN8* pState)
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -566,9 +516,8 @@ profi_get_dps_input_data(IN T_PROFI_DEVICE_HANDLE* hDevice, OUT USIGN8* pData, ...@@ -566,9 +516,8 @@ profi_get_dps_input_data(IN T_PROFI_DEVICE_HANDLE* hDevice, OUT USIGN8* pData,
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
; ;
FUNCTION extern INT16 CALL_CONV FUNCTION extern INT16 CALL_CONV profi_get_dps_output_data(
profi_get_dps_output_data(IN T_PROFI_DEVICE_HANDLE* hDevice, OUT USIGN8* pData, OUT USIGN8* pData, INOUT USIGN8* pDataLength, OUT USIGN8* pState)
INOUT USIGN8* pDataLength, OUT USIGN8* pState)
/*----------------------------------------------------------------------------- /*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -590,8 +539,7 @@ profi_get_dps_output_data(IN T_PROFI_DEVICE_HANDLE* hDevice, OUT USIGN8* pData, ...@@ -590,8 +539,7 @@ profi_get_dps_output_data(IN T_PROFI_DEVICE_HANDLE* hDevice, OUT USIGN8* pData,
; ;
FUNCTION extern INT16 CALL_CONV FUNCTION extern INT16 CALL_CONV
profi_get_versions(IN T_PROFI_DEVICE_HANDLE* hDevice, OUT CSTRING* pPapiVersion, profi_get_versions(OUT CSTRING* pPapiVersion, OUT CSTRING* pFirmwareVersion)
OUT CSTRING* pFirmwareVersion)
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
...@@ -610,8 +558,8 @@ profi_get_versions(IN T_PROFI_DEVICE_HANDLE* hDevice, OUT CSTRING* pPapiVersion, ...@@ -610,8 +558,8 @@ profi_get_versions(IN T_PROFI_DEVICE_HANDLE* hDevice, OUT CSTRING* pPapiVersion,
-----------------------------------------------------------------------------*/ -----------------------------------------------------------------------------*/
; ;
FUNCTION extern INT16 CALL_CONV profi_get_serial_device_number( FUNCTION extern INT16 CALL_CONV
IN T_PROFI_DEVICE_HANDLE* hDevice, OUT USIGN32* pSerialDeviceNumber) profi_get_serial_device_number(OUT USIGN32* pSerialDeviceNumber)
/*---------------------------------------------------------------------------- /*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION FUNCTIONAL_DESCRIPTION
......
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/ /*****************************************************************************/
/* */ /* */
/* SOFTING AG */ /* SOFTING Industrial Automation GmbH */
/* Richard-Reitzner-Allee 6 */ /* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */ /* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */ /* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */ /* Fax: (++49)-(0)89-45656-399 */
/* */ /* */
/* Copyright (C) SOFTING AG 1995-2003 */ /* Copyright (C) SOFTING Industrial Automation GmbH 1995-2012 */
/* All Rights Reserved */ /* All Rights Reserved */
/* */ /* */
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
/* PROFIBUS WINDOWS NT DRIVERS */ /* PROFIBUS LINUX DRIVERS */
/* */ /* */
/* Filename : PB_IOCTL.H */ /* Filename : PB_IOCTL.H */
/* Version : 5.26.0.01.release */ /* Version : 5.45.0.00.release */
/* Date : 30-April-2003 */ /* Date : December-2009 */
/* Author : SOFTING AG */ /* Author : SOFTING */
/* */ /* */
/* Description : This file contains the global declarations */ /* Description : This file contains the global declarations */
/* to access the PROFIBUS Drivers for Linux */ /* to access the PROFIBUS Drivers for Linux */
...@@ -77,36 +42,43 @@ ...@@ -77,36 +42,43 @@
#define IOCTL_PROFI_SET_DEBUGLEVEL 0x6909 #define IOCTL_PROFI_SET_DEBUGLEVEL 0x6909
#ifdef __KERNEL__ #ifdef __KERNEL__
extern int pb_ioctl(struct inode* inode, struct file* file, unsigned int cmd, #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 32)
unsigned long arg); long pb_ioctl(struct file* file, unsigned int cmd, unsigned long arg);
#else
int pb_ioctl(struct inode* inode, struct file* file, unsigned int cmd,
unsigned long arg);
#endif
#endif #endif
/*****************************************************************************/ /*****************************************************************************/
/* Structure for data image description */ /* Structure for data image description */
/*****************************************************************************/ /*****************************************************************************/
// #pragma pack(push,1)
typedef struct _StatusAndData typedef struct _StatusAndData
{ {
void* StatusImage; void* StatusImage;
int StatusLength; __s32 StatusLength;
void* Data; void* Data;
int DataLength; __s32 DataLength;
} StatusAndData; } __attribute__((aligned(8))) StatusAndData;
typedef struct _NTIoctl typedef struct _NTIoctl
{ {
void* InBuf; void* InBuf;
int InBufLength; __s32 InBufLength;
void* OutBuf; void* OutBuf;
int OutBufLength; __s32 OutBufLength;
} NTIoctl; } __attribute__((aligned(8))) NTIoctl;
typedef struct _DataImage typedef struct _DataImage
{ {
int id; __s32 id;
void* Buf; void* Buf;
unsigned short Length; // sizeof( Buf ) __u16 Length; // sizeof( Buf )
} DataImage; } __attribute__((aligned(8))) DataImage;
// #pragma pack(pop)
/*****************************************************************************/ /*****************************************************************************/
/* Operation Mode as (FMS/DPV1-Master or DP-Slave) */ /* Operation Mode as (FMS/DPV1-Master or DP-Slave) */
......
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/ /*****************************************************************************/
/* */ /* */
/* SOFTING AG */ /* SOFTING Industrial Automation GmbH */
/* Richard-Reitzner-Allee 6 */ /* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */ /* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */ /* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */ /* Fax: (++49)-(0)89-45656-399 */
/* */ /* */
/* Copyright (C) SOFTING AG 1995-2003 */ /* Copyright (C) SOFTING Industrial Automation GmbH 1995-2012 */
/* All Rights Reserved */ /* All Rights Reserved */
/* */ /* */
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
/* PROFIBUS WINDOWS NT DRIVERS */ /* PROFIBUS LINUX DRIVERS */
/* */ /* */
/* Filename : PB_NTDRV.H */ /* Filename : PB_NTDRV.H */
/* Version : 5.26.0.01.release */ /* Version : 5.45.0.00.release */
/* Date : 30-April-2003 */ /* Date : December-2009 */
/* Author : SOFTING AG */ /* Author : SOFTING */
/* */ /* */
/* Description : This file contains the global declarations */ /* Description : This file contains the global declarations */
/* to access the PROFIBUS Drivers for Windows NT */ /* to access the PROFIBUS Drivers for Linux */
/* */ /* */
/*****************************************************************************/ /*****************************************************************************/
......
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/ /*****************************************************************************/
/* */ /* */
/* SOFTING AG */ /* SOFTING Industrial Automation GmbH */
/* Richard-Reitzner-Allee 6 */ /* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */ /* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */ /* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */ /* Fax: (++49)-(0)89-45656-399 */
/* */ /* */
/* Copyright (C) SOFTING AG 1995-2003 */ /* Copyright (C) SOFTING Industrial Automation GmbH 1995-2012 */
/* All Rights Reserved */ /* All Rights Reserved */
/* */ /* */
/*****************************************************************************/ /*****************************************************************************/
...@@ -50,8 +15,8 @@ ...@@ -50,8 +15,8 @@
/* */ /* */
/* Filename : PB_TOOLS.H */ /* Filename : PB_TOOLS.H */
/* Version : 5.21.0.00.release */ /* Version : 5.21.0.00.release */
/* Date : 27-February-1998 */ /* Date : February-1998 */
/* Author : SOFTING AG */ /* Author : SOFTING */
/* */ /* */
/* Description : This file contains the global function declarations, */ /* Description : This file contains the global function declarations, */
/* defines and types of the PROFIBUS-TOOLS-Interface */ /* defines and types of the PROFIBUS-TOOLS-Interface */
......
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2019 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/*****************************************************************************/ /*****************************************************************************/
/* */ /* */
/* SOFTING AG */ /* SOFTING Industrial Automation GmbH */
/* Richard-Reitzner-Allee 6 */ /* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */ /* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */ /* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */ /* Fax: (++49)-(0)89-45656-399 */
/* */ /* */
/* Copyright (C) SOFTING AG 1995-2003 */ /* Copyright (C) SOFTING Industrial Automation GmbH 1995-2012 */
/* All Rights Reserved */ /* All Rights Reserved */
/* */ /* */
/*****************************************************************************/ /*****************************************************************************/
...@@ -50,8 +15,8 @@ ...@@ -50,8 +15,8 @@
/* */ /* */
/* Filename : PB_TYPE.H */ /* Filename : PB_TYPE.H */
/* Version : 5.22.0.00.release */ /* Version : 5.22.0.00.release */
/* Date : 26-February-1999 */ /* Date : February-1999 */
/* Author : SOFTING AG */ /* Author : SOFTING */
/* */ /* */
/* Description : This file contains the PROFIBUS basic types */ /* Description : This file contains the PROFIBUS basic types */
/* */ /* */
...@@ -60,6 +25,10 @@ ...@@ -60,6 +25,10 @@
#ifndef __PB_TYPE__ #ifndef __PB_TYPE__
#define __PB_TYPE__ #define __PB_TYPE__
#ifdef _LINUX
#include <linux/types.h>
#endif
#include "pb_conf.h" /* PAPI configuration parameters */ #include "pb_conf.h" /* PAPI configuration parameters */
#ifndef NULL #ifndef NULL
...@@ -84,7 +53,7 @@ typedef unsigned char PB_BOOL; ...@@ -84,7 +53,7 @@ typedef unsigned char PB_BOOL;
typedef unsigned char OCTET; typedef unsigned char OCTET;
typedef unsigned char USIGN8; typedef unsigned char USIGN8;
typedef unsigned short USIGN16; typedef unsigned short USIGN16;
typedef unsigned long USIGN32; typedef __u32 USIGN32;
typedef signed char INT8; typedef signed char INT8;
typedef signed short INT16; typedef signed short INT16;
...@@ -92,7 +61,7 @@ typedef signed short INT16; ...@@ -92,7 +61,7 @@ typedef signed short INT16;
#ifdef WIN32 #ifdef WIN32
typedef int INT32; typedef int INT32;
#else #else
typedef signed long INT32; typedef __s32 INT32;
#endif #endif
#ifdef _LINUX #ifdef _LINUX
......
Volume Profibus $ClassVolume 0.0.250.7 Volume Profibus $ClassVolume 0.0.250.7
Body SysBody 05-SEP-2005 17:51:40.00 Body SysBody 05-SEP-2005 17:51:40.00
Attr NextOix = "_X263" Attr NextOix = "_X263"
Attr NextCix = "_X22" Attr NextCix = "_X22"
...@@ -1208,7 +1208,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -1208,7 +1208,7 @@ Volume Profibus $ClassVolume 0.0.250.7
! @Summary Process that handles the slave. Plc(1), rt_io_comm(2) or application process(4). ! @Summary Process that handles the slave. Plc(1), rt_io_comm(2) or application process(4).
! Process that handles the slave. All slaves belonging to the same Profiboard must be handled ! Process that handles the slave. All slaves belonging to the same Profiboard must be handled
! by the same process. ! by the same process.
! !
! 1: The slave is handled by the plc process, and by a specific ! 1: The slave is handled by the plc process, and by a specific
! thread in the plc, which is specified in the ThreadObject attribute. ! thread in the plc, which is specified in the ThreadObject attribute.
! 2: The slave is handled by the rt_io_comm process. ! 2: The slave is handled by the rt_io_comm process.
...@@ -1225,7 +1225,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -1225,7 +1225,7 @@ Volume Profibus $ClassVolume 0.0.250.7
! @Summary Plc thread that handles the slave. ! @Summary Plc thread that handles the slave.
! The PlcThread object of the plc thread that handles the slave. ! The PlcThread object of the plc thread that handles the slave.
! The slave is handled with the scantime of the thread. ! The slave is handled with the scantime of the thread.
! All slaves ! All slaves
!*/ !*/
Object ThreadObject $Attribute 5 16-JAN-2006 09:46:40.50 Object ThreadObject $Attribute 5 16-JAN-2006 09:46:40.50
Body SysBody 16-JAN-2006 09:46:40.50 Body SysBody 16-JAN-2006 09:46:40.50
...@@ -1393,7 +1393,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -1393,7 +1393,7 @@ Volume Profibus $ClassVolume 0.0.250.7
! The parameters WdFact1 and WdFact2 represent factors for setting ! The parameters WdFact1 and WdFact2 represent factors for setting
! the watchdog control. The watchdog control in a DP-Slave takes care ! the watchdog control. The watchdog control in a DP-Slave takes care
! that, if the master fails, the outputs fall in the safe state after ! that, if the master fails, the outputs fall in the safe state after
! the expiration of this time. ! the expiration of this time.
! t[ms] = 10*WdFact1*WdFact2 ! t[ms] = 10*WdFact1*WdFact2
!*/ !*/
Object WdFact1 $Attribute 21 16-JAN-2006 09:46:40.50 Object WdFact1 $Attribute 21 16-JAN-2006 09:46:40.50
...@@ -1408,7 +1408,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -1408,7 +1408,7 @@ Volume Profibus $ClassVolume 0.0.250.7
! The parameters WdFact1 and WdFact2 represent factors for setting ! The parameters WdFact1 and WdFact2 represent factors for setting
! the watchdog control. The watchdog control in a DP-Slave takes care ! the watchdog control. The watchdog control in a DP-Slave takes care
! that, if the master fails, the outputs fall in the safe state after ! that, if the master fails, the outputs fall in the safe state after
! the expiration of this time. ! the expiration of this time.
! t[ms] = 10*WdFact1*WdFact2 ! t[ms] = 10*WdFact1*WdFact2
!*/ !*/
Object WdFact2 $Attribute 22 16-JAN-2006 09:46:40.50 Object WdFact2 $Attribute 22 16-JAN-2006 09:46:40.50
...@@ -2005,7 +2005,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -2005,7 +2005,7 @@ Volume Profibus $ClassVolume 0.0.250.7
! @Group Profibus ! @Group Profibus
! @Summary Configuration of a Profibus module ! @Summary Configuration of a Profibus module
! Configuration of a Profibus module. ! Configuration of a Profibus module.
! !
!*/ !*/
Object Pb_Module $ClassDef 11 16-JAN-2006 09:46:40.50 Object Pb_Module $ClassDef 11 16-JAN-2006 09:46:40.50
Body SysBody 16-JAN-2006 09:46:40.50 Body SysBody 16-JAN-2006 09:46:40.50
...@@ -2048,7 +2048,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -2048,7 +2048,7 @@ Volume Profibus $ClassVolume 0.0.250.7
!/** !/**
! @Summary Process that handles the card. Plc(1), rt_io_comm(2) or application process(4). ! @Summary Process that handles the card. Plc(1), rt_io_comm(2) or application process(4).
! Process that handles the card. ! Process that handles the card.
! !
! 1: The card is read by the plc process, and is handled by a specific ! 1: The card is read by the plc process, and is handled by a specific
! thread in the plc, which is specified in the ThreadObject attribute. ! thread in the plc, which is specified in the ThreadObject attribute.
! 2: The card is read by the rt_io_comm process. ! 2: The card is read by the rt_io_comm process.
...@@ -2150,13 +2150,15 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -2150,13 +2150,15 @@ Volume Profibus $ClassVolume 0.0.250.7
EndObject EndObject
EndObject EndObject
!/** !/**
! @Author Claes Jurstrand ! @Author Claes Jurstrand/Marcus Nordenberg
! @Version 1.0 ! @Version 1.1
! @Group Profibus ! @Group Profibus
! @Summary Configurates a Profibus PCI master card (Softing profiboard) ! @Summary Configurates a Profibus PCI master card (Softing profiboard)
! Configurates a Profibus PCI master card (Softing Profiboard). Available on LynxOS and Linux. ! Configurates a Profibus PCI master card (Softing Profiboard). Available on LynxOS and Linux.
! The object should be named Px, where x is the number of the device, eg P1. ! The object should be named Px, where x is the number of the device, eg P1.
! You can have maximum two buses (master cards) on each system. ! You can have maximum two buses (master cards) on each system. The latest API from Softing
! can only handle one board per process. So you have to make sure to select PlcThread
! objects from different PlcProcess objects.
!*/ !*/
Object Pb_Profiboard $ClassDef 13 16-JAN-2006 09:46:40.51 Object Pb_Profiboard $ClassDef 13 16-JAN-2006 09:46:40.51
Body SysBody 16-JAN-2006 09:46:40.51 Body SysBody 16-JAN-2006 09:46:40.51
...@@ -2300,8 +2302,8 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -2300,8 +2302,8 @@ Volume Profibus $ClassVolume 0.0.250.7
EndObject EndObject
!/** !/**
! Baud rate for the bus in Kbit/s. Possible values are 500, 1500, 3000, 6000, 12000. ! Baud rate for the bus in Kbit/s. Possible values are 500, 1500, 3000, 6000, 12000.
! Note that the values for some of the following attributes are depending on the ! Note that the values for some of the following attributes are depending on the
! baud rate. For further information about these bus parameters, please refer to the ! baud rate. For further information about these bus parameters, please refer to the
! documentation from Softing. ! documentation from Softing.
!*/ !*/
Object BaudRate $Attribute 11 16-JAN-2006 09:46:40.51 Object BaudRate $Attribute 11 16-JAN-2006 09:46:40.51
...@@ -2312,9 +2314,9 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -2312,9 +2314,9 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody EndBody
EndObject EndObject
!/** !/**
! Watchdog timer for write supervision in the master card. This watchdog is ! Watchdog timer for write supervision in the master card. This watchdog is
! activated at the first write operation after initialization. If the timer later ! activated at the first write operation after initialization. If the timer later
! elapses without a write operation, the master card will reset itself, and the bus ! elapses without a write operation, the master card will reset itself, and the bus
! will stop, leaving all slaves to stall when their own stalltime elapses. ! will stop, leaving all slaves to stall when their own stalltime elapses.
! Range 100..10000 ms ! Range 100..10000 ms
!*/ !*/
...@@ -2326,7 +2328,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -2326,7 +2328,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody EndBody
EndObject EndObject
!/** !/**
! Slot time, the maximum time a master station must wait for a transaction response. ! Slot time, the maximum time a master station must wait for a transaction response.
! Range 37..16383 Bit Times. ! Range 37..16383 Bit Times.
! Recommended values for each baudrate: ! Recommended values for each baudrate:
! 500 kbit/s - 200 ! 500 kbit/s - 200
...@@ -2343,7 +2345,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -2343,7 +2345,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody EndBody
EndObject EndObject
!/** !/**
! Minimum station delay time for responder, the period of time which may elapse before ! Minimum station delay time for responder, the period of time which may elapse before
! the responder can send the response frame. Range 11..1023 Bit Times. ! the responder can send the response frame. Range 11..1023 Bit Times.
! Recommended values for each baudrate: ! Recommended values for each baudrate:
! 500 kbit/s - 11 ! 500 kbit/s - 11
...@@ -2394,7 +2396,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -2394,7 +2396,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody EndBody
EndObject EndObject
!/** !/**
! Setup time, the time between the occurance of an interrupt request and the necessary request ! Setup time, the time between the occurance of an interrupt request and the necessary request
! action is performed. Range 1..494-Tqui BitTimes. ! action is performed. Range 1..494-Tqui BitTimes.
! Recommended values for each baudrate: ! Recommended values for each baudrate:
! 500 kbit/s - 1 ! 500 kbit/s - 1
...@@ -2412,7 +2414,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -2412,7 +2414,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndObject EndObject
!/** !/**
! Target rotation time, the anticipated time for one token rotation on the bus, including ! Target rotation time, the anticipated time for one token rotation on the bus, including
! allowances for high and low priority transactions and GAP maintenance. ! allowances for high and low priority transactions and GAP maintenance.
! Range 256..2^24-1 Bit Times. ! Range 256..2^24-1 Bit Times.
! The value is irrelevant in Profibus DP operations. ! The value is irrelevant in Profibus DP operations.
!*/ !*/
...@@ -2451,7 +2453,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -2451,7 +2453,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody EndBody
EndObject EndObject
!/** !/**
! Maximum retry limit, indicates how often FDL has to repeat the request frame when no response ! Maximum retry limit, indicates how often FDL has to repeat the request frame when no response
! or acknowledge frame is receive from the recognized station within the slot time. Range 0..7. ! or acknowledge frame is receive from the recognized station within the slot time. Range 0..7.
! Recommended values for each baudrate: ! Recommended values for each baudrate:
! 500 kbit/s - 1 ! 500 kbit/s - 1
...@@ -2691,7 +2693,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -2691,7 +2693,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndObject EndObject
!/** !/**
! Baud rate for the bus in Kbit/s. Possible values are 500, 1500, 3000, 6000, 12000. ! Baud rate for the bus in Kbit/s. Possible values are 500, 1500, 3000, 6000, 12000.
! Note that the values for some of the following attributes are depending on the ! Note that the values for some of the following attributes are depending on the
! baud rate. ! baud rate.
!*/ !*/
Object BaudRate $Attribute 37 09-DEC-2008 13:19:32.10 Object BaudRate $Attribute 37 09-DEC-2008 13:19:32.10
...@@ -2702,9 +2704,9 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -2702,9 +2704,9 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody EndBody
EndObject EndObject
!/** !/**
! Watchdog timer for write supervision in the master card. This watchdog is ! Watchdog timer for write supervision in the master card. This watchdog is
! activated at the first write operation after initialization. If the timer later ! activated at the first write operation after initialization. If the timer later
! elapses without a write operation, the master card will reset itself, and the bus ! elapses without a write operation, the master card will reset itself, and the bus
! will stop, leaving all slaves to stall when their own stall time elapses. ! will stop, leaving all slaves to stall when their own stall time elapses.
! A value of 0 will disable the board's watchdog functionality altogether. ! A value of 0 will disable the board's watchdog functionality altogether.
! Range 0..65535 ms ! Range 0..65535 ms
...@@ -2717,7 +2719,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -2717,7 +2719,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody EndBody
EndObject EndObject
!/** !/**
! Slot time, the maximum time a master station must wait for a transaction response. ! Slot time, the maximum time a master station must wait for a transaction response.
! Range 37..16383 Bit Times. ! Range 37..16383 Bit Times.
! Recommended values for each baud rate: ! Recommended values for each baud rate:
! 500 kbit/s - 200 ! 500 kbit/s - 200
...@@ -2734,7 +2736,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -2734,7 +2736,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody EndBody
EndObject EndObject
!/** !/**
! Minimum station delay time for responder, the period of time which may elapse before ! Minimum station delay time for responder, the period of time which may elapse before
! the responder can send the response frame. Range 11..1023 Bit Times. ! the responder can send the response frame. Range 11..1023 Bit Times.
! Recommended values for each baud rate: ! Recommended values for each baud rate:
! 500 kbit/s - 11 ! 500 kbit/s - 11
...@@ -2785,7 +2787,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -2785,7 +2787,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody EndBody
EndObject EndObject
!/** !/**
! Setup time, the time between the occurrence of an interrupt request and the necessary request ! Setup time, the time between the occurrence of an interrupt request and the necessary request
! action is performed. Range 1..494-Tqui BitTimes. ! action is performed. Range 1..494-Tqui BitTimes.
! Recommended values for each baud rate: ! Recommended values for each baud rate:
! 500 kbit/s - 1 ! 500 kbit/s - 1
...@@ -2803,7 +2805,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -2803,7 +2805,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndObject EndObject
!/** !/**
! Target rotation time, the anticipated time for one token rotation on the bus, including ! Target rotation time, the anticipated time for one token rotation on the bus, including
! allowances for high and low priority transactions and GAP maintenance. ! allowances for high and low priority transactions and GAP maintenance.
! Range 256..2^24-1 Bit Times. ! Range 256..2^24-1 Bit Times.
! The value is irrelevant in Profibus DP operations. ! The value is irrelevant in Profibus DP operations.
!*/ !*/
...@@ -2842,7 +2844,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -2842,7 +2844,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody EndBody
EndObject EndObject
!/** !/**
! Maximum retry limit, indicates how often FDL has to repeat the request frame when no response ! Maximum retry limit, indicates how often FDL has to repeat the request frame when no response
! or acknowledge frame is receive from the recognized station within the slot time. Range 0..7. ! or acknowledge frame is receive from the recognized station within the slot time. Range 0..7.
! Recommended values for each baud rate: ! Recommended values for each baud rate:
! 500 kbit/s - 1 ! 500 kbit/s - 1
...@@ -2985,73 +2987,73 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -2985,73 +2987,73 @@ Volume Profibus $ClassVolume 0.0.250.7
Attr NextAix = "_X11" Attr NextAix = "_X11"
EndBody EndBody
!/** !/**
! Diagnosis appears Alarm ! Diagnosis appears Alarm
! A diagnosis appears alarm signals an event within a submodule, ! A diagnosis appears alarm signals an event within a submodule,
! for instance overtemperature, short circuit, etc. ! for instance overtemperature, short circuit, etc.
! The content of the alarm is defined by the Diagnosis ASE for this type. ! The content of the alarm is defined by the Diagnosis ASE for this type.
! !
! Process Alarm ! Process Alarm
! A process alarm signals the occurrence of an event in the ! A process alarm signals the occurrence of an event in the
! connected process, for instance upper limit value exceeded. ! connected process, for instance upper limit value exceeded.
! !
! Pull Alarm ! Pull Alarm
! A slot signals the withdrawal of a submodule/module or change ! A slot signals the withdrawal of a submodule/module or change
! in configuration (reduction). ! in configuration (reduction).
! !
! Plug Alarm ! Plug Alarm
! A slot signals the insertion of a submodule/module, a new need ! A slot signals the insertion of a submodule/module, a new need
! for parametrization, or a change in configuration (addition). ! for parametrization, or a change in configuration (addition).
! !
! Status Alarm ! Status Alarm
! A status alarm signals a change in the state of a submodule, ! A status alarm signals a change in the state of a submodule,
! for instance run, stop or ready. ! for instance run, stop or ready.
! !
! Update Alarm ! Update Alarm
! An update alarm signals the change of a parameter in a submodule ! An update alarm signals the change of a parameter in a submodule
! e.g. by a local operation or a remote access. ! e.g. by a local operation or a remote access.
! !
! Redundancy Alarm ! Redundancy Alarm
! A redundancy alarm signals the fault of one IO controller to the ! A redundancy alarm signals the fault of one IO controller to the
! remaining IO controller for redundant IO ARs. ! remaining IO controller for redundant IO ARs.
! !
! Controlled by supervisor ! Controlled by supervisor
! A slot signals the logical withdrawal of a submodule by the ! A slot signals the logical withdrawal of a submodule by the
! IO supervisor. The actions shall be according to the Pull Alarm. ! IO supervisor. The actions shall be according to the Pull Alarm.
! !
! Released Alarm ! Released Alarm
! A slot signals the logical insertion of a submodule by the IO supervisor. ! A slot signals the logical insertion of a submodule by the IO supervisor.
! The actions shall be according to the Plug Alarm. ! The actions shall be according to the Plug Alarm.
! !
! Plug Wrong Submodule Alarm ! Plug Wrong Submodule Alarm
! A slot signals the insertion of a wrong submodule/module or a ! A slot signals the insertion of a wrong submodule/module or a
! change in configuration (addition). ! change in configuration (addition).
! !
! Return of Submodule Alarm ! Return of Submodule Alarm
! A slot signals that a submodule is ready to switch its IOCS/IOPS from ! A slot signals that a submodule is ready to switch its IOCS/IOPS from
! "BAD" to "GOOD" again without new parameterization. ! "BAD" to "GOOD" again without new parameterization.
! !
! Diagnosis disappears Alarm ! Diagnosis disappears Alarm
! A diagnosis disappears alarm signals a disappearing diagnosis event ! A diagnosis disappears alarm signals a disappearing diagnosis event
! within a submodule. The content of the alarm is defined by the ! within a submodule. The content of the alarm is defined by the
! Diagnosis ASE for this type. ! Diagnosis ASE for this type.
! !
! Multicast Communication Mismatch ! Multicast Communication Mismatch
! A multicast consumer submodule signals that communication ! A multicast consumer submodule signals that communication
! relationship to the associated multicast provider is failed. ! relationship to the associated multicast provider is failed.
! !
! Port Data Change Notification Alarm ! Port Data Change Notification Alarm
! A port submodule signals that port data has been changed. ! A port submodule signals that port data has been changed.
! !
! Sync Data Change Notification Alarm ! Sync Data Change Notification Alarm
! An interface submodule signals that synchronization data has been changed. ! An interface submodule signals that synchronization data has been changed.
! !
! Isochronous Mode Problem Notification Alarm ! Isochronous Mode Problem Notification Alarm
! The application signals that problems with isochronously execution ! The application signals that problems with isochronously execution
! have been detected. ! have been detected.
! !
! Furthermore, manufacturer specific alarms may be used and alarms ! Furthermore, manufacturer specific alarms may be used and alarms
! are reserved for profile specific definitions. ! are reserved for profile specific definitions.
! !
!*/ !*/
Object Type $Attribute 1 10-JUN-2010 10:53:19.20 Object Type $Attribute 1 10-JUN-2010 10:53:19.20
Body SysBody 21-OCT-2010 08:59:53.40 Body SysBody 21-OCT-2010 08:59:53.40
...@@ -3106,7 +3108,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -3106,7 +3108,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody EndBody
EndObject EndObject
!/** !/**
! Module ident number identifying the module the ! Module ident number identifying the module the
! alarm comes from (see GSDML-file) ! alarm comes from (see GSDML-file)
!*/ !*/
Object ModuleIdentNumber $Attribute 6 10-JUN-2010 11:49:40.15 Object ModuleIdentNumber $Attribute 6 10-JUN-2010 11:49:40.15
...@@ -3118,7 +3120,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -3118,7 +3120,7 @@ Volume Profibus $ClassVolume 0.0.250.7
EndBody EndBody
EndObject EndObject
!/** !/**
! Subodule ident number identifying the module the ! Subodule ident number identifying the module the
! alarm comes from (see GSDML-file) ! alarm comes from (see GSDML-file)
!*/ !*/
Object SubmoduleIdentNumber $Attribute 7 10-JUN-2010 11:49:56.34 Object SubmoduleIdentNumber $Attribute 7 10-JUN-2010 11:49:56.34
...@@ -3272,31 +3274,31 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -3272,31 +3274,31 @@ Volume Profibus $ClassVolume 0.0.250.7
! @Group Profinet ! @Group Profinet
! @Summary Configures a Softing Profinet controller stack. ! @Summary Configures a Softing Profinet controller stack.
! Configures a Sofing Profinet controller stack. ! Configures a Sofing Profinet controller stack.
! !
! ProviewR has support for a Profinet stack from Softing (www.softing.com). ! ProviewR has support for a Profinet stack from Softing (www.softing.com).
! The Profinet stack is implemented as three Linux kernel modules. The stack ! The Profinet stack is implemented as three Linux kernel modules. The stack
! is configured by the current object and is placed below the $Node object. ! is configured by the current object and is placed below the $Node object.
! !
! See ProviewR documentation 'Guide to I/O System' for more information. See also ! See ProviewR documentation 'Guide to I/O System' for more information. See also
! a Case Study in class help class ABB_ACS880_PnDevice ! a Case Study in class help class ABB_ACS880_PnDevice
! !
! Note due to Softing licens requirements the NIC must have a specific macadress. ! Note due to Softing licens requirements the NIC must have a specific macadress.
! !
! Example: ! Example:
! !
! auto eth1 ! auto eth1
! iface eth1 inet static ! iface eth1 inet static
! address 192.168.90.1 ! address 192.168.90.1
! netmask 255.255.254.0 ! netmask 255.255.254.0
! hwaddress ether xx:xx:xx:xx:xx:xx ! hwaddress ether xx:xx:xx:xx:xx:xx
! !
! where xx:xx:xx:xx:xx:xx needs to be: ! where xx:xx:xx:xx:xx:xx needs to be:
! !
! AA:00:04:00:xx:14 where xx is 21-52 (hex, i.e. max 50 device available) ! AA:00:04:00:xx:14 where xx is 21-52 (hex, i.e. max 50 device available)
! !
! See also an example 9 'Ethernet interface settings in file' /etc/network/interfaces ! See also an example 9 'Ethernet interface settings in file' /etc/network/interfaces
! in class ABB_ACS880_PnDevice. ! in class ABB_ACS880_PnDevice.
! !
! @b See also ! @b See also
! @classlink PnDevice profibus_pndevice.html ! @classlink PnDevice profibus_pndevice.html
! @classlink PnModule profibus_pnmodule.html ! @classlink PnModule profibus_pnmodule.html
...@@ -3415,29 +3417,29 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -3415,29 +3417,29 @@ Volume Profibus $ClassVolume 0.0.250.7
! @Group Profinet ! @Group Profinet
! @Summary Configures a Profinet device. ! @Summary Configures a Profinet device.
! Configures a Profinet device. ! Configures a Profinet device.
! !
! Baseobject for a profinet device. Reside below a profinet agent object. ! Baseobject for a profinet device. Reside below a profinet agent object.
! In the attribute GSDMfile the gsdmlfile for the current device is stated. ! In the attribute GSDMfile the gsdmlfile for the current device is stated.
! When the gsdmlfile is supplied the device can be configured by the Profinet ! When the gsdmlfile is supplied the device can be configured by the Profinet
! configurator. See ProviewR documentation 'Guide to I/O System' for more ! configurator. See ProviewR documentation 'Guide to I/O System' for more
! information. See also a Case Study class ABB_ACS880_PnDevice. ! information. See also a Case Study class ABB_ACS880_PnDevice.
! !
! Note 'DeviceName' is the most important setting and defines the device on ! Note 'DeviceName' is the most important setting and defines the device on
! the network. When IO communication starts the Profinet stack will first ! the network. When IO communication starts the Profinet stack will first
! look up all the devices on the network by the name. ! look up all the devices on the network by the name.
! !
! There is a viewer tool for searching a network for Profinet devices and to set the ! There is a viewer tool for searching a network for Profinet devices and to set the
! 'DeviceName'. The viewer is started from a terminal window with the shell command: ! 'DeviceName'. The viewer is started from a terminal window with the shell command:
! !
! > profinet_viewer [device] ! > profinet_viewer [device]
! !
! Where 'device' is the network device, eg eth0. By default the profinet_viewer will ! Where 'device' is the network device, eg eth0. By default the profinet_viewer will
! connect to eth1. ! connect to eth1.
! !
! @bNote. ! @bNote.
! The ProviewR runtime environment should be stopped on the current node before the ! The ProviewR runtime environment should be stopped on the current node before the
! the viewer is started. ! the viewer is started.
! !
! @b See also ! @b See also
! @classlink PnControllerSoftingPNAK profibus_pncontrollersoftingpnak.html ! @classlink PnControllerSoftingPNAK profibus_pncontrollersoftingpnak.html
! @classlink Hilscher_cifX_PnController otherio_hilscher_cifx_pncontroller.html ! @classlink Hilscher_cifX_PnController otherio_hilscher_cifx_pncontroller.html
...@@ -3509,7 +3511,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -3509,7 +3511,7 @@ Volume Profibus $ClassVolume 0.0.250.7
!/** !/**
! @Summary Process that handles the device. Plc(1), rt_io_comm(2) or application process(4). ! @Summary Process that handles the device. Plc(1), rt_io_comm(2) or application process(4).
! Process that handles the device. ! Process that handles the device.
! !
! 1: The device is read by the plc process, and is handled by a specific ! 1: The device is read by the plc process, and is handled by a specific
! thread in the plc, which is specified in the ThreadObject attribute. ! thread in the plc, which is specified in the ThreadObject attribute.
! 2: The device is read by the rt_io_comm process. ! 2: The device is read by the rt_io_comm process.
...@@ -3863,22 +3865,22 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -3863,22 +3865,22 @@ Volume Profibus $ClassVolume 0.0.250.7
! @Group Profinet ! @Group Profinet
! @Summary Configures a Profinet module. ! @Summary Configures a Profinet module.
! Configures a Profinet module. ! Configures a Profinet module.
! !
! This object configures the data exchange between a Profinet Slave Device and a ! This object configures the data exchange between a Profinet Slave Device and a
! Profinet Master. ! Profinet Master.
! !
! The class PnModule will be valid for all types of modules. In many cases there exist ! The class PnModule will be valid for all types of modules. In many cases there exist
! prepared subclasses of the PnModule­class for the specific module. This is for example ! prepared subclasses of the PnModule­class for the specific module. This is for example
! the case for a Siemens ET200M device. For the prepared classes the IO channels will ! the case for a Siemens ET200M device. For the prepared classes the IO channels will
! exist as a part of the moduleobject. The prepared classes should be used if they exist. ! exist as a part of the moduleobject. The prepared classes should be used if they exist.
! See ProviewR documentation 'Guide to I/O Systemfor more information. ! See ProviewR documentation 'Guide to I/O Systemfor more information.
! !
! @bConfiguration (prepared subclasses) ! @bConfiguration (prepared subclasses)
! One device object (not this module object) are placed as children to the master. For ! One device object (not this module object) are placed as children to the master. For
! the device object, a profinet configurator is opened, that configures the device object ! the device object, a profinet configurator is opened, that configures the device object
! and creates this module objects for the modules handled by the device. See ! and creates this module objects for the modules handled by the device. See
! a Case Study in class ABB_ACS880_PnDevice for more information. ! a Case Study in class ABB_ACS880_PnDevice for more information.
! !
! @classlink PnControllerSoftingPNAK profibus_pncontrollersoftingpnak.html ! @classlink PnControllerSoftingPNAK profibus_pncontrollersoftingpnak.html
! @classlink PnDevice profibus_pndevice.html ! @classlink PnDevice profibus_pndevice.html
! @classlink ABB_ACS880_PnDevice abb_abb_acs880_pndevice.html ! @classlink ABB_ACS880_PnDevice abb_abb_acs880_pndevice.html
...@@ -3938,7 +3940,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -3938,7 +3940,7 @@ Volume Profibus $ClassVolume 0.0.250.7
!/** !/**
! @Summary Process that handles the module. Plc(1), rt_io_comm(2) or application process(4). ! @Summary Process that handles the module. Plc(1), rt_io_comm(2) or application process(4).
! Process that handles the module. ! Process that handles the module.
! !
! 1: The module is read by the plc process, and is handled by a specific ! 1: The module is read by the plc process, and is handled by a specific
! thread in the plc, which is specified in the ThreadObject attribute. ! thread in the plc, which is specified in the ThreadObject attribute.
! 2: The module is read by the rt_io_comm process. ! 2: The module is read by the rt_io_comm process.
...@@ -4041,34 +4043,34 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -4041,34 +4043,34 @@ Volume Profibus $ClassVolume 0.0.250.7
! @Group Profibus ! @Group Profibus
! @Summary Configures a Profibus FDL Service Access Point (SAP) or Remote Service Access Point (RSAP). ! @Summary Configures a Profibus FDL Service Access Point (SAP) or Remote Service Access Point (RSAP).
! Configures a Profibus FDL (R)SAP. ! Configures a Profibus FDL (R)SAP.
! !
! With Profibus FDL Service Access Points data transfer services between nodes on a Profibus ! With Profibus FDL Service Access Points data transfer services between nodes on a Profibus
! network is made possible. ! network is made possible.
! There are two SAP types reflecting the different characteristics of Master Stations and ! There are two SAP types reflecting the different characteristics of Master Stations and
! Slave Stations. Usually, "regular" SAP's are activated o Master Stations whereas Responder ! Slave Stations. Usually, "regular" SAP's are activated o Master Stations whereas Responder
! SAP's (RSAP's) are activated on Slave Stations. However both can be used on either one. ! SAP's (RSAP's) are activated on Slave Stations. However both can be used on either one.
! !
! A (R)SAP is defined by an address in the interval 0-63. A SAP is used to issue data transfers ! A (R)SAP is defined by an address in the interval 0-63. A SAP is used to issue data transfers
! to a remote SAP or RSAP. A SAP can also be used to request data from a remote RSAP. ! to a remote SAP or RSAP. A SAP can also be used to request data from a remote RSAP.
! A RSAP cannot request data from a remote (R)SAP. It is used to respond on a data request ! A RSAP cannot request data from a remote (R)SAP. It is used to respond on a data request
! and to receive data. ! and to receive data.
! !
! This object defines a SAP or RSAP and it's address. Also defined is the slave address ! This object defines a SAP or RSAP and it's address. Also defined is the slave address
! of the node that this SAP will exchange data with. It should be created as a child to a ! of the node that this SAP will exchange data with. It should be created as a child to a
! Pb_Profiboard. ! Pb_Profiboard.
! !
! See ProviewR documentation 'Guide to I/O Systems' for more information. ! See ProviewR documentation 'Guide to I/O Systems' for more information.
! !
! @bConfiguration ! @bConfiguration
! Instances of the class Pb_FDL_DataTransfer are created as children to the Pb_FDL_SAP object. ! Instances of the class Pb_FDL_DataTransfer are created as children to the Pb_FDL_SAP object.
! !
! For the SAP more than one instance can be created of the types SDA, SDN and SRD. These ! For the SAP more than one instance can be created of the types SDA, SDN and SRD. These
! different type are used to send data to a remote SAP (types SDA and SDN) or to request data and ! different type are used to send data to a remote SAP (types SDA and SDN) or to request data and
! if needed, at the same time send, data (type SRD). See more on class Pb_FDL_DataTransfer. ! if needed, at the same time send, data (type SRD). See more on class Pb_FDL_DataTransfer.
! !
! For a RSAP instance only one instance can be created of type RUM used to recieve data and to update ! For a RSAP instance only one instance can be created of type RUM used to recieve data and to update
! the data that will be sent back by a SRD request. ! the data that will be sent back by a SRD request.
! !
! @classlink Pb_Profiboard profibus_pb_profiboard.html ! @classlink Pb_Profiboard profibus_pb_profiboard.html
! @classlink Pb_FDL_DataTransfer profibus_pb_fdl_datatransfer.html ! @classlink Pb_FDL_DataTransfer profibus_pb_fdl_datatransfer.html
!*/ !*/
...@@ -4158,7 +4160,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -4158,7 +4160,7 @@ Volume Profibus $ClassVolume 0.0.250.7
! @Summary Process that handles the slave. Plc(1), rt_io_comm(2) or application process(4). ! @Summary Process that handles the slave. Plc(1), rt_io_comm(2) or application process(4).
! Process that handles the slave. All slaves belonging to the same Profiboard must be handled ! Process that handles the slave. All slaves belonging to the same Profiboard must be handled
! by the same process. ! by the same process.
! !
! 1: The slave is handled by the plc process, and by a specific ! 1: The slave is handled by the plc process, and by a specific
! thread in the plc, which is specified in the ThreadObject attribute. ! thread in the plc, which is specified in the ThreadObject attribute.
! 2: The slave is handled by the rt_io_comm process. ! 2: The slave is handled by the rt_io_comm process.
...@@ -4175,7 +4177,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -4175,7 +4177,7 @@ Volume Profibus $ClassVolume 0.0.250.7
! @Summary Plc thread that handles the slave. ! @Summary Plc thread that handles the slave.
! The PlcThread object of the plc thread that handles the slave. ! The PlcThread object of the plc thread that handles the slave.
! The slave is handled with the scantime of the thread. ! The slave is handled with the scantime of the thread.
! All slaves ! All slaves
!*/ !*/
Object ThreadObject $Attribute 7 14-AUG-2014 13:30:57.23 Object ThreadObject $Attribute 7 14-AUG-2014 13:30:57.23
Body SysBody 14-AUG-2014 13:30:57.23 Body SysBody 14-AUG-2014 13:30:57.23
...@@ -4327,43 +4329,43 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -4327,43 +4329,43 @@ Volume Profibus $ClassVolume 0.0.250.7
! @Group Profibus ! @Group Profibus
! @Summary Configures a Profibus FDL Data Transfer Service. ! @Summary Configures a Profibus FDL Data Transfer Service.
! Configures a Profibus FDL Data Transfer Service. ! Configures a Profibus FDL Data Transfer Service.
! !
! With Profibus FDL Service Access Points data transfer services between nodes on a Profibus ! With Profibus FDL Service Access Points data transfer services between nodes on a Profibus
! network is made possible. ! network is made possible.
! !
! There are two SAP types reflecting the different characteristics of Master Stations and ! There are two SAP types reflecting the different characteristics of Master Stations and
! Slave Stations. Usually, "regular" SAP's are activated on Master Stations whereas Responder ! Slave Stations. Usually, "regular" SAP's are activated on Master Stations whereas Responder
! SAP's (RSAP's) are activated on Slave Stations. However both can be used on either one. ! SAP's (RSAP's) are activated on Slave Stations. However both can be used on either one.
! !
! There are five types of data transfer services that can be configured. Three for sending and/or ! There are five types of data transfer services that can be configured. Three for sending and/or
! requesting data and two for preparing reply data (only one supported). ! requesting data and two for preparing reply data (only one supported).
! !
! The first three of them are used from a SAP and cannot be used with a responder SAP (RSAP). These ! The first three of them are used from a SAP and cannot be used with a responder SAP (RSAP). These
! are SDA (Send Data with Acknowledge), SDN (Send Data with No acknowledge) and SRD (Send and Request ! are SDA (Send Data with Acknowledge), SDN (Send Data with No acknowledge) and SRD (Send and Request
! Data with reply). When requesting data no data need to be sent. ! Data with reply). When requesting data no data need to be sent.
! !
! The other two services are used together with a responder SAP (RSAP) to prepare the reply data ! The other two services are used together with a responder SAP (RSAP) to prepare the reply data
! that will be sent back to a SAP upon the receipt of a SDA, SDN or SRD. These are RU (Reply-Update, ! that will be sent back to a SAP upon the receipt of a SDA, SDN or SRD. These are RU (Reply-Update,
! this one is not supported) and RUM (Reply-Update-Multiple) ! this one is not supported) and RUM (Reply-Update-Multiple)
! !
! Each data transfer is configured with the destination address (address of remote (R)SAP). ! Each data transfer is configured with the destination address (address of remote (R)SAP).
! !
! The data that is to be sent or received are created as standard I/O channels which should be ! The data that is to be sent or received are created as standard I/O channels which should be
! created as children to the Pb_FDL_DataTransfer-object. When receiveing data, the data will always ! created as children to the Pb_FDL_DataTransfer-object. When receiveing data, the data will always
! be directed to the first (top) Pb_FDL_DataTransfer-object found as a child to the ! be directed to the first (top) Pb_FDL_DataTransfer-object found as a child to the
! Pb_FDL_SAP-object. ! Pb_FDL_SAP-object.
! !
! See ProviewR documentation 'Guide to I/O Systems' for more information. ! See ProviewR documentation 'Guide to I/O Systems' for more information.
! !
! @bConfiguration ! @bConfiguration
! Instances of the class Pb_FDL_DataTransfer are created as children to the Pb_FDL_SAP object. ! Instances of the class Pb_FDL_DataTransfer are created as children to the Pb_FDL_SAP object.
! !
! I/O-channels are created as children to the Pb_FDL_DataTransfer-object to represent the ! I/O-channels are created as children to the Pb_FDL_DataTransfer-object to represent the
! data being sent and/or received. ! data being sent and/or received.
! !
! For a RSAP instance only one instance can be created of type RUM used to recieve data and to update ! For a RSAP instance only one instance can be created of type RUM used to recieve data and to update
! the data that will be sent back by a SRD request. ! the data that will be sent back by a SRD request.
! !
! @classlink Pb_FDL_SAP profibus_pb_fdl_sap.html ! @classlink Pb_FDL_SAP profibus_pb_fdl_sap.html
!*/ !*/
Object Pb_FDL_DataTransfer $ClassDef 21 14-AUG-2014 15:41:30.53 Object Pb_FDL_DataTransfer $ClassDef 21 14-AUG-2014 15:41:30.53
...@@ -4414,8 +4416,8 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -4414,8 +4416,8 @@ Volume Profibus $ClassVolume 0.0.250.7
! FDLIF_SRD - Send and Request Data with reply ! FDLIF_SRD - Send and Request Data with reply
! FDLIF_RU - Reply Update (not supprted, RUM will always be used) ! FDLIF_RU - Reply Update (not supprted, RUM will always be used)
! FDLIF_RUM - Reply Update Multiple ! FDLIF_RUM - Reply Update Multiple
! !
! SDA and SDN can also receive data explictly sent with a SDA or SDN service from a ! SDA and SDN can also receive data explictly sent with a SDA or SDN service from a
! remote SAP. If more than one Pb_FDL_DataTransfer objects have been created for a single ! remote SAP. If more than one Pb_FDL_DataTransfer objects have been created for a single
! SAP then the first child will receive the data. ! SAP then the first child will receive the data.
!*/ !*/
...@@ -4452,7 +4454,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -4452,7 +4454,7 @@ Volume Profibus $ClassVolume 0.0.250.7
! @Summary Process that handles the slave. Plc(1), rt_io_comm(2) or application process(4). ! @Summary Process that handles the slave. Plc(1), rt_io_comm(2) or application process(4).
! Process that handles the slave. All slaves belonging to the same Profiboard must be handled ! Process that handles the slave. All slaves belonging to the same Profiboard must be handled
! by the same process. ! by the same process.
! !
! 1: The slave is handled by the plc process, and by a specific ! 1: The slave is handled by the plc process, and by a specific
! thread in the plc, which is specified in the ThreadObject attribute. ! thread in the plc, which is specified in the ThreadObject attribute.
! 2: The slave is handled by the rt_io_comm process. ! 2: The slave is handled by the rt_io_comm process.
...@@ -4469,7 +4471,7 @@ Volume Profibus $ClassVolume 0.0.250.7 ...@@ -4469,7 +4471,7 @@ Volume Profibus $ClassVolume 0.0.250.7
! @Summary Plc thread that handles the slave. ! @Summary Plc thread that handles the slave.
! The PlcThread object of the plc thread that handles the slave. ! The PlcThread object of the plc thread that handles the slave.
! The slave is handled with the scantime of the thread. ! The slave is handled with the scantime of the thread.
! All slaves ! All slaves
!*/ !*/
Object ThreadObject $Attribute 12 14-AUG-2014 15:41:08.64 Object ThreadObject $Attribute 12 14-AUG-2014 15:41:08.64
Body SysBody 14-AUG-2014 15:41:08.64 Body SysBody 14-AUG-2014 15:41:08.64
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment