35 #define epicsExportSharedSymbols 43 static int firstTime =
TRUE;
45 static int caInitializing=
FALSE;
59 long stat = args.
stat;
62 static char *unknown =
"unknown";
63 const char *nativeType;
64 const char *requestType;
70 channel = (chid ?
ca_name(chid) : unknown);
71 context = (args.
ctx ? args.
ctx : unknown);
75 requestCount = args.
count;
79 errlogPrintf(
"dbCa:exceptionCallback stat \"%s\" channel \"%s\"" 81 " nativeType %s requestType %s" 82 " nativeCount %ld requestCount %ld %s %s\n",
84 nativeType,requestType,
85 nativeCount,requestCount,
86 (readAccess ?
"readAccess" :
"noReadAccess"),
87 (writeAccess ?
"writeAccess" :
"noWriteAccess"));
110 int caStatus = arg.
status;
119 epicsPrintf(
"asCa: eventCallback error %s channel %s\n",
122 epicsPrintf(
"asCa: eventCallback error %s chid is null\n",
127 pasg = pasginp->
pasg;
129 if(chid!=pcapvt->chid) {
130 epicsPrintf(
"asCa: eventCallback error pcapvt->chid != arg.chid\n");
134 if(!(pasg->inpBad & (1<<pasginp->
inpIndex))) {
136 pasg->inpBad |= (1<<pasginp->
inpIndex);
139 printf(
"as eventCallback %s inpBad ca_state %d" 140 " ca_read_access %d\n",
147 pcapvt->rtndata = *pdata;
149 pasg->inpBad |= (1<<pasginp->
inpIndex);
151 printf(
"as eventCallback %s inpBad because INVALID_ALARM\n",
154 pasg->inpBad &= ~((1<<pasginp->
inpIndex));
155 pasg->pavalue[pasginp->
inpIndex] = pdata->value;
157 printf(
"as eventCallback %s inpGood data %f\n",
160 pasg->inpChanged |= (1<<pasginp->
inpIndex);
164 static void asCaTask(
void)
173 "asCaTask calling ca_context_create");
175 "ca_add_exception_event");
178 caInitializing =
TRUE;
187 connectCallback,pasginp);
189 epicsPrintf(
"asCa ca_search_and_connect error %s\n",
194 eventCallback,pasginp,0);
204 caInitializing =
FALSE;
219 free(pasginp->
capvt);
244 errMessage(0,
"asCaStart: taskSpawn Failure\n");
256 if(threadid==0)
return;
274 fprintf(fp,
"access security not started\n");
284 pcapvt = pasginp->
capvt;
288 if(level>1 || (level==1 && state!=
cs_conn)) {
289 fprintf(fp,
"connected:");
292 else if(state==
cs_conn) fprintf(fp,
"yes ");
293 else if(state==
cs_closed) fprintf(fp,
"closed");
294 else fprintf(fp,
"unknown");
295 fprintf(fp,
" read:%s write:%s",
304 fprintf(fp,
"%d channels %d not connected\n",n,nbad);
315 if (pchans) *pchans = n;
316 if (pdiscon) *pdiscon = nbad;
332 if (pchans) *pchans = n;
333 if (pdiscon) *pdiscon = nbad;
void taskwdInsert(epicsThreadId tid, TASKWDFUNC callback, void *usr)
LIBCA_API unsigned epicsStdCall ca_write_access(chid chan)
LIBCOM_API volatile ASBASE * pasbase
LIBCA_API unsigned long epicsStdCall ca_element_count(chid chan)
LIBCA_API enum channel_state epicsStdCall ca_state(chid chan)
int epicsStdCall ca_search_and_connect(const char *name_str, chid *chanptr, caCh *conn_func, void *puser)
LIBCA_API const char *epicsStdCall ca_host_name(chid channel)
LIBCA_API void *epicsStdCall ca_puser(chid chan)
#define epicsMutexMustCreate()
Create an epicsMutex semaphore for use from C code.
#define errMessage(S, PM)
LIBCOM_API epicsEventId epicsEventMustCreate(epicsEventInitialState initialState)
Create an epicsEvent for use from C code.
void epicsStdCall epicsMutexUnlock(epicsMutexId pmutexNode)
Release the semaphore.
LIBCOM_API long epicsStdCall asComputeAsg(ASG *pasg)
Miscellaneous macro definitions.
LIBCA_API short epicsStdCall ca_field_type(chid chan)
LIBCOM_API unsigned int epicsStdCall epicsThreadGetStackSize(epicsThreadStackSizeClass size)
LIBCOM_API void epicsEventMustWait(epicsEventId id)
Wait for an event (see epicsEventWait()).
epicsThreadId epicsStdCall epicsThreadCreate(const char *name, unsigned int priority, unsigned int stackSize, EPICSTHREADFUNC funptr, void *parm)
#define dbr_type_to_text(type)
A doubly-linked list library.
int epicsStdCall ca_context_create(ca_preemptive_callback_select premptiveCallbackSelect)
epicsExportAddress(int, asCaDebug)
#define ellNext(PNODE)
Find the next node in list.
#define epicsEventSignal(ID)
A synonym for epicsEventTrigger().
APIs for the epicsMutex mutual exclusion semaphore.
int epicsStdCall ca_add_exception_event(caExceptionHandler *pfunc, void *arg)
int epicsStdCall ca_flush_io()
#define SEVCHK(CA_ERROR_CODE, MESSAGE_STRING)
LIBCA_API const char *epicsStdCall ca_name(chid chan)
LIBCA_API unsigned epicsStdCall ca_read_access(chid chan)
int errlogPrintf(const char *pFormat,...)
int epicsStdCall ca_clear_channel(chid pChan)
APIs for the epicsEvent binary semaphore.
const char *epicsStdCall ca_message(long ca_status)
void ascaStats(int *pchans, int *pdiscon)
#define epicsThreadPriorityScanLow
LIBCOM_API void *epicsStdCall asCalloc(size_t nobj, size_t size)
Routines for code that can't continue or return after an error.
LIBCOM_API long epicsStdCall asComputeAllAsg(void)
int ascarFP(FILE *fp, int level)
C++ and C descriptions for a thread.
#define epicsMutexMustLock(ID)
Claim a semaphore (see epicsMutexLock()).
#define ca_add_event(type, chan, pFunc, pArg, pEventID)
void(* EPICSTHREADFUNC)(void *parm)
#define ellFirst(PLIST)
Find the first node in list.
LIBCOM_API epicsThreadId epicsStdCall epicsThreadGetIdSelf(void)