Defines | Functions | Variables

marhw.cpp File Reference

#include <stdio.h>
#include <time.h>
#include <math.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include "esd.h"
#include "esd_error.h"
#include "marcmd.h"
#include "mar_command.h"
#include "marglobals.h"
#include "twopower.h"
#include "config.h"
#include "marhw.h"
Include dependency graph for marhw.cpp:

Go to the source code of this file.

Defines

#define min0(a, b)   if ( b < a ) a = b
#define max0(a, b)   if ( b > a ) a = b
#define MAX_DOSE   2000

Functions

float GetDiskSpace (char *)
int mar_io ()
void swaplong (char *, int)

Variables

char start_time [32]
char motor_op = 0
char skip_op = 0
char keep_image = 1
int mar_error = 0
int target_steps = 0
int ict1 = 0
int ict2 = 0
int adc1 = 0
int adc2 = 0
time_t exposure_time
time_t exposure_start = 0
int erase_start
int fehler_index = 0
int stat_scan_add = 0
int stat_task_number
int stat_task_active
int stat_task_done
int stat_task_mode
int stat_task_error
int stat_pixels
int stat_blocks_sent
int stat_blocks_scanned
int stat_reference_status
int stat_plate_locked
int stat_lock_permit
int stat_sending_data
int stat_oscil_msg = (-1)
char stat_home = 1
char stat_scan_active = 0
int com_phi_steps
int op_dosen
float op_dosebeg
float op_doseend
float op_dosemin
float op_dosemax
float op_doseavg
float op_dosesig
double target_distance
double original_distance
double target_phi
double original_phi
double target_omega
double original_omega
static float expo_dosebeg = 99999
static float expo_doseend = 0.0
static float expo_doseavg = 0.0
static float expo_dosesig = 0.0
static float expo_dosemin = 999999.0
static float expo_dosemax = 0.0
static int expo_dosen = 0
static int i
static int j
static char motor_moving [6] = {0,0,0,0,0,0}
static char change_mode = 0
static char scan_started = 0
static char stop_image = 0
static int last_mar_mode = 0
static int dist_retry = 0
static int intensity_counter = 0
static int open_shutter_counter = 0
static int close_shutter_counter = 0
static int scan_error = 0
static int p_task_active = 0
static int erase_lamps_ok = 0
static int expo_dose [MAX_DOSE]
static time_t now
static time_t tick
static time_t last = 0
static float ftmp
static float erase_time = 1.0
static float xray_start = -999.0
static float stat_start_phi = 0.0
static int stat_erase_T
static int stat_erase_R
static int stat_erase_L
static int stat_erase_T_temp
static int stat_erase_R_temp
static int stat_erase_L_temp
static int stat_servo_warning
static int stat_laser_status
static int task_done [MAX_CMD]
static int task_error [MAX_CMD]
static int task_active [MAX_CMD]
static int task_queued [MAX_CMD]
static int task_started [MAX_CMD]
char op_in_progress
char scan_in_progress
int images_per_sweep
int current_block
int maximum_block
int current_pixel
int maximum_pixels
static MarHWmarhw = NULL

Define Documentation

#define max0 (   a,
 
)    if ( b > a ) a = b

Definition at line 41 of file marhw.cpp.

Referenced by MarHW::mar_progress().

#define MAX_DOSE   2000

Definition at line 42 of file marhw.cpp.

Referenced by MarHW::mar_progress(), MarHW::marTask(), and MarHW::StartScan().

#define min0 (   a,
 
)    if ( b < a ) a = b

Definition at line 40 of file marhw.cpp.

Referenced by MarHW::mar_progress().


Function Documentation

float GetDiskSpace ( char *  )

Definition at line 90 of file mardisk.c.

References disk.

{
float           free= 999999.0 ;

        if (strlen(dir) < 1 ) return( free );

#ifdef __sgi
        if(statfs(dir, &disk, sizeof disk, 0) != 0) return( free );
#elif (__linux__ || __hpux || __DARWIN__)
        if(statfs(dir, &disk) != 0) return( free );
#elif ( SUN )
        if(statvfs(dir, &disk) != 0) return( free );
#elif __osf__
        if(statfs(dir, &disk, sizeof disk )  != 0 )return( free ); 
#endif

#ifdef __osf__ 
        free = (float)disk.f_bavail * (float)disk.f_fsize / 1024000.;
#else
        if(disk.f_blocks > 0)
                free = (float)disk.f_bfree * (float)disk.f_bsize / 1024000. ;
#endif

        return( free );
}
int mar_io ( )
void swaplong ( char *  ,
int   
)

Definition at line 129 of file utils.c.

Referenced by Getmar300Header(), MarXF::mar_start_scan_readout(), MarNet::net_comm(), MarNet::net_stat(), and MarHW::print_msg().

{
        register int i, t1, t2, t3, t4;

        for(i=nbytes/4;i--;) {
                t1 = data[i*4+3];
                t2 = data[i*4+2];
                t3 = data[i*4+1];
                t4 = data[i*4+0];
                data[i*4+0] = t1;
                data[i*4+1] = t2;
                data[i*4+2] = t3;
                data[i*4+3] = t4;
        }
}

Variable Documentation

int adc1 = 0

Definition at line 54 of file marhw.cpp.

Referenced by MarXF::get_header_values(), MarXF::PrintStats(), and MarXF::Transform().

int adc2 = 0

Definition at line 55 of file marhw.cpp.

Referenced by MarXF::get_header_values(), MarXF::PrintStats(), and MarXF::Transform().

char change_mode = 0 [static]

Definition at line 101 of file marhw.cpp.

Referenced by MarHW::mar_change_mode(), and MarHW::marTask().

int close_shutter_counter = 0 [static]

Definition at line 109 of file marhw.cpp.

Referenced by MarHW::mar_start_expo().

Definition at line 78 of file marhw.cpp.

Referenced by MarHW::mar_progress(), MarHW::mar_start_expo(), and MarHW::marTask().

int dist_retry = 0 [static]

Definition at line 106 of file marhw.cpp.

Referenced by MarHW::mar_progress(), and MarHW::marTask().

int erase_lamps_ok = 0 [static]

Definition at line 112 of file marhw.cpp.

Referenced by MarHW::marTask(), MarHW::process_status(), and MarHW::StartScan().

float erase_time = 1.0 [static]

Definition at line 117 of file marhw.cpp.

Referenced by MarHW::mar_erase(), MarHW::mar_progress(), and MarHW::marTask().

int expo_dose[MAX_DOSE] [static]

Definition at line 113 of file marhw.cpp.

Referenced by MarHW::mar_progress(), MarHW::marTask(), and MarHW::StartScan().

float expo_doseavg = 0.0 [static]

Definition at line 89 of file marhw.cpp.

Referenced by MarHW::mar_progress(), MarHW::marTask(), and MarHW::StartScan().

float expo_dosebeg = 99999 [static]

Definition at line 87 of file marhw.cpp.

Referenced by MarHW::mar_progress(), MarHW::marTask(), and MarHW::StartScan().

float expo_doseend = 0.0 [static]

Definition at line 88 of file marhw.cpp.

Referenced by MarHW::mar_progress(), MarHW::marTask(), and MarHW::StartScan().

float expo_dosemax = 0.0 [static]

Definition at line 92 of file marhw.cpp.

Referenced by MarHW::mar_progress(), MarHW::marTask(), and MarHW::StartScan().

float expo_dosemin = 999999.0 [static]

Definition at line 91 of file marhw.cpp.

Referenced by MarHW::mar_progress(), MarHW::marTask(), and MarHW::StartScan().

int expo_dosen = 0 [static]

Definition at line 93 of file marhw.cpp.

Referenced by MarHW::mar_progress(), MarHW::marTask(), and MarHW::StartScan().

float expo_dosesig = 0.0 [static]

Definition at line 90 of file marhw.cpp.

Referenced by MarHW::marTask(), and MarHW::StartScan().

time_t exposure_start = 0

Definition at line 58 of file marhw.cpp.

Referenced by MarHW::mar_progress(), MarHW::marTask(), and MarHW::StartScan().

time_t exposure_time

Definition at line 57 of file marhw.cpp.

Referenced by MarHW::mar_start_expo(), and MarHW::StartScan().

int fehler_index = 0

Definition at line 61 of file marhw.cpp.

Referenced by MarHW::get_error(), and MarHW::marError().

float ftmp [static]
int i [static]
int ict1 = 0

Definition at line 52 of file marhw.cpp.

Referenced by MarNet::net_data(), and MarHW::StartScan().

int ict2 = 0

Definition at line 53 of file marhw.cpp.

Referenced by MarNet::net_data(), and MarHW::StartScan().

int intensity_counter = 0 [static]

Definition at line 107 of file marhw.cpp.

Referenced by MarHW::mar_progress(), and MarHW::StartScan().

int j
char keep_image = 1
time_t last = 0 [static]
int last_mar_mode = 0 [static]

Definition at line 105 of file marhw.cpp.

Referenced by MarHW::mar_command().

int mar_error = 0

Definition at line 50 of file marhw.cpp.

Referenced by MarHW::marError().

MarHW* marhw = NULL [static]

Definition at line 150 of file marhw.cpp.

Referenced by MarHW::mar_hw().

Definition at line 72 of file marxf.cpp.

Referenced by MarXF::mar_start_scan_readout(), and MarXF::Transform().

char motor_moving[6] = {0,0,0,0,0,0} [static]

Definition at line 100 of file marhw.cpp.

Referenced by MarHW::marTask(), and MarHW::process_status().

char motor_op = 0

Definition at line 47 of file marhw.cpp.

Referenced by MarHW::mar_move_phi(), MarHW::mar_progress(), and MarHW::marTask().

time_t now [static]
float op_doseavg

Definition at line 82 of file marhw.cpp.

Referenced by MarHW::StartScan().

float op_dosebeg

Definition at line 81 of file marhw.cpp.

Referenced by MarXF::get_header_values(), and MarHW::StartScan().

float op_doseend

Definition at line 81 of file marhw.cpp.

Referenced by MarXF::get_header_values(), and MarHW::StartScan().

float op_dosemax

Definition at line 81 of file marhw.cpp.

Referenced by MarHW::StartScan().

float op_dosemin

Definition at line 81 of file marhw.cpp.

Referenced by MarHW::StartScan().

int op_dosen

Definition at line 80 of file marhw.cpp.

Referenced by MarHW::StartScan().

float op_dosesig

Definition at line 82 of file marhw.cpp.

Referenced by MarHW::StartScan().

Definition at line 58 of file marxf.cpp.

Referenced by MarXF::output_image(), and MarXF::Transform().

int open_shutter_counter = 0 [static]

Definition at line 108 of file marhw.cpp.

Referenced by MarHW::mar_start_expo().

Definition at line 83 of file marhw.cpp.

Referenced by MarHW::mar_progress(), and MarHW::marTask().

Definition at line 85 of file marhw.cpp.

double original_phi

Definition at line 84 of file marhw.cpp.

int p_task_active = 0 [static]

Definition at line 111 of file marhw.cpp.

Referenced by MarHW::mar_progress().

int scan_error = 0 [static]

Definition at line 110 of file marhw.cpp.

Referenced by MarHW::StartScan().

Definition at line 56 of file marxf.cpp.

char scan_started = 0 [static]

Definition at line 102 of file marhw.cpp.

Referenced by MarHW::mar_progress(), and MarHW::StartScan().

char skip_op = 0

Definition at line 48 of file marhw.cpp.

Referenced by MarHW::marTask(), MarXF::output_image(), and MarXF::PrintResults().

char start_time[32]

Definition at line 46 of file marhw.cpp.

Referenced by MarHW::marTask().

Definition at line 70 of file marhw.cpp.

Referenced by MarNet::net_data().

Definition at line 69 of file marhw.cpp.

Referenced by MarXF::mar_start_scan_readout(), MarNet::net_data(), and MarXF::Transform().

Definition at line 121 of file marhw.cpp.

Referenced by MarHW::process_status().

Definition at line 122 of file marhw.cpp.

Referenced by MarHW::process_status().

Definition at line 121 of file marhw.cpp.

Referenced by MarHW::process_status().

Definition at line 122 of file marhw.cpp.

Referenced by MarHW::process_status().

int stat_erase_T [static]

Definition at line 121 of file marhw.cpp.

Referenced by MarHW::process_status().

int stat_erase_T_temp [static]

Definition at line 122 of file marhw.cpp.

Referenced by MarHW::process_status().

char stat_home = 1

Definition at line 76 of file marhw.cpp.

Referenced by MarHW::process_status().

Definition at line 123 of file marhw.cpp.

Referenced by MarHW::process_status().

Definition at line 73 of file marhw.cpp.

Referenced by MarHW::mar_lock(), and MarHW::process_status().

int stat_oscil_msg = (-1)

Definition at line 75 of file marhw.cpp.

Referenced by MarHW::mar_progress().

Definition at line 68 of file marhw.cpp.

Referenced by MarHW::mar_progress(), and MarHW::process_status().

Definition at line 72 of file marhw.cpp.

Referenced by MarHW::mar_lock(), and MarHW::process_status().

Definition at line 71 of file marhw.cpp.

Referenced by MarHW::process_status().

char stat_scan_active = 0

Definition at line 77 of file marhw.cpp.

Referenced by MarHW::process_status().

int stat_scan_add = 0

Definition at line 62 of file marhw.cpp.

Referenced by MarXF::mar_start_scan_readout(), MarHW::marTask(), and MarHW::StartScan().

Definition at line 74 of file marhw.cpp.

int stat_servo_warning [static]

Definition at line 123 of file marhw.cpp.

Referenced by MarHW::process_status().

float stat_start_phi = 0.0 [static]

Definition at line 119 of file marhw.cpp.

Referenced by MarHW::mar_progress(), MarHW::marTask(), and MarHW::StartScan().

Definition at line 64 of file marhw.cpp.

Referenced by Command::exec_command(), and MarHW::process_status().

Definition at line 65 of file marhw.cpp.

Referenced by MarHW::process_status().

Definition at line 67 of file marhw.cpp.

Referenced by MarHW::process_status().

Definition at line 66 of file marhw.cpp.

Definition at line 63 of file marhw.cpp.

Referenced by MarHW::mar_progress(), MarHW::marTask(), and MarHW::process_status().

char stop_image = 0 [static]

Definition at line 103 of file marhw.cpp.

Referenced by MarHW::mar_progress(), and MarHW::marTask().

Definition at line 83 of file marhw.cpp.

Referenced by MarHW::mar_progress(), and MarHW::marTask().

double target_omega

Definition at line 85 of file marhw.cpp.

Referenced by MarHW::marTask().

double target_phi

Definition at line 84 of file marhw.cpp.

Referenced by MarHW::mar_move_phi(), and MarHW::marTask().

int target_steps = 0

Definition at line 51 of file marhw.cpp.

Referenced by MarHW::marTask().

int task_active[MAX_CMD] [static]

Definition at line 126 of file marhw.cpp.

Referenced by MarHW::process_status().

int task_done[MAX_CMD] [static]

Definition at line 124 of file marhw.cpp.

Referenced by MarHW::process_status().

int task_error[MAX_CMD] [static]

Definition at line 125 of file marhw.cpp.

Referenced by MarHW::process_status().

int task_queued[MAX_CMD] [static]

Definition at line 127 of file marhw.cpp.

Referenced by MarHW::process_status().

int task_started[MAX_CMD] [static]

Definition at line 128 of file marhw.cpp.

Referenced by MarHW::process_status().

time_t tick

Definition at line 114 of file marhw.cpp.

Referenced by MarHW::marError(), and MarHW::marTask().

float xray_start = -999.0 [static]

Definition at line 118 of file marhw.cpp.

Referenced by MarHW::mar_progress(), and MarHW::StartScan().