dxd - dynax driver framework 3.0.2
cross platform open source driver development framework
Loading...
Searching...
No Matches
dxd::clock Class Referenceabstract

DriverKit periodic software clock, mirroring dx::clock's tick()/run()/halt() shape. More...

#include <dxd_clock.h>

Inheritance diagram for dxd::clock:
Collaboration diagram for dxd::clock:

Public Member Functions

virtual void align(int64_t &)
 aligns the next objective(system time, 100ns units) to an external time base, e.g. a bus frame counter; the plain period by default
 clock()
void halt() noexcept
 disarm; no-op if never run()
void halt() noexcept
 stop and join the clock thread; no-op if never run()
os_result run(int64_t period)
 create and arm the timer source (autonomous mode)
os_result run(int64_t period)
 create and start the clock thread(autonomous mode)
virtual void tick()= 0
 per-tick handler, called on the clock's queue in autonomous mode, or synchronously by the owning device in pod mode.
virtual void tick()= 0
 per-tick handler, called from the clock's own thread at PASSIVE_LEVEL in autonomous mode, or synchronously by the owning device in pod mode.
virtual ~clock()
 the source goes only once it is cancelled: nothing of the clock may be reached by a wakeup already in flight
virtual ~clock()
 virtual destructur

Protected Types

enum class  priority { low = LOW_PRIORITY , realtime = LOW_REALTIME_PRIORITY , high = HIGH_PRIORITY }
 the thread priorities a driver's own thread is raised to More...

Protected Member Functions

void join()
 launch() returned: the queue drained, unless launch() itself asks
void join()
 the completion event is signalled on launch()'s way out, the thread object only once the thread left the image; the thread itself never joins
os_result prio(prioritypriority prioritypriority)
os_result run()

Static Protected Member Functions

static unsigned int prio()

Protected Attributes

os_result status
dx::stream::clock::strategy strategy{}
 the wait toward each tick's objective

Friends

class ::dxd_timer
struct dx::stream::clock
 its wait() takes now(), sleep() and relax()

Detailed Description

DriverKit periodic software clock, mirroring dx::clock's tick()/run()/halt() shape.

kernel-mode periodic software clock, mirroring dx::clock's tick()/run()/halt() shape

A dext has no threads: an IOTimerDispatchSource on the clock's own serial queue fires TimerOccurred, tick() runs there and the source is re-armed at an accumulated absolute deadline, so the period neither drifts nor depends on the tick's own duration. run() never called and tick() driven from an IOCTL is the pod mode, as on the other platforms.

A dxd::process(PASSIVE_LEVEL system thread) that waits toward each tick's objective by its strategy (dx::stream::clock::wait): a high resolution EX_TIMER up to the strategy's lead, expiring on the process's own event, then polling the rest; so a derived class's tick() body runs without DISPATCH_LEVEL restrictions - unlike a DPC-driven timer. EX_TIMER_HIGH_RESOLUTION is what keeps the sub-millisecond period precision small buffer sizes need: a KTIMER expires on the system clock interrupt alone, 15.6 ms apart. Re-arming against an accumulated absolute due time each iteration avoids drift.

A device that never calls run() and instead calls tick() directly (from an externally-driven IOCTL, e.g. ioctl::stream::clock::frame) gets the pod/puppet mode - no thread, no timer, purely reactive; see dxd/CLAUDE.md's kernel clock notes. Both modes are this same class; the difference is only whether run() was ever called.

Member Enumeration Documentation

◆ priority

enum class dxd::process::priority
stronginherited

the thread priorities a driver's own thread is raised to

Enumerator
low 

Lowest thread priority level.

realtime 

Lowest realtime priority level.

high 

Highest thread priority level.

Constructor & Destructor Documentation

◆ ~clock() [1/2]

virtual dxd::clock::~clock()
inlinevirtual

the source goes only once it is cancelled: nothing of the clock may be reached by a wakeup already in flight

Here is the call graph for this function:

◆ clock()

◆ ~clock() [2/2]

virtual dxd::clock::~clock()
inlinevirtual

virtual destructur

clock base class needs virtual destructor; although its a dummy; to ensure inherited and composite objects to be correctly destructed.

Here is the call graph for this function:

Member Function Documentation

◆ align()

virtual void dxd::clock::align(int64_t&)
inlinevirtual

aligns the next objective(system time, 100ns units) to an external time base, e.g. a bus frame counter; the plain period by default

◆ halt() [1/2]

void dxd::clock::halt()
inlinenoexcept

disarm; no-op if never run()

Here is the caller graph for this function:

◆ halt() [2/2]

void dxd::clock::halt()
inlinenoexcept

stop and join the clock thread; no-op if never run()

<wake launch()'s wait() so it observes running==false and exits

Here is the call graph for this function:

◆ join() [1/2]

void dxd::process::join()
inlineprotectedinherited

launch() returned: the queue drained, unless launch() itself asks

Here is the caller graph for this function:

◆ join() [2/2]

void dxd::process::join()
inlineprotectedinherited

the completion event is signalled on launch()'s way out, the thread object only once the thread left the image; the thread itself never joins

◆ prio() [1/2]

unsigned int dxd::process::prio()
inlinestaticinherited
Here is the caller graph for this function:

◆ prio() [2/2]

os_result dxd::process::prio(priority priority)
inlineinherited

◆ run() [1/3]

os_result dxd::clock::run(int64_t period)
inline

create and arm the timer source (autonomous mode)

Parameters
periodtick period, ns (see dxd::scale)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ run() [2/3]

os_result dxd::clock::run(int64_t period)
inline

create and start the clock thread(autonomous mode)

Parameters
periodtick period, 100ns units(see dxd::scale)
Here is the call graph for this function:

◆ run() [3/3]

os_result dxd::process::run()
inlineinherited
Here is the call graph for this function:
Here is the caller graph for this function:

◆ tick() [1/2]

virtual void dxd::clock::tick()
pure virtual

per-tick handler, called on the clock's queue in autonomous mode, or synchronously by the owning device in pod mode.

◆ tick() [2/2]

virtual void dxd::clock::tick()
pure virtual

per-tick handler, called from the clock's own thread at PASSIVE_LEVEL in autonomous mode, or synchronously by the owning device in pod mode.

◆ ::dxd_timer

friend class ::dxd_timer
friend

◆ dx::stream::clock

friend struct dx::stream::clock
friend

its wait() takes now(), sleep() and relax()

Member Data Documentation

◆ status

os_result dxd::process::status
inherited

◆ strategy

dx::stream::clock::strategy dxd::clock::strategy{}
protected

the wait toward each tick's objective


The documentation for this class was generated from the following files: