Beispiel #1
0
/* 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);
}
Beispiel #2
0
/* 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);
}
Beispiel #3
0
/* 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);
}