mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
format
This commit is contained in:
parent
492b4815a6
commit
007330caa7
@ -106,10 +106,9 @@ static PyObject *decode(PyObject *Py_UNUSED(self), PyObject *args,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (n_threads == 1) {
|
||||||
if (n_threads == 1){
|
|
||||||
pm_decode(src, dst, pm, n_frames, n_rows * n_cols);
|
pm_decode(src, dst, pm, n_frames, n_rows * n_cols);
|
||||||
}else{
|
} else {
|
||||||
// Multithreaded processing
|
// Multithreaded processing
|
||||||
pthread_t *threads = malloc(sizeof(pthread_t *) * n_threads);
|
pthread_t *threads = malloc(sizeof(pthread_t *) * n_threads);
|
||||||
thread_args *arguments = malloc(sizeof(thread_args) * n_threads);
|
thread_args *arguments = malloc(sizeof(thread_args) * n_threads);
|
||||||
@ -120,7 +119,8 @@ static PyObject *decode(PyObject *Py_UNUSED(self), PyObject *args,
|
|||||||
arguments[i].src = src + (i * frames_per_thread * pm_size);
|
arguments[i].src = src + (i * frames_per_thread * pm_size);
|
||||||
arguments[i].dst = dst + (i * frames_per_thread * pm_size);
|
arguments[i].dst = dst + (i * frames_per_thread * pm_size);
|
||||||
arguments[i].pm = pm;
|
arguments[i].pm = pm;
|
||||||
arguments[i].n_frames = frames_per_thread; // TODO! not matching frames.
|
arguments[i].n_frames =
|
||||||
|
frames_per_thread; // TODO! not matching frames.
|
||||||
arguments[i].n_pixels = n_rows * n_cols;
|
arguments[i].n_pixels = n_rows * n_cols;
|
||||||
assigned_frames += frames_per_thread;
|
assigned_frames += frames_per_thread;
|
||||||
}
|
}
|
||||||
@ -137,8 +137,6 @@ static PyObject *decode(PyObject *Py_UNUSED(self), PyObject *args,
|
|||||||
free(arguments);
|
free(arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Py_DECREF(raw_data);
|
Py_DECREF(raw_data);
|
||||||
Py_DECREF(pixel_map);
|
Py_DECREF(pixel_map);
|
||||||
|
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
#include "pm_decode.h"
|
#include "pm_decode.h"
|
||||||
#include "thread_utils.h"
|
#include "thread_utils.h"
|
||||||
|
|
||||||
void thread_pmdecode(void* args){
|
void thread_pmdecode(void *args) {
|
||||||
thread_args* a;
|
thread_args *a;
|
||||||
a = (thread_args *) args;
|
a = (thread_args *)args;
|
||||||
pm_decode(a->src, a->dst, a->pm, a->n_frames, a->n_pixels);
|
pm_decode(a->src, a->dst, a->pm, a->n_frames, a->n_pixels);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pm_decode(uint16_t* src, uint16_t* dst, uint32_t* pm, size_t n_frames, size_t n_pixels){
|
void pm_decode(uint16_t *src, uint16_t *dst, uint32_t *pm, size_t n_frames,
|
||||||
for(size_t i = 0; i<n_frames; i++){
|
size_t n_pixels) {
|
||||||
for(size_t j=0; j<n_pixels; j++){
|
for (size_t i = 0; i < n_frames; i++) {
|
||||||
|
for (size_t j = 0; j < n_pixels; j++) {
|
||||||
*dst++ = src[pm[j]];
|
*dst++ = src[pm[j]];
|
||||||
}
|
}
|
||||||
src += n_pixels;
|
src += n_pixels;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <stdint.h>
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
//Wrapper to be used with pthreads
|
#include <stdint.h>
|
||||||
void thread_pmdecode(void* args);
|
// Wrapper to be used with pthreads
|
||||||
|
void thread_pmdecode(void *args);
|
||||||
|
|
||||||
|
void pm_decode(uint16_t *src, uint16_t *dst, uint32_t *pm, size_t n_frames,
|
||||||
void pm_decode(uint16_t* src, uint16_t* dst, uint32_t* pm, size_t n_frames, size_t n_pixels);
|
size_t n_pixels);
|
@ -1,10 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <stdint.h>
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
typedef struct{
|
#include <stdint.h>
|
||||||
uint16_t* src;
|
typedef struct {
|
||||||
uint16_t* dst;
|
uint16_t *src;
|
||||||
uint32_t* pm;
|
uint16_t *dst;
|
||||||
|
uint32_t *pm;
|
||||||
size_t n_frames;
|
size_t n_frames;
|
||||||
size_t n_pixels;
|
size_t n_pixels;
|
||||||
}thread_args;
|
} thread_args;
|
@ -206,13 +206,11 @@ int createSymbolicLinksForDevices(int adcDeviceIndex, int dacDeviceIndex,
|
|||||||
// delete andcreate iio device links folder (deleting because cannot
|
// delete andcreate iio device links folder (deleting because cannot
|
||||||
// overwrite symbolic links with -sf)
|
// overwrite symbolic links with -sf)
|
||||||
if (deleteAbsoluteDirectory(mess, IIO_DEVICE_FOLDER,
|
if (deleteAbsoluteDirectory(mess, IIO_DEVICE_FOLDER,
|
||||||
"create sym links for device trees") ==
|
"create sym links for device trees") == FAIL) {
|
||||||
FAIL) {
|
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
if (createAbsoluteDirectory(mess, IIO_DEVICE_FOLDER,
|
if (createAbsoluteDirectory(mess, IIO_DEVICE_FOLDER,
|
||||||
"create sym links for device trees") ==
|
"create sym links for device trees") == FAIL) {
|
||||||
FAIL) {
|
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,8 +241,7 @@ int createSymbolicLinksForDevices(int adcDeviceIndex, int dacDeviceIndex,
|
|||||||
memset(retvals, 0, MAX_STR_LENGTH);
|
memset(retvals, 0, MAX_STR_LENGTH);
|
||||||
if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
|
if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) {
|
||||||
snprintf(mess, MAX_STR_LENGTH,
|
snprintf(mess, MAX_STR_LENGTH,
|
||||||
"Could not create sym link [dac%d] (%s)\n", idac,
|
"Could not create sym link [dac%d] (%s)\n", idac, retvals);
|
||||||
retvals);
|
|
||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
@ -8470,7 +8470,8 @@ int start_readout(int file_des) {
|
|||||||
#else
|
#else
|
||||||
if (Server_VerifyLock() == OK) {
|
if (Server_VerifyLock() == OK) {
|
||||||
enum runStatus s = getRunStatus();
|
enum runStatus s = getRunStatus();
|
||||||
if ((s == RUNNING || s == WAITING) && (myDetectorType != XILINX_CHIPTESTBOARD)) {
|
if ((s == RUNNING || s == WAITING) &&
|
||||||
|
(myDetectorType != XILINX_CHIPTESTBOARD)) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
strcpy(mess, "Could not start readout because the detector is "
|
strcpy(mess, "Could not start readout because the detector is "
|
||||||
"already running!\n");
|
"already running!\n");
|
||||||
|
@ -567,7 +567,8 @@ int powerChip(int on, char *mess) {
|
|||||||
LOG(logERROR, (mess));
|
LOG(logERROR, (mess));
|
||||||
|
|
||||||
// to be removed when fixed later
|
// to be removed when fixed later
|
||||||
LOG(logWARNING, ("Bypassing this error for now. To be fixed later...\n"));
|
LOG(logWARNING,
|
||||||
|
("Bypassing this error for now. To be fixed later...\n"));
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -1334,7 +1335,7 @@ int startStateMachine() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
LOG(logINFOBLUE, ("Starting State Machine\n"));
|
LOG(logINFOBLUE, ("Starting State Machine\n"));
|
||||||
//cleanFifos(); removing this for now as its done before readout pattern
|
// cleanFifos(); removing this for now as its done before readout pattern
|
||||||
|
|
||||||
// start state machine
|
// start state machine
|
||||||
bus_w(FLOW_CONTROL_REG, bus_r(FLOW_CONTROL_REG) | START_F_MSK);
|
bus_w(FLOW_CONTROL_REG, bus_r(FLOW_CONTROL_REG) | START_F_MSK);
|
||||||
|
@ -181,9 +181,9 @@ class slsDetectorDefs {
|
|||||||
int ymin{-1};
|
int ymin{-1};
|
||||||
int ymax{-1};
|
int ymax{-1};
|
||||||
ROI() = default;
|
ROI() = default;
|
||||||
ROI(int xmin, int xmax) : xmin(xmin), xmax(xmax) {};
|
ROI(int xmin, int xmax) : xmin(xmin), xmax(xmax){};
|
||||||
ROI(int xmin, int xmax, int ymin, int ymax)
|
ROI(int xmin, int xmax, int ymin, int ymax)
|
||||||
: xmin(xmin), xmax(xmax), ymin(ymin), ymax(ymax) {};
|
: xmin(xmin), xmax(xmax), ymin(ymin), ymax(ymax){};
|
||||||
constexpr std::array<int, 4> getIntArray() const {
|
constexpr std::array<int, 4> getIntArray() const {
|
||||||
return std::array<int, 4>({xmin, xmax, ymin, ymax});
|
return std::array<int, 4>({xmin, xmax, ymin, ymax});
|
||||||
}
|
}
|
||||||
@ -234,7 +234,7 @@ typedef struct {
|
|||||||
int x{0};
|
int x{0};
|
||||||
int y{0};
|
int y{0};
|
||||||
xy() = default;
|
xy() = default;
|
||||||
xy(int x, int y) : x(x), y(y) {};
|
xy(int x, int y) : x(x), y(y){};
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user