Table of Contents
Previous Chapter
ACIS
The purpose of the Detector Electronics Assembly (DEA) Management classes are to manage access to the DEA CCD-controller and system boards.
The following lists the use of the DEA Manager:
- Load values into a CCD-controller's Program or Sequencer RAM
- Read values stored into a CCD-controller's Program or Sequencer RAM
- Start the CCD-controller sequencers
- Stop the CCD-controller sequencers
- Set the value of one of the DEA Registers or Digital-to-Analog converters
- Obtain the current value of one of the DEA Registers
- Enable and disable power to a single DEA CCD-controller board
Figure 114 illustrates the class relationships used by the Detector Electronics Assembly Manager class, DeaManager.
FIGURE 114. DeaManager Class Relationships
DeaManager - The DeaManager class is responsible for managing access to the Detector Electronics Assembly. It provides functions which read and write the contents of a CCD Controller board's Program and Sequencer RAM (readPram, readSram, writePram, writeSram), and to load complete images into the controller's RAM (loadSequencers). It provides functions to set control and digital-to-analog register values in one of the DEA boards and to query the values in the control and housekeeping registers (setRegister, queryDea). It provides functions to start and stop all of the DEA sequencers (invokeSequencer, stopSequencer). It also provides functions to individually power CCD-controller boards on and off and to determine if it has enabled power to a particular board (powerOn, powerOff, hasPower).
Semaphore - This class is supplied by the Executive class category. This class represents a resource lock or flag. Its implementation uses the underlying resource facilities of the RTX. The DeaManager contains an instance of this class, called lock, and uses this class to arbitrate access to the DEA interface. Prior to using the interface, the DeaManager attempts wait for exclusive access to the interface and reserve the semaphore (waitFor). Once the DeaManager has completed its action, it releases the semaphore (release).
DeaDevice - This class is supplied by the Devices class category. It is responsible for managing the physical interface between the Back End Processor and the Detector Electronics Assembly. The DeaManager uses this class to issue commands to the DEA and to retrieve status back from the DEA. This class provides functions which reset the DEA's interface board (reset() not shown), which indicate whether or not the command port to the DEA is ready to accept another command (isCmdPortReady), whether or not a status word has been received from the DEA (isReplyRead). It provides functions to write a command to be sent the DEA (sendCmd) and read status information sent back (readReply). The DeaDevice also provides a function which reads and returns the version of the science time-stamp, latched when the last command was issued to the DEA (readTimestamp).
TaskManager - This class is supplied by the Executive class category. It is responsible for managing the collection of tasks running within the Back End Processor. The DeaManager uses this class to obtain a pointer to the currently active task (queryCurrentTask).
Task - This class is supplied by the Executive class category. It represents and controls an active running task. The DeaManager uses this class to cause the current task to relinquish control to other tasks for a period of time (sleep).
This section describes how much time the DEA Manager must allow for commands to be transmitted to the DEA, and how much time it must allow for commands to be executed by the DEA. When issuing back-to-back commands, the DEA Manager must wait until the first command has been transmitted to the DEA and executed by the DEA before issuing a second command. If it sends the second command too close to the first, the DEA will ignore the second. Except for commands which demand a response from the DEA, there is no physical handshaking between the Back End Processor and the DEA. The command spacing requirements must be handled using time-delays.
The Back End Processor sends 24-bit commands to the DEA via a 1Mbps serial interface. It takes approximately 24us after the Back End writes a command word to the serial interface and the time at which it has been received by the DEA.
The time taken to execute a command varies from command to command. At a minimum, each command (including board and address selection) takes the DEA CCD Controllers 5us to execute.
The following tables list the various command types and their respective execution times:
TABLE 24. DEA CCD Controller Command Timing
----------------------------------------------------------------------------
Command Register Type Execution Time Reply Time Total Time
(including
transmission)
----------------------------------------------------------------------------
Select Card N/A 9µs N/A 33µs
Write N/A 9µs N/A 33µs
Address
Write Data PRAM/SRAM 9µs N/A 33µs
Write Data A/D Control Register 9.6ms N/A 9.6ms
Write Data Sequencer Control 19µs N/A 43µs
Read Data PRAM/SRAM 14µs 24µs 62µs
Read Data Housekeeping 56.5µs 45.5µs 121µs
Read Data Control Register 9µs 45.5µs 78.5µs
----------------------------------------------------------------------------
TABLE 25. DEA Interface Board Command Timing
-----------------------------------------------------------------------------
Command Execution Time Reply Timing Total Time
(including
transmission)
-----------------------------------------------------------------------------
Read CCD Controller Housekeeping 56.6µs 45.5µs 121µs
Read Interface Housekeeping 56.6µs 45.5µs 121µs
Write Focal Plane Temperature 9µs N/A 33µs
Write Back-out Temperature 9µs N/A 33µs
Enable Relay 1.024ms N/A 1.048ms
Switch CCD Controller Power 9µs(a) N/A 33µs
Calibrate A/D Converter 9.6ms N/A 9.6ms
Reset CCD Controllers 100ms N/A 100ms
-----------------------------------------------------------------------------
- (a)
- The CCD Controller power enable execution time does not include the board charge time. The instrument software will wait at 1/2 second after switching power on or off to a CCD Controller to allow the board to fully charge.
Assuming that the bulk of commanding to the DEA is to load Program and Sequencer RAM (PRAM and SRAM), the DEA Manager takes three approaches to command timing, fast commanding, and slow commanding. For commands which select boards, addresses and load RAM, the DEA Manager attempts to issue the commands as quickly as possible. For other commands which do not cause a response from the DEA, the DEA Manager adds the maximum delay between each command. For commands which request a response from the DEA, the DEA Manager blocks until the response has been received.
Refer to the "DPA/DEA Interface Control Document," MIT 36-02205 Rev. A for descriptions of the command and status formats, and the overall address map of the DEA CCD Controller boards. This version of the document also accurately lists the D/A Controller settings.
The following illustrates the 8-bit DEA CCD Controller Control Registers. Unless otherwise specified, all single-bit signals are active high (1 - enable, 0 - disable):
![](fm2html-table.gif)
----------------------------------------------------------------------------------
Address (msb) 6 5 4 3 2 1 (lsb)
7 0
----------------------------------------------------------------------------------
0x10000 100KHz Sequencer Offset (0..63) Stop Start
Sequencer Sequencer
0x10001 100KHz Video ADC Offset (0..63) Stop Start
Video Video
ADC ADC
0x10002 - Hold - - Video Video Video Video
House Output Output Output Output
keeping Enable Enable Enable Enable
Address Channel Channel Channel Channel
D C B A
0x10003 - - - Status High Clock Back -
Enable Speed Swap Junction
Tap Enable Diode
(active Enable Enable
low) (active
low)
----------------------------------------------------------------------------------
NOTE: In order to ensure that all the sequencers start at the same time, ACIS always broadcasts the "Start Sequencer/Stop Sequencer" command word to all controllers being used for a run. This means that all of the controllers must use the same 100KHz Sequencer Offset value.
The following lists the CCD Controller Housekeeping Channels:
![](fm2html-table.gif)
-------------------------------------------------------------------------
Index Description Min. Max. Conversion
Value Value
-------------------------------------------------------------------------
0 Parallel Image Array Voltage + 0 TBD Volts = TBD(value)
1 Parallel Image Array Voltage - 0 TBD Volts = TBD(value)
2 Parallel Framestore Voltage + 0 TBD Volts = TBD(value)
3 Parallel Framestore Voltage - 0 TBD Volts = TBD(value)
4 Serial Output Register Voltage + 0 TBD Volts = TBD(value)
5 Serial Output Register Voltage - 0 TBD Volts = TBD(value)
6 Reset Gate Voltage + 0 TBD Volts = TBD(value)
7 Reset Gate Voltage - 0 TBD Volts = TBD(value)
8 Output Gate Voltage 0 TBD Volts = TBD(value)
9 Scupper Voltage 0 TBD Volts = TBD(value)
10 Reset Diode Voltage 0 TBD Volts = TBD(value)
11 Drain Output Channel A Voltage 0 TBD Volts = TBD(value)
12 Drain Output Channel B Voltage 0 TBD Volts = TBD(value)
13 Drain Output Channel C Voltage 0 TBD Volts = TBD(value)
14 Drain Output Channel D Voltage 0 TBD Volts = TBD(value)
15 RTD4 - Board Temperature 0 TBD oC = TBD(value)
16 RTD3 - SRAM Temperature 0 TBD oC = TBD(value)
17 RTD2 - ADC Temperature 0 TBD oC = TBD(value)
18 RTD1 - Gate Array Temperature 0 TBD oC = TBD(value)
-------------------------------------------------------------------------
The DEA CCD Controllers are commanded using a small collection of control commands which can read and write a set of indexed control registers, D/A Converter settings, PRAM and SRAM memory locations, and A/D Converter housekeeping channels. The following describe the overall procedure for performing the indicated operation:
Writing to a Control Register, PRAM/SRAM or D/A Converter
- Ensure that the desired card is selected, and issue a "Card Selection" command if not.
- Use the "Write Address" command to select the destination register
- Use the "Write Data" command to write the data value to the register and wait for the command to execute.
Reading a Control Register, or PRAM/SRAM
- Ensure that the desired card is selected and is setup to reply to read requests. If not, ensure that the previously selected card's "Status Enable" is disabled (use "Write Address"/"Write Data" to deselect), and use "Card Selection" to select the new card, and then assert "Status Enable" (using "Write Address"/"Write Data") on the newly selected card.
- Use the "Write Address" command to select the control register or PRAM/SRAM location.
- Use the "Read Data" command to issue the query.
- Wait for the status word to arrive
Reading a housekeeping A/D Converter channel
Although the housekeeper query is being addressed to a CCD Controller card, the A/D converter on the DEA Interface card will be used to sample and transmit the signal back to the BEP. For this reason, all CCD Controller cards must have their "Status Enable" signals deasserted.
- Ensure that the desired card is selected and setup to reply (without "Status Enable"), and that no card has its "Status Enable" signal asserted. If this or another card left "Status Enable" asserted, then deassert it (use "Card Selection," if needed, followed by "Write Address"/"Write Data" to deassert the signal).
- Use the "Write Address" command to select the A/D channel to sample
- Use the "Read Data" command to issue the query.
- Wait for the status word to arrive from the interface card.
All commands to the DEA Interface card have the following overall format:
![](fm2html-table.gif)
---------------------------------------------------------------------------
23 22 21 20 19 18 17 16 15 12 11 0
---------------------------------------------------------------------------
0 0 1 1 Execute = 0 Unused Off = 0 Task Task dependent data
Read = 1 On = 1 Number
---------------------------------------------------------------------------
The task numbers and data fields on the DEA Interface board are as follows:
![](fm2html-table.gif)
-------------------------------------------------------------------------------------------------------------
Action Task Data Field
11 10 9 8 7 6 5 4 3 2 1 0
-------------------------------------------------------------------------------------------------------------
Read Interface 0xa Channel Number (0 - 39 decimal)
Housekeeping
Read Focal 0xb -
Plane Tempera
ture
Read Relay 0xc -
Positions
Set Focal Plane 0x1 12-bit temperature set-point
Temperature
Set Bakeout 0x2 12-bit temperature set-point
Tempearture
Set Spare D/A 0x3 Value
Set CCD Con 0x4 Board Power Selection Mask(a)
troller Power
Discrete Settings 0x5 - - - Hold - - - - - - Bake LED
Hk. Out
Addr.
Pulse Actions 0x6 - - - - - - - Reset CCD - - - Cal. A/D
Controllers
Signal Selects 0x7 - - - - Disable Disable Disable Disable - - - Signal
Video 100KHz Command Command Path
Clock Synch. Clock Data
Relay Enables 0x8 - - - - - - - R5 R4 R3 R2 R1
-------------------------------------------------------------------------------------------------------------
- (a)
- Bit 0 corresponds to board 1, bit 1 corresponds to board 2 and so on.
Unlike the DEA CCD Controllers, the DEA Interface Card does not rely on indexed registers for most of its functionalilty. Instead, it is commanded using a collection set of command opcodes, or "tasks." Each control function or collection of control functions is explicitly indicated by a command task number and possibly an item selection bit-field with the task-dependent data.
Setting a value (such as focal plane temperature)
- Form the command word with the appropriate task number, placing the data value in the task-dependent data portion of the command word, and set the "Execute/Read bit" to 0.
- Send the command
- Wait for the command to be sent and executed
Reading a value
- Form the command word with the appropriate task number and setting the "Execute/Read bit" to 1.
- Issue the command
- Wait for the status to be returned
Enabling a switch or state
- Form the command word with the appropriate task number, set the "Off/On" bit to 1, and set a `1' in the task-dependent data field for the items which are to be enabled.
- Issue the command
- Wait for the command to be executed
Disabling a switch or state
- Form the command word with the appropriate task number, set the "Off/On" bit to 0, and set a `1' in the task-dependent data field for the items which are to be disabled.
- Issue the command
- Wait for the command to be executed
Reading a Interface card housekeeping A/D converter channel
- Form the command word with the appropriate task number, and place the Interface Card housekeeping item code in the task-dependent data field.
- Issue the command
- Wait for the status to be returned
Reading a CCD Controller housekeeping A/D converter channel
See Section 26.4.2.4
Figure 115 illustrates the sequence of actions when a client instructs the DeaManager to load a section of Program RAM (PRAM). The scenario to load Sequencer RAM (SRAM) is the same except for the initial call to writeSram().
FIGURE 115. Load Program RAM Scenario
- The client tells the deaManager to load a section of PRAM using deaManager.writePram().
- The deaManager maps the requested PRAM address into an absolute DEA address, and calls loadRam() to perform the load.
- loadRam() gets and saves a pointer to the running task using taskManager.queryCurrentTask().
- loadRam() enters a loop where it loads each word into the DEA PRAM. The loop terminates once all words have been loaded, or on an error. The loop starts by symbolically obtaining exclusive access to the DEA by calling lock.waitFor().
- loadRam() then checks an internal flag indicating if the sequencer is running or if the board is off (hasPower() not shown), and if so, releases the lock (lock.release() not shown) and returns an error. If the sequencer is not running, the loadRam() calls writeData() to write one word into the DEA board's RAM. For this scenario, assume that the sequencer is not running.
- writeData() calls selectBoard() to ensure that the targeted DEA board has been selected.
- selectBoard() checks the desired board against the currently selected board, and if different, issues a command to select the desired board using sendCommand(). For the purposes of this scenario, assume that selectBoard() needs to issue the command.
- sendCommand() waits for the DEA command port to complete any transmissions in progress by calling waitForPort().
- waitForPort() consists of a loop which polls the status of the DEA command port using deaDevice.isCmdPortReady(). If the loop's count expires, waitForPort() returns an error. If the command port finishes its transmission before the loop count terminates, waitForPort() returns that the port is ready. The loop count is chosen such that the time to exhaust the count is longer than the time to send one command to the DEA. For this scenario, assume that the previous command transmission completes.
- Once the port is ready, sendCommand() performs a short busy-loop to allow the previous command to execute on the DEA, and then writes the new command to the DEA command port using deaDevice.sendCmd().
- Once the desired board has been selected, selectBoard() returns to writeData(). writeData() then sets the destination address for the memory write using setAddress(). setAddress(), in turn, calls sendCommand() to issue the command (not shown).
- writeData() then calls sendCommand() directly to write the data value into the DEA RAM, and then returns to loadRam().
- loadRam()'s write loop then releases its hold on the DEA port, using lock.release().
- loadRam() then checks how many words it has written since pausing to allow other tasks to run. If the number of words written exceeds the class-specific limit (defined by DeaManager::DEATIME_RAM_ITERATIONS), loadRam(), using its saved task pointer, tells the current task to sleep for a few tenths of a second, using client>sleep(). loadRam()'s loop then repeats from step 4 until all of the data words have been loaded into the DEA board's RAM.
Figure 116 illustrates the sequence of actions when a client instructs the DeaManager to load a section of Program RAM (PRAM). The scenario to read Sequencer RAM (SRAM) is the same except for the initial call to readSram().
FIGURE 116. Read Program RAM Scenario
- The client tells the deaManager to read section of PRAM using deaManager.readPram().
- readPram() converts the SRAM index into a DEA address, and calls readRam() to perform the read.
- readRam() obtains and saves a pointer to the currently running task, using taskManager.queryCurrentTask().
- readRam() then enters its acquisition loop. The loop terminates once all of the requested words have been read, or when an error is encountered. The body of the loop starts by symbolically obtaining exclusive access to the DEA, using lock.waitFor().
- readRam() then checks to see if sequencer is running or if the board is off. If so, it unlocks the DEA and returns an error. If not, it proceeds to read one word from the DEA using readData(). Assume for this scenario that the sequencer is not running.
- readData() selects the desired board using selectBoard() (see Section 26.5.1 for more detail).
- readData() then sets the desired read address using setAddress().
- readData() then issues a data read command to the DEA using sendCommand().
- Once the command has been issued, readData() obtains the returned data word using getStatus().
- getStatus() waits for the returned value to arrive using waitForStatus().
- waitForStatus() consists of a busy-loop which polls the DEA status port using deaDevice.isReplyReady(). If the loop's count expires before the status is returned, waitForStatus() returns an error. The busy-loop count is chosen to account for the execution time to read a value plus the transmission time of the value from the DEA to the BEP. Assume for this scenario that the reply arrives before the polling loop's count expires.
- getStatus() then reads the status port using deaDevice.readReply(), passing the value back to its caller.
- Once readData() has read and stored the RAM word into the destination buffer, readRam() releases the symbolic DEA lock using lock.release().
- readRam() then checks how words it has written since pausing to allow other tasks to run. If the number of words read exceeds the class-specific limit (defined by DeaManager::DEATIME_RAM_ITERATIONS), readRam(), using its saved task pointer, tells the current task to sleep for a few tenths of a second, using client->sleep(). readRam()'s loop then repeats from step 4 until all of the data words have been read from the DEA board's RAM.
Figure 117 illustrates the sequence of actions when a client instructs the DeaManager to start the CCD sequencers.
FIGURE 117. Start Sequencer Scenario
- The client issues a command to start the DEA CCD sequencers, using deaManager.invokeSequencer().
- invokeSequencer() obtains exclusive access to the DEA interface, using lock.waitFor().
- invokeSequencer() enables all DEA CCD-controller boards to listen for commands using selectBroadcast().
- invokeSequencer() selects the sequencer control register on all of the enabled boards using setAddress().
- invokeSequencer() then forms and writes a sequencer enable word to the selected register on all of the enabled boards using sendCommand(). The sequencers will start clocking within 10us after the command is transmitted to the DEA.
- invokeSequencer() obtains a pointer to the currently running task using taskManager.queryCurrentTask().
- invokeSequencer() instructs the current task to sleep for a tenth of a second to ensure that the latched time-stamp is stable, using client->sleep().
- invokeSequencer() then obtains a copy of the latched time-stamp using deaDevice.readTimestamp().
- invokeSequencer() releases the lock, using lock.release() and passed the read time-stamp to the calling client.
Figure 118 illustrates the sequence of actions when a client instructs the DeaManager to halt the CCD sequencers.
FIGURE 118. Stop Sequencer Scenario
- The client issues a command to halt the DEA CCD sequencers, using deaManager.stopSequencer().
- stopSequencer() obtains exclusive access to the DEA interface, using lock.waitFor().
- stopSequencer() enables all DEA CCD-controller boards to listen for commands using selectBroadcast().
- stopSequencer() selects the sequencer control register on all of the enabled boards using setAddress().
- stopSequencer() then forms and writes a sequencer disable word to the selected register on all of the enabled boards using sendCommand(). The sequencers will stop clocking once the command is transmitted to the DEA.
- After ensuring that the command port is ready, sendCommand() issues the command to the DEA boards using deaDevice.sendCmd().
- stopSequencer() obtains a pointer to the currently running task using taskManager.queryCurrentTask().
- stopSequencer() instructs the current task to sleep for a tenth of a second to ensure that the command has been executed by the DEA, using client->sleep().
- stopSequencer() releases the lock, using lock.release() and returns to the calling client.
Figure 119 illustrates the sequence of actions when a client instructs the DeaManager to write a value to one of the DEA board registers.
FIGURE 119. Set DEA Register Scenario
- The client issues a command to write a value to one of the DEA boards, using deaManager.setRegister().
- setRegister() obtains exclusive access to the DEA interface, using lock.waitFor(). It then checks if the board has power (hasPower() not shown), and if not, it releases the lock and returns an error.
- setRegister() writes the data to the selected board register by calling writeData().
- writeData() selects the desired DEA board using selectBoard().
- writeData() selects the desired register using setAddress().
- writeData() issues the command to write the data to the register using sendCommand().
- After waiting for the command port to become available, sendCommand() transmits the command to the DEA using deaDevice.sendCmd().
- Once the command has been issued, setRegister() gets a pointer to the currently running task using taskManager.queryCurrentTask().
- setRegister() tells the task to sleep for several tenths of a second to ensure that the DEA has time to act on the register command using client->sleep().
- setRegister() releases the lock using lock.release(), and returns to the calling client.
Figure 120 illustrates the sequence of actions when a client instructs the DeaManager to read a value from one of the DEA board registers.
FIGURE 120. Query DEA Register Scenario
- The client issues a command to read value from one of the DEA boards, using deaManager.queryDea().
- queryDea() obtains exclusive access to the DEA interface, using lock.waitFor(). It then checks if the board has power (hasPower() not shown), and if not, it releases the lock and returns an error.
- queryDea() reads the value from the desired board and register calling readData().
- readData() selects the desired DEA board using selectBoard().
- readData() selects the desired register using setAddress().
- readData() issues the command to read the data from the register using sendCommand().
- After waiting for the command port to become available, sendCommand() transmits the command to the DEA using deaDevice.sendCmd().
- readData() then gets the response to the query using getStatus().
- getStatus() waits for the reply to be received by the Back End, and reads the value using deaDevice.readReply().
- setRegister() releases the lock using lock.release(), and returns to the calling client.
Figure 121 illustrates the sequence of actions when a client instructs the DeaManager to power on a single DEA CCD-controller board. The steps involved in powering off a single board are similar, except that a power-off command is sent to the DEA Interface board. TBD: How to detect and update system configurations on power-on?
FIGURE 121. CCD-Controller Power On Scenario
- The client issues a command to enable power to one of the DEA CCD-controller boards, using deaManager.powerOn().
- powerOn() obtains exclusive access to the DEA interface using lock.waitFor().
- powerOn() issues a command to select the DEA Interface board on the DEA using selectBoard().
- powerOn() issues a command to select the power-control register on the DEA Interface board using setAddress().
- powerOn() adds the selected board to a mask of boards which have power, and issues a command to write the mask to the power control register using sendCommand().
- sendCommand() waits for the command port to complete its previous transfer, and then issues the command to the DEA using deaDevice.sendCmd().
- powerOn() obtains a pointer to the currently running task using taskManager.queryCurrentTask().
- powerOn() instructs the task to sleep for 1 second (TBD) using client->sleep().
- powerOn() releases its lock on the DEA interface using lock.release() and returns to the calling client.
Documentation:
- The DeaManager class performs high level input/output operations to the Detector Electronics Assembly. It is capable of loading sequencer memory, setting register levels, and querying housekeeping ports.
Export Control:
- Public
Cardinality:
- n
Hierarchy:
Superclasses:
none
Implementation Uses:
DeaDevice deaDevice
TaskManager taskManager
Task
Public Interface:
Operations:
DeaManager()
hasPower()
invokeSequencer()
loadSequencers()
powerOff()
powerOn()
queryDea()
readPram()
readSram()
setRegister()
stopSequencer()
writePram()
writeSram()
Protected Interface:
Operations:
getStatus()
loadRam()
readData()
readRam()
selectBoard()
selectBroadcast()
sendCommand()
setAddress()
waitForPort()
waitForStatus()
writeData()
Private Interface:
Timing Constants:
DEATIME_RAM_ITERATIONS = 1000 per sleep
DEATIME_RAM_SLEEP = 2 ticks (0.2 seconds)
DEATIME_LOCK_WAIT = 5 ticks (0.5 seconds)
DEATIME_REG_SLEEP = 2 ticks (0.2 seconds)
DEATIME_SEQ_SLEEP = 2 ticks (0.2 seconds)
DEATIME_CMD_ITERATIONS = 100 (~50us)
DEATIME_CMD_WAITLOOP = 500 (~250us)
DEATIME_STAT_WAITLOOP = 1500 (~750us)
DEATIME_POWER_ON_SLEEP = 10 (1 second)
DEATIME_POWER_OFF_SLEEP = 10 (1 second)
Has-A Relationships:
- unsigned curboard: This state variable indicates which DEA board was last written to and selected to send responses. If broadcast mode was last selected, or the last select command failed, this variable contains the value DEAID_UNKNOWN = 15.
- Boolean sequencerActive: This instance variable indicates whether or not the sequencers have been commanded to run or not.
- Semaphore lock: This is used to symbolically indicate exclusive access to the DEA interface.
- unsigned powermask: This variable maintains a list of currently powered DEA Boards. Bit 0 corresponds to board 0, bit 1 to board 1, etc. If a bit is set to 1, a command has been sent to turn the power on the board. If a bit is set to 0, the board should be off.
Concurrency:
- Synchronous
Persistence:
- Persistent
Public member of:
- DeaManager
Arguments:
unsigned semid
Documentation:
This is the constructor for the DEA Manager. semid is the Nucleus RTX semaphore id to use for the class's lock variable. The function initializes lock, sets curboard to DEAID_UNKNOWN, deasserts sequencerActive, and zeroes powermask. The body of the constructor calls deaDevice.reset() to reset the DEA interface board, and disable power to the DEA's CCD controller boards.
Concurrency:
- Sequential
Protected member of:
- DeaManager
Return Class:
- Boolean
Arguments:
unsigned& status
Documentation:
This function busy-waits until a status is received from the DEA, and stores the read word into the status parameter. If the status word is read successfully, the function returns BoolTrue. If the wait expires before a status word is ready, the function returns BoolFalse.
Semantics:
- Call waitForStatus() to synch. with the DEA. Then call deaDevice.readReply() to read the status word. If waitForStatus() times out, return BoolFalse, otherwise return BoolTrue.
Concurrency:
- Guarded
Public member of:
- DeaManager
Return Class:
- Boolean
Arguments:
DeaBoardId boardid
Documentation:
This function returns whether or not the DEA Manager has enabled power to the board, indicated by boardid, by examining the private powermask variable. If the board has been enabled, the function returns BoolTrue. If not, it returns BoolFalse.
Concurrency:
- Guarded
Public member of:
- DeaManager
Return Class:
- Boolean
Arguments:
unsigned& starttime
Documentation:
This function starts the DEA CCD Controller Sequencers. starttime is a copy of the science timestamp, latched when the command to start was issued. If the command is sent successfully, the function returns BoolTrue. If an error occurs, it returns BoolFalse.
Semantics:
- Obtain exclusive access to the DEA interface using lock.waitFor(). Select all CCD-controllers as listeners by calling selectBroadcast(). Select the sequencer control register using setAddress() and form and issue the sequencer start command using sendCommand(). Obtain the calling task using taskManager.queryCurrentTask() and sleep for DEATIME_SEQ_SLEEP timer ticks (0.1 second) using curtask>sleep() to allow the command to complete execution. Read the latched time-stamp using deaDevice.readTimestamp() and place the result into starttime. Assert the sequencerActive flag, and release access to the DEA interface using lock.release().
Concurrency:
- Guarded
Protected member of:
- DeaManager
Return Class:
- Boolean
Arguments:
DeaBoardId boardid
unsigned addr
const unsigned short* srcbuf
unsigned count
Documentation:
This function loads count words pointed to by srcbuf into the location specified by addr on the board specified by boardid. If the load succeeds, the function returns BoolTrue, otherwise it returns BoolFalse.
Semantics:
- Call taskManager.queryCurrentTask() to get pointer to calling task. Set iteration counter to DEATIME_RAM_ITERATIONS and enter loop, which terminates when there are no more words to store, or on error. On each iteration, call lock.waitFor() to obtain exclusive access to the DEA. Then check sequencerActive, and generate an error if the sequencers are running. Call hasPower() to make sure board was turned on, and generate error if not. Call writeData() to store the word into DEA RAM and release the lock using lock.release() once the function returns. Then check the iteration counter and call curtask->sleep() and reset the counter if it has expired, otherwise, decrement the counter.
Concurrency:
- Guarded
Public member of:
- DeaManager
Return Class:
- Boolean
Arguments:
const DeaSequenceLoad& image
Documentation:
This function loads the sequencer images, specified by image, into the indicated CCD controller boards. If the load is successful, the function returns BoolTrue. If the load fails, the function returns BoolFalse.
Semantics:
- Iterate through each section contained within image. On each section iteration, iterate through each selected controller board. If a board is selected, use writePram() to load PRAM sections into the boards, and writeSram() to load SRAM sections.
Concurrency:
- Guarded
Public member of:
- DeaManager
Return Class:
- Boolean
Arguments:
DeaBoardId boardid
Documentation:
This function issues a command to turn off power to one of the DEA's CCD Controller boards. The function returns BoolTrue if successful, and BoolFalse if the command transmission fails.
Semantics:
- Lock access to the DEA using lock.waitFor(). Call selectBoard() to select the DEA's interface board, and call setAddress() to select the power control register on that board. Clear the bit in powermask corresponding to boardid, and write powermask to the selected control register. Once the command has been issued, get a pointer to the current task using taskManager.queryCurrentTask(), and sleep for DEATIME_POWER_OFF_SLEEP using curtask->sleep(). Once the power-off time has elapsed, release control the DEA interface using lock.release().
Concurrency:
- Guarded
Public member of:
- DeaManager
Return Class:
- Boolean
Arguments:
DeaBoardId boardid
Documentation:
This function issues a command to enable power to the CCD controller board indicated by boardid. If the command is sent successfully, the function returns BoolTrue. If the command fails, it returns BoolFalse.
Semantics:
- Lock access to the DEA using lock.waitFor(). Call selectBoard() to select the DEA's interface board, and call setAddress() to select the power control register on that board. Set the bit in powermask corresponding to boardid, and write powermask to the selected control register. Once the command has been issued, get a pointer to the current task using taskManager.queryCurrentTask(), and sleep for DEATIME_POWER_ON_SLEEP using curtask->sleep(). Once the power-on time has elapsed, release control the DEA interface using lock.release().
Concurrency:
- Guarded
Public member of:
- DeaManager
Return Class:
- Boolean
Arguments:
DeaBoardId boardid
unsigned queryid
unsigned& value
Documentation:
This function queries the housekeeping port or PRAM location, addressed by queryid, on the DEA board indicated by boardid, and places the returned item into value. If the query command and response is successful, the function returns BoolTrue, otherwise it returns BoolFalse.
Semantics:
- Lock access to the DEA using lock.waitFor(). Call hasPower() to ensure that the desired board has been powered on. If the board is not on, return BoolFalse. Convert the queryid from a register index into a DEA address, and pass it, and the reference to value to readData(), which reads the requested register and places the result into value. Once the requested register has been read, release control the DEA interface using lock.release().
Concurrency:
- Guarded
Protected member of:
- DeaManager
Return Class:
- Boolean
Arguments:
DeaBoardId boardid
unsigned addr
unsigned& value
Documentation:
This function reads the field located at addr on DEA Board boardid and stores the result into value. If successful, the routine returns BoolTrue. If the read fails, it returns BoolFalse.
Semantics:
- Call selectBoard() to select the board to read from. Call setAddress() to select the address to read. Call sendCommand() to issue the read command. Call getStatus() to read the response to the query.
Concurrency:
- Guarded
Public member of:
- DeaManager
Return Class:
- Boolean
Arguments:
DeaBoardId pramid
unsigned index
unsigned short* dstbuf
unsigned valcnt
Documentation:
This function reads valcnt words of PRAM from the board specified by pramid, and starting from the location indicated by index into the array pointed to by dstbuf. If successful, the function returns BoolTrue. If a query fails, the function returns BoolFalse. This function adjusts index to the corresponding DEA address and calls readRam() to perform the read.
Concurrency:
- Guarded
Protected member of:
- DeaManager
Return Class:
- Boolean
Arguments:
DeaBoardId boardid
unsigned addr
unsigned short* dstbuf
unsigned count
Documentation:
This function reads count words from the DEA RAM located at addr on board boardid into the buffer dstbuf. If successful, the function returns BoolTrue, otherwise it returns BoolFalse.
Semantics:
- Call taskManager.queryCurrentTask() to get pointer to calling task. Set iteration counter to DEATIME_RAM_ITERATIONS and enter loop, which terminates when there are no more words to read, or on error. On each iteration, call lock.waitFor() to obtain exclusive access to the DEA. Then check sequencerActive, and generate an error if the sequencers are running. Call hasPower() to make sure board was turned on, and generate error if not. Call readData() to fetch the word from DEA RAM. Release the lock using lock.release() once the function returns. Store the returned value into the destination buffer. Then check the iteration counter and call curtask->sleep() and reset the counter if it has expired, otherwise, decrement the counter.
Concurrency:
- Guarded
Public member of:
- DeaManager
Return Class:
- Boolean
Arguments:
DeaBoardId sramid
unsigned index
unsigned short* dstbuf
unsigned valcnt
Documentation:
This function reads valcnt words of DRAM from the board specified by sramid, and starting from the location indicated by index into the array pointed to by dstbuf. If successful, the function returns BoolTrue. If a query fails, the function returns BoolFalse. This function adjusts index to the corresponding DEA address and calls readRam() to perform the read.
Concurrency:
- Guarded
Protected member of:
- DeaManager
Return Class:
- Boolean
Arguments:
DeaBoardId boardid
Documentation:
This function selects boardid as the current board being written to and being queried. If the specified board has already been selected, or if the selection command succeeds, the function returns BoolTrue. Otherwise, the function returns BoolFalse.
Semantics:
- Compare boardid to curboard. If different, form command, set the write mask bit corresponding to boardid, and the read select field to the passed boardid and issue the command using sendCommand(). If sendCommand() succeeds, copy boardid to curboard and return BoolTrue. If it fails, set curboard to DEAID_UNKNOWN and return BoolFalse.
Concurrency:
- Guarded
Protected member of:
- DeaManager
Return Class:
- Boolean
Documentation:
- This function issues a command which selects all boards to listen to the next command. If the command is successful, the function returns BoolTrue, otherwise, it returns BoolFalse.
Semantics:
- Set curboard to powermask, enabling all powered on boards as listeners, form command and set the read select to board DEAID_UNKNOWN. Issue the command using sendCommand(). If sendCommand() succeeds, return BoolTrue. If it fails, return BoolFalse.
Concurrency:
- Guarded
Protected member of:
- DeaManager
Return Class:
- Boolean
Arguments:
unsigned command
Documentation:
This function sends a command word, command, to the DEA. If the word is sent, the function returns BoolTrue. If the wait for the command port expires, the function returns BoolFalse.
Semantics:
- Call waitForPort() to wait until the command port is ready. Then execute a small loop DEATIME_CMD_INTERATIONS times to ensure a delay between the previous command and the next. Then pass command to deaDevice.sendCmd(). If waitForPort() fails, return BoolFalse, otherwise return BoolTrue.
Concurrency:
- Guarded
Protected member of:
- DeaManager
Return Class:
- Boolean
Arguments:
unsigned address
Documentation:
This function issues a command to copy address into current address register on the listening DEA board. If the command succeeds, the function returns BoolTrue. On error, it returns BoolFalse.
Semantics:
- Form and issues the write address command using sendCommand(). If the command is sent successfully, the function returns BoolTrue. If the command fails, it returns BoolFalse.
Concurrency:
- Guarded
Public member of:
- DeaManager
Return Class:
- Boolean
Arguments:
DeaBoardId boardid
unsigned regaddr
unsigned regval
Documentation:
This function writes regval to the register located on the DEA board, boardid, at the register address, regaddr. This function returns BoolTrue if the command is successfully sent, and BoolFalse if it fails to send the value. After issuing the command, the function sleeps the calling task for at least 0.2 seconds to allow the command to be executed.
Semantics:
- Obtain exclusive access to the DEA interface using lock.waitFor(). Check to ensure that the board has power, using hasPower(). Adjust the regaddr to map to the DEA register addresses and call writeData() to write the value to the specified board register. If it succeeds, get the current task, using taskManager.queryCurrentTask(), and sleep for DEATIME_REG_SLEEP (~0.2 seconds) to allow the command to be executed, release the lock using lock.release() and return BoolTrue. If the it fails, return BoolFalse.
Concurrency:
- Guarded
Public member of:
- DeaManager
Return Class:
- Boolean
Documentation:
- This function issues a command to stop the DEA CCD Controller Sequencers. If the command is successful, the function returns BoolTrue. If an error is detected, the function returns BoolFalse.
Semantics:
- Obtain exclusive access to the DEA interface using lock.waitFor(). Select all CCD-controllers as listeners by calling selectBroadcast(). Select the sequencer control register using setAddress() and form and issue the stop command using sendCommand(). Obtain the calling task using taskManager.queryCurrentTask() and sleep for DEATIME_SEQ_SLEEP timer ticks (0.1 second) using curtask>sleep() to allow the command to complete execution. Clear the sequencerActive flag, and release access to the DEA interface using lock.release().
Concurrency:
- Guarded
Protected member of:
- DeaManager
Return Class:
- Boolean
Documentation:
- This function busy waits until the DEA serial command port is ready to send a word of data. If the wait time exceeds the serial transfer time (i.e. about 24us), the function returns BoolFalse, otherwise, it returns BoolTrue.
Semantics:
- Iterate no more than DEATIME_CMD_WAITLOOP times, calling deaDevice.isCmdPortReady(). If the call returns BoolTrue, the port is ready for another command and return BoolTrue. Otherwise, continue iterating. If the loop iterations complete, the command port timed-out, and return BoolFalse.
Concurrency:
- Guarded
Protected member of:
- DeaManager
Return Class:
- Boolean
Documentation:
- This function busy-waits until a status word is received by the DEA status port. If a status word is ready, the function returns BoolTrue. If the wait expires without a status word being received, the function returns BoolFalse.
Semantics:
- Iterate DEATIME_STAT_WAITLOOP times or until deaDevice.isReplyReady() returns BoolTrue. If the device indicates a reply is ready, return BoolTrue. If the loop completes without a status word available, return BoolFalse.
Concurrency:
- Guarded
Protected member of:
- DeaManager
Return Class:
- Boolean
Arguments:
DeaBoardId boardid
unsigned addr
unsigned value
Documentation:
This function writes value to the register located on the DEA board, boardid, at the register address, addr. This function returns BoolTrue if the command is successfully sent, and BoolFalse if it fails to send the value.
Semantics:
- Call selectBoard() to ensure the appropriate board has been enabled. Then call setAddress() to select the register to write to, Then form and issue the write command using sendCommand() to send the value to the selected board. If all of the steps succeed, return BoolTrue, otherwise return BoolFalse.
Concurrency:
- Guarded
Public member of:
- DeaManager
Return Class:
- Boolean
Arguments:
DeaBoardId pramid
unsigned index
const unsigned short* srcbuf
unsigned valcnt
Documentation:
This function writes valcnt words of PRAM from the source buffer pointed to by srcbuf, into the board specified by pramid, and starting at the location indicated by index into the array pointed to by dstbuf. If successful, the function returns BoolTrue. If a write fails, the function returns BoolFalse. This function maps index to the appropriate DEA address and uses loadRam() to perform the load.
Concurrency:
- Guarded
Public member of:
- DeaManager
Return Class:
- Boolean
Arguments:
DeaBoardId sramid
unsigned index
const unsigned short* srcbuf
unsigned valcnt
Documentation:
This function writes valcnt words of SRAM from the source buffer pointed to by srcbuf, into the board specified by sramid, and starting at the location indicated by index into the array pointed to by dstbuf. If successful, the function returns BoolTrue. If a write fails, the function returns BoolFalse. This function maps index to the appropriate DEA address and uses loadRam() to perform the load.
Concurrency:
- Guarded
Table of Contents
Next Chapter