Changeset 10187


Ignore:
Timestamp:
Mar 1, 2011, 1:29:46 PM (9 years ago)
Author:
neise
Message:
added new daqmode command
Location:
fact/FADctrl
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • fact/FADctrl/FAD.cc

    r10186 r10187  
    3939   {"stop", &FAD::cmd_stop, false, 0, "", "Stop current operation/run"},
    4040   {"update", &FAD::cmd_update, false, 1, "<sec>", "Minimum delay between updates to DIM event service"},                 
    41    {"socketmode", &FAD::cmd_socketmode, true, 1, "<com|daq>", "Choose which Sockets are used for data transmission"},             
     41   {"socketmode", &FAD::cmd_socketmode, true, 1, "<com|daq>", "Choose which Sockets are used for data transmission"},
     42   {"daqmode", &FAD::cmd_daqmode, true, 1, "<start|stop>", "Set FAD DAQ mode. when started, no configurations must be send."},                           
    4243   {"reconnect", &FAD::cmd_reconnect, true, 1, "<board range> [init]", "Reconnect to boards (and re-initialise)"},               
    4344   {"exit", &FAD::cmd_exit, false, 0, "", "Exit program"},
     
    203204
    204205  for (unsigned int i=0; i<Boards.size(); i++) {
    205         if (Match(Parameter[1],"com")) Boards[i]->Send(CMD_Stop);
    206         else if (Match(Parameter[1],"daq")) Boards[i]->Send(CMD_Start);
     206        if (Match(Parameter[1],"com")) Boards[i]->Send(CMD_mode_command);
     207        else if (Match(Parameter[1],"daq")) Boards[i]->Send(CMD_mode_all_sockets);
    207208        else {
    208209          PrintUsage();
     
    211212  }
    212213}
     214
     215//
     216// Set DAQ mode
     217// "start" - DAQ started, no configurations may be issued
     218// "stop" - DAQ stopped, configurations may be issued
     219//
     220//      Note that socket 0 is always used to issue commands
     221//
     222void FAD::cmd_daqmode() {
     223
     224  for (unsigned int i=0; i<Boards.size(); i++) {
     225        if (Match(Parameter[1],"start")) Boards[i]->Send(CMD_Start);
     226        else if (Match(Parameter[1],"stop")) Boards[i]->Send(CMD_Stop);
     227        else {
     228          PrintUsage();
     229          return;
     230        }
     231  }
     232}
     233
    213234
    214235//
  • fact/FADctrl/FAD.h

    r10186 r10187  
    6969        void cmd_board();               void cmd_status();
    7070        void cmd_acalib();              void cmd_serial();
    71         void cmd_trigger();     void cmd_socketmode();
     71        void cmd_trigger();     
     72void cmd_socketmode();void cmd_daqmode(); 
    7273        void cmd_srclk();               void cmd_sclk();
    7374        void cmd_dwrite();              void cmd_domino();
  • fact/FADctrl/FADBoard.cc

    r10185 r10187  
    418418          Status.BoardID = ntohl(Header->board_id);
    419419          Status.FirmwareRevision = ntohl(Header->version_no);
    420           Status.TriggerID = ntohl(Header->local_trigger_id);
    421           Status.TriggerType = ntohs(Header->local_trigger_type);
     420          Status.TriggerID = ntohl(Header->trigger_id);
     421          Status.TriggerType = ntohs(Header->trigger_type);
    422422
    423423          // Extract temperatures (MSB indicates if temperature is positive or negative)
  • fact/FADctrl/FADFormat.h

    r10103 r10187  
    77// Commands for FAD
    88//
    9 #define CMD_Start 0xC000                // Start Run
    10 #define CMD_Stop 0x3000                 // Stop Run
     9#define CMD_Start 0x2200                                                // Start Run
     10#define CMD_Stop 0x2300                                                 // Stop Run
     11#define CMD_mode_command 0x3000                 // Set Socket mode to: command mode
     12#define CMD_mode_all_sockets 0x3100// Set Socket mode to: daq mode
     13
    1114#define CMD_Trigger 0xA000              // single trigger
    1215#define CMD_DENABLE 0x0600      // DENABLE line HIGH
     
    5053//
    5154typedef struct {
    52         unsigned short start_package_flag;
    53         unsigned short package_length;
    54         unsigned short version_no;
    55         unsigned long trigger_id;
    56         unsigned char trigger_type;
    57         unsigned char trigger_crc;
    58         unsigned long local_trigger_id;
    59         unsigned char local_trigger_type;
    60         unsigned char local_trigger_crc;
    61         unsigned short board_id;
    62         short drs_temperature[NTemp];
    63         unsigned short dac[NDAC];
    64 }  __attribute__((__packed__)) PEVNT_HEADER;
    65 
     55// ------------------------------
     56uint16_t start_package_flag;
     57uint16_t package_length;
     58uint16_t version_no;
     59uint16_t PLLLCK;
     60// ------------------------------
     61uint16_t trigger_crc;
     62uint16_t trigger_type;
     63uint32_t trigger_id;
     64// ------------------------------
     65uint32_t fad_evt_counter;
     66uint32_t REFCLK_frequency;
     67// ------------------------------
     68uint16_t board_id;
     69uint16_t adc_clock_phase_shift;
     70uint16_t number_of_triggers_to_generate;
     71uint16_t trigger_generator_prescaler;
     72// ------------------------------
     73uint8_t DNA[8]; // Xilinx DNA
     74// ------------------------------
     75uint32_t time;
     76uint32_t fad_status;
     77// ------------------------------
     78int16_t drs_temperature[NTemp];
     79// ------------------------------
     80uint16_t dac[NDAC];
     81// ------------------------------
     82} __attribute__((__packed__)) PEVNT_HEADER;
    6683typedef struct {
    67         unsigned short id;
    68         unsigned short start_cell;
    69         unsigned short roi;
    70         unsigned short adc_data[];
    71 }  __attribute__((__packed__)) PCHANNEL;
    72 
     84uint16_t id;
     85uint16_t start_cell;
     86uint16_t roi;
     87uint16_t filling;
     88uint16_t adc_data[];
     89} __attribute__((__packed__)) PCHANNEL;
    7390typedef struct {
    74         unsigned short package_crc;
    75         unsigned short end_package_flag;
    76 }  __attribute__((__packed__)) PEVNT_FOOTER;
     91uint16_t package_crc;
     92uint16_t end_package_flag;
     93} __attribute__((__packed__)) PEVNT_FOOTER;
    7794
    7895#endif
Note: See TracChangeset for help on using the changeset viewer.