Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
wr2rf-vme
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
5
Issues
5
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
wr2rf-vme
Commits
efefdba4
Commit
efefdba4
authored
Mar 30, 2021
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libwr2rf: return status for API
parent
93187f78
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
15 deletions
+28
-15
ad9910_init.c
software/libwr2rf/ad9910_init.c
+10
-5
init.c
software/libwr2rf/init.c
+13
-6
api.h
software/libwr2rf/libwr2rf/api.h
+2
-2
board.h
software/libwr2rf/libwr2rf/board.h
+1
-1
wr2rf.c
software/libwr2rf/wr2rf.c
+2
-1
No files found.
software/libwr2rf/ad9910_init.c
View file @
efefdba4
...
...
@@ -34,7 +34,8 @@ static struct ad9910_config_reg ad9910_default_config[] = {
#define AD9910_REG_CFR2 1
#define AD9910_DEFAULT_CFR2 0x400820
static
void
ad9910_probe
(
struct
libwr2rf_dev
*
dev
)
static
int
ad9910_probe
(
struct
libwr2rf_dev
*
dev
)
{
libwr2rf_dds_write
(
dev
,
0
,
0x0
,
32
);
// unidir mode for SDIO
libwr2rf_dds_write
(
dev
,
0
,
0x02000002
,
32
);
// unidir mode for SDIO
...
...
@@ -47,9 +48,10 @@ static void ad9910_probe(struct libwr2rf_dev *dev)
printf
(
"AD9910: 0x%x (expected 0x%x)
\n
"
,
id
,
AD9910_DEFAULT_CFR2
);
if
(
id
!=
AD9910_DEFAULT_CFR2
)
{
printf
(
"DDS not found
\n
"
);
exit
(
1
)
;
printf
(
"
AD9910: Error:
DDS not found
\n
"
);
return
-
1
;
}
return
0
;
}
static
uint64_t
ad9910_frequency_to_ftw
(
uint64_t
freq_hz
)
...
...
@@ -100,15 +102,17 @@ void libwr2rf_dds_configure_sync(struct libwr2rf_dev *dev, int sync_receiver_ena
libwr2rf_dds_ioupdate
(
dev
);
libwr2rf_dds_write
(
dev
,
0x1
,
0x00000800
,
32
);
// CFR2, TW - enabled sync pulse timing validation
libwr2rf_dds_ioupdate
(
dev
);
libwr2rf_dds_write
(
dev
,
0xa
,
r10
,
32
);
libwr2rf_dds_ioupdate
(
dev
);
}
void
int
libwr2rf_dds_init
(
struct
libwr2rf_dev
*
dev
,
unsigned
io_update
)
{
/* Probe. */
ad9910_probe
(
dev
);
if
(
ad9910_probe
(
dev
)
!=
0
)
return
-
1
;
/* Configure sync. */
/* TODO. */
...
...
@@ -118,6 +122,7 @@ libwr2rf_dds_init(struct libwr2rf_dev *dev, unsigned io_update)
uint64_t
ftw
=
ad9910_frequency_to_ftw
(
223500000ULL
);
ad9910_program
(
dev
,
ftw
,
0
,
0x0
,
io_update
);
return
0
;
}
void
...
...
software/libwr2rf/init.c
View file @
efefdba4
...
...
@@ -164,16 +164,18 @@ libwr2rf_nco_wrcfg (struct libwr2rf_dev *dev, unsigned ch)
return
0
;
}
static
void
static
int
libwr2rf_rf_init_dds
(
struct
libwr2rf_dev
*
dev
)
{
/* 3. DDS (ad9910). */
//libwr2rf_dds_spi_init(dev);
libwr2rf_dds_reset_pulse
(
dev
);
libwr2rf_dds_init
(
dev
,
1
);
if
(
libwr2rf_dds_init
(
dev
,
1
)
!=
0
)
return
-
1
;
usleep
(
1000
);
libwr2rf_dds_sync_calibrate
(
dev
,
0
);
return
0
;
}
static
void
...
...
@@ -207,15 +209,17 @@ libwr2rf_rf_init_rfnco (struct libwr2rf_dev *dev)
libwr2rf_nco_wrcfg
(
dev
,
2
);
}
void
int
libwr2rf_rf_init
(
struct
libwr2rf_dev
*
dev
)
{
libwr2rf_rf_init_dds
(
dev
);
if
(
libwr2rf_rf_init_dds
(
dev
)
!=
0
)
return
-
1
;
libwr2rf_rf_init_dac
(
dev
);
libwr2rf_rf_init_rfnco
(
dev
);
return
0
;
}
void
int
libwr2rf_api_init
(
struct
libwr2rf_dev
*
dev
)
{
...
...
@@ -235,7 +239,8 @@ libwr2rf_api_init (struct libwr2rf_dev *dev)
nco-source
nco-wrcfg
*/
libwr2rf_rf_init
(
dev
);
if
(
libwr2rf_rf_init
(
dev
)
!=
0
)
return
-
1
;
/* Configure RF outputs.
Command set-rfout
...
...
@@ -252,6 +257,8 @@ libwr2rf_api_init (struct libwr2rf_dev *dev)
/* Command nco-reset-delay */
libwr2rf_vtu_nco_reset_delay
(
dev
,
1
,
75
,
9
);
libwr2rf_vtu_nco_reset_delay
(
dev
,
2
,
75
,
0
);
return
0
;
}
void
...
...
software/libwr2rf/libwr2rf/api.h
View file @
efefdba4
...
...
@@ -66,10 +66,10 @@ int libwr2rf_nco_reset(struct libwr2rf_dev *dev, unsigned ch, unsigned en);
int
libwr2rf_set_rf_out
(
struct
libwr2rf_dev
*
dev
,
unsigned
ch
,
unsigned
cfg
);
/* Initialize RF (DDS and DAC). */
void
libwr2rf_rf_init
(
struct
libwr2rf_dev
*
dev
);
int
libwr2rf_rf_init
(
struct
libwr2rf_dev
*
dev
);
/* Post WR full initialization. */
void
libwr2rf_api_init
(
struct
libwr2rf_dev
*
dev
);
int
libwr2rf_api_init
(
struct
libwr2rf_dev
*
dev
);
/* tmg-io connector. */
//#define LIBWR2RF_TMGIO_OUT_RFSYNC 0 /* For channels 1 & 2 */
...
...
software/libwr2rf/libwr2rf/board.h
View file @
efefdba4
...
...
@@ -10,7 +10,7 @@ void libwr2rf_pll_write(struct libwr2rf_dev *dev, unsigned reg, uint8_t value);
/* For the dds (ad9910). */
void
libwr2rf_dds_spi_init
(
struct
libwr2rf_dev
*
dev
);
/* Note: common to dds and dac. */
void
libwr2rf_dds_init
(
struct
libwr2rf_dev
*
dev
,
unsigned
io_update
);
/* In ad9910_init.c */
int
libwr2rf_dds_init
(
struct
libwr2rf_dev
*
dev
,
unsigned
io_update
);
/* In ad9910_init.c */
void
libwr2rf_dds_reset
(
struct
libwr2rf_dev
*
dev
,
unsigned
reset
);
void
libwr2rf_dds_reset_pulse
(
struct
libwr2rf_dev
*
dev
);
void
libwr2rf_dds_configure_sync
(
struct
libwr2rf_dev
*
dev
,
int
sync_receiver_enable
,
...
...
software/libwr2rf/wr2rf.c
View file @
efefdba4
...
...
@@ -2987,7 +2987,8 @@ api_init (struct libwr2rf_dev *dev, int argc, char **argv)
sleep
(
1
);
}
libwr2rf_api_init
(
dev
);
if
(
libwr2rf_api_init
(
dev
)
!=
0
)
printf
(
"ERROR
\n
"
);
}
static
void
...
...
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