Commit 3690c0d7 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

finalized board detection, SENSPGM state checking moved to common part

parent 51ae2bd5
......@@ -464,7 +464,7 @@ int lepton_pgm_detectsensor (int sensor_port, ///< sensor port n
// int i2c_data,i2c_rslt;
struct sensor_t * psensor; // current sensor
// x393_sensio_ctl_t sensio_ctl = {.d32=0};
x393_status_sens_io_t status; // check board exists
//x393_status_sens_io_t status; // check board exists
// unsigned short * sensor_multi_regs;
// temporary
......@@ -537,14 +537,17 @@ int lepton_pgm_detectsensor (int sensor_port, ///< sensor port n
return 0; // no sensor found
}
#else
//assume Lepton sesnors if there is some sesnor board attached
// this check is moved to pgm_functions.c, see check_senspgmin_state()
/*
//assume Lepton sensors if there is some sensor board attached
status = x393_sensio_status(sensor_port);
if (!status.senspgmin){
dev_info(g_dev_ptr,"Some sensor board is attached to port %d, assumimg Lepton 3.5 as FPGA is programmed for it\n",sensor_port);
dev_info(g_dev_ptr,"Some sensor board is attached to port %d, assuming Lepton 3.5 as FPGA is programmed for it\n",sensor_port);
} else {
dev_info(g_dev_ptr,"No sesnor board is attached to port %d\n",sensor_port);
dev_info(g_dev_ptr,"No sensor board is attached to port %d\n",sensor_port);
return 0; // no sensor found
}
*/
#endif
// Sensor recognized, go on
......
......@@ -356,6 +356,37 @@ int add_sensor_proc(int port, ///< sensor port
return 0;
}
/** Check SENSPGM pin state to determine board type connected to
* the sensor_port.
* '1' (pulled up) - nothing or mux board
* '0' (grounded) - some kind of sensor board
* @param sensor_port
* @return pin state
*/
inline int check_senspgmin_state(int sensor_port){
// Need to check a certain pin state, which is
// senspgmin (bit 24 of x393_status_sens_io_t)
// senspgmin = 0 - some sensor board is attached to port
// senspgmin = 1 - mux board or nothing
x393_status_ctrl_t status_ctrl = {.d32 = 0};
x393_status_sens_io_t status;
int i;
// check senspgmin (bit 24 of x393_status_sens_io_t)
status = x393_sensio_status(sensor_port);
status_ctrl.seq_num = status.seq_num + 1;
status_ctrl.mode = 1;
set_x393_sensio_status_cntrl(status_ctrl, sensor_port);
for(i=0;i<10;i++){
status = x393_sensio_status(sensor_port);
if(status.seq_num==status_ctrl.seq_num){
break;
}
}
return status.senspgmin;
}
/** Detect and initialize sensor and related data structures
* - detect sensor type
* - set sensor structure (capabilities),
......@@ -373,15 +404,7 @@ int pgm_detectsensor (int sensor_port, ///< sensor port number (
x393_camsync_io_t camsync_src = {.d32=0x00000}; // all disabled (use internal)
x393_camsync_io_t camsync_dst = {.d32=0x00000}; // all disable - nothing to output
// Need to check a certain pin state, which is
// senspgmin (bit 24 of x393_status_sens_io_t)
// senspgmin = 0 - some sensor board is attached to port
// senspgmin = 1 - mux board or nothing
x393_status_ctrl_t status_ctrl = {.d32 = 0};
x393_status_sens_io_t status;
int i;
// Setting trigger input, output and preriod to off
// Setting trigger input, output and period to off
int was_sensor_freq = 0; // 90000000; // getClockFreq(1);
int qperiod;
......@@ -484,24 +507,12 @@ int pgm_detectsensor (int sensor_port, ///< sensor port number (
} else {
dev_dbg(g_dev_ptr,"Mux mode for port %d SENSOR_NONE, skipping 10359 detection\n",sensor_port);
MDP(DBGB_PADD, sensor_port,"Mux mode for port %d SENSOR_NONE, skipping 10359 detection\n",sensor_port)
}
// check senspgmin (bit 24 of x393_status_sens_io_t)
status = x393_sensio_status(sensor_port);
status_ctrl.seq_num = status.seq_num + 1;
status_ctrl.mode = 1;
set_x393_sensio_status_cntrl(status_ctrl, sensor_port);
for(i=0;i<10;i++){
status = x393_sensio_status(sensor_port);
if(status.seq_num==status_ctrl.seq_num){
break;
}
}
// '1' - means empty port (pull up) or mux board
if (status.senspgmin==1){
if (check_senspgmin_state()==1){
dev_info(g_dev_ptr,"No sensors connected to port %d \n",sensor_port);
return 0;
}
}
//if ((thispars->pars[P_SENSOR]==0) || // multisensor not detected
// ((thispars->pars[P_SENSOR] & SENSOR_MASK) == SENSOR_MT9X001)) { // or is (from DT) SENSOR_MT9X001
......
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