Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC ADC 100M 14b 4cha - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
FMC ADC 100M 14b 4cha - Software
Commits
854994a7
Commit
854994a7
authored
Aug 13, 2020
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drv: read pattern data from debugfs
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
3d1f99de
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
2 deletions
+56
-2
fa-core.c
kernel/fa-core.c
+28
-0
fa-debug.c
kernel/fa-debug.c
+25
-1
fmc-adc-100m14b4cha.h
kernel/fmc-adc-100m14b4cha.h
+3
-1
No files found.
kernel/fa-core.c
View file @
854994a7
...
...
@@ -294,6 +294,34 @@ err:
return
err
;
}
/**
* Get current status for data pattern
* @fa The ADC device instance
* @pattern the pattern data to get from the ADC
* @enable 0 to disable, 1 to enable
*/
int
fa_adc_data_pattern_get
(
struct
fa_dev
*
fa
,
uint16_t
*
pattern
,
unsigned
int
*
enable
)
{
uint32_t
tx
,
rx
;
int
err
;
tx
=
0x8000
|
(
3
<<
8
);
err
=
fa_spi_xfer
(
fa
,
FA_SPI_SS_ADC
,
16
,
tx
,
&
rx
);
if
(
err
)
return
err
;
*
enable
=
!!
(
rx
&
0x80
);
*
pattern
=
((
rx
&
0xF
)
<<
8
);
tx
=
0x8000
|
(
4
<<
8
);
err
=
fa_spi_xfer
(
fa
,
FA_SPI_SS_ADC
,
16
,
tx
,
&
rx
);
if
(
err
)
return
err
;
*
pattern
|=
(
rx
&
0xFF
);
return
0
;
}
/*
* zfad_fsm_command
* @fa: the fmc-adc descriptor
...
...
kernel/fa-debug.c
View file @
854994a7
...
...
@@ -227,10 +227,34 @@ static ssize_t fa_data_pattern_write(struct file *file, const char __user *buf,
}
}
static
ssize_t
fa_data_pattern_read
(
struct
file
*
file
,
char
__user
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
struct
fa_dev
*
fa
=
file
->
private_data
;
char
buf_l
[
FA_ADC_DATA_PATTERN_CMD_SIZE
];
uint16_t
pattern
;
unsigned
int
enable
;
int
err
;
if
(
*
ppos
>
0
)
return
0
;
err
=
fa_adc_data_pattern_get
(
fa
,
&
pattern
,
&
enable
);
if
(
err
)
return
err
;
snprintf
(
buf_l
,
FA_ADC_DATA_PATTERN_CMD_SIZE
,
"adc %d 0x%02x
\n
"
,
enable
,
pattern
);
count
=
min
(
count
,
strlen
(
buf_l
));
err
=
copy_to_user
(
buf
,
buf_l
,
count
);
*
ppos
+=
count
;
return
err
?
err
:
count
;
}
static
const
struct
file_operations
fa_data_pattern_ops
=
{
.
owner
=
THIS_MODULE
,
.
open
=
simple_open
,
.
write
=
fa_data_pattern_write
,
.
read
=
fa_data_pattern_read
,
};
int
fa_debug_init
(
struct
fa_dev
*
fa
)
...
...
@@ -274,7 +298,7 @@ int fa_debug_init(struct fa_dev *fa)
"Cannot create software trigger file
\n
"
);
}
fa
->
dbg_data_pattern
=
debugfs_create_file
(
"data_pattern"
,
0
200
,
fa
->
dbg_data_pattern
=
debugfs_create_file
(
"data_pattern"
,
0
644
,
fa
->
dbg_dir
,
fa
,
&
fa_data_pattern_ops
);
if
(
IS_ERR_OR_NULL
(
fa
->
dbg_data_pattern
))
{
...
...
kernel/fmc-adc-100m14b4cha.h
View file @
854994a7
...
...
@@ -614,7 +614,9 @@ extern int fa_fsm_wait_state(struct fa_dev *fa,
enum
fa100m14b4c_fsm_state
state
,
unsigned
int
timeout_us
);
extern
int
fa_adc_data_pattern_set
(
struct
fa_dev
*
fa
,
uint16_t
pattern
,
unsigned
int
enable
);
unsigned
int
enable
);
extern
int
fa_adc_data_pattern_get
(
struct
fa_dev
*
fa
,
uint16_t
*
pattern
,
unsigned
int
*
enable
);
/* Temporarily, user values are the same as hardware values */
extern
int
zfad_convert_user_range
(
uint32_t
user_val
);
...
...
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