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
b2b0813b
Commit
b2b0813b
authored
Aug 26, 2016
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more debugging
parent
b049b19c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
119 additions
and
25 deletions
+119
-25
debug393.h
src/drivers/elphel/debug393.h
+7
-1
framepars.c
src/drivers/elphel/framepars.c
+23
-7
pgm_functions.c
src/drivers/elphel/pgm_functions.c
+32
-13
sensor_common.c
src/drivers/elphel/sensor_common.c
+7
-1
x393_fpga_functions.c
src/drivers/elphel/x393_fpga_functions.c
+45
-0
x393_videomem.c
src/drivers/elphel/x393_videomem.c
+5
-3
No files found.
src/drivers/elphel/debug393.h
View file @
b2b0813b
...
@@ -34,6 +34,9 @@
...
@@ -34,6 +34,9 @@
#define DBGB_PADD 11 ///< additional details
#define DBGB_PADD 11 ///< additional details
// x393_vidoemem.c
// x393_vidoemem.c
#define DBGB_VM 12 ///< vidoemem all debug
#define DBGB_VM 12 ///< vidoemem all debug
#define DBGB_SCRST 13 ///< vidoemem all debug
// 13
// 13
// 14
// 14
// 15
// 15
...
@@ -58,6 +61,8 @@
...
@@ -58,6 +61,8 @@
#include "klogger_393.h"
#include "klogger_393.h"
#include "framepars.h" // for aglobals
#include "framepars.h" // for aglobals
#include "sensor_common.h"// for int getHardFrameNumber(int sensor_port, int use_compressor);
#ifndef ELPHEL_DEBUG393
#ifndef ELPHEL_DEBUG393
#define ELPHEL_DEBUG393 1
#define ELPHEL_DEBUG393 1
#if ELPHEL_DEBUG393
#if ELPHEL_DEBUG393
...
@@ -65,7 +70,8 @@
...
@@ -65,7 +70,8 @@
/// log unconditionally, for any channel
/// log unconditionally, for any channel
#define MDG(...) print_klog393(klog_mode, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__);
#define MDG(...) print_klog393(klog_mode, __FILE__, __FUNCTION__, __LINE__, __VA_ARGS__);
/// log only if specified bit in G_DEBUG global parameter for the specified sensor port is set
/// log only if specified bit in G_DEBUG global parameter for the specified sensor port is set
#define MDP(bit,port,fmt,...) { if (GLOBALPARS(port,G_DEBUG) & (1 << bit)) print_klog393(klog_mode, __FILE__, __FUNCTION__, __LINE__,"%d: "fmt,port,__VA_ARGS__); }
// #define MDP(bit,port,fmt,...) { if (GLOBALPARS(port,G_DEBUG) & (1 << bit)) print_klog393(klog_mode, __FILE__, __FUNCTION__, __LINE__,"%d: "fmt,port,__VA_ARGS__); }
#define MDP(bit,port,fmt,...) { if (GLOBALPARS(port,G_DEBUG) & (1 << bit)) print_klog393(klog_mode, __FILE__, __FUNCTION__, __LINE__,"%d:%d "fmt,port,getHardFrameNumber(port, 0),__VA_ARGS__); }
#else
#else
#define MDF(x)
#define MDF(x)
#define MDP(bit,port,fmt,...)
#define MDP(bit,port,fmt,...)
...
...
src/drivers/elphel/framepars.c
View file @
b2b0813b
...
@@ -1019,6 +1019,9 @@ int setFrameParsAtomic(int sensor_port, ///< sensor port number (0
...
@@ -1019,6 +1019,9 @@ int setFrameParsAtomic(int sensor_port, ///< sensor port number (0
struct
framepars_t
*
framepars
=
aframepars
[
sensor_port
];
struct
framepars_t
*
framepars
=
aframepars
[
sensor_port
];
unsigned
long
*
funcs2call
=
afuncs2call
[
sensor_port
];
unsigned
long
*
funcs2call
=
afuncs2call
[
sensor_port
];
int
findex_this
,
findex_prev
,
findex_future
,
frame16
;
int
findex_this
,
findex_prev
,
findex_future
,
frame16
;
findex_this
=
thisFrameNumber
(
sensor_port
)
&
PARS_FRAMES_MASK
;
findex_prev
=
(
findex_this
-
1
)
&
PARS_FRAMES_MASK
;
findex_future
=
(
findex_this
-
2
)
&
PARS_FRAMES_MASK
;
// actually - fartherst in the future??
MDP
(
DBGB_FSFA
,
sensor_port
,
"frameno=0x%lx, findex_this=%ld (0x%lx) maxLatency=%d, numPars=%d, frameParsInitialized[%d]=%d
\n
"
,
MDP
(
DBGB_FSFA
,
sensor_port
,
"frameno=0x%lx, findex_this=%ld (0x%lx) maxLatency=%d, numPars=%d, frameParsInitialized[%d]=%d
\n
"
,
frameno
,
findex_this
,
thisFrameNumber
(
sensor_port
),
maxLatency
,
numPars
,
sensor_port
,
frameParsInitialized
[
sensor_port
])
frameno
,
findex_this
,
thisFrameNumber
(
sensor_port
),
maxLatency
,
numPars
,
sensor_port
,
frameParsInitialized
[
sensor_port
])
dev_dbg
(
g_devfp_ptr
,
"port= %d, frameno=0x%lx, findex_this=%d (0x%lx) maxLatency=%d, numPars=%d, frameParsInitialized[%d]=%d
\n
"
,
dev_dbg
(
g_devfp_ptr
,
"port= %d, frameno=0x%lx, findex_this=%d (0x%lx) maxLatency=%d, numPars=%d, frameParsInitialized[%d]=%d
\n
"
,
...
@@ -1028,9 +1031,6 @@ int setFrameParsAtomic(int sensor_port, ///< sensor port number (0
...
@@ -1028,9 +1031,6 @@ int setFrameParsAtomic(int sensor_port, ///< sensor port number (0
if
(
!
frameParsInitialized
[
sensor_port
])
{
if
(
!
frameParsInitialized
[
sensor_port
])
{
initSequencers
(
sensor_port
);
// Will call initFramePars(); and initialize functions
initSequencers
(
sensor_port
);
// Will call initFramePars(); and initialize functions
}
}
findex_this
=
thisFrameNumber
(
sensor_port
)
&
PARS_FRAMES_MASK
;
findex_prev
=
(
findex_this
-
1
)
&
PARS_FRAMES_MASK
;
findex_future
=
(
findex_this
-
2
)
&
PARS_FRAMES_MASK
;
// actually - fartherst in the future??
LOCK_IBH
(
framepars_locks
[
sensor_port
]);
LOCK_IBH
(
framepars_locks
[
sensor_port
]);
PROFILE_NOW
(
5
);
// Was 6, but no 7 in NC393
PROFILE_NOW
(
5
);
// Was 6, but no 7 in NC393
if
(
maxLatency
>=
0
)
{
if
(
maxLatency
>=
0
)
{
...
@@ -1054,7 +1054,9 @@ int setFrameParsAtomic(int sensor_port, ///< sensor port number (0
...
@@ -1054,7 +1054,9 @@ int setFrameParsAtomic(int sensor_port, ///< sensor port number (0
}
}
// not too late, not too early, go ahead (or maxlatency <0 - ASAP only)
// not too late, not too early, go ahead (or maxlatency <0 - ASAP only)
for
(
npar
=
0
;
npar
<
numPars
;
npar
++
)
{
for
(
npar
=
0
;
npar
<
numPars
;
npar
++
)
{
dev_dbg
(
g_devfp_ptr
,
"port= %d, --pars[%d].num=0x%lx, pars[%d].val=0x%lx"
,
sensor_port
,
npar
,
pars
[
npar
].
num
,
npar
,
pars
[
npar
].
val
);
dev_dbg
(
g_devfp_ptr
,
"port= %d, --pars[%d].num=0x%lx, pars[%d].val=0x%lx
\n
"
,
sensor_port
,
npar
,
pars
[
npar
].
num
,
npar
,
pars
[
npar
].
val
);
MDP
(
DBGB_FSFA
,
sensor_port
,
" --pars[%d].num=0x%lx, pars[%d].val=0x%lx
\n
"
,
npar
,
pars
[
npar
].
num
,
npar
,
pars
[
npar
].
val
)
// frame16= (pars[npar].num & FRAMEPAR_GLOBALS)? -1: (frameno & PARS_FRAMES_MASK);
// frame16= (pars[npar].num & FRAMEPAR_GLOBALS)? -1: (frameno & PARS_FRAMES_MASK);
frame16
=
frameno
&
PARS_FRAMES_MASK
;
frame16
=
frameno
&
PARS_FRAMES_MASK
;
val
=
pars
[
npar
].
val
;
val
=
pars
[
npar
].
val
;
...
@@ -1081,6 +1083,8 @@ int setFrameParsAtomic(int sensor_port, ///< sensor port number (0
...
@@ -1081,6 +1083,8 @@ int setFrameParsAtomic(int sensor_port, ///< sensor port number (0
}
}
//TODO: optimize to use mask several parameters together
//TODO: optimize to use mask several parameters together
dev_dbg
(
g_devfp_ptr
,
"port= %d, frame16=0x%x
\n
"
,
sensor_port
,
frame16
);
dev_dbg
(
g_devfp_ptr
,
"port= %d, frame16=0x%x
\n
"
,
sensor_port
,
frame16
);
MDP
(
DBGB_FSFA
,
sensor_port
,
"framepars[%d].pars[%d]=0x%lx =?= val = 0x%lx, pars[%d].num=0x%08lx & 0x%08x
\n
"
,
frame16
,
index
,
framepars
[
frame16
].
pars
[
index
],
val
,
npar
,
pars
[
npar
].
num
,
FRAMEPAIR_FORCE_NEW
)
if
((
framepars
[
frame16
].
pars
[
index
]
!=
val
)
||
(
pars
[
npar
].
num
&
FRAMEPAIR_FORCE_NEW
))
{
if
((
framepars
[
frame16
].
pars
[
index
]
!=
val
)
||
(
pars
[
npar
].
num
&
FRAMEPAIR_FORCE_NEW
))
{
bmask
=
1
<<
(
index
&
31
);
bmask
=
1
<<
(
index
&
31
);
bindex
=
index
>>
5
;
bindex
=
index
>>
5
;
...
@@ -1090,15 +1094,24 @@ int setFrameParsAtomic(int sensor_port, ///< sensor port number (0
...
@@ -1090,15 +1094,24 @@ int setFrameParsAtomic(int sensor_port, ///< sensor port number (0
framepars
[
frame16
].
mod
[
bindex
]
|=
bmask
;
framepars
[
frame16
].
mod
[
bindex
]
|=
bmask
;
framepars
[
frame16
].
mod32
|=
bmask32
;
framepars
[
frame16
].
mod32
|=
bmask32
;
framepars
[
frame16
].
functions
|=
funcs2call
[
index
];
//Mark which functions will be needed to process the parameters
framepars
[
frame16
].
functions
|=
funcs2call
[
index
];
//Mark which functions will be needed to process the parameters
dev_dbg
(
g_devfp_ptr
,
"port= %d, bindex=0x%x, bmask=0x%08lx, bmask32=0x%08lx, functions=0x%08lx
\n
"
,
sensor_port
,
bindex
,
bmask
,
bmask32
,
framepars
[
frame16
].
functions
);
dev_dbg
(
g_devfp_ptr
,
"port= %d, bindex=0x%x, bmask=0x%08lx, bmask32=0x%08lx, functions=0x%08lx
\n
"
,
sensor_port
,
bindex
,
bmask
,
bmask32
,
framepars
[
frame16
].
functions
);
MDP
(
DBGB_FSFA
,
sensor_port
,
"bindex=0x%x, bmask=0x%08lx, bmask32=0x%08lx, functions=0x%08lx
\n
"
,
bindex
,
bmask
,
bmask32
,
framepars
[
frame16
].
functions
)
// Write parameter to the next frames up to the one that have the same parameter already modified (only if not FRAMEPAIR_JUST_THIS)
// Write parameter to the next frames up to the one that have the same parameter already modified (only if not FRAMEPAIR_JUST_THIS)
if
((
pars
[
npar
].
num
&
FRAMEPAIR_JUST_THIS
)
==
0
)
{
if
((
pars
[
npar
].
num
&
FRAMEPAIR_JUST_THIS
)
==
0
)
{
dev_dbg
(
g_devfp_ptr
,
"port= %d, --- setting next frames
\n
"
,
sensor_port
);
dev_dbg
(
g_devfp_ptr
,
"port= %d, --- setting next frames, pars[%d].num=0x%lx
\n
"
,
sensor_port
,
npar
,
pars
[
npar
].
num
);
MDP
(
DBGB_FSFA
,
sensor_port
,
" --- setting next frames, pars[%d].num=0x%lx
\n
"
,
npar
,
pars
[
npar
].
num
)
for
(
nframe
=
(
frame16
+
1
)
&
PARS_FRAMES_MASK
;
(
nframe
!=
findex_prev
)
&&
(
!
(
framepars
[
nframe
].
mod
[
bindex
]
&
bmask
));
nframe
=
(
nframe
+
1
)
&
PARS_FRAMES_MASK
)
{
for
(
nframe
=
(
frame16
+
1
)
&
PARS_FRAMES_MASK
;
(
nframe
!=
findex_prev
)
&&
(
!
(
framepars
[
nframe
].
mod
[
bindex
]
&
bmask
));
nframe
=
(
nframe
+
1
)
&
PARS_FRAMES_MASK
)
{
framepars
[
nframe
].
pars
[
index
]
=
val
;
framepars
[
nframe
].
pars
[
index
]
=
val
;
dev_dbg
(
g_devfp_ptr
,
"port= %d, %d"
,
sensor_port
,
nframe
);
dev_dbg
(
g_devfp_ptr
,
"framepars[%d].pars[%d] <- 0x%08x "
,
nframe
,
index
,
val
);
MDP
(
DBGB_FSFA
,
sensor_port
,
"framepars[%d].pars[%d] <- 0x%08x "
,
nframe
,
index
,
val
)
}
}
frame16
=
(
frame16
-
1
)
&
PARS_FRAMES_MASK
;
// for " regular parameters "modified since" do not include the target frame itself, for "JUST_THIS" - does
frame16
=
(
frame16
-
1
)
&
PARS_FRAMES_MASK
;
// for " regular parameters "modified since" do not include the target frame itself, for "JUST_THIS" - does
dev_dbg
(
g_devfp_ptr
,
"
\n
"
);
MDP
(
DBGB_FSFA
,
sensor_port
,
"%s
\n
"
,
""
)
// D5(printk("\n"));
// D5(printk("\n"));
}
}
// Mark this parameter in all previous frames as "modified since"
// Mark this parameter in all previous frames as "modified since"
...
@@ -1106,7 +1119,10 @@ int setFrameParsAtomic(int sensor_port, ///< sensor port number (0
...
@@ -1106,7 +1119,10 @@ int setFrameParsAtomic(int sensor_port, ///< sensor port number (0
for
(
nframe
=
frame16
;
nframe
!=
findex_future
;
nframe
=
(
nframe
-
1
)
&
PARS_FRAMES_MASK
)
{
//NOTE: frame16 is modified here
for
(
nframe
=
frame16
;
nframe
!=
findex_future
;
nframe
=
(
nframe
-
1
)
&
PARS_FRAMES_MASK
)
{
//NOTE: frame16 is modified here
framepars
[
nframe
].
modsince
[
bindex
]
|=
bmask
;
framepars
[
nframe
].
modsince
[
bindex
]
|=
bmask
;
framepars
[
nframe
].
modsince32
|=
bmask32
;
framepars
[
nframe
].
modsince32
|=
bmask32
;
MDP
(
DBGB_FSFA
,
sensor_port
,
"framepars[%d].modsince[%d] |= 0x%08x, framepars[%d].modsince32 |= 0x%08x "
,
nframe
,
bindex
,
bmask
,
nframe
,
bmask32
)
}
}
MDP
(
DBGB_FSFA
,
sensor_port
,
"%s
\n
"
,
""
)
}
}
}
else
{
// error - trying to write "just this" to the "future" - that would stick if allowed
}
else
{
// error - trying to write "just this" to the "future" - that would stick if allowed
UNLOCK_IBH
(
framepars_locks
[
sensor_port
]);
UNLOCK_IBH
(
framepars_locks
[
sensor_port
]);
...
...
src/drivers/elphel/pgm_functions.c
View file @
b2b0813b
...
@@ -1473,10 +1473,12 @@ int pgm_sensorrun (int sensor_port, ///< sensor port number (0..3
...
@@ -1473,10 +1473,12 @@ int pgm_sensorrun (int sensor_port, ///< sensor port number (0..3
dev_dbg
(
g_dev_ptr
,
"{%d} frame16=%d
\n
"
,
sensor_port
,
frame16
);
dev_dbg
(
g_dev_ptr
,
"{%d} frame16=%d
\n
"
,
sensor_port
,
frame16
);
MDP
(
DBGB_PSFN
,
sensor_port
,
"frame16=%d
\n
"
,
frame16
)
MDP
(
DBGB_PSFN
,
sensor_port
,
"frame16=%d
\n
"
,
frame16
)
if
(
frame16
>=
PARS_FRAMES
)
return
-
EINVAL
;
// wrong frame
if
(
frame16
>=
PARS_FRAMES
)
return
-
EINVAL
;
// wrong frame
control_sensor_memory
(
sensor_port
,
if
(
thispars
->
pars
[
P_SENSOR_RUN
]
&
3
)
{
thispars
->
pars
[
P_SENSOR_RUN
]
&
3
,
control_sensor_memory
(
sensor_port
,
(
frame16
<
0
)
?
ASAP
:
ABSOLUTE
,
// how to apply commands - directly or through channel sequencer
thispars
->
pars
[
P_SENSOR_RUN
]
&
3
,
frame16
);
(
frame16
<
0
)
?
ASAP
:
ABSOLUTE
,
// how to apply commands - directly or through channel sequencer
frame16
);
}
// Is it OK to process stop here too?
// Is it OK to process stop here too?
return
0
;
return
0
;
/*
/*
...
@@ -1522,10 +1524,12 @@ int pgm_sensorstop (int sensor_port, ///< sensor port number (0..3
...
@@ -1522,10 +1524,12 @@ int pgm_sensorstop (int sensor_port, ///< sensor port number (0..3
MDP
(
DBGB_PSFN
,
sensor_port
,
"frame16=%d
\n
"
,
frame16
)
MDP
(
DBGB_PSFN
,
sensor_port
,
"frame16=%d
\n
"
,
frame16
)
if
(
frame16
>=
PARS_FRAMES
)
return
-
EINVAL
;
// wrong frame
if
(
frame16
>=
PARS_FRAMES
)
return
-
EINVAL
;
// wrong frame
// Do we need to filter for stop only ( if ((thispars->pars[P_SENSOR_RUN] & 3)==0){... ) ?
// Do we need to filter for stop only ( if ((thispars->pars[P_SENSOR_RUN] & 3)==0){... ) ?
control_sensor_memory
(
sensor_port
,
if
((
thispars
->
pars
[
P_SENSOR_RUN
]
&
3
)
==
0
){
thispars
->
pars
[
P_SENSOR_RUN
]
&
3
,
control_sensor_memory
(
sensor_port
,
(
frame16
<
0
)
?
ASAP
:
ABSOLUTE
,
// how to apply commands - directly or through channel sequencer
thispars
->
pars
[
P_SENSOR_RUN
]
&
3
,
frame16
);
(
frame16
<
0
)
?
ASAP
:
ABSOLUTE
,
// how to apply commands - directly or through channel sequencer
frame16
);
}
return
0
;
return
0
;
#else
#else
int
fpga_data
=
0
;
int
fpga_data
=
0
;
...
@@ -1900,15 +1904,22 @@ int pgm_memcompressor (int sensor_port, ///< sensor port number (
...
@@ -1900,15 +1904,22 @@ int pgm_memcompressor (int sensor_port, ///< sensor port number (
#ifndef NC353
#ifndef NC353
int
width_marg
,
height_marg
;
int
width_marg
,
height_marg
;
int
overlap
=
0
;
// tile overlap (total - 2 for JPEG18, 4 - for JPEG20, 0 otherwise
int
overlap
=
0
;
// tile overlap (total - 2 for JPEG18, 4 - for JPEG20, 0 otherwise
int
width_bursts
;
int
width_bursts
;
// width in 16-pixel bursts
int
cmprs_top
=
0
;
// 1 for JPEG18 only, 0 for others
int
cmprs_top
=
0
;
// 1 for JPEG18 only, 0 for others
(also is used for compressor left)
int
tile_width
;
// in bursts, 2 for those with overlap (height>16), 4 with heigh==16
int
tile_width
;
// in bursts, 2 for those with overlap (height>16), 4 with heigh==16
int
tile_height
;
// 16/18 (20 not yet implemented)
int
tile_height
;
// 16/18 (20 not yet implemented)
x393_cmprs_frame_format_t
cmprs_frame_format
=
{.
d32
=
0
};
dev_dbg
(
g_dev_ptr
,
"{%d} frame16=%d
\n
"
,
sensor_port
,
frame16
);
dev_dbg
(
g_dev_ptr
,
"{%d} frame16=%d
\n
"
,
sensor_port
,
frame16
);
MDP
(
DBGB_PSFN
,
sensor_port
,
"frame16=%d
\n
"
,
frame16
)
MDP
(
DBGB_PSFN
,
sensor_port
,
"frame16=%d
\n
"
,
frame16
)
if
(
frame16
>=
PARS_FRAMES
)
return
-
1
;
// wrong frame
if
(
frame16
>=
PARS_FRAMES
)
return
-
1
;
// wrong frame
width_marg
=
thispars
->
pars
[
P_ACTUAL_WIDTH
];
width_marg
=
thispars
->
pars
[
P_ACTUAL_WIDTH
];
height_marg
=
thispars
->
pars
[
P_ACTUAL_WIDTH
];
height_marg
=
thispars
->
pars
[
P_ACTUAL_WIDTH
];
// NC393: maybe add later monochrome mode with small tiles?
cmprs_frame_format
.
num_macro_cols_m1
=
(
width_marg
>>
4
)
-
1
;
// before adding margins
cmprs_frame_format
.
num_macro_rows_m1
=
(
height_marg
>>
4
)
-
1
;
// before adding margins;
switch
(
thispars
->
pars
[
P_COLOR
]){
switch
(
thispars
->
pars
[
P_COLOR
]){
case
COLORMODE_COLOR
:
case
COLORMODE_COLOR
:
overlap
=
2
;
overlap
=
2
;
...
@@ -1927,6 +1938,8 @@ int pgm_memcompressor (int sensor_port, ///< sensor port number (
...
@@ -1927,6 +1938,8 @@ int pgm_memcompressor (int sensor_port, ///< sensor port number (
}
else
{
}
else
{
tile_width
=
4
;
tile_width
=
4
;
}
}
cmprs_frame_format
.
left_margin
=
cmprs_top
;
// same as top - only for 18x18 tiles to keep Bayer shift (0/1)
width_bursts
=
(
width_marg
>>
4
)
+
((
width_marg
&
0xf
)
?
1
:
0
);
width_bursts
=
(
width_marg
>>
4
)
+
((
width_marg
&
0xf
)
?
1
:
0
);
// Adjusting for tile width. TODO: probably not needed, handled in FPGA - verify (and remove 2 next lines)
// Adjusting for tile width. TODO: probably not needed, handled in FPGA - verify (and remove 2 next lines)
if
(
width_bursts
&
1
)
width_bursts
++
;
if
(
width_bursts
&
1
)
width_bursts
++
;
...
@@ -1944,6 +1957,7 @@ int pgm_memcompressor (int sensor_port, ///< sensor port number (
...
@@ -1944,6 +1957,7 @@ int pgm_memcompressor (int sensor_port, ///< sensor port number (
(
frame16
<
0
)
?
ASAP
:
ABSOLUTE
,
// how to apply commands - directly or through channel sequencer
(
frame16
<
0
)
?
ASAP
:
ABSOLUTE
,
// how to apply commands - directly or through channel sequencer
frame16
);
// Frame number the command should be applied to (if not immediate mode)
frame16
);
// Frame number the command should be applied to (if not immediate mode)
X393_SEQ_SEND1
(
sensor_port
,
frame16
,
x393_cmprs_format
,
cmprs_frame_format
);
return
0
;
return
0
;
// TODO: Do we need to maintain P_IMGSZMEM ?
// TODO: Do we need to maintain P_IMGSZMEM ?
// #define P_PAGE_ACQ 18 ///< Number of image page buffer to acquire to (0.1?)
// #define P_PAGE_ACQ 18 ///< Number of image page buffer to acquire to (0.1?)
...
@@ -2541,7 +2555,11 @@ int pgm_comprestart(int sensor_port, ///< sensor port number (0..3
...
@@ -2541,7 +2555,11 @@ int pgm_comprestart(int sensor_port, ///< sensor port number (0..3
MDP
(
DBGB_PSFN
,
sensor_port
,
"frame16=%d
\n
"
,
frame16
)
MDP
(
DBGB_PSFN
,
sensor_port
,
"frame16=%d
\n
"
,
frame16
)
if
(
frame16
>=
PARS_FRAMES
)
return
-
1
;
// wrong frame
if
(
frame16
>=
PARS_FRAMES
)
return
-
1
;
// wrong frame
// does it need to be be started (nothing do be done to stop)
// does it need to be be started (nothing do be done to stop)
if
(
thispars
->
pars
[
P_COMPRESSOR_RUN
]
==
0
)
return
0
;
// does not need compressor to be started
if
(
thispars
->
pars
[
P_COMPRESSOR_RUN
]
==
0
)
{
MDP
(
DBGB_PADD
,
sensor_port
,
"thispars->pars[P_COMPRESSOR_RUN] = %d, does not need compressor to be started
\n
"
,
(
int
)
thispars
->
pars
[
P_COMPRESSOR_RUN
])
return
0
;
// does not need compressor to be started
}
// NC393: memory controller already set by pgm_memcompressor, but we'll need to setup dependent/from memory here
// NC393: memory controller already set by pgm_memcompressor, but we'll need to setup dependent/from memory here
switch
(
thispars
->
pars
[
P_COLOR
]){
switch
(
thispars
->
pars
[
P_COLOR
]){
case
COLORMODE_COLOR
:
case
COLORMODE_COLOR
:
...
@@ -2690,7 +2708,7 @@ int pgm_compctl (int sensor_port, ///< sensor port number (0..3
...
@@ -2690,7 +2708,7 @@ int pgm_compctl (int sensor_port, ///< sensor port number (0..3
extra_pages
=
0
;
extra_pages
=
0
;
}
}
control_compressor_memory
(
sensor_port
,
control_compressor_memory
(
sensor_port
,
thispars
->
pars
[
P_
SEN
SOR_RUN
]
&
3
,
// stop/single/run(/reset)
thispars
->
pars
[
P_
COMPRES
SOR_RUN
]
&
3
,
// stop/single/run(/reset)
extra_pages
,
extra_pages
,
disable_need
,
disable_need
,
(
frame16
<
0
)
?
ASAP
:
ABSOLUTE
,
// how to apply commands - directly or through channel sequencer
(
frame16
<
0
)
?
ASAP
:
ABSOLUTE
,
// how to apply commands - directly or through channel sequencer
...
@@ -2702,12 +2720,13 @@ int pgm_compctl (int sensor_port, ///< sensor port number (0..3
...
@@ -2702,12 +2720,13 @@ int pgm_compctl (int sensor_port, ///< sensor port number (0..3
break
;
break
;
case
COMPRESSOR_RUN_SINGLE
:
case
COMPRESSOR_RUN_SINGLE
:
case
COMPRESSOR_RUN_CONT
:
case
COMPRESSOR_RUN_CONT
:
cmprs_mode
.
run
=
((
thispars
->
pars
[
P_
SENSOR_RUN
]
&
3
)
==
SEN
SOR_RUN_CONT
)
?
X393_CMPRS_CBIT_RUN_ENABLE
:
X393_CMPRS_CBIT_RUN_STANDALONE
;
cmprs_mode
.
run
=
((
thispars
->
pars
[
P_
COMPRESSOR_RUN
]
&
3
)
==
COMPRES
SOR_RUN_CONT
)
?
X393_CMPRS_CBIT_RUN_ENABLE
:
X393_CMPRS_CBIT_RUN_STANDALONE
;
break
;
break
;
}
}
cmprs_mode
.
run_set
=
1
;
cmprs_mode
.
run_set
=
1
;
X393_SEQ_SEND1
(
sensor_port
,
frame16
,
x393_cmprs_control_reg
,
cmprs_mode
);
X393_SEQ_SEND1
(
sensor_port
,
frame16
,
x393_cmprs_control_reg
,
cmprs_mode
);
dev_dbg
(
g_dev_ptr
,
"{%d} X393_SEQ_SEND1(0x%x, 0x%x, x393_cmprs_control_reg, 0x%x)
\n
"
,
sensor_port
,
sensor_port
,
frame16
,
cmprs_mode
.
d32
);
dev_dbg
(
g_dev_ptr
,
"{%d} X393_SEQ_SEND1(0x%x, 0x%x, x393_cmprs_control_reg, 0x%x)
\n
"
,
sensor_port
,
sensor_port
,
frame16
,
cmprs_mode
.
d32
);
MDP
(
DBGB_PADD
,
sensor_port
,
"X393_SEQ_SEND1(0x%x, 0x%x, x393_cmprs_control_reg, 0x%x)
\n
"
,
sensor_port
,
frame16
,
cmprs_mode
.
d32
)
return
0
;
return
0
;
#else
#else
...
...
src/drivers/elphel/sensor_common.c
View file @
b2b0813b
...
@@ -52,6 +52,9 @@
...
@@ -52,6 +52,9 @@
#include <asm/delay.h> // just for usleep1000()
#include <asm/delay.h> // just for usleep1000()
// NC393 debug macros
#include "debug393.h"
/* Driver name to display in log messages.*/
/* Driver name to display in log messages.*/
//#define IMAGEACQ_DRIVER_DESCRIPTION "Elphel (R) Model 393 Image Acquisition device driver"
//#define IMAGEACQ_DRIVER_DESCRIPTION "Elphel (R) Model 393 Image Acquisition device driver"
...
@@ -956,7 +959,7 @@ int sequencer_stop_run_reset(int chn, ///< Sensor port
...
@@ -956,7 +959,7 @@ int sequencer_stop_run_reset(int chn, ///< Sensor port
{
{
x393_cmdframeseq_mode_t
cmdframeseq_mode
=
{.
d32
=
0
};
x393_cmdframeseq_mode_t
cmdframeseq_mode
=
{.
d32
=
0
};
x393_status_ctrl_t
status_ctrl
=
{.
d32
=
0
};
x393_status_ctrl_t
status_ctrl
=
{.
d32
=
0
};
MDP
(
DBGB_SCRST
,
chn
,
"cmd = %d
\n
"
,
cmd
)
switch
(
cmd
){
switch
(
cmd
){
case
SEQ_CMD_STOP
:
case
SEQ_CMD_STOP
:
cmdframeseq_mode
.
run_cmd
=
2
;
cmdframeseq_mode
.
run_cmd
=
2
;
...
@@ -974,6 +977,9 @@ int sequencer_stop_run_reset(int chn, ///< Sensor port
...
@@ -974,6 +977,9 @@ int sequencer_stop_run_reset(int chn, ///< Sensor port
udelay
(
1
);
udelay
(
1
);
if
(
status_ctrl
.
mode
)
if
(
status_ctrl
.
mode
)
set_x393_cmdseqmux_status_ctrl
(
status_ctrl
);
set_x393_cmdseqmux_status_ctrl
(
status_ctrl
);
// debug
udelay
(
1
);
MDP
(
DBGB_SCRST
,
chn
,
"status_ctrl.d32 = 0x%x
\n
"
,
status_ctrl
.
d32
)
return
0
;
return
0
;
}
}
...
...
src/drivers/elphel/x393_fpga_functions.c
View file @
b2b0813b
...
@@ -37,6 +37,51 @@ int init_command_sequencer(int sensor_port)
...
@@ -37,6 +37,51 @@ int init_command_sequencer(int sensor_port)
return 0;
return 0;
}
}
#endif
#endif
int
compressor_dma_setup
(
int
port_afi
,
///< number of AFI port (0 - afi 1, 1 - afi2) (currently only 0 is routed)
int
chn_mask
,
///< compressor channels to use, bitmask
int
status_mode
,
///< status update mode status mode (3 for auto)
int
report_mode
,
///< readback mode:
///< * 0 - show EOF pointer, internal
///< * 1 - show EOF pointer, confirmed written to the system memory
///< * 2 - show show current pointer, internal (debug mode)
///< * 3 - show current pointer, confirmed written to the system memory (debug mode)
u32
cmprs0_sa
,
///< input channel 0 start address, 32-bytes aligned
u32
cmprs0_len
,
///< input channel 0 buffer length, 32-byte aligned
u32
cmprs1_sa
,
///< input channel 1 start address, 32-bytes aligned
u32
cmprs1_len
,
///< input channel 1 buffer length, 32-byte aligned
u32
cmprs2_sa
,
///< input channel 2 start address, 32-bytes aligned
u32
cmprs2_len
,
///< input channel 2 buffer length, 32-byte aligned
u32
cmprs3_sa
,
///< input channel 3 start address, 32-bytes aligned
u32
cmprs3_len
)
///< input channel 3 buffer length, 32-byte aligned
{
if
((
cmprs0_sa
|
cmprs0_len
|
cmprs1_sa
|
cmprs1_len
|
cmprs2_sa
|
cmprs2_len
|
cmprs3_sa
|
cmprs3_len
)
&
0x1f
){
return
-
EINVAL
;
}
return
0
;
}
/*
Set mode of selected input channel of the selected AFI multiplexer
@param port_afi - number of AFI port (0 - afi 1, 1 - afi2)
@param chn - number of afi input channel to program
@param status_mode - status mode (3 for auto)
@param report_mode - readback mode:
mode == 0 - show EOF pointer, internal
mode == 1 - show EOF pointer, confirmed written to the system memory
mode == 2 - show current pointer, internal
mode == 3 - show current pointer, confirmed written to the system memory
@param afi_cmprs0_sa - input channel 0 start address in 32-byte chunks
@param afi_cmprs0_len - input channel 0 buffer length in 32-byte chunks
@param afi_cmprs1_sa - input channel 0 start address in 32-byte chunks
@param afi_cmprs1_len - input channel 0 buffer length in 32-byte chunks
@param afi_cmprs2_sa - input channel 0 start address in 32-byte chunks
@param afi_cmprs2_len - input channel 0 buffer length in 32-byte chunks
@param afi_cmprs3_sa - input channel 0 start address in 32-byte chunks
@param afi_cmprs3_len - input channel 0 buffer length in 32-byte chunks
@param verbose - verbose level
*/
/** Read time (seconds and microseconds) from the FPGA RTC */
/** Read time (seconds and microseconds) from the FPGA RTC */
sec_usec_t
*
get_fpga_rtc
(
sec_usec_t
*
ts
)
///< Pointer to a sec/usec structure to fill in
sec_usec_t
*
get_fpga_rtc
(
sec_usec_t
*
ts
)
///< Pointer to a sec/usec structure to fill in
///< @return structure link to a passed structure
///< @return structure link to a passed structure
...
...
src/drivers/elphel/x393_videomem.c
View file @
b2b0813b
...
@@ -187,6 +187,7 @@ int control_sensor_memory (int num_sensor, ///< sensor port number (0..3)
...
@@ -187,6 +187,7 @@ int control_sensor_memory (int num_sensor, ///< sensor port number (0..3)
}
}
if
(
mcntrl_mode
.
enable
){
if
(
mcntrl_mode
.
enable
){
memchan_enable
(
num_sensor
+
VIDEOMEM_SENSOR_CHANNEL0
,
1
);
// just enable - nothing will change if it was already enabled. Never disabled
memchan_enable
(
num_sensor
+
VIDEOMEM_SENSOR_CHANNEL0
,
1
);
// just enable - nothing will change if it was already enabled. Never disabled
MDP
(
DBGB_VM
,
num_sensor
,
"memchan_enable(%d,1)
\n
"
,
num_sensor
+
VIDEOMEM_SENSOR_CHANNEL0
)
}
}
return
0
;
return
0
;
}
}
...
@@ -305,14 +306,14 @@ int control_compressor_memory (int num_sensor, ///< sensor port number (0.
...
@@ -305,14 +306,14 @@ int control_compressor_memory (int num_sensor, ///< sensor port number (0.
mcntrl_mode
.
disable_need
=
disable_need
;
// non-constant parameter
mcntrl_mode
.
disable_need
=
disable_need
;
// non-constant parameter
mcntrl_mode
.
extra_pages
=
extra_pages
;
// non-constant parameter
mcntrl_mode
.
extra_pages
=
extra_pages
;
// non-constant parameter
switch
(
cmd
){
switch
(
cmd
){
case
SEN
SOR_RUN_STOP
:
case
COMPRES
SOR_RUN_STOP
:
mcntrl_mode
.
enable
=
0
;
mcntrl_mode
.
enable
=
0
;
break
;
break
;
case
SEN
SOR_RUN_SINGLE
:
case
COMPRES
SOR_RUN_SINGLE
:
mcntrl_mode
.
single
=
1
;
mcntrl_mode
.
single
=
1
;
mcntrl_mode
.
repetitive
=
0
;
mcntrl_mode
.
repetitive
=
0
;
break
;
break
;
case
SEN
SOR_RUN_CONT
:
case
COMPRES
SOR_RUN_CONT
:
break
;
break
;
case
SENSOR_RUN_RESET
:
case
SENSOR_RUN_RESET
:
mcntrl_mode
.
chn_nreset
=
0
;
mcntrl_mode
.
chn_nreset
=
0
;
...
@@ -348,6 +349,7 @@ int control_compressor_memory (int num_sensor, ///< sensor port number (0.
...
@@ -348,6 +349,7 @@ int control_compressor_memory (int num_sensor, ///< sensor port number (0.
}
}
if
(
mcntrl_mode
.
enable
){
if
(
mcntrl_mode
.
enable
){
memchan_enable
(
num_sensor
+
VIDEOMEM_COMPRESSOR_CHANNEL0
,
1
);
// just enable - nothing will change if it was already enabled. Never disabled
memchan_enable
(
num_sensor
+
VIDEOMEM_COMPRESSOR_CHANNEL0
,
1
);
// just enable - nothing will change if it was already enabled. Never disabled
MDP
(
DBGB_VM
,
num_sensor
,
"memchan_enable(%d,1)
\n
"
,
num_sensor
+
VIDEOMEM_COMPRESSOR_CHANNEL0
)
}
}
return
0
;
return
0
;
}
}
...
...
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