Changeset 10504 for fact/FADctrl


Ignore:
Timestamp:
05/02/11 14:56:49 (14 years ago)
Author:
neise
Message:
supports new FAD event format:
setting runnumber
resetting internat trigger ID
Location:
fact/FADctrl
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • fact/FADctrl/FAD.cc

    r10291 r10504  
    2828   {"sclk", &FAD::cmd_sclk, true, 1, "<on|off>", "Set SCLK"},
    2929   {"trigger", &FAD::cmd_trigger, false, 0, "[n|cont [rate]|stop|enable|disable]", "Issue software triggers"},
     30   {"reset_trigger", &FAD::cmd_reset_trigger, false, 0, "resets the internal trigger counter"},
     31   {"set_runnumber", &FAD::cmd_set_runnumber, false, 1, "<n> sets runnumber"},
    3032   {"roi", &FAD::cmd_roi, true, 2, "<channel range> <value>", "Set region-of-interest to value"},
    3133   {"dac", &FAD::cmd_dac, true, 2, "<range> <value>", "Set DAC numbers in range to value"},
     
    195197}
    196198
     199void FAD::cmd_reset_trigger() {
     200  for (unsigned int i=0; i<Boards.size(); i++) {
     201        Boards[i]->Send(CMD_RESET_TRIGGER_ID);
     202  }
     203}
     204
     205
     206void FAD::cmd_set_runnumber() {
     207  int Num;
     208
     209  if (Parameter.size() == 2) {
     210                ConvertToInt(Parameter[1], &Num);
     211          for (unsigned int i=0; i<Boards.size(); i++) {
     212                        Boards[i]->Send( CMD_Write | ADDR_RUNNUMBER );
     213                        Boards[i]->Send((unsigned short) Num>>16);              // Write the HIGH-word first
     214                        Boards[i]->Send( CMD_Write | (ADDR_RUNNUMBER+1) );
     215                        Boards[i]->Send((unsigned short) (Num>>16)<<16); // now write the LOW-word
     216                }
     217        }
     218        else {
     219          PrintUsage();
     220          return;
     221        }
     222}
     223 
     224
    197225//
    198226// Switch socket mode
  • fact/FADctrl/FAD.h

    r10263 r10504  
    6969        void cmd_board();               void cmd_status();
    7070        void cmd_acalib();              void cmd_serial();
    71         void cmd_trigger();     
     71        void cmd_trigger();
     72        void cmd_reset_trigger();
     73        void cmd_set_runnumber();       
    7274void cmd_socketmode();void cmd_daqmode(); 
    7375        void cmd_srclk();               void cmd_sclk();
  • fact/FADctrl/FADBoard.cc

    r10291 r10504  
    457457          Status.EventCounter = ntohl(Header->fad_evt_counter);
    458458          Status.TriggerID = ntohl(Header->trigger_id);
     459          Status.Runnumber = ntohl(Header->runnumber);
    459460          Status.TriggerType = ntohs(Header->trigger_type);
    460461          Status.TriggerCRC = ntohs(Header->trigger_crc);
     
    496497                  // Extract ADC data (stored in 12 bit signed twis complement with out-of-range-bit and leading zeroes)
    497498                  for (int i=0; i<Status.ROI[Chip][Chan]; i++) {
    498                           Buf = ntohs(Channel[Chip+NChips*Chan]->adc_data[i]);
     499                          Buf = (Channel[Chip+NChips*Chan]->adc_data[i]);
    499500                          (Buf <<= 4) >>= 4;                    //delete the sign-bit by shifting left and shift back
    500501                          Data[Chip][Chan][i] = Buf;                                   
  • fact/FADctrl/FADBoard.h

    r10290 r10504  
    5252
    5353          uint32_t TriggerID;
     54          uint32_t Runnumber;
    5455          uint16_t TriggerType;
    5556          uint16_t TriggerCRC;
  • fact/FADctrl/FADFormat.h

    r10224 r10504  
    2929#define CMD_Read 0x0A00                 // read from Config-RAM
    3030#define CMD_Write 0x0500                // write to Config-RAM
     31#define CMD_RESET_TRIGGER_ID 0x2A00
    3132
    3233#define CMD_TRIGGERS_ON 0x1800  // enables the trigger line
     
    4041#define BADDR_DAC 0x24          // Baseaddress DAC-Values
    4142#define BADDR_CONT_TRIGGER_TIME 0x2C // Baseaddress for the continouus trigger timing.
     43#define ADDR_RUNNUMBER 0x2D //
    4244#define MAX_VAL 65535
    4345#define MAX_ROIVAL 1024
     
    7678
    7779  uint32_t time;
    78   uint32_t fad_status;
     80  uint32_t runnumber;
    7981
    8082  int16_t drs_temperature[NTemp];
Note: See TracChangeset for help on using the changeset viewer.