Commit 0b1ebecc authored by Mikhail Karpenko's avatar Mikhail Karpenko

Merge branch 'circbuf'

Conflicts resolved:
	.gitignore
	src/drivers/elphel/Kconfig
	src/drivers/elphel/Makefile
	src/include/elphel/driver_numbers.h
parents 4c01ada9 9408d96d
...@@ -9,7 +9,8 @@ sysroots ...@@ -9,7 +9,8 @@ sysroots
.externalToolBuilders .externalToolBuilders
.settings .settings
.pydevproject .pydevproject
#auto-generated files from x393 project
# auto-generated files from x393 project
src/drivers/elphel/x393.c src/drivers/elphel/x393.c
src/drivers/elphel/x393.h src/drivers/elphel/x393.h
src/drivers/elphel/x393_defs.h src/drivers/elphel/x393_defs.h
......
...@@ -5,7 +5,7 @@ while (( "$#" )); do ...@@ -5,7 +5,7 @@ while (( "$#" )); do
done done
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "Launching bitbake $args" echo "Launching bitbake $args"
cd $DIR/.. cd $DIR/../poky
. ./oe-init-build-env . ./oe-init-build-env
bitbake $args | sed -u 's@| @@' bitbake $args | sed -u 's@| @@'
exit 0 exit 0
...@@ -26,5 +26,4 @@ config ELPHEL393_EXTERNAL ...@@ -26,5 +26,4 @@ config ELPHEL393_EXTERNAL
default m default m
help help
If unsure, say Y. If unsure, say Y.
endmenu endmenu
...@@ -6,9 +6,16 @@ obj-$(CONFIG_ELPHEL393) += elphel393-pwr.o ...@@ -6,9 +6,16 @@ obj-$(CONFIG_ELPHEL393) += elphel393-pwr.o
obj-$(CONFIG_ELPHEL393) += elphel393-mem.o obj-$(CONFIG_ELPHEL393) += elphel393-mem.o
obj-$(CONFIG_ELPHELDRVONMICROZED) += elphel393-mem.o obj-$(CONFIG_ELPHELDRVONMICROZED) += elphel393-mem.o
obj-$(CONFIG_ELPHEL393_INIT) += elphel393-init.o obj-$(CONFIG_ELPHEL393_INIT) += elphel393-init.o
obj-$(CONFIG_ELPHEL393) += x393.o obj-$(CONFIG_ELPHEL393) += x393.o
obj-$(CONFIG_ELPHEL393) += sensor_i2c.o obj-$(CONFIG_ELPHEL393) += sensor_i2c.o
obj-$(CONFIG_ELPHEL393) += fpgajtag353.o obj-$(CONFIG_ELPHEL393) += fpgajtag353.o
obj-$(CONFIG_ELPHEL393) += clock10359.o obj-$(CONFIG_ELPHEL393) += clock10359.o
#fpgajtag-y := fpgajtag353.o x393.o #fpgajtag-y := fpgajtag353.o x393.o
#obj-$(CONFIG_ELPHEL393_EXTERNAL) += fpgajtag.o #obj-$(CONFIG_ELPHEL393_EXTERNAL) += fpgajtag.o
obj-$(CONFIG_ELPHEL393) += framepars.o
obj-$(CONFIG_ELPHEL393) += sensor_common.o x393.o
obj-$(CONFIG_ELPHEL393) += quantization_tables.o
obj-$(CONFIG_ELPHEL393) += circbuf.o jpeghead.o
This diff is collapsed.
// FILE NAME : cxsdma.h
// read/write image and FPN buffers from SDRAM
#ifndef _CIRCBUF_H
#define _CIRCBUF_H
#include <linux/poll.h>
int circbuf_all_open (struct inode *inode, struct file *filp); // set filesize
int circbuf_all_release(struct inode *inode, struct file *filp);
loff_t circbuf_all_lseek (struct file * file, loff_t offset, int orig);
ssize_t circbuf_all_write (struct file * file, const char * buf, size_t count, loff_t *off);
ssize_t circbuf_all_read (struct file * file, char * buf, size_t count, loff_t *off);
int circbuf_all_mmap (struct file *file, struct vm_area_struct *vma);
unsigned int circbuf_all_poll (struct file *file, poll_table *wait);
//!just to notify it is not implemented
int circbuf_all_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);
int circbuf_open (struct inode *inode, struct file *filp); // set filesize
loff_t circbuf_lseek (struct file * file, loff_t offset, int orig);
ssize_t circbuf_write (struct file * file, const char * buf, size_t count, loff_t *off);
ssize_t circbuf_read (struct file * file, char * buf, size_t count, loff_t *off);
int circbuf_mmap (struct file *file, struct vm_area_struct *vma);
unsigned int circbuf_poll (struct file *file, poll_table *wait);
//int init_ccam_dma_buf_ptr(void);
/*!======================================================================================
*! Wait queue for the processes waiting for a new frame to appear in the circular buffer
*!======================================================================================*/
extern wait_queue_head_t circbuf_wait_queue;
extern unsigned long *ccam_dma_buf_ptr;
//unsigned long *circbuf_get_ccam_ptr(void);
// private data
struct circbuf_priv_t {
int minor;
unsigned long *buf_ptr;
dma_addr_t phys_addr;
};
extern struct circbuf_priv_t *circbuf_priv_ptr;
#endif /* _CIRCBUF_H */
...@@ -449,7 +449,7 @@ static struct of_device_id elphel393_mem_of_match[] = { ...@@ -449,7 +449,7 @@ static struct of_device_id elphel393_mem_of_match[] = {
{ .compatible = "elphel,elphel393-mem-1.00", }, { .compatible = "elphel,elphel393-mem-1.00", },
{ /* end of table */} { /* end of table */}
}; };
MODULE_DEVICE_TABLE(of, elphel393_pwr_of_match); MODULE_DEVICE_TABLE(of, elphel393_mem_of_match);
static struct platform_driver elphel393_mem = { static struct platform_driver elphel393_mem = {
.probe = elphel393_mem_probe, .probe = elphel393_mem_probe,
......
#ifndef __F_EXIF__H_
#define __F_EXIF__H_
extern unsigned char exif_header[];
int exif_header_length(void);
#define EXIF_OFFSET 4
#define EXIF_FIRMWARE 0xC4
#define EXIF_FIRMWARE_LEN 27
//#define EXIF_DATE_TIME 0x7A
#define EXIF_DATE_TIME 0xE0
#define EXIF_DATE_TIME_LEN 20
//#define EXIF_ARTIST 0x8E
#define EXIF_ARTIST 0xF4
#define EXIF_ARTIST_LEN 18
//#define EXIF_DATE_TIME_OR 0xCA
#define EXIF_DATE_TIME_OR 0x0138
#define EXIF_DATE_TIME_OR_LEN 20
//#define EXIF_SUBSEC_OR 0xDE
#define EXIF_SUBSEC_OR 0x014C
#define EXIF_SUBSEC_OR_LEN 7
//#define EXIF_EXP 0xE6
#define EXIF_EXP 0x0130
#define EXIF_EXP_LEN 8
#define EXIF_IMAGE_ID 0x6E
#define EXIF_IMAGE_ID_LEN 64
struct exif_desc_t {
unsigned char date_time[EXIF_DATE_TIME_LEN];
unsigned char date_time_or[EXIF_DATE_TIME_OR_LEN];
unsigned char subsec[EXIF_SUBSEC_OR_LEN];
unsigned char artist[EXIF_ARTIST_LEN];
unsigned char firmware[EXIF_FIRMWARE_LEN];
unsigned long exp[2];
};
extern struct exif_desc_t exif_desc;
#endif //__F_EXIF__H_
This diff is collapsed.
#ifndef _FRAMEPARS_H
#define _FRAMEPARS_H
//extern struct framepars_t (*framepars)[PARS_FRAMES];
extern struct framepars_t *framepars;
extern struct framepars_past_t *pastpars;
extern unsigned long *globalPars;
extern unsigned long *multiSensIndex;
extern unsigned long *multiSensRvrsIndex;
extern wait_queue_head_t framepars_wait_queue;
///TODO: init framepars (zero parameters) before initscripts (not when detecting the sensors) - then initscript will be able to overwrite some
void init_framepars_ptr(void);
void initSequencers(void); ///Move to sensorcommon? currently it is used through frameparsall file (lseek)
void initGlobalPars(void); /// resets all global parameters but debug mask (if ELPHEL_DEBUG)
int initMultiPars(void); /// initialize structures for individual per-sensor parameters. Now only works for sensor registers using G_MULTI_REGSM. Should be called aftre/during sensor detection
void initFramePars(void); ///initialize all parameters, set thisFrameNumber to frame8 (read from hardware, usually 0 after resetting i2c and cmd_seq)
void resetFrameNumber(void); /// reset this frame number (called from initFramePars(), also can be used to avoid frame number integer overflow)
unsigned long get_imageParamsThis (int n);
unsigned long get_imageParamsPrev (int n);
void set_imageParamsThis (int n,unsigned long d);
unsigned long get_globalParam (int n);
void set_globalParam (int n, unsigned long d);
void set_imageParamsR_all(int n, unsigned long d);
void update_frame_pars(void);
void updateFramePars(int frame8, struct interframe_params_t * frame_pars); /// called from ISR - advance thisFrameNumber to match hardware frame8, copy parameters as needed.
/// frame8 usually is just next after thisFrameNumber
/// frame_pars - pointer to structure (between frames in the frame buffer) to save a pointer to past parameters
int setFrameParsStatic(int numPars, struct frameparspair_t * pars);
unsigned long getThisFrameNumber(void); /// just return current thisFrameNumber
/// set parameters for the frame number frameno, knowing that they should be set not less than maxLatency ahead (may be sensor - dependent)
/// Parameters (numPars of them) will be updated all at once, with interrupts disabled
/// Return - 0 if OK, -ERR_FRAMEPARS_TOOEARLY or -ERR_FRAMEPARS_TOOLATE if it is too early or too late to set parameters (numPars may be 0 to just test)
///
/// NOTE: When writing parameter to P_SENSOR_RUN or P_COMPRESSOR_RUN "*_RUN_SINGLE", first write "*SENSOR_RUN_STOP" (it will propagate to all next frames) and then
/// write "*_RUN_SINGLE", to (P_*_RUN | FRAMEPAIR_JUST_THIS) - then this *_RUN_SINGLE will not propagate to the next frames (they will stay stopped)
/// TODO: Make (an "unlimited") future commands que based on lists and a tree frame index
int setFrameParsAtomic(unsigned long frameno, int maxLatency, int numPars, struct frameparspair_t * pars);
/// set output/calculated parameter and propogate changes - will not trigger any actions
int setFramePar(struct framepars_t * this_framepars, unsigned long mindex, unsigned long val);
///same for several pars at once
int setFramePars(struct framepars_t * this_framepars, int numPars, struct frameparspair_t * pars);
/// schedule pgm_func to be executed for selected frame
void schedule_pgm_func(int frame8, int func_num);
/// schedule pgm_func to be executed for the current frame
void schedule_this_pgm_func(struct framepars_t * this_framepars, int func_num);
/// program acquisition, according to the parameters changed.
/// maxahead - how many frames ahead of time (start with most urgent, then 1 ahead, ...)
/// make maxahead - P_* parameter?
inline void processParsASAP (struct sensorproc_t * sensorproc, int frame8);
inline void processParsSeq (struct sensorproc_t * sensorproc, int frame8, int maxahead);
void processPars (struct sensorproc_t * sensorproc, int frame8, int maxahead);
///*** TODO: Add option (flag?) to write "single" (like single compress, single sensor) so it will not make all the next frames "single"
int framepars_init(struct platform_device *pdev);
int framepars_remove(struct platform_device *pdev);
#endif
This diff is collapsed.
// FILE NAME : jpeghead.h
///Structure used for FPGA data - lower 16 bits - code value, next 5 - code length (1..16).
///Actually FPGA only uses 20 bits, length 0 is interpreted as 16
#ifndef _JPEGHEAD
#define _JPEGHEAD
struct huffman_fpga_code_t {
unsigned short value; /// code value
unsigned short length; /// code length
};
int qtables_create (struct interframe_params_t * params, unsigned char * buf, unsigned int chn);
int jpegheader_create(struct interframe_params_t * params, unsigned char * buf, unsigned int chn);
int jpeghead_open (struct inode *inode, struct file *filp); // set filesize
loff_t jpeghead_lseek (struct file * file, loff_t offset, int orig, struct interframe_params_t *fp);
ssize_t jpeghead_read (struct file * file, char * buf, size_t count, loff_t *off);
int huffman_open (struct inode *inode, struct file *filp); // set filesize
int huffman_release(struct inode *inode, struct file *filp);
loff_t huffman_lseek (struct file * file, loff_t offset, int orig);
ssize_t huffman_read (struct file * file, char * buf, size_t count, loff_t *off);
ssize_t huffman_write (struct file * file, const char * buf, size_t count, loff_t *off);
//extern unsigned long * ccam_dma_buf_ptr;
//void init_ccam_dma_buf_ptr(void);
#define JPEG_HEADER_MAXSIZE 0x300
struct jpeghead_pd {
int minor;/// should be the first, same as in circbuf_pd
unsigned long size; /// JPEG header size (no Exif)
unsigned char header[JPEG_HEADER_MAXSIZE];
};
struct huffman_pd {
int minor;/// should be the first, same as in circbuf_pd
};
int jpeg_htable_is_programmed(unsigned int chn);
void jpeg_htable_init(unsigned int chn);
int jpeg_htable_fpga_encode(unsigned int chn);
void jpeg_htable_fpga_pgm(unsigned int chn);
int jpeg_prep_htable(struct huffman_encoded_t * htable, struct huffman_fpga_code_t * hcodes);
int jpeghead_init(struct platform_device *pdev);
#endif /* _JPEGHEAD */
This diff is collapsed.
This diff is collapsed.
/// @file quantization_tables.h
#ifndef _QUANTIZATION_TABLES_H
#define _QUANTIZATION_TABLES_H
/** @brief Quantization tables cache usage policy */
enum {
// @brief Use common cache for all compressors
COMMON_CACHE = 0,
// @brief Use separate cache for each compressor
PER_CHN_CACHE
};
/**
* @brief initialization of quantization tables (direct - JPEG header ones) cache
* \n TODO: add \b init_qtable_head_cache to module initialization
*
* used in quantization_tables.c only
*/
void init_qtable_head_cache(unsigned int chn);
/**
* @brief calculates a pair of direct (JPEG header) tables for the specified quality (2-bytes )
* @param quality2 single byte (standard) or a pair of bytes (see file header description)
* @param y_tab caller-provided pointer to a 64-byte Y (intensity) quantization table (NULL - don't copy)
* @param c_tab caller-provided pointer to a 64-byte C (color) quantization table (NULL - don't copy)
* @return 0 - cache hit, 1 - cache miss (recalculated), -1 - invalid quality
*
* used in quantization_tables.c and jpeghead.c
*/
int get_qtable(int quality2, unsigned char *y_tab, unsigned char *c_tab, unsigned int chn);
/**
* @brief initialization of quantization tables (reverse, for the FPGA) cache
* \n TODO: add \b init_qtable_fpga to module initialization
*
* used in quantization_tables.c only
*/
void init_qtable_fpga(unsigned int chn);
/**
* @brief Finds an already programmed FPGA page or calculates (an programms FPGA with) a new one
* @param quality2 single byte (standard) or a pair of bytes (see file header description)
* @return table page number used (0..7) or -1 - invalid q
*
* used in quantization_table.c and pgm_functions.c
*/
int set_qtable_fpga(int quality2, unsigned int chn);
/**
* @brief Temporary function to directly set one of the coring LUTs (currently 100 0.0 to 9.9 with 0.1 step)
* to one of 16 FPGA tables (even - for Y,odd - for C)
* @param coring_number 0..99 - function number
* @param fpga_number 0.. 15 - fpga table number
* @return table page number used (0..7) or -1 - invalid q
*
* used in quantization_table.c and pgm_functions.c
*/
void set_coring_fpga(unsigned int coring_number, int fpga_number, unsigned int chn);
void reset_qtables(unsigned int chn);
int get_cache_policy(void);
void set_cache_policy(int policy);
void qt_init(struct platform_device *pdev);
#endif
This diff is collapsed.
#ifndef _SENSOR_COMMON_H
#define _SENSOR_COMMON_H
//extern struct sensor_t sensor; // current sensor (will be copied to by sensor driver), made external for the cc353.c to read/write i2c
extern struct sensorproc_t * sensorproc;
/// IRQ-safe "nice" FPGA table write and histogram read functions - they split the data in chunks of fixed size,
/// disable IRQ, transfer a chunk, then reenable interrupt before proceedg to the next chunk
#define FPGA_TABLE_CHUNK 64 // up to 64 words to send to the table/from histogram on a single IRQ-off transfer
//void fpga_table_write_nice (int addr, int len, unsigned long * data);
//void fpga_hist_read_nice (int addr, int len, unsigned long * data);
#ifdef CONFIG_ETRAX_ELPHEL_MT9X001
#include "mt9x001.h"
#endif
//#include "multisensor.h"
//int camSeqGetJPEG_wp(void);
//int camSeqGetJPEG_rp(void);
//void camSeqSetJPEG_rp(int p);
int camseq_get_jpeg_wp(unsigned int chn);
int camseq_get_jpeg_rp(unsigned int chn);
void camseq_set_jpeg_rp(unsigned int chn, int ptr);
///CIRCBUF macros
extern unsigned long * ccam_dma_buf_ptr;
/* move these lines to x313_macro.h
#define X313_LENGTH_MASK 0xff000000
#define X313_PADDED_FRAME(x)((((x)+67+CCAM_MMAP_META ) >>2) & 0xfffffff8)
#define X313_BUFFSUB(x,y) (((x)>=(y))? ((x)-(y)) : ((x)+ (CCAM_DMA_SIZE-(y))))
#define X313_BUFFADD(x,y) ((((x) + (y))<=CCAM_DMA_SIZE)? ((x) + (y)) : ((x) - (CCAM_DMA_SIZE-(y))))
*/
//int init_FPGA(void); /// can be initialized only after FPGA is configured, not at module init (NOTE was static??)
///can be verified with if (!X313_IS_SDRAM_ON)
void reset_compressor(unsigned int chn);
void camera_interrupts (int on);
struct sensorproc_t * copy_sensorproc (struct sensorproc_t * copy);
///NOTE: If profiling is enabled (TASKLET_CTL_ENPROF is set in G_TASKLET_CTL) - save current time in 2 of the 32-bit locations that can be read as pastpars (i.e. from PHP)
#ifdef TEST_DISABLE_CODE
#define PROFILE_NOW(x) if (get_globalParam(G_TASKLET_CTL) & (1 << TASKLET_CTL_ENPROF)) \
X313_GET_FPGA_TIME((pastpars[getThisFrameNumber() & PASTPARS_SAVE_ENTRIES_MASK].past_pars[(PP_PROFILE_START + 0) + ((x)<<1)]),\
(pastpars[getThisFrameNumber() & PASTPARS_SAVE_ENTRIES_MASK].past_pars[(PP_PROFILE_START + 1) + ((x)<<1)]))
///Put this to the next frame's data (before thisFrameNumber was incremented)
#define PROFILE_NEXT(x) if (get_globalParam(G_TASKLET_CTL) & (1 << TASKLET_CTL_ENPROF)) \
X313_GET_FPGA_TIME((pastpars[(getThisFrameNumber()+1) & PASTPARS_SAVE_ENTRIES_MASK].past_pars[(PP_PROFILE_START + 0) + ((x)<<1)]),\
(pastpars[(getThisFrameNumber()+1) & PASTPARS_SAVE_ENTRIES_MASK].past_pars[(PP_PROFILE_START + 1) + ((x)<<1)]))
#else
#define PROFILE_NOW(x) {}
#define PROFILE_NEXT(x) {}
#endif
int image_acq_init(struct platform_device *pdev);
// indicate that this channel need attention; set in interrupt handler, reset in bottom half
#define SENS_FLAG_IRQ 0x01
// got 0x20 more than start of the new image
#define OFFSET_X40 0x40
#endif
/**
* @file x393_macro.h
* @brief This file contains various macros used in multiple files.
*/
#ifndef _X393_MACRO
#define _X393_MACRO
#include <elphel/driver_numbers.h>
/** @brief Number of image channels */
#define IMAGE_CHN_NUM 4
/** @brief Resolution of current/OEF pointer in bits */
#define OFFSET256_CNTR_RES 26
#define CHUNK_SIZE 32
/** @brief The size of #interframe_params_t structure in double words */
#define INTERFRAME_PARAMS_SZ 8
#define MARKER_FF 0xff000000
#define MARKER_FFFF 0xffff
#define FRAME_LENGTH_MASK 0xffffff
#define IRQ_NOP 0
#define IRQ_CLEAR 1
#define IRQ_DISABLE 2
#define IRQ_ENABLE 3
#define BYTE2DW(x) ((x) >> 2)
#define DW2BYTE(x) ((x) << 2)
// 4 bytes offset, this one comes from python code x393_cmprs_afi.py
#define ADJUSTMENT 4
#define INSERTED_BYTES(x) (((CHUNK_SIZE - ((((x) % CHUNK_SIZE) + CCAM_MMAP_META) % CHUNK_SIZE) - ADJUSTMENT) % CHUNK_SIZE ) + ADJUSTMENT)
/* These macro were removed from sensor_common.h*/
#define X313_LENGTH_MASK 0xff000000
#define X393_BUFFSUB(x, y) (((x) >= (y)) ? ((x)-(y)) : ((x) + (CCAM_DMA_SIZE -(y))))
#define X393_BUFFADD(x, y) ((((x) + (y)) <= CCAM_DMA_SIZE) ? ((x) + (y)) : ((x) - (CCAM_DMA_SIZE -(y))))
#define TABLE_TYPE_QUANT 0
#define TABLE_TYPE_CORING 1
#define TABLE_TYPE_FOCUS 2
#define TABLE_TYPE_HUFFMAN 3
/**
* @brief Converts file minor number to image compressor channel.
*
* This function assumes that the least significant nibble of minor number contains image compressor channel number and
* next nibble contains device type. Channel numbers and device type are defined in #driver_numbers.h
* @param[in] minor file minor number
* @param[out] dev_type pointer to a variable which will hold device type or NULL if this value is not needed
* @return compressor channel number in the range [0..#IMAGE_CHN_NUM)
*/
static inline unsigned int minor_to_chn(unsigned int minor, unsigned int *dev_type)
{
if (dev_type != NULL) {
if ((minor & 0xf0) == CIRCBUF_MINOR || (minor & 0xf0) == HUFFMAN_MINOR || (minor & 0xf0) == JPEGHEAD_MINOR)
*dev_type = minor & 0xf0;
else
*dev_type = 0;
}
if ((minor & 0x0f) < IMAGE_CHN_NUM)
return minor & 0x0f;
else
return 0;
}
#endif /* _X393_MACRO */
This diff is collapsed.
...@@ -27,6 +27,23 @@ ...@@ -27,6 +27,23 @@
#define IMAGERAW_MINOR_FPN 2 #define IMAGERAW_MINOR_FPN 2
#define IMAGERAW_MINOR_UNLOCK 3 #define IMAGERAW_MINOR_UNLOCK 3
#define CIRCBUF_MINOR 0x20
#define CIRCBUF_MINOR_CHN_0 0x20
#define CIRCBUF_MINOR_CHN_1 0x21
#define CIRCBUF_MINOR_CHN_2 0x22
#define CIRCBUF_MINOR_CHN_3 0x23
#define JPEGHEAD_MINOR 0x30
#define JPEGHEAD_MINOR_CHN_0 0x30
#define JPEGHEAD_MINOR_CHN_1 0x31
#define JPEGHEAD_MINOR_CHN_2 0x32
#define JPEGHEAD_MINOR_CHN_3 0x33
#define HUFFMAN_MINOR 0x40
#define HUFFMAN_MINOR_CHN_0 0x40
#define HUFFMAN_MINOR_CHN_1 0x41
#define HUFFMAN_MINOR_CHN_2 0x42
#define HUFFMAN_MINOR_CHN_3 0x43
#define CMOSCAM_MINOR_RWTABLES 9 #define CMOSCAM_MINOR_RWTABLES 9
#define CMOSCAM_MINOR_CIRCBUF 11 #define CMOSCAM_MINOR_CIRCBUF 11
...@@ -62,8 +79,6 @@ ...@@ -62,8 +79,6 @@
#define FPGA_SJTAG_MINOR_OFFSET 8 // Minors range start for the sensor port JTAG #define FPGA_SJTAG_MINOR_OFFSET 8 // Minors range start for the sensor port JTAG
#define FPGA_SJTAG_BOUNDARY_OFFSET 12 // Minors range start for the sensor port boundary #define FPGA_SJTAG_BOUNDARY_OFFSET 12 // Minors range start for the sensor port boundary
#define X3X3_EXIF_EXIF 0 // read encoded Exif data (SEEK_END, #define X3X3_EXIF_EXIF 0 // read encoded Exif data (SEEK_END,
#define X3X3_EXIF_META 1 // write metadata, concurently opened files. All writes atomic #define X3X3_EXIF_META 1 // write metadata, concurently opened files. All writes atomic
// control/setup devices // control/setup devices
......
/*
exifa.h
*/
#ifndef _ASM_EXIF_H
#define _ASM_EXIF_H
//Major
#define X3X3_EXIF 125
//Minors
#define X3X3_EXIF_EXIF 0 // read encoded Exif data (SEEK_END,
#define X3X3_EXIF_META 1 // write metadata, concurently opened files. All writes atomic
// control/setup devices
#define X3X3_EXIF_TEMPLATE 2 // write Exif template
#define X3X3_EXIF_METADIR 3 // write metadata to Exif header translation (dir_table[MAX_EXIF_FIELDS])
// those 2 files will disable exif_enable and exif_valid, truncate file size to file pointer on release.
#define X3X3_EXIF_TIME 4 // write today/tomorrow date (YYYY:MM:DD) and number of seconds at today/tomorrow
// midnight (00:00:00) in seconds from epoch (long, startting from LSB)
// commands for the overloaded lseek:
//X3X3_EXIF_TIME
#define EXIF_LSEEK_DISABLE 1 // disable Exif (storing of frame meta, generating Exif)
#define EXIF_LSEEK_ENABLE 2 // enable Exif (build buffer if needed)
#define EXIF_LSEEK_INVALIDATE 3 // invalidate (and disable)
#define EXIF_LSEEK_REBUILD 4 // rebuild buffer
#define EXIF_LSEEK_TOMORROW_DATE 5 // file pointer to YYYY:MM:DD (tomorrow) string
#define EXIF_LSEEK_TOMORROW_SEC 6 // file pointer to unsigned long (little endian) tomorrow seconds from epoch
#define EXIF_LSEEK_TODAY_DATE 7 // file pointer to YYYY:MM:DD (today) string
#define EXIF_LSEEK_TODAY_SEC 8 // file pointer to unsigned long (little endian) today seconds from epoch
/*
Exif data in the images is combined from the "static" structure (template), calculated once at startup, and
variable data stored in the buffer for individual frames in the "Exif" form - converted to ASCII strings
or Rational or else. The generated Exif header copies that variable fileds on top of the Exif template.
The compressed data buffer is stored in "meta pages", one per frame
*/
struct exif_dir_table_t {
union {
unsigned long ltag;// tag group and tag combined
struct {
unsigned short tag_group; // tag group: 0 - IFD0, 1 - Exif, 2 - GPS
unsigned short tag; // Exif tag as defined in the standard
};
};
unsigned long len; // Number of bytes to be copied from metadata to Exif
unsigned long src; // offset in meta data page
unsigned long dst; // offset in output Exif page
};
#define MAX_EXIF_FIELDS 256 // number of Exif tags in the header
#define MAX_EXIF_SIZE 4096 // Exif data size
//#define MAX_EXIF_FRAMES 512 // number of frames in the buffer
#define MAX_EXIF_FRAMES 2048 // number of frames in the buffer
//Exif Tags - unsigned long, combining actual Exif tags with tag groups (0 - IFD0, 1 - Exif, 2 - GPS)
#define Exif_Image_ImageDescription 0x0010e
#define Exif_Image_Make 0x0010f
#define Exif_Image_Model 0x00110
#define Exif_Image_Software 0x00131
#define Exif_Image_DateTime 0x00132
#define Exif_Image_Artist 0x0013b
#define Exif_Image_HostComputer 0x0013c
#define Exif_Image_Orientation 0x00112
// hack, reusing field to keep it protected
#define Exif_Image_IPTCNAA 0x083bb
#define Exif_Image_FrameNumber 0x083bb
#define Exif_Image_ExifTag 0x08769
#define Exif_Image_GPSTag 0x08825
//Sub IFD
#define Exif_Photo_ExposureTime 0x1829a
#define Exif_Photo_DateTimeOriginal 0x19003
#define Exif_Photo_MakerNote 0x1927c
#define Exif_Photo_SubSecTime 0x19290
#define Exif_Photo_SubSecTimeOriginal 0x19291
//GPSInfo
#define Exif_GPSInfo_GPSLatitudeRef 0x20001
#define Exif_GPSInfo_GPSLatitude 0x20002
#define Exif_GPSInfo_GPSLongitudeRef 0x20003
#define Exif_GPSInfo_GPSLongitude 0x20004
#define Exif_GPSInfo_GPSAltitudeRef 0x20005
#define Exif_GPSInfo_GPSAltitude 0x20006
#define Exif_GPSInfo_GPSTimeStamp 0x20007
#define Exif_GPSInfo_GPSMeasureMode 0x2000a
#define Exif_GPSInfo_GPSDateStamp 0x2001D
/// used for compass module
#define Exif_GPSInfo_GPSImgDirectionRef 0x20010
#define Exif_GPSInfo_GPSImgDirection 0x20011
#define Exif_GPSInfo_GPSDestLatitudeRef 0x20013
#define Exif_GPSInfo_GPSDestLatitude 0x20014
#define Exif_GPSInfo_GPSDestLongitudeRef 0x20015
#define Exif_GPSInfo_GPSDestLongitude 0x20016
#define Exif_GPSInfo_CompassDirectionRef 0x20010
#define Exif_GPSInfo_CompassDirection 0x20011
#define Exif_GPSInfo_CompassPitchRef 0x20013
#define Exif_GPSInfo_CompassPitch 0x20014
#define Exif_GPSInfo_CompassRollRef 0x20015
#define Exif_GPSInfo_CompassRoll 0x20016
// array(0x9003,2,"2001:06:21 12:00:00","len"=> 20), //date/time original time created, always use 20 bytes (19 ."\0")
// array(0x9291,2,"0 ") //original time sub-second length=10 9 ."\0"
///move back to interframe_params_t?
struct frame_exif_t {
unsigned short meta_index; //! index of the linked meta page
unsigned short signffff; //! should be 0xffff - it will be a signature that JPEG data was not overwritten
unsigned long frame_length; //! frame length
};
struct meta_GPSInfo_t {
unsigned char GPSLatitudeRef; //"N"/"S"
unsigned long GPSLatitude_deg_nom;
unsigned long GPSLatitude_deg_denom;
unsigned long GPSLatitude_min_nom;
unsigned long GPSLatitude_min_denom;
unsigned char GPSLongitudeRef; //"E"/"W"
unsigned long GPSLongitude_deg_nom;
unsigned long GPSLongitude_deg_denom;
unsigned long GPSLongitude_min_nom;
unsigned long GPSLongitude_min_denom;
unsigned char GPSAltitudeRef; //byte, not ascii 0 - above sea level, 1 - below
unsigned long GPSAltitude_nom; //in meters
unsigned long GPSAltitude_denom;
unsigned long GPSTimeStamp_hrs_nom;
unsigned long GPSTimeStamp_hrs_denom;
unsigned long GPSTimeStamp_min_nom;
unsigned long GPSTimeStamp_min_denom;
unsigned long GPSTimeStamp_sec_nom;
unsigned long GPSTimeStamp_sec_denom;
unsigned char GPSDateStamp[11]; //includes '\0'
unsigned char GPSMeasureMode;
};
//hack - use
struct meta_CompassInfo_t {
// unsigned char GPSImgDirectionRef; //"M"/"T" //0x10
unsigned long CompassDirection_nom; //0x11
unsigned long CompassDirection_denom;
unsigned char CompassPitchRef; //"N"/"S"
unsigned long CompassPitch_nom;
unsigned long CompassPitch_denom;
unsigned char CompassRollRef; //"E"/"W"
unsigned long CompassRoll_nom;
unsigned long CompassRoll_denom;
};
#define EXIF_GPS_MIN_DENOM 10000
#define EXIF_GPS_METERS_DENOM 10
#define EXIF_GPS_TIMESEC_DENOM 1000
#define EXIF_GPS_COMPASS_DENOM 10
///hack!
#define EXIF_COMPASS_PITCH_ASCII "NS" // use for pitch +/-
#define EXIF_COMPASS_ROLL_ASCII "EW" // use for roll +/-
/// Exif data (variable, stored with each frame) used for KML (not only)
#define Exif_Image_ImageDescription_Index 0x00
#define Exif_Photo_DateTimeOriginal_Index 0x01
#define Exif_Photo_SubSecTimeOriginal_Index 0x02
#define Exif_Photo_ExposureTime_Index 0x03
#define Exif_GPSInfo_GPSLatitudeRef_Index 0x04
#define Exif_GPSInfo_GPSLatitude_Index 0x05
#define Exif_GPSInfo_GPSLongitudeRef_Index 0x06
#define Exif_GPSInfo_GPSLongitude_Index 0x07
#define Exif_GPSInfo_GPSAltitudeRef_Index 0x08
#define Exif_GPSInfo_GPSAltitude_Index 0x09
#define Exif_GPSInfo_GPSTimeStamp_Index 0x0a
#define Exif_GPSInfo_GPSDateStamp_Index 0x0b
#define Exif_GPSInfo_GPSMeasureMode_Index 0x0c
#define Exif_GPSInfo_CompassDirectionRef_Index 0x0d
#define Exif_GPSInfo_CompassDirection_Index 0x0e
#define Exif_GPSInfo_CompassPitchRef_Index 0x0f
#define Exif_GPSInfo_CompassPitch_Index 0x10
#define Exif_GPSInfo_CompassRollRef_Index 0x11
#define Exif_GPSInfo_CompassRoll_Index 0x12
#define Exif_Image_FrameNumber_Index 0x13
#define Exif_Image_Orientation_Index 0x14
#define Exif_Photo_MakerNote_Index 0x15
/// update ExifKmlNumber to be total number of *_Index entries
#define ExifKmlNumber Exif_Photo_MakerNote_Index+1
#define EXIF_DEV_NAME "/dev/exif_exif"
#define EXIFDIR_DEV_NAME "/dev/exif_metadir"
#define EXIFMETA_DEV_NAME "/dev/exif_meta"
#endif
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