From 007330caa7f58079d0ad751d496440ff7832c1fe Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Thu, 26 Sep 2024 15:39:49 +0200 Subject: [PATCH] format --- pyctbgui/src/decoder.c | 12 +++++------- pyctbgui/src/pm_decode.c | 17 +++++++++-------- pyctbgui/src/pm_decode.h | 10 +++++----- pyctbgui/src/thread_utils.h | 12 ++++++------ .../slsDetectorServer/src/programViaArm.c | 9 +++------ .../src/slsDetectorServer_funcs.c | 3 ++- .../slsDetectorFunctionList.c | 5 +++-- slsSupportLib/include/sls/sls_detector_defs.h | 6 +++--- slsSupportLib/include/sls/versionAPI.h | 12 ++++++------ 9 files changed, 42 insertions(+), 44 deletions(-) diff --git a/pyctbgui/src/decoder.c b/pyctbgui/src/decoder.c index 67cb0c4a2..2cbb6909b 100644 --- a/pyctbgui/src/decoder.c +++ b/pyctbgui/src/decoder.c @@ -106,10 +106,9 @@ static PyObject *decode(PyObject *Py_UNUSED(self), PyObject *args, return NULL; } - - if (n_threads == 1){ + if (n_threads == 1) { pm_decode(src, dst, pm, n_frames, n_rows * n_cols); - }else{ + } else { // Multithreaded processing pthread_t *threads = malloc(sizeof(pthread_t *) * 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].dst = dst + (i * frames_per_thread * pm_size); 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; assigned_frames += frames_per_thread; } @@ -128,7 +128,7 @@ static PyObject *decode(PyObject *Py_UNUSED(self), PyObject *args, for (size_t i = 0; i < n_threads; i++) { pthread_create(&threads[i], NULL, (void *)thread_pmdecode, - &arguments[i]); + &arguments[i]); } for (size_t i = 0; i < n_threads; i++) { pthread_join(threads[i], NULL); @@ -136,8 +136,6 @@ static PyObject *decode(PyObject *Py_UNUSED(self), PyObject *args, free(threads); free(arguments); } - - Py_DECREF(raw_data); Py_DECREF(pixel_map); diff --git a/pyctbgui/src/pm_decode.c b/pyctbgui/src/pm_decode.c index 99cbcfc01..fc702b22b 100644 --- a/pyctbgui/src/pm_decode.c +++ b/pyctbgui/src/pm_decode.c @@ -1,17 +1,18 @@ #include "pm_decode.h" #include "thread_utils.h" -void thread_pmdecode(void* args){ - thread_args* a; - a = (thread_args *) args; +void thread_pmdecode(void *args) { + thread_args *a; + a = (thread_args *)args; 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){ - for(size_t i = 0; i #include -//Wrapper to be used with pthreads -void thread_pmdecode(void* args); +#include +// 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, size_t n_pixels); \ No newline at end of file +void pm_decode(uint16_t *src, uint16_t *dst, uint32_t *pm, size_t n_frames, + size_t n_pixels); \ No newline at end of file diff --git a/pyctbgui/src/thread_utils.h b/pyctbgui/src/thread_utils.h index bd8f283ef..6cc3c2381 100644 --- a/pyctbgui/src/thread_utils.h +++ b/pyctbgui/src/thread_utils.h @@ -1,10 +1,10 @@ #pragma once -#include #include -typedef struct{ - uint16_t* src; - uint16_t* dst; - uint32_t* pm; +#include +typedef struct { + uint16_t *src; + uint16_t *dst; + uint32_t *pm; size_t n_frames; size_t n_pixels; -}thread_args; \ No newline at end of file +} thread_args; \ No newline at end of file diff --git a/slsDetectorServers/slsDetectorServer/src/programViaArm.c b/slsDetectorServers/slsDetectorServer/src/programViaArm.c index a31317815..64a7eafb2 100644 --- a/slsDetectorServers/slsDetectorServer/src/programViaArm.c +++ b/slsDetectorServers/slsDetectorServer/src/programViaArm.c @@ -206,13 +206,11 @@ int createSymbolicLinksForDevices(int adcDeviceIndex, int dacDeviceIndex, // delete andcreate iio device links folder (deleting because cannot // overwrite symbolic links with -sf) if (deleteAbsoluteDirectory(mess, IIO_DEVICE_FOLDER, - "create sym links for device trees") == - FAIL) { + "create sym links for device trees") == FAIL) { return FAIL; } if (createAbsoluteDirectory(mess, IIO_DEVICE_FOLDER, - "create sym links for device trees") == - FAIL) { + "create sym links for device trees") == FAIL) { return FAIL; } @@ -243,8 +241,7 @@ int createSymbolicLinksForDevices(int adcDeviceIndex, int dacDeviceIndex, memset(retvals, 0, MAX_STR_LENGTH); if (executeCommand(cmd, retvals, logDEBUG1) == FAIL) { snprintf(mess, MAX_STR_LENGTH, - "Could not create sym link [dac%d] (%s)\n", idac, - retvals); + "Could not create sym link [dac%d] (%s)\n", idac, retvals); LOG(logERROR, (mess)); return FAIL; } diff --git a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c index acaa051c0..a14f1c1b8 100644 --- a/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/src/slsDetectorServer_funcs.c @@ -8470,7 +8470,8 @@ int start_readout(int file_des) { #else if (Server_VerifyLock() == OK) { enum runStatus s = getRunStatus(); - if ((s == RUNNING || s == WAITING) && (myDetectorType != XILINX_CHIPTESTBOARD)) { + if ((s == RUNNING || s == WAITING) && + (myDetectorType != XILINX_CHIPTESTBOARD)) { ret = FAIL; strcpy(mess, "Could not start readout because the detector is " "already running!\n"); diff --git a/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c index 7bdc3cdc7..142063da0 100644 --- a/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/xilinx_ctbDetectorServer/slsDetectorFunctionList.c @@ -567,7 +567,8 @@ int powerChip(int on, char *mess) { LOG(logERROR, (mess)); // 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 FAIL; @@ -1334,7 +1335,7 @@ int startStateMachine() { #endif 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 bus_w(FLOW_CONTROL_REG, bus_r(FLOW_CONTROL_REG) | START_F_MSK); diff --git a/slsSupportLib/include/sls/sls_detector_defs.h b/slsSupportLib/include/sls/sls_detector_defs.h index 10848abe7..96b1f8a43 100644 --- a/slsSupportLib/include/sls/sls_detector_defs.h +++ b/slsSupportLib/include/sls/sls_detector_defs.h @@ -181,9 +181,9 @@ class slsDetectorDefs { int ymin{-1}; int ymax{-1}; 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) - : xmin(xmin), xmax(xmax), ymin(ymin), ymax(ymax) {}; + : xmin(xmin), xmax(xmax), ymin(ymin), ymax(ymax){}; constexpr std::array getIntArray() const { return std::array({xmin, xmax, ymin, ymax}); } @@ -234,7 +234,7 @@ typedef struct { int x{0}; int y{0}; xy() = default; - xy(int x, int y) : x(x), y(y) {}; + xy(int x, int y) : x(x), y(y){}; } __attribute__((packed)); #endif diff --git a/slsSupportLib/include/sls/versionAPI.h b/slsSupportLib/include/sls/versionAPI.h index 01a31600b..44d444be4 100644 --- a/slsSupportLib/include/sls/versionAPI.h +++ b/slsSupportLib/include/sls/versionAPI.h @@ -4,11 +4,11 @@ #define RELEASE "developer" #define APILIB "developer 0x230224" #define APIRECEIVER "developer 0x230224" -#define APICTB "developer 0x240910" -#define APIGOTTHARD "developer 0x240910" +#define APICTB "developer 0x240910" +#define APIGOTTHARD "developer 0x240910" #define APIGOTTHARD2 "developer 0x240910" -#define APIJUNGFRAU "developer 0x240910" -#define APIMYTHEN3 "developer 0x240910" -#define APIMOENCH "developer 0x240910" +#define APIJUNGFRAU "developer 0x240910" +#define APIMYTHEN3 "developer 0x240910" +#define APIMOENCH "developer 0x240910" #define APIXILINXCTB "developer 0x240910" -#define APIEIGER "developer 0x240910" +#define APIEIGER "developer 0x240910"