-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ofs: initial implementation of libofs #1899
Conversation
libofs is meant to contain primitive routines for interfacing with a dfl feature in user space. This will typically be mmio register space. This first implementation is more of a staging and integration into the opae-sdk repository and build system. This currently contains two macros that can be used to wait for variables to either be set to a specific value or different from a specific value.
When doing time delta, account for the case when the lhs nsec happens to be smaller than the rhs. When this happens, add 1E9 nsec to lhs nsec before subtracting and subtract it from the sec component.
opae_add_shared_library( | ||
TARGET ofs | ||
SOURCE ${src} | ||
VERSION ${OPAE_VERSION} | ||
SOVERSION ${OPAE_VERSION_MAJOR} | ||
COMPONENT libofs | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be listed in opae.spec.in
? And do you plan to create a new RPM package for? (I.e. opae-ofs.rpm
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably and most likely will be in some rpm or another. Because this is in a feature branch, I'm sort of laying the groundwork for this library as well as a user mode driver framework that I've been prototyping.
ofs/libofs/ofs_primitives.h
Outdated
clock_gettime(CLOCK_MONOTONIC, &now); \ | ||
uint64_t delta_sec = (now.tv_sec - begin.tv_sec)*1E9; \ | ||
uint64_t delta_nsec = now.tv_nsec < begin.tv_nsec) ? \ | ||
(1E9 + now.tv_nsec) - begin.tv_nsec + (delta_sec-1)*1E9 :\ | ||
now.tv_nsec - begin.tv_nsec + delta_sec*1E9; \ | ||
if (_timeout_usec*1E3 > delta_nsec) { \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like it could be a useful macro, fx OFS_TIMESPEC_AFTER_USEC(_begin, _usec)
ofs/libofs/ofs_primitives.h
Outdated
status; \ | ||
}) | ||
|
||
#define OFS_WAIT_FOR_CHANGE(_bit, _value, _timeout_usec, _sleep_usec) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should OFS_WAIT_FOR_CHANGE()
and OFS_WAIT_FOR()
be documented somewhere ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'll probably document it along with other ofs APIs as it matures.
Move away from macros and use inline functions. Add doxygen comments and inlclude gtest tests.
59ec00f libofs: add libofs and umd (user mode driver) framework 9561585 libofs: fix blank lines in files b75690c libofs: finish migration to opae-libs repo f552e4d ofs_parse: look for call nodes in ast 049e00a ofs-umd: fix ofs_resolve to check func.id 4006206 libofs: add macros to wait for bit fields 15bac6c ofs umd: add ofs umd framework (#1909) e62592b ofs: initial implementation of libofs (#1899) git-subtree-dir: opae-libs git-subtree-split: 59ec00f
a53e62e ofs-umd: fix ofs_add_driver cmake macro (#140) 59ec00f libofs: add libofs and umd (user mode driver) framework 9561585 libofs: fix blank lines in files b75690c libofs: finish migration to opae-libs repo f552e4d ofs_parse: look for call nodes in ast 049e00a ofs-umd: fix ofs_resolve to check func.id 4006206 libofs: add macros to wait for bit fields 15bac6c ofs umd: add ofs umd framework (#1909) e62592b ofs: initial implementation of libofs (#1899) git-subtree-dir: opae-libs git-subtree-split: a53e62e
* ofs: initial implementation of libofs libofs is meant to contain primitive routines for interfacing with a dfl feature in user space. This will typically be mmio register space. This first implementation is more of a staging and integration into the opae-sdk repository and build system. This currently contains: * macros to help with time related function/structures * ofs_diff_timespec : C function that calculates difference between two timespec structs * ofs_wait_for_eq32 and ofs_wait_for_eq64: Two functions that poll waiting for a pointer's value to equal a given value. * simple unit tests for the added code
libofs is meant to contain primitive routines for interfacing with a dfl
feature in user space. This will typically be mmio register space.
This first implementation is more of a staging and integration into the
opae-sdk repository and build system.
This currently contains two macros that can be used to wait for
variables to either be set to a specific value or different from a
specific value.