|
|
Line 1: |
Line 1: |
− | Command-line access to MAS involves the programs
| + | #REDIRECT[[MAS#Usage]] |
− | | |
− | mce_cmd
| |
− | [[dsp_cmd]]
| |
− | maslog
| |
− | maslog_server
| |
− | | |
− | = mce_cmd =
| |
− | | |
− | ''use dsp_cmd to issue special resetmce command''
| |
− | | |
− | This program, in its default mode, accepts MCE commands and various special commands on standard input, and prints the success or failure of the operation and any data returned by the command to standard output. Various command line options facilitate scripting, a DAS compatibility mode, and some control over the output.
| |
− | | |
− | == MCE commands ==
| |
− | | |
− | MCE commands can be issued directly to mce_cmd. e.g.:
| |
− | | |
− | wb cc led 7
| |
− | Line 1 : ok
| |
− | rb cc led
| |
− | Line 2 : ok : 0x4
| |
− | rb cc fw_rev
| |
− | Line 3 : ok : 0x4000004
| |
− |
| |
− | The aliases "r" and "w" are provided for "rb" and "wb". For read commands, the output data defaults to hex but can be printed in decimal by issuing the "dec" command:
| |
− | | |
− | dec
| |
− | Line 4 : ok
| |
− | rb cc card_id
| |
− | Line 5 : ok : 11914487
| |
− | | |
− | The program will help you out a bit if you can't remember parameter or card names. e.g.
| |
− | | |
− | rb psc ?
| |
− | Line 1 : error : psc expects argument from [ brst cycle_pow cut_pow psc_status (int) ]
| |
− | | |
− | The program will also allow "raw" data writes and reads. The syntax for read commands is
| |
− | | |
− | rb <card_id> <param_id> <n_data> [<multiplier>]
| |
− | | |
− | e.g. to do a raw read of the cc led, the command is
| |
− | | |
− | rb 0x2 0x99 1
| |
− | | |
− | You can even specify the card explicitly and the parameter as an id:
| |
− | | |
− | rb cc 0x99 1
| |
− | | |
− | This will return 1 datum. The "multiplier" argument is for commands that return multiple data for a single query, such as sys commands. To query sys led, we would have tell mce_cmd to print out the single datum for each of the 9 cards.
| |
− | | |
− | rb 0xd 0x99 1 9
| |
− | | |
− | For raw writes, the card/param options are the same. Every subsequent datum after that is written to the MCE, up to the maximum command size. e.g.:
| |
− | | |
− | == Headline text ==
| |
− | | |
− | wb 0x2 0x99 1 2 3 4
| |
− | | |
− | would write 4 values to the cc led.
| |
− | | |
− | == manipulating a single element of a multi-valued mce parameter ==
| |
− | | |
− | wbel bc1 flux_fb 5 2000
| |
− | rbel bc1 flux_fb 5
| |
− | | |
− | == MCE data commands ==
| |
− | | |
− | Five special commands are provided for taking data:
| |
− | | |
− | acq_path - specify the output directory for data files
| |
− | acq_config - start a new output data file
| |
− | acq_config_fs - start a new output data file set
| |
− | acq_go - get frames from MCE
| |
− | acq_flush - flush buffers to disk
| |
− | | |
− | To open a new output file or file set, use either of
| |
− | | |
− | acq_config <filename> <card>
| |
− | or
| |
− | acq_config_fs <filebase> <card> <interval>
| |
− | | |
− | where interval is the number of frames to store in each file. e.g.
| |
− | | |
− | acq_config test rcs
| |
− | or
| |
− | acq_config_fs test rcs 1000
| |
− | | |
− | In the first case, the output file will be called "test". In the second case, the first 1000 frames are written to the file "test.000", then the next 1000 frames are written to the file "test.001", etc.
| |
− | | |
− | To change the default directory for data files, specify a path with
| |
− | | |
− | acq_path <directory>
| |
− | | |
− | e.g.
| |
− | | |
− | acq_path /data/cryo/current_data
| |
− | | |
− | Make sure acq_path is issued before acq_config.
| |
− | | |
− | Alternately, the path can be specified at run-time with the -o option. '''''(Is -o an acq_go option???)'''''
| |
− | | |
− | | |
− | Once acq_config or acq_config_fs have been run, any number of frames can be acquired using the command
| |
− | | |
− | acq_go <frame_count>
| |
− | | |
− | e.g.
| |
− | | |
− | acq_go 4000
| |
− | | |
− | | |
− | Note that the frames are not explicity flushed to file until a new acq_config command is issued, mce_cmd exits, or the command
| |
− | | |
− | acq_flush
| |
− | | |
− | is issued to mce_cmd.
| |
− | | |
− | | |
− | == DAS emulation ==
| |
− | | |
− | In DAS, "go" commands resulted in data accumulating in some file. This is not the default behaviour of mce_cmd, which tries to separate MCE commands from software behaviour.
| |
− | | |
− | To provide legacy support to DAS scripts, a "DAS compatibility mode" can be specified using the -C command line option. This will direct all "go" output to the file specified in the -C option. A typical session would look like this:
| |
− | | |
− | gamow:~$ mce_cmd -C /data/cryo/current_data/go_data
| |
− | w cc ret_dat_s 0 99
| |
− | Line 1 : ok
| |
− | go rcs ret_dat
| |
− | Line 2 : ok
| |
− |
| |
− | When not running in compatibility mode, the raw data will remain in the driver's buffer. It can be read from the device file /dev/mce_data0, or the buffer can be cleared with the mce_cmd command "empty".
| |
− | | |
− | == Useful scripting commands ==
| |
− | | |
− | Sleep some number of microseconds (realistically, this is limited by the system tick so the minimum delay is probably 0.4-1 ms). e.g.
| |
− | | |
− | sleep 1000000
| |
− | | |
− | Echo each command to the terminal, e.g.
| |
− | | |
− | echo 1
| |
− | Line 1 : ok
| |
− | r cc led
| |
− | Cmd 2 : r cc led
| |
− | Line 2 : ok : 0x4
| |
− | | |
− | The comment character is '#'. Lines beginning with the hash are ignored by mce_cmd.
| |
− | | |
− | | |
− | == Command line options ==
| |