SEQUENCE OF COMMANDS FOR AN EXPOSURE expose_callback in expctl_stubs.c is called by the window manager when the user clicks on the expose button. Do_expose in expctl.c is then called by expose_callback. Do_readout_ccd in expctl.c is called from within do_expose. Within do_readout_ccd, three commands are executed/sent, 1) The total time of the image is written to the boards via the function dsp_command. Dsp_command then expects a DON before returning to do_readout_ccd. 2) A reset is sent (send_reset) and nothing is expected. 3) The sex (start exposure) command is sent via dsp_command. Dsp_command doesn't send the sex command. Instead it calls the function image_transfer in libdsp.c, and this is where everything goes on. 1) Send the sex command via send_sex 2) expect a DON 3) if the remaining time is less than or equal to 4 seconds, then send a word width of 1 and set/send the timeout for the image transfer. If there are more than 4 seconds left, then send a timeout of 75 usecs and get the remaining time from the utility board. When the time remaining is less than 4 seconds, send a word width of 1 and set/send the timeout for the image transfer. 4) Fork a child process to perform the read and if the fork fails, perform the read itself. The Read. The action of transferring the image is done via the UNIX system call 'read'. The name of the device driver, the location in user memory that will hold the image, and the size of the image are the parameters passed to read. At this point, the device driver is now responsible for transferring the image. The steps to do so are, (for the revision 1.6.x device driver) 1) Allocate and lock three 64KB buffers 2) Load the address and size of the first buffer onto the Address Register and the Byte Count Register of the DMA. 3) Enable the DMA to perform a data transfer by setting the appropriate bits in the DMA's condition status register. 4) Load the address and the size of the next buffer onto the Next Address register and the Next Byte Count Register. 5) When the first buffer has filled, the DMA will continue with the buffer in the Next Registers by moving the address and size in the Next Registers into the Address and Byte Count Registers, thus clearing the Next Registers. The device driver will load the address and the size of the next buffer onto the Next Address Register and the Next Byte Count Register. 6) Transfer the data in the first buffer into user memory. 7) Continue with steps 5 and 6 until the entire image has transferred. The Fork. The forking of the child process is a VERY time consuming and cpu expensive process, as is the time spent while child process is preparing for the image. In hindsight, step #4 has the potential to lose data. Therefore, it might be prudent to fork the child process before the send_sex command, and have the child process waiting on a semaphore. When the time comes to transfer the image, the semaphore could be changed and the child process could begin the data transfer immediately. Another Important note: Currently, the Rev 1.6.x device driver does not support timeouts. Whenever a timeout is sent, the device driver just ignores it.