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
aca0c9b9
Commit
aca0c9b9
authored
Apr 16, 2016
by
Mikhail Karpenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add multichannel support to jpeghead.c, fix formatting
parent
e14c7478
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
601 additions
and
571 deletions
+601
-571
circbuf.c
src/drivers/elphel/circbuf.c
+6
-25
jpeghead.c
src/drivers/elphel/jpeghead.c
+540
-519
jpeghead.h
src/drivers/elphel/jpeghead.h
+8
-6
sensor_common.c
src/drivers/elphel/sensor_common.c
+22
-21
x393_macro.h
src/drivers/elphel/x393_macro.h
+25
-0
No files found.
src/drivers/elphel/circbuf.c
View file @
aca0c9b9
...
...
@@ -117,29 +117,6 @@ int init_ccam_dma_buf_ptr(struct platform_device *pdev)
return
0
;
}
/**
* @brief Converts file minor number to image compressor channel.
*
* This function assumes that the least significant nibble of minor contains image compressor channel number and
* next nibble contains device type. Channel numbers and device type are defined in #driver_numbers.h
* @param[in] minor file minor number
* @param[out] dev_type pointer to a variable which will hold device type or NULL if this value is not needed
* @return compressor channel number in the range [0..#IMAGE_CHN_NUM)
*/
static
inline
unsigned
int
minor_to_chn
(
unsigned
int
minor
,
unsigned
int
*
dev_type
)
{
if
(
dev_type
!=
NULL
)
{
if
((
minor
&
0xf0
)
==
CIRCBUF_MINOR
||
(
minor
&
0xf0
)
==
HUFFMAN_MINOR
||
(
minor
&
0xf0
)
==
JPEGHEAD_MINOR
)
*
dev_type
=
minor
&
0xf0
;
else
*
dev_type
=
0
;
}
if
((
minor
&
0x0f
)
<
IMAGE_CHN_NUM
)
return
minor
&
0x0f
;
else
return
0
;
}
int
circbuf_all_open
(
struct
inode
*
inode
,
struct
file
*
filp
)
{
int
res
;
...
...
@@ -747,6 +724,7 @@ static int circbuf_all_init(struct platform_device *pdev)
dev_err
(
dev
,
"couldn't get a major number %d.
\n
"
,
CIRCBUF_MAJOR
);
return
res
;
}
dev_info
(
dev
,
"registered MAJOR: %d
\n
"
,
CIRCBUF_MAJOR
);
res
=
init_ccam_dma_buf_ptr
(
pdev
);
if
(
res
<
0
)
{
...
...
@@ -757,9 +735,12 @@ static int circbuf_all_init(struct platform_device *pdev)
dev_dbg
(
dev
,
"initialize circbuf wait queue
\n
"
);
init_waitqueue_head
(
&
circbuf_wait_queue
);
dev_dbg
(
dev
,
"initialize Huffman tables with default data
\n
"
);
jpeg_htable_init
();
/// set default Huffman table, encode it for the FPGA
dev_info
(
dev
,
"registered MAJOR: %d
\n
"
,
CIRCBUF_MAJOR
);
res
=
jpeghead_init
(
pdev
);
if
(
res
<
0
)
{
dev_err
(
dev
,
"unable to initialize jpeghead module
\n
"
);
return
res
;
}
res
=
image_acq_init
(
pdev
);
if
(
res
<
0
)
{
dev_err
(
dev
,
"unable to initialize sensor_common module
\n
"
);
...
...
src/drivers/elphel/jpeghead.c
View file @
aca0c9b9
This diff is collapsed.
Click to expand it.
src/drivers/elphel/jpeghead.h
View file @
aca0c9b9
...
...
@@ -10,7 +10,7 @@ struct huffman_fpga_code_t {
unsigned
short
length
;
/// code length
};
int
qtables_create
(
struct
interframe_params_t
*
params
,
unsigned
char
*
buf
);
int
jpegheader_create
(
struct
interframe_params_t
*
params
,
unsigned
char
*
buf
);
int
jpegheader_create
(
struct
interframe_params_t
*
params
,
unsigned
char
*
buf
,
unsigned
int
chn
);
int
jpeghead_open
(
struct
inode
*
inode
,
struct
file
*
filp
);
// set filesize
loff_t
jpeghead_lseek
(
struct
file
*
file
,
loff_t
offset
,
int
orig
,
struct
interframe_params_t
*
fp
);
ssize_t
jpeghead_read
(
struct
file
*
file
,
char
*
buf
,
size_t
count
,
loff_t
*
off
);
...
...
@@ -35,10 +35,12 @@ struct huffman_pd {
int
minor
;
/// should be the first, same as in circbuf_pd
};
int
jpeg_htable_is_programmed
(
void
);
void
jpeg_htable_init
(
void
);
int
jpeg_htable_fpga_encode
(
void
);
void
jpeg_htable_fpga_pgm
(
unsigned
int
chn
);
int
jpeg_prep_htable
(
struct
huffman_encoded_t
*
htable
,
struct
huffman_fpga_code_t
*
hcodes
);
int
jpeg_htable_is_programmed
(
unsigned
int
chn
);
void
jpeg_htable_init
(
unsigned
int
chn
);
int
jpeg_htable_fpga_encode
(
unsigned
int
chn
);
void
jpeg_htable_fpga_pgm
(
unsigned
int
chn
);
int
jpeg_prep_htable
(
struct
huffman_encoded_t
*
htable
,
struct
huffman_fpga_code_t
*
hcodes
);
int
jpeghead_init
(
struct
platform_device
*
pdev
);
#endif
/* _JPEGHEAD */
src/drivers/elphel/sensor_common.c
View file @
aca0c9b9
...
...
@@ -25,33 +25,33 @@
*/
//copied from cxi2c.c - TODO:remove unneeded
#include <linux/module.h>
//
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/errno.h>
//
#include <linux/slab.h>
//
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/string.h>
//
#include <linux/fs.h>
//
#include <linux/string.h>
#include <linux/init.h>
//#include <linux/autoconf.h>
#include <linux/interrupt.h>
#include <linux/time.h>
#include <linux/vmalloc.h>
//
#include <linux/vmalloc.h>
#include <linux/platform_device.h>
#include <linux/of.h>
#include <linux/of_device.h>
//
#include <linux/of.h>
//
#include <linux/of_device.h>
//#include <asm/system.h>
#include <asm/byteorder.h> // endians
#include <asm/io.h>
//
#include <asm/byteorder.h> // endians
//
#include <asm/io.h>
//#include <asm/arch/hwregs/intr_vect_defs.h> /// ETRAX interrupt registers
#include <asm/irq.h>
//
#include <asm/irq.h>
#include <asm/delay.h>
#include <asm/uaccess.h>
//
#include <asm/delay.h>
//
#include <asm/uaccess.h>
#include <elphel/driver_numbers.h>
#include <elphel/c313a.h>
//#include <asm/elphel/fpgaconfa.h>
...
...
@@ -775,11 +775,12 @@ int image_acq_stop(struct platform_device *pdev)
return
0
;
}
static
const
struct
of_device_id
elphel393_sensor_of_match
[]
=
{
{
.
compatible
=
"elphel,elphel393-sensor-1.00"
},
{
/* end of list */
}
};
MODULE_DEVICE_TABLE
(
of
,
elphel393_sensor_of_match
);
//static const struct of_device_id elphel393_sensor_of_match[] = {
// { .compatible = "elphel,elphel393-sensor-1.00" },
// { /* end of list */ }
//};
//MODULE_DEVICE_TABLE(of, elphel393_sensor_of_match);
/*static struct platform_driver elphel393_sensor_common = {
.probe = image_acq_init,
...
...
@@ -792,6 +793,6 @@ MODULE_DEVICE_TABLE(of, elphel393_sensor_of_match);
//module_platform_driver(elphel393_sensor_common);
MODULE_LICENSE
(
"GPL"
);
MODULE_AUTHOR
(
"Andrey Filippov <andrey@elphel.com>."
);
MODULE_DESCRIPTION
(
IMAGEACQ_DRIVER_NAME
);
//
MODULE_LICENSE("GPL");
//
MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>.");
//
MODULE_DESCRIPTION(IMAGEACQ_DRIVER_NAME);
src/drivers/elphel/x393_macro.h
View file @
aca0c9b9
...
...
@@ -5,6 +5,8 @@
#ifndef _X393_MACRO
#define _X393_MACRO
#include <elphel/driver_numbers.h>
/** @brief Number of image channels */
#define IMAGE_CHN_NUM 4
...
...
@@ -39,4 +41,27 @@
#define X393_BUFFSUB(x, y) (((x) >= (y)) ? ((x)-(y)) : ((x) + (CCAM_DMA_SIZE -(y))))
#define X393_BUFFADD(x, y) ((((x) + (y)) <= CCAM_DMA_SIZE) ? ((x) + (y)) : ((x) - (CCAM_DMA_SIZE -(y))))
/**
* @brief Converts file minor number to image compressor channel.
*
* This function assumes that the least significant nibble of minor number contains image compressor channel number and
* next nibble contains device type. Channel numbers and device type are defined in #driver_numbers.h
* @param[in] minor file minor number
* @param[out] dev_type pointer to a variable which will hold device type or NULL if this value is not needed
* @return compressor channel number in the range [0..#IMAGE_CHN_NUM)
*/
static
inline
unsigned
int
minor_to_chn
(
unsigned
int
minor
,
unsigned
int
*
dev_type
)
{
if
(
dev_type
!=
NULL
)
{
if
((
minor
&
0xf0
)
==
CIRCBUF_MINOR
||
(
minor
&
0xf0
)
==
HUFFMAN_MINOR
||
(
minor
&
0xf0
)
==
JPEGHEAD_MINOR
)
*
dev_type
=
minor
&
0xf0
;
else
*
dev_type
=
0
;
}
if
((
minor
&
0x0f
)
<
IMAGE_CHN_NUM
)
return
minor
&
0x0f
;
else
return
0
;
}
#endif
/* _X393_MACRO */
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