Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added measure frequency and Mk2 libraries #54

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions xspress3App/src/xspress3Epics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1037,13 +1037,22 @@ asynStatus Xspress3::setupITFG(void)
int num_frames, trigger_mode, ppt;
double exposureTime;
int xsp3_status=XSP3_OK;
int clock_freq = 80e6;
int actual_clock_freq = xsp3_measure_clock_frequency(0, 0);
if (actual_clock_freq > 0) {
clock_freq = actual_clock_freq;
}
else printf(
"Error measuring onboard clock frequency, defaulting to 80MHz. error code: %d\n",
actual_clock_freq
);

getIntegerParam(xsp3TriggerModeParam, &trigger_mode);
if(trigger_mode == 7) {
getIntegerParam(ADNumImages, &num_frames);
getDoubleParam(ADAcquireTime, &exposureTime);
xsp3_status = xsp3->itfg_setup2( xsp3_handle_, 0, num_frames,
(u_int32_t) floor(exposureTime*80E6+0.5),
(u_int32_t) floor(exposureTime*clock_freq+0.5),
XSP3_ITFG_TRIG_MODE_SOFTWARE, XSP3_ITFG_GAP_MODE_1US,0,0,0 );
xsp3->histogram_arm(0,-1);
}
Expand All @@ -1052,7 +1061,7 @@ asynStatus Xspress3::setupITFG(void)
getIntegerParam(ADNumImages, &num_frames);
getDoubleParam(ADAcquireTime, &exposureTime);
xsp3_status = xsp3->itfg_setup( xsp3_handle_, 0, num_frames,
(u_int32_t) floor(exposureTime*80E6+0.5),
(u_int32_t) floor(exposureTime*clock_freq+0.5),
XSP3_ITFG_TRIG_MODE_BURST, XSP3_ITFG_GAP_MODE_1US );
}

Expand Down
58 changes: 46 additions & 12 deletions xspress3Support/datamod.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,31 @@
2d - A 2 D image of num_x cols and num_y rows.
1D_XY - One or more 1d images, where the first row contains X and the
second any subsequent rows contains Y data sets.
The bottom 4 bits are reserved for various plotting types. The top 12 bit allow specials to be coded
*/
#ifndef DISP_2D
#define DISP_2D 1
#define DISP_1D_XY 2
#define DISP_1D_Y 3
#define DISP_XSP_DTC (1<<4|DISP_1D_XY) /* Special display type for XSPRESS2 or 3 dtc_fit modules */

#define DATA_LONG 1
#define DATA_SHORT 2
#define DATA_FLOAT 3
#define DATA_DOUBLE 4

#define DATA_SHORT_DIG1 32
#define DATA_SHORT_DIG2 33

#define DATA_FIXED8_DIG1 40
#define DATA_FIXED8_DIG2 41
#define DATA_FIXED8_DIG3 42
#define DATA_FIXED8_DIG4 43
#define DATA_FIXED8_DIG5 44
#define DATA_FIXED8_DIG6 45
#define DATA_FIXED8_DIG7 46
#define DATA_FIXED8_DIG8 47

#endif

/* The structure contains x y and title strings */
Expand Down Expand Up @@ -80,6 +96,7 @@ typedef void mh_data;
#define ML_ANY 0
#define mkattrevs(a,b) 0
#define mktypelang(a,b) 0

#else
#include <module.h>
#include <types.h>
Expand Down Expand Up @@ -135,7 +152,7 @@ typedef struct
char t_label[MOD_LABLEN+2];
char z_label[MOD_LABLEN+2];
char title[MOD_TITLEN+2];
int labels_num, labels_size, labels_spare; /* For Y lables, future expansion */
int labels_num, labels_size, labels_spare; /* For Y labels, future expansion */
int data_offset;
} head;
int labels_offset[1]; /* First label offset if labels_size > 0 */
Expand All @@ -146,28 +163,45 @@ typedef struct
extern "C" {
#endif

typedef enum {ImgModUnlinkNone=0, ImgModUnlinkCreated=1, ImgModUnlinkAll=2} ImgModUnlink;

#if defined(__LINUX__) || defined(linux)
int _os_datmod (char *name, int off_t, u_int16 *attr_rev, u_int16 *type_lang, u_int32 perm, void **mod, void **mod_head);
int _os_link(char **namep, void **mod_head, void **mod, u_int16 *type_lang, u_int16 *att_rev);
int _os_link(char **namep, void **mod_head, void **mod, u_int16 *type_lang, u_int16 *att_rev);


int _os_datmod (const char *name, size_t s, u_int16 *attr_rev, u_int16 *type_lang, u_int32 perm, void **mod, void **mod_head);
int _os_link(const char **namep, void **mod_head, void **mod, u_int16 *type_lang, u_int16 *att_rev);
int _os_link2(const char *namep, void **mod_head, void **mod, u_int16 *type_lang, u_int16 *att_rev);
int munlink(void *mod_head);
int _os_unlink(void *mod_head);
int datamod_size(void *mod_head);
size_t datamod_size(void *mod_head);
int munlink_linux(void *mod_head, ImgModUnlink what);

MOD_IMAGE *id_mkmod ( char *name, int num_x, int num_y, char *x_lab, char *y_lab, int data_float, void **mod_head);
MOD_IMAGE3D *id_mkmod3d ( char *name, int num_x, int num_y, int num_t, char *x_lab, char *y_lab, char *t_lab, char ** labels, int data_float, mh_com **mod_head);
u_int32 *id_get_ptr(void *mod, int x, int y, int t);
MOD_IMAGE *id_mkmod (const char *name, int num_x, int num_y, const char *x_lab, const char *y_lab, int data_type, void **mod_head);
MOD_IMAGE3D *id_mkmod3d (const char *name, int num_x, int num_y, int num_t, const char *x_lab, const char *y_lab, const char *t_lab, char ** labels, int data_type, mh_com **mod_head);
size_t datamod_mod_size(void *mod);
MOD_IMAGE *id_mkmod_err_msg (const char *name, int num_x, int num_y, const char *x_lab, const char *y_lab, int data_type, mh_com **mod_head, char *err_msg, int max_err_msg);
MOD_IMAGE3D *id_mkmod3d_err_msg (const char *name, int num_x, int num_y, int num_t, const char *x_lab, const char *y_lab, const char *t_lab, char ** labels, int data_type, mh_com **mod_head, char *err_msg, int max_err_msg);

#else
MOD_IMAGE *id_mkmod ( char *name, int num_x, int num_y, char *x_lab, char *y_lab,
int data_float, mh_com **mod_head);
MOD_IMAGE *id_mkmod (const char *name, int num_x, int num_y, const char *x_lab, const char *y_lab, int data_type, mh_com **mod_head);
MOD_IMAGE *id_mkmod_err_msg (const char *name, int num_x, int num_y, const char *x_lab, const char *y_lab, int data_type, mh_com **mod_head, char *err_msg, int max_err_msg);

MOD_IMAGE3D *id_mkmod3d ( char *name, int num_x, int num_y, int num_t, char *x_lab, char *y_lab, char *t_lab, char ** labels, int data_float, mh_com **mod_head);
MOD_IMAGE3D *id_mkmod3d (const char *name, int num_x, int num_y, int num_t, const char *x_lab, const char *y_lab, const char *t_lab, char ** labels, int data_type, mh_com **mod_head);
MOD_IMAGE3D *id_mkmod3d_err_msg (const char *name, int num_x, int num_y, int num_t, const char *x_lab, const char *y_lab, const char *t_lab, char ** labels, int data_type, mh_com **mod_head, char *err_msg, int max_err_msg);

#endif
u_int32 *id_get_ptr(void *mod, int x, int y, int t);
int id_clear_mod(void *p);
int id_copy_mod(void *s, void *d);
char *id_get_label(void *p, int row);
int id_mod_get_shape(void *m, int *num_x, int *num_y, int *num_t);
int id_get_num_x(void *p);
int id_get_num_y(void *p);
int id_get_num_t(void *p);
int id_get_data_type(void *p);

char ** mdir_list();

#endif
#ifdef __cplusplus
}
#endif
Expand Down
Binary file removed xspress3Support/os/linux-x86_64/libimg_mod.a
Binary file not shown.
Binary file modified xspress3Support/os/linux-x86_64/libimg_mod.so
Binary file not shown.
Binary file modified xspress3Support/os/linux-x86_64/libimg_mod.so.1.0
Binary file not shown.
Binary file removed xspress3Support/os/linux-x86_64/libxspress3.a
Binary file not shown.
Binary file modified xspress3Support/os/linux-x86_64/libxspress3.so
Binary file not shown.
Binary file modified xspress3Support/os/linux-x86_64/libxspress3.so.1.0
Binary file not shown.
40 changes: 34 additions & 6 deletions xspress3Support/os9types.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
#ifndef _OS9_TYPES_H
#define _OS9_TYPES_H
#define _OS9_TYPES_H
#ifdef _MSC_VER
#if _MSV_VER>=1600
#include <stdint.h>
#else
typedef __int8 int8_t;
typedef __int16 int16_t;
typedef __int32 int32_t;
typedef __int64 int64_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
#endif
typedef uint8_t u_int8;
typedef uint16_t u_int16;
typedef uint32_t u_int32;
typedef int32_t int32;
typedef int16_t int16;
typedef uint8_t u_int8_t;
typedef uint16_t u_int16_t;
typedef uint32_t u_int32_t;
typedef uint64_t u_int64_t;
typedef int pid_t;

#else
#ifdef __CYGWIN__
#if defined(__int8_t_defined) && 0
/* Becasue of yet more confusion, this tries to use the C99 standard type from stdint.h from inttypes.h */
Expand All @@ -19,28 +44,30 @@ typedef int32_t int32;
typedef int16_t int16;
#endif
#else
#ifdef __MINGW32__
#if defined(__MINGW32__) | defined(__MINGW64__)
#if defined(__int8_t_defined) && 0
/* Becasue of yet more confusion, this tries to use the C99 standard type from stdint.h from inttypes.h */
/* Even more confusiion as __int8_defined seesm to lie a little */
/* Even more confusion as __int8_defined seesm to lie a little */
typedef uint8_t u_int8;
typedef uint16_t u_int16;
typedef uint32_t u_int32;
typedef int32_t int32;
typedef int16_t int16;
#else
/* Or uses some others from */
/* Or uses some others from */
#include <stdint.h>
typedef uint8_t u_int8;
typedef uint16_t u_int16;
typedef uint32_t u_int32;
typedef int32_t int32;
typedef int16_t int16;
typedef uint64_t u_int64_t;
#endif
#else
#ifdef linux
#if defined(__int8_t_defined) && 0
/* Becasue of yet more confusion, this tries to use the C99 standard type from stdint.h from inttypes.h */
/* Even more confusiion as __int8_defined seesm to lie a little */
/* Because of yet more confusion, this tries to use the C99 standard type from stdint.h from inttypes.h */
/* Even more confusion as __int8_defined seems to lie a little */
typedef uint8_t u_int8;
typedef uint16_t u_int16;
typedef uint32_t u_int32;
Expand All @@ -61,6 +88,7 @@ typedef u_int64_t u_int64;
#endif
#endif
#endif
#endif

typedef int error_code;
typedef pid_t process_id;
Expand Down
Loading