Hinawa.CycleTime

Fields

None

Methods

class

new ()

class

parse_tstamp (tstamp)

compute_tstamp (tstamp)

get_clock_id ()

get_fields ()

get_raw ()

get_system_time ()

Details

class Hinawa.CycleTime

A boxed object to express data of cycle time. A [struct`CycleTime`] expresses the value of cycle time of 1394 OHCI as well as Linux system time referring to clock_id.

classmethod new()
Returns:

An instance of [struct`CycleTime`].

Return type:

Hinawa.CycleTime

Allocate and return an instance of [struct`CycleTime`].

New in version 2.6.

classmethod parse_tstamp(tstamp)
Parameters:

tstamp (int) – The value of time stamp retrieved from each context of 1394 OHCI.

Returns:

The result to parse the time stamp. The first element is for three order bits of second field in the format of IEEE 1394 CYCLE_TIME register, up to 7. The second element is for 13 bits of cycle field in the format, up to 7,999.

Return type:

isoc_cycle: [int]

Parse second count and cycle count from unsigned 16 bit integer value retrieved by Asynchronous Transmit (AT), Asynchronous Receive(AR), Isochronous Transmit (IT), and Isochronous Receive (IR) contexts of 1394 OHCI.

New in version 2.6.

compute_tstamp(tstamp)
Parameters:

tstamp (int) – The value of time stamp retrieved from each context of 1394 OHCI.

Returns:

The result to parse the time stamp. The first element is for 7 bits of second field in the format of IEEE 1394 CYCLE_TIME register, up to 127. The second element is for 13 bits of cycle field in the format, up to 7,999.

Return type:

isoc_cycle: [int]

Compute second count and cycle count from unsigned 16 bit integer value retrieved by Asynchronous Transmit (AT), Asynchronous Receive(AR), Isochronous Transmit (IT), and Isochronous Receive (IR) contexts of 1394 OHCI. The second count is completed with the internal value read from the CYCLE_TIME register. For the precise computation, the method should be called in the condition that the timing between receipt of time stamp and access to CYCLE_TIME register is within 8 seconds.

New in version 2.6.

get_clock_id()
Returns:

The numeric ID of clock source for the reference timestamp. One of CLOCK_REALTIME(0), CLOCK_MONOTONIC(1), and CLOCK_MONOTONIC_RAW(4) is available UAPI of Linux kernel.

Return type:

clock_id: int

Get the ID of clock for timestamp.

New in version 2.6.

get_fields()
Returns:

The value of cycle time register of 1394 OHCI hardware, including three elements; second, cycle, and offset in its order.

Return type:

fields: [int]

Get the value of cycle time in 1394 OHCI hardware. The first element of array expresses the value of sec field, up to 127. The second element of array expresses the value of cycle field, up to 7999. The third element of array expresses the value of offset field, up to 3071.

New in version 2.6.

get_raw()
Returns:

The raw value for CYCLE_TIME register.

Return type:

raw: int

Get the value of cycle time in 1394 OHCI hardware.

New in version 2.6.

get_system_time()
Returns:

tv_sec:

The second part of timestamp.

tv_nsec:

The nanosecond part of timestamp.

Return type:

(tv_sec: int, tv_nsec: int)

Get system time with enough size of strorage. The timestamp refers to clock_id available by [method`CycleTime`.get_clock_id].

New in version 2.6.