harmony 鸿蒙SCSI Peripheral DDK
SCSI Peripheral DDK
Overview
The SCSI Peripheral DDK is a suite dedicated to SCSI device driver development at the application layer. It provides APIs for initializing the DDK, releasing the DDK, enabling and disabling devices, and reading data from and writing data to devices. It also declares the macros, enum variables, and data structures required by the SCSI Peripheral DDK APIs.
System capability: SystemCapability.Driver.SCSI.Extension
Since: 18
Summary
File
Name | Description |
---|---|
scsi_peripheral_api.h | Declares the SCSI Peripheral DDK APIs used by the host to access the SCSI device. |
scsi_peripheral_types.h | Provides the enum variables, structures, and macros used in the SCSI Peripheral DDK APIs. |
Structs
Name | Description |
---|---|
struct ScsiPeripheral_DeviceMemMap | Device memory mapping created by calling OH_ScsiPeripheral_CreateDeviceMemMap. The buffer that uses the device memory mapping can provide better performance. |
struct ScsiPeripheral_IORequest | Read/write operation request. |
struct ScsiPeripheral_Request | Request structure. |
struct ScsiPeripheral_Response | Response structure. |
struct ScsiPeripheral_TestUnitReadyRequest | Request structure of the test unit ready command. |
struct ScsiPeripheral_InquiryRequest | Request structure of the inquiry command. |
struct ScsiPeripheral_InquiryInfo | SCSI inquiry data. |
struct ScsiPeripheral_ReadCapacityRequest | Request structure of the read capacity command. |
struct ScsiPeripheral_CapacityInfo | SCSI read capacity. |
struct ScsiPeripheral_RequestSenseRequest | Request structure of the request sense command. |
struct ScsiPeripheral_BasicSenseInfo | Basic information about the sense data. |
struct ScsiPeripheral_VerifyRequest | Request structure of the verify command. |
Macros
Name | Description |
---|---|
SCSIPERIPHERAL_MIN_DESCRIPTOR_FORMAT_SENSE 8 | Minimum length of the sense data descriptor format. |
SCSIPERIPHERAL_MIN_FIXED_FORMAT_SENSE 18 | Minimum length of the fixed format of sense data. |
SCSIPERIPHERAL_MAX_CMD_DESC_BLOCK_LEN 16 | Maximum length of a command descriptor block (CDB). |
SCSIPERIPHERAL_MAX_SENSE_DATA_LEN 252 | Maximum length of sense data. In the SCSI protocol, the maximum length of sense data is usually 252 bytes. |
SCSIPERIPHERAL_VENDOR_ID_LEN 8 | Maximum length of the vendor ID. |
SCSIPERIPHERAL_PRODUCT_ID_LEN 18 | Maximum length of the product ID. |
SCSIPERIPHERAL_PRODUCT_REV_LEN 4 | Maximum length of the product version. |
Types
Name | Description |
---|---|
typedef struct ScsiPeripheral_Device ScsiPeripheral_Device | Opaque SCSI device structure. |
typedef struct ScsiPeripheral_DeviceMemMap ScsiPeripheral_DeviceMemMap | Device memory mapping created by calling OH_ScsiPeripheral_CreateDeviceMemMap. The buffer that uses the device memory mapping can provide better performance. |
typedef struct ScsiPeripheral_IORequest ScsiPeripheral_IORequest | Read/write operation request. |
typedef struct ScsiPeripheral_Request ScsiPeripheral_Request | Request structure. |
typedef struct ScsiPeripheral_Response ScsiPeripheral_Response | Response structure. |
typedef struct ScsiPeripheral_TestUnitReadyRequest ScsiPeripheral_TestUnitReadyRequest | Request structure of the test unit ready command. |
typedef struct ScsiPeripheral_InquiryRequest ScsiPeripheral_InquiryRequest | Request structure of the inquiry command. |
typedef struct ScsiPeripheral_InquiryInfo ScsiPeripheral_InquiryInfo | SCSI inquiry data. |
typedef struct ScsiPeripheral_ReadCapacityRequest ScsiPeripheral_ReadCapacityRequest | Request structure of the read capacity command. |
typedef struct ScsiPeripheral_CapacityInfo ScsiPeripheral_CapacityInfo | SCSI read capacity. |
typedef struct ScsiPeripheral_RequestSenseRequest ScsiPeripheral_RequestSenseRequest | Request structure of the request sense command. |
typedef struct ScsiPeripheral_BasicSenseInfo ScsiPeripheral_BasicSenseInfo | Basic information about the sense data. |
typedef struct ScsiPeripheral_VerifyRequest ScsiPeripheral_VerifyRequest | Request structure of the verify command. |
Enums
Name | Description |
---|---|
ScsiPeripheral_DdkErrCode { SCSIPERIPHERAL_DDK_NO_PERM = 201, SCSIPERIPHERAL_DDK_INVALID_PARAMETER = 401, SCSIPERIPHERAL_DDK_SUCCESS = 31700000, SCSIPERIPHERAL_DDK_MEMORY_ERROR = 31700001, SCSIPERIPHERAL_DDK_INVALID_OPERATION = 31700002, SCSIPERIPHERAL_DDK_IO_ERROR = 31700003, SCSIPERIPHERAL_DDK_TIMEOUT = 31700004, SCSIPERIPHERAL_DDK_INIT_ERROR = 31700005, SCSIPERIPHERAL_DDK_SERVICE_ERROR = 31700006, SCSIPERIPHERAL_DDK_DEVICE_NOT_FOUND = 31700007 } |
SCSI Peripheral DDK error codes. |
ScsiPeripheral_Status { SCSIPERIPHERAL_STATUS_GOOD = 0x00, SCSIPERIPHERAL_STATUS_CHECK_CONDITION_NEEDED = 0x02, SCSIPERIPHERAL_STATUS_CONDITION_MET = 0x04, SCSIPERIPHERAL_STATUS_BUSY = 0x08, SCSIPERIPHERAL_STATUS_RESERVATION_CONFLICT = 0x18, SCSIPERIPHERAL_STATUS_TASK_SET_FULL = 0x28, SCSIPERIPHERAL_STATUS_ACA_ACTIVE = 0x30, SCSIPERIPHERAL_STATUS_TASK_ABORTED = 0x40 } |
SCSI status used for the response. |
Function
Name | Description |
---|---|
int32_t OH_ScsiPeripheral_Init (void) | Initializes the SCSI Peripheral DDK. |
int32_t OH_ScsiPeripheral_Release (void) | Releases the SCSI Peripheral DDK. |
int32_t OH_ScsiPeripheral_Open (uint64_t deviceId, uint8_t interfaceIndex, ScsiPeripheral_Device **dev) | Opens the SCSI device specified by deviceId and interfaceIndex. |
int32_t OH_ScsiPeripheral_Close (ScsiPeripheral_Device **dev) | Disables the SCSI device. |
int32_t OH_ScsiPeripheral_TestUnitReady (ScsiPeripheral_Device *dev, ScsiPeripheral_TestUnitReadyRequest *request, ScsiPeripheral_Response *response) | Checks whether the logical units are ready. |
int32_t OH_ScsiPeripheral_Inquiry (ScsiPeripheral_Device *dev, ScsiPeripheral_InquiryRequest *request, ScsiPeripheral_InquiryInfo *inquiryInfo, ScsiPeripheral_Response *response) | Queries basic information about the SCSI device. |
int32_t OH_ScsiPeripheral_ReadCapacity10 (ScsiPeripheral_Device *dev, ScsiPeripheral_ReadCapacityRequest *request, ScsiPeripheral_CapacityInfo *capacityInfo, ScsiPeripheral_Response *response) | Obtains the capacity information about the SCSI device. |
int32_t OH_ScsiPeripheral_RequestSense (ScsiPeripheral_Device *dev, ScsiPeripheral_RequestSenseRequest *request, ScsiPeripheral_Response *response) | Obtains sense data, that is, information returned by the SCSI device to the host to report the device status, error information, and diagnosis information. |
int32_t OH_ScsiPeripheral_Read10 (ScsiPeripheral_Device *dev, ScsiPeripheral_IORequest *request, ScsiPeripheral_Response *response) | Reads data from a specified logical block. |
int32_t OH_ScsiPeripheral_Write10 (ScsiPeripheral_Device *dev, ScsiPeripheral_IORequest *request, ScsiPeripheral_Response *response) | Writes data to a specified logical block of a device. |
int32_t OH_ScsiPeripheral_Verify10 (ScsiPeripheral_Device *dev, ScsiPeripheral_VerifyRequest *request, ScsiPeripheral_Response *response) | Verifies a specified logical block. |
int32_t OH_ScsiPeripheral_SendRequestByCdb (ScsiPeripheral_Device *dev, ScsiPeripheral_Request *request, ScsiPeripheral_Response *response) | Sends SCSI commands in CDB mode. |
int32_t OH_ScsiPeripheral_CreateDeviceMemMap (ScsiPeripheral_Device *dev, size_t size, ScsiPeripheral_DeviceMemMap **devMmap) | Creates a buffer. To avoid memory leakage, use OH_ScsiPeripheral_DestroyDeviceMemMap to destroy a buffer after use. |
int32_t OH_ScsiPeripheral_DestroyDeviceMemMap (ScsiPeripheral_DeviceMemMap *devMmap) | Destroys a buffer. To avoid resource leakage, destroy a buffer in time after use. |
int32_t OH_ScsiPeripheral_ParseBasicSenseInfo (uint8_t *senseData, uint8_t senseDataLen, ScsiPeripheral_BasicSenseInfo *senseInfo) | Parses basic sense data, including the Information, Command specific information, and Sense key specific fields. |
Macro Description
SCSIPERIPHERAL_MAX_CMD_DESC_BLOCK_LEN
#define SCSIPERIPHERAL_MAX_CMD_DESC_BLOCK_LEN 16
Description
Maximum length of a CDB.
Since: 18
SCSIPERIPHERAL_MAX_SENSE_DATA_LEN
#define SCSIPERIPHERAL_MAX_SENSE_DATA_LEN 252
Description
Maximum length of sense data. In the SCSI protocol, the maximum length of sense data is usually 252 bytes.
Since: 18
SCSIPERIPHERAL_MIN_DESCRIPTOR_FORMAT_SENSE
#define SCSIPERIPHERAL_MIN_DESCRIPTOR_FORMAT_SENSE 8
Description
Minimum length of the sense data descriptor format.
Since: 18
SCSIPERIPHERAL_MIN_FIXED_FORMAT_SENSE
#define SCSIPERIPHERAL_MIN_FIXED_FORMAT_SENSE 18
Description
Minimum length of the fixed format of sense data.
Since: 18
SCSIPERIPHERAL_PRODUCT_ID_LEN
#define SCSIPERIPHERAL_PRODUCT_ID_LEN 18
Description
Maximum length of the product ID.
Since: 18
SCSIPERIPHERAL_PRODUCT_REV_LEN
#define SCSIPERIPHERAL_PRODUCT_REV_LEN 4
Description
Maximum length of the product version.
Since: 18
SCSIPERIPHERAL_VENDOR_ID_LEN
#define SCSIPERIPHERAL_VENDOR_ID_LEN 8
Description
Maximum length of the vendor ID.
Since: 18
Type Description
ScsiPeripheral_BasicSenseInfo
typedef struct ScsiPeripheral_BasicSenseInfo ScsiPeripheral_BasicSenseInfo
Description
Basic information about the sense data.
Since: 18
ScsiPeripheral_CapacityInfo
typedef struct ScsiPeripheral_CapacityInfo ScsiPeripheral_CapacityInfo
Description
SCSI read capacity.
Since: 18
ScsiPeripheral_Device
typedef struct ScsiPeripheral_Device ScsiPeripheral_Device
Description
Opaque SCSI device structure.
Since: 18
ScsiPeripheral_DeviceMemMap
typedef struct ScsiPeripheral_DeviceMemMap ScsiPeripheral_DeviceMemMap
Description
Device memory mapping created by calling OH_ScsiPeripheral_CreateDeviceMemMap. The buffer that uses the device memory mapping can provide better performance.
Since: 18
ScsiPeripheral_InquiryInfo
typedef struct ScsiPeripheral_InquiryInfo ScsiPeripheral_InquiryInfo
Description
SCSI inquiry data.
Since: 18
ScsiPeripheral_InquiryRequest
typedef struct ScsiPeripheral_InquiryRequest ScsiPeripheral_InquiryRequest
Description
Request structure of the inquiry command.
Since: 18
ScsiPeripheral_IORequest
typedef struct ScsiPeripheral_IORequest ScsiPeripheral_IORequest
Description
Read/write operation request.
Since: 18
ScsiPeripheral_ReadCapacityRequest
typedef struct ScsiPeripheral_ReadCapacityRequest ScsiPeripheral_ReadCapacityRequest
Description
Request structure of the read capacity command.
Since: 18
ScsiPeripheral_Request
typedef struct ScsiPeripheral_Request ScsiPeripheral_Request
Description
Request structure.
Since: 18
ScsiPeripheral_RequestSenseRequest
typedef struct ScsiPeripheral_RequestSenseRequest ScsiPeripheral_RequestSenseRequest
Description
Request structure of the request sense command.
Since: 18
ScsiPeripheral_Response
typedef struct ScsiPeripheral_Response ScsiPeripheral_Response
Description
Response structure.
Since: 18
ScsiPeripheral_TestUnitReadyRequest
typedef struct ScsiPeripheral_TestUnitReadyRequest ScsiPeripheral_TestUnitReadyRequest
Description
Request structure of the test unit ready command.
Since: 18
ScsiPeripheral_VerifyRequest
typedef struct ScsiPeripheral_VerifyRequest ScsiPeripheral_VerifyRequest
Description
Request structure of the verify command.
Since: 18
Enum Description
ScsiPeripheral_DdkErrCode
enum ScsiPeripheral_DdkErrCode
Description
SCSI Peripheral DDK error codes.
Since: 18
Value | Description |
---|---|
SCSIPERIPHERAL_DDK_NO_PERM | Permission denied. |
SCSIPERIPHERAL_DDK_INVALID_PARAMETER | Invalid parameter. |
SCSIPERIPHERAL_DDK_SUCCESS | Operation succeeded. |
SCSIPERIPHERAL_DDK_MEMORY_ERROR | Memory-related errors, such as insufficient memory, memory data replication failure, or memory request failure. |
SCSIPERIPHERAL_DDK_INVALID_OPERATION | Invalid operation. |
SCSIPERIPHERAL_DDK_IO_ERROR | Device input/output operation failure. |
SCSIPERIPHERAL_DDK_TIMEOUT | Transfer timeout. |
SCSIPERIPHERAL_DDK_INIT_ERROR | DDK initialization error, or DDK uninitialized. |
SCSIPERIPHERAL_DDK_SERVICE_ERROR | Failed to communicate with the SCSI Peripheral DDK. |
SCSIPERIPHERAL_DDK_DEVICE_NOT_FOUND | Device not found. |
ScsiPeripheral_Status
enum ScsiPeripheral_Status
Description
SCSI status used for the response.
Since: 18
Value | Description |
---|---|
SCSIPERIPHERAL_STATUS_GOOD | Normal state. |
SCSIPERIPHERAL_STATUS_CHECK_CONDITION_NEEDED | Status check required. |
SCSIPERIPHERAL_STATUS_CONDITION_MET | Conditions met. |
SCSIPERIPHERAL_STATUS_BUSY | Occupying. |
SCSIPERIPHERAL_STATUS_RESERVATION_CONFLICT | Resource reservation conflict. |
SCSIPERIPHERAL_STATUS_TASK_SET_FULL | Task set already full. |
SCSIPERIPHERAL_STATUS_ACA_ACTIVE | ACA activity status. |
SCSIPERIPHERAL_STATUS_TASK_ABORTED | Task aborted. |
Function Description
OH_ScsiPeripheral_Close()
int32_t OH_ScsiPeripheral_Close (ScsiPeripheral_Device ** dev)
Description
Disables the SCSI device.
Since: 18
Parameters
Name | Description |
---|---|
dev | Device handle. For details, see ScsiPeripheral_Device. |
Required Permissions
ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL
Returns
SCSIPERIPHERAL_DDK_SUCCESS: Operation succeeded.
SCSIPERIPHERAL_DDK_NO_PERM: Permission verification failed.
SCSIPERIPHERAL_DDK_INIT_ERROR: DDK not initialized.
SCSIPERIPHERAL_DDK_INVALID_PARAMETER: empty dev.
SCSIPERIPHERAL_DDK_SERVICE_ERROR: DDK service communication error.
SCSIPERIPHERAL_DDK_IO_ERROR: DDK I/O error.
OH_ScsiPeripheral_CreateDeviceMemMap()
int32_t OH_ScsiPeripheral_CreateDeviceMemMap (ScsiPeripheral_Device * dev, size_t size, ScsiPeripheral_DeviceMemMap ** devMmap )
Description
Creates a buffer. To avoid memory leakage, use OH_ScsiPeripheral_DestroyDeviceMemMap to destroy a buffer after use.
Since: 18
Parameters
Name | Description |
---|---|
dev | Device handle. For details, see ScsiPeripheral_Device. |
size | Buffer size. |
devMmap | Device memory mapping used to return the created buffer to the caller. For details, see ScsiPeripheral_DeviceMemMap. |
Required Permissions
ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL
Returns
SCSIPERIPHERAL_DDK_SUCCESS: Operation succeeded.
SCSIPERIPHERAL_DDK_INVALID_PARAMETER: Empty dev or devMmap.
SCSIPERIPHERAL_DDK_MEMORY_ERROR: Memory operation error.
OH_ScsiPeripheral_DestroyDeviceMemMap()
int32_t OH_ScsiPeripheral_DestroyDeviceMemMap (ScsiPeripheral_DeviceMemMap * devMmap)
Description
Destroys a buffer. To avoid resource leakage, destroy a buffer in time after use.
Since: 18
Parameters
Name | Description |
---|---|
devMmap | Buffer to be destroyed, which is created by calling OH_ScsiPeripheral_CreateDeviceMemMa. For details, see ScsiPeripheral_DeviceMemMap. |
Required Permissions
ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL
Returns
SCSIPERIPHERAL_DDK_SUCCESS: Operation succeeded.
SCSIPERIPHERAL_DDK_INVALID_PARAMETER: Empty devMmap.
SCSIPERIPHERAL_DDK_MEMORY_ERROR: Memory operation error.
OH_ScsiPeripheral_Init()
int32_t OH_ScsiPeripheral_Init (void )
Description
Initializes the SCSI Peripheral DDK.
Since: 18
Required Permissions
ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL
Returns
SCSIPERIPHERAL_DDK_SUCCESS: Operation succeeded.
SCSIPERIPHERAL_DDK_NO_PERM: Permission verification failed.
SCSIPERIPHERAL_DDK_INIT_ERROR: DDK initialization error.
SCSIPERIPHERAL_DDK_SERVICE_ERROR: DDK service communication error.
OH_ScsiPeripheral_Inquiry()
int32_t OH_ScsiPeripheral_Inquiry (ScsiPeripheral_Device * dev, ScsiPeripheral_InquiryRequest * request, ScsiPeripheral_InquiryInfo * inquiryInfo, ScsiPeripheral_Response * response )
Description
Queries basic information about the SCSI device.
Since: 18
Parameters
Name | Description |
---|---|
dev | Device handle. For details, see ScsiPeripheral_Device. |
request | Request of the inquiry command. For details, see ScsiPeripheral_InquiryRequest. |
inquiryInfo | Query result returned by the inquiry command. For details, see ScsiPeripheral_InquiryInfo. |
response | Original response returned by the inquiry command. For details, see ScsiPeripheral_Response. |
Required Permissions
ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL
Returns
SCSIPERIPHERAL_DDK_SUCCESS: Operation succeeded.
SCSIPERIPHERAL_DDK_NO_PERM: Permission verification failed.
SCSIPERIPHERAL_DDK_INIT_ERROR: DDK not initialized.
SCSIPERIPHERAL_DDK_INVALID_PARAMETER: Empty dev, request, inquiryInfo, inquiryInfo->data, or response.
SCSIPERIPHERAL_DDK_SERVICE_ERROR: DDK service communication error.
SCSIPERIPHERAL_DDK_MEMORY_ERROR: Memory operation error.
SCSIPERIPHERAL_DDK_IO_ERROR: DDK I/O error.
SCSIPERIPHERAL_DDK_TIMEOUT: Transfer timeout.
SCSIPERIPHERAL_DDK_INVALID_OPERATION: Operation not supported.
OH_ScsiPeripheral_Open()
int32_t OH_ScsiPeripheral_Open (uint64_t deviceId, uint8_t interfaceIndex, ScsiPeripheral_Device ** dev )
Description
Opens the SCSI device specified by deviceId and interfaceIndex.
Since: 18
Parameters
Name | Description |
---|---|
deviceId | Device ID. |
interfaceIndex | Interface index for the API of the SCSI device. |
dev | Device handle. For details, see ScsiPeripheral_Device. |
Required Permissions
ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL
Returns
SCSIPERIPHERAL_DDK_SUCCESS: Operation succeeded.
SCSIPERIPHERAL_DDK_NO_PERM: Permission verification failed.
SCSIPERIPHERAL_DDK_INIT_ERROR: DDK not initialized.
SCSIPERIPHERAL_DDK_INVALID_PARAMETER: empty dev.
SCSIPERIPHERAL_DDK_SERVICE_ERROR: DDK service communication error.
SCSIPERIPHERAL_DDK_MEMORY_ERROR: Memory operation error.
SCSIPERIPHERAL_DDK_IO_ERROR: DDK I/O operation error.
SCSIPERIPHERAL_DDK_DEVICE_NOT_FOUND: Device not found based on deviceId and interfaceIndex.
SCSIPERIPHERAL_DDK_INVALID_OPERATION: Operation not supported.
SCSIPERIPHERAL_DDK_TIMEOUT: Transfer timeout.
OH_ScsiPeripheral_ParseBasicSenseInfo()
int32_t OH_ScsiPeripheral_ParseBasicSenseInfo (uint8_t * senseData, uint8_t senseDataLen, ScsiPeripheral_BasicSenseInfo * senseInfo )
Description
Parses basic sense data, including the Information, Command specific information, and Sense key specific fields.
Since: 18
Parameters
Name | Description |
---|---|
senseData | Sense data to be parsed. |
senseDataLen | Length of sense data. |
senseInfo | Stores parsed basic information. For details, see ScsiPeripheral_BasicSenseInfo. |
Required Permissions
ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL
Returns
SCSIPERIPHERAL_DDK_SUCCESS: Operation succeeded.
SCSIPERIPHERAL_DDK_INVALID_PARAMETER: senseData or senseDataLen error. (senseData is not a descriptor or is not of the fixed format, or senseDataLen is smaller than SCSIPERIPHERAL_MIN_DESCRIPTOR_FORMAT_SENSE or SCSIPERIPHERAL_MIN_FIXED_FORMAT_SENSE.)
OH_ScsiPeripheral_Read10()
int32_t OH_ScsiPeripheral_Read10 (ScsiPeripheral_Device * dev, ScsiPeripheral_IORequest * request, ScsiPeripheral_Response * response )
Description
Reads data from a specified logical block.
Since: 18
Parameters
Name | Description |
---|---|
dev | Device handle. For details, see ScsiPeripheral_Device. |
request | Request of the read command. For details, see ScsiPeripheral_IORequest. |
response | Response returned by the read command. For details, see ScsiPeripheral_Response. |
Required Permissions
ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL
Returns
SCSIPERIPHERAL_DDK_SUCCESS: Operation succeeded.
SCSIPERIPHERAL_DDK_NO_PERM: Permission verification failed.
SCSIPERIPHERAL_DDK_INIT_ERROR: DDK not initialized.
SCSIPERIPHERAL_DDK_INVALID_PARAMETER: Empty dev, request, request->data, or response.
SCSIPERIPHERAL_DDK_SERVICE_ERROR: DDK service communication error.
SCSIPERIPHERAL_DDK_MEMORY_ERROR: Memory operation error.
SCSIPERIPHERAL_DDK_IO_ERROR: DDK I/O error.
SCSIPERIPHERAL_DDK_TIMEOUT: Transfer timeout.
SCSIPERIPHERAL_DDK_INVALID_OPERATION: Operation not supported.
OH_ScsiPeripheral_ReadCapacity10()
int32_t OH_ScsiPeripheral_ReadCapacity10 (ScsiPeripheral_Device * dev, ScsiPeripheral_ReadCapacityRequest * request, ScsiPeripheral_CapacityInfo * capacityInfo, ScsiPeripheral_Response * response )
Description
Obtains the capacity information about the SCSI device.
Since: 18
Parameters
Name | Description |
---|---|
dev | Device handle. For details, see ScsiPeripheral_Device. |
request | Request of the read capacity command. For details, see ScsiPeripheral_ReadCapacityRequest. |
capacityInfo | Capacity information returned by the read capacity command. For details, see ScsiPeripheral_CapacityInfo. |
response | Original response returned by the read capacity command. For details, see ScsiPeripheral_Response. |
Required Permissions
ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL
Returns
SCSIPERIPHERAL_DDK_SUCCESS: Operation succeeded.
SCSIPERIPHERAL_DDK_NO_PERM: Permission verification failed.
SCSIPERIPHERAL_DDK_INIT_ERROR: DDK not initialized.
SCSIPERIPHERAL_DDK_INVALID_PARAMETER: Empty dev, request, capacityInfo, or response.
SCSIPERIPHERAL_DDK_SERVICE_ERROR: DDK service communication error.
SCSIPERIPHERAL_DDK_MEMORY_ERROR: Memory operation error.
SCSIPERIPHERAL_DDK_IO_ERROR: DDK I/O error.
SCSIPERIPHERAL_DDK_TIMEOUT: Transfer timeout.
SCSIPERIPHERAL_DDK_INVALID_OPERATION: Operation not supported.
OH_ScsiPeripheral_Release()
int32_t OH_ScsiPeripheral_Release (void )
Description
Releases the SCSI Peripheral DDK.
Since: 18
Required Permissions
ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL
Returns
SCSIPERIPHERAL_DDK_SUCCESS: Operation succeeded.
SCSIPERIPHERAL_DDK_NO_PERM: Permission verification failed.
SCSIPERIPHERAL_DDK_INIT_ERROR: DDK not initialized.
SCSIPERIPHERAL_DDK_SERVICE_ERROR: DDK service communication error.
OH_ScsiPeripheral_RequestSense()
int32_t OH_ScsiPeripheral_RequestSense (ScsiPeripheral_Device * dev, ScsiPeripheral_RequestSenseRequest * request, ScsiPeripheral_Response * response )
Description
Obtains sense data, that is, information returned by the SCSI device to the host to report the device status, error information, and diagnosis information.
Since: 18
Parameters
Name | Description |
---|---|
dev | Device handle. For details, see ScsiPeripheral_Device. |
request | Request of the request sense command. For details, see ScsiPeripheral_RequestSenseRequest. |
response | Response returned by the request sense command. For details, see ScsiPeripheral_Response. |
Required Permissions
ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL
Returns
SCSIPERIPHERAL_DDK_SUCCESS: Operation succeeded.
SCSIPERIPHERAL_DDK_NO_PERM: Permission verification failed.
SCSIPERIPHERAL_DDK_INIT_ERROR: DDK not initialized.
SCSIPERIPHERAL_DDK_INVALID_PARAMETER: Empty dev, request, or response.
SCSIPERIPHERAL_DDK_SERVICE_ERROR: DDK service communication error.
SCSIPERIPHERAL_DDK_MEMORY_ERROR: Memory operation error.
SCSIPERIPHERAL_DDK_IO_ERROR: DDK I/O error.
SCSIPERIPHERAL_DDK_TIMEOUT: Transfer timeout.
SCSIPERIPHERAL_DDK_INVALID_OPERATION: Operation not supported.
OH_ScsiPeripheral_SendRequestByCdb()
int32_t OH_ScsiPeripheral_SendRequestByCdb (ScsiPeripheral_Device * dev, ScsiPeripheral_Request * request, ScsiPeripheral_Response * response )
Description
Sends SCSI commands in command descriptor block (CDB) mode.
Since: 18
Parameters
Name | Description |
---|---|
dev | Device handle. For details, see ScsiPeripheral_Device. |
request | Request. For details, see ScsiPeripheral_Request. |
response | Response. For details, see ScsiPeripheral_Response. |
Required Permissions
ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL
Returns
SCSIPERIPHERAL_DDK_SUCCESS: Operation succeeded.
SCSIPERIPHERAL_DDK_NO_PERM: Permission verification failed.
SCSIPERIPHERAL_DDK_INIT_ERROR: DDK not initialized.
SCSIPERIPHERAL_DDK_INVALID_PARAMETER: Empty dev, request, request->data, or response, or invalid request->cdbLength value (0).
SCSIPERIPHERAL_DDK_SERVICE_ERROR: DDK service communication error.
SCSIPERIPHERAL_DDK_MEMORY_ERROR: Memory operation error.
SCSIPERIPHERAL_DDK_IO_ERROR: DDK I/O error.
SCSIPERIPHERAL_DDK_TIMEOUT: Transfer timeout.
SCSIPERIPHERAL_DDK_INVALID_OPERATION: Operation not supported.
OH_ScsiPeripheral_TestUnitReady()
int32_t OH_ScsiPeripheral_TestUnitReady (ScsiPeripheral_Device * dev, ScsiPeripheral_TestUnitReadyRequest * request, ScsiPeripheral_Response * response )
Description
Checks whether the logical units are ready.
Since: 18
Parameters
Name | Description |
---|---|
dev | Device handle. For details, see ScsiPeripheral_Device. |
request | Request of the test unit ready command. For details, see ScsiPeripheral_TestUnitReadyRequest. |
response | Response returned by the test unit ready command. For details, see ScsiPeripheral_Response. |
Required Permissions
ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL
Returns
SCSIPERIPHERAL_DDK_SUCCESS: Operation succeeded.
SCSIPERIPHERAL_DDK_NO_PERM: Permission verification failed.
SCSIPERIPHERAL_DDK_INIT_ERROR: DDK not initialized.
SCSIPERIPHERAL_DDK_INVALID_PARAMETER: Empty dev, request, or response.
SCSIPERIPHERAL_DDK_SERVICE_ERROR: DDK service communication error.
SCSIPERIPHERAL_DDK_MEMORY_ERROR: Memory operation error.
SCSIPERIPHERAL_DDK_IO_ERROR: DDK I/O error.
SCSIPERIPHERAL_DDK_TIMEOUT: Transfer timeout.
SCSIPERIPHERAL_DDK_INVALID_OPERATION: Operation not supported.
OH_ScsiPeripheral_Verify10()
int32_t OH_ScsiPeripheral_Verify10 (ScsiPeripheral_Device * dev, ScsiPeripheral_VerifyRequest * request, ScsiPeripheral_Response * response )
Description
Verifies a specified logical block.
Since: 18
Parameters
Name | Description |
---|---|
dev | Device handle. For details, see ScsiPeripheral_Device. |
request | Request of the verify command. For details, see ScsiPeripheral_VerifyRequest. |
response | Response returned by the verify command. For details, see ScsiPeripheral_Response. |
Required Permissions
ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL
Returns
SCSIPERIPHERAL_DDK_SUCCESS: Operation succeeded.
SCSIPERIPHERAL_DDK_NO_PERM: Permission verification failed.
SCSIPERIPHERAL_DDK_INIT_ERROR: DDK not initialized.
SCSIPERIPHERAL_DDK_INVALID_PARAMETER: Empty dev, request, or response.
SCSIPERIPHERAL_DDK_SERVICE_ERROR: DDK service communication error.
SCSIPERIPHERAL_DDK_MEMORY_ERROR: Memory operation error.
SCSIPERIPHERAL_DDK_IO_ERROR: DDK I/O error.
SCSIPERIPHERAL_DDK_TIMEOUT: Transfer timeout.
SCSIPERIPHERAL_DDK_INVALID_OPERATION: Operation not supported.
OH_ScsiPeripheral_Write10()
int32_t OH_ScsiPeripheral_Write10 (ScsiPeripheral_Device * dev, ScsiPeripheral_IORequest * request, ScsiPeripheral_Response * response )
Description
Writes data to a specified logical block of a device.
Since: 18
Parameters
Name | Description |
---|---|
dev | Device handle. For details, see ScsiPeripheral_Device. |
request | Request of the write command. For details, see ScsiPeripheral_IORequest. |
response | Response returned by the write command. For details, see ScsiPeripheral_Response. |
Required Permissions
ohos.permission.ACCESS_DDK_SCSI_PERIPHERAL
Returns
SCSIPERIPHERAL_DDK_SUCCESS: Operation succeeded.
SCSIPERIPHERAL_DDK_NO_PERM: Permission verification failed.
SCSIPERIPHERAL_DDK_INIT_ERROR: DDK not initialized.
SCSIPERIPHERAL_DDK_INVALID_PARAMETER: Empty dev, request, request->data, or response.
SCSIPERIPHERAL_DDK_SERVICE_ERROR: DDK service communication error.
SCSIPERIPHERAL_DDK_MEMORY_ERROR: Memory operation error.
SCSIPERIPHERAL_DDK_IO_ERROR: DDK I/O error.
SCSIPERIPHERAL_DDK_TIMEOUT: Transfer timeout.
SCSIPERIPHERAL_DDK_INVALID_OPERATION: Operation not supported.
你可能感兴趣的鸿蒙文章
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦