MCA-3K Data Server (sipm-MDS) Reference |
|||||||||||||||||||||||||||||
eMorphoUSB driverData structuresFPGA Data structuresARM Data structuresAPI |
MCA-3K APISummaryThe MCA-3K API (mca3k_api.py) takes a command and a dictionary of mca objects as its argument, executes the command and returns data, if any, in the mca.data_in_dict member of each mca object. Reading dataWhen reading data, the API reads registers from the device, converts some of these into named fields and again reports some of these as physical quantities in SI-units in the user dictionary. All three hierarchical levels are populated automatically. Writing dataFor a short_write or write command the API only accepts the list data, and they have to be complete. For instance all 16 control registers must be given for a fpga_ctrl write to succeed. Write and short_write commands are used only when execution speed is of utmost performance, and added USB-delays (2ms) are unacceptable. Read-Modify-WriteThe most robust and easy to use method for updating parameters is to employ read-modify-write commands (dir='rmw'). When executing such a command, the API reads the current values from the target and promotes data from registers to named fields and then up to the user dictionary. It then proceeds to update only the values given by the user. It translates data from an input user dictionary to named fields, then merges in any user-supplied named fields, and finally copies all that into the list of data that are to be written to the device. The advantage to the user is that they only need to supply data for the quantities they want to change and can ignore all the others. Secondly, the MCA Data Server receives commands from any attached client and will execute them in order or receipt. A read-modify-write command is atomic in the sense that it cannot be interrupted by another client. API functionsThere are three main functions to process commands and boot attached devices.
The API accepts a command data structure (dictionary in Python) that is the same for all commands.
|