* @brief This module handles sensor discovery, initialization and programming tasks
* common for all sensors. Task that are implemented:
* - system initialization (?)
...
...
@@ -7,9 +8,7 @@
* - interrupts handling
* - tasklets
* - device driver that includes waiting for the next frame regardless of compression
*/
/* Copyright (C) 2016 Elphel, Inc.
* @copyright Copyright (C) 2016 Elphel, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
...
...
@@ -79,45 +78,27 @@
//#include "x393.h"
#include "x393_helpers.h"
/** @brief Driver name to display in log messages.*/
/** @brief Driver name to display in log messages.*/
#define IMAGEACQ_DRIVER_NAME "Elphel (R) Model 393 Image Acquisition device driver"
/** @brief The size in bytes of L2 cache invalidation area. This size must be aligned to cache line size.
* 16 kbytes seems to be good starting point. */
/** @brief The size in bytes of L2 cache invalidation area. This size must be aligned to cache line size. 16 kbytes seems to be good starting point.*/
#define L2_INVAL_SIZE (32 * 1024)
/**@struct jpeg_ptr_t
* @brief \e jpeg_ptr_t structure contains read and write pointers along with
* IRQ number for a single channel
* @var jpeg_ptr_t::jpeg_wr
* JPEG write pointer in 32 bit words
* @var jpeg_ptr_t::jpeg_rp
* JPEG read pointer in 32 bit words
* @var jpeg_ptr_t::fpga_cntr_prev
* This field contains previous value of the FPGA transfer counter which is used
* to find out if it has changed. This pointer is in 32 bit words.
* @var jpeg_ptr_t::irq_num_comp
* IRQ number associated with compressor
* @var jpeg_ptr_t::irq_num_sens
* IRQ number associated with sensor
* @var jpeg_ptr_t::chn_num
* Current channel number
*/
/** @brief Contains read and write pointers along with IRQ number for a single channel*/
structjpeg_ptr_t{
volatileintjpeg_wp;
volatileintjpeg_rp;
volatileintfpga_cntr_prev;
unsignedintirq_num_comp;
unsignedintirq_num_sens;
unsignedintchn_num;
volatileintjpeg_wp;///< JPEG write pointer in 32 bit words
volatileintjpeg_rp;///< JPEG read pointer in 32 bit words
volatileintfpga_cntr_prev;///< This field contains previous value of the FPGA transfer counter which is used to find out if it has changed. This pointer is in 32 bit words.
unsignedintirq_num_comp;///< IRQ number associated with compressor
unsignedintirq_num_sens;///< IRQ number associated with sensor
unsignedintchn_num;///< Current channel number
volatileunsignedintflags;
};
/**@struct image_acq_pd_t
* @brief \e image_acq_pd contains private data for the image acquisition driver
*/
/** @brief Contains private data for the image acquisition driver */
structimage_acq_pd_t{
intminor;
structjpeg_ptr_tjpeg_ptr[SENSOR_PORTS];
intminor;///< Driver minor number
structjpeg_ptr_tjpeg_ptr[SENSOR_PORTS];///< Array of read/write pointers
};
/* debug code follows */
longlongzero_counter[SENSOR_PORTS]={0};
...
...
@@ -146,17 +127,21 @@ long long get_frame_pos(unsigned int chn, unsigned int pos)
staticstructimage_acq_pd_timage_acq_priv;
staticvolatileintJPEG_wp;
staticvolatileintJPEG_rp;
staticintfpga_counter_prev=0;/// Previous value of the FPGA transfer counter (to find out if it did change)
staticstructmeta_offsets_t{// works like a cache to time save on looking for tags in the directory (forced to recalculate if does not match)
intImage_DateTime;// will have offset of the Exif_Image_DateTime data in meta page (Exif_Photo_SubSecTime should go immediately after in meta page)
intPhoto_DateTimeOriginal;
intPhoto_ExposureTime;
intImage_ImageNumber;
intImage_Orientation;
intPhoto_MakerNote;
intPageNumber;
//static volatile int JPEG_wp;
//static volatile int JPEG_rp;
//static int fpga_counter_prev=0; ///< Previous value of the FPGA transfer counter (to find out if it did change)
/** @brief Works like a cache to time save on looking for tags in the directory (forced to recalculate if does not match)
* will have offset of the Exif_Image_DateTime data in meta page (Exif_Photo_SubSecTime should go immediately after in meta page)
*/
staticstructmeta_offsets_t{
intImage_DateTime;///< EXIF Date/Time offset
intPhoto_DateTimeOriginal;///< EXIF Date/Time Original offset
intPhoto_ExposureTime;///< EXIF exposure offset
intImage_ImageNumber;///< EXIF image number offset