Files
sinqS7plcFW/drvS7plcFW.h
2010-09-22 13:44:37 +00:00

79 lines
2.3 KiB
C

/* $Author: anicic $ */
/* $Date: 2010/09/22 13:44:37 $ */
/* $Id: drvS7plcFW.h,v 1.1 2010/09/22 13:44:37 anicic Exp $ */
/* $Name: $ */
/* $Revision: 1.1 $ */
#ifndef drvS7plcFW_h
#define drvS7plcFW_h
#include <dbScan.h>
#ifndef __GNUC__
#define __attribute__(a)
#endif
#ifndef DEBUG
#define STATIC static
#else
#define STATIC
#endif
/* driver initialisation define */
typedef struct s7plcFWStation s7plcFWStation;
extern int s7plcFWDebug;
void s7plcFWDebugLog(int level, const char *fmt, ...)
__attribute__((format(printf, 2, 3)));
s7plcFWStation *s7plcFWOpen(char *name);
IOSCANPVT s7plcFWGetFetchScanPvt(s7plcFWStation *station);
IOSCANPVT s7plcFWGetWriteScanPvt(s7plcFWStation *station);
int s7plcFWReadArray(
s7plcFWStation *station,
unsigned int offset,
unsigned int dlen,
unsigned int nelem,
void* pdata
);
int s7plcFWWriteMaskedArray(
s7plcFWStation *station,
unsigned int offset,
unsigned int dlen,
unsigned int nelem,
void* pdata,
void* pmask
);
#define s7plcFWWriteArray(station, offset, dlen, nelem, pdata) \
s7plcFWWriteMaskedArray((station), (offset), (dlen), (nelem), (pdata), NULL)
#define s7plcFWWriteMasked(station, offset, dlen, pdata, mask) \
s7plcFWWriteMaskedArray((station), (offset), (dlen), 1, (pdata), (mask))
#define s7plcFWWrite(station, offset, dlen, pdata) \
s7plcFWWriteMaskedArray((station), (offset), (dlen), 1, (pdata), NULL)
#define s7plcFWRead(station, offset, dlen, pdata) \
s7plcFWReadArray((station), (offset), (dlen), 1, (pdata))
/************************************************************************/
/* * DRV driver error codes */
#define M_drvLib (1003<<16U)
#define drvError(CODE) (M_drvLib | (CODE))
#define S_drv_OK 0 /* success */
#define S_drv_badParam drvError(1) /*driver: bad parameter*/
#define S_drv_noMemory drvError(2) /*driver: no memory*/
#define S_drv_noDevice drvError(3) /*driver: device not configured*/
#define S_drv_invSigMode drvError(4)/*driver: signal mode conflicts with device config*/
#define S_drv_cbackChg drvError(5) /*driver: specified callback differs from previous config*/
#define S_drv_alreadyQd drvError(6)/*driver: a read request is already queued for the channel*/
#define S_drv_noConn drvError(7) /*driver: connection to plc lost*/
#endif /* drvS7plcFW_h */