#include "ccu.h"
#include "error.h"
#include <stdlib.h>
#include <stdio.h>
#include <gnome.h>
#include "semaphore.h"
#include "math.h"
#include "background.h"
Defines | |
#define | WIDTH 0x0850 |
#define | HEIGHT 0x800 |
#define | BYTESPERPIX 2 |
#define | BYTEORDER ccu_channels; |
Functions | |
void | ccu_fail (char *str) |
extracts the error code from an endmessage received from the CCU. | |
int | end_message_get_error_code (const char *endmsg) |
extracts the error code from an endmessage received from the CCU. | |
ccu_status_struct | ccu_get_status () |
returns the current status of the CCU. | |
void | ccu_set_status_async (struct ccu_status_struct input) |
sets the status of the CCU (for internal use by ccu.c only). | |
void | ccu_set_progress (char *msg, float f) |
sets the progress struct of ccu.c. | |
void | ccu_set_status (struct ccu_status_struct input) |
sets the status of the CCU. | |
void | ccu_set_com_problem (void) |
sets the CCUs communication problem flag. | |
void | ccu_reset_com_problem (void) |
resets the CCUs communication problem flag. | |
int | ccu_get_dummy_read () |
retruns 1 if dummy read is running and 0 otherwise. | |
void | ccu_reset_breakcondition () |
resets the CCUs break condition flag. | |
void | ccu_reset_warning () |
resets the CCUs warning flag. | |
int | ccu_get_xsize () |
returns the x size of the image beeing acquired currently. | |
int | ccu_get_ysize () |
returns the y size of the image beeing acquired currently. | |
progress_struct | ccu_get_progress () |
returns the current progress of the CCU. | |
int | ccu_get_available () |
retruns the availabilty of the ccu. | |
int | ccu_init (void) |
initializes ccu.c. | |
void | ccu_done (void) |
closes ccu.c. | |
int | ccu_load_sequence_context (void) |
loads the sequence list from the CCU. | |
int | ccu_simulate_sequence_context (void) |
generates a simulated sequence list. | |
int | ccu_load_version_number (void) |
loads the version number from the CCU. | |
int | ccu_simulate_version_number (void) |
gernerates a simulated version number. | |
int | ccu_load_and_check_sequence_context () |
loads the sequence list from the CCU, and compares it with data store in the .SQ file. | |
int | ccu_simulate_and_dont_check_sequence_context () |
loads the sequence list from the CCU, and compares it with data store in the .SQ file. | |
int | ccu_send_simple_command (char *command, char *description, int timeout) |
sends a command to the CCU and waits for the corresponding start message. | |
int | ccu_send_ending_command (char *command, char *description, int timeout) |
sends a command to the CCU and waits for the corresponding start and end messages. | |
int | ccu_wait_for_end_message (int timeout) |
waits for the CCU to send an end message. | |
int | ccu_dummy_read () |
starts a continues dummy read | |
int | ccu_quit () |
sends a quit signal to the CCU | |
int | ccu_quit_msg () |
sends a quit signal to the CCU | |
int | ccu_clear_queue () |
clears the queue CCU and empties the queue in ccu.c | |
int | ccu_contact (void) |
contacts the CCU | |
int | ccu_test_avail (void) |
tests whether the CCU is available and initalized it if possible. | |
int | ccu_start_queue () |
starts a queue in the ccu. | |
int | ccu_shutter_open () |
opens the shutter. | |
int | ccu_shutter_close () |
closes the shutter. | |
int | ccu_single_dummy_read () |
runs a single dummy read. | |
int | ccu_zero_volt () |
starts the zero volt sequence on the CCU. | |
int | ccu_set_gain (int gain) |
sets the gain. | |
int | ccu_set_capacity (int capacity) |
sets the capacity of the integration capacitor. | |
int | ccu_readout (int sequence) |
starts a readout. | |
int | ccu_readout_user (char *str) |
starts a readout, with a user defined readout command. | |
int | ccu_reset_kerneldriver () |
resets the kernel driver. | |
size_t | ccu_read_usb (unsigned char *data) |
reads 512 bytesfrom the usb kerneldriver. | |
int | ccu_parse_database () |
loads and parses a database given in the .SQ file | |
char * | ccu_function_origin_message (int funcorig) |
retruns a string corresponding to the given function origin code emitted by the CCU. | |
char * | ccu_error_message (int error) |
retruns a string corresponding to the given error code emitted by the CCU. | |
char * | ccu_status_message (int code) |
retruns a string corresponding to status code defined in ccu.h. | |
char * | ccu_status_text (int code) |
retruns a string corresponding to status code defined in ccu.h. | |
void | ccu_parse_endmessage (const char *endmsg) |
parses an endmessage and sets the status accordingly | |
void | ccu_parse_message (const char *msg) |
parses a message and sets the status accordingly | |
void | ccu_queue_push_item (char *input) |
queues a new command into the queue. | |
int | ccu_queue_pop_item (char *dummy) |
pops a command from the queue. | |
int | ccu_send_queue () |
send a queue to the CCU. | |
int | ccu_queue_file (char *filename) |
queues a list of commands read from a file. | |
int | ccu_upload_database_file (char *filename) |
downloads a database into the CCU. | |
void | ccu_start_database_dowload (char *str) |
starts a thread that will download the database into the CCU | |
void | ccu_start_zero_volt () |
starts a thread that will run the zero volt sequence in the CCU | |
void | ccu_start_database_dowload_basename (char *str) |
starts a thread that will download the database into the CCU | |
void | ccu_ser_in (const char *str) |
called whenever something is received from the CCU | |
void | ccu_ser_out (const char *str) |
called whenever something is sent to the CCU | |
int | ccu_send_command (char *cmd) |
sends a command to the CCD controller. | |
int | ccu_send_byte (int byte) |
sends a single byte to the CCD controller. | |
int | ccu_receive_command (char *cmd, int timeout) |
sends a single byte to the CCD controller. | |
int | ccu_finish () |
Destuctor. | |
void | makestar (long x, long y, unsigned long f, int boxsize, double sigma, unsigned char *image) |
Writes a simulated star to the image buffer. | |
void | makebias (unsigned long bias, unsigned long noise, unsigned char *image) |
Writes a simulated bias image to the image buffer. | |
void | ccu_simulate_image () |
Fills the image buffer with some pseudoastronimical data. | |
Variables | |
sem_t | ccu_sem |
sem_t | ccu_queue_sem |
serdev * | ccu_device |
FILE * | ccu_usbdev_file = NULL |
sem_t | ccu_status_sem |
ccu_status_struct | ccu_status |
volatile int | ccu_expect_break = 0 |
char | ccu_sequence_context [100][1000] |
char | ccu_sequence_context_full [100][1000] |
char | ui_ccu_sequence_context [100][1000] |
ccu_database_struct | ccu_database [100] |
char | ccu_dev [1000] |
char | ccu_usbdev [1000] |
int | ccu_stty_baud |
char | ccu_database_filename [1000] |
char | ccu_database_dir [1000] |
char | ccu_ctrldir [1000] |
int | ccu_channels |
GList * | ccu_queue_list = NULL |
int | ccu_simulation_mode = 0 |
unsigned char * | ccu_simulated_image = NULL |
unsigned long | ccu_simulation_position |
double | ccu_shutter_offset |
int | command_block = 1 |
Copyright (C) 2001-2003 Dirk Huenniger (dhun@astro.uni-bonn.de)
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
clears the queue CCU and empties the queue in ccu.c
|
|
contacts the CCU
|
|
closes ccu.c.
|
|
starts a continues dummy read
|
|
retruns a string corresponding to the given error code emitted by the CCU.
|
|
extracts the error code from an endmessage received from the CCU.
|
|
Destuctor.
|
|
retruns a string corresponding to the given function origin code emitted by the CCU.
|
|
retruns the availabilty of the ccu.
|
|
retruns 1 if dummy read is running and 0 otherwise.
|
|
returns the current progress of the CCU.
|
|
returns the current status of the CCU.
|
|
returns the x size of the image beeing acquired currently.
|
|
returns the y size of the image beeing acquired currently.
|
|
initializes ccu.c.
|
|
loads the sequence list from the CCU, and compares it with data store in the .SQ file.
|
|
loads the sequence list from the CCU.
|
|
loads the version number from the CCU.
|
|
loads and parses a database given in the .SQ file
|
|
parses an endmessage and sets the status accordingly
|
|
parses a message and sets the status accordingly
|
|
queues a list of commands read from a file.
|
|
pops a command from the queue.
|
|
queues a new command into the queue.
|
|
sends a quit signal to the CCU
|
|
sends a quit signal to the CCU
|
|
reads 512 bytesfrom the usb kerneldriver.
|
|
starts a readout.
|
|
starts a readout, with a user defined readout command.
|
|
sends a single byte to the CCD controller.
|
|
resets the CCUs break condition flag.
|
|
resets the CCUs communication problem flag.
|
|
resets the kernel driver.
|
|
resets the CCUs warning flag.
|
|
sends a single byte to the CCD controller.
|
|
sends a command to the CCD controller.
|
|
sends a command to the CCU and waits for the corresponding start and end messages.
|
|
send a queue to the CCU.
|
|
sends a command to the CCU and waits for the corresponding start message.
|
|
called whenever something is received from the CCU
|
|
called whenever something is sent to the CCU
|
|
sets the capacity of the integration capacitor.
|
|
sets the CCUs communication problem flag.
|
|
sets the gain.
|
|
sets the progress struct of ccu.c.
|
|
sets the status of the CCU.
|
|
sets the status of the CCU (for internal use by ccu.c only).
|
|
closes the shutter.
|
|
opens the shutter.
|
|
loads the sequence list from the CCU, and compares it with data store in the .SQ file.
|
|
Fills the image buffer with some pseudoastronimical data.
|
|
generates a simulated sequence list.
|
|
gernerates a simulated version number.
|
|
runs a single dummy read.
|
|
starts a thread that will download the database into the CCU
|
|
starts a thread that will download the database into the CCU
|
|
starts a queue in the ccu.
|
|
starts a thread that will run the zero volt sequence in the CCU
|
|
retruns a string corresponding to status code defined in ccu.h.
|
|
retruns a string corresponding to status code defined in ccu.h.
|
|
tests whether the CCU is available and initalized it if possible.
|
|
downloads a database into the CCU.
|
|
waits for the CCU to send an end message.
|
|
starts the zero volt sequence on the CCU.
|
|
extracts the error code from an endmessage received from the CCU.
|
|
Writes a simulated bias image to the image buffer.
|
|
Writes a simulated star to the image buffer.
|
|
the number of channels to be read out simutaneously |
|
the name of the directory for ccu control files received via network |
|
the CCU Database as read form the ".SQ" file |
|
the name of the directory containing the .DB and .SQ files to be selected |
|
the name of the ".DB" file containing the sequences |
|
the name of the file representing the serial port the CCU is connected to |
|
serial device |
|
1 if the next "break condition" message from the ccu shall be ignored 0 otherwise |
|
a list to store a ccu queue (for later transmission and execution) |
|
a semaphore protecting ccu_queue_list |
|
a semaphore protecting any operation on the CCU |
|
the names of the sequences as read from the CCU |
|
the full description of the sequences as read from the CCU, via H 13 |
|
Correction for incorrect shutter open time exposuretime_send_to_controlller=exposuretime_set_by_user-ccu_shutter_offset |
|
a buffer used to hold a simulated image if simulation mode is on |
|
if set to one the communication with the ccu's serial port will performed everyting will be simulated instead also the kernel driver will no be accessed some random data will be generated instead |
|
the position inside the simulated image |
|
a struct representing the current status of the CCU |
|
a semaphore procteting ccu_status |
|
the baud rate of the serial (ttyS) port used by the CCU |
|
the name of the file representing the usb device for fast data transfer form the CCU into the computer |
|
a file pointer for data acquistion via usb |
|
if this is not 0, any command to be sent to the ccu will be blocked |
|
the names of the sequences for display in a user interface |