Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
promise
OpenXG-RAN
Commits
28171c1a
Commit
28171c1a
authored
Jun 23, 2017
by
Cedric Roux
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/hack-bladerf-w24' into develop_integration_w25
parents
ef87ec51
a8ae85f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
2 deletions
+59
-2
targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c
targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c
+59
-2
No files found.
targets/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c
View file @
28171c1a
...
@@ -82,6 +82,48 @@ openair0_timestamp trx_get_timestamp(openair0_device *device, bladerf_module mod
...
@@ -82,6 +82,48 @@ openair0_timestamp trx_get_timestamp(openair0_device *device, bladerf_module mod
* \returns 0 on success
* \returns 0 on success
*/
*/
int
trx_brf_start
(
openair0_device
*
device
)
{
int
trx_brf_start
(
openair0_device
*
device
)
{
brf_state_t
*
brf
=
(
brf_state_t
*
)
device
->
priv
;
int
status
;
brf
->
meta_tx
.
flags
=
0
;
if
((
status
=
bladerf_sync_config
(
brf
->
dev
,
BLADERF_MODULE_TX
,
BLADERF_FORMAT_SC16_Q11_META
,
brf
->
num_buffers
,
brf
->
buffer_size
,
brf
->
num_transfers
,
100
/*brf->tx_timeout_ms*/
))
!=
0
)
{
fprintf
(
stderr
,
"Failed to configure TX sync interface: %s
\n
"
,
bladerf_strerror
(
status
));
abort
();
}
if
((
status
=
bladerf_sync_config
(
brf
->
dev
,
BLADERF_MODULE_RX
,
BLADERF_FORMAT_SC16_Q11_META
,
brf
->
num_buffers
,
brf
->
buffer_size
,
brf
->
num_transfers
,
100
/*brf->rx_timeout_ms*/
))
!=
0
)
{
fprintf
(
stderr
,
"Failed to configure RX sync interface: %s
\n
"
,
bladerf_strerror
(
status
));
abort
();
}
if
((
status
=
bladerf_enable_module
(
brf
->
dev
,
BLADERF_MODULE_TX
,
true
))
!=
0
)
{
fprintf
(
stderr
,
"Failed to enable TX module: %s
\n
"
,
bladerf_strerror
(
status
));
abort
();
}
if
((
status
=
bladerf_enable_module
(
brf
->
dev
,
BLADERF_MODULE_RX
,
true
))
!=
0
)
{
fprintf
(
stderr
,
"Failed to enable RX module: %s
\n
"
,
bladerf_strerror
(
status
));
abort
();
}
if
((
status
=
bladerf_calibrate_dc
(
brf
->
dev
,
BLADERF_MODULE_TX
))
!=
0
)
{
fprintf
(
stderr
,
"Failed to calibrate TX DC: %s
\n
"
,
bladerf_strerror
(
status
));
abort
();
}
if
((
status
=
bladerf_calibrate_dc
(
brf
->
dev
,
BLADERF_MODULE_RX
))
!=
0
)
{
fprintf
(
stderr
,
"Failed to calibrate RX DC: %s
\n
"
,
bladerf_strerror
(
status
));
abort
();
}
return
0
;
return
0
;
}
}
...
@@ -133,7 +175,7 @@ static int trx_brf_write(openair0_device *device,openair0_timestamp ptimestamp,
...
@@ -133,7 +175,7 @@ static int trx_brf_write(openair0_device *device,openair0_timestamp ptimestamp,
brf
->
tx_count
++
;
brf
->
tx_count
++
;
return
(
0
)
;
return
nsamps
;
//brf->meta_tx.actual_count
;
}
}
/*! \brief Receive samples from hardware.
/*! \brief Receive samples from hardware.
...
@@ -155,6 +197,7 @@ static int trx_brf_read(openair0_device *device, openair0_timestamp *ptimestamp,
...
@@ -155,6 +197,7 @@ static int trx_brf_read(openair0_device *device, openair0_timestamp *ptimestamp,
// BRF has only one rx/tx chain
// BRF has only one rx/tx chain
int16_t
*
samples
=
(
int16_t
*
)
buff
[
0
];
int16_t
*
samples
=
(
int16_t
*
)
buff
[
0
];
brf
->
meta_rx
.
actual_count
=
0
;
brf
->
meta_rx
.
flags
=
BLADERF_META_FLAG_RX_NOW
;
brf
->
meta_rx
.
flags
=
BLADERF_META_FLAG_RX_NOW
;
status
=
bladerf_sync_rx
(
brf
->
dev
,
samples
,
(
unsigned
int
)
nsamps
,
&
brf
->
meta_rx
,
2
*
brf
->
rx_timeout_ms
);
status
=
bladerf_sync_rx
(
brf
->
dev
,
samples
,
(
unsigned
int
)
nsamps
,
&
brf
->
meta_rx
,
2
*
brf
->
rx_timeout_ms
);
...
@@ -170,6 +213,10 @@ static int trx_brf_read(openair0_device *device, openair0_timestamp *ptimestamp,
...
@@ -170,6 +213,10 @@ static int trx_brf_read(openair0_device *device, openair0_timestamp *ptimestamp,
brf
->
num_overflows
,
brf
->
meta_rx
.
timestamp
,
brf
->
meta_rx
.
actual_count
,
nsamps
);
brf
->
num_overflows
,
brf
->
meta_rx
.
timestamp
,
brf
->
meta_rx
.
actual_count
,
nsamps
);
}
}
if
(
brf
->
meta_rx
.
actual_count
!=
nsamps
)
{
printf
(
"RX bad samples count, wanted %d, got %d
\n
"
,
nsamps
,
brf
->
meta_rx
.
actual_count
);
}
//printf("Current RX timestampe %u\n", brf->meta_rx.timestamp);
//printf("Current RX timestampe %u\n", brf->meta_rx.timestamp);
//printf("[BRF] (buff %p) ts=0x%"PRIu64" %s\n",samples, brf->meta_rx.timestamp,bladerf_strerror(status));
//printf("[BRF] (buff %p) ts=0x%"PRIu64" %s\n",samples, brf->meta_rx.timestamp,bladerf_strerror(status));
brf
->
rx_current_ts
=
brf
->
meta_rx
.
timestamp
;
brf
->
rx_current_ts
=
brf
->
meta_rx
.
timestamp
;
...
@@ -180,7 +227,7 @@ static int trx_brf_read(openair0_device *device, openair0_timestamp *ptimestamp,
...
@@ -180,7 +227,7 @@ static int trx_brf_read(openair0_device *device, openair0_timestamp *ptimestamp,
*
ptimestamp
=
brf
->
meta_rx
.
timestamp
;
*
ptimestamp
=
brf
->
meta_rx
.
timestamp
;
return
brf
->
meta_rx
.
actual_count
;
return
nsamps
;
//
brf->meta_rx.actual_count;
}
}
...
@@ -188,6 +235,7 @@ static int trx_brf_read(openair0_device *device, openair0_timestamp *ptimestamp,
...
@@ -188,6 +235,7 @@ static int trx_brf_read(openair0_device *device, openair0_timestamp *ptimestamp,
* \param device the hardware to use
* \param device the hardware to use
*/
*/
void
trx_brf_end
(
openair0_device
*
device
)
{
void
trx_brf_end
(
openair0_device
*
device
)
{
abort
();
int
status
;
int
status
;
brf_state_t
*
brf
=
(
brf_state_t
*
)
device
->
priv
;
brf_state_t
*
brf
=
(
brf_state_t
*
)
device
->
priv
;
...
@@ -1081,6 +1129,15 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
...
@@ -1081,6 +1129,15 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
// memcpy((void*)&device->openair0_cfg,(void*)&openair0_cfg[0],sizeof(openair0_config_t));
// memcpy((void*)&device->openair0_cfg,(void*)&openair0_cfg[0],sizeof(openair0_config_t));
if
((
status
=
bladerf_enable_module
(
brf
->
dev
,
BLADERF_MODULE_TX
,
false
))
!=
0
)
{
fprintf
(
stderr
,
"Failed to enable TX module: %s
\n
"
,
bladerf_strerror
(
status
));
abort
();
}
if
((
status
=
bladerf_enable_module
(
brf
->
dev
,
BLADERF_MODULE_RX
,
false
))
!=
0
)
{
fprintf
(
stderr
,
"Failed to enable RX module: %s
\n
"
,
bladerf_strerror
(
status
));
abort
();
}
return
0
;
return
0
;
}
}
...
...
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