Class: Dread::EndpointEvent

Inherits:
Event show all
Defined in:
lib/dread/endpoint_event.rb

Constant Summary collapse

DEPEVT_XFERCOMPLETE =
0x01
DEPEVT_XFERINPROGRESS =
0x02
DEPEVT_XFERNOTREADY =
0x03
DEPEVT_RXTXFIFOEVT =
0x04
DEPEVT_STREAMEVT =
0x06
DEPEVT_EPCMDCMPLT =
0x07
STREAMEVT_FOUND =
1
STREAMEVT_NOTFOUND =
2
CONTROL_DATA =
(1 << 0)
CONTROL_STATUS =
(2 << 0)
TRANSFER_ACTIVE =
(1 << 3)
XFERCOMPLETE_LST =
(1 << 3)
XFERCOMPLETE_IOC =
(1 << 2)
XFERCOMPLETE_SHORT =
(1 << 1)

Instance Attribute Summary collapse

Attributes inherited from Trace

#cpu, #data, #function, #pid, #task, #timestamp

Instance Method Summary collapse

Methods inherited from Event

#endpoint?, #gadget?

Methods included from Bitfield

#field

Constructor Details

#initialize(line) ⇒ EndpointEvent

Returns a new instance of EndpointEvent.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/dread/endpoint_event.rb', line 30

def initialize(line)
  super

  @event_type = {
    DEPEVT_XFERCOMPLETE => "Transfer Complete",
    DEPEVT_XFERINPROGRESS => "Transfer In Progress",
    DEPEVT_XFERNOTREADY => "Transfer Not Ready",
    DEPEVT_RXTXFIFOEVT => "FIFO Event",
    DEPEVT_STREAMEVT => "Stream",
    DEPEVT_EPCMDCMPLT => "Command Complete",
  }

  decode
end

Instance Attribute Details

#epnumObject (readonly)

Returns the value of attribute epnum.



6
7
8
# File 'lib/dread/endpoint_event.rb', line 6

def epnum
  @epnum
end

#parametersObject (readonly)

Returns the value of attribute parameters.



9
10
11
# File 'lib/dread/endpoint_event.rb', line 9

def parameters
  @parameters
end

#statusObject (readonly)

Returns the value of attribute status.



8
9
10
# File 'lib/dread/endpoint_event.rb', line 8

def status
  @status
end

#typeObject (readonly)

Returns the value of attribute type.



7
8
9
# File 'lib/dread/endpoint_event.rb', line 7

def type
  @type
end

Instance Method Details

#decodeObject



45
46
47
48
49
50
51
52
# File 'lib/dread/endpoint_event.rb', line 45

def decode
  @event_data = super

  @epnum = field(@event_data, 5, 1)
  @type = field(@event_data, 9, 6)
  @status = field(@event_data, 15, 12)
  @parameters = field(@event_data, 31, 16)
end

#endpointObject



72
73
74
75
76
77
# File 'lib/dread/endpoint_event.rb', line 72

def endpoint
  num = @epnum >> 1
  dir = (@epnum & 1) == 1 ? "in" : "out"

  "ep#{num}#{dir}"
end

#to_sObject



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/dread/endpoint_event.rb', line 54

def to_s
  str = super

  str += ": #{endpoint}: "
  str += @event_type[@type]

  case @type
  when DEPEVT_XFERCOMPLETE
    str += xfer_complete_status
  when DEPEVT_XFERNOTREADY
    str += xfer_not_ready_status
  when DEPEVT_STREAMEVT
    str += stream_extras
  end

  str
end