Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-apps-camogm
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-apps-camogm
Commits
1e062fa5
Commit
1e062fa5
authored
Sep 26, 2016
by
Mikhail Karpenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check compressors state before starting
parent
85935b34
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
3 deletions
+18
-3
camogm.c
src/camogm.c
+18
-3
No files found.
src/camogm.c
View file @
1e062fa5
...
@@ -212,6 +212,21 @@ void put_uint64(void *buf, u_int64_t val)
...
@@ -212,6 +212,21 @@ void put_uint64(void *buf, u_int64_t val)
tmp
[
7
]
=
(
val
>>=
8
)
&
0xff
;
tmp
[
7
]
=
(
val
>>=
8
)
&
0xff
;
}
}
/**
* @brief Detect running compressors and update active channels mask. This function should be
* called right after all driver files are opened.
* @param state pointer to #camogm_state structure containing program state
* @return none
*/
void
check_compressors
(
camogm_state
*
state
)
{
for
(
int
i
=
0
;
i
<
SENSOR_PORTS
;
i
++
)
{
if
(
getGPValue
(
i
,
P_COMPRESSOR_RUN
)
!=
COMPRESSOR_RUN_STOP
)
{
state
->
active_chn
|=
1
<<
i
;
}
}
}
/**
/**
* @brief Initialize the state of the program
* @brief Initialize the state of the program
* @param[in] state pointer to #camogm_state structure containing program state
* @param[in] state pointer to #camogm_state structure containing program state
...
@@ -259,7 +274,7 @@ void camogm_init(camogm_state *state, char *pipe_name, uint16_t port_num)
...
@@ -259,7 +274,7 @@ void camogm_init(camogm_state *state, char *pipe_name, uint16_t port_num)
state
->
rawdev
.
end_pos
=
state
->
rawdev
.
start_pos
;
state
->
rawdev
.
end_pos
=
state
->
rawdev
.
start_pos
;
state
->
rawdev
.
curr_pos_w
=
state
->
rawdev
.
start_pos
;
state
->
rawdev
.
curr_pos_w
=
state
->
rawdev
.
start_pos
;
state
->
rawdev
.
curr_pos_r
=
state
->
rawdev
.
start_pos
;
state
->
rawdev
.
curr_pos_r
=
state
->
rawdev
.
start_pos
;
state
->
active_chn
=
ALL_CHN_ACTIVE
;
state
->
active_chn
=
ALL_CHN_
IN
ACTIVE
;
state
->
rawdev
.
mmap_default_size
=
MMAP_CHUNK_SIZE
;
state
->
rawdev
.
mmap_default_size
=
MMAP_CHUNK_SIZE
;
state
->
sock_port
=
port_num
;
state
->
sock_port
=
port_num
;
}
}
...
@@ -378,7 +393,6 @@ int camogm_start(camogm_state *state)
...
@@ -378,7 +393,6 @@ int camogm_start(camogm_state *state)
memcpy
(
&
(
state
->
frame_params
[
chn
]),
(
unsigned
long
*
)
&
ccam_dma_buf
[
chn
][
state
->
metadata_start
>>
2
],
32
);
memcpy
(
&
(
state
->
frame_params
[
chn
]),
(
unsigned
long
*
)
&
ccam_dma_buf
[
chn
][
state
->
metadata_start
>>
2
],
32
);
state
->
jpeg_len
=
state
->
frame_params
[
chn
].
frame_length
;
// frame_params.frame_length are now the length of bitstream
state
->
jpeg_len
=
state
->
frame_params
[
chn
].
frame_length
;
// frame_params.frame_length are now the length of bitstream
if
(
state
->
frame_params
[
chn
].
signffff
!=
0xffff
)
{
if
(
state
->
frame_params
[
chn
].
signffff
!=
0xffff
)
{
D0
(
fprintf
(
debug_file
,
"%s:%d: wrong signature - %d
\r\n
"
,
__FILE__
,
__LINE__
,
(
int
)
state
->
frame_params
[
chn
].
signffff
));
D0
(
fprintf
(
debug_file
,
"%s:%d: wrong signature - %d
\r\n
"
,
__FILE__
,
__LINE__
,
(
int
)
state
->
frame_params
[
chn
].
signffff
));
state
->
cirbuf_rp
[
chn
]
=
-
1
;
state
->
cirbuf_rp
[
chn
]
=
-
1
;
...
@@ -1902,6 +1916,7 @@ int main(int argc, char *argv[])
...
@@ -1902,6 +1916,7 @@ int main(int argc, char *argv[])
ret
=
open_files
(
&
sstate
);
ret
=
open_files
(
&
sstate
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
ret
;
return
ret
;
check_compressors
(
&
sstate
);
if
(
pthread_create
(
&
sstate
.
rawdev
.
tid
,
NULL
,
reader
,
&
sstate
)
!=
0
||
if
(
pthread_create
(
&
sstate
.
rawdev
.
tid
,
NULL
,
reader
,
&
sstate
)
!=
0
||
pthread_detach
(
sstate
.
rawdev
.
tid
)
!=
0
)
{
pthread_detach
(
sstate
.
rawdev
.
tid
)
!=
0
)
{
D0
(
fprintf
(
debug_file
,
"%s:line %d: Can not start reading thread in detached state
\n
"
,
__FILE__
,
__LINE__
));
D0
(
fprintf
(
debug_file
,
"%s:line %d: Can not start reading thread in detached state
\n
"
,
__FILE__
,
__LINE__
));
...
@@ -1955,7 +1970,7 @@ int waitDaemonEnabled(unsigned int port, int daemonBit) // <0 - use default
...
@@ -1955,7 +1970,7 @@ int waitDaemonEnabled(unsigned int port, int daemonBit) // <0 - use default
unsigned
long
this_frame
=
GLOBALPARS
(
port
,
G_THIS_FRAME
);
unsigned
long
this_frame
=
GLOBALPARS
(
port
,
G_THIS_FRAME
);
// No semaphors, so it is possible to miss event and wait until the streamer will be re-enabled before sending message,
// No semaphors, so it is possible to miss event and wait until the streamer will be re-enabled before sending message,
// but it seems not so terrible
// but it seems not so terrible
lseek
(
state
->
fd_circ
[
state
->
port_num
],
LSEEK_DAEMON_CIRCBUF
+
lastDaemonBit
[
port
],
SEEK_END
);
lseek
(
state
->
fd_circ
[
port
],
LSEEK_DAEMON_CIRCBUF
+
lastDaemonBit
[
port
],
SEEK_END
);
if
(
this_frame
==
GLOBALPARS
(
port
,
G_THIS_FRAME
))
return
1
;
if
(
this_frame
==
GLOBALPARS
(
port
,
G_THIS_FRAME
))
return
1
;
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