Commit 65fbc0b1 authored by ladi's avatar ladi

Last ladi updates

parent 60750f5d
......@@ -78,6 +78,9 @@ LadiController::LadiController(const string& name) :
safetyState.init(this, NOSAVE | SPY, "safetyState");
rhLowLimit.init(this, NOSAVE, "rhLowLimit");
rhHighLimit.init(this, NOSAVE, "rhHighLimit");
m_GateOn = false;
m_ShutterState = 0x2;
......@@ -142,7 +145,7 @@ void LadiController::postConfiguration() {
void LadiController::refreshReadingPixelSize(int32 value) throw (CannotSetValue) {
if (value == 50) {
m_LadiDriver->nbEncoderStepsBetweenADCSamples = 3;
maxNbAcquisitionLines.update(600);
maxNbAcquisitionLines.update(3600);
}
else if (value == 100) {
m_LadiDriver->nbEncoderStepsBetweenADCSamples = 18;
......@@ -460,6 +463,20 @@ void LadiController::updateLadiDriverStatus() {
// Abort
safetyState.update(0);
}
/// For debugging limits pb
if (status & ladicontrol::RH_LOW_LIMIT_SWITCH_ON_STATUS) {
rhLowLimit.update(500);
}
else {
rhLowLimit.update(0);
}
if (status & ladicontrol::RH_HIGH_LIMIT_SWITCH_ON_STATUS) {
rhHighLimit.update(500);
}
else {
rhHighLimit.update(0);
}
//////
if (isStarted() == true) {
cout << "updateLadiDriverStatus : status 0x" << hex << status << dec << endl;
if (status & ladicontrol::DRUM_MOVED_ABORT_ACQ_STATUS) {
......@@ -468,10 +485,11 @@ void LadiController::updateLadiDriverStatus() {
stopParallel(true);
}
// Nicolas prefere ne pas arreter
// if (!(status & ladicontrol::SAFETY_RACK_OK_STATUS)) {
// // Abort
if (!(status & ladicontrol::SAFETY_RACK_OK_STATUS)) {
// Abort
log(Level::s_Error) << "Acquisition stopped due to Safety Rack Error" << endlog;
// stopParallel(true);
// }
}
if (status & ladicontrol::RUNNING_ERASE_DRUM_STATUS) {
ladiMessage.update("Erasing");
}
......
......@@ -90,6 +90,9 @@ public:
Property<int32> minNbAcquisitionLines;
Property<int32> safetyState;
Property<int32> rhLowLimit; // Temporary, for debugging pb RH limits
Property<int32> rhHighLimit; // Temporary, for debugging pb RH limits
/*!
* \brief Method called before changing the property value
* This method is called after setting configuration during the creation of controller.
......
......@@ -2,7 +2,7 @@
<controller type="ladi_controller" role="ladi_controller1"/>
<controller type="data_plot" role="data_plot1"/>
<number_of_lines nb_lines="3"/>
<number_of_lines nb_lines="4"/>
<property_switcher role="ladi_controller1" property="use_subtitle" switcher_key="use_subtitleSwitcher"/>
......@@ -30,5 +30,10 @@
<text role="ladi_controller1" property="readingInitialPoint" prefix="ladi_controller.readingInitialPointPrefix" suffix="ladi_controller.mmeter"/>
<combo role="ladi_controller1" property="readingYPixelSize" prefix="ladi_controller.readingYPixelSizePrefix" valuesAndLabels="ladi_controller.125um,ladi_controller.250um,ladi_controller.500um,ladi_controller.full"/>
<text role="ladi_controller1" property="nbAcquisitionLines" prefix="ladi_controller.nbAcquisitionLinesPrefix"/>
<newLine/>
<check role="ladi_controller1" property="enableAverage" prefix="ladi_controller.enableAveragePrefix" checkBoxValues="ladi_controller.enableAverage"/>
<text role="ladi_controller1" property="detector_high_voltage" prefix="ladi_controller.detector_high_voltagePrefix" suffix="ladi_controller.volt"/>
</plugin>
......@@ -34,14 +34,14 @@
<label role="ladi_controller1" property="adcTemperature" prefix="ladi_controller.adcTemperaturePrefix" suffix="ladi_controller.degreeC" font_size="10"/>
<switchable_composite switcher_key="ladi_messageSwitcher" switch_values="Counting">
<switchable_composite switcher_key="acquisitionStatusSwitcher" switch_values="0,1,2,4,16,32" >
<label role="ladi_controller1" property="status_message" font_size="10"/>
<label role="ladi_controller1" property="status_message" font_size="10" font_style="CHANGING"/>
</switchable_composite>
</switchable_composite>
<switchable_composite switcher_key="ladi_messageSwitcher" switch_values="Erasing">
<label role="ladi_controller1" property="eraseProgression" prefix="ladi_controller.eraseProgressionPrefix" suffix="ladi_controller.progressionSuffix" spaceBefore="false" font_size="10"/>
<label role="ladi_controller1" property="eraseProgression" prefix="ladi_controller.eraseProgressionPrefix" suffix="ladi_controller.progressionSuffix" spaceBefore="false" font_size="10" font_style="CHANGING"/>
</switchable_composite>
<switchable_composite switcher_key="ladi_messageSwitcher" switch_values="Reading Data">
<label role="ladi_controller1" property="readingDataProgression" prefix="ladi_controller.readingDataProgressionPrefix" suffix="ladi_controller.progressionSuffix" spaceBefore="false" font_size="10"/>
<label role="ladi_controller1" property="readingDataProgression" prefix="ladi_controller.readingDataProgressionPrefix" suffix="ladi_controller.progressionSuffix" spaceBefore="false" font_size="10" font_style="CHANGING"/>
</switchable_composite>
</composite>
<newLine />
......
......@@ -230,6 +230,29 @@ static const uint32 CYCLE_DONE_STATUS = 0x8000;
// Data A32 address
static const uint32 DATA_A32_ADDRESS = 0x90000000;
// -A32 base adress initialisaton : 0x1000000.
static const uint32 A24_ROTARY_SWITCHES_REGISTER = 0x400;
static const uint32 ENABLE_VME_SLAVE_REGISTER = 0x408;
static const uint32 A32_INIT_BA_REGISTER = 0x560;
static const uint32 ENABLE_A32_BA_REGISTER = 0x5F8;
static const uint32 MMU_PAGE_ZERO_REGISTER = 0x410;
static const uint32 DESCRIPTOR_FOR_SUSER_REGISTER = 0x414;
static const uint32 ENABLE_VME_SLAVE = 0x80000015; // for 512MB DDR mapping
static const uint32 A32_INIT_BA = 0x01;
static const uint32 ENABLE_A32_BA = 0x10;
static const uint32 MMU_PAGE_ZERO = 0x0;
static const uint32 DESCRIPTOR_FOR_SUSER = 0x4803; // FPGA internal RAM
static const uint32 DESCRIPTOR_FOR_SUSER_2 = 0x2C03; // DDR
// -Direction for the P2 lines.
static const uint32 ENABLE_PLL_CLOCK_REGISTER = 0x1090;
static const uint32 ENABLE_SERDES_VMEP2_REGISTER = 0x1090;
// Values.
static const uint32 ENABLE_PLL_CLOCK = 0x1;
static const uint32 ENABLE_SERDES_VMEP2 = 0xC3;
}
#endif //LADICONTROLDEF_H
......@@ -53,6 +53,56 @@ RealLadiControlDriver::~RealLadiControlDriver() {
* init
*/
void RealLadiControlDriver::init() {
// Add stop
// int32 valuest = 1;
// owner()->write(STOP_ACQUISITION_REG, Vme::LONGWORD_WIDTH, 1, (void*) &valuest);
//
// //Reset all parameters --> to be done
// // init A32 base adress of the ioxos board.
// uint32 aData;
//
// // enable VME Slave
// aData = ENABLE_VME_SLAVE;
// owner()->write(ENABLE_VME_SLAVE_REGISTER, Vme::LONGWORD_WIDTH, 1, (void*) &aData);
//
// // Init A32 VME BA
// aData = owner()->address() >> 16;
// owner()->write(A32_INIT_BA_REGISTER, Vme::LONGWORD_WIDTH, 1, (void*) &aData);
//
// // Enable A32 VME BA
// aData = ENABLE_A32_BA;
// owner()->write(ENABLE_A32_BA_REGISTER, Vme::LONGWORD_WIDTH, 1, (void*) &aData);
//
// // (16MB of DDR not used to limit the VME address space)
// for (int32 page = 0; page < 512; ++page) {
// // MMU Pointer cf Thierry
// aData = page * 8;
// owner()->write(MMU_PAGE_ZERO_REGISTER, Vme::LONGWORD_WIDTH, 1, (void*) &aData);
// cout << "REG 0x410 -- Value: " << hex << aData << endl;
// // Descriptor for SUSER cf Thierry
// aData = DESCRIPTOR_FOR_SUSER_2;
// owner()->write(DESCRIPTOR_FOR_SUSER_REGISTER, Vme::LONGWORD_WIDTH, 1, (void*) &aData);
// // same address, data = 3
// aData = 3 + 0x10 * page;
// owner()->write(DESCRIPTOR_FOR_SUSER_REGISTER, Vme::LONGWORD_WIDTH, 1, (void*) &aData);
// cout << "REG 0x414 -- Value: " << hex << aData << endl;
// // same address, data = 0 (first write)
// aData = 0;
// owner()->write(DESCRIPTOR_FOR_SUSER_REGISTER, Vme::LONGWORD_WIDTH, 1, (void*) &aData);
// // same address, data = 0 (second write)
// aData = 0;
// owner()->write(DESCRIPTOR_FOR_SUSER_REGISTER, Vme::LONGWORD_WIDTH, 1, (void*) &aData);
// }
//
// // Enabling the VMEP2 SerDes
// // Enable PLL Clock Generation.
// aData = ENABLE_PLL_CLOCK;
// owner()->write(ENABLE_PLL_CLOCK_REGISTER, Vme::LONGWORD_WIDTH, 1, (void*) &aData);
//
// // Enable SerDes.
// aData = ENABLE_SERDES_VMEP2;
// owner()->write(ENABLE_SERDES_VMEP2_REGISTER, Vme::LONGWORD_WIDTH, 1, (void*) &aData);
readInfos();
write();
writeParam();
......@@ -63,7 +113,7 @@ void RealLadiControlDriver::init() {
* clear
*/
void RealLadiControlDriver::clear() {
// owner()->write(RESET_REGISTER, Vme::WORD_WIDTH, 1, (void*) &WRITE_BUF);
owner()->write(RESET_REG, Vme::LONGWORD_WIDTH, 1, (void*) &WRITE_BUF);
}
/*
......@@ -152,9 +202,9 @@ void RealLadiControlDriver::writeParam() {
*/
void RealLadiControlDriver::write() {
int32 lvalue = (int32) (29963 - owner()->drumAcquisitionSpeed() * 43.8) & 0xFFFF; // Conversion RPM to decimal
if (owner()->readingYPixelSize() == 400) {
lvalue = (int32) (29963 - 500. * 43.8) & 0xFFFF; // Conversion RPM to decimal
}
//if (owner()->readingYPixelSize() == 400) {
// lvalue = (int32) (29963 - 500. * 43.8) & 0xFFFF; // Conversion RPM to decimal HACK Emilio 02/07/2019 change reading head spee
//}
owner()->write(DRUM_ACQ_SPEED_REG, Vme::LONGWORD_WIDTH, 1, (void*) &lvalue);
lvalue = (int32) (owner()->readingInitialPoint() * 800.);
......@@ -244,7 +294,7 @@ void RealLadiControlDriver::synchroniseRead() {
img.permute_axes("yx");
cout << "permute img = " << c1.getTimeAndClear() << endl;
img.shift(0, decalage, 0 , 0, 3);
cout << "shift img = " << c1.getTimeAndClear() << endl;
// cout << "shift img = " << c1.getTimeAndClear() << endl;
memcpy(ldata, img.data(), size * sizeof(uint16));
cout << "memcpy img = " << c1.getTimeAndClear() << endl;
// If data changed send event
......@@ -252,7 +302,8 @@ void RealLadiControlDriver::synchroniseRead() {
uint16 val;
for(int32 i = 0;i < size;++i) {
val = Calculations::swapD16ByD8(ldata[i]);
data[i] = ((val & 0x8000) == 0 ? val + 32768 : val & 0x7FFF);
//data[i] = ((val & 0x8000) == 0 ? val + 32768 : val & 0x7FFF); // HACK Emilio
data[i] = val; // HACK Emilio 28/06/2019 Average problems
sum += data[i];
}
owner()->sum = sum;
......@@ -396,6 +447,7 @@ void RealLadiControlDriver::readStatus() {
if (owner()->startActivated() == true) {
if ((status & ACQUISITION_DONE_STATUS) || !(status & SAFETY_RACK_OK_STATUS)) {
cout << "NORMAL FINISHED : 0x" << hex << status << dec << endl;
owner()->startActivated = false;
owner()->m_StopActivated = false;
owner()->commandProgression = PROGRESSION_END_DEVICE_CONTAINER;
......@@ -407,11 +459,13 @@ void RealLadiControlDriver::readStatus() {
} else {
if (owner()->m_SynchroniseReadActivated == true) {
if (owner()->m_SynchroniseReadTerminated == true) {
cout << "SYNCHRONISED FINISHED : 0x" << hex << status << dec << endl;
owner()->m_SynchroniseReadActivated = false;
owner()->m_SynchroniseReadTerminated = false;
owner()->commandProgression = PROGRESSION_END_DEVICE_CONTAINER;
}
} else {
cout << "NOTHING FINISHED : 0x" << hex << status << dec << endl;
owner()->commandProgression = PROGRESSION_END_DEVICE_CONTAINER;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment