mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-05 04:10:03 +02:00
WIP
This commit is contained in:
parent
ab72d342c9
commit
5a7eeb3d76
@ -64,66 +64,12 @@ int Feb_Control_hv_fd = -1;
|
|||||||
void Module_Module(struct Module *mod, unsigned int number,
|
void Module_Module(struct Module *mod, unsigned int number,
|
||||||
unsigned int address_top) {
|
unsigned int address_top) {
|
||||||
mod->module_number = number;
|
mod->module_number = number;
|
||||||
mod->top_address_valid = 1;
|
mod->left_address = 0x100 | (0xff & address_top);
|
||||||
mod->top_left_address = 0x100 | (0xff & address_top);
|
mod->right_address = (0x200 | (0xff & address_top));
|
||||||
mod->top_right_address = (0x200 | (0xff & address_top));
|
|
||||||
mod->bottom_address_valid = 0;
|
|
||||||
mod->bottom_left_address = 0;
|
|
||||||
mod->bottom_right_address = 0;
|
|
||||||
|
|
||||||
mod->high_voltage = -1;
|
mod->high_voltage = -1;
|
||||||
mod->top_dac = malloc(Module_ndacs * sizeof(int));
|
mod->dac = malloc(Module_ndacs * sizeof(int));
|
||||||
mod->bottom_dac = malloc(Module_ndacs * sizeof(int));
|
|
||||||
for (unsigned int i = 0; i < Module_ndacs; i++)
|
for (unsigned int i = 0; i < Module_ndacs; i++)
|
||||||
mod->top_dac[i] = mod->top_address_valid ? -1 : 0;
|
mod->dac[i] = 0;
|
||||||
for (unsigned int i = 0; i < Module_ndacs; i++)
|
|
||||||
mod->bottom_dac[i] = mod->bottom_address_valid ? -1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module_ModuleBottom(struct Module *mod, unsigned int number,
|
|
||||||
unsigned int address_bottom) {
|
|
||||||
mod->module_number = number;
|
|
||||||
mod->top_address_valid = 0;
|
|
||||||
mod->top_left_address = 0;
|
|
||||||
mod->top_right_address = 0;
|
|
||||||
mod->bottom_address_valid = 1;
|
|
||||||
mod->bottom_left_address = 0x100 | (0xff & address_bottom);
|
|
||||||
mod->bottom_right_address = (0x200 | (0xff & address_bottom));
|
|
||||||
|
|
||||||
mod->high_voltage = -1;
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < 4; i++)
|
|
||||||
mod->idelay_top[i] = mod->idelay_bottom[i] = 0;
|
|
||||||
|
|
||||||
mod->top_dac = malloc(Module_ndacs * sizeof(int));
|
|
||||||
mod->bottom_dac = malloc(Module_ndacs * sizeof(int));
|
|
||||||
for (unsigned int i = 0; i < Module_ndacs; i++)
|
|
||||||
mod->top_dac[i] = mod->top_address_valid ? -1 : 0;
|
|
||||||
for (unsigned int i = 0; i < Module_ndacs; i++)
|
|
||||||
mod->bottom_dac[i] = mod->bottom_address_valid ? -1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Module_Module1(struct Module *mod, unsigned int number,
|
|
||||||
unsigned int address_top, unsigned int address_bottom) {
|
|
||||||
mod->module_number = number;
|
|
||||||
mod->top_address_valid = 1;
|
|
||||||
mod->top_left_address = 0x100 | (0xff & address_top);
|
|
||||||
mod->top_right_address = 0x200 | (0xff & address_top);
|
|
||||||
mod->bottom_address_valid = 1;
|
|
||||||
mod->bottom_left_address = 0x100 | (0xff & address_bottom);
|
|
||||||
mod->bottom_right_address = 0x200 | (0xff & address_bottom);
|
|
||||||
|
|
||||||
mod->high_voltage = -1;
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i < 4; i++)
|
|
||||||
mod->idelay_top[i] = mod->idelay_bottom[i] = 0;
|
|
||||||
|
|
||||||
mod->top_dac = malloc(Module_ndacs * sizeof(int));
|
|
||||||
mod->bottom_dac = malloc(Module_ndacs * sizeof(int));
|
|
||||||
for (unsigned int i = 0; i < Module_ndacs; i++)
|
|
||||||
mod->top_dac[i] = mod->top_address_valid ? -1 : 0;
|
|
||||||
for (unsigned int i = 0; i < Module_ndacs; i++)
|
|
||||||
mod->bottom_dac[i] = mod->bottom_address_valid ? -1 : 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int Module_GetModuleNumber(struct Module *mod) {
|
unsigned int Module_GetModuleNumber(struct Module *mod) {
|
||||||
@ -222,7 +168,7 @@ int Feb_Control_Init(int master, int top, int normal, int module_num) {
|
|||||||
Feb_control_normal = normal;
|
Feb_control_normal = normal;
|
||||||
|
|
||||||
// global send
|
// global send
|
||||||
Feb_Control_AddModule1(0, 1, 0xff, 0, 1);
|
Feb_Control_AddModule(0, 0xff);
|
||||||
Feb_Control_PrintModuleList();
|
Feb_Control_PrintModuleList();
|
||||||
Feb_Control_module_number = (module_num & 0xFF);
|
Feb_Control_module_number = (module_num & 0xFF);
|
||||||
|
|
||||||
@ -232,7 +178,7 @@ int Feb_Control_Init(int master, int top, int normal, int module_num) {
|
|||||||
Feb_Control_current_index = 1;
|
Feb_Control_current_index = 1;
|
||||||
|
|
||||||
// Add the half module
|
// Add the half module
|
||||||
Feb_Control_AddModule1(Feb_Control_module_number, top, serial, serial, 1);
|
Feb_Control_AddModule(Feb_Control_module_number, serial);
|
||||||
Feb_Control_PrintModuleList();
|
Feb_Control_PrintModuleList();
|
||||||
|
|
||||||
unsigned int nfebs = 0;
|
unsigned int nfebs = 0;
|
||||||
@ -389,13 +335,8 @@ int Feb_Control_CheckModuleAddresses(struct Module *m) {
|
|||||||
|
|
||||||
int Feb_Control_AddModule(unsigned int module_number,
|
int Feb_Control_AddModule(unsigned int module_number,
|
||||||
unsigned int top_address) {
|
unsigned int top_address) {
|
||||||
return Feb_Control_AddModule1(module_number, 1, top_address, 0, 1);
|
|
||||||
}
|
|
||||||
int Feb_Control_AddModule1(unsigned int module_number, int top_enable,
|
|
||||||
unsigned int top_address,
|
|
||||||
unsigned int bottom_address,
|
|
||||||
int half_module) { // bot_address 0 for half module
|
|
||||||
int parameters_ok = 1;
|
int parameters_ok = 1;
|
||||||
|
<<<<<<< Updated upstream
|
||||||
unsigned int pre_module_index = 0;
|
unsigned int pre_module_index = 0;
|
||||||
if (Feb_Control_GetModuleIndex(module_number, &pre_module_index)) {
|
if (Feb_Control_GetModuleIndex(module_number, &pre_module_index)) {
|
||||||
LOG(logINFO, ("\tRemoving previous assignment of module number %d.\n",
|
LOG(logINFO, ("\tRemoving previous assignment of module number %d.\n",
|
||||||
@ -407,19 +348,11 @@ int Feb_Control_AddModule1(unsigned int module_number, int top_enable,
|
|||||||
parameters_ok = 0;
|
parameters_ok = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
=======
|
||||||
|
>>>>>>> Stashed changes
|
||||||
struct Module mod, *m;
|
struct Module mod, *m;
|
||||||
m = &mod;
|
m = &mod;
|
||||||
|
Module_Module(m, module_number, top_address);
|
||||||
/* if ((half_module)&& (top_address != 1))
|
|
||||||
Module_Module(m,module_number,top_address); else if (half_module)
|
|
||||||
Module_ModuleBottom(m,module_number,top_address);*/
|
|
||||||
if ((half_module) && (top_enable))
|
|
||||||
Module_Module(m, module_number, top_address);
|
|
||||||
else if (half_module)
|
|
||||||
Module_ModuleBottom(m, module_number, bottom_address);
|
|
||||||
else
|
|
||||||
Module_Module1(m, module_number, top_address, bottom_address);
|
|
||||||
|
|
||||||
parameters_ok &= Feb_Control_CheckModuleAddresses(m);
|
parameters_ok &= Feb_Control_CheckModuleAddresses(m);
|
||||||
|
|
||||||
if (Module_TopAddressIsValid(m) && Module_BottomAddressIsValid(m)) {
|
if (Module_TopAddressIsValid(m) && Module_BottomAddressIsValid(m)) {
|
||||||
|
@ -5,26 +5,15 @@
|
|||||||
|
|
||||||
struct Module {
|
struct Module {
|
||||||
unsigned int module_number;
|
unsigned int module_number;
|
||||||
int top_address_valid;
|
unsigned int left_address;
|
||||||
unsigned int top_left_address;
|
unsigned int right_address;
|
||||||
unsigned int top_right_address;
|
unsigned int idelay_top[4]; // ll,lr,rl,ll
|
||||||
int bottom_address_valid;
|
|
||||||
unsigned int bottom_left_address;
|
|
||||||
unsigned int bottom_right_address;
|
|
||||||
|
|
||||||
unsigned int idelay_top[4]; // ll,lr,rl,ll
|
|
||||||
unsigned int idelay_bottom[4]; // ll,lr,rl,ll
|
|
||||||
float high_voltage;
|
float high_voltage;
|
||||||
int *top_dac;
|
int *dac;
|
||||||
int *bottom_dac;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void Module_Module(struct Module *mod, unsigned int number,
|
void Module_Module(struct Module *mod, unsigned int number,
|
||||||
unsigned int address_top);
|
unsigned int address_top);
|
||||||
void Module_ModuleBottom(struct Module *mod, unsigned int number,
|
|
||||||
unsigned int address_bottom);
|
|
||||||
void Module_Module1(struct Module *mod, unsigned int number,
|
|
||||||
unsigned int address_top, unsigned int address_bottom);
|
|
||||||
unsigned int Module_GetModuleNumber(struct Module *mod);
|
unsigned int Module_GetModuleNumber(struct Module *mod);
|
||||||
int Module_TopAddressIsValid(struct Module *mod);
|
int Module_TopAddressIsValid(struct Module *mod);
|
||||||
unsigned int Module_GetTopBaseAddress(struct Module *mod);
|
unsigned int Module_GetTopBaseAddress(struct Module *mod);
|
||||||
@ -59,9 +48,6 @@ int Feb_Control_GetModuleIndex(unsigned int module_number,
|
|||||||
unsigned int *module_index);
|
unsigned int *module_index);
|
||||||
int Feb_Control_CheckModuleAddresses(struct Module *m);
|
int Feb_Control_CheckModuleAddresses(struct Module *m);
|
||||||
int Feb_Control_AddModule(unsigned int module_number, unsigned int top_address);
|
int Feb_Control_AddModule(unsigned int module_number, unsigned int top_address);
|
||||||
int Feb_Control_AddModule1(unsigned int module_number, int top_enable,
|
|
||||||
unsigned int top_address,
|
|
||||||
unsigned int bottom_address, int half_module);
|
|
||||||
int Feb_Control_GetDACNumber(char *s, unsigned int *n);
|
int Feb_Control_GetDACNumber(char *s, unsigned int *n);
|
||||||
int Feb_Control_SendDACValue(unsigned int dst_num, unsigned int ch,
|
int Feb_Control_SendDACValue(unsigned int dst_num, unsigned int ch,
|
||||||
unsigned int *value);
|
unsigned int *value);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user