Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Schedules
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
Software for White Rabbit PTP Core
Commits
2a197f48
Commit
2a197f48
authored
Apr 13, 2020
by
Tomasz Wlostowski
Committed by
Grzegorz Daniluk
Apr 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
boards/ertm14: rename ertm14 config structure to state for clarity...
parent
df08f3b8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
21 deletions
+21
-21
board.c
boards/ertm14/board.c
+9
-9
board.h
boards/ertm14/board.h
+5
-5
cmd_ertm14.c
boards/ertm14/cmd_ertm14.c
+7
-7
No files found.
boards/ertm14/board.c
View file @
2a197f48
...
...
@@ -63,8 +63,8 @@
#define ERTM14_PSYNC_DEBUG
struct
ertm14_board
board
;
static
struct
ertm14_board_
config
ertm14_configs
[
ERTM14_MAX_CONFIGS
];
static
struct
ertm14_board_
config
*
ertm14_current_config
;
static
struct
ertm14_board_
state
ertm14_configs
[
ERTM14_MAX_CONFIGS
];
static
struct
ertm14_board_
state
*
ertm14_current_state
;
static
struct
gpio_pin
pin_pll_main_cs_n
=
{
&
board
.
gpio_aux
,
0
};
static
struct
gpio_pin
pin_pll_main_sdi
=
{
&
board
.
gpio_aux
,
1
};
...
...
@@ -922,7 +922,7 @@ void ertm14_config_init()
for
(
i
=
0
;
i
<
ERTM14_MAX_CONFIGS
;
i
++
)
{
struct
ertm14_board_
config
*
cfg
=
&
ertm14_configs
[
i
];
struct
ertm14_board_
state
*
cfg
=
&
ertm14_configs
[
i
];
cfg
->
valid
=
1
;
cfg
->
lo
.
ftw
=
0x39374BC6
;
...
...
@@ -947,7 +947,7 @@ void ertm14_config_init()
}
};
struct
ertm14_board_
config
*
ertm14_get
_config
(
int
config_id
)
struct
ertm14_board_
state
*
ertm14_get_state_for
_config
(
int
config_id
)
{
return
&
ertm14_configs
[
config_id
];
}
...
...
@@ -955,7 +955,7 @@ struct ertm14_board_config *ertm14_get_config(int config_id)
int
ertm14_apply_config
(
int
config_id
)
{
ertm14_current_
config
=
&
ertm14_configs
[
config_id
];
ertm14_current_
state
=
&
ertm14_configs
[
config_id
];
has_new_config
=
1
;
}
...
...
@@ -964,13 +964,13 @@ int ertm14_get_current_config_id()
int
i
;
for
(
i
=
0
;
i
<
ERTM14_MAX_CONFIGS
;
i
++
)
if
(
&
ertm14_configs
[
i
]
==
ertm14_current_config
)
if
(
&
ertm14_configs
[
i
]
==
ertm14_current_state
)
return
i
;
return
-
1
;
}
static
int
ertm14_commit_config
(
struct
ertm14_board_
config
*
cfg
)
static
int
ertm14_commit_config
(
struct
ertm14_board_
state
*
cfg
)
{
int
i
;
for
(
i
=
0
;
i
<=
ERTM14_CLKAB_OUT_MAX_ID
;
i
++
)
...
...
@@ -1018,7 +1018,7 @@ static int ertm14_commit_config( struct ertm14_board_config *cfg )
static
int
ertm14_update_config_task
(
void
)
{
if
(
has_new_config
&&
ertm_init_complete
&&
ertm14_current_
config
->
valid
)
if
(
has_new_config
&&
ertm_init_complete
&&
ertm14_current_
state
->
valid
)
{
int
i
;
pp_printf
(
"New config detected, applying...
\n
"
);
...
...
@@ -1027,7 +1027,7 @@ static int ertm14_update_config_task(void)
if
(
!
(
board
.
mode
&
ERTM14_MODE_WITHOUT_ERTM15
))
{
ertm14_commit_config
(
ertm14_current_
config
);
ertm14_commit_config
(
ertm14_current_
state
);
ertm14_clk_pps_sync_restart
();
}
}
...
...
boards/ertm14/board.h
View file @
2a197f48
...
...
@@ -166,7 +166,7 @@ struct ertm14_board
int
dds_resync_count
;
};
struct
ertm14_dds_
config
struct
ertm14_dds_
state
{
uint32_t
ftw
;
uint8_t
out_state
[
ERTM14_RF_OUT_MAX_ID
+
1
];
...
...
@@ -177,11 +177,11 @@ struct ertm14_dds_config
int
sync_count
;
};
struct
ertm14_board_
config
struct
ertm14_board_
state
{
int
valid
;
struct
ertm14_dds_
config
ref
;
struct
ertm14_dds_
config
lo
;
struct
ertm14_dds_
state
ref
;
struct
ertm14_dds_
state
lo
;
uint32_t
clka_freq_hz
[
ERTM14_CLKAB_OUT_MAX_ID
+
1
];
uint32_t
clkb_freq_hz
[
ERTM14_CLKAB_OUT_MAX_ID
+
1
];
uint32_t
clka_enable_mask
;
...
...
@@ -193,7 +193,7 @@ struct ertm14_board_config
extern
struct
ertm14_board
board
;
void
ertm14_config_init
(
void
);
struct
ertm14_board_
config
*
ertm14_get
_config
(
int
config_id
);
struct
ertm14_board_
state
*
ertm14_get_state_for
_config
(
int
config_id
);
int
ertm14_apply_config
(
int
config_id
);
int
ertm14_get_current_config_id
(
void
);
int
ertm14_is_config_ready
(
void
);
...
...
boards/ertm14/cmd_ertm14.c
View file @
2a197f48
...
...
@@ -36,7 +36,7 @@ static const char *get_rf_out_state_string(int state)
}
static
void
dump_dds_state
(
const
char
*
name
,
struct
ertm14_dds_
config
*
cfg
)
static
void
dump_dds_state
(
const
char
*
name
,
struct
ertm14_dds_
state
*
cfg
)
{
int
i
;
pp_printf
(
"%s DDS FTW: 0x%08x
\n
"
,
name
,
cfg
->
ftw
);
...
...
@@ -49,7 +49,7 @@ static void dump_dds_state( const char *name, struct ertm14_dds_config *cfg )
);
}
static
void
dump_config
(
int
id
,
struct
ertm14_board_
config
*
cfg
)
static
void
dump_config
(
int
id
,
struct
ertm14_board_
state
*
cfg
)
{
int
i
=
0
;
...
...
@@ -97,12 +97,12 @@ static void set_dds_param(int param, const char *name, const char *value, const
int
is_lo
=
!
strcasecmp
(
name
,
"lo"
);
int
is_ref
=
!
strcasecmp
(
name
,
"ref"
);
struct
ertm14_board_
config
*
cfg
=
ertm14_get
_config
(
selected_config
);
struct
ertm14_board_
state
*
cfg
=
ertm14_get_state_for
_config
(
selected_config
);
cfg
->
valid
=
1
;
if
(
is_lo
||
is_ref
)
{
struct
ertm14_dds_
config
*
dcfg
=
is_lo
?
&
cfg
->
lo
:
&
cfg
->
ref
;
struct
ertm14_dds_
state
*
dcfg
=
is_lo
?
&
cfg
->
lo
:
&
cfg
->
ref
;
switch
(
param
)
{
...
...
@@ -131,7 +131,7 @@ static void set_clk_param(int param, const char *name, const char *channel, cons
int
is_clka
=
!
strcasecmp
(
name
,
"clka"
);
int
is_clkb
=
!
strcasecmp
(
name
,
"clkb"
);
struct
ertm14_board_
config
*
cfg
=
ertm14_get
_config
(
selected_config
);
struct
ertm14_board_
state
*
cfg
=
ertm14_get_state_for
_config
(
selected_config
);
cfg
->
valid
=
1
;
...
...
@@ -282,7 +282,7 @@ static int cmd_ertm(const char *args[])
}
else
if
(
!
strcasecmp
(
args
[
0
],
"show-config"
)
)
{
dump_config
(
i
,
ertm14_get_config
(
selected_config
)
);
dump_config
(
i
,
ertm14_get_
state_for_
config
(
selected_config
)
);
}
else
if
(
!
strcasecmp
(
args
[
0
],
"activate-config"
)
)
{
if
(
!
args
[
1
]
)
...
...
@@ -291,7 +291,7 @@ static int cmd_ertm(const char *args[])
}
int
id
=
atoi
(
args
[
1
]);
pp_printf
(
"Activating configuration %d:
\n
"
,
id
);
dump_config
(
id
,
ertm14_get_config
(
id
)
);
dump_config
(
id
,
ertm14_get_
state_for_
config
(
id
)
);
ertm14_apply_config
(
id
);
...
...
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