static long subFinalProc(subRecord *precord) { myData *pmyData = (myData*) precord->dpvt; if(precord->pact) { if(dbSubFinalDebug) { epicsPrintf("Proc Phase 2 execution by (thread) %s, (record) %s\n", epicsThreadGetNameSelf(), precord->name); } precord->val = pmyData->private_counter; precord->pact = FALSE; return 0; } precord->pact = TRUE; if(dbSubFinalDebug) { epicsPrintf("Proc Phase 1 execution by (thread) %s, (record) %s\n", epicsThreadGetNameSelf(), precord->name); } epicsMessageQueueSend(queueId, (void*) &pmyData, sizeof(myData*)); return 0; }
static long devStringoutV792Control_write_stringout(stringoutRecord *precord) { ST_dpvt *pST_dpvt = (ST_dpvt*) precord->dpvt; ST_STD_device *pSTDdev; ST_threadCfg *pControlThreadConfig; ST_threadQueueData qData; if(!pST_dpvt || precord->udf == TRUE) { precord->pact = TRUE; return -1; /*(-1,0)=>(failure,success)*/ } pSTDdev = pST_dpvt->pSTDdev; pControlThreadConfig = pSTDdev->pST_stdCtrlThread; qData.param.pSTDdev = pSTDdev; qData.param.precord = (struct dbCommon *)precord; qData.param.n32Arg0 = pST_dpvt->n32Arg0; /* qData.param.setValue = precord->val; */ strcpy( qData.param.setStr, precord->val ); /* db processing: phase I */ if(precord->pact == FALSE) { precord->pact = TRUE; #if PRINT_PHASE_INFO epicsPrintf("db processing: phase I %s (%s)\n", precord->name, epicsThreadGetNameSelf()); #endif switch(pST_dpvt->ind) { case STRINGOUT_TAG: qData.pFunc = devV792_STRINGOUT_TAG; break; default: break; } epicsMessageQueueSend(pControlThreadConfig->threadQueueId, (void*) &qData, sizeof(ST_threadQueueData)); return 0; /*(-1,0)=>(failure,success)*/ } /* db processing: phase II -post processing */ if(precord->pact == TRUE) { #if PRINT_PHASE_INFO epicsPrintf("db processing: phase II %s (%s)\n", precord->name, epicsThreadGetNameSelf() ); #endif precord->pact = FALSE; precord->udf = FALSE; return 0; /*(-1,0)=>(failure,success)*/ } return -1; /*(-1,0)=>(failure,success)*/ }
void Channel::monitorThread(Channel* channel) { logger.debug("Started monitor thread %s", epicsThreadGetNameSelf()); while (true) { if (channel->processMonitorElement()) { break; } } logger.debug("Exiting monitor thread %s", epicsThreadGetNameSelf()); channel->notifyMonitorThreadExit(); }
static void devV792_BO_TOGGLE_mean_value(ST_execParam *pParam) { ST_STD_device *pSTDdev = pParam->pSTDdev; struct dbCommon *precord = pParam->precord; ST_MASTER *pAdminCfg = pSTDdev->pST_parentAdmin; ST_V792 *pV792 = (ST_V792 *)pSTDdev->pUser; if( pSTDdev->ST_Base.opMode == OPMODE_CALIBRATION ) { notify_error(1, "%s: Not supported in calib. mode!\n", pSTDdev->taskName); return; } pSTDdev = (ST_STD_device*) ellFirst(pAdminCfg->pList_DeviceTask); while(pSTDdev) { pV792 = (ST_V792 *)pSTDdev->pUser; pV792->toggle_get_MeanVal = (char)pParam->setValue; if( pV792->toggle_get_MeanVal ) { drvV792_reset_calibration_param(pSTDdev); epicsPrintf("%s: get mean value. ON\n", pSTDdev->taskName); } else epicsPrintf("%s: get mean value. OFF\n", pSTDdev->taskName); pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node); } pSTDdev = pParam->pSTDdev; epicsPrintf("%s %s (%s)\n", pSTDdev->taskName, precord->name, epicsThreadGetNameSelf() ); #if 0 pV792->toggle_get_MeanVal = (char)pParam->setValue; if( pV792->toggle_get_MeanVal ) { /* int i; for(i = 0; i<pV792->chNum; i++) { pV792->ST_Ch[i].acuum_value = 0; pV792->ST_Ch[i].mean_value = 0; } pV792->accum_cnt = 0; */ drvV792_reset_calibration_param(pSTDdev); } epicsPrintf("%s %s (%s), val: %d\n", pSTDdev->taskName, precord->name, epicsThreadGetNameSelf(), pV792->toggle_get_MeanVal); #endif }
void RpcServer::listenerThread(RpcServer* server) { logger.debug("Started listener thread %s", epicsThreadGetNameSelf()); // Handle possible exceptions try { server->run(); } catch (const std::exception& ex) { // Not good. logger.error("Exception caught in listener thread %s: %s", epicsThreadGetNameSelf(), ex.what()); } }
static long devStringoutAdmin_write_stringout(stringoutRecord *precord) { ST_devAdmin_dpvt *pdevAdmin_dpvt = (ST_devAdmin_dpvt*) precord->dpvt; ST_ADMIN *pAdminCfg; ST_threadCfg *pControlThreadConfig; ST_threadQueueData qData; if(!pdevAdmin_dpvt || precord->udf == TRUE) { precord->pact = TRUE; return -1; /*(-1,0)=>(failure,success)*/ } pAdminCfg = pdevAdmin_dpvt->ptaskConfig; pControlThreadConfig = pAdminCfg->pST_adminCtrlThread; qData.param.precord = (struct dbCommon *)precord; strcpy( qData.param.setStr, precord->val ); if(precord->pact == FALSE) { precord->pact = TRUE; #if PRINT_PHASE_INFO epicsPrintf("db processing: phase I %s (%s)\n", precord->name, epicsThreadGetNameSelf()); #endif switch(pdevAdmin_dpvt->ind) { case 0: break; default: break; } epicsMessageQueueSend(pControlThreadConfig->threadQueueId, (void*) &qData, sizeof(ST_threadQueueData)); return 0; /*(-1,0)=>(failure,success)*/ } /* db processing: phase II -post processing */ if(precord->pact == TRUE) { #if PRINT_PHASE_INFO epicsPrintf("db processing: phase II %s (%s) %d\n", precord->name, epicsThreadGetNameSelf() ); #endif precord->pact = FALSE; precord->udf = FALSE; return 0; /*(-1,0)=>(failure,success)*/ } return -1; /*(-1,0)=>(failure,success)*/ }
static void devV792_BO_SHOW_MEAN_VALUE(ST_execParam *pParam) { ST_STD_device *pSTDdev = pParam->pSTDdev; struct dbCommon *precord = pParam->precord; ST_V792 *pV792 = (ST_V792 *)pSTDdev->pUser; // int i; if( !(pSTDdev->StatusDev & TASK_SYSTEM_IDLE) ) { epicsPrintf("ERROR! %s not Idle condition! please check again. (0x%x)\n", pSTDdev->taskName, pSTDdev->StatusDev); return; } printf("%s: Ipad: %d, pulse width: ??? \n", pSTDdev->taskName, pV792->Pedestal ); /* for( i=0; i< pV792->chNum; i++) { printf(" ch%d, %f, (= %d/%d ) \n", i, pV792->ST_Ch[i].mean_value, pV792->ST_Ch[i].acuum_value, pV792->accum_cnt ); } */ epicsPrintf("%s %s (%s), val: %d\n", pSTDdev->taskName, precord->name, epicsThreadGetNameSelf(), pV792->toggle_get_MeanVal); }
static void devV792_BO_TOGGLE_make_file(ST_execParam *pParam) { ST_STD_device *pSTDdev = pParam->pSTDdev; struct dbCommon *precord = pParam->precord; ST_V792 *pV792 = NULL; ST_MASTER *pAdminCfg = pSTDdev->pST_parentAdmin; /* if( !(pSTDdev->StatusDev & TASK_SYSTEM_IDLE) ) { epicsPrintf("ERROR! %s not Idle condition! please check again. (0x%x)\n", pSTDdev->taskName, pSTDdev->StatusDev); return; } */ pSTDdev = (ST_STD_device*) ellFirst(pAdminCfg->pList_DeviceTask); while(pSTDdev) { pV792 = (ST_V792 *)pSTDdev->pUser; pV792->use_file_save = (char)pParam->setValue; if( pV792->use_file_save ) epicsPrintf("%s: use file save (%d)\n", pSTDdev->taskName, pV792->use_file_save); else epicsPrintf("%s: skip making raw files (%d)\n", pSTDdev->taskName, pV792->use_file_save); pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node); } pSTDdev = pParam->pSTDdev; epicsPrintf("%s: %s (%s)\n", pSTDdev->taskName, precord->name, epicsThreadGetNameSelf()); }
static void devV792_BO_SHOW_CALIB_INFO(ST_execParam *pParam) { ST_STD_device *pSTDdev = pParam->pSTDdev; struct dbCommon *precord = pParam->precord; ST_V792 *pV792 = (ST_V792 *)pSTDdev->pUser; // int i,j; if( !(pSTDdev->StatusDev & TASK_SYSTEM_IDLE) ) { epicsPrintf("ERROR! %s not Idle condition! please check again. (0x%x)\n", pSTDdev->taskName, pSTDdev->StatusDev); return; } printf("%s: total Cnt: %d, pulse width: ??? \n", pSTDdev->taskName, pV792->accum_cnt ); /* for( i=0; i<10; i++) { printf("Iped:%d, ", i ); for( j=0; j< pV792->chNum; j++) { printf("%.2f ", pV792->ST_Ch[j].Iped_ref[i] ); } printf("\n"); } */ epicsPrintf("%s %s (%s)\n", pSTDdev->taskName, precord->name, epicsThreadGetNameSelf()); }
void epicsAssert (const char *pFile, const unsigned line, const char *pExp, const char *pAuthorName) { epicsTimeStamp current; errlogPrintf("\n\n\n" "A call to 'assert(%s)'\n" " by thread '%s' failed in %s line %u.\n", pExp, epicsThreadGetNameSelf(), pFile, line); errlogPrintf("EPICS Release %s.\n", epicsReleaseVersion); if (epicsTimeGetCurrent(¤t) == 0) { char date[64]; epicsTimeToStrftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S.%f %Z", ¤t); errlogPrintf("Local time is %s\n", date); } if (!pAuthorName) { pAuthorName = "the author"; } errlogPrintf("Please E-mail this message to %s or to [email protected]\n", pAuthorName); errlogPrintf("Calling epicsThreadSuspendSelf()\n"); epicsThreadSuspendSelf (); }
static void devV792_AO_TEST_PUT(ST_execParam *pParam) { ST_STD_device *pSTDdev = pParam->pSTDdev; struct dbCommon *precord = pParam->precord; /* char strval[64]; */ /* pSTDdev->dT0 = (float)pParam->setValue; */ /* dbProc_call_LSAVE_start(); */ /* dbProc_call_RESET_shotseq_started(); */ /* drvV792_set_testFunc(pSTDdev); */ /* CAproc_get("CCS_SHOT_NUMBER", strval); */ /* sprintf(strval, "%d", (int)pParam->setValue ); CAproc_put("atca:ai1", strval); */ /* db_get("TS1_CCS_SHOT_NUMBER", strval); db_get("TS1_CCS_BLIP_TIME", strval); */ epicsPrintf("control thread (test PUT): %s %s (%s), val: %f\n", pSTDdev->taskName, precord->name, epicsThreadGetNameSelf(), (float)pParam->setValue); }
static void devV792_AO_SET_PEDESTAL(ST_execParam *pParam) { ST_STD_device *pSTDdev = pParam->pSTDdev; struct dbCommon *precord = pParam->precord; /* ST_MASTER *pAdminCfg = pSTDdev->pST_parentAdmin; */ ST_V792 *pV792 = (ST_V792 *)pSTDdev->pUser; UINT16 reg_value, cur_value; if( (UINT16)pParam->setValue > 255 ) { epicsPrintf("ERROR! %s: Over the max value (%d)\n", pSTDdev->taskName, (UINT16)pParam->setValue ); return; } cur_value = (UINT16)pParam->setValue; cvt_read_reg( &pV792->board_data.m_common_data, CVT_V792_IPED_INDEX, ®_value); epicsPrintf("%s: Current Pedestal (%d)\n", pSTDdev->taskName, reg_value); if ( !cvt_V792_set_pedestal( &pV792->board_data, cur_value)) { notify_error(1,"%s: pedestal(%d)", pSTDdev->taskName, cur_value); return; } cvt_read_reg( &pV792->board_data.m_common_data, CVT_V792_IPED_INDEX, ®_value); pV792->Pedestal = reg_value; epicsPrintf("New Pedestal:%d %s %s (%s)\n", pV792->Pedestal, pSTDdev->taskName, precord->name, epicsThreadGetNameSelf()); }
static EPICSTHREADFUNC calcThread(void *param) { subRecord *precord; myData *pmyData; struct rset *prset; while(epicsMessageQueueReceive(queueId, (void*) &pmyData, sizeof(myData*))) { precord = pmyData->precord; prset = (struct rset*) precord->rset; if(dbSubFinalDebug) { epicsMessageQueueShow(queueId, 1); epicsPrintf("Thread %s: Record %s requested thread processing\n", epicsThreadGetNameSelf(), precord->name); } pmyData->private_counter ++; dbScanLock((struct dbCommon*) precord); (*prset->process)(precord); dbScanUnlock((struct dbCommon*) precord); } return 0; }
static void devAdmin_AO_T1(ST_execParam *pParam) { ST_ADMIN *pAdminCfg = drvAdmin_get_AdminPtr(); struct dbCommon *precord = pParam->precord; ST_STD_device *pSTDdev = (ST_STD_device*) ellFirst(pAdminCfg->pList_DeviceTask); if( pAdminCfg->StatusAdmin & TASK_ARM_ENABLED ) { epicsPrintf("ERROR! System armed! please check again. (0x%x)\n", pAdminCfg->StatusAdmin); return; } if( pParam->n32Arg0 >= SIZE_CNT_MULTI_TRIG ) { epicsPrintf("ERROR! Timing section not valid(%d).\n", pParam->n32Arg0); return; } pAdminCfg->ST_Base.dT1[pParam->n32Arg0]= (double)pParam->setValue; while(pSTDdev) { pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node); } epicsPrintf("T1 (%lf): Sec. %d, %s %s (%s)\n", pAdminCfg->ST_Base.dT1[pParam->n32Arg0], pParam->n32Arg0, pAdminCfg->taskName, precord->name, epicsThreadGetNameSelf()); }
static void printTime(void) { epicsTimeStamp ts; epicsTimeGetCurrent(&ts); printf("%s %s %s %d %d ", pvname,pvalue, epicsThreadGetNameSelf(),ts.secPastEpoch,ts.nsec/1000000); }
static void devV792_BO_READ_ALL_DATA(ST_execParam *pParam) { ST_STD_device *pSTDdev = pParam->pSTDdev; struct dbCommon *precord = pParam->precord; drvV792_read_FullData(pSTDdev); epicsPrintf("control thread: %s %s (%s), val: %f\n", pSTDdev->taskName, precord->name, epicsThreadGetNameSelf(), (float)pParam->setValue); }
epicsShareFunc void * mallocMustSucceed(size_t size, const char *msg) { void * mem = NULL; if (size > 0) { while ((mem = malloc(size)) == NULL) { errlogPrintf("%s: mallocMustSucceed(%lu) - malloc failed\n", msg, (unsigned long)size); errlogPrintf("Thread %s (%p) suspending.\n", epicsThreadGetNameSelf(), (void *)epicsThreadGetIdSelf()); errlogFlush(); epicsThreadSuspendSelf(); } } return mem; }
extern "C" void sender(void *arg) { epicsMessageQueue *q = (epicsMessageQueue *)arg; char cbuf[80]; int len; int i = 0; while (!testExit) { len = sprintf(cbuf, "%s -- %d.", epicsThreadGetNameSelf(), ++i); while (q->trySend((void *)cbuf, len) < 0) epicsThreadSleep(0.005 * (randBelow(5))); epicsThreadSleep(0.005 * (randBelow(20))); } }
epicsShareFunc void cantProceed(const char *msg, ...) { va_list pvar; va_start(pvar, msg); if (msg) errlogVprintf(msg, pvar); va_end(pvar); errlogPrintf("Thread %s (%p) can't proceed, suspending.\n", epicsThreadGetNameSelf(), (void *)epicsThreadGetIdSelf()); errlogFlush(); epicsThreadSleep(1.0); while (1) epicsThreadSuspendSelf(); }
static void spawnThread(void *param) { subRecord *precord = (subRecord*) param; queueId = epicsMessageQueueCreate(20, sizeof(myData*)); threadId = epicsThreadCreate("calcThread", epicsThreadPriorityLow, epicsThreadGetStackSize(epicsThreadStackSmall), calcThread, NULL); if(dbSubFinalDebug) { epicsPrintf("Thread Spawn by (thread) %s, (record) %s\n", epicsThreadGetNameSelf(), precord->name); } }
static void devV792_BO_DEV_RUN(ST_execParam *pParam) { ST_STD_device *pSTDdev = pParam->pSTDdev; struct dbCommon *precord = pParam->precord; if( (int)pParam->setValue == 1 ) /* in case of arming */ { drvV792_RUN_start(pSTDdev); } else { drvV792_RUN_stop(pSTDdev); } scanIoRequest(pSTDdev->ioScanPvt_status); epicsPrintf("%s: %s (%s)\n", pSTDdev->taskName, precord->name, epicsThreadGetNameSelf()); }
static void devV792_BO_SHOW_STATUS1(ST_execParam *pParam) { ST_STD_device *pSTDdev = pParam->pSTDdev; struct dbCommon *precord = pParam->precord; ST_V792 *pV792 = (ST_V792 *)pSTDdev->pUser; UINT16 reg_value= 0; if( !cvt_V792_get_status_1( &pV792->board_data, ®_value)) { epicsPrintf( "\nError %s: executing cvt_V792_get_status_1 \n", pSTDdev->taskName ); return ; } epicsPrintf("%s: - 0x%X CVT_V792_STATUS_1_INDEX\n", pSTDdev->taskName, reg_value ); if( reg_value & 0x1 ) epicsPrintf("\t [0]-1 Data Ready\n"); else epicsPrintf("\t [0]-0 No Data Ready\n"); if( reg_value & 0x2 ) epicsPrintf("\t [1]-1 At least one module has Data Ready.\n"); else epicsPrintf("\t [1]-0 No module has Data Ready.\n"); if( reg_value & 0x4 ) epicsPrintf("\t [2]-1 Module Busy.\n"); else epicsPrintf("\t [2]-0 Module not Busy.\n"); if( reg_value & 0x8 ) epicsPrintf("\t [3]-1 At least one module is Busy.\n"); else epicsPrintf("\t [3]-0 No module is Busy.\n"); if( reg_value & 0x10 ) epicsPrintf("\t [4]-1 GEO is not available from the JAUX.\n"); else epicsPrintf("\t [4]-0 GEO is picked from the JAUX.\n"); if( reg_value & 0x20 ) epicsPrintf("\t [5]-1 the board is purged.\n"); else epicsPrintf("\t [5]-0 the board is not purged.\n"); if( reg_value & 0x40 ) epicsPrintf("\t [6]-1 all Control Bus Terminations are ON.\n"); else epicsPrintf("\t [6]-0 not all Control Bus Terminations are ON.\n"); if( reg_value & 0x80 ) epicsPrintf("\t [7]-1 all Control Bus Terminations are OFF.\n"); else epicsPrintf("\t [7]-0 not all Control Bus Terminations are OFF.\n"); if( reg_value & 0x100 ) epicsPrintf("\t [8]-1 Indicate 1, not implemented\n"); else epicsPrintf("\t [8]-0 Indicate 0, not implemented\n"); epicsPrintf("%s: %s (%s)\n", pSTDdev->taskName, precord->name, epicsThreadGetNameSelf()); }
static void devAdmin_AO_SHOT_NUMBER(ST_execParam *pParam) { ST_ADMIN *pAdminCfg = drvAdmin_get_AdminPtr(); struct dbCommon *precord = pParam->precord; ST_STD_device *pSTDdev = (ST_STD_device*) ellFirst(pAdminCfg->pList_DeviceTask); if( pAdminCfg->StatusAdmin & TASK_ARM_ENABLED ) { epicsPrintf("WARNING! %s armed! but shot number changed!(0x%x)\n", pAdminCfg->taskName, pAdminCfg->StatusAdmin); } pAdminCfg->ST_Base.shotNumber = (uint32)pParam->setValue; pSTDdev->ST_Base.shotNumber = (uint32)pParam->setValue; /* TGLee */ flush_ShotNum_to_All_STDdev(); epicsPrintf("AO thread (%lu): %s %s (%s)\n", pAdminCfg->ST_Base.shotNumber, pAdminCfg->taskName, precord->name, epicsThreadGetNameSelf()); }
long epicsShareAPI dbPutField(DBADDR *paddr, short dbrType, const void *pbuffer, long nRequest) { long status = 0; long special = paddr->special; dbFldDes *pfldDes = paddr->pfldDes; dbCommon *precord = paddr->precord; short dbfType = paddr->field_type; if (special == SPC_ATTRIBUTE) return S_db_noMod; /*check for putField disabled*/ if (precord->disp && (void *)(&precord->disp) != paddr->pfield) return S_db_putDisabled; if (dbfType >= DBF_INLINK && dbfType <= DBF_FWDLINK) return dbPutFieldLink(paddr, dbrType, pbuffer, nRequest); dbScanLock(precord); status = dbPut(paddr, dbrType, pbuffer, nRequest); if (status == 0) { if (paddr->pfield == (void *)&precord->proc || (pfldDes->process_passive && precord->scan == 0 && dbrType < DBR_PUT_ACKT)) { if (precord->pact) { if (precord->tpro) printf("%s: Active %s\n", epicsThreadGetNameSelf(), precord->name); precord->rpro = TRUE; } else { /* indicate that dbPutField called dbProcess */ precord->putf = TRUE; status = dbProcess(precord); } } } dbScanUnlock(precord); return status; }
static void devAdmin_AO_CLOCK(ST_execParam *pParam) { ST_ADMIN *pAdminCfg = drvAdmin_get_AdminPtr(); struct dbCommon *precord = pParam->precord; ST_STD_device *pSTDdev = (ST_STD_device*) ellFirst(pAdminCfg->pList_DeviceTask); if( pAdminCfg->StatusAdmin & TASK_ARM_ENABLED ) { epicsPrintf("ERROR! System armed! please check again. (0x%x)\n", pAdminCfg->StatusAdmin); return; } pAdminCfg->ST_Base.nSamplingRate = (uint32)pParam->setValue; while(pSTDdev) { pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node); } epicsPrintf("AO thread (%d): %s %s (%s)\n", pAdminCfg->ST_Base.nSamplingRate, pAdminCfg->taskName, precord->name, epicsThreadGetNameSelf()); }
static void devV792_BO_SHOW_STATUS2(ST_execParam *pParam) { ST_STD_device *pSTDdev = pParam->pSTDdev; struct dbCommon *precord = pParam->precord; ST_V792 *pV792 = (ST_V792 *)pSTDdev->pUser; UINT16 reg_value= 0; if( !cvt_V792_get_status_2( &pV792->board_data, ®_value)) { epicsPrintf( "\nError %s: executing cvt_V792_get_status_2 \n", pSTDdev->taskName ); return ; } epicsPrintf("%s: - 0x%X CVT_V792_STATUS_2_INDEX\n", pSTDdev->taskName, reg_value ); epicsPrintf("\t [0]-null\n"); if( reg_value & 0x2 ) epicsPrintf("\t [1]-1 Buffer empty.\n"); else epicsPrintf("\t [1]-0 Buffer not empty.\n"); if( reg_value & 0x4 ) epicsPrintf("\t [2]-1 Buffer full.\n"); else epicsPrintf("\t [2]-0 Buffer not full.\n"); epicsPrintf("\t [3]-null\n"); /* if( reg_value & 0x10 ) epicsPrintf("\t [4]-1 GEO is not available from the JAUX.\n"); else epicsPrintf("\t [4]-0 GEO is picked from the JAUX.\n"); if( reg_value & 0x20 ) epicsPrintf("\t [5]-1 the board is purged.\n"); else epicsPrintf("\t [5]-0 the board is not purged.\n"); if( reg_value & 0x40 ) epicsPrintf("\t [6]-1 all Control Bus Terminations are ON.\n"); else epicsPrintf("\t [6]-0 not all Control Bus Terminations are ON.\n"); if( reg_value & 0x80 ) epicsPrintf("\t [7]-1 all Control Bus Terminations are OFF.\n"); else epicsPrintf("\t [7]-0 not all Control Bus Terminations are OFF.\n"); */ epicsPrintf("%s: %s (%s)\n", pSTDdev->taskName, precord->name, epicsThreadGetNameSelf()); }
static void devV792_BO_TOGGLE_realtime_calc(ST_execParam *pParam) { ST_STD_device *pSTDdev = pParam->pSTDdev; struct dbCommon *precord = pParam->precord; ST_V792 *pV792 = NULL; ST_MASTER *pAdminCfg = pSTDdev->pST_parentAdmin; pSTDdev = (ST_STD_device*) ellFirst(pAdminCfg->pList_DeviceTask); while(pSTDdev) { pV792 = (ST_V792 *)pSTDdev->pUser; pV792->toggle_rt_calc = (char)pParam->setValue; if( pV792->toggle_rt_calc ) epicsPrintf("%s: enable rt_calc. (%d)\n", pSTDdev->taskName, pV792->toggle_rt_calc); else epicsPrintf("%s: disable rt_calc. (%d)\n", pSTDdev->taskName, pV792->toggle_rt_calc); pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node); } pSTDdev = pParam->pSTDdev; epicsPrintf("%s: %s (%s)\n", pSTDdev->taskName, precord->name, epicsThreadGetNameSelf()); }
static long subFinalInit(subRecord *precord) { static int instance_counter = 0; myData *pmyData; if(dbSubFinalDebug) { epicsPrintf("Init SubRecord by (thread) %s, (record) %s\n", epicsThreadGetNameSelf(), precord->name); } pmyData = (myData*) malloc (sizeof(myData)); pmyData->instance_counter = ++instance_counter; pmyData->private_counter = 0; pmyData->precord = precord; precord->dpvt = (void*) pmyData; epicsThreadOnce(&threadOnceFlag, (void(*))spawnThread, (void*) precord); return 0; }
extern "C" void receiver(void *arg) { epicsMessageQueue *q = (epicsMessageQueue *)arg; char cbuf[80]; int expectmsg[4]; int len; int sender, msgNum; int errors = 0; for (sender = 1 ; sender <= 4 ; sender++) expectmsg[sender-1] = 1; while (!testExit) { cbuf[0] = '\0'; len = q->receive(cbuf, sizeof cbuf, 2.0); if (len < 0 && !testExit) { testDiag("receiver() received unexpected timeout"); ++errors; } else if (sscanf(cbuf, "Sender %d -- %d", &sender, &msgNum) == 2 && sender >= 1 && sender <= 4) { if (expectmsg[sender-1] != msgNum) { ++errors; testDiag("%s received %d '%.*s' -- expected %d", epicsThreadGetNameSelf(), len, len, cbuf, expectmsg[sender-1]); } expectmsg[sender-1] = msgNum + 1; epicsThreadSleep(0.001 * (randBelow(20))); } } for (sender = 1 ; sender <= 4 ; sender++) { if (expectmsg[sender-1] > 1) testDiag("Sender %d -- %d messages", sender, expectmsg[sender-1]-1); } testOk1(errors == 0); epicsEventSignal(finished); }
static long devAoAdmin_write_ao(aoRecord *precord) { ST_devAdmin_dpvt *pdevAdmin_dpvt = (ST_devAdmin_dpvt*) precord->dpvt; ST_ADMIN *pAdminCfg; ST_threadCfg *pControlThreadConfig; ST_threadQueueData qData; if(!pdevAdmin_dpvt || precord->udf == TRUE) { precord->pact = TRUE; return -1; } pAdminCfg = pdevAdmin_dpvt->ptaskConfig; pControlThreadConfig = pAdminCfg->pST_adminCtrlThread; qData.param.precord = (struct dbCommon *)precord; qData.param.setValue = precord->val; /* db processing: phase I */ if(precord->pact == FALSE) { precord->pact = TRUE; #if PRINT_PHASE_INFO epicsPrintf("db processing: phase I %s (%s)\n", precord->name, epicsThreadGetNameSelf()); #endif switch(pdevAdmin_dpvt->ind) { case AO_SHOT_NUMBER: qData.pFunc = devAdmin_AO_SHOT_NUMBER; break; case AO_OP_MODE: qData.pFunc = devAdmin_AO_OP_MODE; break; case AO_SET_BLIP: qData.pFunc = devAdmin_AO_SET_BLIP; break; case AO_CREATE_LOCAL_SHOT: qData.pFunc = devAdmin_AO_CREATE_LOCAL_SHOT; break; case AO_SAMPLING_RATE: qData.pFunc = devAdmin_AO_CLOCK; break; case AO_START_T0: qData.pFunc = devAdmin_AO_T0; qData.param.n32Arg0 = strtoul(pdevAdmin_dpvt->arg1, NULL, 0); break; case AO_STOP_T1: qData.pFunc = devAdmin_AO_T1; qData.param.n32Arg0 = strtoul(pdevAdmin_dpvt->arg1, NULL, 0); break; default: break; } epicsMessageQueueSend(pControlThreadConfig->threadQueueId, (void*) &qData, sizeof(ST_threadQueueData)); return 0; /*(0)=>(success ) */ } /* db processing: phase II -post processing */ if(precord->pact == TRUE) { #if PRINT_PHASE_INFO epicsPrintf("db processing: phase II %s (%s)\n", precord->name, epicsThreadGetNameSelf()); #endif precord->pact = FALSE; precord->udf = FALSE; switch(pdevAdmin_dpvt->ind) { case AO_OP_MODE: precord->val = pAdminCfg->ST_Base.opMode; break; default: break; } return 0; /*(0)=>(success ) */ } return -1; }