Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DEL 1ns 4cha - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
FMC DEL 1ns 4cha - Software
Commits
8779d604
Commit
8779d604
authored
Apr 25, 2012
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
time: get_time now works
parent
2cb2cad0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
16 deletions
+10
-16
time.c
time.c
+10
-16
No files found.
time.c
View file @
8779d604
...
...
@@ -55,30 +55,24 @@ int fd_time_set(struct spec_fd *fd, struct fd_time *t, struct timespec *ts)
/* If fd_time is not null, use it. Otherwise use ts */
int
fd_time_get
(
struct
spec_fd
*
fd
,
struct
fd_time
*
t
,
struct
timespec
*
ts
)
{
uint32_t
h1
,
l1
,
h2
,
l2
,
c
;
uint32_t
tcr
,
h
,
l
,
c
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
fd
->
lock
,
flags
);
/* get the tuple. If inconsistent re-read the high part */
h1
=
fd_readl
(
fd
,
FD_REG_TM_SECH
);
l1
=
fd_readl
(
fd
,
FD_REG_TM_SECL
);
c
=
fd_readl
(
fd
,
FD_REG_TM_CYCLES
);
h2
=
fd_readl
(
fd
,
FD_REG_TM_SECH
);
l2
=
fd_readl
(
fd
,
FD_REG_TM_SECL
);
if
(
h2
!=
h1
||
l2
!=
l1
)
{
c
=
fd_readl
(
fd
,
FD_REG_TM_CYCLES
);
h1
=
h2
;
l1
=
l2
;
}
tcr
=
fd_readl
(
fd
,
FD_REG_TCR
);
fd_writel
(
fd
,
tcr
|
FD_TCR_CAP_TIME
,
FD_REG_TCR
);
h
=
fd_readl
(
fd
,
FD_REG_TM_SECH
);
l
=
fd_readl
(
fd
,
FD_REG_TM_SECL
);
c
=
fd_readl
(
fd
,
FD_REG_TM_CYCLES
);
spin_unlock_irqrestore
(
&
fd
->
lock
,
flags
);
printk
(
"got %i %i %i
\n
"
,
h1
,
l1
,
c
);
printk
(
"%s: got %i %i %i
\n
"
,
__func__
,
h
,
l
,
c
);
if
(
t
)
{
t
->
utc
=
((
uint64_t
)
h
1
<<
32
)
|
l1
;
t
->
utc
=
((
uint64_t
)
h
<<
32
)
|
l
;
t
->
coarse
=
c
;
}
if
(
ts
)
{
ts
->
tv_sec
=
((
uint64_t
)
h
1
<<
32
)
|
l1
;
ts
->
tv_sec
=
((
uint64_t
)
h
<<
32
)
|
l
;
ts
->
tv_nsec
=
c
*
8
;
}
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