### USBPD_HW_IF_GlobalHwInit / USBPD_HW_IF_PortHwInit Source: https://context7.com/usb-c/stusb1602/llms.txt Initializes the USB-PD hardware stack. `USBPD_HW_IF_GlobalHwInit` initializes shared hardware, and `USBPD_HW_IF_PortHwInit` sets up a specific port and registers PD policy engine callbacks. ```APIDOC ## Hardware Interface Layer (USB-PD Middleware) ### Description Initializes the USB-PD hardware stack. `USBPD_HW_IF_GlobalHwInit` initializes shared hardware (ADC, DMA, timers). `USBPD_HW_IF_PortHwInit` sets up a specific port with its SPI engine, DMA channels, and registers the PD policy engine callbacks. ### Methods - **USBPD_HW_IF_GlobalHwInit**: Initializes global hardware resources for USB-PD. - **USBPD_HW_IF_PortHwInit**: Initializes a specific USB-PD port. ### Parameters - **port_number**: The identifier for the USB-PD port (e.g., 0). - **pd_cbs**: A struct containing callbacks for PD events (e.g., `PD_TxCompleted_Callback`, `PD_RxCompleted_Callback`). - **initial_role**: The initial power role for the port (e.g., `USBPD_PORTPOWERROLE_DRP`). ### Return Value - **USBPD_StatusTypeDef**: Returns `USBPD_OK` on success, or an error code otherwise. ```