Commit 9f42f3da authored by Andrey Filippov's avatar Andrey Filippov

debugging with applications

parent 11bcb946
...@@ -33,3 +33,4 @@ obj-$(CONFIG_ELPHEL393) += imu_log393.o ...@@ -33,3 +33,4 @@ obj-$(CONFIG_ELPHEL393) += imu_log393.o
obj-$(CONFIG_ELPHEL393) += cxi2c.o obj-$(CONFIG_ELPHEL393) += cxi2c.o
obj-$(CONFIG_ELPHEL393) += x393_videomem.o obj-$(CONFIG_ELPHEL393) += x393_videomem.o
obj-$(CONFIG_ELPHEL393) += detect_sensors.o obj-$(CONFIG_ELPHEL393) += detect_sensors.o
obj-$(CONFIG_ELPHEL393) += x393_fpga_functions.o
\ No newline at end of file
This diff is collapsed.
...@@ -957,7 +957,7 @@ int image_acq_init(struct platform_device *pdev) ...@@ -957,7 +957,7 @@ int image_acq_init(struct platform_device *pdev)
#endif #endif
dev_dbg(dev, "Elphel FPGA interrupts initialized\n"); dev_info(dev, "Elphel FPGA interrupts initialized\n");
dev_dbg(dev, "reset all compressors\n"); dev_dbg(dev, "reset all compressors\n");
for (i = 0; i < SENSOR_PORTS; i++) { for (i = 0; i < SENSOR_PORTS; i++) {
reset_compressor(i); reset_compressor(i);
...@@ -969,7 +969,7 @@ int image_acq_init(struct platform_device *pdev) ...@@ -969,7 +969,7 @@ int image_acq_init(struct platform_device *pdev)
//init_pgm_proc (); // setup pointers to functions (not sensor-specific) //init_pgm_proc (); // setup pointers to functions (not sensor-specific)
//MDD1(printk("reset_qtables()\n")); //MDD1(printk("reset_qtables()\n"));
framepars_init(pdev); // framepars_init(pdev);
return 0; return 0;
} }
......
...@@ -14,11 +14,62 @@ ...@@ -14,11 +14,62 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/ *******************************************************************************/
#include <linux/spinlock.h>
#include <uapi/elphel/c313a.h> // PARS_FRAMES_MASK
#include "x393.h" #include "x393.h"
#include "x393_fpga_functions.h" #include "x393_fpga_functions.h"
#define REPEAT_STATUS_READ 10 ///< Number of times status is re-read waiting for a new timestamp
static DEFINE_SPINLOCK(fpga_time_lock);
// Nothing to init? Started in pgm_detectsesnor through sensor_common:sequencer_stop_run_reset
#if 0
int init_command_sequencer(int sensor_port) int init_command_sequencer(int sensor_port)
{ {
return 0; return 0;
} }
#endif
/** Read time (seconds and microseconds) from the FPGA RTC */
sec_usec_t * get_fpga_rtc(sec_usec_t * ts) ///< Pointer to a sec/usec structure to fill in
///< @return structure link to a passed structure
{
// sec_usec_t ts = {.sec=0, .usec=0};
x393_rtc_status_t stat;
x393_status_ctrl_t stat_ctrl={.d32=0};
// x393_rtc_usec_t usec;
// x393_rtc_sec_t sec;
int i;
if (!ts) return NULL;
spin_lock(&fpga_time_lock);
stat = x393_rtc_status();
stat_ctrl.mode = 1;
stat_ctrl.seq_num = stat.seq_num + 1;
set_x393_rtc_set_status(stat_ctrl); // Requests single status, latches current time
for (i = 0; i < REPEAT_STATUS_READ; i++) {
stat = x393_rtc_status();
if (stat.seq_num == stat_ctrl.seq_num) {
ts->sec = x393_rtc_status_sec().sec;
ts->usec = x393_rtc_status_usec().usec;
break;
}
}
spin_unlock(&fpga_time_lock);
return ts;
}
/** Set FPGA RTC to specified time */
void set_fpga_rtc (sec_usec_t ts) ///< timestamp providing seconds and microseconds
{
x393_rtc_usec_t usec;
x393_rtc_sec_t sec;
usec.usec = ts.usec;
sec.sec = ts.sec;
spin_lock(&fpga_time_lock);
set_x393_rtc_usec(usec);
set_x393_rtc_sec_set(sec); // And apply
spin_unlock(&fpga_time_lock);
}
...@@ -16,4 +16,7 @@ ...@@ -16,4 +16,7 @@
*******************************************************************************/ *******************************************************************************/
//typedef enum {DIRECT,ABSOLUTE,RELATIVE} x393cmd_t; //typedef enum {DIRECT,ABSOLUTE,RELATIVE} x393cmd_t;
#include "x393.h" #include "x393.h"
void fpga_table_write_nice (int addr, int len, unsigned long * data); //void fpga_table_write_nice (int addr, int len, unsigned long * data);
sec_usec_t * get_fpga_rtc(sec_usec_t * ts);
void set_fpga_rtc (sec_usec_t ts);
...@@ -208,7 +208,7 @@ ...@@ -208,7 +208,7 @@
*/ */
// parameter indexes will be updated to group-related ones into the same groups of 32 // parameter indexes will be updated to group-related ones into the same groups of 32
// NOTE: P_* and G_* should not end with numbers - numbers will be used in PHP constants to add to the constant value (ELPHEL_AAA3 will be treated as ELPHEL_AAA+3) // NOTE: P_* and G_* should not end with numbers - numbers will be used in PHP constants to add to the constant value (ELPHEL_AAA3 will be treated as ELPHEL_AAA+3)
//#define P_NUMBER 1024 //number of registers (was 64) - NOTE: obsolete? #define P_NUMBER 1024 //number of registers (was 64) - NOTE: obsolete?
#define P_SENSOR 1 /**< if set to 0 - will (re)detect sensor, if set to None - won't bother <ul> #define P_SENSOR 1 /**< if set to 0 - will (re)detect sensor, if set to None - won't bother <ul>
<li> 4 - ZR32112MLC - now there is no way to see color/mono <li> 4 - ZR32112MLC - now there is no way to see color/mono
<li> 5 - ZR32112PLC <li> 5 - ZR32112PLC
...@@ -1694,6 +1694,12 @@ struct sensorproc_t { ...@@ -1694,6 +1694,12 @@ struct sensorproc_t {
//#define EXPOSURE_UNIT 100 // to move to finer exposure settings - current unit in microseconds. TODO: Propagate it to drivers... //#define EXPOSURE_UNIT 100 // to move to finer exposure settings - current unit in microseconds. TODO: Propagate it to drivers...
#define EXPOSURE_UNIT 1 ///< to move to finer exposure settings - current unit in microseconds. TODO: Propagate it to drivers... #define EXPOSURE_UNIT 1 ///< to move to finer exposure settings - current unit in microseconds. TODO: Propagate it to drivers...
typedef struct{
unsigned long usec;
unsigned long sec;
} sec_usec_t;
/// width,height, quality are still needed even with new Exif - it is used to rebuild JPEG header /// width,height, quality are still needed even with new Exif - it is used to rebuild JPEG header
// most parameters are moved out, but width, height, quality are needed for JPEG header, so currently the following are used: // most parameters are moved out, but width, height, quality are needed for JPEG header, so currently the following are used:
......
...@@ -37,10 +37,10 @@ ...@@ -37,10 +37,10 @@
#define DEV393_EXIF_META2 ("exif_meta2", "exif_elphel", 125, 34, "0666", "c") ///< sensor port 2: write metadata, concurrently opened files. All writes are atomic #define DEV393_EXIF_META2 ("exif_meta2", "exif_elphel", 125, 34, "0666", "c") ///< sensor port 2: write metadata, concurrently opened files. All writes are atomic
#define DEV393_EXIF_META3 ("exif_meta3", "exif_elphel", 125, 35, "0666", "c") ///< sensor port 3: write metadata, concurrently opened files. All writes are atomic #define DEV393_EXIF_META3 ("exif_meta3", "exif_elphel", 125, 35, "0666", "c") ///< sensor port 3: write metadata, concurrently opened files. All writes are atomic
#define DEV393_FRAMEPARS0 ("frameparsall0","framepars_operations",125,80, "0666", "c") ///< Access frame parameters for channel 0 (schedule modification, read with mmap) #define DEV393_FRAMEPARS0 ("frameparsall0","framepars_operations",130,80, "0666", "c") ///< Access frame parameters for channel 0 (schedule modification, read with mmap)
#define DEV393_FRAMEPARS1 ("frameparsall1","framepars_operations",125,81, "0666", "c") ///< Access frame parameters for channel 1 (schedule modification, read with mmap) #define DEV393_FRAMEPARS1 ("frameparsall1","framepars_operations",130,81, "0666", "c") ///< Access frame parameters for channel 1 (schedule modification, read with mmap)
#define DEV393_FRAMEPARS2 ("frameparsall2","framepars_operations",125,82, "0666", "c") ///< Access frame parameters for channel 2 (schedule modification, read with mmap) #define DEV393_FRAMEPARS2 ("frameparsall2","framepars_operations",130,82, "0666", "c") ///< Access frame parameters for channel 2 (schedule modification, read with mmap)
#define DEV393_FRAMEPARS3 ("frameparsall3","framepars_operations",125,83, "0666", "c") ///< Access frame parameters for channel 3 (schedule modification, read with mmap) #define DEV393_FRAMEPARS3 ("frameparsall3","framepars_operations",130,83, "0666", "c") ///< Access frame parameters for channel 3 (schedule modification, read with mmap)
#define DEV393_JTAG_RESET ("fpgaresetjtag", "x393_jtag", 132, 0, "0666", "c") ///< Just close open files (same as jtagraw) #define DEV393_JTAG_RESET ("fpgaresetjtag", "x393_jtag", 132, 0, "0666", "c") ///< Just close open files (same as jtagraw)
#define DEV393_JTAG_RAW ("jtagraw", "x393_jtag", 132, 0, "0666", "c") ///< Just close open files (same as jtagraw) #define DEV393_JTAG_RAW ("jtagraw", "x393_jtag", 132, 0, "0666", "c") ///< Just close open files (same as jtagraw)
......
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