• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/* *
17 * @addtogroup HdiScsiDdk
18 * @{
19 *
20 * @brief Provides SCSI DDK APIs to open and close SCSI interfaces.
21 * @since 5.1
22 * @version 1.0
23 */
24
25/* *
26 * @file IScsiPeripheralDdk.idl
27 *
28 * @brief Declares the SCSI DDK APIs used by the SCSI host to access SCSI devices.
29 *
30 * @since 5.1
31 * @version 1.0
32 */
33
34package ohos.hdi.usb.scsi_ddk.v1_0;
35
36import ohos.hdi.usb.scsi_ddk.v1_0.ScsiPeripheralDdkTypes;
37
38/* *
39 * @brief Declares the SCSI DDK APIs used by the SCSI host to access SCSI devices.
40 */
41interface IScsiPeripheralDdk
42{
43    /* *
44     * @brief Initializes the DDK.
45     *
46     * @return <b>0</b> if the operation is successful; a negative value otherwise.
47     * @since 5.1
48     * @version 1.0
49     */
50    Init();
51
52    /* *
53     * @brief Releases the DDK.
54     *
55     * @return <b>0</b> if the operation is successful; a negative value otherwise.
56     * @since 5.1
57     * @version 1.0
58     */
59    Release();
60
61    /* *
62     * @brief Open SCSI device by deviceId.
63     *
64     * @param deviceId ID of the device to be operated.
65     * @param interfaceIndex Interface index, which corresponds to interface which supports USB Protocol UAS.
66     * @param dev Device handle.
67     * @param fd The file descriptor obtained for memory mapping.
68     *
69     * @return <b>0</b> if the operation is successful; a negative value otherwise.
70     * @since 5.1
71     * @version 1.0
72     */
73    Open([in] unsigned long deviceId, [in] unsigned char interfaceIndex, [out] struct ScsiPeripheralDevice dev, [out] FileDescriptor fd);
74
75    /* *
76     * @brief Close SCSI device.
77     *
78     * @param dev Device handle.
79     *
80     * @return <b>0</b> if the operation is successful; a negative value otherwise.
81     * @since 5.1
82     * @version 1.0
83     */
84    Close([in] struct ScsiPeripheralDevice dev);
85
86    /* *
87     * @brief Get the device capacity.
88     *
89     * @param dev Device handle.
90     * @param request ReadCapacity request information.
91     * @param capacityInfo The data of read capacity command.
92     * @param response The response parameters.
93     *
94     * @return <b>0</b> if the operation is successful; a negative value otherwise.
95     * @since 5.1
96     * @version 1.0
97     */
98    ReadCapacity10([in] struct ScsiPeripheralDevice dev, [in] struct ScsiPeripheralReadCapacityRequest request, [out] struct ScsiPeripheralCapacityInfo capacityInfo, [out] struct ScsiPeripheralResponse response);
99
100    /* *
101     * @brief Check if the logical unit is ready.
102     *
103     * @param dev Device handle.
104     * @param request Test unit ready request information.
105     * @param response The response parameters.
106     *
107     * @return <b>0</b> if the operation is successful; a negative value otherwise.
108     * @since 5.1
109     * @version 1.0
110     */
111    TestUnitReady([in] struct ScsiPeripheralDevice dev, [in] struct ScsiPeripheralTestUnitReadyRequest request, [out] struct ScsiPeripheralResponse response);
112
113    /* *
114     * @brief Get the information regarding the logical unit and SCSI target device.
115     *
116     * @param dev Device handle.
117     * @param request Inquiry request information.
118     * @param inquiryInfo The data of inquiry command.
119     * @param response The response parameters.
120     *
121     * @return <b>0</b> if the operation is successful; a negative value otherwise.
122     * @since 5.1
123     * @version 1.0
124     */
125    Inquiry([in] struct ScsiPeripheralDevice dev, [in] struct ScsiPeripheralInquiryRequest request, [out] struct ScsiPeripheralInquiryInfo inquiryInfo, [out] struct ScsiPeripheralResponse response);
126
127    /* *
128     * @brief Get the sense data.
129     *
130     * @param dev Device handle.
131     * @param request RequestSense request information.
132     * @param response The response parameters.
133     *
134     * @return <b>0</b> if the operation is successful; a negative value otherwise.
135     * @since 5.1
136     * @version 1.0
137     */
138    RequestSense([in] struct ScsiPeripheralDevice dev, [in] struct ScsiPeripheralRequestSenseRequest request, [out] struct ScsiPeripheralResponse response);
139
140    /* *
141     * @brief Read from the specified logical block(s).
142     *
143     * @param dev Device handle.
144     * @param request The request parameters.
145     * @param response The response parameters.
146     *
147     * @return <b>0</b> if the operation is successful; a negative value otherwise.
148     * @since 5.1
149     * @version 1.0
150     */
151    Read10([in] struct ScsiPeripheralDevice dev, [in] struct ScsiPeripheralIORequest request, [out] struct ScsiPeripheralResponse response);
152
153    /* *
154     * @brief Write data to the specified logical block(s).
155     *
156     * @param dev Device handle.
157     * @param request The request parameters.
158     * @param response The response parameters.
159     *
160     * @return <b>0</b> if the operation is successful; a negative value otherwise.
161     * @since 5.1
162     * @version 1.0
163     */
164    Write10([in] struct ScsiPeripheralDevice dev, [in] struct ScsiPeripheralIORequest request, [out] struct ScsiPeripheralResponse response);
165
166    /* *
167     * @brief Verify the specified logical block(s) on the medium.
168     *
169     * @param dev Device handle.
170     * @param request The request parameters.
171     * @param request Verify request information.
172     * @param response The response parameters.
173     *
174     * @return <b>0</b> if the operation is successful; a negative value otherwise.
175     * @since 5.1
176     * @version 1.0
177     */
178    Verify10([in] struct ScsiPeripheralDevice dev, [in] struct ScsiPeripheralVerifyRequest request, [out] struct ScsiPeripheralResponse response);
179
180    /* *
181     * @brief Send SCSI command that specified by CDB.
182     *
183     * @param dev Device handle.
184     * @param request The request parameters.
185     * @param response The response parameters.
186     *
187     * @return <b>0</b> if the operation is successful; a negative value otherwise.
188     * @since 5.1
189     * @version 1.0
190     */
191    SendRequestByCDB([in] struct ScsiPeripheralDevice dev, [in] struct ScsiPeripheralRequest request, [out] struct ScsiPeripheralResponse response);
192}
193