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

moved circbuf_start_offset to DT

parent 64c2d002
......@@ -195,6 +195,7 @@
memsize-partitions-circbuf = <16384 16384 16384 16384>; /* line 1 */
/* memsize-partitions-raw = <16384 16384 16384 16384>; /* line 2 */
memsize-partitions-raw = <0 0 0 0>; /* line 2 */
memsize-circbuf-start-offset = <0x100000>;
h2d_size = <1024>;
d2h_size = <1024>;
bidir_size = <1024>;
......
......@@ -195,6 +195,7 @@
memsize-partitions-circbuf = <16384 16384 16384 16384>; /* line 1 */
/* memsize-partitions-raw = <16384 16384 16384 16384>; /* line 2 */
memsize-partitions-raw = <0 0 0 0>; /* line 2 */
memsize-circbuf-start-offset = <0x100000>;
h2d_size = <1024>;
d2h_size = <1024>;
bidir_size = <1024>;
......
......@@ -195,6 +195,7 @@
memsize-partitions-circbuf = <16384 16384 16384 16384>; /* line 1 */
/* memsize-partitions-raw = <16384 16384 16384 16384>; /* line 2 */
memsize-partitions-raw = <0 0 0 0>; /* line 2 */
memsize-circbuf-start-offset = <0x100000>;
h2d_size = <1024>;
d2h_size = <1024>;
bidir_size = <1024>;
......
......@@ -195,6 +195,7 @@
memsize-partitions-circbuf = <16384 16384 16384 16384>; /* line 1 */
/* memsize-partitions-raw = <16384 16384 16384 16384>; /* line 2 */
memsize-partitions-raw = <0 0 0 0>; /* line 2 */
memsize-circbuf-start-offset = <0x100000>;
h2d_size = <1024>;
d2h_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
{
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;
if (offset + len < CCAM_DMA_SIZE) {
if (offset + len < circbuf_priv[sensor_port].buf_size) {
// the image is not split
vect_0->iov_base = &circbuf_priv[sensor_port].buf_ptr[BYTE2DW(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
// the image is split into two segments
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_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_dma = circbuf_priv[sensor_port].phys_addr;
vect_1->iov_len = len - vect_0->iov_len;
......
......@@ -79,6 +79,9 @@ static struct elphel_buf_t _elphel_buf = {
.logger_paddr = 0,
.logger_size = 1024, // should be 2**n !
// circbuf start offset
.circbuf_start_offset = 0x100000,
// circbuf channel 0 (in Coherent DMA buffer)
.circbuf_chn0_vaddr = NULL,
.circbuf_chn0_paddr = 0,
......@@ -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, "histograms_size",&_elphel_buf.histograms_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,
"memsize-partitions-circbuf",
......@@ -184,7 +188,7 @@ int elphelmem_update_partitions(void){
//circbuf_priv[i].buf_size = CCAM_DMA_SIZE;
//...
tmpsize = CIRCBUF_START_OFFSET;
tmpsize = _elphel_buf.circbuf_start_offset;
// fill out buffers info
_elphel_buf.circbuf_chn0_vaddr = _elphel_buf.vaddr+tmpsize;
......
......@@ -49,6 +49,8 @@ struct elphel_buf_t
dma_addr_t logger_paddr;
ssize_t logger_size;
dma_addr_t circbuf_start_offset;
// circbuf channel 0 (in Coherent DMA buffer)
void *circbuf_chn0_vaddr;
dma_addr_t circbuf_chn0_paddr;
......
......@@ -1647,8 +1647,10 @@ struct p_names_t {
/* For past compatibility, CCMA_DMA_SIZE...
*/
//#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 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.
......
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