Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gr-bladeRF-cdc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ELEN90089 CDC
gr-bladeRF-cdc
Commits
23930e74
Commit
23930e74
authored
Jun 10, 2021
by
Sergey Musikhin
Browse files
Options
Downloads
Patches
Plain Diff
init refclk
parent
ed98fe79
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/bladerf/bladerf_common.cc
+40
-0
40 additions, 0 deletions
lib/bladerf/bladerf_common.cc
lib/bladerf/bladerf_common.h
+2
-0
2 additions, 0 deletions
lib/bladerf/bladerf_common.h
with
42 additions
and
0 deletions
lib/bladerf/bladerf_common.cc
+
40
−
0
View file @
23930e74
...
...
@@ -281,6 +281,15 @@ void bladerf_common::init(dict_t const &dict, bladerf_direction direction)
}
}
if
(
dict
.
count
(
"ref_clk"
))
{
auto
freq
=
boost
::
lexical_cast
<
int
>
(
_get
(
dict
,
"ref_clk"
));
if
(
freq
)
{
init_refclk
(
freq
);
}
}
/* Show some info about the device we've opened */
print_device_info
();
...
...
@@ -421,6 +430,37 @@ size_t bladerf_common::get_max_channels(bladerf_direction direction)
#endif
}
void
bladerf_common
::
init_refclk
(
int
freq
)
{
const
bladerf_range
*
range
=
nullptr
;
auto
status
=
bladerf_get_pll_refclk_range
(
_dev
.
get
(),
&
range
);
if
(
status
!=
0
)
{
BLADERF_WARNING
(
"bladerf_get_pll_refclk_range: "
<<
bladerf_strerror
(
status
));
}
if
(
freq
<
range
->
min
||
freq
>
range
->
max
)
{
BLADERF_WARNING
(
freq
<<
" not in ref_clk range("
<<
range
->
min
<<
" - "
<<
range
->
max
<<
")"
);
}
else
{
status
=
bladerf_set_pll_enable
(
_dev
.
get
(),
true
);
if
(
status
!=
0
)
{
BLADERF_WARNING
(
"bladerf_set_pll_enable: "
<<
bladerf_strerror
(
status
));
}
else
{
status
=
bladerf_set_pll_refclk
(
_dev
.
get
(),
freq
);
if
(
status
!=
0
)
{
BLADERF_WARNING
(
"bladerf_set_pll_refclk: "
<<
bladerf_strerror
(
status
));
}
}
}
}
void
bladerf_common
::
set_channel_enable
(
bladerf_channel
ch
,
bool
enable
)
{
_enables
[
ch
]
=
enable
;
...
...
This diff is collapsed.
Click to expand it.
lib/bladerf/bladerf_common.h
+
2
−
0
View file @
23930e74
...
...
@@ -163,6 +163,8 @@ protected:
/* Get the maximum number of channels supported in a given direction */
size_t
get_max_channels
(
bladerf_direction
direction
);
void
init_refclk
(
int
freq
);
void
set_channel_enable
(
bladerf_channel
ch
,
bool
enable
);
bool
get_channel_enable
(
bladerf_channel
ch
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment