diff --git a/usb/bundle.json b/usb/bundle.json index e7aacb134e2be483bba01c8397219fc3a40acf8d..d4d26a3f3aa5c37e6b4eb1f9beb8e7ed3fb73690 100644 --- a/usb/bundle.json +++ b/usb/bundle.json @@ -37,7 +37,8 @@ "//drivers/interface/usb/serial/v1_0:serial_idl_target", "//drivers/interface/usb/gadget/mtp/v1_0:usbfn_mtp_idl_target", "//drivers/interface/usb/ddk/v1_0:usb_ddk_idl_target", - "//drivers/interface/usb/ddk/v1_1:usb_ddk_idl_target" + "//drivers/interface/usb/ddk/v1_1:usb_ddk_idl_target", + "//drivers/interface/usb/ddk/v1_2:usb_ddk_idl_target" ], "test": [], "inner_kits": [ @@ -174,6 +175,34 @@ "header_base": "//drivers/interface/usb" } }, + { + "name": "//drivers/interface/usb/ddk/v1_2:libusb_ddk_proxy_1.2", + "header": { + "header_files": [], + "header_base": "//drivers/interface/usb/ddk" + } + }, + { + "name": "//drivers/interface/usb/ddk/v1_2:libusb_ddk_stub_1.2", + "header": { + "header_files": [], + "header_base": "//drivers/interface/usb/ddk" + } + }, + { + "name": "//drivers/interface/usb/ddk/v1_2:usb_ddk_idl_headers", + "header": { + "header_files": [], + "header_base": "//drivers/interface/usb/ddk" + } + }, + { + "name": "//drivers/interface/usb/ddk/v1_2:usb_ddk_idl_headers_1.2", + "header": { + "header_files": [], + "header_base": "//drivers/interface/usb/ddk" + } + }, { "name": "//drivers/interface/usb/ddk/v1_1:libusb_ddk_proxy_1.1", "header": { diff --git a/usb/ddk/v1_2/BUILD.gn b/usb/ddk/v1_2/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..50d4e17337133d5cb09b1730fadcae1a9ad60650 --- /dev/null +++ b/usb/ddk/v1_2/BUILD.gn @@ -0,0 +1,29 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/config/components/hdi/hdi.gni") +hdi("usb_ddk") { + module_name = "usb_ddk" + imports = [ "ohos.hdi.usb.ddk.v1_1:usb_ddk" ] + + sources = [ + "IUsbDdk.idl", + "IEventListener.idl", + "UsbDdkTypes.idl", + ] + + language = "cpp" + mode = "ipc" + subsystem_name = "hdf" + part_name = "drivers_interface_usb" +} diff --git a/usb/ddk/v1_2/IEventListener.idl b/usb/ddk/v1_2/IEventListener.idl new file mode 100644 index 0000000000000000000000000000000000000000..ef69d8738daec19fe11c5a0d170b9c3644fef1bf --- /dev/null +++ b/usb/ddk/v1_2/IEventListener.idl @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ohos.hdi.usb.ddk.v1_2; + +import ohos.hdi.usb.ddk.v1_2.UsbDdkTypes; + +/** + * @brief DDK Service notifies the peripheral extension framework of SA fault events through this listener. + * + * @since 3.2 + */ +[callback] interface IEventListener { + OnEvent([in] Event event); +} \ No newline at end of file diff --git a/usb/ddk/v1_2/IUsbDdk.idl b/usb/ddk/v1_2/IUsbDdk.idl new file mode 100644 index 0000000000000000000000000000000000000000..8650163e3169524410ff4027668597a02c0e2038 --- /dev/null +++ b/usb/ddk/v1_2/IUsbDdk.idl @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiUsbDdk + * @{ + * + * @brief Provides USB DDK APIs to open and close USB interfaces, perform non-isochronous and isochronous\n + * data transfer over USB pipes, and implement control transfer and interrupt transfer, etc. + * @since 5.1 + * @version 1.2 + */ + +/** + * @file IUsbDdk.idl + * + * @brief Declares the USB DDK APIs used by the USB host to access USB devices. + * + * @since 5.1 + * @version 1.2 + */ + +package ohos.hdi.usb.ddk.v1_2; + +import ohos.hdi.usb.ddk.v1_1.IUsbDdk; +import ohos.hdi.usb.ddk.v1_2.IEventListener; + +/** + * @brief The DDK Service defines a registration listener function for notifying the peripheral extension framework of SA fault events. + * The peripheral extension framework SA invokes this listener function through IPC. + * @since 5.1 + * @version 1.2 + */ +interface IUsbDdk extends ohos.hdi.usb.ddk.v1_1.IUsbDdk +{ + RegisterListener([in] IEventListener listener); +} diff --git a/usb/ddk/v1_2/UsbDdkTypes.idl b/usb/ddk/v1_2/UsbDdkTypes.idl new file mode 100644 index 0000000000000000000000000000000000000000..819730a5da198c9b370ec4a6a8053cbb80a6a130 --- /dev/null +++ b/usb/ddk/v1_2/UsbDdkTypes.idl @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup HdiUsbDdk + * @{ + * + * @brief Provides USB DDK types and declares the macros, enumerated variables, and\n + * data structures required by the USB DDK APIs. + * + * @since 5.1 + * @version 1.1 + */ + +/** + * @addtogroup HdiUsbDdk + * @{ + * + * @brief Provides USB DDK types and declares the macros, enumerated variables, and\n + * data structures required by the USB DDK APIs. + * + * @since 5.1 + * @version 1.1 + */ + +/** + * @file UsbDdkTypes.idl + * + * @brief Provides the enumerated variables, structures, and macros used in USB DDK APIs. + * + * @since 5.1 + * @version 1.2 + */ + +package ohos.hdi.usb.ddk.v1_2; + +import ohos.hdi.usb.ddk.v1_1.UsbDdkTypes; + +/** + * @brief Defines event info. + * + * @since 5.1 + * @version 1.0 + */ +struct Event { + /** event domain */ + String domain; + /** event name */ + String name; +}; \ No newline at end of file