Exemple #1
0
int
sy1527GetMainframeStatus(unsigned int id, int *active, int *onoff, int *alarm)
{
    int i, board, chan;
    unsigned int u;
    int retv=-1;

    pthread_mutex_lock(&global_mutex);

    *active = *onoff = *alarm = 0;

    /* check if it is active */
    for(i=0; i<nmainframes; i++)
    {
        if(mainframes[i] == id)
        {
            *active = 1;


            /* check if it is ON: loop over all boards and channels */
            /* and if at least one channel is ON, report mainframe  */
            /* status as ON, overwise report it as OFF */

            for(board=0; board<Measure[id].nslots; board++)
            {
                for(chan=0; chan<Measure[id].board[board].nchannels; chan++)
                {
                    /* check on/off status */
                    GET_LVALUE(Pw, u);
                    if(u) *onoff = 1;

                    /* check I-tripped bit */
                    GET_LVALUE(Status, u);
                    if(u & 0x200) *alarm = 1;
                }
            }
            retv=CAENHV_OK; // my:
        }
    }
///smiui_send_command("", "");
    pthread_mutex_unlock(&global_mutex);

    return retv;
}
Exemple #2
0
/* returns status for one channel */
unsigned int
sy1527GetChannelStatus(unsigned int id, unsigned int board,
                       unsigned int chan)
{
    unsigned int u;
    LOCK_MAINFRAME(id);
    GET_LVALUE(Status, u);
    UNLOCK_MAINFRAME(id);
    return(u);
}
Exemple #3
0
/* returns enable/disable for one channel */
unsigned int
sy1527GetChannelEnableDisable(unsigned int id, unsigned int board,
                              unsigned int chan)
{
    unsigned int u;
    LOCK_MAINFRAME(id);
    GET_LVALUE(PwEn, u);
    UNLOCK_MAINFRAME(id);
    return(u);
}
Exemple #4
0
int
sy527GetMainframeStatus(unsigned int id, int *active, int *onoff, int *alarm)
{
  int i, board, chan;
  unsigned int u;

  LOCK_GLOBAL;

  *active = *onoff = *alarm = 0;

  /* check if it is active */
  for(i=0; i<nmainframes; i++)
  {
    if(mainframes[i] == id)
    {
      *active = 1;


      /* check if it is ON: loop over all boards and channels */
      /* and if at least one channel is ON, report mainframe  */
      /* status as ON, overwise report it as OFF */

      for(board=0; board<Measure[id]->nslots; board++)
      {
        for(chan=0; chan<Measure[id]->board[board].nchannels; chan++)
        {
          /* check on/off status */
          GET_LVALUE(Pw, u);
          if(u) *onoff = 1;

          /* check I-tripped bit */
          GET_LVALUE(Status, u);
          if(u & 0x200) *alarm = 1;
        }
      }

    }
  }

  UNLOCK_GLOBAL;

  return(CAENHV_OK);
}
Exemple #5
0
/* returns on/off status for one channel */
unsigned int
sy527GetChannelOnOff(unsigned int id, unsigned int board,
                      unsigned int chan)
{
  unsigned int u;
  LOCK_MAINFRAME(id);
  GET_LVALUE(Pw, u);
  UNLOCK_MAINFRAME(id);
  return(u);
}