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 #ifndef SCSI_OS_ADAPTER_H 17 #define SCSI_OS_ADAPTER_H 18 19 #include <stdint.h> 20 #include <vector> 21 22 #include "scsi_ddk_err_code.h" 23 24 namespace OHOS { 25 namespace HDI { 26 namespace Usb { 27 namespace ScsiDdk { 28 namespace V1_0 { 29 30 typedef struct Request { 31 int devFd; 32 std::vector<uint8_t> commandDescriptorBlock; 33 int8_t dataTransferDirection; 34 uint32_t timeout; 35 } Request; 36 37 typedef struct Response { 38 std::vector<uint8_t> senseData; 39 unsigned char status; 40 unsigned char maskedStatus; 41 unsigned char msgStatus; 42 unsigned char sbLenWr; 43 unsigned short hostStatus; 44 unsigned short driverStatus; 45 int resId; 46 unsigned int duration; 47 int transferredLength; 48 } Response; 49 50 class ScsiOsAdapter { 51 public: 52 virtual int32_t SendRequest(const Request& request, uint8_t *buffer, uint32_t bufferSize, Response& response) = 0; 53 }; 54 55 } // namespace V1_0 56 } // namespace ScsiDdk 57 } // namespace Usb 58 } // namespace HDI 59 } // namespace OHOS 60 #endif 61