Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
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
White Rabbit Switch - Software
Commits
8d5ed9f3
Commit
8d5ed9f3
authored
Dec 01, 2016
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'adam-fix_hal_high_load'
parents
dfcea15f
9b27811e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
16 additions
and
16 deletions
+16
-16
util.h
userspace/libwr/include/libwr/util.h
+1
-1
ptpd_netif.c
userspace/libwr/ptpd_netif.c
+3
-3
shmem.c
userspace/libwr/shmem.c
+2
-2
util.c
userspace/libwr/util.c
+3
-3
hal_main.c
userspace/wrsw_hal/hal_main.c
+3
-3
timeout.h
userspace/wrsw_hal/timeout.h
+4
-4
No files found.
userspace/libwr/include/libwr/util.h
View file @
8d5ed9f3
...
...
@@ -16,7 +16,7 @@
void
shw_udelay_init
(
void
);
void
shw_udelay
(
uint32_t
microseconds
);
/* get monotonic number of useconds */
uint64_t
get_monotonic_
tic
s
(
void
);
uint64_t
get_monotonic_
u
s
(
void
);
/* get monotonic number of seconds */
time_t
get_monotonic_sec
(
void
);
...
...
userspace/libwr/ptpd_netif.c
View file @
8d5ed9f3
...
...
@@ -51,20 +51,20 @@ struct etherpacket {
static
inline
int
tmo_init
(
struct
wr_tmo
*
tmo
,
uint32_t
milliseconds
)
{
tmo
->
start_tics
=
get_monotonic_
tic
s
();
tmo
->
start_tics
=
get_monotonic_
u
s
();
tmo
->
timeout
=
(
uint64_t
)
milliseconds
*
1000ULL
;
return
0
;
}
static
inline
int
tmo_restart
(
struct
wr_tmo
*
tmo
)
{
tmo
->
start_tics
=
get_monotonic_
tic
s
();
tmo
->
start_tics
=
get_monotonic_
u
s
();
return
0
;
}
static
inline
int
tmo_expired
(
struct
wr_tmo
*
tmo
)
{
return
(
get_monotonic_
tic
s
()
-
tmo
->
start_tics
>
tmo
->
timeout
);
return
(
get_monotonic_
u
s
()
-
tmo
->
start_tics
>
tmo
->
timeout
);
}
// cheks if x is inside range <min, max>
...
...
userspace/libwr/shmem.c
View file @
8d5ed9f3
...
...
@@ -80,7 +80,7 @@ struct wrs_shm_head *wrs_shm_get(enum wrs_shm_name name_id, char *name,
if
(
!
(
flags
&
wrs_shm_locked
))
return
map
;
tv1
=
get_monotonic_
tic
s
();
tv1
=
get_monotonic_
u
s
();
while
(
1
)
{
/* Releasing does not mean initial data is in place! */
/* Read data with wrs_shm_seqbegin and
...
...
@@ -89,7 +89,7 @@ struct wrs_shm_head *wrs_shm_get(enum wrs_shm_name name_id, char *name,
return
map
;
usleep
(
10
*
1000
);
tv2
=
get_monotonic_
tic
s
();
tv2
=
get_monotonic_
u
s
();
if
(((
tv2
-
tv1
)
/
1000
)
<
SHM_LOCK_TIMEOUT_MS
)
continue
;
...
...
userspace/libwr/util.c
View file @
8d5ed9f3
...
...
@@ -14,10 +14,10 @@ void shw_udelay_init(void)
int
j
,
cur
,
min
=
0
;
uint64_t
tv1
,
tv2
;
for
(
j
=
0
;
j
<
10
;
j
++
)
{
tv1
=
get_monotonic_
tic
s
();
tv1
=
get_monotonic_
u
s
();
for
(
i
=
0
;
i
<
100
*
1000
;
i
++
)
;
tv2
=
get_monotonic_
tic
s
();
tv2
=
get_monotonic_
u
s
();
cur
=
tv2
-
tv1
;
/* keep minimum time, assuming we were scheduled-off less */
if
(
!
min
||
cur
<
min
)
...
...
@@ -53,7 +53,7 @@ void shw_udelay(uint32_t microseconds)
}
/* get monotonic number of useconds */
uint64_t
get_monotonic_
tic
s
(
void
)
uint64_t
get_monotonic_
u
s
(
void
)
{
struct
timespec
tv
;
clock_gettime
(
CLOCK_MONOTONIC
,
&
tv
);
...
...
userspace/wrsw_hal/hal_main.c
View file @
8d5ed9f3
...
...
@@ -254,14 +254,14 @@ int main(int argc, char *argv[])
* includes some jitter.
*/
t1
=
get_monotonic_
tic
s
();
t1
=
get_monotonic_
u
s
();
for
(;;)
{
int
delay_ms
;
hal_update_wripc
(
25
/* max ms delay */
);
t2
=
get_monotonic_
tic
s
();
delay_ms
=
(
t2
-
t1
)
*
1000
;
t2
=
get_monotonic_
u
s
();
delay_ms
=
(
t2
-
t1
)
/
1000
;
if
(
delay_ms
<
PORT_FAN_MS_PERIOD
)
continue
;
...
...
userspace/wrsw_hal/timeout.h
View file @
8d5ed9f3
...
...
@@ -15,23 +15,23 @@ typedef struct {
static
inline
int
tmo_init
(
timeout_t
*
tmo
,
uint32_t
milliseconds
,
int
repeat
)
{
tmo
->
repeat
=
repeat
;
tmo
->
start_tics
=
get_monotonic_
tic
s
();
tmo
->
start_tics
=
get_monotonic_
u
s
();
tmo
->
timeout
=
(
uint64_t
)
milliseconds
*
1000ULL
;
return
0
;
}
static
inline
int
tmo_restart
(
timeout_t
*
tmo
)
{
tmo
->
start_tics
=
get_monotonic_
tic
s
();
tmo
->
start_tics
=
get_monotonic_
u
s
();
return
0
;
}
static
inline
int
tmo_expired
(
timeout_t
*
tmo
)
{
int
expired
=
(
get_monotonic_
tic
s
()
-
tmo
->
start_tics
>
tmo
->
timeout
);
int
expired
=
(
get_monotonic_
u
s
()
-
tmo
->
start_tics
>
tmo
->
timeout
);
if
(
tmo
->
repeat
&&
expired
)
tmo
->
start_tics
=
get_monotonic_
tic
s
();
tmo
->
start_tics
=
get_monotonic_
u
s
();
return
expired
;
}
...
...
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