コード例 #1
0
ファイル: sy527.c プロジェクト: boiarino17/epics
/* loop over all available channels and set them on or off */
int
sy527SetMainframeOnOff(unsigned int id, unsigned int on_off)
{
  int i, board, chan;

  LOCK_GLOBAL;

  /* check if it is active */
  for(i=0; i<nmainframes; i++)
  {
    /*printf("-> check mainframe %d\n",i);*/
    if(mainframes[i] == id)
    {
      /*printf("-> mainframe %d has id=%d, so loop over %d boards\n",
        i,id,Measure[id]->nslots);*/
      /* loop over all channels in all boards and set it to 'on_off' */

      for(board=0; board<Measure[id]->nslots; board++)
      {
        /*printf("-> slot %d: nchannels=%d\n",
          board,Measure[id]->board[board].nchannels);*/
        for(chan=0; chan<Measure[id]->board[board].nchannels; chan++)
        {
          /*printf("-> set channel %d to %d\n",chan, on_off);*/
          SET_LVALUE(Pw, on_off);
        }
      }
    }
  }

  UNLOCK_GLOBAL;

  return(CAENHV_OK);
}
コード例 #2
0
ファイル: sy1527.c プロジェクト: joshua-ballard/clas12-epics
/* sets on/off status for one channel */
int
sy1527SetChannelOnOff(unsigned int id, unsigned int board,
                      unsigned int chan, unsigned int u)
{
    LOCK_MAINFRAME(id);
    SET_LVALUE(Pw, u);
    UNLOCK_MAINFRAME(id);
    return(0);
}
コード例 #3
0
ファイル: sy1527.c プロジェクト: joshua-ballard/clas12-epics
/* loop over all available channels and set them on or off */
int
sy1527SetBoardOnOff(unsigned int id, unsigned int board, unsigned int on_off)
{
    int i, chan;

    pthread_mutex_lock(&global_mutex);

// check if it is active

//printf("hjhjhjhjhjhjhhjh nmainframes,id, mainframes[i] %d %d %d\n",nmainframes,id, mainframes[i]);
    for(i=0; i<nmainframes; i++)
    {
        /*printf("-> check mainframe %d\n",i);*/
        if(mainframes[i] == id)
        {
//printf("hjhjhjhjhjhjhhjh 2\n");
            /*printf("-> mainframe %d has id=%d, so loop over %d boards\n",
              i,id,Measure[id].nslots);*/
            /* loop over all channels in all boards and set it to 'on_off' */

            /// for(board=0; board < Measure[id].nslots; board++)
            ///{
            /*printf("-> slot %d: nchannels=%d\n",
              board,Measure[id].board[board].nchannels);*/
            for(chan=0; chan<Measure[id].board[board].nchannels; chan++)
            {
                printf("-> set channel %d to %d\n",chan, on_off); /// my:
                SET_LVALUE(Pw, on_off);
            }
            ///}
        }
    }

    pthread_mutex_unlock(&global_mutex);

    return(CAENHV_OK);
}