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
31391359
Commit
31391359
authored
Aug 30, 2016
by
Mikhail Karpenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Insert app15 marker before header, fix offset error in circbuf
parent
e33c95a7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
15 deletions
+17
-15
ahci_elphel.c
src/drivers/ata/ahci_elphel.c
+15
-13
circbuf.c
src/drivers/elphel/circbuf.c
+2
-2
No files found.
src/drivers/ata/ahci_elphel.c
View file @
31391359
...
@@ -745,6 +745,17 @@ static void align_frame(struct device *dev, struct elphel_ahci_priv *dpriv)
...
@@ -745,6 +745,17 @@ static void align_frame(struct device *dev, struct elphel_ahci_priv *dpriv)
vectshrink
(
&
chunks
[
CHUNK_EXIF
],
chunks
[
CHUNK_EXIF
].
iov_len
);
vectshrink
(
&
chunks
[
CHUNK_EXIF
],
chunks
[
CHUNK_EXIF
].
iov_len
);
}
}
/* align common buffer to ALIGNMENT boundary, APP15 marker should be placed before header data */
data_len
=
cbuff
->
iov_len
+
chunks
[
CHUNK_HEADER
].
iov_len
;
len
=
align_bytes_num
(
data_len
,
ALIGNMENT_SIZE
);
if
(
len
<
JPEG_MARKER_LEN
+
JPEG_SIZE_LEN
&&
len
!=
0
)
{
/* the number of bytes needed for alignment is less than the length of the marker itself, increase the number of stuffing bytes */
len
+=
ALIGNMENT_SIZE
;
}
dev_dbg
(
dev
,
"total number of stuffing bytes in APP15 marker: %u
\n
"
,
len
);
app15
[
3
]
=
len
-
JPEG_MARKER_LEN
;
vectcpy
(
cbuff
,
app15
,
len
);
/* copy JPEG header */
/* copy JPEG header */
len
=
chunks
[
CHUNK_HEADER
].
iov_len
;
len
=
chunks
[
CHUNK_HEADER
].
iov_len
;
printk
(
KERN_DEBUG
">>> copy %u bytes from HEADER to common buffer
\n
"
,
len
);
printk
(
KERN_DEBUG
">>> copy %u bytes from HEADER to common buffer
\n
"
,
len
);
...
@@ -814,16 +825,6 @@ static void align_frame(struct device *dev, struct elphel_ahci_priv *dpriv)
...
@@ -814,16 +825,6 @@ static void align_frame(struct device *dev, struct elphel_ahci_priv *dpriv)
return
;
return
;
}
}
/* align common buffer to ALIGNMENT boundary */
len
=
align_bytes_num
(
cbuff
->
iov_len
,
ALIGNMENT_SIZE
);
if
(
len
<
JPEG_MARKER_LEN
+
JPEG_SIZE_LEN
&&
len
!=
0
)
{
/* the number of bytes needed for alignment is less than the length of the marker itself, increase the number of stuffing bytes */
len
+=
ALIGNMENT_SIZE
;
}
dev_dbg
(
dev
,
"total number of stuffing bytes in APP15 marker: %u
\n
"
,
len
);
app15
[
3
]
=
len
-
JPEG_MARKER_LEN
;
vectcpy
(
cbuff
,
app15
,
len
);
/* align frame to sector size boundary; total size could have changed by the moment - recalculate */
/* align frame to sector size boundary; total size could have changed by the moment - recalculate */
total_sz
=
get_size_from
(
chunks
,
0
,
0
,
INCLUDE_REM
);
total_sz
=
get_size_from
(
chunks
,
0
,
0
,
INCLUDE_REM
);
len
=
total_sz
%
PHY_BLOCK_SIZE
;
len
=
total_sz
%
PHY_BLOCK_SIZE
;
...
@@ -1259,15 +1260,16 @@ static ssize_t rawdev_write(struct device *dev, ///<
...
@@ -1259,15 +1260,16 @@ static ssize_t rawdev_write(struct device *dev, ///<
rcvd
=
exif_get_data
(
fdata
.
sensor_port
,
fdata
.
meta_index
,
buffs
->
exif_buff
.
iov_base
,
buffs
->
exif_buff
.
iov_len
);
rcvd
=
exif_get_data
(
fdata
.
sensor_port
,
fdata
.
meta_index
,
buffs
->
exif_buff
.
iov_base
,
buffs
->
exif_buff
.
iov_len
);
// rcvd = exif_get_data_tst(fdata.sensor_port, fdata.meta_index, buffs->exif_buff.iov_base, buffs->exif_buff.iov_len, 1);
// rcvd = exif_get_data_tst(fdata.sensor_port, fdata.meta_index, buffs->exif_buff.iov_base, buffs->exif_buff.iov_len, 1);
printk
(
KERN_DEBUG
">>> bytes received from exif driver: %u
\n
"
,
rcvd
);
printk
(
KERN_DEBUG
">>> bytes received from exif driver: %u
\n
"
,
rcvd
);
if
(
rcvd
>
0
&&
rcvd
<
buffs
->
exif_buff
.
iov_len
)
if
(
rcvd
>
0
&&
rcvd
<
buffs
->
exif_buff
.
iov_len
)
{
print_hex_dump_bytes
(
""
,
DUMP_PREFIX_OFFSET
,
buffs
->
exif_buff
.
iov_base
,
rcvd
);
// print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buffs->exif_buff.iov_base, rcvd);
}
chunks
[
CHUNK_EXIF
].
iov_len
=
rcvd
;
chunks
[
CHUNK_EXIF
].
iov_len
=
rcvd
;
rcvd
=
jpeghead_get_data
(
fdata
.
sensor_port
,
buffs
->
jpheader_buff
.
iov_base
,
buffs
->
jpheader_buff
.
iov_len
,
0
);
rcvd
=
jpeghead_get_data
(
fdata
.
sensor_port
,
buffs
->
jpheader_buff
.
iov_base
,
buffs
->
jpheader_buff
.
iov_len
,
0
);
// rcvd = jpeghead_get_data_tst(fdata.sensor_port, buffs->jpheader_buff.iov_base, buffs->jpheader_buff.iov_len, 0);
// rcvd = jpeghead_get_data_tst(fdata.sensor_port, buffs->jpheader_buff.iov_base, buffs->jpheader_buff.iov_len, 0);
printk
(
KERN_DEBUG
">>> bytes received from jpeghead driver: %u
\n
"
,
rcvd
);
printk
(
KERN_DEBUG
">>> bytes received from jpeghead driver: %u
\n
"
,
rcvd
);
if
(
rcvd
>
0
&&
rcvd
<
buffs
->
jpheader_buff
.
iov_len
)
{
if
(
rcvd
>
0
&&
rcvd
<
buffs
->
jpheader_buff
.
iov_len
)
{
print_hex_dump_bytes
(
""
,
DUMP_PREFIX_OFFSET
,
buffs
->
jpheader_buff
.
iov_base
,
rcvd
);
//
print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buffs->jpheader_buff.iov_base, rcvd);
chunks
[
CHUNK_LEADER
].
iov_len
=
JPEG_MARKER_LEN
;
chunks
[
CHUNK_LEADER
].
iov_len
=
JPEG_MARKER_LEN
;
chunks
[
CHUNK_TRAILER
].
iov_len
=
JPEG_MARKER_LEN
;
chunks
[
CHUNK_TRAILER
].
iov_len
=
JPEG_MARKER_LEN
;
chunks
[
CHUNK_HEADER
].
iov_len
=
rcvd
-
chunks
[
CHUNK_LEADER
].
iov_len
;
chunks
[
CHUNK_HEADER
].
iov_len
=
rcvd
-
chunks
[
CHUNK_LEADER
].
iov_len
;
...
...
src/drivers/elphel/circbuf.c
View file @
31391359
...
@@ -109,7 +109,7 @@ int circbuf_get_ptr(int sensor_port, size_t offset, size_t len, struct fvec *vec
...
@@ -109,7 +109,7 @@ int circbuf_get_ptr(int sensor_port, size_t offset, size_t len, struct fvec *vec
if
(
offset
+
len
<
CCAM_DMA_SIZE
)
{
if
(
offset
+
len
<
CCAM_DMA_SIZE
)
{
// the image is not split
// the image is not split
vect_0
->
iov_base
=
circbuf_priv
[
sensor_port
].
buf_ptr
+
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
=
len
;
vect_0
->
iov_len
=
len
;
vect_1
->
iov_base
=
NULL
;
vect_1
->
iov_base
=
NULL
;
...
@@ -117,7 +117,7 @@ int circbuf_get_ptr(int sensor_port, size_t offset, size_t len, struct fvec *vec
...
@@ -117,7 +117,7 @@ int circbuf_get_ptr(int sensor_port, size_t offset, size_t len, struct fvec *vec
vect_1
->
iov_dma
=
0
;
vect_1
->
iov_dma
=
0
;
}
else
{
}
else
{
// the image is split into two segments
// the image is split into two segments
vect_0
->
iov_base
=
circbuf_priv
[
sensor_port
].
buf_ptr
+
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
=
CCAM_DMA_SIZE
-
offset
;
vect_1
->
iov_base
=
circbuf_priv
[
sensor_port
].
buf_ptr
;
vect_1
->
iov_base
=
circbuf_priv
[
sensor_port
].
buf_ptr
;
...
...
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