Commit 0135e84d authored by claes's avatar claes

Profibus I/O-routines adapted to new Softing API and driver

parent a202d657
This diff is collapsed.
#define BUILD_NUMBER 52
#define BUILD_NUMBER_STR "52"
#define MAJOR_VERSION_NUMBER 5
#define MINOR_VERSION_NUMBER 26
#define VERSION_TEXT "5.26.1.00.release"
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*****************************************************************************
* *
* 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
PROJECT_NAME PROFIBUS
MODULE DPSGDL
COMPONENT_LIBRARY PAPI Lib
PAPI DLL
AUTHOR SOFTING AG
VERSION 1.20.0.00.release (DP-Slave Stand-Alone for DOS)
5.22.0.00.release (WIN95/WIN98 and WinNT)
DATE 26-February-1999
STATUS finished
FUNCTIONAL_MODULE_DESCRIPTION
This modul contains DP-Slave-Service-Specific-Functions which return the length
length of the Request- or Response-Datas.
RELATED_DOCUMENTS
=============================================================================*/
#include "keywords.h"
INCLUDES
#if defined (WIN16) || defined (WIN32)
#include <windows.h>
#endif
#include "pb_type.h"
#include "pb_if.h"
#ifndef DPS_STANDALONE_MODE
#include "pb_err.h"
#include "pb_dp.h"
#endif
#include "pb_dps.h"
FUNCTION_DECLARATIONS
LOCAL_DEFINES
LOCAL_TYPEDEFS
EXPORT_DATA
IMPORT_DATA
LOCAL_DATA
#if defined (WIN32) || defined (_WIN32) || defined (WIN16) || defined (_WIN16)
#pragma check_stack (off)
#endif
FUNCTION PUBLIC INT16 dpsgdl_get_data_len
(
IN INT16 result,
IN USIGN8 service,
IN USIGN8 primitive,
IN USIGN8 FAR* data_ptr,
OUT INT16 FAR* data_len_ptr
)
/*------------------------------------------------------------------------*/
/* FUNCTIONAL_DESCRIPTION */
/*------------------------------------------------------------------------*/
/* - returns the data length of any called PROFIBUS DP-Slave service */
/*------------------------------------------------------------------------*/
{
LOCAL_VARIABLES
T_DPS_INIT_SLAVE_REQ FAR* init_slave_req_ptr;
T_DPS_SLAVE_DIAG_REQ FAR* slave_diag_req_ptr;
FUNCTION_BODY
switch (primitive)
{
/*--- USER REQUESTS ----------------------------------------------------*/
case REQ:
{
switch (service)
{
case DPS_INIT_SLAVE :
{
init_slave_req_ptr = (T_DPS_INIT_SLAVE_REQ FAR*) data_ptr;
if ( (init_slave_req_ptr->cfg_data_len == 0 ) ||
(init_slave_req_ptr->cfg_data_len > DP_MAX_CFG_DATA_LEN) )
{
result = E_IF_INVALID_DATA_SIZE;
return (E_IF_INVALID_DATA_SIZE);
}
if (init_slave_req_ptr->enhanced_init_data_len > sizeof (init_slave_req_ptr->enhanced_init_data))
{
result = E_IF_INVALID_DATA_SIZE;
return (E_IF_INVALID_DATA_SIZE);
}
*data_len_ptr = sizeof (T_DPS_INIT_SLAVE_REQ) -
(sizeof (init_slave_req_ptr->enhanced_init_data) - init_slave_req_ptr->enhanced_init_data_len);
break;
} /* case DPS_INIT_SLAVE */
case DPS_EXIT_SLAVE : *data_len_ptr = 0; break;
case DPS_SLAVE_DIAG :
{
slave_diag_req_ptr = (T_DPS_SLAVE_DIAG_REQ FAR*) data_ptr;
if (slave_diag_req_ptr->ext_diag_data_len > DP_MAX_EXT_DIAG_DATA_LEN)
{
result = E_IF_INVALID_DATA_SIZE;
return (E_IF_INVALID_DATA_SIZE);
}
*data_len_ptr = sizeof (T_DPS_SLAVE_DIAG_REQ) - (DP_MAX_EXT_DIAG_DATA_LEN - slave_diag_req_ptr->ext_diag_data_len);
break;
}
case DPS_GET_STATUS : *data_len_ptr = 0; break;
case DPS_CHK_CFG :
case DPS_SET_PRM :
case DPS_SET_SLAVE_ADD: result = E_IF_INVALID_PRIMITIVE; return (E_IF_INVALID_PRIMITIVE);
default : result = E_IF_INVALID_SERVICE; return (E_IF_INVALID_SERVICE);
} /* switch serivce */
break;
} /* case REQ */
/*---- USER RESPONSES --------------------------------------------------*/
case RES:
{
switch (service)
{
case DPS_CHK_CFG: *data_len_ptr = sizeof (T_DPS_CHK_CFG_RES); break;
case DPS_SET_PRM: *data_len_ptr = sizeof (T_DPS_SET_PRM_RES); break;
default: result = E_IF_INVALID_SERVICE; return (E_IF_INVALID_SERVICE);
} /* switch serivce */
break;
} /* case RES */
/*---- WRONG PRIMITIVE -------------------------------------------------*/
default: result = E_IF_INVALID_PRIMITIVE; return (E_IF_INVALID_PRIMITIVE);
} /* switch primitive */
result = E_OK;
return (E_OK);
} /* dpsgdl_get_data_len */
#if defined (WIN32) || defined (_WIN32) || defined (WIN16) || defined (_WIN16)
#pragma check_stack
#endif
/*****************************************************************************
* *
* 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
PROJECT_NAME PROFIBUS
MODULE FDLGDL
COMPONENT_LIBRARY PAPI Lib
PAPI DLL
AUTHOR SOFTING AG
VERSION 5.23.0.00.release
DATE 30-October-2000
STATUS finished
FUNCTIONAL_MODULE_DESCRIPTION
This modul contains the FDL(IF)-Service-Specific-Functions which return the length
length of the Request- or Response-Datas.
RELATED_DOCUMENTS
=============================================================================*/
#include "keywords.h"
INCLUDES
#if defined (WIN16) || defined (WIN32)
#include <windows.h>
#endif
#include "pb_type.h"
#include "pb_if.h"
#include "pb_err.h"
#include "pb_fdl.h"
GLOBAL_DEFINES
LOCAL_DEFINES
EXPORT_TYPEDEFS
LOCAL_TYPEDEFS
FUNCTION_DECLARATIONS
EXPORT_DATA
IMPORT_DATA
LOCAL_DATA
#if defined (WIN32) || defined (_WIN32) || defined (WIN16) || defined (_WIN16)
#pragma check_stack (off)
#endif
FUNCTION PUBLIC INT16 fdlgdl_get_data_len
(
IN INT16 result, /* Service-Result */
IN USIGN8 service, /* Service */
IN USIGN8 primitive, /* Service-Primitive */
IN USIGN8 FAR *data_ptr, /* pointer to data */
OUT INT16 *data_len_ptr /* length of data */
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
this function is used to return the data length of FDL-SERVICES
possible return values:
- Data-length
-----------------------------------------------------------------------------*/
{
LOCAL_VARIABLES
FUNCTION_BODY
*data_len_ptr = 0;
result = E_OK;
if (primitive == REQ)
{
switch (service)
{
case FDLIF_SDA:
case FDLIF_SDN:
case FDLIF_SRD:
{
T_FDLIF_SDN_SDA_SRD_REQ FAR* req = (T_FDLIF_SDN_SDA_SRD_REQ FAR*) data_ptr;
*data_len_ptr = sizeof (T_FDLIF_SDN_SDA_SRD_REQ) + req->length;
}
break;
case FDLIF_REPLY_UPDATE:
case FDLIF_REPLY_UPDATE_MULTIPLE:
{
T_FDLIF_RUP_REQ FAR* req = (T_FDLIF_RUP_REQ FAR*) data_ptr;
*data_len_ptr = sizeof (T_FDLIF_RUP_REQ) + req->length;
}
break;
case FDLIF_SET_BUSPARAMETER:
*data_len_ptr = sizeof (T_FDLIF_SET_BUSPARAMETER_REQ);
break;
case FDLIF_READ_BUSPARAMETER:
*data_len_ptr = 0;
break;
case FDLIF_SAP_ACTIVATE:
*data_len_ptr = sizeof (T_FDLIF_SAP_ACTIVATE_REQ);
break;
case FDLIF_RSAP_ACTIVATE:
*data_len_ptr = sizeof (T_FDLIF_RSAP_ACTIVATE_REQ);
break;
case FDLIF_SAP_CHANGE_ACCESS:
*data_len_ptr = sizeof (T_FDLIF_SAP_CHANGE_REQ);
break;
case FDLIF_SAP_DEACTIVATE:
*data_len_ptr = sizeof (T_FDLIF_SAP_DEACTIVATE_REQ);
break;
case FDLIF_EXIT:
*data_len_ptr = 0;
break;
default:
*data_len_ptr = 0;
result = E_IF_INVALID_SERVICE;
break;
}
}
else
{
result = E_IF_INVALID_PRIMITIVE;
}
return(result);
}
#if defined (WIN32) || defined (_WIN32) || defined (WIN16) || defined (_WIN16)
#pragma check_stack
#endif
This diff is collapsed.
/*****************************************************************************
* *
* 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
PROJECT_NAME PROFIBUS
MODULE FMBGDL
COMPONENT_LIBRARY PAPI Lib
PAPI DLL
AUTHOR SOFTING AG
VERSION 5.21.0.00.release
DATE 27-February-1998
STATUS finished
FUNCTIONAL_MODULE_DESCRIPTION
This modul contains the Fieldbus Basic Management function which returns the
length of the request datas.
RELATED_DOCUMENTS
=============================================================================*/
#include "keywords.h"
INCLUDES
#if defined (WIN16) || defined (WIN32)
#include <windows.h>
#endif
#include "pb_type.h"
#include "pb_if.h"
#include "pb_err.h"
#include "pb_fmb.h"
GLOBAL_DEFINES
LOCAL_DEFINES
EXPORT_TYPEDEFS
LOCAL_TYPEDEFS
FUNCTION_DECLARATIONS
EXPORT_DATA
IMPORT_DATA
LOCAL_DATA
#if defined (WIN32) || defined (_WIN32) || defined (WIN16) || defined (_WIN16)
#pragma check_stack (off)
#endif
FUNCTION PUBLIC INT16 fmbgdl_get_data_len
(
IN INT16 result, /* Service-Result */
IN USIGN8 service, /* Service */
IN USIGN8 primitive, /* Service-Primitive */
IN USIGN8 FAR *data_ptr, /* pointer to data */
OUT INT16 *data_len_ptr /* length of data */
)
/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION
This function is used to return the request data length of FMB-SERVICES
possible return values:
- E_OK
- E_IF_INVALID_SERVICE
-----------------------------------------------------------------------------*/
{
LOCAL_VARIABLES
INT16 ret_val = E_OK;
FUNCTION_BODY
if (primitive == REQ)
{
switch (service)
{
case FMB_SET_CONFIGURATION:
{
T_FMB_SET_CONFIGURATION_REQ FAR* req_ptr = (T_FMB_SET_CONFIGURATION_REQ FAR*) data_ptr;
#ifdef WIN32
req_ptr->sm7_active &= 0xFE;
#else
req_ptr->sm7_active = PB_FALSE;
#endif
*data_len_ptr = sizeof(T_FMB_SET_CONFIGURATION_REQ);
}
break;
case FMB_SET_BUSPARAMETER:
*data_len_ptr = sizeof(T_FMB_SET_BUSPARAMETER_REQ);
break;
case FMB_SET_VALUE:
{
T_FMB_SET_VALUE_REQ FAR *req = (T_FMB_SET_VALUE_REQ FAR*) data_ptr;
*data_len_ptr = (sizeof (T_FMB_SET_VALUE_REQ) + req->length);
break;
}
case FMB_READ_VALUE:
*data_len_ptr = sizeof(T_FMB_READ_VALUE_REQ);
break;
case FMB_LSAP_STATUS:
*data_len_ptr = sizeof(T_FMB_LSAP_STATUS_REQ);
break;
case FMB_GET_LIVE_LIST:
case FMB_READ_BUSPARAMETER:
case FMB_EXIT:
case FMB_RESET:
*data_len_ptr = 0;
break;
default:
*data_len_ptr = 0;
ret_val = E_IF_INVALID_SERVICE;
break;
}
}
else
{
ret_val = E_IF_INVALID_PRIMITIVE;
}
return(ret_val);
}
#if defined (WIN32) || defined (_WIN32) || defined (WIN16) || defined (_WIN16)
#pragma check_stack
#endif
This diff is collapsed.
ifndef variables_mk
-include $(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/variables.mk
endif
ifndef variables_mk
include $(pwre_kroot)/tools/bld/src/$(os_name)/variables.mk
endif
vpath %.c $(hw_source):$(os_source):$(co_source)
c_sources := $(sort \
$(foreach file, \
$(foreach dir, \
$(source_dirs), \
$(wildcard $(dir)/*.c) \
), $(notdir $(file)) \
) \
)
export_c := $(addprefix $(bld_dir)/, $(patsubst %.c, %.o, $(c_sources)))
lib : $(export_lib) export_lib_local
export_lib_local : $(export_c)
@ echo "Inserting local lib"
@ $(ar) -r $(export_lib) $(export_c)
/*****************************************************************************/
/* */
/* SOFTING AG */
/* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */
/* */
/* Copyright (C) SOFTING AG 1995-2003 */
/* All Rights Reserved */
/* */
/*****************************************************************************/
/*****************************************************************************/
/* KEYWORDS */
/* */
/* Filename : KEYWORDS.H */
/* Version : 5.21.0.00.release */
/* Date : 27-February-1998 */
/* Author : SOFTING AG */
/* */
/* Description : This include file defines some keywords which are used */
/* for structuring and formatting the PROFIBUS source files. These */
/* keywords are ignored by the the compiler. */
/* */
/*****************************************************************************/
#ifndef __KEYWORDS__
#define __KEYWORDS__
#define INCLUDES
#define GLOBAL_DEFINES
#define LOCAL_DEFINES
#define EXPORT_TYPEDEFS
#define LOCAL_TYPEDEFS
#define EXPORT_DATA
#define IMPORT_DATA
#define LOCAL_DATA
#define FUNCTION
#define IN
#define OUT
#define INOUT
#define FUNCTIONAL_DESCRIPTION
#define ASSERTIONS
#define LOCAL_VARIABLES
#define FUNCTION_BODY
#define FUNCTION_DECLARATIONS
#define PUBLIC
#define GLOBAL
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*****************************************************************************/
/* */
/* SOFTING AG */
/* Richard-Reitzner-Allee 6 */
/* D-85540 Haar */
/* Phone: (++49)-(0)89-45656-0 */
/* Fax: (++49)-(0)89-45656-399 */
/* */
/* Copyright (C) SOFTING AG 1995-2003 */
/* All Rights Reserved */
/* */
/*****************************************************************************/
/*****************************************************************************/
/* PROFIBUS WINDOWS NT DRIVERS */
/* */
/* Filename : PB_IOCTL.H */
/* Version : 5.26.0.01.release */
/* Date : 30-April-2003 */
/* Author : SOFTING AG */
/* */
/* Description : This file contains the global declarations */
/* to access the PROFIBUS Drivers for Linux */
/* */
/*****************************************************************************/
#ifndef PB_IOCTL_H
#define PB_IOCTL_H
/*****************************************************************************/
/* Definitions of IO Control codes */
/*****************************************************************************/
// IOCTL-Magic for Softing-PROFIBUS is 0x69
#define IOCTL_PROFI_GET_DPRAM 0x6901
#define IOCTL_PROFI_SET_TIMEOUT 0x6902
#define IOCTL_PROFI_OPTIMIZED_MODE 0x6903
#define IOCTL_PROFI_SERIAL_NUMBER 0x6904
#define IOCTL_PROFI_STATUS_DATA 0x6905
#define IOCTL_PROFI_GET_DATA_IMAGE 0x6906
#define IOCTL_PROFI_SET_SLAVE_IN 0x6907
#define IOCTL_PROFI_DP_OPERATE 0x6908
#define IOCTL_PROFI_SET_DEBUGLEVEL 0x6909
#ifdef __KERNEL__
extern int pb_ioctl( struct inode *inode, struct file *file, unsigned int cmd,
unsigned long arg );
#endif
/*****************************************************************************/
/* Structure for data image description */
/*****************************************************************************/
typedef struct _StatusAndData {
void *StatusImage;
int StatusLength;
void *Data;
int DataLength;
} StatusAndData;
typedef struct _NTIoctl {
void *InBuf;
int InBufLength;
void *OutBuf;
int OutBufLength;
} NTIoctl;
typedef struct _DataImage {
int id;
void *Buf;
unsigned short Length; // sizeof( Buf )
} DataImage;
/*****************************************************************************/
/* Operation Mode as (FMS/DPV1-Master or DP-Slave) */
/*****************************************************************************/
#define FMS_DPV1_MASTER_MODE 0x00 // FMS/DPV1-Master
#define DPV1_MASTER_MODE 0x01 // for future use
#define DPV1_SLAVE_MODE 0x02 // DP-Slave
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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