Type-C OIAC Cable
===
Active_Cable
---
特點:
1. E-Marker
2. Repeater, 包含 `Re-Timer` or `Re-Drive`
3. 至少支援 USB 3.2 Gen 2x2
4. 支援 USB PD eMarkers,並**可能**支援 `Alternate Modes`
變體:
#### Hybrid Optical Active Cables
使用銅線傳輸電源和 USB 2.0 資料,但高速度訊號(TX/RX)使用光纖傳輸。
#### Optically Isolated Active Cables
* **內部方向性**(==開發者自行設計==),僅限於兩端Cable溝通,但是使用上不分方向
* `使用光纖傳輸高速度訊號`(TX/RX)
* 不傳輸 `VBUS`、`VCONN`、`GND`、`SBx(若支援Alternate Mode會傳輸)` and `USB2.0`,每端主機/裝置需自供電並供應 VCONN
* `雙端供電` VCONN 和 USB Power Delivery (PD) 來建立 DFP-UFP 連結
* 長距離傳輸(最高可達 50 公尺)

> The following features are optional:
> * DP Alternate Mode.
> * USB 2.0.
> * USB PD Unchunked Messages.
> * For USB4 Gen4 OIAC, USB4 Asymmetric Mode.
>

OIAC
---
#### Requirements
[Optically Isolated Active Cables](#Active_Cable)
##### 兩端Host/Device要求:
* 供應 `VCONN`。
* 支援 `USB PD`。
* 初始為 `Sourc DFP`。
* Dual Role Data(至少一端接受 `DR_Swap`)。
##### OIAC_USB_PD_Requirements
support USB PD Revision 3, Version 1.6 or later.
* SOP’/SOP”:
* `Discover_Identity` and `Get_Status` on `SOP’`
* `SOP”`controller is `not required `
* Get_Status of **SOP’** will respond with **Thermal Shutdown** and **temperature information of the worst case** of both cable ends.
* USB4 Gen4-capable OIAC
* may optionally support USB4 Asymmetric Mode.
* This support shall be reported in
the USB PD Active Cable VDO2 (Bit 1) response.
* USB PD Message Handling
==這些 Messages 不會到另一端!!!==, 其他 PD messages 都會到另一端

* Reset (Hard, Cable, Soft, Data)
* All Resets (Cable, Hard, Data, Soft) will be `handled the same` by the OIAC and all be treated as `Hard Reset`
1. Detect the Reset ordered set,
2. Forward “disconnect event” to the `remote plug`
3. Remove `Rd`
At the Remote OIAC Plug:
1. 接收 “disconnect event”
Note: 可以用任何方式轉達“disconnect event”
2. Remove `Rd`
* Locally-Handled Messages
**See Spec**
> 6.3.4.3.2 Locally-Handled SOP USB PD Messages Received by the OIAC Plug
* Conditional Response Messages
* Accept
* Reject
* Wait


---
#### Internal Cable Messages
The actual **definition and implementation** of each message is left to the **implemente**r.
用於兩端Cable溝通, 因內部方向性, 某些 Messages 只會有一端會發送 e.g. Plug-A -> Plug-B,但是還是==依照開發者自行設計==
:::spoiler Internal Cable Messages List
* MSG_Keep_Alive (Informative)
* MSG_Keep_Alive_ACK
* MSG_Port_Capabilities
* MSG_Cable_Config
* MSG_Release_Remote_SourceCap_GoodCRC
* MSG_DR_Swap_Init
* MSG_DR_Swap_Reject
* MSG_DR_Swap_Accept
* MSG_Force_Detach
* MSG_Reset
* MSG_Acknowledgement
:::
---
#### Data Role Swap in Active State
:::spoiler Successful

:::
:::spoiler Rejected

:::
:::spoiler Wait

:::
:::spoiler Initiator Reject

:::
:::spoiler Initiator Wait

:::
---
#### Connection Flow
1. **Discovery** – Phase 1
* ==這階段會決定好 DFP/UFP, 到 Phase 3 再做 DR_Swap==
* 兩端Host/Device都是DRD的話, Plug A當DFP

2. **Reboot** – Phase 2
* Plug-A will always start by repeatedly sending `MSG_Cable_Config` to Plug-B to start reboot.
* Plug-B Reboots
* Plug-B sees `MSG_Cable_Config` and holds off on `SourceCap GoodCRC` until it is allowed to release it.
* Plug-B sends `MSG_Cable_Config` to Plug-A.
* Plug-A Reboots
* Plug-A sees `MSG_Cable_Config` and holds off on `SourceCap GoodCRC` until it is allowed to release it.

3. **Configuration** – Phase 3
* The side that issues the `DR_Swap` send a `DR_Swap` and **releases** the other side `SourceCap GoodCRC`.

:::spoiler Plug-A → DFP

:::
:::spoiler Plug-A → UFP

:::
:::spoiler Billboard/no connection

:::
#### Connection State Diagrams Plug-A
The following sections detail a ==possible== OIAC state diagram for Plug-A
:::spoiler Phase 1 and 2

* ==M1==
進入 `Attached.SNK`,禁用 USB 3.2 (RTSSM eSS.Disabled),等待 MSG_Cable_Config 或 Timeout (~100ms)。
:::info
Timeout -> ==M2==
Receive MSG_Cable_Config(Plug-A is DFP) -> ==M8==
Receive MSG_Cable_Config(Plug-A is UFP) -> ==M10==
:::
* ==M2==
建立初始 PD 合約,回應 Source Capabilities(對接的Host/Device) 以 default RDO (5V @ 0A),評估 DRD 能力
1. Send a `GoodCRC` in response to a [`Source Capabilities`](#OIAC_USB_PD_Requirements) message from the local attached port
2. Evaluate the local attached port’s DRD capability (as indicated in the `Source Capabilities` message)
3. Respond to the Source Capabilities message with the “default” RDO specified in Section 6.3.4.3.2.1.2.
:::info
Receive MSG_Port_Capabilities
-Plug-A is DRD and Plug-B port is DRD/DFP -> ==M3==
-Plug-A is DFP and Plug-B port is DRD -> ==M4==
Plug-A and Plug-B are connected to DFP -> ==M5==
:::
:::
:::spoiler Phase 3

:::
Ref
---
1. Universal Serial Bus Type-C Cable and Connector Specification, Release 2.4 October 2024