⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pb_if.h

📁 profibus dp主站于从站通信
💻 H
📖 第 1 页 / 共 4 页
字号:
- CON_IND_RECEIVED          -> a confirmation or indication has been received
- NO_CON_IND_RECEIVED       -> no confirmation or indication has been received

- E_IF_FATAL_ERROR          -> unrecoverable error in PROTOCOL SW
- E_IF_INVALID_DATA_SIZE    -> size of data block provided not sufficient
- E_IF_PAPI_NOT_INITIALIZED -> API not initialized
- E_IF_OS_ERROR             -> OS error
----------------------------------------------------------------------------*/
;


FUNCTION extern INT16 CALL_CONV profi_rtx_set_data
        (
          IN  USIGN8    DataId,
          IN  USIGN16   Offset,
          IN  USIGN16   DataLength,
          IN  VOID    * pData
        )

/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION

This function is used to write data to CMI data area via PROFIBUS WinXP/Win2K RTAPI

IN:   DataId         -> data image identifier
                         - ID_DP_SLAVE_IO_IMAGE     (DPM: image for slave io data)

IN:   Offset         -> write at offset in data image
IN:   DataLength     -> length of  data to write
IN:   pData          -> pointer to data to write


possible return values:
- E_OK                          -> OK
- E_IF_SERVICE_CONSTR_CONFLICT  -> service not executable at time
- E_IF_SERVICE_NOT_SUPPORTED    -> service not supported
- E_IF_INVALID_DATA_SIZE        -> invalid user data size
- E_IF_PAPI_NOT_INITIALIZED     -> API not initialized
- E_IF_INVALID_DP_STATE         -> DP not in operate mode

-----------------------------------------------------------------------------*/
;



FUNCTION extern INT16 CALL_CONV profi_rtx_get_data
        (
          IN     USIGN8     DataId,
          IN     USIGN16    Offset,
          INOUT  USIGN16  * pDataLength,
          OUT    VOID     * pData
        )

/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION

This function is used to read data from CMI data area via PROFIBUS WinXP/Win2K RTAPI

IN:    DataId        -> data image identifier
                         - ID_DP_SLAVE_IO_IMAGE        (DPM: image for slave io data)
                         - ID_DP_STATUS_IMAGE          (DPM: image for status data)

IN:    Offset        -> read at offset in data image
INOUT: pDataLength      IN:  length of data buffer
                        OUT: length of received data
OUT:   pData         -> pointer to data buffer

possible return values:
- E_OK                          -> OK
- E_IF_SERVICE_CONSTR_CONFLICT  -> service not executable at time
- E_IF_SERVICE_NOT_SUPPORTED    -> service not supported
- E_IF_INVALID_DATA_SIZE        -> invalid user data size
- E_IF_PAPI_NOT_INITIALIZED     -> API not initialized
- E_IF_INVALID_DP_STATE         -> DP not in operate mode
-----------------------------------------------------------------------------*/
;




FUNCTION extern INT16 CALL_CONV profi_rtx_set_dps_input_data
        (
          IN    USIGN8  * pData,
          IN    USIGN8    DataLength,
          OUT   USIGN8  * pState
        )

/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION

This function is used to write DP Slave input data to DPS_SLAVE_INPUT_IMAGE via
PROFIBUS WinXP/Win2K RTAPI

IN:   pData      -> pointer to new input data
IN:   DataLength -> number bytes of input data
OUT:  pState     -> pointer to a status variable for the recent input data status

possible return values:
- E_OK                          -> OK
- E_IF_INVALID_DATA_SIZE        -> data_size does not match the expected input data size
- E_IF_NO_CNTRL_RES             -> timeout controller does not response
- E_IF_PAPI_NOT_INITIALIZED     -> API not initialized

-----------------------------------------------------------------------------*/
;




FUNCTION extern INT16 CALL_CONV profi_rtx_get_dps_input_data
        (
          OUT   USIGN8 * pData,
          INOUT USIGN8 * pDataLength,
          OUT   USIGN8 * pState
        )

/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION

This function is used to read data CMI DPS_SLAVE_INPUT_IMAGE via PROFIBUS
WinXP/Win2K RTAPI

OUT:    pData       -> destination buffer for input data
INOUT:  pDataLength -> sizeof destination buffer and number of bytes read
OUT:    pState      -> status of input data if read successfully

possible return values:
- E_OK                          -> OK
- E_IF_INVALID_DATA_SIZE        -> invalid user data size
- E_IF_PAPI_NOT_INITIALIZED     -> API not initialized

-----------------------------------------------------------------------------*/
;





FUNCTION extern INT16 CALL_CONV profi_rtx_get_dps_output_data
        (
          OUT   USIGN8 * pData,
          INOUT USIGN8 * pDataLength,
          OUT   USIGN8 * pState
        )

/*-----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION

This function is used to read data from DPS_SLAVE_OUTPUT_IMAGE via PROFIBUS
WinXP/Win2K RTAPI.

OUT:    pData       -> destination buffer for output data
INOUT:  pDataLength -> sizeof destination buffer and number of bytes read
OUT:    pState      -> status of output data if read successfully

possible return values:
- E_OK                          -> OK
- E_IF_INVALID_DATA_SIZE        -> invalid user data size
- E_IF_PAPI_NOT_INITIALIZED     -> API not initialized

-----------------------------------------------------------------------------*/
;




FUNCTION extern INT16 CALL_CONV profi_rtx_get_versions
         (
           OUT CSTRING * pPapiVersion,
           OUT CSTRING * pFirmwareVersion
         )
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION

This function is used to get the vesrion strings of PAPI and firmware.

OUT:    pPapiVersion      -> data buffer for PAPI version string
OUT:    pFirmwareVersion  -> data buffer for firmware version string

NOTE: There must be at least 100 Bytes (VERSION_STRING_LENGTH) free space for
      each INOUT buffer.

Possible return values:
- E_OK

-----------------------------------------------------------------------------*/
;



FUNCTION extern INT16 CALL_CONV profi_rtx_get_serial_device_number
         (
           OUT USIGN32 * pSerialDeviceNumber
         )
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION

This function is used to get the serial device number of the PROFIBUS
controller

OUT:  pSerialDeviceNumber -> serial device number

Possible return values:
- E_OK
- E_IF_PAPI_NOT_INITIALIZED      -> API not initialized

-----------------------------------------------------------------------------*/
;




FUNCTION extern INT16 CALL_CONV profi_rtx_get_last_error(VOID)

/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION

This function is returns the additional last error code for INTERFACE-ERRORs
controller

Possible return values:
- additional last error code

-----------------------------------------------------------------------------*/
;

#endif


#ifndef UNDER_RTSS
#ifdef  WIN32
/**********************************************************************************/
/* extern function declarations using for enhanced WinNT/Win2K PROFIBUS Interface */
/**********************************************************************************/


FUNCTION extern HANDLE CALL_CONV profi_open_basic_management
         (
           IN USIGN8 Board,
           IN USIGN8 Channel,
           IN INT32  DesiredAccess
         )
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION

This function is used to initialize the enhanced mode of the PROFIBUS API.

It opens the the BASIC MANAGEMENT DEVICE and updates the PROFIBUS firmware onto
PROFIBUS controller if necessary.

IN:  Board           -> number of the PROFIBUS board (0..9)
IN:  Channel         -> channel number
IN:  DesiredAccess   -> GENERIC_READ  specifies the read access to the device
                        GENERIC_WRITE specifies the write access to the device

Possible return values:
- open handle of BASIC MANAGEMENT DEVICE if function succeeds successfully
- INVALID_HANDLE_VALUE  if function fails

-----------------------------------------------------------------------------*/
;



FUNCTION extern HANDLE CALL_CONV profi_open
         (
           IN HANDLE  hBasicMgmtDevice,
           IN INT32   DeviceType,
           IN USIGN32 Index,
           IN INT32   DesiredAccess
         )
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION

This function is used to open a PROFIBUS device specified by 'device_type'.

IN:  hBasicMgmtDevice  -> basic management device handle
IN:  DeviceType        -> type of the device to open
                          DEVICE_DP_MANAGEMENT  -> DP management device
                          DEVICE_DP_SERVICE     -> DP service device
                          DEVICE_DP_SLAVE_DATA  -> DP slave data device
                          DEVICE_DP_MSAC        -> DP master slave acyclic device
                          DEVICE_FDL_MANAGEMENT -> FDL management device
                          DEVICE_FDL_SAP        -> FDL SAP device
                          DEVICE_FMS_MANAGEMENT -> FMS management device
                          DEVICE_FMS_CR         -> FMS CR device
IN:  Index             -> index of the device to open
                          1..128           DP service-, DP slave data- and DP/V1 service devices
                          0..63,DEFAUT_SAP FDL SAP device
                          1..64            FMS CR device
IN:  DesiredAccess     -> GENERIC_READ  specifies the read access to the device
                          GENERIC_WRITE specifies the write access to the device

Possible return values:
- open handle of the specified device if function succeeds successfuly
- INVALID_HANDLE_VALUE  if function fails

-----------------------------------------------------------------------------*/
;



FUNCTION extern BOOL CALL_CONV profi_close
         (
           IN HANDLE hDevice
         )
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION

This function is used to close a device opened with 'profi_open_basic_management'
function or 'profi_open' function.

IN:  hDevice   -> handle of the device to close

Possible return values:
- TRUE        -> device is closed
- FALSE       -> device can not be closed

-----------------------------------------------------------------------------*/
;



FUNCTION extern INT16 CALL_CONV profi_read_service
         (
           IN    HANDLE                  hDevice,
           OUT   T_PROFI_SERVICE_DESCR * pSdb,
           OUT   VOID                  * pData,
           INOUT USIGN16               * pDataLength
         )
/*----------------------------------------------------------------------------
FUNCTIONAL_DESCRIPTION

This function is used to receive a Service-Indication or a Service-Confirmation
from a PROFIBUS service device.

IN:     hDevice           -> device handle
OUT:    pSdb              -> pointer to SERVICE-DESCRIPTION-BLOCK
OUT:    pData             -> pointer to data buffer
INOUT:  pDatalen          -> IN:   length of data buffer
                             OUT:  length of received data
Possible return values:

- CON_IND_RECEIVED                 -> a confirmation or indication has been received
- NO_CON_IND_RECEIVED              -> no confirmation or indication has been received
- E_IF_NO_CNTRL_RES                -> controller does not respond
- E_IF_FATAL_ERROR                 -> unrecoverable error in PROTOCOL SW
- E_IF_CMI_ERROR                   -> serious CMI error
- E_IF_INVALID_DATA_SIZE           -> size of data block provided not sufficient
- E_IF_OS_ERROR                    -> NT system error
- E_IF_RESOURCE_UNAVAILABLE        -> no resource available
-----------------------------------------------------------------------------*/
;




FUNCTION extern INT16 CALL_CONV profi_write_service
         (
           IN HANDLE                  hDevice,
           IN T_PROFI_SERVICE_DESCR * pSdb,
           IN VOID                  * pData
         )
/*----------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -