Exemplo n.º 1
0
int l8590_mem__dw_setup( struct descriptor *niddsc, struct descriptor *methoddsc, Widget parent)
{ 
  static String uids[] = {"L8590_MEM.uid"};
  static int nid;
  static MrmRegisterArg uilnames[] = {{"nid",(XtPointer)0},{"Load",(XtPointer)Load}};
  static NCI_ITM   nci[] = {{4, NciCONGLOMERATE_NIDS, (unsigned char *)&nid, 0}, {0, NciEND_OF_LIST, 0, 0}};
  TreeGetNci(*(int *)niddsc->pointer, nci);
  uilnames[0].value = (char *)0+nid;
  return XmdsDeviceSetup(parent, (int *)niddsc->pointer, uids, XtNumber(uids), "L8590_MEM", uilnames, XtNumber(uilnames), 0);
}
Exemplo n.º 2
0
int       l8210__dw_setup(struct descriptor *niddsc,  struct descriptor *methoddsc, Widget    parent)
{
  Widget dbox;
  static String uids[] = {"L8210.uid","L8210_HEADERS.uid"};
  static int       nid;
  static NCI_ITM   nci[] = {{4, NciCONGLOMERATE_NIDS, (unsigned char *)&nid, 0}, {0, NciEND_OF_LIST, 0, 0}};
  static  MrmRegisterArg uilnames[] = {{"mems_nid", 0},
                                       {"apply_proc", (XtPointer)apply_proc},
                                       {"reset_proc", (XtPointer)reset_proc},
                                       {"pts_activate_proc", (XtPointer)pts_activate_proc},
                                       {"pts_dismiss_proc", (XtPointer)pts_dismiss_proc}};
  int status;
  TreeGetNci(*(int *)niddsc->pointer, nci);
  uilnames[0].value = (XtPointer)(nid+L8210_N_MEMORIES);
  status =  XmdsDeviceSetup(parent, (int *)niddsc->pointer, uids, XtNumber(uids), "L8210",uilnames,XtNumber(uilnames), &dbox);
  reset(dbox);
  return status;
}
Exemplo n.º 3
0
int mdsdcl__dw_setup(struct descriptor *niddsc, struct descriptor *methoddsc, Widget parent)
{ 
  static String uids[] = {"MDSDCL.uid"};
  static int nid;
  static MrmRegisterArg uilnames[] = {{"selections_nid",(XtPointer)0},
                                      {"Apply",(XtPointer)Apply},
                                      {"Reset",(XtPointer)Reset}};
  static NCI_ITM   nci[] = {{4, NciCONGLOMERATE_NIDS, (unsigned char *)&nid, 0}, {0, NciEND_OF_LIST, 0, 0}};
  String verbs;

/*------------------------------------------------------------------------------

 Executable:                                                                  */

  TreeGetNci(*(int *)niddsc->pointer, nci);
  uilnames[0].value = (char *)0+(nid + MDSDCL_N_VERBS);
  XmdsDeviceSetup(parent, (int *)niddsc->pointer, uids, XtNumber(uids), "MDSDCL", uilnames, XtNumber(uilnames), 0);
  return 1;
}
Exemplo n.º 4
0
static int ReadChannel(InStoreStruct *setup, int chunk,int samples,unsigned short *buffer,int *samples_read,int *nid,float *calib)
{
  int chunk_address =  0x0B000 | chunk;
  int points_to_read;
  int status=1;
  int tries;
  for (points_to_read = chunksize; status & 1 && points_to_read; points_to_read = chunksize)
  {
    struct { unsigned short status;
             unsigned short bytcnt;
             unsigned int   dummy;} iosb = {0,0};
    int try;
    static DESCRIPTOR_A(calib_a, sizeof(*calib), DTYPE_NATIVE_FLOAT, 0, 2*sizeof(*calib));
    static DESCRIPTOR_NID(nid_dsc,0);
    void *arglist[] = {0,&nid_dsc,&calib_a MDS_END_ARG};
    calib_a.pointer = (char *)calib;
    nid_dsc.pointer = (char *)nid;
    arglist[0] = (void *)(sizeof(arglist)/sizeof(arglist[0]));
    AccessTraq(setup,chunk_address,24,arglist,TdiData);
    pio(8,0,0);
    for (try = 0;(try < 20) && (!(CamQ(0)&1)) && (status & 1);try++) {pio(8,0,0);}
    pio(10,0,0);
    return_on_error(DevCamChk(CamQstopw(setup->name,0,2,points_to_read,buffer + *samples_read,16,(short *)&iosb),&one,0),status);
    status = status & 1 ? iosb.status : status;
    *samples_read += iosb.bytcnt/2;
    if (iosb.bytcnt/2 != points_to_read) break;
    chunk_address += max_chunks_per_io;
  }
  return status;
}

static int AccessTraq(InStoreStruct *setup, int data,int memsize,void *arglist,int (*routine)())
{ int try;
  int status;
  int called = 0;
  if (max_time > 0) {
    if ((time(0)-start_time) > max_time) {
      printf("T4012 AccessTraq timeout, data=%d\n",data);
      return DEV$_BAD_MODE;
    }
  }
  piomem(17,0,&data,memsize);
  for (try = 0;(try < 30) && (!(CamQ(0)&1)) && (status &1);try++) 
  {
    if (arglist && !called) {
      called = 1;
      LibCallg(arglist,routine);
    }
    else
      DevWait((float).001);
    piomem(17,0,&data,memsize);
  }
  if (try == 30) status = DEV$_CAM_NOSQ;
  if (arglist &&!called) LibCallg(arglist,routine);
  return status;
}

int t4012__dw_setup( struct descriptor *niddsc, struct descriptor *methoddsc, Widget parent)
{ 
  static String uids[] = {"T4012.uid"};
  static int nid;
  static MrmRegisterArg uilnames[] = {{"nid",(XtPointer)0},{"Load",(XtPointer)Load}};
  static NCI_ITM   nci[] = {{4, NciCONGLOMERATE_NIDS, (unsigned char *)&nid, 0}, {0, NciEND_OF_LIST, 0, 0}};
  TreeGetNci(*(int *)niddsc->pointer, nci);
  uilnames[0].value = (char *)0+nid;
  return XmdsDeviceSetup(parent, (int *)niddsc->pointer, uids, XtNumber(uids), "T4012", uilnames, XtNumber(uilnames), 0);
}

static void Load(Widget w)
{
  char *t4012name;
  char dignam[512];
  int i;
  XtPointer user_data;
  int nid;
  int found = False;
  XtVaGetValues(w, XmNuserData, &user_data, NULL);
  nid = (intptr_t)user_data;
  t4012name = TreeGetPath(nid);
  strcpy(dignam,t4012name);
  strcat(dignam,":T28%%_");
  TreeFree(t4012name);
  XmListDeleteAllItems(w);
  for (i=1;i<17;i++)
  {
    int dig_nid;
    int status;
    XmString item;
    int len = strlen(dignam);
    dignam[len++]=i<10 ? '0' : '1';
    dignam[len++]='0'+(i % 10);
    dignam[len++]=0;
    status = TreeFindNode(dignam,&dig_nid);
    if (status & 1)
    {
      NCI_ITM itmlst[] = {{512,NciNODE_NAME,0,0},{0,0,0,0}};
      itmlst[0].pointer = dignam;
      TreeGetNci(dig_nid,itmlst);
      item = XmStringCreateSimple(dignam);
      XmListAddItem(w, item, 0);
      XmStringFree(item);
      found = True;
    }
    else
      break;
  }
  if (!found)
  {
    XmString item = XmStringCreateSimple("Add T28xx_01");
    XmListAddItem(w, item, 0);
    XmStringFree(item);
  }
}