290 likes | 445 Views
Control software. M. Sozzi Pisa - January 30/31, 2014. Mainz 2011. Software. The firmware is to be controlled – initialized – monitored from the CCPC (access during data taking possible) Use only low-level libraries from LHCb (JTAG, glue, I2C, …) with frozen source code
E N D
Control software M. SozziPisa - January 30/31, 2014
Mainz 2011 Software • The firmware is to be controlled – initialized – monitored from the CCPC (access during data taking possible) • Use only low-level libraries from LHCb (JTAG, glue, I2C, …) with frozen source code • Command-line control program (with scripting and macros) made available by Pisa: - tightly linked to firmware version- to be customized for sub-detector firmware versions- to be used both for test/monitoring and real data-taking- initialization via XML files • Scientific Linux version: to be frozen • TEL62 firmware loading requires JAM-file player: existing LHCb version not working: to be solved – Perugia
Low-level libraries I2C handling (LHCb) Glue card handling (LHCb) Local bus handling (LHCb) EPROM programming (LHCb) → NA62 modified JTAG handling (LHCb) → NA62 modified JAM file handling (LHCb) → NA62 modifiedJBI file handling (LHCb) → NA62 modifiedFutex implementation (CERN) i2clib.c gluelib.c lblib.c fproglib.c jtaglib.c jamlib.c jbilib.c exclulib.c
Low-level commands Some standalone (LHCb-provided) utilities are installed together with the libraries, such as: lbread <address> lbwrite <address> <value>for writing to TEL62 local bus (e.g. FPGAs) jtagscan to identify JTAG devices on TEL62 EPC16Handling to load a firmware (pof) file (on TELL1 EEPROM only)
tdcode software suite (NA62) tdspy.h tel62.h tdc.h td.h tdspy.c tdlib.c tel62lib.c tdclib.c tdtab.c tel62tab.c tdctab.c tdspytab.c tdsys.h tdspyreq.h Completely written in standard C~44K lines of code tdspyreq.c tdsyslib.c tdtabcomplete.c tdxml.h tdspycom.h tdmsgdef.c tdxmllib.c tdspycomlib.c
tdcode software suite (NA62) tdspy.h tel62.h tdc.h td.h tdspy.c tdlib.c tel62lib.c tdclib.c tdtab.c tel62tab.c tdctab.c tdspytab.c tdsys.h tdspyreq.h Completely written in standard C~44K lines of code Core functions tdspyreq.c tdsyslib.c tdtabcomplete.c tdxml.h tdspycom.h tdmsgdef.c tdxmllib.c tdspycomlib.c
tdcode software suite (NA62) tdspy.h tel62.h tdc.h td.h tdspy.c tdlib.c tel62lib.c tdclib.c tdtab.c tel62tab.c tdctab.c tdspytab.c tdsys.h tdspyreq.h TDC boardspecific code TEL62 boardspecific code Completely written in standard C~44K lines of code tdspyreq.c tdsyslib.c tdtabcomplete.c tdxml.h tdspycom.h tdmsgdef.c tdxmllib.c tdspycomlib.c
tdcode software suite (NA62) tdspy.h tel62.h tdc.h td.h tdspy.c tdlib.c tel62lib.c tdclib.c tdtab.c tel62tab.c tdctab.c tdspytab.c tdsys.h tdspyreq.h Completely written in standard C~44K lines of code tdspyreq.c tdsyslib.c System (TEL62+TDCB)functions tdtabcomplete.c tdxml.h tdspycom.h tdmsgdef.c tdxmllib.c tdspycomlib.c
tdcode software suite (NA62) tdspy.h tel62.h tdc.h td.h tdspy.c tdlib.c tel62lib.c tdclib.c tdtab.c tel62tab.c tdctab.c tdspytab.c tdsys.h tdspyreq.h Completely written in standard C~44K lines of code tdspyreq.c tdsyslib.c TDSPY interactive program code tdtabcomplete.c tdxml.h tdspycom.h tdmsgdef.c tdxmllib.c tdspycomlib.c
tdcode software suite (NA62) tdspy.h tel62.h tdc.h td.h tdspy.c tdlib.c tel62lib.c tdclib.c tdtab.c tel62tab.c tdctab.c tdspytab.c tdsys.h tdspyreq.h Completely written in standard C~44K lines of code tdspyreq.c tdsyslib.c TDSPY default printout functions tdtabcomplete.c tdxml.h tdspycom.h tdmsgdef.c tdxmllib.c tdspycomlib.c
tdcode software suite (NA62) tdspy.h tel62.h tdc.h td.h tdspy.c tdlib.c tel62lib.c tdclib.c tdtab.c tel62tab.c tdctab.c tdspytab.c tdsys.h tdspyreq.h Completely written in standard C~44K lines of code tdspyreq.c tdsyslib.c TDSPY remote control code tdtabcomplete.c tdxml.h tdspycom.h tdmsgdef.c tdxmllib.c tdspycomlib.c
tdcode software suite (NA62) tdspy.h tel62.h tdc.h td.h tdspy.c tdlib.c tel62lib.c tdclib.c tdtab.c tel62tab.c tdctab.c tdspytab.c tdsys.h tdspyreq.h Completely written in standard C~44K lines of code tdspyreq.c tdsyslib.c XML configuration code tdtabcomplete.c tdxml.h tdspycom.h tdmsgdef.c tdxmllib.c tdspycomlib.c
TDSPY program TDSPY is the interactive control program for the tdcode suite Command-line driven console program running on the TEL62 CCPC under Linux No GUIQuite flexible control allowing- scripting- user macro definition- remote control Some commands are tightly linked to the firmware versionIt still changes almost daily without any notice
Tdspy use Meant to be the unique access point to the hardware, for- board development- board testing- expert debugging- standard user control- hardware configuration and database interaction- operation during data-taking (under run control) (ssh) pipe/socket Otherprocess tdspy DIM Runcontrol
SVN • Na62tdaq repository @CERN contains: • TDCC firmware • TEL62 firmware • tdcode software suite w. scripts • some utilities • How to use it: • Create a CERN service account such as “na62to”, “na62bham”, etc. • Ask Pisa to create a new (empty) sub-detector firmware structure (if needed) • Ask na62tdaq@cern.ch for access • (Read-)accessible from browser via WebSVN
Compilation Compile on the server (much faster), currently SLC4 Current quirk (to be fixed): su chroot /opt/ccpc/root cd <directory> make chown cc:na62 tdspy prompt>tdspyFloating point exception → You did not do the above
Invocation [tel62-10] /home> tdspy -h TDSpy: TDAQ control program Usage: tdspy [-f<file>][-l<file>][-u<file>][-d [-b] [-o[<file>]] [-p[<pipe>]] [-s[<port>]]] -f : alternate startup file (default tdstart.spy) -l : alternate log file (default tdspy.log) -u : alternate users file (default tdspy.usr) -d : daemon mode -b : blocking (for daemon mode) -o : output file name (for daemon mode) -p : pipe mode and name (for daemon mode) -q : quiet mode (for daemon mode) -s : socket mode and port (for daemon mode)
Online help [IDLE]TDSpy>help Use help <command> for individual command usage. Use @<filename> for file input, ! for recall. A dot (.) terminates most interactive commands. In most commands 99 stands for ALL and a list such as n1,n2-n3 is allowed. Macro definitions need () and optional formal arguments of the form %<letter>; definition ends with a dot line. automask mask non-responsive daughter-cards boardinfo show TEL62 information boardinitialize reset and initialize TEL62 boardreload reload all TEL62 devices ...
Online command help [IDLE]TDSpy>help ppwrite ppwrite <id> <tag> <val> [<nloc>] [<first>] write PP-FPGA register id: PP-FPGA id tag: PP-FPGA register val: Value (hex) nloc: Number of locations first: First location (hex) Command (and register, memory, etc.) completion using <TAB>
Some tdspy concepts The basic abstracted action is reading/writing into «registers»: - actual hardware registers- bit fields in hardware registers- FIFOs- memories This can actually happen through the local bus, I2C (for registers in the TDCB), JTAG (for internal HPTDC registers), Intel bus (for GbE MAC registers) etc., with direct or indirect addressing, bit masking, single or multiple accesses etc. (all this is hidden from the user) Most command names start with the target:e.g. ppwrite (PP-FPGA), slread (SL-FPGA), tdccstatus (TDC controller FPGA), tdcdump (TDC chip), ttcrxinfo (TTCrx chip), ddrtest (DDR memory), gbeinfo (GbE card), portmask (GbE port) Commands can have both mandatory and optional arguments (easy mode). 99 usually stands for “all” devices of a kind
A single PP register TDSPY>ppwrite 2 CONTROL 0x10TDSPY>ppwrite 2 FREEZE 1 Reserved means reserved!
More tdspy concepts Some «setup» variables can change the way the program workssetup <variable> <value> e.g. verbose, debug (control level of printing), cwd (directory in which to look for files), echo (write commands to screen), log (log commands to a file) A script file (ASCII text) can be executed with @<filename> User macros (with variables) can be defined with macro <name>(a,b)
Some little known commands • automask • check • hello • setup • shell • tdccemudump • tdcdecode, ttcrxdecode • users
Remote communication DIM (from run control):compile with –DDIMlaunch with –c <server name>send commands via DIM Pipe/socket: launch with –d –s <port> (for socket)send commands by: - Using tdtalk standalone program - Using the API provided in tdspycom.h and tdspycomlib within your code
Hardware configuration Eventually all hardware should be configured through XML files (from online database) Common routines for XML file handling are under development:For each «object» (PP, TDC, etc.) one needs:- a routine to actually load constants to hardware - a routine to read constants from hardware (eventually generating a new XML file for the database) Not ready yet
Todo • XML/configuration code • Default hardcoded init-start-end routines • Fix cross-compilation quirk • Prepare NA62 RPMs (w. NA62-improved JTAG libs) • Migrate to SLC5-6 • More test functions • Hardware access locking during run • Hardware status reporting function (to run control) • User privilege levels • EOB data debugging functions • Burst report loop function • More automatic check functions • ...
More todo • Public standalone data reading PC program • Complete NA62-aware Wireshark module • ...