/** Add an edge to the ingress object using oblivious greedy assignment. */
 void add_edge(vertex_id_type source, vertex_id_type target,
               const EdgeData& edata) {
   dht[source]; dht[target];
   const std::vector<procid_t>& candidates = 
     constraint->get_joint_neighbors(get_master(source), get_master(target));
   const procid_t owning_proc = 
     base_type::edge_decision.edge_to_proc_greedy(source, target, dht[source], dht[target], candidates, proc_num_edges, usehash, userecent);
   typedef typename base_type::edge_buffer_record edge_buffer_record;
   edge_buffer_record record(source, target, edata);
   base_type::edge_exchange.send(owning_proc, record);
 } // end of add edge
示例#2
0
/* auto Run function */
static void devNI6123_BO_AUTO_RUN(ST_execParam *pParam)
{
        ST_MASTER *pMaster = get_master();
        ST_STD_device *pSTDdev = (ST_STD_device*) ellFirst(pMaster->pList_DeviceTask);
        ST_NI6123 *pNI6123 = NULL;

        kLog (K_TRACE, "[devNI6123_BO_AUTO_RUN] auto_run(%f)\n", pParam->setValue);

        if( pMaster->StatusAdmin & TASK_WAIT_FOR_TRIGGER ||
                        pMaster->StatusAdmin & TASK_IN_PROGRESS ) {
                kLog (K_ERR, "System is running! (0x%x)\n", pMaster->StatusAdmin);
                notify_error (1, "System is running! (0x%x)\n", pMaster->StatusAdmin);
                return;
        }

        if(pParam->setValue) {
                if( !(pMaster->StatusAdmin & TASK_SYSTEM_IDLE) ) {
                        kLog (K_ERR, "System is busy! (0x%x)\n", pMaster->StatusAdmin);
                        notify_error (1, "System is busy! (0x%x)\n", pMaster->StatusAdmin);
                        return;
                }
#if 0
		char strBuf[24];
		float stopT1;
	/*	remove this function because ECH has not LTU, so We donot use the DBproc_get function */
				if( pSTDdev->ST_Base.opMode == OPMODE_REMOTE ){
					DBproc_get (PV_LTU_TIG_T0_STR, strBuf);   //Get T0 from LTU
					DBproc_put (PV_START_TIG_T0_STR, strBuf);   //Set T0 from LTU
					sscanf(strBuf, "%f", &stopT1);
					stopT1 = pNI6123->sample_time - stopT1;
					sprintf(strBuf,"%f",stopT1);
					DBproc_put (PV_STOP_TIG_T1_STR, strBuf);   //Set T0 from LTU
				}
#endif
                while(pSTDdev) {
                        pSTDdev->StatusDev |= TASK_STANDBY;

                        pNI6123 = pSTDdev->pUser;
                        pNI6123->auto_run_flag = 1;

                        pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node);
                }
        }
        else if(!pParam->setValue) {
                while(pSTDdev) {
                        pNI6123 = pSTDdev->pUser;
                        pNI6123->auto_run_flag = 0;

                        pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node);
                }

                pMaster->n8EscapeWhile = 0;
                epicsThreadSleep(3.0);
                pMaster->n8EscapeWhile = 1;
                admin_all_taskStatus_reset();
                scanIoRequest(pMaster->ioScanPvt_status);
        }

        notify_refresh_master_status();
}
示例#3
0
static long devAoNI6254_init_record(aoRecord *precord)
{
	ST_dpvt *pSTdpvt = (ST_dpvt*) malloc(sizeof(ST_dpvt));
	int i;

	switch(precord->out.type) {
		case INST_IO:
			strcpy(pSTdpvt->recordName, precord->name);
			i = sscanf(precord->out.value.instio.string, "%s %s %s",
					pSTdpvt->arg0, pSTdpvt->devName, pSTdpvt->arg1);

			kLog (K_INFO, "[devAoNI6254_init_record] %d: %s %s %s\n",
					i, pSTdpvt->devName, pSTdpvt->arg0, pSTdpvt->arg1);

			if (1 == i) {
				ST_MASTER *pMaster = get_master();
				pSTdpvt->pSTDdev = (ST_STD_device*) ellFirst(pMaster->pList_DeviceTask);
			}
			else if (3 == i) {
				pSTdpvt->pSTDdev = (ST_STD_device *)get_STDev_from_name(pSTdpvt->devName);
			}

			if (!pSTdpvt->pSTDdev) {
				recGblRecordError(S_db_badField, (void*) precord, 
						"devAoNI6254Control (init_record) Illegal INP field: task_name");
				free(pSTdpvt);
				precord->udf = TRUE;
				precord->dpvt = NULL;
				return S_db_badField;
			}

			break;

		default:
			recGblRecordError(S_db_badField,(void*) precord,
					"devAoNI6254Control (init_record) Illegal OUT field");
			free(pSTdpvt);
			precord->udf = TRUE;
			precord->dpvt = NULL;
			return S_db_badField;
	}

	if (!strcmp(pSTdpvt->arg0, AO_DAQ_BEAM_PULSE_STR)) {
		pSTdpvt->ind		= AO_DAQ_BEAM_PULSE;
		pSTdpvt->n32Arg0	= strtoul(pSTdpvt->arg1, NULL, 0);
	}
	else if (!strcmp(pSTdpvt->arg0, AO_INTEGRAL_STIME_STR)) {
		pSTdpvt->ind		= AO_INTEGRAL_STIME;
		pSTdpvt->n32Arg0	= strtoul(pSTdpvt->arg1, NULL, 0);
	}
	else if (!strcmp(pSTdpvt->arg0, AO_INTEGRAL_TIME_STR)) {
		pSTdpvt->ind		= AO_INTEGRAL_TIME;
		pSTdpvt->n32Arg0	= strtoul(pSTdpvt->arg1, NULL, 0);
	}

	precord->udf = FALSE;
	precord->dpvt = (void*) pSTdpvt;

	return 2;     /* don't convert */
}
示例#4
0
static void devNI6123_AO_DAQ_MAX_VOLT(ST_execParam *pParam)
{
        ST_MASTER *pMaster = get_master();
        ST_STD_device *pSTDdev = (ST_STD_device*) ellFirst(pMaster->pList_DeviceTask);
        ST_NI6123 *pNI6123 = NULL;

        kLog (K_DATA,"[devNI6123_AO_DAQ_MAX_VOLT] minVolt(%f)\n", pParam->setValue);

        while(pSTDdev) {
                if (pSTDdev->StatusDev & TASK_ARM_ENABLED) {
                        kLog (K_DATA,"[devNI6123_AO_DAQ_MAX_VOLT] %s: System is armed! \n", pSTDdev->taskName);
                        notify_error (1, "System is armed!", pSTDdev->taskName );
                }
                else {
                        pNI6123 = pSTDdev->pUser;
                        pNI6123->maxVal = pParam->setValue;
                        scanIoRequest(pSTDdev->ioScanPvt_userCall);

                        kLog (K_DATA,"[devNI6123_AO_DAQ_MAX_VOLT] task(%s) maxVolt(%.f)\n",
                                        pSTDdev->taskName, pNI6123->maxVal);
                }

                pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node);
        }
}
示例#5
0
static long drvEC1_ANT_io_report (int level)
{
	ST_STD_device *pSTDdev;
	ST_MASTER *pMaster = get_master();

	if(!pMaster) return 0;

	if(ellCount(pMaster->pList_DeviceTask)) {
		pSTDdev = (ST_STD_device*) ellFirst (pMaster->pList_DeviceTask);
	}
	else {
		epicsPrintf("Task not found\n");
		return 0;
	}

  	epicsPrintf("Totoal %d task(s) found\n",ellCount(pMaster->pList_DeviceTask));

	if(level<1) return 0;

	while (pSTDdev) {
		if (level>2) {
			epicsPrintf("   Sampling Rate: %d/sec\n", pSTDdev->ST_Base.nSamplingRate );
		}

		if (level>3) {
			epicsPrintf("   status of Buffer-Pool (reused-counter/number of data/buffer pointer)\n");
			epicsPrintf("   ");
			epicsPrintf("\n");
		}

		pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node);
	}

	return 0;
}
示例#6
0
static void devNI6250_AO_DAQ_GAIN(ST_execParam *pParam)
{
	ST_MASTER *pMaster = get_master();
	ST_STD_device *pSTDdev = (ST_STD_device*) ellFirst(pMaster->pList_DeviceTask);
	ST_NI6250 *pNI6250 = NULL;

	kLog (K_MON, "[devNI6250_AO_DAQ_GAIN] gain(%f)\n", pParam->setValue);

	while(pSTDdev) {
		if (pSTDdev->StatusDev & TASK_ARM_ENABLED) {
			kLog (K_ERR, "[devNI6250_AO_DAQ_GAIN] %s: System is armed! \n", pSTDdev->taskName);
			notify_error (1, "System is armed!", pSTDdev->taskName );		
		}
		else {
			pNI6250 = pSTDdev->pUser;
			pNI6250->gain = pParam->setValue;
			scanIoRequest(pSTDdev->ioScanPvt_userCall); 			

			kLog (K_DEBUG, "[devNI6250_AO_DAQ_GAIN] task(%s) gain(%.f)\n",
					pSTDdev->taskName, pNI6250->gain);
		}

		pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node);
	}
}
示例#7
0
static void devNI6123_AO_DAQ_SAMPLEING_RATE(ST_execParam *pParam)
{
        ST_MASTER *pMaster = get_master();
        ST_STD_device *pSTDdev = (ST_STD_device*) ellFirst(pMaster->pList_DeviceTask);
        ST_NI6123 *pNI6123 = NULL;

        kLog (K_DATA,"[devNI6123_AO_DAQ_SAMPLEING_RATE] sampleRate(%f)\n", pParam->setValue);

        while(pSTDdev) {
                if (pSTDdev->StatusDev & TASK_ARM_ENABLED) {
                        kLog (K_DATA,"[devNI6123_AO_DAQ_SAMPLEING_RATE] %s: System is armed! \n", pSTDdev->taskName);
                        notify_error (1, "System is armed!", pSTDdev->taskName );
                }
                else {
                        pNI6123 = pSTDdev->pUser;
			if(pParam->setValue > pNI6123->sample_rateLimit){
				/*  Device Sampling Rate Limit Cut if User is over Sampling Rate Setting.  */
				pParam->setValue = pNI6123->sample_rateLimit;
			} else if(pParam->setValue <= 0){
				 pParam->setValue = 1;
			}
			pNI6123->sample_rate = pParam->setValue;
                        scanIoRequest(pSTDdev->ioScanPvt_userCall);

                        kLog (K_DATA,"[devNI6123_AO_DAQ_SAMPLEING_RATE] task(%s) sampleRate(%.f)\n",
                                        pSTDdev->taskName, pNI6123->sample_rate);
                }

                pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node);
        }
}
示例#8
0
static void devNI6123_AO_BEAM_PLUSE(ST_execParam *pParam)
{
	ST_MASTER *pMaster = get_master();
	ST_STD_device *pSTDdev = (ST_STD_device*) ellFirst(pMaster->pList_DeviceTask);
	ST_NI6123 *pNI6123 = NULL;

	kLog (K_TRACE, "[devNI6123_AO_BEAM_PLUSE] beam_pulse(%f)\n", pParam->setValue);

	while(pSTDdev) {
		if (pSTDdev->StatusDev & TASK_ARM_ENABLED) {
			kLog (K_ERR, "[devNI6123_AO_BEAM_PLUSE] %s: System is armed! \n", pSTDdev->taskName);
			notify_error (1, "System is armed!", pSTDdev->taskName );		
		}
		else {
			pNI6123 = pSTDdev->pUser;
			pNI6123->beam_pulse = pParam->setValue;
			scanIoRequest(pSTDdev->ioScanPvt_userCall); 			

			kLog (K_DEBUG, "[devNI6123_AO_BEAM_PLUSE] task(%s) pulse(%.f)\n",
					pSTDdev->taskName, pNI6123->beam_pulse);
		}

		pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node);
	}
}
示例#9
0
static long devBoNI6123_init_record(boRecord *precord)
{
	ST_dpvt *pSTdpvt = (ST_dpvt*) malloc(sizeof(ST_dpvt));
	int i;

	switch(precord->out.type) {
		case INST_IO:
			strcpy(pSTdpvt->recordName, precord->name);
			i = sscanf(precord->out.value.instio.string, "%s",
					pSTdpvt->arg0);

			kLog (K_INFO, "[devBoNI6123_init_record] arg num: %d: %s\n",i, pSTdpvt->arg0);

			ST_MASTER *pMaster = get_master();
			pSTdpvt->pSTDdev = (ST_STD_device*) ellFirst(pMaster->pList_DeviceTask);
			if(!pSTdpvt->pSTDdev) {
				recGblRecordError(S_db_badField, (void*) precord, 
						"devBoNI6123Control (init_record) Illegal INP field: task_name");
				free(pSTdpvt);
				precord->udf = TRUE;
				precord->dpvt = NULL;
				return S_db_badField;
			}

			break;

		default:
			recGblRecordError(S_db_badField,(void*) precord,
					"devBoNI6123Control (init_record) Illegal OUT field");
			free(pSTdpvt);
			precord->udf = TRUE;
			precord->dpvt = NULL;

			return S_db_badField;
	}
	if(!strcmp(pSTdpvt->arg0, BO_AUTO_RUN_STR)) {
                pSTdpvt->ind = BO_AUTO_RUN;
        }
	else if (!strcmp(pSTdpvt->arg0, BO_DAQ_STOP_STR)) {
		pSTdpvt->ind = BO_DAQ_STOP;
	} 
	else if (!strcmp(pSTdpvt->arg0, BO_TREND_RUN_STR)) {
		pSTdpvt->ind = BO_TREND_RUN;
	} 
	else if (!strcmp(pSTdpvt->arg0, BO_CALC_RUN_STR)) {
		pSTdpvt->ind = BO_CALC_RUN;
	} 
	else {
		pSTdpvt->ind = -1;
		kLog (K_ERR, "ERROR! devBoNI6123_init_record: arg0 \"%s\" \n",  pSTdpvt->arg0 );
	}

	precord->udf = FALSE;
	precord->dpvt = (void*) pSTdpvt;

	return 2;	  /*returns:(0,2)=>(success,success no convert*/
}
示例#10
0
void window_sub::resize_sub_buffer(coord_int w, coord_int h)
{
  if (sub_buffer) destroy_bitmap(sub_buffer);

  sub_buffer = create_bitmap_ex(bitmap_color_depth(get_master()->get_buffer()), w+1, h+1);     
  Assert(sub_buffer, "Error allocating new sub-buffer for window " << this);

  update_sub();
}
示例#11
0
void printStatusMsg ()
{
	char szStatusMsg[256];

	if (NULL != get_master()) {
		getStatusMsg (get_master()->StatusAdmin, szStatusMsg);
		kuDebug (kuMON, "[Master] %s\n", szStatusMsg);
	}

	ST_STD_device *pSTDdev = get_first_STDdev();

	while (pSTDdev) {
		getStatusMsg (pSTDdev->StatusDev, szStatusMsg);
		kuDebug (kuMON, "[Device] name(%s) : %s\n", pSTDdev->taskName, szStatusMsg);

		pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node);
	}
}
示例#12
0
static long drvACQ196_init_driver(void)
{
	ST_MASTER *pMaster = NULL;
	ST_ACQ196 *pAcq196 = NULL;
	ST_STD_device *pSTDdev = NULL;
	
	pMaster = get_master();
	if(!pMaster)	return 0;

	pSTDdev = (ST_STD_device*) ellFirst(pMaster->pList_DeviceTask);
	while(pSTDdev) 
	{
		if( create_acq196_taskConfig(pSTDdev) == WR_ERROR )
			return -1;
			
		pAcq196 = (ST_ACQ196 *)pSTDdev->pUser;
		drvACQ196_set_defaultAcq196(pSTDdev);

		
		switch(pSTDdev->BoardID){
			case 100: 
				sprintf(pAcq196->dataFileName, "%s/acq196.%d", STR_DEV1_RAW_DIR, pAcq196->slot);
	/*			sprintf(pAcq196->dataFileName, "/media/data1/acq196.%d", slot); */
				break;
			case 200:
				sprintf(pAcq196->dataFileName, "%s/acq196.%d", STR_DEV2_RAW_DIR, pAcq196->slot);
	/*			sprintf(pAcq196->dataFileName, "/media/data2/acq196.%d", slot); */
				break;
			case 300:
				sprintf(pAcq196->dataFileName, "%s/acq196.%d", STR_DEV3_RAW_DIR, pAcq196->slot);
	/*			sprintf(pAcq196->dataFileName, "/media/data3/acq196.%d", slot); */
				break;
			case 400:
				sprintf(pAcq196->dataFileName, "%s/acq196.%d", STR_DEV4_RAW_DIR, pAcq196->slot);
	/*			sprintf(pAcq196->dataFileName, "/root/data4/acq196.%d", slot); */
				break;
			default: break;
		}

		drvACQ196_status_reset(pSTDdev); /* add new function by woong  2009.7.15 */

		pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node);
	} /* while(pAcq196) { */
	
/*	
	if( make_Admin_CA() == WR_ERROR )
		epicsPrintf("\n>>> drvACQ196_init_driver(): make_Admin_CA() ... ERROR! \n");
*/
/*	epicsAtExit((EPICSEXITFUNC) clearAllacq196Tasks, NULL); */

	printf("Local device init OK!\n");
/*	printlog("IOC:HALPHA start ++++++++++++++++++++++++++++++++++++"); */

	return 0;
}
示例#13
0
static long drvACQ196_io_report(int level)
{
	ST_STD_device *pSTDdev;
	ST_ACQ196 *pAcq196;
	ST_MASTER *pMaster = get_master();

	if(!pMaster) return 0;

	if(ellCount(pMaster->pList_DeviceTask))
		pSTDdev = (ST_STD_device*) ellFirst (pMaster->pList_DeviceTask);
	else {
		epicsPrintf("Task not found\n");
		return 0;
	}

  	epicsPrintf("Totoal %d task(s) found\n",ellCount(pMaster->pList_DeviceTask));

	if(level<1) return 0;

	while(pSTDdev) {
		pAcq196 = (ST_ACQ196*)pSTDdev->pUser;
		epicsPrintf("  Task name: %s, vme_addr: 0x%X, status: 0x%x\n",
			    pSTDdev->taskName, 
			    (unsigned int)pSTDdev, 
			    pSTDdev->StatusDev );
		if(level>2) {
			epicsPrintf("   Sampling Rate: %d/sec\n", pSTDdev->ST_Base.nSamplingRate );
		}

		if(level>3 ) {
			epicsPrintf("   status of Buffer-Pool (reused-counter/number of data/buffer pointer)\n");
			epicsPrintf("   ");
			
			epicsPrintf("\n");
/*		
			epicsPrintf("   callback time: %fusec\n", pAcq196->callbackTimeUsec);
			epicsPrintf("   SmplRate adj. counter: %d, adj. time: %fusec\n", pAcq196->adjCount_smplRate,
					                                                 pAcq196->adjTime_smplRate_Usec);
			epicsPrintf("   Gain adj. counter: %d, adj. time: %fusec\n", pAcq196->adjCount_Gain,
					                                                   pAcq196->adjTime_Gain_Usec);
*/
		}


/*		if(ellCount(pAcq196->pchannelConfig)>0) print_channelConfig(pAcq196,level); */
		pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node);
	}

	return 0;
}
示例#14
0
static long devBiNI6254_init_record(biRecord *precord)
{
	ST_dpvt *pSTdpvt = (ST_dpvt*) malloc(sizeof(ST_dpvt));
	int i;

	switch(precord->inp.type) {
		case INST_IO:
			strcpy(pSTdpvt->recordName, precord->name);
			i = sscanf(precord->inp.value.instio.string, "%s", pSTdpvt->arg0);

			kLog (K_INFO, "[devBiNI6254_init_record] %d: %s\n", i, pSTdpvt->arg0);

			pSTdpvt->pMaster = get_master();

			if (!pSTdpvt->pMaster) {
				recGblRecordError(S_db_badField, (void*) precord,
						"devBiNI6254 (init_record) Illegal INP field: task name");
				free(pSTdpvt);
				precord->udf = TRUE;
				precord->dpvt = NULL;
				return S_db_badField;
			}

			break;

		default:
			recGblRecordError(S_db_badField, (void*) precord,
					"devBiNI6254 (init_record) Illegal INP field");
			free(pSTdpvt);
			precord->udf = TRUE;
			precord->dpvt = NULL;

			return S_db_badField;
	}

	pSTdpvt->ind	= -1;

	if (0) {
	}
	else {
		kLog (K_ERR, "[devBiNI6254_init_record] arg cnt (%d) \n",  i );
		return -1;	/*returns: (-1,0)=>(failure,success)*/
	}

	precord->udf	= FALSE;
	precord->dpvt	= (void*) pSTdpvt;

	return 0;
}
示例#15
0
int drvACQ196_check_AllStorageFinished()
{
	int cnt_done = 0;
	ST_MASTER *pMaster = get_master();
	ST_STD_device *pSTDdev = (ST_STD_device*) ellFirst(pMaster->pList_DeviceTask);
	while(pSTDdev) {
		if(pSTDdev->StatusDev & DEV_STORAGE_FINISH ) 
			cnt_done++;
		
  		pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node);
	}
	if( cnt_done == pMaster->s32DeviceNum  )
		return WR_OK;
	
	return WR_ERROR;
}
示例#16
0
int drvACQ196_check_AllReadyToSave()
{
	int cnt_done = 0;
	ST_MASTER *pMaster = get_master();
	ST_STD_device *pSTDdev = (ST_STD_device*) ellFirst(pMaster->pList_DeviceTask);
	while(pSTDdev) {
		if(pSTDdev->StatusDev & DEV_READY_TO_SAVE ) 
			cnt_done++;
		
  		pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node);
	}
	if( cnt_done == pMaster->s32DeviceNum )
		return WR_OK;

	return WR_ERROR;
}
示例#17
0
static void devNI6250_BO_DAQ_STOP(ST_execParam *pParam)
{
	kLog (K_MON, "[devNI6250_BO_DAQ_STOP] daq_stop(%f)\n", pParam->setValue);

	if (0 == pParam->setValue) {
		return;
	}

	resetDeviceAll ();

	notify_refresh_master_status();

	scanIoRequest(get_master()->ioScanPvt_status);

	DBproc_put(PV_SYS_ARMING_STR, "0");
	DBproc_put(PV_SYS_RUN_STR, "0");
	DBproc_put(PV_DAQ_STOP_STR, "0");
}
示例#18
0
static void devNI6254_BO_DAQ_STOP(ST_execParam *pParam)
{
	kLog (K_MON, "[devNI6254_BO_DAQ_STOP] daq_stop(%f)\n", pParam->setValue);

	if (0 == pParam->setValue) {
		return;
	}

	resetDeviceAll ();

	notify_refresh_master_status();

	scanIoRequest(get_master()->ioScanPvt_status);

	DBproc_put("NB1_LODAQ_DAQ_STOP", "0");
	DBproc_put("NB1_LODAQ_TREND_RUN", "0");
	DBproc_put("NB1_LODAQ_CALC_RUN", "0");
}
示例#19
0
static long drvRTCORE_io_report(int level)
{
	ST_STD_device *pSTDdev;
	ST_RTcore *pRTcore;
	ST_MASTER *pMaster = get_master();

	if(!pMaster) return 0;

	if(ellCount(pMaster->pList_DeviceTask))
		pSTDdev = (ST_STD_device*) ellFirst (pMaster->pList_DeviceTask);
	else {
		epicsPrintf("Task not found\n");
		return 0;
	}

  	epicsPrintf("Totoal %d task(s) found\n",ellCount(pMaster->pList_DeviceTask));

	if(level<1) return 0;

	while(pSTDdev) {
		pRTcore = (ST_RTcore *)pSTDdev->pUser;
		if(level>2) {
			epicsPrintf("   Sampling Rate: %d/sec\n", pSTDdev->ST_Base.nSamplingRate );
		}

		if(level>3 ) {
			epicsPrintf("   status of Buffer-Pool (reused-counter/number of data/buffer pointer)\n");
			epicsPrintf("   ");
			
			epicsPrintf("\n");
/*		
			epicsPrintf("   callback time: %fusec\n", pRTcore->callbackTimeUsec);
			epicsPrintf("   SmplRate adj. counter: %d, adj. time: %fusec\n", pRTcore->adjCount_smplRate,
					                                                 pRTcore->adjTime_smplRate_Usec);
			epicsPrintf("   Gain adj. counter: %d, adj. time: %fusec\n", pRTcore->adjCount_Gain,
					                                                   pRTcore->adjTime_Gain_Usec);
*/
		}

		pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node);
	}

	return 0;
}
示例#20
0
static void devNI6123_BO_DAQ_STOP(ST_execParam *pParam)
{
	kLog (K_MON, "[devNI6123_BO_DAQ_STOP] daq_stop(%f)\n", pParam->setValue);

	if (0 == pParam->setValue) {
		return;
	}

	resetDeviceAll ();

	notify_refresh_master_status();

	scanIoRequest(get_master()->ioScanPvt_status);

	DBproc_put(PV_DAQ_STOP_STR, "0");
/* remove tglee
   DBproc_put(PV_TREND_RUN_STR, "0");
	DBproc_put(PV_CALC_RUN_STR, "0");
*/
}
示例#21
0
static long drvRTCORE_init_driver(void)
{
	ST_MASTER *pMaster = NULL;	
	ST_STD_device *pSTDdev = NULL;
	
	pMaster = get_master();
	if(!pMaster)	return 0;

	pSTDdev = (ST_STD_device*) ellFirst(pMaster->pList_DeviceTask);
	while(pSTDdev) 
	{
		if( strcmp(pSTDdev->devType, STR_DEVICE_TYPE_1) != 0 ) {
			pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node);
			continue;
		}

		if(create_RTcore_taskConfig( pSTDdev ) == WR_ERROR) {
			printf("ERROR!  \"%s\" create_RTcore_taskConfig() failed.\n", pSTDdev->taskName );
			return 1;
		}
		
		init_my_sfwFunc_RTcore(pSTDdev);
		
	
		init_DivThreads_RTcore( pSTDdev);

		


		pSTDdev->StatusDev |= TASK_SYSTEM_IDLE;
		pSTDdev->StatusDev |= TASK_STANDBY;
		pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node);
	} /* while(pRTcore) { */

	notify_refresh_master_status();

	printf("****** RTcore local device init OK!\n");

	return 0;
}
示例#22
0
static void devNI6123_AO_DAQ_SAMPLEING_TIME(ST_execParam *pParam)
{
        ST_MASTER *pMaster = get_master();
        ST_STD_device *pSTDdev = (ST_STD_device*) ellFirst(pMaster->pList_DeviceTask);
        ST_NI6123 *pNI6123 = NULL;

        kLog (K_DATA,"[devNI6123_AO_DAQ_SAMPLEING_TIME] sampleTime(%f)\n", pParam->setValue);
#if 0
		char strBuf[24];
		float stopT1;
	/*	remove this function because ECH has not LTU, so We donot use the DBproc_get function */
		if (!(pSTDdev->StatusDev & TASK_ARM_ENABLED)) {
			/* Change T0 value form LUT when Remote Mode TG */
			if( pSTDdev->ST_Base.opMode == OPMODE_REMOTE ){
			/*	DBproc_get (PV_LTU_TIG_T0_STR, strBuf);   Get T0 from LTU - ECH Not yet ready LTU*/
				DBproc_put (PV_START_TIG_T0_STR, strBuf);   //Set T0 from LTU 
				sscanf(strBuf, "%f", &stopT1);
				stopT1 = pParam->setValue - stopT1;
				sprintf(strBuf,"%f",stopT1);
				DBproc_put (PV_STOP_TIG_T1_STR, strBuf);   //Set T0 from LTU
			}
		}
#endif
        while(pSTDdev) {
                if (pSTDdev->StatusDev & TASK_ARM_ENABLED) {
                        kLog (K_DATA,"[devNI6123_AO_DAQ_SAMPLEING_TIME] %s: System is armed! \n", pSTDdev->taskName);
                        notify_error (1, "System is armed!", pSTDdev->taskName );
                }
                else {
                        pNI6123 = pSTDdev->pUser;
                        pNI6123->sample_time = pParam->setValue;
                        scanIoRequest(pSTDdev->ioScanPvt_userCall);

                        kLog (K_DATA,"[devNI6123_AO_DAQ_SAMPLEING_TIME] task(%s) sampleTime(%.f)\n",
                                        pSTDdev->taskName, pNI6123->sample_rate);
                }
                pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node);
        }
}
示例#23
0
static long drvEC1_ANT_init_driver (void)
{
	ST_MASTER *pMaster = NULL;
	ST_STD_device *pSTDdev = NULL;
	
	pMaster = get_master();
	if(!pMaster)	return 0;

	pSTDdev = (ST_STD_device*) ellFirst(pMaster->pList_DeviceTask);

	while (pSTDdev) {
		kuDebug (kuMON, "[drvEC1_ANT_init_driver] devType(%s) type(%s)\n", pSTDdev->devType, STR_DEVICE_TYPE_1);

		if (strcmp (pSTDdev->devType, STR_DEVICE_TYPE_1) != 0) {
			pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node);
			continue;
		}

		if (create_EC1_ANT_taskConfig (pSTDdev) == WR_ERROR) {
			printf ("ERROR!  \"%s\" create_EC1_ANT_taskConfig() failed.\n", pSTDdev->taskName);
			return 1;
		}
		
		init_my_sfwFunc_EC1_ANT (pSTDdev);
		
		pSTDdev->StatusDev |= TASK_SYSTEM_IDLE;
		pSTDdev->StatusDev |= TASK_STANDBY;

		pSTDdev = (ST_STD_device*) ellNext(&pSTDdev->node);
	}

	notify_refresh_master_status ();

	kuDebug (kuMON, "[drvEC1_ANT_init_driver] local device init OK!\n");

	return 0;
}
示例#24
0
static int Is_All_Slave_DAQ_STOPED()
{
	int cnt = 0;
	int brd_cnt=0;
	ST_MASTER *pMaster = get_master();
	ST_STD_device*pSTDdev = (ST_STD_device*) ellLast(pMaster->pList_DeviceTask);
	while(pSTDdev) {
		if( drvACQ196_is_Master(pSTDdev) == WR_ERROR ) 
		{
			if( !(pSTDdev->StatusDev & TASK_IN_PROGRESS) ) {
/*				printf("%s daq stoped!\n", pSTDdev->taskName ); */
				cnt++;
			}
			brd_cnt++;
/*			printf("cnt: %d, brd_cnt: %d\n", cnt, brd_cnt); */
		}
		
		pSTDdev = (ST_STD_device*) ellPrevious(&pSTDdev->node);
	}

	if( cnt == brd_cnt ) return WR_OK; /* 1*/

	return WR_ERROR; /* 0 */
}
示例#25
0
AudioProcessorState *
AudioProcessor::get_state(vtime_t time)
{
  AudioProcessorState *state = new AudioProcessorState;
  if (!state) return 0;

  // Channel order
  get_input_order(state->input_order);
  get_output_order(state->output_order);
  // Master gain
  state->master = get_master();
  state->gain   = get_gain();
  // AGC options
  state->auto_gain = get_auto_gain();
  state->normalize = get_normalize();
  state->attack    = get_attack();
  state->release   = get_release();
  // DRC
  state->drc       = get_drc();
  state->drc_power = get_drc_power();
  state->drc_level = get_drc_level();
  // Matrix
  get_matrix(state->matrix);
  // Automatrix options
  state->auto_matrix      = get_auto_matrix();
  state->normalize_matrix = get_normalize_matrix();
  state->voice_control    = get_voice_control();
  state->expand_stereo    = get_expand_stereo();
  // Automatrix levels
  state->clev = get_clev();
  state->slev = get_slev();
  state->lfelev = get_lfelev();
  // Input/output gains
  get_input_gains(state->input_gains);
  get_output_gains(state->output_gains);
  // Input/output levels
  get_input_levels(time, state->input_levels);
  get_output_levels(time, state->output_levels);
  // SRC
  state->src_quality = get_src_quality();
  state->src_att     = get_src_att();
  // Equalizer
  state->eq = get_eq();
  state->eq_master_nbands = get_eq_nbands(CH_NONE);
  state->eq_master_bands = 0;
  if (state->eq_master_nbands)
  {
    state->eq_master_bands = new EqBand[state->eq_master_nbands];
    get_eq_bands(CH_NONE, state->eq_master_bands, 0, state->eq_master_nbands);
  }

  for (int ch_name = 0; ch_name < CH_NAMES; ch_name++)
  {
    state->eq_nbands[ch_name] = get_eq_nbands(ch_name);
    state->eq_bands[ch_name] = 0;
    if (state->eq_nbands[ch_name])
    {
      state->eq_bands[ch_name] = new EqBand[state->eq_nbands[ch_name]];
      get_eq_bands(ch_name, state->eq_bands[ch_name], 0, state->eq_nbands[ch_name]);
    }
  }

  // Bass redirection
  state->bass_redir = get_bass_redir();
  state->bass_freq = get_bass_freq();
  state->bass_channels = get_bass_channels();
  // Delays
  state->delay = get_delay();
  state->delay_units = get_delay_units();
  get_delays(state->delays);
  // Dithering
  state->dithering = get_dithering();

  return state;
}
示例#26
0
void threadFunc_RTcore_DAQ(void *param)
{
	ST_STD_device *pSTDdev = (ST_STD_device*) param;
	ST_RTcore *pRTcore;
	ST_MASTER *pMaster = NULL;

	ST_STD_device *pSTDRMchk = NULL;
	ST_RMCHK *pRMCHK;	
	
	epicsThreadId pthreadInfo;
	ST_User_Buf_node queueData;
	ST_buf_node *pbufferNode = NULL;

	
	pMaster = get_master();
	if(!pMaster)	return;

	if( !pSTDdev ) {
		printf("ERROR! threadFunc_user_DAQ() has null pointer of STD device.\n");
		return;
	}

	pRTcore = (ST_RTcore *)pSTDdev->pUser;
	if( !pRTcore ) {
		printf("ERROR! threadFunc_user_DAQ() has null pointer of pRTcore.\n");
		return;
	}
/* get RFM device ******************************************* */
	pSTDRMchk = get_STDev_from_type(STR_DEVICE_TYPE_2);
	if( !pSTDRMchk ) {
		printf("ERROR! threadFunc_RTcore_DAQ() has null pointer of Dev2.\n");
		return;
	} else {
		printf("target RMchk: %p, eventID:%d\n", pSTDRMchk, pSTDRMchk->ST_DAQThread.threadEventId );
	}
	pRMCHK = (ST_RMCHK *)pSTDRMchk->pUser;
	if( !pRMCHK ) {
		printf("ERROR! threadFunc_RTcore_RT() has null pointer of pRMCHK.\n");
		return;
	}
/*********************************************************** */

#if USE_CPU_AFFINITY_RT	
	pthreadInfo = epicsThreadGetIdSelf();
/*	printf("%s: EPICS ID %p, pthreadID %lu\n", pthreadInfo->name, (void *)pthreadInfo, (unsigned long)pthreadInfo->tid); */
	epicsThreadSetCPUAffinity( pthreadInfo, AFFINITY_RTCORE_DAQ);
	epicsThreadSetPosixPriority(pthreadInfo, PRIOTY_RTCORE_DAQ, "SCHED_FIFO");
#endif

#if USE_RTCORE_DAQRING
	epicsThreadSleep(1.0);
	pbufferNode = (ST_buf_node *)ellFirst(pSTDdev->pList_BufferNode);
	ellDelete(pSTDdev->pList_BufferNode, &pbufferNode->node);
#endif

	while(TRUE) {
		epicsEventWait( pSTDdev->ST_DAQThread.threadEventId);

#if USE_RTCORE_DAQ_HIGH
		WRITE32(pRTcore->base0 + 0x4, 0x1);
#endif
#if USE_RTCORE_DAQ_LOW
		WRITE32(pRTcore->base0 + 0x4, 0x0);
#endif

#if USE_RTCORE_DAQRING
		pbufferNode->data[pRTcore->cntDAQ_loop * LOOP_ELM + 0] = pRMCHK->mapBuf[RM_PCS_CNT/4];
		pbufferNode->data[pRTcore->cntDAQ_loop * LOOP_ELM + 1] = pRMCHK->mapBuf[RM_PF1_CNT/4];
		pbufferNode->data[pRTcore->cntDAQ_loop * LOOP_ELM + 2] = pRMCHK->mapBuf[RM_PF2_CNT/4];
		pbufferNode->data[pRTcore->cntDAQ_loop * LOOP_ELM + 3] = pRMCHK->mapBuf[RM_PF3U_CNT/4];
		pbufferNode->data[pRTcore->cntDAQ_loop * LOOP_ELM + 4] = pRMCHK->mapBuf[RM_PF3L_CNT/4];
		pbufferNode->data[pRTcore->cntDAQ_loop * LOOP_ELM + 5] = pRMCHK->mapBuf[RM_PF4U_CNT/4];
		pbufferNode->data[pRTcore->cntDAQ_loop * LOOP_ELM + 6] = pRMCHK->mapBuf[RM_PF4L_CNT/4];
		pbufferNode->data[pRTcore->cntDAQ_loop * LOOP_ELM + 7] = pRMCHK->mapBuf[RM_PF5U_CNT/4];
		pbufferNode->data[pRTcore->cntDAQ_loop * LOOP_ELM + 8] = pRMCHK->mapBuf[RM_PF5L_CNT/4];
		pbufferNode->data[pRTcore->cntDAQ_loop * LOOP_ELM + 9] = pRMCHK->mapBuf[RM_PF6U_CNT/4];
		pbufferNode->data[pRTcore->cntDAQ_loop * LOOP_ELM + 10] = pRMCHK->mapBuf[RM_PF6L_CNT/4];
		pbufferNode->data[pRTcore->cntDAQ_loop * LOOP_ELM + 11] = pRMCHK->mapBuf[RM_PF7_CNT/4];
		pbufferNode->data[pRTcore->cntDAQ_loop * LOOP_ELM + 12] = pRMCHK->mapBuf[RM_IVC_CNT/4];

		
//		pRTcore->cntDAQ++;

		pRTcore->cntDAQ_loop++;
		pRTcore->cntAccum += LOOP_ELM;


		if( pRTcore->cntDAQ_loop >= LOOP_CNT ) {
			queueData.pNode		= pbufferNode;
			queueData.timeStamp	= 0x0;
			epicsMessageQueueSend(pSTDdev->ST_RingBufThread.threadQueueId, (void*) &queueData, sizeof(ST_User_Buf_node));

			pbufferNode = (ST_buf_node *)ellFirst(pSTDdev->pList_BufferNode);
			ellDelete(pSTDdev->pList_BufferNode, &pbufferNode->node);

			pRTcore->cntDAQ_loop = 0;

		}
#endif	
		pSTDdev->stdDAQCnt++;

		if( pRTcore->useScanIoRequest )
			scanIoRequest(pSTDdev->ioScanPvt_userCall);
	}
}
示例#27
0
void threadFunc_user_CatchEnd(void *param)
{
	ST_ACQ196 *pAcq196;
	ST_MASTER *pMaster;
	ST_STD_device *pSTDdev = (ST_STD_device*) param;

	while (!pSTDdev)  {
		printf("ERROR! threadFunc_user_CatchEnd() has null pointer of STD device.\n");
		epicsThreadSleep(.1);
	}
	pAcq196 = (ST_ACQ196*)pSTDdev->pUser;
	pMaster = get_master();
	
	while(TRUE) 
	{
		epicsEventWait( pSTDdev->ST_CatchEndThread.threadEventId);
		printf("%s: got End event! it will sleep %fsec. \n", pSTDdev->taskName, pSTDdev->ST_Base_fetch.dT1[0] + 0.1);
		epicsThreadSleep( pSTDdev->ST_Base_fetch.dT1[0] + 0.1 );
		printf(">>> %s: Caught the T1 stop trigger!\n", pSTDdev->taskName);


		DBproc_put( pAcq196->pvName_DEV_RUN, "0" );
		epicsThreadSleep( 1.0 );
/*
		if( !drvACQ196_RUN_stop(pSTDdev) )
			continue;
*/
		drvACQ196_wait_RUN_stop_complete(pSTDdev);

		DBproc_put( pAcq196->pvName_DEV_ARMING, "0" );
		epicsThreadSleep( 1.0 );


		pMaster->StatusAdmin &= ~TASK_SYSTEM_IDLE;
		pMaster->StatusAdmin |= TASK_POST_PROCESS;
		scanIoRequest(pMaster->ioScanPvt_status);
		if( drvACQ196_set_data_parsing( pSTDdev ) == WR_ERROR )
			continue;

		notify_refresh_master_status();
		
		if( pMaster->cUseAutoSave )
		{

			pMaster->StatusAdmin |= TASK_DATA_TRANSFER;
			scanIoRequest(pMaster->ioScanPvt_status);

			if( admin_spinLock_mds_put_flag(pSTDdev) == WR_OK ) 
			{ 
				printf("\"%s\" start data tranfer to MDS tree.\n", pSTDdev->taskName );
				if( drvACQ196_set_send_data( pSTDdev) == WR_ERROR ) {
					printf("\"%s\" data send error!\n ", pSTDdev->taskName );
					pMaster->n8MdsPutFlag  = 0;
					continue;
				}
				printf("\"%s\" release mds put flag ", pSTDdev->taskName );
				/*epicsMutexLock(pST_Master->lock_mds);*/
				pMaster->n8MdsPutFlag  = 0; /* ok. I'm finished. release write process. */				
				/*epicsMutexUnlock(pST_Master->lock_mds);*/
				printf("... OK.\n");
				
			}
/*			notify_refresh_master_status(); */
/*
			epicsMutexLock(pST_Master->lock_mds);
			drvACQ196_set_send_data( pSTDdev);
			epicsMutexUnlock(pST_Master->lock_mds);
*/
			if( drvACQ196_check_AllStorageFinished() == WR_OK ) 
			{
				printf("\n######################################(%s)\n", pSTDdev->taskName);
				printf("HALPHA: Ready to Next Shot(%s)\n", pSTDdev->taskName);
#if 1				
				if( mds_notify_EndOfTreePut(pSTDdev) == WR_ERROR ) /* it will be good for Remote mode.		 2009-11-20 */	
				{
					printlog("%s, MDS event send error!.\n", pSTDdev->taskName);
				}
#endif
/*				wf_print_date();		*//* 2009-11-24 */
				printlog("---- \n");
				pMaster->StatusAdmin |= TASK_SYSTEM_IDLE;
				notify_refresh_master_status();
				printf("######################################(%s)\n", pSTDdev->taskName);
				DBproc_put(pMaster->strPvNames[NUM_SYS_RUN], "0");
				DBproc_put(pMaster->strPvNames[NUM_SYS_ARMING], "0");
			}
		
		}	/* eof auto data put function */
		
		/* back to waiting for next shot start */
		
	}/* eof  While(TRUE) */

}
示例#28
0
void threadFunc_EC1_ANT_RT (void *param)
{
	ST_STD_device *pSTDmy = (ST_STD_device*) param;
	ST_EC1_ANT *pEC1_ANT;
	ST_MASTER *pMaster = NULL;

	epicsThreadId pthreadInfo;
	
	//int nFirst = 1;
	//int toggle = 1;
	
	pMaster = get_master();
	if(!pMaster)	return;

	pEC1_ANT = (ST_EC1_ANT *)pSTDmy->pUser;
	if( !pEC1_ANT ) {
		printf("ERROR! threadFunc_user_DAQ() has null pointer of pEC1_ANT.\n");
		return;
	}

#if USE_CPU_AFFINITY_RT	
	pthreadInfo = epicsThreadGetIdSelf();
	printf("%s: EPICS ID %p, pthreadID %lu\n", pthreadInfo->name, (void *)pthreadInfo, (unsigned long)pthreadInfo->tid);
	epicsThreadSetCPUAffinity( pthreadInfo, "5");
	epicsThreadSetPosixPriority(pthreadInfo, PRIOTY_EC1_ANT, "SCHED_FIFO");
#endif

	int		num_samples = 1;
	float	read_buf[num_samples];
	int		scans_read;

	while(TRUE) {
#if 0
		epicsEventWait (pSTDmy->ST_RTthread.threadEventId);

		//		pSTDmy->StatusDev |= TASK_WAIT_FOR_TRIGGER;
		//		notify_refresh_master_status();

		nFirst = 1;
		toggle = 1;
		printf("%s: Got epics RT Run event.\n", pSTDmy->taskName);
#endif

#if 0
		while(TRUE) {
			got	= read(pEC1_ANT->fd_event, &nval, 4);

			toggle = 0;

			pSTDmy->rtCnt++; 

			if( nFirst ) {
				send_master_stop_event();
				nFirst = 0;
			}
			
			if( pEC1_ANT->useScanIoRequest ) {
				scanIoRequest(pSTDmy->ioScanPvt_userCall);
			}

			if( !(pSTDmy->StatusDev & TASK_IN_PROGRESS ) )
			{
				pSTDmy->StatusDev &= ~TASK_WAIT_FOR_TRIGGER;
				printf("system stop!.. bye RT thread!\n");
				break;
			}
		}
#else
		while (TRUE) {
			// read scaled samples for synchronization with PCSRT1
			if (0 > (scans_read = pxi6259_read_ai (pEC1_ANT->channelFD, read_buf, num_samples))) {
				epicsThreadSleep (0.00001);
				continue;
			}

			kuDebug (kuDEBUG, "[EC1_ANT_RT] schedule RfmHandler ...\n");

			// schedule RfmHandler
			epicsEventSignal (pEC1_ANT->ctrlRunEventId);
		}
#endif

		if( pMaster->cUseAutoSave ) {
			//db_put("HICS_EC1_ANT_SEND_DATA", "1");
		}
	}
}
示例#29
0
static long devAiNI6254_init_record(aiRecord *precord)
{
	ST_dpvt *pSTdpvt = (ST_dpvt*) malloc(sizeof(ST_dpvt));
	int i;

	switch(precord->inp.type) {
		case INST_IO:
			strcpy(pSTdpvt->recordName, precord->name);
			i = sscanf(precord->inp.value.instio.string, "%s %s %s",
					pSTdpvt->devName, pSTdpvt->arg0, pSTdpvt->arg1);

			kLog (K_INFO, "[devAiNI6254_init_record] %d: %s %s %s\n",
					i, pSTdpvt->devName, pSTdpvt->arg0, pSTdpvt->arg1);

			if (1 == i) {
				strcpy (pSTdpvt->arg0, pSTdpvt->devName);
				pSTdpvt->pMaster = get_master();
			}
			else {
				pSTdpvt->pSTDdev = (ST_STD_device *)get_STDev_from_name(pSTdpvt->devName);

				if (!pSTdpvt->pSTDdev) {
					recGblRecordError(S_db_badField, (void*) precord,
							"devAiNI6254 (init_record) Illegal INP field: task name");
					free(pSTdpvt);
					precord->udf = TRUE;
					precord->dpvt = NULL;
					return S_db_badField;
				}
			}

			break;

		default:
			recGblRecordError(S_db_badField, (void*) precord,
					"devAiNI6254 (init_record) Illegal INP field");
			free(pSTdpvt);
			precord->udf = TRUE;
			precord->dpvt = NULL;

			return S_db_badField;
	}

	pSTdpvt->ind	= -1;

	if (1 == i) {
	}
	else if (2 == i) {
		if (!strcmp (pSTdpvt->arg0, AI_READ_STATE_STR)) {
			pSTdpvt->ind		= AI_READ_STATE;
		}
	}
	else if (3 == i) {
		if (!strcmp (pSTdpvt->arg1, AI_RAW_VALUE_STR)) {
			pSTdpvt->ind		= AI_RAW_VALUE;
			pSTdpvt->n32Arg0	= strtoul(pSTdpvt->arg0, NULL, 0);
		}
		else if (!strcmp (pSTdpvt->arg1, AI_VALUE_STR)) {
			pSTdpvt->ind		= AI_VALUE;
			pSTdpvt->n32Arg0	= strtoul(pSTdpvt->arg0, NULL, 0);
		}
		else if (!strcmp (pSTdpvt->arg1, AI_POWER_STR)) {
			pSTdpvt->ind		= AI_POWER;
			pSTdpvt->n32Arg0	= strtoul(pSTdpvt->arg0, NULL, 0);
		}
		else if (!strcmp (pSTdpvt->arg1, AI_FLOW_STR)) {
			pSTdpvt->ind		= AI_FLOW;
			pSTdpvt->n32Arg0	= strtoul(pSTdpvt->arg0, NULL, 0);
		}
	}
	else {
		kLog (K_ERR, "[devAiNI6254_init_record] arg cnt (%d) \n",  i );
		return -1;	/*returns: (-1,0)=>(failure,success)*/
	}

	precord->udf	= FALSE;
	precord->dpvt	= (void*) pSTdpvt;

	return 2;    /* don't convert */ 
}
示例#30
0
static long devAoNI6123_init_record(aoRecord *precord)
{
	ST_dpvt *pSTdpvt = (ST_dpvt*) malloc(sizeof(ST_dpvt));
	int i;

	switch(precord->out.type) {
		case INST_IO:
			strcpy(pSTdpvt->recordName, precord->name);
			i = sscanf(precord->out.value.instio.string, "%s %s %s",
					pSTdpvt->arg0, pSTdpvt->devName, pSTdpvt->arg1);

			kLog (K_INFO, "[devAoNI6123_init_record] %d: %s %s %s\n",
					i, pSTdpvt->devName, pSTdpvt->arg0, pSTdpvt->arg1);

			if (1 == i) {
				ST_MASTER *pMaster = get_master();
				pSTdpvt->pSTDdev = (ST_STD_device*) ellFirst(pMaster->pList_DeviceTask);
			}
			else if (3 == i) {
				pSTdpvt->pSTDdev = (ST_STD_device *)get_STDev_from_name(pSTdpvt->devName);
			}

			if (!pSTdpvt->pSTDdev) {
				recGblRecordError(S_db_badField, (void*) precord, 
						"devAoNI6123Control (init_record) Illegal INP field: task_name");
				free(pSTdpvt);
				precord->udf = TRUE;
				precord->dpvt = NULL;
				return S_db_badField;
			}

			break;

		default:
			recGblRecordError(S_db_badField,(void*) precord,
					"devAoNI6123Control (init_record) Illegal OUT field");
			free(pSTdpvt);
			precord->udf = TRUE;
			precord->dpvt = NULL;
			return S_db_badField;
	}

	if (!strcmp(pSTdpvt->arg0, AO_DAQ_BEAM_PLUSE_T0_STR)) {
		pSTdpvt->ind            = AO_DAQ_BEAM_PLUSE_T0;
	}
	else if (!strcmp(pSTdpvt->arg0, AO_DAQ_BEAM_PLUSE_T1_STR)) {
		pSTdpvt->ind            = AO_DAQ_BEAM_PLUSE_T1;
	}
	else if (!strcmp(pSTdpvt->arg0, AO_DAQ_MIN_VOLT_STR)) {
		pSTdpvt->ind            = AO_DAQ_MIN_VOLT;
	}
	else if (!strcmp(pSTdpvt->arg0, AO_DAQ_MAX_VOLT_STR)) {
		pSTdpvt->ind            = AO_DAQ_MAX_VOLT;
	}
	else if (!strcmp(pSTdpvt->arg0, AO_DAQ_SAMPLING_RATE_STR)) {
		pSTdpvt->ind            = AO_DAQ_SAMPLING_RATE;
	}
	else if (!strcmp(pSTdpvt->arg0, AO_DAQ_SAMPLING_TIME_STR)) {
		pSTdpvt->ind            = AO_DAQ_SAMPLING_TIME;
	}
	else if (!strcmp(pSTdpvt->arg0, AO_DAQ_BEAM_PLUSE_STR)) {
		pSTdpvt->ind			= AO_DAQ_BEAM_PLUSE;
	}
	else if (!strcmp(pSTdpvt->arg0, AO_DENSITY_FRINGE_STR)) {
		pSTdpvt->ind			= AO_DENSITY_FRINGE;
		pSTdpvt->n32Arg0		= strtoul(pSTdpvt->arg1, NULL, 0);
	}
	else if (!strcmp(pSTdpvt->arg0, AO_DENSITY_LIMITE_UP_STR)) {
		pSTdpvt->ind			= AO_DENSITY_LIMITE_UP;
		pSTdpvt->n32Arg0		= strtoul(pSTdpvt->arg1, NULL, 0);
	}
	else if (!strcmp(pSTdpvt->arg0, AO_DENSITY_LIMITE_LOW_STR)) {
		pSTdpvt->ind			= AO_DENSITY_LIMITE_LOW;
		pSTdpvt->n32Arg0		= strtoul(pSTdpvt->arg1, NULL, 0);
	}
	else if (!strcmp(pSTdpvt->arg0, AO_DENSITY_CONSTANT_A_STR)) {
		pSTdpvt->ind			= AO_DENSITY_CONSTANT_A;
		pSTdpvt->n32Arg0		= strtoul(pSTdpvt->arg1, NULL, 0);
	}
	else if (!strcmp(pSTdpvt->arg0, AO_DENSITY_CONSTANT_B_STR)) {
		pSTdpvt->ind			= AO_DENSITY_CONSTANT_B;
		pSTdpvt->n32Arg0		= strtoul(pSTdpvt->arg1, NULL, 0);
	}
	else if (!strcmp(pSTdpvt->arg0, AO_DENSITY_CONSTANT_C_STR)) {
		pSTdpvt->ind			= AO_DENSITY_CONSTANT_C;
		pSTdpvt->n32Arg0		= strtoul(pSTdpvt->arg1, NULL, 0);
	}
	else if (!strcmp(pSTdpvt->arg0, AO_DENSITY_CONSTANT_D_STR)) {
		pSTdpvt->ind			= AO_DENSITY_CONSTANT_D;
		pSTdpvt->n32Arg0		= strtoul(pSTdpvt->arg1, NULL, 0);
	}
	else if (!strcmp(pSTdpvt->arg0, AO_INTEGRAL_TIME_STR)) {
		pSTdpvt->ind			= AO_INTEGRAL_TIME;
		pSTdpvt->n32Arg0		= strtoul(pSTdpvt->arg1, NULL, 0);
	}
	else if (!strcmp(pSTdpvt->arg0, AO_FLOW_STR)) {
		pSTdpvt->ind			= AO_FLOW;
		pSTdpvt->n32Arg0		= strtoul(pSTdpvt->arg1, NULL, 0);
	}
	else if (!strcmp(pSTdpvt->arg0, AO_MDS_PARAM_VALUE1_STR)) {
		pSTdpvt->ind			= AO_MDS_PARAM_VALUE1;
		pSTdpvt->n32Arg0		= strtoul(pSTdpvt->arg1, NULL, 0);
	}
	else if (!strcmp(pSTdpvt->arg0, AO_MDS_PARAM_VALUE2_STR)) {
		pSTdpvt->ind			= AO_MDS_PARAM_VALUE2;
		pSTdpvt->n32Arg0		= strtoul(pSTdpvt->arg1, NULL, 0);
	}
	else if (!strcmp(pSTdpvt->arg0, AO_MDS_PARAM_VALUE3_STR)) {
		pSTdpvt->ind			= AO_MDS_PARAM_VALUE3;
		pSTdpvt->n32Arg0		= strtoul(pSTdpvt->arg1, NULL, 0);
	}
	else if (!strcmp(pSTdpvt->arg0, AO_MDS_PARAM_VALUE4_STR)) {
		pSTdpvt->ind			= AO_MDS_PARAM_VALUE4;
		pSTdpvt->n32Arg0		= strtoul(pSTdpvt->arg1, NULL, 0);
	}
	else if (!strcmp(pSTdpvt->arg0, AO_MDS_PARAM_VALUE5_STR)) {
		pSTdpvt->ind			= AO_MDS_PARAM_VALUE5;
		pSTdpvt->n32Arg0		= strtoul(pSTdpvt->arg1, NULL, 0);
	}

	precord->udf = FALSE;
	precord->dpvt = (void*) pSTdpvt;

	return 2;     /* don't convert */
}