Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC ADC 100M 14b 4cha
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
Commits
55f47c19
Commit
55f47c19
authored
Aug 18, 2020
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drv: expose output randomizer option
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
61a6a3f6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
2 deletions
+63
-2
driver.rst
doc/software/driver.rst
+4
-0
fa-core.c
kernel/fa-core.c
+49
-0
fa-zio-drv.c
kernel/fa-zio-drv.c
+6
-1
fmc-adc-100m14b4cha.h
kernel/fmc-adc-100m14b4cha.h
+4
-1
No files found.
doc/software/driver.rst
View file @
55f47c19
...
@@ -270,6 +270,10 @@ max-sample-mshot
...
@@ -270,6 +270,10 @@ max-sample-mshot
Maximum number of samples that can be stored in the FPGA memory in
Maximum number of samples that can be stored in the FPGA memory in
multi-shot mode
multi-shot mode
output-randomizer
It allows to enable or disable the *Data Output Randomizer* in the ADC
chip.
Timestamp Attributes
Timestamp Attributes
~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~
...
...
kernel/fa-core.c
View file @
55f47c19
...
@@ -36,6 +36,55 @@ static const int zfad_hw_range[] = {
...
@@ -36,6 +36,55 @@ static const int zfad_hw_range[] = {
struct
workqueue_struct
*
fa_workqueue
;
struct
workqueue_struct
*
fa_workqueue
;
/**
* Enable/Disable Data Output Randomizer
* @fa: the adc descriptor
* @enable:
*/
int
fa_adc_output_randomizer_set
(
struct
fa_dev
*
fa
,
bool
enable
)
{
uint32_t
tx
,
rx
;
int
err
;
tx
=
0x8000
;
tx
|=
(
1
<<
8
);
err
=
fa_spi_xfer
(
fa
,
FA_SPI_SS_ADC
,
16
,
tx
,
&
rx
);
if
(
err
)
return
err
;
if
(
enable
)
rx
|=
BIT
(
6
);
else
rx
&=
~
BIT
(
6
);
tx
=
0x0000
;
tx
|=
(
1
<<
8
);
tx
|=
(
rx
&
0xFF
);
err
=
fa_spi_xfer
(
fa
,
FA_SPI_SS_ADC
,
16
,
tx
,
NULL
);
if
(
err
)
return
err
;
return
0
;
}
/**
* Check if the Data Output Randomizer is enabled
* @fa: the adc descriptor
* Return: true if the feature is enabled, otherwise false
*/
bool
fa_adc_is_output_randomizer
(
struct
fa_dev
*
fa
)
{
uint32_t
tx
,
rx
;
int
err
;
tx
=
0x8000
;
tx
|=
(
1
<<
8
);
err
=
fa_spi_xfer
(
fa
,
FA_SPI_SS_ADC
,
16
,
tx
,
&
rx
);
if
(
err
)
return
false
;
return
!!
(
rx
&
BIT
(
6
));
}
/**
/**
* Read FMC mezzanine temperature
* Read FMC mezzanine temperature
* @fa: the adc descriptor
* @fa: the adc descriptor
...
...
kernel/fa-zio-drv.c
View file @
55f47c19
...
@@ -123,6 +123,7 @@ static struct zio_attribute zfad_cset_ext_zattr[] = {
...
@@ -123,6 +123,7 @@ static struct zio_attribute zfad_cset_ext_zattr[] = {
ZIO_PARAM_EXT
(
"sample-frequency"
,
ZIO_RO_PERM
,
ZFAT_SAMPLING_HZ
,
0
),
ZIO_PARAM_EXT
(
"sample-frequency"
,
ZIO_RO_PERM
,
ZFAT_SAMPLING_HZ
,
0
),
ZIO_PARAM_EXT
(
"max-sample-mshot"
,
ZIO_RO_PERM
,
ZFA_MULT_MAX_SAMP
,
0
),
ZIO_PARAM_EXT
(
"max-sample-mshot"
,
ZIO_RO_PERM
,
ZFA_MULT_MAX_SAMP
,
0
),
ZIO_PARAM_EXT
(
"sample-counter"
,
ZIO_RO_PERM
,
ZFAT_CNT
,
0
),
ZIO_PARAM_EXT
(
"sample-counter"
,
ZIO_RO_PERM
,
ZFAT_CNT
,
0
),
ZIO_PARAM_EXT
(
"output-randomizer"
,
ZIO_RW_PERM
,
ZFA_SW_R_NOADDERS_RAND
,
0
),
};
};
#if 0 /* FIXME Unused until TLV control will be available */
#if 0 /* FIXME Unused until TLV control will be available */
...
@@ -192,7 +193,8 @@ static int zfad_conf_set(struct device *dev, struct zio_attribute *zattr,
...
@@ -192,7 +193,8 @@ static int zfad_conf_set(struct device *dev, struct zio_attribute *zattr,
* programming of hardware is done at the end of the
* programming of hardware is done at the end of the
* switch, in the catch-all final zfa_hardware_write()
* switch, in the catch-all final zfa_hardware_write()
*/
*/
case
ZFA_SW_R_NOADDERS_RAND
:
return
fa_adc_output_randomizer_set
(
fa
,
!!
usr_val
);
case
ZFA_SW_R_NOADDERS_AUTO
:
case
ZFA_SW_R_NOADDERS_AUTO
:
fa
->
enable_auto_start
=
usr_val
;
fa
->
enable_auto_start
=
usr_val
;
return
0
;
return
0
;
...
@@ -369,6 +371,9 @@ static int zfad_info_get(struct device *dev, struct zio_attribute *zattr,
...
@@ -369,6 +371,9 @@ static int zfad_info_get(struct device *dev, struct zio_attribute *zattr,
case
ZFA_CHx_OFFSET
:
case
ZFA_CHx_OFFSET
:
*
usr_val
=
fa
->
user_offset
[
to_zio_chan
(
dev
)
->
index
];
*
usr_val
=
fa
->
user_offset
[
to_zio_chan
(
dev
)
->
index
];
return
0
;
return
0
;
case
ZFA_SW_R_NOADDERS_RAND
:
*
usr_val
=
fa_adc_is_output_randomizer
(
fa
);
return
0
;
case
ZFA_SW_R_NOADDRES_NBIT
:
case
ZFA_SW_R_NOADDRES_NBIT
:
/*fallthrough*/
/*fallthrough*/
case
ZFA_SW_R_NOADDERS_AUTO
:
case
ZFA_SW_R_NOADDERS_AUTO
:
...
...
kernel/fmc-adc-100m14b4cha.h
View file @
55f47c19
...
@@ -362,6 +362,7 @@ enum fa_sw_param_id {
...
@@ -362,6 +362,7 @@ enum fa_sw_param_id {
ZFA_SW_R_NOADDRES_TEMP
,
ZFA_SW_R_NOADDRES_TEMP
,
ZFA_SW_R_NOADDERS_AUTO
,
ZFA_SW_R_NOADDERS_AUTO
,
ZFA_SW_R_NOADDERS_RAND
,
ZFA_SW_CH1_OFFSET_ZERO
,
ZFA_SW_CH1_OFFSET_ZERO
,
ZFA_SW_CH2_OFFSET_ZERO
,
ZFA_SW_CH2_OFFSET_ZERO
,
ZFA_SW_CH3_OFFSET_ZERO
,
ZFA_SW_CH3_OFFSET_ZERO
,
...
@@ -616,7 +617,9 @@ extern int fa_fsm_wait_state(struct fa_dev *fa,
...
@@ -616,7 +617,9 @@ extern int fa_fsm_wait_state(struct fa_dev *fa,
extern
int
fa_adc_data_pattern_set
(
struct
fa_dev
*
fa
,
uint16_t
pattern
,
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
,
extern
int
fa_adc_data_pattern_get
(
struct
fa_dev
*
fa
,
uint16_t
*
pattern
,
unsigned
int
*
enable
);
unsigned
int
*
enable
);
extern
int
fa_adc_output_randomizer_set
(
struct
fa_dev
*
fa
,
bool
enable
);
extern
bool
fa_adc_is_output_randomizer
(
struct
fa_dev
*
fa
);
/* Temporarily, user values are the same as hardware values */
/* Temporarily, user values are the same as hardware values */
extern
int
zfad_convert_user_range
(
uint32_t
user_val
);
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