Commit 321e5f6b authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

moved circbuf_start_offset to DT

parent 64c2d002
...@@ -195,6 +195,7 @@ ...@@ -195,6 +195,7 @@
memsize-partitions-circbuf = <16384 16384 16384 16384>; /* line 1 */ memsize-partitions-circbuf = <16384 16384 16384 16384>; /* line 1 */
/* memsize-partitions-raw = <16384 16384 16384 16384>; /* line 2 */ /* memsize-partitions-raw = <16384 16384 16384 16384>; /* line 2 */
memsize-partitions-raw = <0 0 0 0>; /* line 2 */ memsize-partitions-raw = <0 0 0 0>; /* line 2 */
memsize-circbuf-start-offset = <0x100000>;
h2d_size = <1024>; h2d_size = <1024>;
d2h_size = <1024>; d2h_size = <1024>;
bidir_size = <1024>; bidir_size = <1024>;
......
...@@ -195,6 +195,7 @@ ...@@ -195,6 +195,7 @@
memsize-partitions-circbuf = <16384 16384 16384 16384>; /* line 1 */ memsize-partitions-circbuf = <16384 16384 16384 16384>; /* line 1 */
/* memsize-partitions-raw = <16384 16384 16384 16384>; /* line 2 */ /* memsize-partitions-raw = <16384 16384 16384 16384>; /* line 2 */
memsize-partitions-raw = <0 0 0 0>; /* line 2 */ memsize-partitions-raw = <0 0 0 0>; /* line 2 */
memsize-circbuf-start-offset = <0x100000>;
h2d_size = <1024>; h2d_size = <1024>;
d2h_size = <1024>; d2h_size = <1024>;
bidir_size = <1024>; bidir_size = <1024>;
......
...@@ -195,6 +195,7 @@ ...@@ -195,6 +195,7 @@
memsize-partitions-circbuf = <16384 16384 16384 16384>; /* line 1 */ memsize-partitions-circbuf = <16384 16384 16384 16384>; /* line 1 */
/* memsize-partitions-raw = <16384 16384 16384 16384>; /* line 2 */ /* memsize-partitions-raw = <16384 16384 16384 16384>; /* line 2 */
memsize-partitions-raw = <0 0 0 0>; /* line 2 */ memsize-partitions-raw = <0 0 0 0>; /* line 2 */
memsize-circbuf-start-offset = <0x100000>;
h2d_size = <1024>; h2d_size = <1024>;
d2h_size = <1024>; d2h_size = <1024>;
bidir_size = <1024>; bidir_size = <1024>;
......
...@@ -195,6 +195,7 @@ ...@@ -195,6 +195,7 @@
memsize-partitions-circbuf = <16384 16384 16384 16384>; /* line 1 */ memsize-partitions-circbuf = <16384 16384 16384 16384>; /* line 1 */
/* memsize-partitions-raw = <16384 16384 16384 16384>; /* line 2 */ /* memsize-partitions-raw = <16384 16384 16384 16384>; /* line 2 */
memsize-partitions-raw = <0 0 0 0>; /* line 2 */ memsize-partitions-raw = <0 0 0 0>; /* line 2 */
memsize-circbuf-start-offset = <0x100000>;
h2d_size = <1024>; h2d_size = <1024>;
d2h_size = <1024>; d2h_size = <1024>;
bidir_size = <1024>; bidir_size = <1024>;
......
...@@ -178,10 +178,10 @@ ssize_t circbuf_get_ptr(int sensor_port, size_t offset, size_t len, struct fvec ...@@ -178,10 +178,10 @@ ssize_t circbuf_get_ptr(int sensor_port, size_t offset, size_t len, struct fvec
{ {
int ret = 1; int ret = 1;
if (offset > CCAM_DMA_SIZE || sensor_port >= SENSOR_PORTS) if (offset > circbuf_priv[sensor_port].buf_size || sensor_port >= SENSOR_PORTS)
return -EINVAL; return -EINVAL;
if (offset + len < CCAM_DMA_SIZE) { if (offset + len < circbuf_priv[sensor_port].buf_size) {
// the image is not split // the image is not split
vect_0->iov_base = &circbuf_priv[sensor_port].buf_ptr[BYTE2DW(offset)]; vect_0->iov_base = &circbuf_priv[sensor_port].buf_ptr[BYTE2DW(offset)];
vect_0->iov_dma = circbuf_priv[sensor_port].phys_addr + offset; vect_0->iov_dma = circbuf_priv[sensor_port].phys_addr + offset;
...@@ -193,7 +193,7 @@ ssize_t circbuf_get_ptr(int sensor_port, size_t offset, size_t len, struct fvec ...@@ -193,7 +193,7 @@ ssize_t circbuf_get_ptr(int sensor_port, size_t offset, size_t len, struct fvec
// the image is split into two segments // the image is split into two segments
vect_0->iov_base = &circbuf_priv[sensor_port].buf_ptr[BYTE2DW(offset)]; vect_0->iov_base = &circbuf_priv[sensor_port].buf_ptr[BYTE2DW(offset)];
vect_0->iov_dma = circbuf_priv[sensor_port].phys_addr + offset; vect_0->iov_dma = circbuf_priv[sensor_port].phys_addr + offset;
vect_0->iov_len = CCAM_DMA_SIZE - offset; vect_0->iov_len = circbuf_priv[sensor_port].buf_size - offset;
vect_1->iov_base = circbuf_priv[sensor_port].buf_ptr; vect_1->iov_base = circbuf_priv[sensor_port].buf_ptr;
vect_1->iov_dma = circbuf_priv[sensor_port].phys_addr; vect_1->iov_dma = circbuf_priv[sensor_port].phys_addr;
vect_1->iov_len = len - vect_0->iov_len; vect_1->iov_len = len - vect_0->iov_len;
......
...@@ -79,6 +79,9 @@ static struct elphel_buf_t _elphel_buf = { ...@@ -79,6 +79,9 @@ static struct elphel_buf_t _elphel_buf = {
.logger_paddr = 0, .logger_paddr = 0,
.logger_size = 1024, // should be 2**n ! .logger_size = 1024, // should be 2**n !
// circbuf start offset
.circbuf_start_offset = 0x100000,
// circbuf channel 0 (in Coherent DMA buffer) // circbuf channel 0 (in Coherent DMA buffer)
.circbuf_chn0_vaddr = NULL, .circbuf_chn0_vaddr = NULL,
.circbuf_chn0_paddr = 0, .circbuf_chn0_paddr = 0,
...@@ -142,6 +145,7 @@ static int elphelmem_of_get_init_data(void){ ...@@ -142,6 +145,7 @@ static int elphelmem_of_get_init_data(void){
of_property_read_u32(node, "bidir_size",&_elphel_buf.bidir_size); of_property_read_u32(node, "bidir_size",&_elphel_buf.bidir_size);
of_property_read_u32(node, "histograms_size",&_elphel_buf.histograms_size); of_property_read_u32(node, "histograms_size",&_elphel_buf.histograms_size);
of_property_read_u32(node, "logger_size",&_elphel_buf.logger_size); of_property_read_u32(node, "logger_size",&_elphel_buf.logger_size);
of_property_read_u32(node, "memsize-circbuf-start-offset",&_elphel_buf.circbuf_start_offset);
if (of_property_read_u32_array(node, if (of_property_read_u32_array(node,
"memsize-partitions-circbuf", "memsize-partitions-circbuf",
...@@ -184,7 +188,7 @@ int elphelmem_update_partitions(void){ ...@@ -184,7 +188,7 @@ int elphelmem_update_partitions(void){
//circbuf_priv[i].buf_size = CCAM_DMA_SIZE; //circbuf_priv[i].buf_size = CCAM_DMA_SIZE;
//... //...
tmpsize = CIRCBUF_START_OFFSET; tmpsize = _elphel_buf.circbuf_start_offset;
// fill out buffers info // fill out buffers info
_elphel_buf.circbuf_chn0_vaddr = _elphel_buf.vaddr+tmpsize; _elphel_buf.circbuf_chn0_vaddr = _elphel_buf.vaddr+tmpsize;
......
...@@ -49,6 +49,8 @@ struct elphel_buf_t ...@@ -49,6 +49,8 @@ struct elphel_buf_t
dma_addr_t logger_paddr; dma_addr_t logger_paddr;
ssize_t logger_size; ssize_t logger_size;
dma_addr_t circbuf_start_offset;
// circbuf channel 0 (in Coherent DMA buffer) // circbuf channel 0 (in Coherent DMA buffer)
void *circbuf_chn0_vaddr; void *circbuf_chn0_vaddr;
dma_addr_t circbuf_chn0_paddr; dma_addr_t circbuf_chn0_paddr;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#define _ASM_CMOSCAM_H #define _ASM_CMOSCAM_H
#define SAFE_CHECK 1 // perform more verification on the paremeters #define SAFE_CHECK 1 // perform more verification on the paremeters
//#define ELPHEL_DEBUG 0 //global debug on/off in multiple files //#define ELPHEL_DEBUG 0 //global debug on/off in multiple files
//#define ELPHEL_DEBUG_STARTUP 000a4c00 ; //#define ELPHEL_DEBUG_STARTUP 000a4c00 ;
//#define ELPHEL_DEBUG_STARTUP 0 ; // removed - add write to fpga init script //#define ELPHEL_DEBUG_STARTUP 0 ; // removed - add write to fpga init script
//#define ELPHEL_DEBUG 0 //global debug on/off in multiple files //#define ELPHEL_DEBUG 0 //global debug on/off in multiple files
#define ELPHEL_DEBUG 0 //global debug on/off in multiple files #define ELPHEL_DEBUG 0 //global debug on/off in multiple files
...@@ -171,7 +171,7 @@ ...@@ -171,7 +171,7 @@
#ifndef I2C_16_WRITEARG #ifndef I2C_16_WRITEARG
#define I2C_16_WRITEREG 0x3 // write 2 bytes to an i2c register #define I2C_16_WRITEREG 0x3 // write 2 bytes to an i2c register
#define I2C_16_READREG 0x4 // read 2 bytes from an i2c register #define I2C_16_READREG 0x4 // read 2 bytes from an i2c register
#define I2C_16_WRITEARG(slave, reg, value) (((slave) << 24) | ((reg) << 16) | (value)) #define I2C_16_WRITEARG(slave, reg, value) (((slave) << 24) | ((reg) << 16) | (value))
#define I2C_16_READARG(slave, reg) (((slave) << 24) | ((reg) << 16)) #define I2C_16_READARG(slave, reg) (((slave) << 24) | ((reg) << 16))
...@@ -865,9 +865,9 @@ ...@@ -865,9 +865,9 @@
//#define P_HISTRQ 67 // per-frame enabling of histogram calculation - bit 0 - Y (G), bit 2 - C (R,G2,B) //#define P_HISTRQ 67 // per-frame enabling of histogram calculation - bit 0 - Y (G), bit 2 - C (R,G2,B)
//#define HISTRQ_BITY 0 //#define HISTRQ_BITY 0
//#define HISTRQ_BITC 1 //#define HISTRQ_BITC 1
#define HISTRQ_BIT_Y 0 #define HISTRQ_BIT_Y 0
#define HISTRQ_BIT_C 1 #define HISTRQ_BIT_C 1
#define P_HISTRQ_Y (P_HISTRQ | FRAMEPAIR_FRAME_BITS(1, HISTRQ_BIT_Y) | FRAMEPAIR_JUST_THIS) ///< request calculation of the Y-histogram for just this frame #define P_HISTRQ_Y (P_HISTRQ | FRAMEPAIR_FRAME_BITS(1, HISTRQ_BIT_Y) | FRAMEPAIR_JUST_THIS) ///< request calculation of the Y-histogram for just this frame
#define P_HISTRQ_C (P_HISTRQ | FRAMEPAIR_FRAME_BITS(1, HISTRQ_BIT_C) | FRAMEPAIR_JUST_THIS) ///< request calculation of the C-histogram for just this frame #define P_HISTRQ_C (P_HISTRQ | FRAMEPAIR_FRAME_BITS(1, HISTRQ_BIT_C) | FRAMEPAIR_JUST_THIS) ///< request calculation of the C-histogram for just this frame
...@@ -1647,14 +1647,16 @@ struct p_names_t { ...@@ -1647,14 +1647,16 @@ struct p_names_t {
/* For past compatibility, CCMA_DMA_SIZE... /* For past compatibility, CCMA_DMA_SIZE...
*/ */
//#define CCAM_DMA_SIZE CCAM_WORDS_PER_DMABUF //#define CCAM_DMA_SIZE CCAM_WORDS_PER_DMABUF
// Moved to DT
#define CCAM_DMA_SIZE 0x4000000 ///< Each channel buffer size in BYTES (was in DWORDS in NC353) TODO NC393: use only for initial allocation, move to DT #define CCAM_DMA_SIZE 0x4000000 ///< Each channel buffer size in BYTES (was in DWORDS in NC353) TODO NC393: use only for initial allocation, move to DT
#define CIRCBUF_START_OFFSET 0x100000 ///< Offset for the first bufer TODO NC393: use only for initial allocation, move to DT // Moved to DT
//#define CIRCBUF_START_OFFSET 0x100000 ///< Offset for the first bufer TODO NC393: use only for initial allocation, move to DT
/* /*
* CCAM_MMAP_OFFSET... -- offsets in bytes in memory mapped region. * CCAM_MMAP_OFFSET... -- offsets in bytes in memory mapped region.
* CCAM_MMAP_SIZE -- no. of bytes to mmap. * CCAM_MMAP_SIZE -- no. of bytes to mmap.
*/ */
// CCAM_DMA1_SIZE should be 2^N // CCAM_DMA1_SIZE should be 2^N
#ifdef NC353 #ifdef NC353
#define CCAM_CHUNK_PER_DMA1BUF 16 /* no. of 64Kbyte chunks per buffer */ #define CCAM_CHUNK_PER_DMA1BUF 16 /* no. of 64Kbyte chunks per buffer */
#define CCAM_WORDS_PER_DMA1BUF (CCAM_CHUNK_PER_DMA1BUF<<14) /*32bit words...*/ #define CCAM_WORDS_PER_DMA1BUF (CCAM_CHUNK_PER_DMA1BUF<<14) /*32bit words...*/
...@@ -1746,7 +1748,7 @@ struct sensorproc_t { ...@@ -1746,7 +1748,7 @@ struct sensorproc_t {
*! Structure also includes 8 bytes of timestamp (after 2 bytes skipped) - they will be obtained from the circbuf data *! Structure also includes 8 bytes of timestamp (after 2 bytes skipped) - they will be obtained from the circbuf data
*! that goes after the encoded frame, so total is 36 bytes (26+2+8) *! that goes after the encoded frame, so total is 36 bytes (26+2+8)
!****************************************************************************************************/ !****************************************************************************************************/
// move fram x353.h // move fram x353.h
#define DEFAULT_COLOR_SATURATION_BLUE 0x90 ///< 100*relative saturation blue #define DEFAULT_COLOR_SATURATION_BLUE 0x90 ///< 100*relative saturation blue
#define DEFAULT_COLOR_SATURATION_RED 0xb6 ///< 100*relative saturation red #define DEFAULT_COLOR_SATURATION_RED 0xb6 ///< 100*relative saturation red
...@@ -1804,7 +1806,7 @@ struct i2c_timing_t { ...@@ -1804,7 +1806,7 @@ struct i2c_timing_t {
unsigned char slave2master; //0x01, //! slave -> master unsigned char slave2master; //0x01, //! slave -> master
unsigned char master2slave; //0x01, //! master -> slave unsigned char master2slave; //0x01, //! master -> slave
unsigned char filter_sda; //0x07, //! filter SDA read data by testing multiple times - currently just zero/non zero unsigned char filter_sda; //0x07, //! filter SDA read data by testing multiple times - currently just zero/non zero
unsigned char filter_scl; //0x07};//! filter SCL read data by testing multiple times - currently just zero/non zero unsigned char filter_scl; //0x07};//! filter SCL read data by testing multiple times - currently just zero/non zero
}; };
/// Gamma data for one component, including direct and reverse tables, hash (i.e. black level+gamma) and links for caching /// Gamma data for one component, including direct and reverse tables, hash (i.e. black level+gamma) and links for caching
...@@ -1895,7 +1897,7 @@ struct __attribute__((__packed__)) gamma_stuct_t { ...@@ -1895,7 +1897,7 @@ struct __attribute__((__packed__)) gamma_stuct_t {
#define HISTOGRAM_CACHE_NUMBER 8 // 16 // Was 8 // number of frames histograms are kept after acquisition (should be 2^n) #define HISTOGRAM_CACHE_NUMBER 8 // 16 // Was 8 // number of frames histograms are kept after acquisition (should be 2^n)
#define COLOR_RED 0 #define COLOR_RED 0
#define COLOR_GREEN1 1 #define COLOR_GREEN1 1
#define COLOR_GREEN2 2 #define COLOR_GREEN2 2
#define COLOR_BLUE 3 #define COLOR_BLUE 3
...@@ -2089,7 +2091,7 @@ struct huffman_encoded_t { ...@@ -2089,7 +2091,7 @@ struct huffman_encoded_t {
///NOTE page 0 is write protected, page 15 (0x0f) is "default" page ///NOTE page 0 is write protected, page 15 (0x0f) is "default" page
#define AUTOCAMPARS_CMD_RESTORE 1 /// restore specified groups of parameters from the specified page #define AUTOCAMPARS_CMD_RESTORE 1 /// restore specified groups of parameters from the specified page
#define AUTOCAMPARS_CMD_SAVE 2 /// save all current parameters to the specified group (page 0 is write-protected) #define AUTOCAMPARS_CMD_SAVE 2 /// save all current parameters to the specified group (page 0 is write-protected)
#define AUTOCAMPARS_CMD_DFLT 3 /// make selected page the default one (used at startup), page 0 OK #define AUTOCAMPARS_CMD_DFLT 3 /// make selected page the default one (used at startup), page 0 OK
#define AUTOCAMPARS_CMD_SAVEDFLT 4 /// save all current parameters to the specified group (page 0 is write-protected) and make it default (used at startup) #define AUTOCAMPARS_CMD_SAVEDFLT 4 /// save all current parameters to the specified group (page 0 is write-protected) and make it default (used at startup)
#define AUTOCAMPARS_CMD_INIT 5 /// reset sensor/sequencers, restore all parameters from the specified page #define AUTOCAMPARS_CMD_INIT 5 /// reset sensor/sequencers, restore all parameters from the specified page
......
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