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
b049b19c
Commit
b049b19c
authored
Aug 25, 2016
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added header file with debug macros
parent
515823ea
Changes
10
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
559 additions
and
172 deletions
+559
-172
clock10359.c
src/drivers/elphel/clock10359.c
+1
-1
debug393.h
src/drivers/elphel/debug393.h
+73
-0
framepars.c
src/drivers/elphel/framepars.c
+121
-116
gamma_tables.c
src/drivers/elphel/gamma_tables.c
+1
-1
histograms.c
src/drivers/elphel/histograms.c
+1
-1
klogger_393.c
src/drivers/elphel/klogger_393.c
+146
-12
klogger_393.h
src/drivers/elphel/klogger_393.h
+3
-0
mt9x001.c
src/drivers/elphel/mt9x001.c
+1
-1
pgm_functions.c
src/drivers/elphel/pgm_functions.c
+174
-39
x393_videomem.c
src/drivers/elphel/x393_videomem.c
+38
-1
No files found.
src/drivers/elphel/clock10359.c
View file @
b049b19c
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
*******************************************************************************/
/****************** INCLUDE FILES SECTION ***********************************/
/****************** INCLUDE FILES SECTION ***********************************/
#define DEBUG
/* should be before linux/module.h - enables dev_dbg at boot in this file */
//
#define DEBUG /* should be before linux/module.h - enables dev_dbg at boot in this file */
#include <linux/module.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/sched.h>
...
...
src/drivers/elphel/debug393.h
0 → 100644
View file @
b049b19c
/***************************************************************************//**
* @file debug393.h
* @brief Macros for low-overhad logging messages to a large memory buffer
* using klogger_393
* @copyright Copyright 2016 (C) Elphel, Inc.
* @par <b>License</b>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
// Used debug bits:
// framepars.c
// 0
#define DBGB_FSFA 1 ///< setFrameParsAtomic (kthread)
#define DBGB_FASAP 2 ///< _processParsASAP (kthread, tasklet) (first N only)
#define DBGB_FSEQ 3 ///< _processParsSeq (kthread, tasklet) (first N only)
#define DBGB_FPPI 4 ///< _processPars (kthread, tasklet) (first N only)
#define DBGB_FPPT 5 ///< processPars (from tasklets) (first N only)
#define DBGB_FSFP 6 ///< setFramePar(), setFramePars() (tasklet)
#define DBGB_FSFV 7 ///< setFramePar(), setFramePars() - adiitional(verbose) (tasklet)
#define DBGB_FSCF 8 ///< schedule_pgm_func,schedule_this_pgm_func
#define DBGB_FFOP 9 ///< file operations
// pgm_functions.c
#define DBGB_PSFN 10 ///< start of each function
#define DBGB_PADD 11 ///< additional details
// x393_vidoemem.c
#define DBGB_VM 12 ///< vidoemem all debug
// 13
// 14
// 15
// 16
// 17
// 18
// 19
// 20
// 21
// 22
// 23
// 24
// 25
// 26
// 27
// 28
// 29
// 30
// 31
#define DBGB_SFA 1 ///< setFrameParsAtomic (kthread)
#include "klogger_393.h"
#include "framepars.h" // for aglobals
#ifndef ELPHEL_DEBUG393
#define ELPHEL_DEBUG393 1
#if ELPHEL_DEBUG393
static
int
klog_mode
=
0xff
;
///< bits specify attributes to log
/// log unconditionally, for any channel
#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
#define MDP(bit,port,fmt,...) { if (GLOBALPARS(port,G_DEBUG) & (1 << bit)) print_klog393(klog_mode, __FILE__, __FUNCTION__, __LINE__,"%d: "fmt,port,__VA_ARGS__); }
#else
#define MDF(x)
#define MDP(bit,port,fmt,...)
#endif
#endif
src/drivers/elphel/framepars.c
View file @
b049b19c
This diff is collapsed.
Click to expand it.
src/drivers/elphel/gamma_tables.c
View file @
b049b19c
...
@@ -91,7 +91,7 @@
...
@@ -91,7 +91,7 @@
*/
*/
//copied from cxi2c.c - TODO:remove unneeded
//copied from cxi2c.c - TODO:remove unneeded
#define DEBUG // should be before linux/module.h - enables dev_dbg at boot in this file (needs "debug" in bootarg)
//
#define DEBUG // should be before linux/module.h - enables dev_dbg at boot in this file (needs "debug" in bootarg)
#include <linux/module.h>
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/mm.h>
#include <linux/sched.h>
#include <linux/sched.h>
...
...
src/drivers/elphel/histograms.c
View file @
b049b19c
...
@@ -78,7 +78,7 @@
...
@@ -78,7 +78,7 @@
*/
*/
//copied from cxi2c.c - TODO:remove unneeded
//copied from cxi2c.c - TODO:remove unneeded
#define DEBUG // should be before linux/module.h - enables dev_dbg at boot in this file (needs "debug" in bootarg)
//
#define DEBUG // should be before linux/module.h - enables dev_dbg at boot in this file (needs "debug" in bootarg)
#include <linux/module.h>
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/mm.h>
#include <linux/sched.h>
#include <linux/sched.h>
...
...
src/drivers/elphel/klogger_393.c
View file @
b049b19c
...
@@ -18,9 +18,12 @@
...
@@ -18,9 +18,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
*/
#include <linux/module.h>
#include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/io.h>
#include <linux/io.h>
#include <linux/errno.h>
#include <linux/errno.h>
#include <linux/platform_device.h> // For sysfs
#include <linux/platform_device.h> // For sysfs
#include <linux/slab.h> //kzalloc
#include <linux/fs.h>
#include <linux/fs.h>
#include <asm/uaccess.h> // copy_*_user
#include <asm/uaccess.h> // copy_*_user
#include <linux/of.h> // Device Tree
#include <linux/of.h> // Device Tree
...
@@ -39,6 +42,7 @@
...
@@ -39,6 +42,7 @@
//#define DEV393_KLOGGER ("klogger_393", "klogger_393", 144, 1, "0666", "c") ///< kernel event logger to memory (no i/o)
//#define DEV393_KLOGGER ("klogger_393", "klogger_393", 144, 1, "0666", "c") ///< kernel event logger to memory (no i/o)
static
DEFINE_SPINLOCK
(
klogger_lock
);
static
struct
device
*
g_dev_ptr
=
NULL
;
///< Global pointer to basic device structure. This pointer is used in debugfs output functions
static
struct
device
*
g_dev_ptr
=
NULL
;
///< Global pointer to basic device structure. This pointer is used in debugfs output functions
static
u32
buffer_size
=
0
;
static
u32
buffer_size
=
0
;
...
@@ -46,22 +50,81 @@ static u32 buffer_size = 0;
...
@@ -46,22 +50,81 @@ static u32 buffer_size = 0;
static
u32
buffer_size_order
=
0
;
static
u32
buffer_size_order
=
0
;
#endif
#endif
static
u32
klog_mode
=
0xff
;
static
u32
buffer_wp
=
0
;
static
u32
buffer_wp
=
0
;
static
u32
num_writes
=
0
;
static
loff_t
file_size
=
0
;
// write pointer, 64 bits
static
loff_t
file_size
=
0
;
// write pointer, 64 bits
static
char
*
klog393_buf
=
NULL
;
static
char
*
klog393_buf
=
NULL
;
const
char
klogger393_of_prop_name
[]
=
"klogger-393,buffer_size"
;
const
char
klogger393_of_prop_
bufsize_
name
[]
=
"klogger-393,buffer_size"
;
const
static
u32
max_string_len
=
PAGE_SIZE
;
///< maximal string length
const
static
u32
max_string_len
=
PAGE_SIZE
;
///< maximal string length
int
klogger393_open
(
struct
inode
*
inode
,
struct
file
*
filp
);
int
klogger393_open
(
struct
inode
*
inode
,
struct
file
*
filp
);
int
klogger393_release
(
struct
inode
*
inode
,
struct
file
*
filp
);
int
klogger393_release
(
struct
inode
*
inode
,
struct
file
*
filp
);
loff_t
klogger393_llseek
(
struct
file
*
file
,
loff_t
offset
,
int
orig
);
loff_t
klogger393_llseek
(
struct
file
*
file
,
loff_t
offset
,
int
orig
);
ssize_t
klogger393_read
(
struct
file
*
file
,
char
*
buf
,
size_t
count
,
loff_t
*
off
);
ssize_t
klogger393_read
(
struct
file
*
file
,
char
*
buf
,
size_t
count
,
loff_t
*
off
);
// printk();
int
print_klog393
(
const
int
mode
,
///< bits 0: timestamp, 1 - file, 2 - function, 3 - line number, 4 - lock, irq & disable. all 0 - disabled
const
char
*
file
,
/// file path to show
const
char
*
function
,
/// function name to show
const
int
line
,
// line number to show
const
char
*
fmt
,
...)
///< Format and argumants as in printf
{
char
buf
[
1024
];
const
char
*
cp
;
sec_usec_t
ts
;
va_list
args
;
int
mmode
=
mode
&
klog_mode
;
if
(
!
mmode
){
return
0
;
}
if
(
mmode
&
16
){
spin_lock_bh
(
&
klogger_lock
);
}
if
(
mmode
&
1
)
{
get_fpga_rtc
(
&
ts
);
snprintf
(
buf
,
sizeof
(
buf
),
"%ld.%06ld:"
,
ts
.
sec
,
ts
.
usec
);
klog393_puts
(
buf
);
}
if
((
mmode
&
2
)
&&
file
)
{
cp
=
strrchr
(
file
,
'/'
);
cp
=
cp
?
(
cp
+
1
)
:
file
;
snprintf
(
buf
,
sizeof
(
buf
),
"%s:"
,
cp
);
klog393_puts
(
buf
);
}
if
((
mmode
&
4
)
&&
function
)
{
snprintf
(
buf
,
sizeof
(
buf
),
"%s:"
,
function
);
klog393_puts
(
buf
);
}
if
((
mmode
&
8
)
&&
line
)
{
snprintf
(
buf
,
sizeof
(
buf
),
"%d:"
,
line
);
klog393_puts
(
buf
);
}
va_start
(
args
,
fmt
);
vsnprintf
(
buf
,
sizeof
(
buf
),
fmt
,
args
);
va_end
(
args
);
klog393_puts
(
buf
);
if
(
mmode
&
16
){
spin_unlock_bh
(
&
klogger_lock
);
}
return
0
;
}
/** Put string into the logger buffer*/
/** Put string into the logger buffer*/
int
klog393_puts
(
const
char
*
str
)
///< String to log, limited by max_string_len (currently 4096 bytes)
int
klog393_puts
(
const
char
*
str
)
///< String to log, limited by max_string_len (currently 4096 bytes)
///< @return 0 - OK, -EMSGSIZE - string too long
///< @return 0 - OK, -EMSGSIZE - string too long
{
{
int
sl
=
strlen
(
str
);
int
sl
=
strlen
(
str
);
u32
new_wp
=
buffer_wp
+
sl
;
u32
new_wp
=
buffer_wp
+
sl
;
if
(
!
(
klog_mode
&
0x80
)){
return
0
;
// DEBUGGING: Do nothing if bit 7 == 0
}
// u32 pl;
// u32 pl;
if
(
sl
>
max_string_len
){
if
(
sl
>
max_string_len
){
dev_err
(
g_dev_ptr
,
"%s: String too long (%d >%d)
\n
"
,
dev_err
(
g_dev_ptr
,
"%s: String too long (%d >%d)
\n
"
,
...
@@ -78,6 +141,7 @@ int klog393_puts(const char * str) ///< String to log, limited by max_string_len
...
@@ -78,6 +141,7 @@ int klog393_puts(const char * str) ///< String to log, limited by max_string_len
buffer_wp
=
new_wp
-
buffer_size
;
buffer_wp
=
new_wp
-
buffer_size
;
}
}
file_size
+=
sl
;
file_size
+=
sl
;
num_writes
++
;
return
0
;
return
0
;
}
}
/** Put string into the logger buffer, preceded by a timestamp "<sec>.<usec>: "*/
/** Put string into the logger buffer, preceded by a timestamp "<sec>.<usec>: "*/
...
@@ -236,6 +300,54 @@ ssize_t klogger393_read (struct file * file, ///< file structure pointer
...
@@ -236,6 +300,54 @@ ssize_t klogger393_read (struct file * file, ///< file structure pointer
}
}
}
}
// SysFS interface to read/modify video memory map
#define SYSFS_PERMISSIONS 0644
/* default permissions for sysfs files */
#define SYSFS_READONLY 0444
#define SYSFS_WRITEONLY 0222
static
ssize_t
show_mode
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
{
return
sprintf
(
buf
,
"0x%x
\n
"
,
klog_mode
);
}
static
ssize_t
store_mode
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
const
char
*
buf
,
size_t
count
)
{
sscanf
(
buf
,
"%i"
,
&
klog_mode
);
return
count
;
}
static
ssize_t
show_stats
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
{
return
sprintf
(
buf
,
"Number of writes: 0x%x
\n
"
"Buffer size: 0x%x (%d)
\n
"
"Buffer write pointer: 0x%x (%d)
\n
"
"File size: 0x%llx (%lld)
\n
"
"Mode: 0x%x
\n
"
,
num_writes
,
buffer_size
,
buffer_size
,
buffer_wp
,
buffer_wp
,
file_size
,
file_size
,
klog_mode
);
}
static
DEVICE_ATTR
(
klogger_mode
,
SYSFS_PERMISSIONS
,
show_mode
,
store_mode
);
static
DEVICE_ATTR
(
klogger_stats
,
SYSFS_READONLY
,
show_stats
,
NULL
);
static
struct
attribute
*
root_dev_attrs
[]
=
{
&
dev_attr_klogger_mode
.
attr
,
&
dev_attr_klogger_stats
.
attr
,
NULL
};
static
const
struct
attribute_group
dev_attr_root_group
=
{
.
attrs
=
root_dev_attrs
,
.
name
=
NULL
,
};
static
int
klogger_393_sysfs_register
(
struct
platform_device
*
pdev
)
{
int
retval
=
0
;
struct
device
*
dev
=
&
pdev
->
dev
;
if
(
&
dev
->
kobj
)
{
if
(((
retval
=
sysfs_create_group
(
&
dev
->
kobj
,
&
dev_attr_root_group
)))
<
0
)
return
retval
;
}
return
retval
;
}
int
klogger_393_probe
(
struct
platform_device
*
pdev
)
int
klogger_393_probe
(
struct
platform_device
*
pdev
)
{
{
...
@@ -243,19 +355,34 @@ int klogger_393_probe(struct platform_device *pdev)
...
@@ -243,19 +355,34 @@ int klogger_393_probe(struct platform_device *pdev)
struct
device
*
dev
=
&
pdev
->
dev
;
struct
device
*
dev
=
&
pdev
->
dev
;
const
char
*
config_string
;
const
char
*
config_string
;
struct
device_node
*
node
=
pdev
->
dev
.
of_node
;
struct
device_node
*
node
=
pdev
->
dev
.
of_node
;
const
__be32
*
bufsize_be
;
g_dev_ptr
=
dev
;
g_dev_ptr
=
dev
;
buffer_wp
=
0
;
buffer_wp
=
0
;
if
(
node
)
{
if
(
node
)
{
if
(
of_property_read_string
(
node
,
klogger393_of_prop_name
,
&
config_string
))
{
#if 0
if (of_property_read_string(node, klogger393_of_prop_bufsize_name, &config_string)) {
dev_err(dev,"%s: Device tree has entry for "DEV393_NAME(DEV393_KLOGGER)", but no '%s' property is provided\n",
dev_err(dev,"%s: Device tree has entry for "DEV393_NAME(DEV393_KLOGGER)", but no '%s' property is provided\n",
__func__
,
klogger393_of_prop_name
);
__func__,klogger393_of_prop_
bufsize_
name);
return -EINVAL;
return -EINVAL;
}
}
if (!sscanf(config_string,"%i", &buffer_size)){
if (!sscanf(config_string,"%i", &buffer_size)){
dev_err(dev,"%s: Invalid buffer size for "DEV393_NAME(DEV393_KLOGGER)".%s - %s\n",
dev_err(dev,"%s: Invalid buffer size for "DEV393_NAME(DEV393_KLOGGER)".%s - %s\n",
__func__
,
klogger393_of_prop_name
,
config_string
);
__func__,klogger393_of_prop_bufsize_name,config_string);
return -EINVAL;
}
#endif
bufsize_be
=
(
__be32
*
)
of_get_property
(
node
,
klogger393_of_prop_bufsize_name
,
NULL
);
if
(
!
bufsize_be
)
{
dev_err
(
dev
,
"%s: Device tree has entry for "
DEV393_NAME
(
DEV393_KLOGGER
)
", but no '%s' property is provided
\n
"
,
__func__
,
klogger393_of_prop_bufsize_name
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
buffer_size
=
be32_to_cpup
(
bufsize_be
);
//__builtin_clz
//__builtin_clz
#ifndef KLOGGER_BUFFER_ANY_SIZE
#ifndef KLOGGER_BUFFER_ANY_SIZE
buffer_size_order
=
31
-
__builtin_clz
(
buffer_size
);
buffer_size_order
=
31
-
__builtin_clz
(
buffer_size
);
...
@@ -266,17 +393,23 @@ int klogger_393_probe(struct platform_device *pdev)
...
@@ -266,17 +393,23 @@ int klogger_393_probe(struct platform_device *pdev)
__func__
,
buffer_size
,
buffer_size
);
__func__
,
buffer_size
,
buffer_size
);
}
}
#endif
#endif
klog393_buf
=
devm_kzalloc
(
dev
,
buffer_size
,
GFP_KERNEL
);
dev_info
(
dev
,
"%s: Setting up buffer for logging "
DEV393_NAME
(
DEV393_KLOGGER
)
" of %d(0x%x) bytes
\n
"
,
__func__
,
buffer_size
,
buffer_size
);
// klog393_buf = devm_kzalloc(dev, buffer_size, GFP_KERNEL);
klog393_buf
=
kzalloc
(
buffer_size
,
GFP_KERNEL
);
if
(
!
klog393_buf
){
if
(
!
klog393_buf
){
buffer_size
=
0
;
buffer_size
=
0
;
dev_err
(
dev
,
"%s: Failed to create buffer for "
DEV393_NAME
(
DEV393_KLOGGER
)
" of %d(0x%x) bytes
\n
"
,
dev_err
(
dev
,
"%s: Failed to create buffer for "
DEV393_NAME
(
DEV393_KLOGGER
)
" of %d(0x%x) bytes
\n
"
,
__func__
,
buffer_size
,
buffer_size
);
__func__
,
buffer_size
,
buffer_size
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
res
=
register_chrdev
(
DEV393_MAJOR
(
DEV393_FRAMEPARS0
),
DEV393_NAME
(
DEV393_FRAMEPARS0
),
&
framepars_fops
);
dev_info
(
dev
,
"%s: Set up buffer for logging "
DEV393_NAME
(
DEV393_KLOGGER
)
" of %d(0x%x) bytes @0x%08x
\n
"
,
__func__
,
buffer_size
,
buffer_size
,
(
int
)
klog393_buf
);
res
=
register_chrdev
(
DEV393_MAJOR
(
DEV393_KLOGGER
),
DEV393_NAME
(
DEV393_KLOGGER
),
&
framepars_fops
);
if
(
res
<
0
)
{
if
(
res
<
0
)
{
dev_err
(
dev
,
"framepars_init: couldn't get a major number %d (DEV393_MAJOR(DEV393_
FRAMEPARS0
)).
\n
"
,
dev_err
(
dev
,
"framepars_init: couldn't get a major number %d (DEV393_MAJOR(DEV393_
KLOGGER
)).
\n
"
,
DEV393_MAJOR
(
DEV393_
FRAMEPARS0
));
DEV393_MAJOR
(
DEV393_
KLOGGER
));
return
res
;
return
res
;
}
}
...
@@ -288,15 +421,16 @@ int klogger_393_probe(struct platform_device *pdev)
...
@@ -288,15 +421,16 @@ int klogger_393_probe(struct platform_device *pdev)
//
klogger_393_sysfs_register(pdev);
res
=
klogger_393_sysfs_register
(
pdev
);
// dev_info(dev, DEV393_NAME(DEV393_KLOGGER)": registered sysfs\n"
);
dev_info
(
dev
,
DEV393_NAME
(
DEV393_KLOGGER
)
": registered sysfs, result = %d
\n
"
,
res
);
return
0
;
return
0
;
}
}
int
klogger_393_remove
(
struct
platform_device
*
pdev
)
int
klogger_393_remove
(
struct
platform_device
*
pdev
)
{
{
if
(
klog393_buf
)
if
(
klog393_buf
)
{
devm_kfree
(
&
pdev
->
dev
,
klog393_buf
);
// devm_kfree(&pdev->dev, klog393_buf); // actually not needed
}
unregister_chrdev
(
DEV393_MAJOR
(
DEV393_KLOGGER
),
DEV393_NAME
(
DEV393_KLOGGER
));
unregister_chrdev
(
DEV393_MAJOR
(
DEV393_KLOGGER
),
DEV393_NAME
(
DEV393_KLOGGER
));
return
0
;
return
0
;
...
...
src/drivers/elphel/klogger_393.h
View file @
b049b19c
...
@@ -18,6 +18,9 @@
...
@@ -18,6 +18,9 @@
*/
*/
#ifndef KLOGGER_393_H
#ifndef KLOGGER_393_H
#define KLOGGER_393_H
#define KLOGGER_393_H
//int print_klog393(const int mode, const char *fmt, ...);
int
print_klog393
(
const
int
mode
,
const
char
*
file
,
const
char
*
function
,
const
int
line
,
const
char
*
fmt
,
...);
int
klog393_puts
(
const
char
*
str
);
int
klog393_puts
(
const
char
*
str
);
int
klog393_ts
(
const
char
*
str
);
int
klog393_ts
(
const
char
*
str
);
...
...
src/drivers/elphel/mt9x001.c
View file @
b049b19c
...
@@ -323,7 +323,7 @@
...
@@ -323,7 +323,7 @@
//
//
*/
*/
#define DEBUG // should be before linux/module.h - enables dev_dbg at boot in this file (needs "debug" in bootarg)
//
#define DEBUG // should be before linux/module.h - enables dev_dbg at boot in this file (needs "debug" in bootarg)
/****************** INCLUDE FILES SECTION ***********************************/
/****************** INCLUDE FILES SECTION ***********************************/
#include <linux/types.h> // for div 64
#include <linux/types.h> // for div 64
#include <asm/div64.h> // for div 64
#include <asm/div64.h> // for div 64
...
...
src/drivers/elphel/pgm_functions.c
View file @
b049b19c
This diff is collapsed.
Click to expand it.
src/drivers/elphel/x393_videomem.c
View file @
b049b19c
...
@@ -34,6 +34,8 @@
...
@@ -34,6 +34,8 @@
#define VIDEOMEM_MODULE_DESCRIPTION "Video buffer driver"
#define VIDEOMEM_MODULE_DESCRIPTION "Video buffer driver"
//#define VIDEOMEM_DRIVER_NAME "video_mem"
//#define VIDEOMEM_DRIVER_NAME "video_mem"
// NC393 debug macros
#include "debug393.h"
static
const
struct
of_device_id
elphel393_videomem_of_match
[];
static
const
struct
of_device_id
elphel393_videomem_of_match
[];
static
struct
device
*
g_dev_ptr
;
///< Global pointer to basic device structure. This pointer is used in debugfs output functions
static
struct
device
*
g_dev_ptr
;
///< Global pointer to basic device structure. This pointer is used in debugfs output functions
...
@@ -82,6 +84,10 @@ int setup_sensor_memory (int num_sensor, ///< sensor port number (0..3)
...
@@ -82,6 +84,10 @@ int setup_sensor_memory (int num_sensor, ///< sensor port number (0..3)
dev_dbg
(
g_dev_ptr
,
"{%d} frame16=%d, command=%d
\n
"
,
num_sensor
,
frame16
,
(
int
)
x393cmd
);
dev_dbg
(
g_dev_ptr
,
"{%d} frame16=%d, command=%d
\n
"
,
num_sensor
,
frame16
,
(
int
)
x393cmd
);
dev_dbg
(
g_dev_ptr
,
"sa=0x%08x sa_inc=0x%08x lfn=0x%08x fw=0x%08x wh=0x%08x lt=0x%08x
\n
"
,
dev_dbg
(
g_dev_ptr
,
"sa=0x%08x sa_inc=0x%08x lfn=0x%08x fw=0x%08x wh=0x%08x lt=0x%08x
\n
"
,
window_frame_sa
.
d32
,
window_frame_sa_inc
.
d32
,
window_last_frame_num
,
window_full_width
.
d32
,
window_width_height
.
d32
,
window_left_top
.
d32
);
window_frame_sa
.
d32
,
window_frame_sa_inc
.
d32
,
window_last_frame_num
,
window_full_width
.
d32
,
window_width_height
.
d32
,
window_left_top
.
d32
);
MDP
(
DBGB_VM
,
num_sensor
,
"frame16=%d, command=%d
\n
"
,
frame16
,
(
int
)
x393cmd
)
MDP
(
DBGB_VM
,
num_sensor
,
"sa=0x%08x sa_inc=0x%08x lfn=0x%08x fw=0x%08x wh=0x%08x lt=0x%08x
\n
"
,
window_frame_sa
.
d32
,
window_frame_sa_inc
.
d32
,
window_last_frame_num
,
window_full_width
.
d32
,
window_width_height
.
d32
,
window_left_top
.
d32
)
switch
(
x393cmd
){
switch
(
x393cmd
){
case
ASAP
:
case
ASAP
:
...
@@ -153,6 +159,18 @@ int control_sensor_memory (int num_sensor, ///< sensor port number (0..3)
...
@@ -153,6 +159,18 @@ int control_sensor_memory (int num_sensor, ///< sensor port number (0..3)
return
-
EINVAL
;
return
-
EINVAL
;
}
}
dev_dbg
(
g_dev_ptr
,
"{%d} frame16=%d, cmd=%d, x393cms=%d
\n
"
,
num_sensor
,
frame16
,
cmd
,
(
int
)
x393cmd
);
dev_dbg
(
g_dev_ptr
,
"mode=0x%x (enable=%d, chn_nreset=%d, write_mem=%d, extra_pages=%d, keep_open=%d, byte32=%d, reset_frame=%d, single=%d,repetitive=%d, disable_need=%d,skip_too_late=%d )
\n
"
,
mcntrl_mode
.
d32
,
mcntrl_mode
.
enable
,
mcntrl_mode
.
chn_nreset
,
mcntrl_mode
.
write_mem
,
mcntrl_mode
.
extra_pages
,
mcntrl_mode
.
keep_open
,
mcntrl_mode
.
byte32
,
mcntrl_mode
.
reset_frame
,
mcntrl_mode
.
single
,
mcntrl_mode
.
repetitive
,
mcntrl_mode
.
disable_need
,
mcntrl_mode
.
skip_too_late
);
MDP
(
DBGB_VM
,
num_sensor
,
"frame16=%d, cmd=%d, x393cms=%d
\n
"
,
frame16
,
cmd
,
(
int
)
x393cmd
)
MDP
(
DBGB_VM
,
num_sensor
,
"mode=0x%x (enable=%d, chn_nreset=%d, write_mem=%d, extra_pages=%d, keep_open=%d, byte32=%d, reset_frame=%d, single=%d,repetitive=%d, disable_need=%d,skip_too_late=%d )
\n
"
,
mcntrl_mode
.
d32
,
mcntrl_mode
.
enable
,
mcntrl_mode
.
chn_nreset
,
mcntrl_mode
.
write_mem
,
mcntrl_mode
.
extra_pages
,
mcntrl_mode
.
keep_open
,
mcntrl_mode
.
byte32
,
mcntrl_mode
.
reset_frame
,
mcntrl_mode
.
single
,
mcntrl_mode
.
repetitive
,
mcntrl_mode
.
disable_need
,
mcntrl_mode
.
skip_too_late
)
switch
(
x393cmd
){
switch
(
x393cmd
){
case
ASAP
:
case
ASAP
:
frame16
=
0
;
frame16
=
0
;
...
@@ -215,7 +233,16 @@ int setup_compressor_memory (int num_sensor, ///< sensor port number (0..3
...
@@ -215,7 +233,16 @@ int setup_compressor_memory (int num_sensor, ///< sensor port number (0..3
dev_dbg
(
g_dev_ptr
,
"{%d} frame16=%d, command=%d
\n
"
,
num_sensor
,
frame16
,
(
int
)
x393cmd
);
dev_dbg
(
g_dev_ptr
,
"{%d} frame16=%d, command=%d
\n
"
,
num_sensor
,
frame16
,
(
int
)
x393cmd
);
dev_dbg
(
g_dev_ptr
,
"sa=0x%08x sa_inc=0x%08x lfn=0x%08x fw=0x%08x wh=0x%08x lt=0x%08x whs=0x%08x
\n
"
,
dev_dbg
(
g_dev_ptr
,
"sa=0x%08x sa_inc=0x%08x lfn=0x%08x fw=0x%08x wh=0x%08x lt=0x%08x whs=0x%08x
\n
"
,
window_frame_sa
.
d32
,
window_frame_sa_inc
.
d32
,
window_last_frame_num
.
d32
,
window_full_width
.
d32
,
window_width_height
.
d32
,
window_left_top
.
d32
,
window_tile_whs
.
d32
);
window_frame_sa
.
d32
,
window_frame_sa_inc
.
d32
,
window_last_frame_num
.
d32
,
window_full_width
.
d32
,
window_width_height
.
d32
,
window_left_top
.
d32
,
window_tile_whs
.
d32
);
MDP
(
DBGB_VM
,
num_sensor
,
"frame16=%d, command=%d
\n
"
,
frame16
,
(
int
)
x393cmd
)
MDP
(
DBGB_VM
,
num_sensor
,
"sa=0x%08x sa_inc=0x%08x lfn=0x%08x fw=0x%08x wh=0x%08x lt=0x%08x whs=0x%08x
\n
"
,
window_frame_sa
.
d32
,
window_frame_sa_inc
.
d32
,
window_last_frame_num
,
window_full_width
.
d32
,
window_width_height
.
d32
,
window_left_top
.
d32
,
window_tile_whs
.
d32
)
switch
(
x393cmd
){
switch
(
x393cmd
){
case
ASAP
:
case
ASAP
:
...
@@ -294,6 +321,16 @@ int control_compressor_memory (int num_sensor, ///< sensor port number (0.
...
@@ -294,6 +321,16 @@ int control_compressor_memory (int num_sensor, ///< sensor port number (0.
default:
default:
return
-
EINVAL
;
return
-
EINVAL
;
}
}
dev_dbg
(
g_dev_ptr
,
"{%d} frame16=%d, cmd=%d, x393cms=%d
\n
"
,
num_sensor
,
frame16
,
cmd
,
(
int
)
x393cmd
);
dev_dbg
(
g_dev_ptr
,
"mode=0x%x (enable=%d, chn_nreset=%d, write_mem=%d, extra_pages=%d, keep_open=%d, byte32=%d, reset_frame=%d, single=%d,repetitive=%d, disable_need=%d,skip_too_late=%d )
\n
"
,
mcntrl_mode
.
d32
,
mcntrl_mode
.
enable
,
mcntrl_mode
.
chn_nreset
,
mcntrl_mode
.
write_mem
,
mcntrl_mode
.
extra_pages
,
mcntrl_mode
.
keep_open
,
mcntrl_mode
.
byte32
,
mcntrl_mode
.
reset_frame
,
mcntrl_mode
.
single
,
mcntrl_mode
.
repetitive
,
mcntrl_mode
.
disable_need
,
mcntrl_mode
.
skip_too_late
);
MDP
(
DBGB_VM
,
num_sensor
,
"frame16=%d, cmd=%d, x393cms=%d
\n
"
,
frame16
,
cmd
,
(
int
)
x393cmd
)
MDP
(
DBGB_VM
,
num_sensor
,
"mode=0x%x (enable=%d, chn_nreset=%d, write_mem=%d, extra_pages=%d, keep_open=%d, byte32=%d, reset_frame=%d, single=%d,repetitive=%d, disable_need=%d,skip_too_late=%d )
\n
"
,
mcntrl_mode
.
d32
,
mcntrl_mode
.
enable
,
mcntrl_mode
.
chn_nreset
,
mcntrl_mode
.
write_mem
,
mcntrl_mode
.
extra_pages
,
mcntrl_mode
.
keep_open
,
mcntrl_mode
.
byte32
,
mcntrl_mode
.
reset_frame
,
mcntrl_mode
.
single
,
mcntrl_mode
.
repetitive
,
mcntrl_mode
.
disable_need
,
mcntrl_mode
.
skip_too_late
)
switch
(
x393cmd
){
switch
(
x393cmd
){
case
ASAP
:
case
ASAP
:
...
...
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