00001 00015 /* $Id: ccu.h,v 1.1.1.1 2005/11/18 17:30:35 greensheep Exp $ 00016 00017 $Log: ccu.h,v $ 00018 Revision 1.1.1.1 2005/11/18 17:30:35 greensheep 00019 Initial commit 00020 00021 Revision 1.1 2004/10/19 10:14:56 ocordes 00022 - starting with gboocia 00023 Revision 1.2 2005/10/3 Dirk Huenniger 00024 - finishing gboccia 00025 */ 00026 00027 00028 #ifndef __ccu_h 00029 #define __ccu_h 1 00030 #include <stdio.h> 00031 #include "serial.h" 00032 #include <sys/time.h> 00033 #include <progress.h> 00034 00035 00036 #define ccu_errorcode_ok 0 00037 #define ccu_errorcode_domino 1 00038 #define ccu_errorcode_load 2 00039 #define ccu_errorcode_sequence 3 00040 #define ccu_errorcode_copy_memory 4 00041 #define ccu_errorcode_protocol 5 00042 #define ccu_errorcode_time_out 6 00043 #define ccu_errorcode_vme 7 00044 00045 #define ccu_origin_dummy_logic 1 00046 #define ccu_origin_transfer 2 00047 #define ccu_origin_image 3 00048 #define ccu_origin_readout 4 00049 #define ccu_origin_device 5 00050 #define ccu_origin_load 6 00051 #define ccu_origin_wait 7 00052 00053 #define ccu_status_idle 0 00054 #define ccu_status_ok 1 00055 #define ccu_status_busy 2 00056 #define ccu_status_fail 3 00057 #define ccu_status_readout 4 00058 #define ccu_status_waiting 5 00059 #define ccu_status_dummy_read 6 00060 #define ccu_status_downloading 8 00061 #define ccu_timeout 10 00062 00063 #define ccu_closed 0 00064 00065 #define ccu_open 1 00066 00067 00071 struct ccu_database_struct { 00073 int num; 00075 int capacity; 00077 int binx; 00079 int biny; 00081 int loadl; 00083 char detec[1000]; 00085 char ccd[1000]; 00087 char data[1000]; 00089 char bias[1000]; 00091 char trim[1000]; 00093 char name[1000]; 00094 }; 00096 struct ccu_switches { 00097 int shutter; 00098 int breakcondition; 00099 int warning; 00100 int available; 00101 int senseline1; 00102 int senseline2; 00103 int biaslamp_active; 00104 int shutter_active; 00105 int dma_active; 00106 int remote_local_active; 00107 int low_gain; 00108 int com_problem; 00109 }; 00111 struct ccu_codes { 00112 int errorcode; 00113 int function_origin; 00114 int status; 00115 }; 00117 struct ccu_readout_struct { 00119 long int bytes_comming; 00121 long int bytes_red; 00123 int xsize; 00125 int ysize; 00127 int loadlist; 00128 }; 00129 00130 00132 struct ccu_status_struct { 00133 struct ccu_codes codes; 00134 struct ccu_switches switches; 00135 struct ccu_readout_struct readout; 00136 struct progress_struct progress; 00137 float version; 00138 }; 00139 00141 struct ccu_sequence_struct { 00142 char context[100][1000]; 00143 }; 00144 00146 struct DMA_BYTE { 00147 unsigned seqn :4; 00148 unsigned loadl :3; 00149 unsigned dma_req :1; 00150 }; 00151 00153 extern int command_block; 00155 extern double ccu_shutter_offset; 00156 00157 extern void ui_ccu_progress_changed(struct ccu_status_struct); 00158 extern void ui_ccu_switches_changed(struct ccu_status_struct); 00159 extern void ui_ccu_codes_changed(struct ccu_status_struct); 00160 extern void ui_ccu_ser_in( const char *str ); 00161 extern void ui_ccu_ser_out( const char *str ); 00162 extern void ui_ccu_sequences_changed( struct ccu_sequence_struct ); 00163 extern void ui_ccu_zero_volt_set(void); 00164 extern char ccu_sequence_context_full[100][1000]; 00165 00166 extern serdev *ccu_device; 00167 extern char ccu_sequence_context[100][1000]; 00168 extern FILE *ccu_usbdev_file; 00169 extern struct ccu_database_struct ccu_database[100]; 00170 extern char ccu_database_filename[1000]; 00171 extern char ccu_usbdev[1000]; 00172 extern char ccu_dev[1000]; 00173 extern char ccu_ctrldir[1000]; 00174 extern char logfile_name[1000]; 00175 extern char ccu_database_dir[1000]; 00176 extern int ccu_stty_baud; 00177 extern int ccu_channels; 00178 extern char ui_ccu_sequence_context[100][1000]; 00179 int ccu_test_avail ( void ); 00180 int ccu_init ( void ); 00181 int ccu_zero_volt (); 00182 void ccu_done ( void ); 00183 int ccu_reset_kerneldriver(); 00184 void ccu_display_ser_in( const char *str ); 00185 void ccu_display_ser_out( const char *str ); 00186 int end_message_get_error_code ( const char* endmsg ); 00187 int ccu_quit (); 00188 int ccu_quit_msg(); 00189 int ccu_dummy_read(); 00190 int ccu_shutter_open(); 00191 int ccu_shutter_close(); 00192 int ccu_load_sequence_context(void); 00193 int ccu_parse_database(); 00194 int ccu_start_queue(); 00195 int ccu_clear_queue(); 00196 int ccu_readout_user(char *str); 00197 int ccu_queue_pop_item(char *dummy); 00198 void ccu_queue_push_item(char* input); 00199 int ccu_upload_database_file(char *filename); 00200 struct ccu_status_struct ccu_get_status(); 00201 char* ccu_function_origin_message(int funcorig ); 00202 char *ccu_error_message( int error ); 00203 void ccu_parse_endmessage(const char* endmsg); 00204 int ccu_get_ysize(); 00205 int ccu_get_xsize(); 00206 struct progress_struct ccu_get_progress(); 00207 void ccu_ser_in( const char *str ); 00208 void ccu_ser_out( const char *str ); 00209 char *ccu_status_message( int code ); 00210 void ccu_reset_breakcondition(); 00211 void ccu_reset_warning(); 00212 int ccu_wait_for_end_message(int timeout); 00213 void ccu_reset_com_problem(void); 00214 void ccu_set_com_problem(void); 00215 char *ccu_status_text( int code ); 00216 int ccu_queue_file(char *filename); 00217 int ccu_send_queue(); 00218 size_t ccu_read_usb(unsigned char *data); 00219 int ccu_finish(); 00220 void ccu_simulate_image(); 00221 void ccu_start_database_dowload( char *str ); 00222 void ccu_start_database_dowload_basename( char *str ); 00223 void ccu_set_progress(char *msg, float f) ; 00224 void ccu_start_zero_volt(); 00225 #endif