Pdev system software (and jeffs code).
The pnet, prun, psrv suite of
starts, runs, and stops
Building a new version of the
Changing rc.start in the boxes
This documents the original programs supplied by
jeff mock. The online data taking has built some other programs on top
of this (see pnetctl)
The pnet, prun,
psrc suite of programs.
Jeff provided the following programs:
-> prun -> psrv -> disc
- pnet - A perl script to
drive the data taking. It talks to 1 or more prun tasks running on the
spectrometer boxes. It also can route messages through the prun task to
the psrv task on the file servers. It is driven by command line options
and several xxx.conf
- prun- c program running
on the spectrometer box.
- There is one copy for each band of a spectrometer (two per
- It controls the spectrometer hardware.
- It takes commands from pnet. It can forward commands from pnet
to psrv and pass back the replies.
- prun starts the data taking, gets the data from the
spectrometer, and passes it via a socket to the psrv program running on
the file server.
- When the integration is done, the prun process exits.
- psrv - C program running
on file server that reads data from prun and writes it to disc.
- There is a psrv task for each prun task (one for each subband
on a spectrometer box).
- prun starts psrv via xinetd by connecting to the well known
- psrv accepts commands from pnet via prun.
- When data taking starts, psrv reads the data stream over the
same socket that was used for the comands.
- Data from the input socket is buffered in a circular 20 mb
- By default the sequence numbers of each integration are checked.
- Data is written to disc as it comes in. Disc files can grow to
a user defined maximum size before switching to the next file.
- When the requested number of buffers have been input , psrv
stops writing to disc.
- Psrv will exit when the input socket is closed by prun.
- psrv will also exit if it has an error.
- Messages can be sent back msgs to pnet via prun using the input
How datataking starts,
runs, then stops.
Starting/connecting: pnet -> prun -> psrv
The user starts the perl script pnet.
Pnet starts prun and then psrv:
- pnet connects to prun (starting it if not running) on each
- /etc/inetd.conf on the spectrometer starts prun
- /etc/services on the spectrometer box has port 1421 attached to
- pnet (in routine pnet_connect_prun) connects to the socket 1421
on the spectrometer box. This starts prun
- pnet connects to prun on file servers.
- pnet sends the A command
to each prun box. This message contains the file server name:port for
- prun uses gethostbyname() to find the address of the file
server. The port is extracted from the filename.
- prun connects to psrv on the file server.
- On the file server psrv is started by xinetd. The port number
is 1421 (in the services file).
- Now pnet is connected to each prun on each box. Each box has a
connection to their own file server. pnet can send commands to psrv via
prun. The X cmd allows for a generic message to be forwarded to
psrv via prun.
- The configuration files are read by pnet.
- The config info is sent to prun (pnet_setup)
- pnet_dump is called to start the datataking:
- The first available file sequence number is found by querying
all psrvs (O cmd).
- Filename with seq number is sent to all psrv's (P cmd).
This opens the files.
- pnet makes the headers and then sends the 4K block to each psrv
(Q cmd). The command includes the number of dumps that are to be taken.
At this point psrv is in data acquistion mode (just waiting for data
blocks from prun).
- dma is engine is started on prun (pnet_startdma sends L command
- pnet_sync() will wait for the next 1 PPS from the first
spectrometer box (assuming not start immediate). This uses the H cmd.
- pnet sends the M cmd to prun to take data forever.
- While taking data:
- psrv will send back a status message every 1 second (w
command). This is passed back thru prun.
- prun does a select on: read: psrv, fpga, and pnet. It does a
select on write for psrv.
- pnet is waiting on any messages from prun.
- psrv is counting the blocks of data it reads from prun. The
number it needs to complete the run was sent during the writeheaders
- When psrv reads the final block of data, it sends a message back
to pnet (x cmd) saying that it has completed the run. In the meantime
psrv will continue reading from prun but the data will be discarded.
- pnet receives the x (done) message from each psrv. When the
number of end messages equals the number of spectrometers running, pnet
- pnet exitting causes the socket to prun to close.
- When prun sees the socket from pnet returning an error, it exits
(after stopping the datataking).
- When psrv sees the socket from prun return an error, it exits.
Changing rc.start in
The spectrometers execute /etc/rc.start on bootup.
To change something in this file:
- pdev/sw/image/etc-files/rc.start is the file to edit.
- then cd pdev/sw; make clean; make