parlib: have delay functions return end time; add nsec call.
authorRonald G. Minnich <rminnich@gmail.com>
Wed, 31 Aug 2016 22:28:07 +0000 (15:28 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 31 Aug 2016 22:53:32 +0000 (18:53 -0400)
commitc9e3a91ac6637fd965a8401c70a23e95f6f46f61
tree1c8c4b46d08424ed9537482eb0456f1762b965d4
parentcab1d19d33719faee0231f7e0bd495f97a341c17
parlib: have delay functions return end time; add nsec call.

Delay functions don't necessarily end right at the exact time
asked. Change udelay and ndelay to return the last read time in
microseconds and nanoseconds, respectively. A side effect is that
udelay(0) and ndelay(0) return approximate current time.

Add an nsec() call to return the current nanoseconds as a uint64_t.

While we're at it, have timing.c including timing.h so we can
be sure the prototypes match the function definitions.

And, finally, clang-format it.

Change-Id: I22b855ac055314a1846dc45f93378675104f13a4
Signed-off-by: Ronald G. Minnich <rminnich@gmail.com>
[checkpatch touchup]
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
user/parlib/include/parlib/timing.h
user/parlib/timing.c