Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
linux-elphel
Commits
e23e383a
Commit
e23e383a
authored
Apr 05, 2016
by
Mikhail Karpenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: check the pointer updates
parent
fd58a7d1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
16 deletions
+60
-16
circbuf.c
src/drivers/elphel/circbuf.c
+3
-0
sensor_common.c
src/drivers/elphel/sensor_common.c
+51
-15
sensor_common.h
src/drivers/elphel/sensor_common.h
+6
-1
No files found.
src/drivers/elphel/circbuf.c
View file @
e23e383a
...
...
@@ -127,6 +127,9 @@ int init_ccam_dma_buf_ptr(struct platform_device *pdev) {
}
ccam_dma_buf
=
ccam_dma_buf_ptr
;
// set circbuf size in bytes
set_globalParam
(
G_CIRCBUFSIZE
,
pElphel_buf
->
size
*
PAGE_SIZE
);
return
0
;
}
//extern struct interframe_params_t frame_params; // cc353.c
...
...
src/drivers/elphel/sensor_common.c
View file @
e23e383a
...
...
@@ -25,7 +25,6 @@
*/
//copied from cxi2c.c - TODO:remove unneeded
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/slab.h>
...
...
@@ -123,10 +122,11 @@
struct
jpeg_ptr_t
{
volatile
int
jpeg_wp
;
volatile
int
jpeg_rp
;
int
fpga_cntr_prev
;
volatile
int
fpga_cntr_prev
;
unsigned
int
irq_num_comp
;
unsigned
int
irq_num_sens
;
unsigned
int
chn_num
;
volatile
unsigned
int
flags
;
};
/**@struct image_acq_pd_t
...
...
@@ -245,20 +245,22 @@ static inline int updateIRQJPEG_wp(struct jpeg_ptr_t *jptr)
{
int
xferred
;
/// number of 32-byte chunks transferred since compressor was reset
x393_afimux_status_t
stat
=
x393_afimux0_status
(
jptr
->
chn_num
);
int
circbuf_size
=
get_globalParam
(
G_CIRCBUFSIZE
)
>>
2
;
//int circbuf_size = get_globalParam(G_CIRCBUFSIZE) >> 2;
int
circbuf_size
=
get_globalParam
(
G_CIRCBUFSIZE
);
xferred
=
stat
.
offset256
-
jptr
->
fpga_cntr_prev
;
if
(
xferred
==
0
)
return
0
;
/// no advance (compressor was off?)
jptr
->
flags
|=
SENS_FLAG_IRQ
;
jptr
->
fpga_cntr_prev
=
stat
.
offset256
;
if
(
xferred
<
0
)
/*
if (xferred < 0)
// 26 bit hardware counter rolled over
xferred
+=
(
1
<<
OFFSET256_CNTR_RES
);
xferred += (1 << OFFSET256_CNTR_RES);
*/
jptr
->
jpeg_wp
+=
xferred
*
CHUNK_SIZE
;
//JPEG_wp+= (xferred << 3); //! counts in 32-byte ( 8 of 32bit words) chunks
if
(
jptr
->
jpeg_wp
>
circbuf_size
)
jptr
->
jpeg_wp
-=
circbuf_size
;
/*
if (jptr->jpeg_wp > circbuf_size)
jptr->jpeg_wp -= circbuf_size;
*/
return
1
;
}
...
...
@@ -267,7 +269,11 @@ static inline int updateIRQJPEG_wp(struct jpeg_ptr_t *jptr)
* @brief Calculate/update CIRCBUF parameters available after compressor interrupt
*/
inline
void
update_irq_circbuf
(
struct
jpeg_ptr_t
*
jptr
)
{
set_globalParam
(
G_CIRCBUFWP
,
JPEG_wp
<<
2
);
/*set_globalParam (G_CIRCBUFWP, JPEG_wp<<2);
set_globalParam (G_FREECIRCBUF, (((get_globalParam (G_CIRCBUFRP) <= get_globalParam (G_CIRCBUFWP))? get_globalParam (G_CIRCBUFSIZE):0)+
get_globalParam (G_CIRCBUFRP)) - get_globalParam (G_CIRCBUFWP));*/
/* the concept of global parameters will be changed, use one channel only for testing */
set_globalParam
(
G_CIRCBUFWP
,
jptr
->
jpeg_wp
);
set_globalParam
(
G_FREECIRCBUF
,
(((
get_globalParam
(
G_CIRCBUFRP
)
<=
get_globalParam
(
G_CIRCBUFWP
))
?
get_globalParam
(
G_CIRCBUFSIZE
)
:
0
)
+
get_globalParam
(
G_CIRCBUFRP
))
-
get_globalParam
(
G_CIRCBUFWP
));
}
...
...
@@ -276,9 +282,11 @@ inline void update_irq_circbuf(struct jpeg_ptr_t *jptr) {
* @brief Calculate/update focus parameters available after compressor interrupt
* NOTE: currently global (latest), not per-frame
*/
inline
void
updateIRQFocus
(
void
)
{
inline
void
updateIRQFocus
(
struct
jpeg_ptr_t
*
jptr
)
{
//set_globalParam (G_GFOCUS_VALUE, X313_HIGHFREQ);
//set_imageParamsThis (P_FOCUS_VALUE, X313_HIGHFREQ);
u32
high_freq
=
x393_cmprs_highfreq
(
jptr
->
chn_num
);
}
...
...
@@ -287,7 +295,7 @@ inline void updateIRQFocus(void) {
* @brief Locate area between frames in the circular buffer
* @return pointer to interframe parameters structure
*/
inline
struct
interframe_params_t
*
updateIRQ_interframe
(
void
)
{
inline
struct
interframe_params_t
*
updateIRQ_interframe
(
struct
jpeg_ptr_t
*
jptr
)
{
int
circbuf_size
=
get_globalParam
(
G_CIRCBUFSIZE
)
>>
2
;
int
alen
=
JPEG_wp
-
9
;
if
(
alen
<
0
)
alen
+=
circbuf_size
;
int
jpeg_len
=
ccam_dma_buf_ptr
[
alen
]
&
0xffffff
;
...
...
@@ -448,9 +456,9 @@ static irqreturn_t compressor_irq_handler(int irq, void *dev_id)
x393_cmprs_interrupts_t
irq_ctrl
;
if
(
updateIRQJPEG_wp
(
priv
))
{
/*
update_irq_circbuf(priv);
updateIRQFocus();
interframe = updateIRQ_interframe();
update_irq_circbuf
(
priv
);
updateIRQFocus
(
priv
);
/*
interframe = updateIRQ_interframe();
updateIRQ_Exif(interframe);
wake_up_interruptible(&circbuf_wait_queue);*/
}
...
...
@@ -496,7 +504,35 @@ void tasklet_fpga_function(unsigned long arg) {
unsigned
long
*
hash32p
=&
(
framepars
[(
thisFrameNumber
-
1
)
&
PARS_FRAMES_MASK
].
pars
[
P_GTAB_R
]);
unsigned
long
*
framep
=
&
(
framepars
[(
thisFrameNumber
-
1
)
&
PARS_FRAMES_MASK
].
pars
[
P_FRAME
]);
dump_priv_data
(
0
);
int
i
,
j
;
int
last_image_chunk
;
int
len32
;
int
circbuf_size
=
get_globalParam
(
G_CIRCBUFSIZE
);
unsigned
long
*
buf_ptr
;
printk
(
KERN_DEBUG
"%s: get_globalParam(G_CIRCBUFSIZE) = %d"
,
__func__
,
circbuf_size
);
//dump_priv_data(0);
for
(
i
=
0
;
i
<
IMAGE_CHN_NUM
;
i
++
)
{
printk
(
KERN_DEBUG
"%s: checking channel %d
\n
"
,
__func__
,
i
);
if
(
image_acq_priv
.
jpeg_ptr
[
i
].
flags
&
SENS_FLAG_IRQ
)
{
dump_priv_data
(
i
);
last_image_chunk
=
image_acq_priv
.
jpeg_ptr
[
i
].
jpeg_wp
-
OFFSET_X40
;
if
(
last_image_chunk
<
0
)
last_image_chunk
+=
circbuf_size
;
len32
=
ccam_dma_buf_ptr
[(
last_image_chunk
+
(
0x20
-
CCAM_MMAP_META_LENGTH
)
+
0x100000
)
>>
2
];
buf_ptr
=
&
ccam_dma_buf_ptr
[(
last_image_chunk
+
0x100000
)
>>
2
];
for
(
j
=
0
;
j
<
(
OFFSET_X40
>>
2
);
j
++
)
{
printk
(
KERN_DEBUG
"0x%x: 0x%x
\n
"
,
last_image_chunk
+
j
,
buf_ptr
[
j
]);
}
printk
(
KERN_DEBUG
"circbuffer start address: 0x%x"
,
ccam_dma_buf_ptr
);
printk
(
KERN_DEBUG
"last_image_chunk: 0x%x
\n
"
,
last_image_chunk
);
dev_dbg
(
NULL
,
"0x40 bytes of mem dump from last image chunk:
\n
"
);
print_hex_dump_bytes
(
""
,
DUMP_PREFIX_NONE
,
(
void
*
)
buf_ptr
,
OFFSET_X40
);
printk
(
KERN_DEBUG
"%s: reading image length, channel %d; len32 0x%x
\n
"
,
__func__
,
i
,
len32
);
image_acq_priv
.
jpeg_ptr
[
i
].
flags
&=
(
~
SENS_FLAG_IRQ
)
&
0xffffffff
;
}
}
#ifdef TEST_DISABLE_CODE
/// Time is out?
...
...
src/drivers/elphel/sensor_common.h
View file @
e23e383a
...
...
@@ -16,7 +16,7 @@ int camSeqGetJPEG_wp(void);
int
camSeqGetJPEG_rp
(
void
);
void
camSeqSetJPEG_rp
(
int
p
);
///CIRCBUF macros
//
extern unsigned long * ccam_dma_buf_ptr;
extern
unsigned
long
*
ccam_dma_buf_ptr
;
/* move these lines to x313_macro.h
#define X313_LENGTH_MASK 0xff000000
...
...
@@ -47,4 +47,9 @@ struct sensorproc_t * copy_sensorproc (struct sensorproc_t * copy);
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment