Exemple #1
0
void writetag(cUINT utype, chid searchID)
{
	cUINT  type;

	switch (utype)
	{
		case T_CIP_INT:
			type   = DBR_INT;
			ca_put(type, searchID, &iWriteDATA);
			break;

		case T_CIP_DINT:
			type   = DBR_DOUBLE;
			ca_put(type, searchID, &dblWriteDATA);
			break;

		case T_CIP_BITS:
			type   = DBR_INT;
			if (bDATA%2==0)
				bDATA=0;
			else
			bDATA=255;
			ca_put(type, searchID, &bWriteDATA);
			break;

		case T_CIP_REAL:
			type   = DBR_FLOAT;
			ca_put(type, searchID, &fltWriteDATA);
			break;
	}//end switch
	istatus = ca_pend_io(0.1);
	//printf("WRITEtag   istatus : %d\n", istatus);
}
Exemple #2
0
static void ca_write_process(MSFilter *f){
	CAData *d = (CAData *) f->data;
	mblk_t *m;
	while((m=ms_queue_get(f->inputs[0]))!=NULL){
		ca_put(d,m);
	}
}
Exemple #3
0
int main(int argc,char **argv)
{
  int indval,field;

  SEVCHK(ca_task_initialize(),"ca_task_initialize");
  SEVCHK(ca_search("enumCputDTYP",&putCchid[0]),"ca_search failure");
  SEVCHK(ca_search("enumCputPRIO",&putCchid[1]),"ca_search failure");
  SEVCHK(ca_search("enumCputVAL" ,&putCchid[2]),"ca_search failure");
  SEVCHK(ca_search("enumMDbputDTYP",&putMDbchid[0]),"ca_search failure");
  SEVCHK(ca_search("enumMDbputPRIO",&putMDbchid[1]),"ca_search failure");
  SEVCHK(ca_search("enumMDbputVAL" ,&putMDbchid[2]),"ca_search failure");
  SEVCHK(ca_search("enumMCaputDTYP",&putMCachid[0]),"ca_search failure");
  SEVCHK(ca_search("enumMCaputPRIO",&putMCachid[1]),"ca_search failure");
  SEVCHK(ca_search("enumMCaputVAL" ,&putMCachid[2]),"ca_search failure");
  SEVCHK(ca_search("enumCmbbi.DTYP" ,&getCchid[0]),"ca_search failure");
  SEVCHK(ca_search("enumCmbbi.PRIO" ,&getCchid[1]),"ca_search failure");
  SEVCHK(ca_search("enumCmbbi.VAL" ,&getCchid[2]),"ca_search failure");
  SEVCHK(ca_search("enumMDbmbbi.DTYP" ,&getMDbchid[0]),"ca_search failure");
  SEVCHK(ca_search("enumMDbmbbi.PRIO" ,&getMDbchid[1]),"ca_search failure");
  SEVCHK(ca_search("enumMDbmbbi.VAL" ,&getMDbchid[2]),"ca_search failure");
  SEVCHK(ca_search("enumMCambbi.DTYP" ,&getMCachid[0]),"ca_search failure");
  SEVCHK(ca_search("enumMCambbi.PRIO" ,&getMCachid[1]),"ca_search failure");
  SEVCHK(ca_search("enumMCambbi.VAL" ,&getMCachid[2]),"ca_search failure");
  SEVCHK(ca_pend_io(5.0),"ca_pend_io failure");

  for(indval=0; indval<2; indval++) {
      SEVCHK(ca_put(DBR_STRING,putCchid[0],dtypValue[indval]),"ca_put");
      SEVCHK(ca_put(DBR_STRING,putCchid[1],prioValue[indval]),"ca_put");
      SEVCHK(ca_put(DBR_STRING,putCchid[2],valValue[indval]),"ca_put");
      SEVCHK(ca_put(DBR_STRING,putMDbchid[0],dtypValue[indval]),"ca_put");
      SEVCHK(ca_put(DBR_STRING,putMDbchid[1],prioValue[indval]),"ca_put");
      SEVCHK(ca_put(DBR_STRING,putMDbchid[2],valValue[indval]),"ca_put");
      SEVCHK(ca_put(DBR_STRING,putMCachid[0],dtypValue[indval]),"ca_put");
      SEVCHK(ca_put(DBR_STRING,putMCachid[1],prioValue[indval]),"ca_put");
      SEVCHK(ca_put(DBR_STRING,putMCachid[2],valValue[indval]),"ca_put");
      /*Wait until evertthing updated*/
      ca_pend_event(2.0);
      for(field=0; field<3; field++) {
	SEVCHK(ca_get(DBR_STRING,getCchid[field],&getCvalue[field]),
		"ca_get");
	SEVCHK(ca_get(DBR_STRING,getMDbchid[field],&getMDbvalue[field]),
		"ca_get");
	SEVCHK(ca_get(DBR_STRING,getMCachid[field],&getMCavalue[field]),
		"ca_get");
      }
      SEVCHK(ca_pend_io(5.0),"ca_pend_io failure");
      printReport(indval);
  }
  return(0);
}
Exemple #4
0
circular_array * ca_grow(circular_array *a, long int b, long int t) {

  circular_array *na = ca_build(a->log_size + 1);

  for (long int i = t; i < b; i++) {
    ca_put(na, i, ca_get(a, i));
  }

  return na;

}
void ECCD_Calorimetric::slot_SET_DATA(void)
{
	chid   searchID;
	int    istatus;
	int	 iDATA = 1;
	
	ca_search ("EC1_WCS_SET_DATA", &searchID);
	istatus = ca_pend_io(0.1);
	ca_put(DBR_INT, searchID, &iDATA);
	istatus = ca_pend_io(0.1);
}
void medmSendString(Record *pr, char *data)
{
    int status;

    Channel *pCh = &((caTask.pages[pr->caId/CA_PAGE_SIZE])
      [pr->caId % CA_PAGE_SIZE]);
    status = ca_put(DBR_STRING,pCh->chid,data);
    if(status != ECA_NORMAL) {
	medmPostMsg(1,"medmSendString: ca_put failed: %s\n",
	  ca_message(status));
    }
    ca_flush_io();
}
Exemple #7
0
void push_bottom(ws_deque *q, void *value) {

  long int b = q->bottom;
  long int t = (long int) g_atomic_pointer_get(&(q->top));
  circular_array *a = q->active_array;
  long int a_size = ca_size(a);
  long int size = b - t;

  if(size >= (a_size - 1)) {
    a = ca_grow(a, b, t);
    q->active_array = a;
  }

  ca_put(a, b, value);
  q->bottom = b + 1;
  
}
void medmSendDouble(Record *pr, double data)
{
    int status;

    Channel *pCh = &((caTask.pages[pr->caId/CA_PAGE_SIZE])
      [pr->caId % CA_PAGE_SIZE]);
    status = ca_put(DBR_DOUBLE,pCh->chid,&data);
#if DEBUG_SLIDER
    if(data > 150.0 || data < -150.0) {
	print("medmSendDouble: %g\n",data);
    }
#endif
    if(status != ECA_NORMAL) {
	medmPostMsg(1,"medmSendDouble: ca_put failed: %s\n",
	  ca_message(status));
    }
    ca_flush_io();
}
Exemple #9
0
int main(int argc,char **argv)
{
    chid		mychid;
    unsigned short	value;

    if(argc!=3) {
	printf("usage: caputackt pvname value\n");
	exit(1);
    }
    sscanf(argv[2],"%hu",&value);
    SEVCHK(ca_task_initialize(),"ca_task_initialize");
    SEVCHK(ca_search(argv[1],&mychid), "ca_search");
    ca_pend_io(5.0);
    SEVCHK(ca_put(DBR_PUT_ACKT,mychid,&value),"ca_put");
    ca_pend_event(1.0);
/*
    ca_task_exit();
*/
    return(0);
}
Exemple #10
0
/*
 *	capft
 *
 *	test ca_put() over a range of data types
 *	
 */
static int capft(
char		*pname,
char		*pvalue
)
{
	dbr_short_t			shortvalue;
	dbr_long_t			longvalue;
	dbr_float_t			floatvalue;
	dbr_char_t			charvalue;
	dbr_double_t		doublevalue;
	unsigned long		ntries = 10ul;
	int					status;
	chid				chan_id;

	if (((*pname < ' ') || (*pname > 'z'))
	  || ((*pvalue < ' ') || (*pvalue > 'z'))){
		printf("\nusage \"pv name\",\"value\"\n");
		return -1;
	}

	/* 
	 *	convert name to chan id 
	 */
	status = ca_search(pname, &chan_id);
	SEVCHK(status,NULL);
	status = ca_pend_io(5.0);
	if(status != ECA_NORMAL){
        SEVCHK(ca_clear_channel(chan_id),NULL);
		printf("Not Found %s\n", pname);
		return -1;
	}

	printf("name:\t%s\n", ca_name(chan_id));
	printf("native type:\t%d\n", ca_field_type(chan_id));
	printf("native count:\t%lu\n", ca_element_count(chan_id));

	/*
	 *  string value ca_put
	 */
	status = ca_put(
			DBR_STRING, 
			chan_id, 
			pvalue);
	SEVCHK(status, NULL);
	verify_value(chan_id, DBR_STRING);

	if(ca_field_type(chan_id)==0)goto skip_rest;

	if(sscanf(pvalue,"%hd",&shortvalue)==1) {
		/*
		 * short integer ca_put
		 */
		status = ca_put(
				DBR_SHORT, 
				chan_id, 
				&shortvalue);
		SEVCHK(status, NULL);
		verify_value(chan_id, DBR_SHORT);
		status = ca_put(
				DBR_ENUM, 
				chan_id, 
				&shortvalue);
		SEVCHK(status, NULL);
		verify_value(chan_id, DBR_ENUM);
		charvalue=(dbr_char_t)shortvalue;
		status = ca_put(
				DBR_CHAR, 
				chan_id, 
				&charvalue);
		SEVCHK(status, NULL);
		verify_value(chan_id, DBR_CHAR);
	}
	if(sscanf(pvalue,"%d",&longvalue)==1) {
		/*
		 * long integer ca_put
		 */
		status = ca_put(
				DBR_LONG, 
				chan_id, 
				&longvalue);
		SEVCHK(status, NULL);
		verify_value(chan_id, DBR_LONG);
	}
	if(epicsScanFloat(pvalue, &floatvalue)==1) {
		/*
		 * single precision float ca_put
		 */
		status = ca_put(
				DBR_FLOAT, 
				chan_id, 
				&floatvalue);
		SEVCHK(status, NULL);
		verify_value(chan_id, DBR_FLOAT);
	}
	if(epicsScanDouble(pvalue, &doublevalue)==1) {
		/*
		 * double precision float ca_put
		 */
		status = ca_put(
				DBR_DOUBLE, 
				chan_id, 
				&doublevalue);
		SEVCHK(status, NULL);
		verify_value(chan_id, DBR_DOUBLE);
	}

skip_rest:

	/*
	 * wait for the operation to complete
	 * (outstabnding decrements to zero)
	 */
	while(ntries){
		ca_pend_event(1.0);

		if(!outstanding){
            SEVCHK(ca_clear_channel(chan_id),NULL);
			printf("\n\n");
			return 0;
		}

		ntries--;
	}

    SEVCHK(ca_clear_channel(chan_id),NULL);
	return -1;
}