Hinoko.FwIsoIrSingle

g GObject.GInterface GObject.GInterface Hinoko.FwIsoCtx Hinoko.FwIsoCtx GObject.GInterface->Hinoko.FwIsoCtx GObject.Object GObject.Object Hinoko.FwIsoIrSingle Hinoko.FwIsoIrSingle GObject.Object->Hinoko.FwIsoIrSingle Hinoko.FwIsoCtx->Hinoko.FwIsoIrSingle

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Hinoko.FwIsoCtx (6)

Structs:

GObject.ObjectClass (5)

class

new ()

allocate (path, channel, header_size)

get_payload (index)

map_buffer (maximum_bytes_per_payload, payloads_per_buffer)

register_packet (schedule_interrupt)

start (cycle_match, sync_code, tags)

Virtual Methods

Inherited:

GObject.Object (7), Hinoko.FwIsoCtx (7)

do_interrupted (sec, cycle, header, count)

Properties

Inherited:

Hinoko.FwIsoCtx (2)

Signals

Inherited:

GObject.Object (1), Hinoko.FwIsoCtx (1)

Name

Short Description

interrupted

Emitted when Linux FireWire subsystem generates interrupt event.

Fields

Inherited:

GObject.Object (1), Hinoko.FwIsoCtx (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class Hinoko.FwIsoIrSingle(**kwargs)
Bases:

GObject.Object, Hinoko.FwIsoCtx

Abstract:

No

Structure:

Hinoko.FwIsoIrSingleClass

An object to receive isochronous packet for single channel. [class`FwIsoIrSingle`] receives isochronous packets for single channel by packet-per-buffer mode of IR context in 1394 OHCI. The content of packet is split to two parts; context header and context payload in a manner of Linux FireWire subsystem.

classmethod new()
Returns:

an instance of [class`FwIsoIrSingle`].

Return type:

Hinoko.FwIsoIrSingle

Instantiate [class`FwIsoIrSingle`] object and return the instance.

allocate(path, channel, header_size)
Parameters:
  • path (str) – A path to any Linux FireWire character device.

  • channel (int) – An isochronous channel to listen, up to 63.

  • header_size (int) – The number of bytes for header of IR context, greater than 4 at least to include isochronous packet header in header parameter of [signal`FwIsoIrSingle`:py:func:::interrupted<Hinoko.FwIsoIrSingle.signals.interrupted>].

Raises:

GLib.Error

Returns:

True if the overall operation finishes successfully, otherwise False.

Return type:

bool

Allocate an IR context to 1394 OHCI hardware for packet-per-buffer mode. A local node of the node corresponding to the given path is used as the hardware, thus any path is accepted as long as process has enough permission for the path.

The header_size parameter has an effect for the content of header parameter in [signal`FwIsoIrSingle`:py:func:::interrupted<Hinoko.FwIsoIrSingle.signals.interrupted>]. When it’s greater than 8, header includes the series of two quadlets for isochronous packet header and timestamp per isochronous packet. When it’s greater than 12, header includes the part of isochronous packet data per packet.

New in version 0.7.

get_payload(index)
Parameters:

index (int) – the index inner available packets at the event of interrupt.

Returns:

The array with data frame for payload of IR context.

Return type:

payload: bytes

Retrieve payload of IR context for a handled packet corresponding to index at the event of interrupt.

New in version 0.7.

map_buffer(maximum_bytes_per_payload, payloads_per_buffer)
Parameters:
  • maximum_bytes_per_payload (int) – The maximum number of bytes per payload of IR context.

  • payloads_per_buffer (int) – The number of payload in buffer.

Raises:

GLib.Error

Returns:

True if the overall operation finishes successfully, otherwise False.

Return type:

bool

Map intermediate buffer to share payload of IR context with 1394 OHCI hardware.

New in version 0.7.

register_packet(schedule_interrupt)
Parameters:

schedule_interrupt (bool) – Whether to schedule hardware interrupt at isochronous cycle for the packet.

Raises:

GLib.Error

Returns:

True if the overall operation finishes successfully, otherwise False.

Return type:

bool

Register chunk of buffer to process packet for future isochronous cycle. The caller can schedule hardware interrupt to generate interrupt event. In detail, please refer to documentation about [signal`FwIsoIrSingle`:py:func:::interrupted<Hinoko.FwIsoIrSingle.signals.interrupted>] signal.

New in version 0.7.

start(cycle_match, sync_code, tags)
Parameters:
  • cycle_match ([int] or None) – The isochronous cycle to start packet processing. The first element should be the second part of isochronous cycle, up to 3. The second element should be the cycle part of isochronous cycle, up to 7999.

  • sync_code (int) – The value of sy field in isochronous packet header for packet processing, up to 15.

  • tags (Hinoko.FwIsoCtxMatchFlag) – The value of tag field in isochronous header for packet processing.

Raises:

GLib.Error

Returns:

True if the overall operation finishes successfully, otherwise False.

Return type:

bool

Start IR context.

New in version 0.7.

do_interrupted(sec, cycle, header, count) virtual
Parameters:
  • sec (int) – The sec part of isochronous cycle when interrupt occurs, up to 7.

  • cycle (int) – The cycle part of of isochronous cycle when interrupt occurs, up to 7999.

  • header (bytes) – The headers of IR context for packets handled in the event of interrupt. The content is different depending on header_size parameter of [method`FwIsoIrSingle`.allocate].

  • count (int) – the number of packets to handle.

Class closure for the [signal`FwIsoIrSingle`:py:func:::interrupted<Hinoko.FwIsoIrSingle.signals.interrupted>] signal.

Signal Details

Hinoko.FwIsoIrSingle.signals.interrupted(fw_iso_ir_single, sec, cycle, header, count)
Signal Name:

interrupted

Flags:

RUN_LAST

Parameters:
  • fw_iso_ir_single (Hinoko.FwIsoIrSingle) – The object which received the signal

  • sec (int) – sec part of isochronous cycle when interrupt occurs, up to 7.

  • cycle (int) – cycle part of of isochronous cycle when interrupt occurs, up to 7999.

  • header (bytes) – The headers of IR context for packets handled in the event of interrupt. The content is different depending on header_size parameter of [method`FwIsoIrSingle`.allocate].

  • count (int) – the number of packets to handle.

Emitted when Linux FireWire subsystem generates interrupt event. There are three cases for Linux FireWire subsystem to generate the event:

  • When 1394 OHCI hardware generates hardware interrupt as a result to process the isochronous packet for the buffer chunk marked to generate hardware interrupt.

  • When the size of accumulated context header for packets since the last event reaches the size of memory page (usually 4,096 bytes).

  • When application calls [method`FwIsoCtx`.flush_completions] explicitly.

The handler of signal can retrieve context payload of received packet by call of [method`FwIsoIrSingle`.get_payload].