Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a04f10e8 authored by Myles Watson's avatar Myles Watson
Browse files

HCI: Add support for synchronous commands

Bug: 175844355
Tag: #gd-refactor
Test: make
Change-Id: I7a22a399cb175e6702b2c14df4c8f35def8835cf
parent d0e057f9
Loading
Loading
Loading
Loading
+65 −28
Original line number Diff line number Diff line
@@ -624,7 +624,7 @@ packet DiscoveryCommand : Command { _payload_, }
packet AclCommand : Command { _payload_, }
packet ConnectionManagementCommand : AclCommand { _payload_, }
packet SecurityCommand : Command { _payload_, }
packet ScoConnectionCommand : Command { _payload_, }
packet ScoConnectionCommand : AclCommand { _payload_, }
packet LeAdvertisingCommand : Command { _payload_, }
packet LeScanningCommand : Command { _payload_, }
packet LeConnectionManagementCommand : AclCommand { _payload_, }
@@ -1097,7 +1097,11 @@ packet AcceptSynchronousConnection : ScoConnectionCommand (op_code = ACCEPT_SYNC
}

packet RejectSynchronousConnection : ScoConnectionCommand (op_code = REJECT_SYNCHRONOUS_CONNECTION) {
  _payload_,  // placeholder (unimplemented)
  bd_addr : Address,
  reason : ErrorCode,
}

packet RejectSynchronousConnectionStatus : CommandStatus (command_op_code = REJECT_SYNCHRONOUS_CONNECTION) {
}

enum IoCapability : 8 {
@@ -1237,10 +1241,23 @@ enum ScoDataPath : 8 {
  AUDIO_TEST_MODE = 0xFF,
}

enum SynchronousPacketTypeBits : 16 {
  HV1_ALLOWED = 0x0000,
  HV2_ALLOWED = 0x0001,
  HV3_ALLOWED = 0x0002,
  EV3_ALLOWED = 0x0004,
  EV4_ALLOWED = 0x0008,
  EV5_ALLOWED = 0x0010,
  NO_2_EV3_ALLOWED = 0x0020,
  NO_3_EV3_ALLOWED = 0x0040,
  NO_2_EV5_ALLOWED = 0x0080,
  NO_3_EV5_ALLOWED = 0x0100,
}

enum RetransmissionEffort : 8 {
  NO_RETRANSMISSION = 0x00,
  AT_LEAST_ONE_OPTIMIZED_FOR_POWER = 0x01,
  AT_LEAST_ONE_OPTIMIZED_FOR_LINK_QUALITY = 0x02,
  OPTIMIZED_FOR_POWER = 0x01,
  OPTIMIZED_FOR_LINK_QUALITY = 0x02,
  DO_NOT_CARE = 0xFF,
}

@@ -1250,8 +1267,8 @@ packet EnhancedSetupSynchronousConnection : ScoConnectionCommand (op_code = ENHA
  // Next two items
  // [0x00000000, 0xFFFFFFFE] Bandwidth in octets per second.
  // [0xFFFFFFFF]: Don't care
  transmit_bandwidth : 16,
  receive_bandwidth : 16,
  transmit_bandwidth : 32,
  receive_bandwidth : 32,
  transmit_coding_format : ScoCodingFormat,
  receive_coding_format : ScoCodingFormat,
  // Next two items
@@ -1267,8 +1284,8 @@ packet EnhancedSetupSynchronousConnection : ScoConnectionCommand (op_code = ENHA
  output_coding_format : ScoCodingFormat,
  // Next two items
  // Size, in bits, of the sample or framed data
  input_coded_data_size : 16,
  output_coded_data_size : 16,
  input_coded_data_bits : 16,
  output_coded_data_bits : 16,
  input_pcm_data_format : ScoPcmDataFormat,
  output_pcm_data_format : ScoPcmDataFormat,
  // Next two items
@@ -1282,25 +1299,28 @@ packet EnhancedSetupSynchronousConnection : ScoConnectionCommand (op_code = ENHA
  // [1, 255] The number of bits in each unit of data received from the Host
  //          over the audio data transport.
  // [0] Not applicable (implied by the choice of audio data transport)
  input_transport_unit_size : 8,
  output_transport_unit_size : 8,
  input_transport_unit_bits : 8,
  output_transport_unit_bits : 8,
  // [0x0004, 0xFFFE]: in milliseconds
  //     Upper limit represent the sum of the synchronous interval and the size
  //     of the eSCO window, where the eSCO window is reserved slots plus the
  //     retransmission window
  // [0xFFFF]: don't care
  max_latency : 16,
  packet_type : 16,
  max_latency_ms: 16,
  packet_type : 16, // Or together SynchronousPacketTypeBits
  retransmission_effort : RetransmissionEffort,
}

packet EnhancedSetupSynchronousConnectionStatus : CommandStatus (command_op_code = ENHANCED_SETUP_SYNCHRONOUS_CONNECTION) {
}

packet EnhancedAcceptSynchronousConnection : ScoConnectionCommand (op_code = ENHANCED_ACCEPT_SYNCHRONOUS_CONNECTION) {
  bd_addr : Address,
  // Next two items
  // [0x00000000, 0xFFFFFFFE] Bandwidth in octets per second.
  // [0xFFFFFFFF]: Don't care
  transmit_bandwidth : 16,
  receive_bandwidth : 16,
  transmit_bandwidth : 32,
  receive_bandwidth : 32,
  transmit_coding_format : ScoCodingFormat,
  receive_coding_format : ScoCodingFormat,
  // Next two items
@@ -1316,8 +1336,8 @@ packet EnhancedAcceptSynchronousConnection : ScoConnectionCommand (op_code = ENH
  output_coding_format : ScoCodingFormat,
  // Next two items
  // Size, in bits, of the sample or framed data
  input_coded_data_size : 16,
  output_coded_data_size : 16,
  input_coded_data_bits : 16,
  output_coded_data_bits : 16,
  input_pcm_data_format : ScoPcmDataFormat,
  output_pcm_data_format : ScoPcmDataFormat,
  // Next two items
@@ -1331,18 +1351,21 @@ packet EnhancedAcceptSynchronousConnection : ScoConnectionCommand (op_code = ENH
  // [1, 255] The number of bits in each unit of data received from the Host
  //          over the audio data transport.
  // [0] Not applicable (implied by the choice of audio data transport)
  input_transport_unit_size : 8,
  output_transport_unit_size : 8,
  input_transport_unit_bits : 8,
  output_transport_unit_bits : 8,
  // [0x0004, 0xFFFE]: in milliseconds
  //     Upper limit represent the sum of the synchronous interval and the size
  //     of the eSCO window, where the eSCO window is reserved slots plus the
  //     retransmission window
  // [0xFFFF]: don't care
  max_latency : 16,
  packet_type : 16,
  packet_type : 16, // Or together SynchronousPacketTypeBits
  retransmission_effort : RetransmissionEffort,
}

packet EnhancedAcceptSynchronousConnectionStatus : CommandStatus (command_op_code = ENHANCED_ACCEPT_SYNCHRONOUS_CONNECTION) {
}

packet RemoteOobExtendedDataRequestReply : SecurityCommand (op_code = REMOTE_OOB_EXTENDED_DATA_REQUEST_REPLY) {
  bd_addr : Address,
  c_192 : 8[16],
@@ -1899,15 +1922,29 @@ packet ReadTransmitPowerLevelComplete : CommandComplete (command_op_code = READ_
}

packet ReadSynchronousFlowControlEnable : Command (op_code = READ_SYNCHRONOUS_FLOW_CONTROL_ENABLE) {
  _payload_,  // placeholder (unimplemented)
}

packet ReadSynchronousFlowControlEnableComplete : CommandComplete (command_op_code = READ_SYNCHRONOUS_FLOW_CONTROL_ENABLE) {
  status : ErrorCode,
  enable : Enable,
}

packet WriteSynchronousFlowControlEnable : Command (op_code = WRITE_SYNCHRONOUS_FLOW_CONTROL_ENABLE) {
  _payload_,  // placeholder (unimplemented)
  enable : Enable,
}

packet WriteSynchronousFlowControlEnableComplete : CommandComplete (command_op_code = WRITE_SYNCHRONOUS_FLOW_CONTROL_ENABLE) {
  status : ErrorCode,
}

packet SetControllerToHostFlowControl : Command (op_code = SET_CONTROLLER_TO_HOST_FLOW_CONTROL) {
  _payload_,  // placeholder (unimplemented)
  acl : 1,
  synchronous : 1,
  _reserved_ : 6,
}

packet SetControllerToHostFlowControlComplete : CommandComplete (command_op_code = SET_CONTROLLER_TO_HOST_FLOW_CONTROL) {
  status : ErrorCode,
}

packet HostBufferSize : Command (op_code = HOST_BUFFER_SIZE) {
@@ -4276,8 +4313,8 @@ enum ScoLinkType : 8 {
}

enum ScoAirMode : 8 {
  ULAW_LONG = 0x00,
  ALAW_LONG = 0x01,
  ULAW_LOG = 0x00,
  ALAW_LOG = 0x01,
  CVSD = 0x02,
  TRANSPARENT = 0x03,
}
@@ -4290,10 +4327,10 @@ packet SynchronousConnectionComplete : Event (event_code = SYNCHRONOUS_CONNECTIO
  link_type : ScoLinkType,
  // Time between two consecutive eSCO instants measured in slots.
  // eSCO only, Shall be zero for SCO links.
  transmission_interval : 8,
  transmission_interval_slots : 8,
  // The size of the retransmission window measured in slots.
  // eSCO only. Shall be zero for SCO links.
  retransmission_window : 8,
  retransmission_window_slots : 8,
  // Length in bytes of the eSCO payload in the receive direction.
  // eSCO only. Shall be zero for SCO links.
  rx_packet_length : 16,
@@ -4309,9 +4346,9 @@ packet SynchronousConnectionChanged : Event (event_code = SYNCHRONOUS_CONNECTION
   _reserved_ : 4,
  // Time between two consecutive eSCO instants measured in slots.
  // eSCO only, Shall be zero for SCO links.
  transmission_interval : 8,
  transmission_interval_slots : 8,
  // Time between two consecutive SCO/eSCO instants measured in slots.
  retransmission_window : 8,
  retransmission_window_slots : 8,
  // Length in bytes of the SCO/eSCO payload in the receive direction.
  rx_packet_length : 16,
  // Length in bytes of the SCO/eSCO payload in the transmit direction.