Moved header files and changed Makefiles to get rid of inc build step.
This commit is contained in:
@@ -1,6 +1,16 @@
|
||||
TOP = ../../..
|
||||
include $(TOP)/config/CONFIG_BASE
|
||||
|
||||
INC += drvTS.h
|
||||
INC += fast_lock.h
|
||||
INC += devSup.h
|
||||
INC += drvSup.h
|
||||
INC += caeventmask.h
|
||||
INC += asLib.h
|
||||
INC += cadef.h
|
||||
INC += caerr.h
|
||||
INC += asDbLib.h
|
||||
|
||||
INC += dbDefs.h
|
||||
INC += camacLib.h
|
||||
INC += epicsTypes.h
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/* share/epicsH/dbAsLib.h */
|
||||
/* $Id$ */
|
||||
/* Author: Marty Kraimer Date: 02-23-94*/
|
||||
/*****************************************************************
|
||||
COPYRIGHT NOTIFICATION
|
||||
*****************************************************************
|
||||
|
||||
(C) COPYRIGHT 1993 UNIVERSITY OF CHICAGO
|
||||
|
||||
This software was developed under a United States Government license
|
||||
described on the COPYRIGHT_UniversityOfChicago file included as part
|
||||
of this distribution.
|
||||
**********************************************************************/
|
||||
|
||||
/*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 02-23-94 mrk Initial Implementation
|
||||
*/
|
||||
|
||||
#ifndef INCdbAsLibh
|
||||
#define INCdbAsLibh
|
||||
#include <asLib.h>
|
||||
#include <callback.h>
|
||||
|
||||
typedef struct {
|
||||
CALLBACK callback;
|
||||
long status;
|
||||
} ASDBCALLBACK;
|
||||
|
||||
int asSetFilename(char *acf);
|
||||
int asSetSubstitutions(char *substitutions);
|
||||
int asInit(void);
|
||||
int asInitAsyn(ASDBCALLBACK *pcallback);
|
||||
int asDbGetAsl( void *paddr);
|
||||
ASMEMBERPVT asDbGetMemberPvt( void *paddr);
|
||||
int asdbdump( void);
|
||||
int aspuag(char *uagname);
|
||||
int asphag(char *hagname);
|
||||
int asprules(char *asgname);
|
||||
int aspmem(char *asgname,int clients);
|
||||
void asCaStart(void);
|
||||
void asCaStop(void);
|
||||
|
||||
#endif /*INCdbAsLibh*/
|
||||
@@ -0,0 +1,192 @@
|
||||
/* $Id$ */
|
||||
/* Author: Marty Kraimer Date: 09-27-93*/
|
||||
/*****************************************************************
|
||||
COPYRIGHT NOTIFICATION
|
||||
*****************************************************************
|
||||
|
||||
(C) COPYRIGHT 1993 UNIVERSITY OF CHICAGO
|
||||
|
||||
This software was developed under a United States Government license
|
||||
described on the COPYRIGHT_UniversityOfChicago file included as part
|
||||
of this distribution.
|
||||
**********************************************************************/
|
||||
|
||||
/*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 09-27-93 mrk Initial Implementation
|
||||
*/
|
||||
#ifndef INCasLibh
|
||||
#define INCasLibh
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errMdef.h>
|
||||
#include <ellLib.h>
|
||||
|
||||
typedef struct asgMember *ASMEMBERPVT;
|
||||
typedef struct asgClient *ASCLIENTPVT;
|
||||
typedef int (*ASINPUTFUNCPTR)(char *buf,int max_size);
|
||||
typedef enum{
|
||||
asClientCOAR /*Change of access rights*/
|
||||
/*For now this is all*/
|
||||
} asClientStatus;
|
||||
|
||||
typedef void (*ASCLIENTCALLBACK) (ASCLIENTPVT,asClientStatus);
|
||||
/* The following routines are macros with the following syntax
|
||||
long asCheckGet(ASCLIENTPVT asClientPvt);
|
||||
long asCheckPut(ASCLIENTPVT asClientPvt);
|
||||
*/
|
||||
#define asCheckGet(asClientPvt)\
|
||||
(asActive ?\
|
||||
((asClientPvt)->access>=asREAD ? TRUE : FALSE)\
|
||||
: TRUE)
|
||||
#define asCheckPut(asClientPvt)\
|
||||
(asActive ?\
|
||||
((asClientPvt)->access>=asWRITE ? TRUE : FALSE)\
|
||||
: TRUE)
|
||||
|
||||
epicsShareFunc int epicsShareAPI asInit(void);
|
||||
epicsShareFunc long epicsShareAPI asInitialize(ASINPUTFUNCPTR inputfunction);
|
||||
epicsShareFunc long epicsShareAPI asInitFile(const char *filename,const char *substitutions);
|
||||
epicsShareFunc long epicsShareAPI asInitFP(FILE *fp,const char *substitutions);
|
||||
/*caller must provide permanent storage for asgName*/
|
||||
epicsShareFunc long epicsShareAPI asAddMember(ASMEMBERPVT *asMemberPvt,char *asgName);
|
||||
epicsShareFunc long epicsShareAPI asRemoveMember(ASMEMBERPVT *asMemberPvt);
|
||||
/*caller must provide permanent storage for newAsgName*/
|
||||
epicsShareFunc long epicsShareAPI asChangeGroup(ASMEMBERPVT *asMemberPvt,char *newAsgName);
|
||||
epicsShareFunc void * epicsShareAPI asGetMemberPvt(ASMEMBERPVT asMemberPvt);
|
||||
epicsShareFunc void epicsShareAPI asPutMemberPvt(ASMEMBERPVT asMemberPvt,void *userPvt);
|
||||
/*client must provide permanent storage for user and host*/
|
||||
epicsShareFunc long epicsShareAPI asAddClient(ASCLIENTPVT *asClientPvt,ASMEMBERPVT asMemberPvt,
|
||||
int asl,char *user,char *host);
|
||||
/*client must provide permanent storage for user and host*/
|
||||
epicsShareFunc long epicsShareAPI asChangeClient(ASCLIENTPVT asClientPvt,int asl,char *user,char *host);
|
||||
epicsShareFunc long epicsShareAPI asRemoveClient(ASCLIENTPVT *asClientPvt);
|
||||
epicsShareFunc void * epicsShareAPI asGetClientPvt(ASCLIENTPVT asClientPvt);
|
||||
epicsShareFunc void epicsShareAPI asPutClientPvt(ASCLIENTPVT asClientPvt,void *userPvt);
|
||||
epicsShareFunc long epicsShareAPI asRegisterClientCallback(ASCLIENTPVT asClientPvt,
|
||||
ASCLIENTCALLBACK pcallback);
|
||||
epicsShareFunc long epicsShareAPI asComputeAllAsg(void);
|
||||
/* following declared below after ASG is declared
|
||||
epicsShareFunc long epicsShareAPI asComputeAsg(ASG *pasg);
|
||||
*/
|
||||
epicsShareFunc long epicsShareAPI asCompute(ASCLIENTPVT asClientPvt);
|
||||
epicsShareFunc int epicsShareAPI asDump(void (*memcallback)(ASMEMBERPVT),
|
||||
void (*clientcallback)(ASCLIENTPVT),int verbose);
|
||||
epicsShareFunc int epicsShareAPI asDumpUag(char *uagname);
|
||||
epicsShareFunc int epicsShareAPI asDumpHag(char *hagname);
|
||||
epicsShareFunc int epicsShareAPI asDumpRules(char *asgname);
|
||||
epicsShareFunc int epicsShareAPI asDumpMem(char *asgname,void (*memcallback)(ASMEMBERPVT),int clients);
|
||||
epicsShareFunc int epicsShareAPI asDumpHash(void);
|
||||
|
||||
#define S_asLib_clientsExist (M_asLib| 1) /*Client Exists*/
|
||||
#define S_asLib_noUag (M_asLib| 2) /*User Access Group does not exist*/
|
||||
#define S_asLib_noHag (M_asLib| 3) /*Host Access Group does not exist*/
|
||||
#define S_asLib_noAccess (M_asLib| 4) /*access security: no access allowed*/
|
||||
#define S_asLib_noModify (M_asLib| 5) /*access security: no modification allowed*/
|
||||
#define S_asLib_badConfig (M_asLib| 6) /*access security: bad configuration file*/
|
||||
#define S_asLib_badCalc (M_asLib| 7) /*access security: bad calculation espression*/
|
||||
#define S_asLib_dupAsg (M_asLib| 8) /*Duplicate Access Security Group */
|
||||
#define S_asLib_InitFailed (M_asLib| 9) /*access security: Init failed*/
|
||||
#define S_asLib_asNotActive (M_asLib|10) /*access security is not active*/
|
||||
#define S_asLib_badMember (M_asLib|11) /*access security: bad ASMEMBERPVT*/
|
||||
#define S_asLib_badClient (M_asLib|12) /*access security: bad ASCLIENTPVT*/
|
||||
#define S_asLib_badAsg (M_asLib|13) /*access security: bad ASG*/
|
||||
#define S_asLib_noMemory (M_asLib|14) /*access security: no Memory */
|
||||
|
||||
/*Private declarations */
|
||||
#define ASMAXINP 12
|
||||
extern int asActive;
|
||||
/* definition of access rights*/
|
||||
typedef enum{asNOACCESS,asREAD,asWRITE} asAccessRights;
|
||||
|
||||
/*Base pointers for access security*/
|
||||
typedef struct asBase{
|
||||
ELLLIST uagList;
|
||||
ELLLIST hagList;
|
||||
ELLLIST asgList;
|
||||
void *phash;
|
||||
} ASBASE;
|
||||
/*Defs for User Access Groups*/
|
||||
typedef struct{
|
||||
ELLNODE node;
|
||||
char *user;
|
||||
} UAGNAME;
|
||||
typedef struct uag{
|
||||
ELLNODE node;
|
||||
char *name;
|
||||
ELLLIST list; /*list of UAGNAME*/
|
||||
} UAG;
|
||||
/*Defs for Host Access Groups*/
|
||||
typedef struct{
|
||||
ELLNODE node;
|
||||
char *host;
|
||||
} HAGNAME;
|
||||
typedef struct hag{
|
||||
ELLNODE node;
|
||||
char *name;
|
||||
ELLLIST list; /*list of HAGNAME*/
|
||||
} HAG;
|
||||
/*Defs for Access SecurityGroups*/
|
||||
typedef struct {
|
||||
ELLNODE node;
|
||||
UAG *puag;
|
||||
}ASGUAG;
|
||||
typedef struct {
|
||||
ELLNODE node;
|
||||
HAG *phag;
|
||||
}ASGHAG;
|
||||
typedef struct{
|
||||
ELLNODE node;
|
||||
asAccessRights access;
|
||||
int level;
|
||||
int inpUsed; /*mask for which inputs are used*/
|
||||
int result; /*Result of calc converted to TRUE/FALSE*/
|
||||
char *calc;
|
||||
void *rpcl;
|
||||
ELLLIST uagList; /*List of ASGUAG*/
|
||||
ELLLIST hagList; /*List of ASGHAG*/
|
||||
} ASGRULE;
|
||||
typedef struct{
|
||||
ELLNODE node;
|
||||
char *inp;
|
||||
void *capvt;
|
||||
struct asg *pasg;
|
||||
int inpIndex;
|
||||
}ASGINP;
|
||||
|
||||
typedef struct asg{
|
||||
ELLNODE node;
|
||||
char *name;
|
||||
ELLLIST inpList;
|
||||
ELLLIST ruleList;
|
||||
ELLLIST memberList;
|
||||
double *pavalue; /*pointer to array of input values*/
|
||||
int inpBad; /*mask for which inputs are bad*/
|
||||
int inpChanged; /*mask showing inputs that have changed*/
|
||||
} ASG;
|
||||
typedef struct asgMember {
|
||||
ELLNODE node;
|
||||
ASG *pasg;
|
||||
ELLLIST clientList;
|
||||
char *asgName;
|
||||
void *userPvt;
|
||||
} ASGMEMBER;
|
||||
typedef struct asgClient {
|
||||
ELLNODE node;
|
||||
ASGMEMBER *pasgMember;
|
||||
char *user;
|
||||
char *host;
|
||||
void *userPvt;
|
||||
ASCLIENTCALLBACK pcallback;
|
||||
int level;
|
||||
asAccessRights access;
|
||||
} ASGCLIENT;
|
||||
|
||||
epicsShareFunc long epicsShareAPI asComputeAsg(ASG *pasg);
|
||||
/*following is "friend" function*/
|
||||
void * asCalloc(size_t nobj,size_t size);
|
||||
|
||||
#endif /*INCasLibh*/
|
||||
+1184
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,235 @@
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* L O S A L A M O S */
|
||||
/* Los Alamos National Laboratory */
|
||||
/* Los Alamos, New Mexico 87545 */
|
||||
/* */
|
||||
/* Copyright, 1986, The Regents of the University of California. */
|
||||
/* */
|
||||
/* Author: Jeffrey O. Hill */
|
||||
/* */
|
||||
/* History */
|
||||
/* ------- */
|
||||
/* */
|
||||
/* Date Programmer Comments */
|
||||
/* ---- ---------- -------- */
|
||||
/* 08--87 joh Init Release */
|
||||
/* 031290 joh Changed __CAERR__ to INCLcaerrh */
|
||||
/* 102990 joh added readonly for VAXC share image */
|
||||
/* 032092 joh added ECA_BADMASK */
|
||||
/* 072792 joh added ECA_IODONE & ECA_IOINPROGESS */
|
||||
/* 102992 joh changed wording on the no vx fp message */
|
||||
/* 011494 joh Added ECA_BADSYNCGRP */
|
||||
/* 021194 joh Added ECA_PUTCBINPROG */
|
||||
/* */
|
||||
/*_begin */
|
||||
/************************************************************************/
|
||||
/* */
|
||||
/* Name: */
|
||||
/* Title: */
|
||||
/* File: */
|
||||
/* Environment: VMS, UNIX, VRTX */
|
||||
/* Equipment: VAX, SUN, VME */
|
||||
/* */
|
||||
/* */
|
||||
/* Purpose */
|
||||
/* ------- */
|
||||
/* */
|
||||
/* CA error message declaration include file */
|
||||
/* */
|
||||
/* */
|
||||
/* Special comments */
|
||||
/* ------- -------- */
|
||||
/* */
|
||||
/************************************************************************/
|
||||
/*_end */
|
||||
|
||||
#ifndef INCLcaerrh
|
||||
#define INCLcaerrh
|
||||
|
||||
#include "shareLib.h"
|
||||
#include "epicsTypes.h"
|
||||
|
||||
#ifndef HDRVERSIONID
|
||||
# define HDRVERSIONID(NAME,VERS)
|
||||
#endif /*HDRVERSIONID*/
|
||||
|
||||
HDRVERSIONID(caerrh, "@(#) $Id$")
|
||||
|
||||
/* CA Status Code Definitions */
|
||||
|
||||
#define CA_K_INFO 3 /* successful */
|
||||
#define CA_K_ERROR 2 /* failed- continue */
|
||||
#define CA_K_SUCCESS 1 /* successful */
|
||||
#define CA_K_WARNING 0 /* unsuccessful */
|
||||
#define CA_K_SEVERE 4 /* failed- quit */
|
||||
#define CA_K_FATAL CA_K_ERROR | CA_K_SEVERE
|
||||
|
||||
#define CA_M_MSG_NO 0x0000FFF8
|
||||
#define CA_M_SEVERITY 0x00000007
|
||||
#define CA_M_LEVEL 0x00000003
|
||||
#define CA_M_SUCCESS 0x00000001
|
||||
#define CA_M_ERROR 0x00000002
|
||||
#define CA_M_SEVERE 0x00000004
|
||||
|
||||
#define CA_S_MSG_NO 0x0D
|
||||
#define CA_S_SEVERITY 0x03
|
||||
|
||||
#define CA_V_MSG_NO 0x03
|
||||
#define CA_V_SEVERITY 0x00
|
||||
#define CA_V_SUCCESS 0x00
|
||||
|
||||
/* Define MACROS to extract/insert individual fields from a status value */
|
||||
|
||||
#define CA_EXTRACT_MSG_NO(code)\
|
||||
( ( (code) & CA_M_MSG_NO ) >> CA_V_MSG_NO )
|
||||
#define CA_EXTRACT_SEVERITY(code)\
|
||||
( ( (code) & CA_M_SEVERITY ) >> CA_V_SEVERITY )
|
||||
#define CA_EXTRACT_SUCCESS(code)\
|
||||
( ( (code) & CA_M_SUCCESS ) >> CA_V_SUCCESS )
|
||||
|
||||
#define CA_INSERT_MSG_NO(code)\
|
||||
( ((code)<< CA_V_MSG_NO) & CA_M_MSG_NO )
|
||||
#define CA_INSERT_SEVERITY(code)\
|
||||
( ((code)<< CA_V_SEVERITY)& CA_M_SEVERITY )
|
||||
#define CA_INSERT_SUCCESS(code)\
|
||||
( ((code)<< CA_V_SUCCESS) & CA_M_SUCCESS )
|
||||
|
||||
|
||||
#define DEFMSG(SEVERITY,NUMBER)\
|
||||
(CA_INSERT_MSG_NO(NUMBER) | CA_INSERT_SEVERITY(SEVERITY))
|
||||
|
||||
|
||||
#define ECA_NORMAL DEFMSG(CA_K_SUCCESS, 0)
|
||||
#define ECA_MAXIOC DEFMSG(CA_K_ERROR, 1)
|
||||
#define ECA_UKNHOST DEFMSG(CA_K_ERROR, 2)
|
||||
#define ECA_UKNSERV DEFMSG(CA_K_ERROR, 3)
|
||||
#define ECA_SOCK DEFMSG(CA_K_ERROR, 4)
|
||||
#define ECA_CONN DEFMSG(CA_K_WARNING, 5)
|
||||
#define ECA_ALLOCMEM DEFMSG(CA_K_WARNING, 6)
|
||||
#define ECA_UKNCHAN DEFMSG(CA_K_WARNING, 7)
|
||||
#define ECA_UKNFIELD DEFMSG(CA_K_WARNING, 8)
|
||||
#define ECA_TOLARGE DEFMSG(CA_K_ERROR, 9)
|
||||
#define ECA_TIMEOUT DEFMSG(CA_K_WARNING, 10)
|
||||
#define ECA_NOSUPPORT DEFMSG(CA_K_WARNING, 11)
|
||||
#define ECA_STRTOBIG DEFMSG(CA_K_WARNING, 12)
|
||||
#define ECA_DISCONNCHID DEFMSG(CA_K_ERROR, 13)
|
||||
#define ECA_BADTYPE DEFMSG(CA_K_ERROR, 14)
|
||||
#define ECA_CHIDNOTFND DEFMSG(CA_K_INFO, 15)
|
||||
#define ECA_CHIDRETRY DEFMSG(CA_K_INFO, 16)
|
||||
#define ECA_INTERNAL DEFMSG(CA_K_FATAL, 17)
|
||||
#define ECA_DBLCLFAIL DEFMSG(CA_K_WARNING, 18)
|
||||
#define ECA_GETFAIL DEFMSG(CA_K_WARNING, 19)
|
||||
#define ECA_PUTFAIL DEFMSG(CA_K_WARNING, 20)
|
||||
#define ECA_ADDFAIL DEFMSG(CA_K_WARNING, 21)
|
||||
#define ECA_BADCOUNT DEFMSG(CA_K_WARNING, 22)
|
||||
#define ECA_BADSTR DEFMSG(CA_K_ERROR, 23)
|
||||
#define ECA_DISCONN DEFMSG(CA_K_WARNING, 24)
|
||||
#define ECA_DBLCHNL DEFMSG(CA_K_WARNING, 25)
|
||||
#define ECA_EVDISALLOW DEFMSG(CA_K_ERROR, 26)
|
||||
#define ECA_BUILDGET DEFMSG(CA_K_WARNING, 27)
|
||||
#define ECA_NEEDSFP DEFMSG(CA_K_WARNING, 28)
|
||||
#define ECA_OVEVFAIL DEFMSG(CA_K_WARNING, 29)
|
||||
#define ECA_BADMONID DEFMSG(CA_K_ERROR, 30)
|
||||
#define ECA_NEWADDR DEFMSG(CA_K_WARNING, 31)
|
||||
#define ECA_NEWCONN DEFMSG(CA_K_INFO, 32)
|
||||
#define ECA_NOCACTX DEFMSG(CA_K_WARNING, 33)
|
||||
#define ECA_DEFUNCT DEFMSG(CA_K_FATAL, 34)
|
||||
#define ECA_EMPTYSTR DEFMSG(CA_K_WARNING, 35)
|
||||
#define ECA_NOREPEATER DEFMSG(CA_K_WARNING, 36)
|
||||
#define ECA_NOCHANMSG DEFMSG(CA_K_WARNNING, 37)
|
||||
#define ECA_DLCKREST DEFMSG(CA_K_WARNING, 38)
|
||||
#define ECA_SERVBEHIND DEFMSG(CA_K_WARNING, 39)
|
||||
#define ECA_NOCAST DEFMSG(CA_K_WARNING, 40)
|
||||
#define ECA_BADMASK DEFMSG(CA_K_ERROR, 41)
|
||||
#define ECA_IODONE DEFMSG(CA_K_INFO, 42)
|
||||
#define ECA_IOINPROGRESS DEFMSG(CA_K_INFO, 43)
|
||||
#define ECA_BADSYNCGRP DEFMSG(CA_K_ERROR, 44)
|
||||
#define ECA_PUTCBINPROG DEFMSG(CA_K_ERROR, 45)
|
||||
#define ECA_NORDACCESS DEFMSG(CA_K_WARNING, 46)
|
||||
#define ECA_NOWTACCESS DEFMSG(CA_K_WARNING, 47)
|
||||
#define ECA_ANACHRONISM DEFMSG(CA_K_ERROR, 48)
|
||||
#define ECA_NOSEARCHADDR DEFMSG(CA_K_WARNING, 49)
|
||||
#define ECA_NOCONVERT DEFMSG(CA_K_WARNING, 50)
|
||||
#define ECA_BADCHID DEFMSG(CA_K_ERROR, 51)
|
||||
#define ECA_BADFUNCPTR DEFMSG(CA_K_ERROR, 52)
|
||||
|
||||
#ifndef CA_ERROR_GLBLSOURCE
|
||||
epicsShareExtern READONLY char *ca_message_text[];
|
||||
#else
|
||||
READONLY char *ca_message_text[]
|
||||
=
|
||||
{
|
||||
"Normal successful completion",
|
||||
"Maximum simultaneous IOC connections exceeded",
|
||||
"Unknown internet host",
|
||||
"Unknown internet service",
|
||||
"Unable to allocate a new socket",
|
||||
"Unable to connect to internet host or service",
|
||||
"Unable to allocate additional dynamic memory",
|
||||
"Unknown IO channel",
|
||||
"Record field specified inappropriate for channel specified",
|
||||
"The array or data structure specified will not fit in CA message buffer",
|
||||
"User specified timeout on IO operation expired",
|
||||
"Sorry, that feature is planned but not supported at this time",
|
||||
"The supplied string is unusually large",
|
||||
"The request was ignored because the specified channel is disconnected",
|
||||
"The type you have requested from this channel is unknown",
|
||||
"Remote Channel not found",
|
||||
"Unable to locate all user specified channels",
|
||||
"Channel Access Internal Failure",
|
||||
"The requested local DB operation failed",
|
||||
"Could not perform a database value get for that channel",
|
||||
"Could not perform a database value put for that channel",
|
||||
"Could not perform a database event add for that channel",
|
||||
"Count requested inappropriate for that channel",
|
||||
"The supplied string has improper format",
|
||||
"Network connection lost",
|
||||
"Ambiguous channel host (multiple IOC's have a channel by that name)",
|
||||
"The CA routine called is inappropriate for use within an event handler",
|
||||
"Database value get for that channel failed during channel search",
|
||||
"Unable to initialize without the vxWorks VX_FP_TASK task option set",
|
||||
"Event queue overflow has prevented first pass event after event add",
|
||||
"A monitor by that id cant be found",
|
||||
"Remote channel has new network address",
|
||||
"New or resumed network connection",
|
||||
"Specified task isnt a member of a CA context",
|
||||
"Attempt to use defunct CA feature failed",
|
||||
"The supplied string is empty",
|
||||
"Unable to spawn the CA repeater thread- auto reconnect will fail",
|
||||
"No channel id match for search reply- search reply ignored",
|
||||
"Reseting dead connection- will try to reconnect",
|
||||
"Server (IOC) has fallen behind or is not responding- still waiting",
|
||||
"No internet interface with broadcast available",
|
||||
"The event selection mask supplied is empty or inappropriate",
|
||||
"IO operations have completed",
|
||||
"IO operations are in progress",
|
||||
"Invalid synchronous group identifier",
|
||||
"Put call back operation collision with put call back operation in progress",
|
||||
"Read access denied",
|
||||
"Write access denied",
|
||||
"Sorry, that anachronistic feature of CA is no longer supported",
|
||||
"The search request/beacon address list was empty after initialization",
|
||||
"Data conversion between client's type and the server's type failed",
|
||||
"Invalid channel identifier",
|
||||
"Invalid function pointer"
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef __STDC__
|
||||
#define CAERR_USE_FUNC_PROTO
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifndef CAERR_USE_FUNC_PROTO
|
||||
#define CAERR_USE_FUNC_PROTO
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CAERR_USE_FUNC_PROTO
|
||||
epicsShareFunc READONLY char * epicsShareAPI ca_message(long ca_status);
|
||||
#else /* CAERR_USE_FUNC_PROTO */
|
||||
READONLY char *ca_message();
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
$Id$
|
||||
caeventmask.h
|
||||
|
||||
Modification History
|
||||
joh 04-16-90 Created
|
||||
|
||||
*/
|
||||
|
||||
#ifndef INCLcaeventmaskh
|
||||
#define INCLcaeventmaskh
|
||||
|
||||
/*
|
||||
event selections
|
||||
(If any more than 8 of these are needed then update the
|
||||
select field in the event_block struct in db_event.c from
|
||||
unsigned char to unsigned short)
|
||||
|
||||
|
||||
DBE_VALUE
|
||||
Trigger an event when a significant change in the channel's value
|
||||
occurs. Relies on the monitor deadband field under DCT.
|
||||
|
||||
DBE_LOG
|
||||
Trigger an event when an archive significant change in the channel's
|
||||
valuue occurs. Relies on the archiver monitor deadband field under DCT.
|
||||
|
||||
DBE_ALARM
|
||||
Trigger an event when the alarm state changes
|
||||
|
||||
*/
|
||||
#define DBE_VALUE (1<<0)
|
||||
#define DBE_LOG (1<<1)
|
||||
#define DBE_ALARM (1<<2)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,66 @@
|
||||
/* devSup.h Device Support */
|
||||
/* share/epicsH $Id$ */
|
||||
/*
|
||||
* Author: Marty Kraimer
|
||||
* Date: 6-1-90
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 10-04-91 jba Added error message
|
||||
* .02 05-18-92 rcz Changed macro "GET_DEVSUP(" to "GET_PDEVSUP(precDevSup,"
|
||||
* .03 05-18-92 rcz Structure devSup changed element name from dsetName to papDsetName
|
||||
* .04 05-18-92 rcz New database access
|
||||
*/
|
||||
|
||||
#ifndef INCdevSuph
|
||||
#define INCdevSuph 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
typedef long (*DEVSUPFUN)(void*); /* ptr to device support function*/
|
||||
#else
|
||||
typedef long (*DEVSUPFUN)(); /* ptr to device support function*/
|
||||
#endif
|
||||
|
||||
struct dset { /* device support entry table */
|
||||
long number; /*number of support routines*/
|
||||
DEVSUPFUN report; /*print report*/
|
||||
DEVSUPFUN init; /*init support*/
|
||||
DEVSUPFUN init_record; /*init support for particular record*/
|
||||
DEVSUPFUN get_ioint_info; /* get io interrupt information*/
|
||||
/*other functions are record dependent*/
|
||||
};
|
||||
|
||||
#define S_dev_noDevSup (M_devSup| 1) /*SDR_DEVSUP: Device support missing*/
|
||||
#define S_dev_noDSET (M_devSup| 3) /*Missing device support entry table*/
|
||||
#define S_dev_missingSup (M_devSup| 5) /*Missing device support routine*/
|
||||
#define S_dev_badInpType (M_devSup| 7) /*Bad INP link type*/
|
||||
#define S_dev_badOutType (M_devSup| 9) /*Bad OUT link type*/
|
||||
#define S_dev_badInitRet (M_devSup|11) /*Bad init_rec return value */
|
||||
#define S_dev_badBus (M_devSup|13) /*Illegal bus type*/
|
||||
#define S_dev_badCard (M_devSup|15) /*Illegal or nonexistant module*/
|
||||
#define S_dev_badSignal (M_devSup|17) /*Illegal signal*/
|
||||
#define S_dev_NoInit (M_devSup|19) /*No init*/
|
||||
#define S_dev_Conflict (M_devSup|21) /*Multiple records accessing same signal*/
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,51 @@
|
||||
/* drvSup.h Driver Support */
|
||||
/* share/epicsH $Id$ */
|
||||
|
||||
/*
|
||||
* Author: Marty Kraimer
|
||||
* Date: 6-1-90
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 05-21-92 rcz changed drvetName to papDrvName
|
||||
* .02 05-18-92 rcz New database access (removed extern)
|
||||
*/
|
||||
|
||||
#ifndef INCdrvSuph
|
||||
#define INCdrvSuph 1
|
||||
|
||||
typedef long (*DRVSUPFUN) (); /* ptr to driver support function*/
|
||||
|
||||
struct drvet { /* driver entry table */
|
||||
long number; /*number of support routines*/
|
||||
DRVSUPFUN report; /*print report*/
|
||||
DRVSUPFUN init; /*init support*/
|
||||
/*other functions are device dependent*/
|
||||
};
|
||||
#define DRVETNUMBER ( (sizeof(struct drvet) -sizeof(long))/sizeof(DRVSUPFUN) )
|
||||
|
||||
#define S_drv_noDrvSup (M_drvSup| 1) /*SDR_DRVSUP: Driver support missing*/
|
||||
#define S_drv_noDrvet (M_drvSup| 3) /*Missing driver support entry table*/
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,255 @@
|
||||
#ifndef __DRVTS_h__
|
||||
#define __DRVTS_h__
|
||||
|
||||
/*
|
||||
* $Log$
|
||||
* Revision 1.3 1998/09/29 14:11:03 mrk
|
||||
* TSsetClockFromUnix was made global
|
||||
*
|
||||
* Revision 1.2 1998/03/19 20:41:16 mrk
|
||||
* Checked for Y2K complience. It turns out it was even ok when NTP time overflows
|
||||
* in 2036. However it was modified so that no overflows should occur while convert
|
||||
* ing between NTP, UNIX, and EPICS epochs.
|
||||
* In addition the conversion of fractions of a second to nanaoseconds was changed
|
||||
* Formatting was changed so that interesting code does not run off right side of page.
|
||||
* Hopefully EPICS base is now fine for Y2K.
|
||||
* In fact it should be fine (as far as time is converned) until the Unix epoch
|
||||
* overflows a 32 unsigned integer in the year 2106.
|
||||
*
|
||||
* Revision 1.1 1996/01/25 21:11:56 mrk
|
||||
* moved includes; .ascii=> .db; path changes
|
||||
*
|
||||
* Revision 1.12 1995/08/30 15:39:07 jbk
|
||||
* Added global variables for force accurate time stamps and direct time.
|
||||
*
|
||||
* Revision 1.11 1995/08/18 13:18:13 mrk
|
||||
* Added function prototypes for ansi c
|
||||
*
|
||||
* Revision 1.10 1995/08/17 20:35:52 jbk
|
||||
* fixed the debug macro to work with -pendantic option (yuck)
|
||||
*
|
||||
* Revision 1.9 1995/08/17 19:44:08 jbk
|
||||
* Added a new utility function to get the first of the year time stamp.
|
||||
*
|
||||
* Revision 1.8 1995/08/16 19:04:20 jbk
|
||||
* corrected vxworks time troubles
|
||||
*
|
||||
* Revision 1.7 1995/05/22 15:22:24 jbk
|
||||
* changes TS_EXTERN thing
|
||||
*
|
||||
* Revision 1.6 1995/02/01 15:30:17 winans
|
||||
* Added a type field to the configure command to disable the use of the event
|
||||
* system hardware if desired.
|
||||
*
|
||||
* Revision 1.5 1994/10/31 20:36:17 jbk
|
||||
* added new stuff
|
||||
*
|
||||
*/
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* Author: Jim Kowalkowski
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 01-06-94 jbk initial version
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
/*****************************************************************
|
||||
COPYRIGHT NOTIFICATION
|
||||
*****************************************************************
|
||||
|
||||
(C) COPYRIGHT 1993 UNIVERSITY OF CHICAGO
|
||||
|
||||
This software was developed under a United States Government license
|
||||
described on the COPYRIGHT_UniversityOfChicago file included as part
|
||||
of this distribution.
|
||||
**********************************************************************/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <timers.h>
|
||||
#include <semLib.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <tsDefs.h>
|
||||
|
||||
#ifdef TS_DRIVER
|
||||
#define TS_EXTERN
|
||||
#else
|
||||
#define TS_EXTERN extern
|
||||
#endif
|
||||
|
||||
#define ER_EVENT_RESET_TICK 0x7d /* Reset the tick counter */
|
||||
|
||||
#define TS_MAGIC ('T'<<24|'S'<<16|'d'<<8|'r')
|
||||
#define TS_SLAVE_PORT 18322
|
||||
#define TS_MASTER_PORT 18323
|
||||
#define TS_RETRY_COUNT 4
|
||||
#define TS_TIME_OUT_MS 250
|
||||
#define TS_SECS_ASYNC_TRY_MASTER (60*5) /* every five minutes */
|
||||
#define TS_SECS_SYNC_TRY_MASTER (60*1) /* every one minute */
|
||||
|
||||
#define UDP_TIME_PORT 37
|
||||
#define UDP_NTP_PORT 123
|
||||
|
||||
#define TS_BILLION 1000000000
|
||||
#define TS_SYNC_RATE_SEC 10
|
||||
#define TS_CLOCK_RATE_HZ 1000
|
||||
#define TS_TOTAL_EVENTS 128
|
||||
/*Following is (SEC_IN_YEAR*90)+(22*SEC_IN_DAY) */
|
||||
/*22 is leap years from 1900 to 1990*/
|
||||
#define TS_1900_TO_EPICS_EPOCH 2840140800UL
|
||||
/*Following is (SEC_IN_YEAR*70)+(17*SEC_IN_DAY) */
|
||||
/*17 is leap years from 1900 to 1970*/
|
||||
#define TS_1900_TO_VXWORKS_EPOCH 2208988800UL
|
||||
/*Following is (SEC_IN_YEAR*20)+(5*SEC_IN_DAY) */
|
||||
/*5 is leap years from 1970 to 1990*/
|
||||
#define TS_VXWORKS_TO_EPICS_EPOCH 631152000UL
|
||||
|
||||
#define TS_STAMP_SERVER_PRI 70
|
||||
#define TS_SYNC_SERVER_PRI 70
|
||||
#define TS_SYNC_CLIENT_PRI 70
|
||||
#define TS_ASYNC_CLIENT_PRI 70
|
||||
|
||||
typedef enum { TS_time_request, TS_sync_request, TS_sync_msg } TStype;
|
||||
typedef enum { TS_master_alive, TS_master_dead } TSstate;
|
||||
typedef enum { TS_async_none, TS_async_private,
|
||||
TS_async_ntp, TS_async_time } TStime_protocol;
|
||||
typedef enum { TS_sync_master, TS_async_master,
|
||||
TS_sync_slave, TS_async_slave,
|
||||
TS_direct_master, TS_direct_slave} TStime_type;
|
||||
|
||||
struct TSstampTransStruct {
|
||||
unsigned long magic; /* identifier */
|
||||
TStype type; /* transaction type */
|
||||
struct timespec master_time; /* master time stamp - last sync time */
|
||||
struct timespec current_time; /* master current time stamp 1990 epoch */
|
||||
struct timespec unix_time; /* time using 1900 epoch */
|
||||
unsigned long sync_rate; /* master sends sync at this rate */
|
||||
unsigned long clock_hz; /* master clock this frequency (tick rate) */
|
||||
};
|
||||
typedef struct TSstampTransStruct TSstampTrans;
|
||||
|
||||
struct TSinfoStruct {
|
||||
TSstate state;
|
||||
TStime_type type;
|
||||
TStime_protocol async_type;
|
||||
int ts_sync_valid;
|
||||
|
||||
struct timespec *event_table; /* timestamp table */
|
||||
|
||||
unsigned long sync_rate; /* master send sync at this rate */
|
||||
unsigned long clock_hz; /* master clock is this frequency */
|
||||
unsigned long clock_conv;/* conversion factor for tick_rate->ns */
|
||||
unsigned long time_out; /* udp packet time-out in milliseconds */
|
||||
int master_timing_IOC; /* 1=master, 0=slave */
|
||||
int master_port; /* port that master listens on */
|
||||
int slave_port; /* port that slave listens on */
|
||||
int total_events; /* this is the total event in the event system*/
|
||||
int sync_event; /* this is the sync event number */
|
||||
int has_event_system; /* 1=has event system, 0=no event system */
|
||||
int has_direct_time; /* 1=has direct time, 0=no direct time */
|
||||
int UserRequestedType; /* let user force the setting of type */
|
||||
|
||||
SEM_ID sync_occurred;
|
||||
|
||||
struct sockaddr hunt; /* broadcast address info */
|
||||
struct sockaddr master; /* socket info for contacting master */
|
||||
};
|
||||
typedef struct TSinfoStruct TSinfo;
|
||||
|
||||
/* global functions */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
TS_EXTERN long TSinit(void);
|
||||
TS_EXTERN long TSgetTimeStamp(int event_number,struct timespec* ts);
|
||||
TS_EXTERN unsigned long TSepochNtpToUnix(struct timespec* ts);
|
||||
TS_EXTERN unsigned long TSfractionToNano(unsigned long fraction);
|
||||
TS_EXTERN unsigned long TSepochNtpToEpics(struct timespec* ts);
|
||||
TS_EXTERN unsigned long TSepochUnixToEpics(struct timespec* ts);
|
||||
TS_EXTERN unsigned long TSepochEpicsToUnix(struct timespec* ts);
|
||||
TS_EXTERN long TScurrentTimeStamp(struct timespec* ts);
|
||||
TS_EXTERN long TSaccurateTimeStamp(struct timespec* ts);
|
||||
TS_EXTERN long TSgetFirstOfYearVx(struct timespec* ts);
|
||||
TS_EXTERN void TSconfigure(int master, int sync_rate_sec, int clock_rate_hz,
|
||||
int master_port, int slave_port,
|
||||
unsigned long millisecond_request_time_out, int type);
|
||||
TS_EXTERN long TSsetClockFromUnix(void);
|
||||
|
||||
#ifndef TS_DRIVER
|
||||
TS_EXTERN TSinfo TSdata;
|
||||
TS_EXTERN TSdirectTimeVar; /* set to !=0 to indicate direct time available*/
|
||||
TS_EXTERN TSgoodTimeStamps; /* force best time stamps by setting != 0 */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
/* NTP information - all this is backwards and documentation only */
|
||||
#define VN_SHIFT 2 /* Version - 3 bits */
|
||||
#define VN_version 3<<VN_SHIFT
|
||||
|
||||
#define LI_SHIFT 0 /* Leap Indicator LI - 2 bits */
|
||||
#define LI_no_warning (0x00<<LI_SHIFT)
|
||||
#define LI_61_sec_minute (0x01<<LI_SHIFT)
|
||||
#define LI_59_sec_minute (0x02<<LI_SHIFT)
|
||||
#define LI_alarm_condition (0x03<<LI_SHIFT)
|
||||
|
||||
#define MODE_SHIFT 5 /* Mode MODE - 3 bits */
|
||||
#define MODE_reserved (0x00<<MODE_SHIFT)
|
||||
#define MODE_sym_active (0x01<<MODE_SHIFT)
|
||||
#define MODE_sym_passive (0x02<<MODE_SHIFT)
|
||||
#define MODE_client (0x03<<MODE_SHIFT)
|
||||
#define MODE_server (0x04<<MODE_SHIFT)
|
||||
#define MODE_broadcast (0x05<<MODE_SHIFT)
|
||||
#define MODE_reserved_NTP (0x06<<MODE_SHIFT)
|
||||
#define MODE_reserved_pvt (0x07<<MODE_SHIFT)
|
||||
|
||||
#define STRAT_SHIFT 8 /* Stratum STRAT - 8 bits */
|
||||
#define STRAT_unspecified (0x00<<STRAT_SHIFT)
|
||||
#define STRAT_ascii (0x00<<STRAT_SHIFT)
|
||||
#define STRAT_GPS (0x01<<STRAT_SHIFT)
|
||||
#define STRAT_ATOM (0x01<<STRAT_SHIFT)
|
||||
#define STRAT_address (0x02<<STRAT_SHIFT)
|
||||
|
||||
#define POLL_SHIFT 16 /* eight bits */
|
||||
#define PREC_SHIFT 24 /* eight bits */
|
||||
|
||||
struct TS_ntp {
|
||||
/* unsigned int info; */
|
||||
unsigned char info[4];
|
||||
unsigned int root_delay;
|
||||
unsigned int root_disp;
|
||||
unsigned int reference_id;
|
||||
struct timespec reference_ts;
|
||||
struct timespec originate_ts;
|
||||
struct timespec receive_ts;
|
||||
struct timespec transmit_ts;
|
||||
/* char authenticator[96]; (optional) */
|
||||
};
|
||||
typedef struct TS_ntp TS_NTP;
|
||||
|
||||
|
||||
/* debug macro creation */
|
||||
#ifdef NODEBUG
|
||||
#define Debug(l,f,v) ;
|
||||
#else
|
||||
#ifdef MAKE_DEBUG
|
||||
volatile int MAKE_DEBUG = 0;
|
||||
#define Debug(l,f,v) { if(l<= MAKE_DEBUG ) \
|
||||
{ printf("%s:%d: ",__FILE__,__LINE__); printf(f,v); }}
|
||||
#define Debug0(l,f) { if(l<= MAKE_DEBUG ) \
|
||||
{ printf("%s:%d: ",__FILE__,__LINE__); printf(f); }}
|
||||
#else
|
||||
#define Debug(l,f,v) { if(l) \
|
||||
{ printf("%s:%d: ",__FILE__,__LINE__); printf(f,v); }}
|
||||
#define Debug0(l,f) { if(l) \
|
||||
{ printf("%s:%d: ",__FILE__,__LINE__); printf(f); }}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,191 @@
|
||||
/* fast_lock.h */
|
||||
/* share/epicsH $Id$ */
|
||||
|
||||
/*
|
||||
* Author: Jeff Hill
|
||||
* Date: 4-11-89
|
||||
*
|
||||
* Experimental Physics and Industrial Control System (EPICS)
|
||||
*
|
||||
* Copyright 1991, the Regents of the University of California,
|
||||
* and the University of Chicago Board of Governors.
|
||||
*
|
||||
* This software was produced under U.S. Government contracts:
|
||||
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
|
||||
* and (W-31-109-ENG-38) at Argonne National Laboratory.
|
||||
*
|
||||
* Initial development by:
|
||||
* The Controls and Automation Group (AT-8)
|
||||
* Ground Test Accelerator
|
||||
* Accelerator Technology Division
|
||||
* Los Alamos National Laboratory
|
||||
*
|
||||
* Co-developed with
|
||||
* The Controls and Computing Group
|
||||
* Accelerator Systems Division
|
||||
* Advanced Photon Source
|
||||
* Argonne National Laboratory
|
||||
*
|
||||
* Modification Log:
|
||||
* -----------------
|
||||
* .01 joh 041189 initial release into middle age
|
||||
* .02 joh 071989 added fast lock test
|
||||
* .03 joh 090391 VRTX kernel ifdef for V5 vxWorks
|
||||
* .04 joh 091091 Now uses V5 vxWorks binary semaphore
|
||||
* .05 joh 092491 Dont use V5 semaphore on V3 EPICS yet
|
||||
* .06 jba 030692 added cast to vxTas arg in FASTLOCK vxWorks5
|
||||
* .07 jba 081092 added cast to vxTas arg in FASTLOCKNOWAIT
|
||||
* .08 mgb 082493 Removed V5/V4 conditional defines
|
||||
* .09 joh 082493 include vxLib.h for vxWorks V5.1
|
||||
* .10 joh 082593 made lock char as vxTas expects
|
||||
* (padded structure to identical size)
|
||||
* .11 joh 082593 made fast lock structure fields volatile
|
||||
* .12 joh 091493 added sem and task lock based fast locks
|
||||
* with ifdefs - removed volatile
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
* Macros and data structures for a much faster (than vrtx semaphore)
|
||||
* mutual exclusion lock/unlock.
|
||||
* (semaphore in this case is only used to wait for unlock)
|
||||
*
|
||||
* On a 68020 the following times include lock and unlock
|
||||
*
|
||||
* FASTLOCK-FASTUNLOCK 8 microsecs
|
||||
* semTake-semGive(Macro) 80 microsecs
|
||||
* semTake-semGive 92 microsecs
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef INCLfast_lockh
|
||||
#define INCLfast_lockh
|
||||
|
||||
#ifndef INCLsemLibh
|
||||
#include <semLib.h>
|
||||
#endif
|
||||
#ifndef INCLvxLibh
|
||||
#include <vxLib.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Macro equivalent of vxWorks glue for better performance
|
||||
*/
|
||||
#ifdef VRTX_KERNEL
|
||||
# define semGive(SEMID)\
|
||||
{ if ((SEMID)->count == 0)vrtxPost (&((SEMID)->count), 1); }
|
||||
|
||||
# define semTake(SEMID)\
|
||||
{int dummy; vrtxPend (&((SEMID)->count), 0, &dummy); }
|
||||
#endif
|
||||
|
||||
typedef struct{
|
||||
SEM_ID ppend; /* wait for lock sem */
|
||||
unsigned short count; /* cnt of tasks waiting for lock */
|
||||
unsigned char lock; /* test and set lock bit */
|
||||
char pad; /* structure alignment */
|
||||
}FAST_LOCK;
|
||||
|
||||
#define SEM_FAST_LOCK
|
||||
|
||||
#if defined(SEM_FAST_LOCK) /* no lock test */
|
||||
|
||||
#define FASTLOCKINIT(PFAST_LOCK)\
|
||||
(((FAST_LOCK *)(PFAST_LOCK))->ppend = \
|
||||
semMCreate(SEM_DELETE_SAFE|SEM_INVERSION_SAFE|SEM_Q_PRIORITY))
|
||||
#define FASTLOCKFREE(PFAST_LOCK)\
|
||||
semDelete( ((FAST_LOCK *)(PFAST_LOCK))->ppend )
|
||||
#define FASTLOCK(PFAST_LOCK)\
|
||||
semTake(((FAST_LOCK *)(PFAST_LOCK))->ppend, WAIT_FOREVER);
|
||||
#define FASTUNLOCK(PFAST_LOCK)\
|
||||
semGive(((FAST_LOCK *)(PFAST_LOCK))->ppend);
|
||||
#define FASTLOCKNOWAIT(PFAST_LOCK) \
|
||||
((semTake(((FAST_LOCK *)(PFAST_LOCK))->ppend,NO_WAIT)==0) ? TRUE : FALSE)
|
||||
#define FASTLOCKTEST(PFAST_LOCK) \
|
||||
(\
|
||||
(semTake(((FAST_LOCK *)(PFAST_LOCK))->ppend,NO_WAIT)==0 )\
|
||||
? (semGive(((FAST_LOCK *)(PFAST_LOCK))->ppend),FALSE)\
|
||||
: TRUE \
|
||||
)
|
||||
|
||||
|
||||
#elif defined(TASK_LOCK_FAST_LOCK)
|
||||
|
||||
#define FASTLOCKINIT(PFAST_LOCK)\
|
||||
(\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->count =0, \
|
||||
((FAST_LOCK *)(PFAST_LOCK))->lock =0, \
|
||||
((FAST_LOCK *)(PFAST_LOCK))->ppend = \
|
||||
semBCreate(SEM_Q_PRIORITY, SEM_EMPTY) \
|
||||
)
|
||||
#define FASTLOCKFREE(PFAST_LOCK)\
|
||||
semDelete( ((FAST_LOCK *)(PFAST_LOCK))->ppend )
|
||||
|
||||
#define FASTLOCK(PFAST_LOCK)\
|
||||
{\
|
||||
TASK_LOCK;\
|
||||
while( ((FAST_LOCK *)(PFAST_LOCK))->lock ){\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->count++;\
|
||||
TASK_UNLOCK;\
|
||||
semTake(((FAST_LOCK *)(PFAST_LOCK))->ppend, WAIT_FOREVER);\
|
||||
TASK_LOCK;\
|
||||
(((FAST_LOCK *)(PFAST_LOCK))->count)--;\
|
||||
}\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->lock= TRUE;
|
||||
TASK_UNLOCK;
|
||||
}
|
||||
|
||||
#define FASTUNLOCK(PFAST_LOCK)\
|
||||
{\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->lock = FALSE;\
|
||||
if( ((FAST_LOCK *)(PFAST_LOCK))->count )\
|
||||
semGive(((FAST_LOCK *)(PFAST_LOCK))->ppend);\
|
||||
};
|
||||
|
||||
#define FASTLOCKTEST(PFAST_LOCK)\
|
||||
( ((FAST_LOCK *)(PFAST_LOCK))->lock )
|
||||
|
||||
#else /* vxTas() fast lock */
|
||||
|
||||
/*
|
||||
* extra paren avoids order of ops problems
|
||||
* (returns what semBCreate returns on v5 vxWorks)
|
||||
*/
|
||||
#define FASTLOCKINIT(PFAST_LOCK)\
|
||||
(\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->count =0, \
|
||||
((FAST_LOCK *)(PFAST_LOCK))->lock =0, \
|
||||
((FAST_LOCK *)(PFAST_LOCK))->ppend = \
|
||||
semBCreate(SEM_Q_PRIORITY, SEM_EMPTY) \
|
||||
)
|
||||
|
||||
/*
|
||||
* new requirement with v5 vxWorks
|
||||
*/
|
||||
#define FASTLOCKFREE(PFAST_LOCK)\
|
||||
semDelete( ((FAST_LOCK *)(PFAST_LOCK))->ppend )
|
||||
|
||||
#define FASTLOCK(PFAST_LOCK)\
|
||||
{\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->count++;\
|
||||
while(!vxTas( (char *)&( ((FAST_LOCK *)(PFAST_LOCK))->lock ) ))\
|
||||
semTake(((FAST_LOCK *)(PFAST_LOCK))->ppend, WAIT_FOREVER);\
|
||||
( ((FAST_LOCK *)(PFAST_LOCK))->count)--;\
|
||||
}
|
||||
|
||||
#define FASTUNLOCK(PFAST_LOCK)\
|
||||
{\
|
||||
((FAST_LOCK *)(PFAST_LOCK))->lock = FALSE;\
|
||||
if( ((FAST_LOCK *)(PFAST_LOCK))->count )\
|
||||
semGive(((FAST_LOCK *)(PFAST_LOCK))->ppend);\
|
||||
};
|
||||
|
||||
#define FASTLOCKNOWAIT(PFAST_LOCK) (vxTas((char *)&(((FAST_LOCK *)(PFAST_LOCK))->lock)))
|
||||
|
||||
#define FASTLOCKTEST(PFAST_LOCK)\
|
||||
( ((FAST_LOCK *)(PFAST_LOCK))->lock )
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* Nothing after this endif */
|
||||
Reference in New Issue
Block a user