Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
DIOT Zynq Ultrascale-based System Board
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
8
Issues
8
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Projects
DIOT Zynq Ultrascale-based System Board
Commits
a84ff4e1
Commit
a84ff4e1
authored
Dec 02, 2021
by
Grzegorz Daniluk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
diot_util: add clocks pts
parent
89d5d1ac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
0 deletions
+62
-0
diot_util_clk.c
...ec/meta-user/recipes-apps/diot-util/files/diot_util_clk.c
+61
-0
diot_util_clk.h
...ec/meta-user/recipes-apps/diot-util/files/diot_util_clk.h
+1
-0
No files found.
sw/petalinux/project-spec/meta-user/recipes-apps/diot-util/files/diot_util_clk.c
View file @
a84ff4e1
...
...
@@ -11,6 +11,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "diot_util_error.h"
#include "diot_util_pts.h"
#define INPUT_PRESENT_FILE "/sys/bus/i2c/drivers/si5341/7-0076/input_present"
#define PLL_LOCKED_FILE "/sys/bus/i2c/drivers/si5341/7-0076/pll_locked"
...
...
@@ -152,6 +153,66 @@ char *check_ret_value(int ret, int val)
return
"Unkn"
;
}
int
pts_clocks
(
void
)
{
struct
pts_sensor
*
pts_sensor_p
;
int
val
,
ret
;
int
errors
=
0
;
int
i
;
char
path_buff
[
100
];
char
buff
[
20
];
printf
(
"Test Clocks"
);
get_file_content
(
INPUT_PRESENT_FILE
,
&
val
);
pts_sensor_p
=
find_pts_sensor
(
"PLL Input Present"
);
if
(
!
pts_sensor_inrange
(
val
,
pts_sensor_p
))
{
if
(
errors
++
==
0
)
printf
(
"
\r
FAIL Clocks
\n
"
);
printf
(
"
\t
%s: ERROR (%d vs [%.1f;%.1f])
\n
"
,
pts_sensor_p
->
short_name
,
val
,
pts_sensor_p
->
allowed_min
,
pts_sensor_p
->
allowed_max
);
}
get_file_content
(
PLL_LOCKED_FILE
,
&
val
);
pts_sensor_p
=
find_pts_sensor
(
"PLL Locked"
);
if
(
!
pts_sensor_inrange
(
val
,
pts_sensor_p
))
{
if
(
errors
++
==
0
)
printf
(
"
\r
FAIL Clocks
\n
"
);
printf
(
"
\t
%s: ERROR (%d vs [%.1f;%.1f])
\n
"
,
pts_sensor_p
->
short_name
,
val
,
pts_sensor_p
->
allowed_min
,
pts_sensor_p
->
allowed_max
);
}
get_selected_input
(
&
val
,
NULL
,
NULL
);
pts_sensor_p
=
find_pts_sensor
(
"PLL Input"
);
if
(
!
pts_sensor_inrange
(
val
,
pts_sensor_p
))
{
if
(
errors
++
==
0
)
printf
(
"
\r
FAIL Clocks
\n
"
);
printf
(
"
\t
%s: ERROR (%d vs [%.1f;%.1f])
\n
"
,
pts_sensor_p
->
short_name
,
val
,
pts_sensor_p
->
allowed_min
,
pts_sensor_p
->
allowed_max
);
}
for
(
i
=
0
;
i
<
SI5341_N_CH_OUT
;
i
++
)
{
snprintf
(
path_buff
,
sizeof
(
path_buff
),
"%s.%d/clk_rate"
,
SI5341_PREFIX_PATH
,
i
);
get_file_content
(
path_buff
,
&
val
);
snprintf
(
path_buff
,
sizeof
(
path_buff
),
"PLL Out%d"
,
i
);
pts_sensor_p
=
find_pts_sensor
(
path_buff
);
if
(
!
pts_sensor_inrange
((
float
)
val
/
1000000
,
pts_sensor_p
))
{
if
(
errors
++
==
0
)
printf
(
"
\r
FAIL Clocks
\n
"
);
printf
(
"
\t
%s: ERROR (%.1f vs [%.1f;%.1f])
\n
"
,
pts_sensor_p
->
short_name
,
(
float
)
val
/
1000000
,
pts_sensor_p
->
allowed_min
,
pts_sensor_p
->
allowed_max
);
}
}
if
(
errors
==
0
)
{
printf
(
"
\r
OK Clocks
\n
"
);
}
return
errors
;
}
int
cmd_clocks
(
char
*
params
)
{
int
val
;
...
...
sw/petalinux/project-spec/meta-user/recipes-apps/diot-util/files/diot_util_clk.h
View file @
a84ff4e1
...
...
@@ -11,6 +11,7 @@
#ifndef __DIOT_UTIL_CLK_H
#define __DIOT_UTIL_CLK_H
int
pts_clocks
(
void
);
int
cmd_clocks
(
char
*
params
);
#endif
/* __DIOT_UTIL_CLK_H */
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