/**
 * @file hv_drv_UsbStorageProtocol.c
 * @brief This is usb driver for storage class protocol.
 * @details 
 * @author HiView SoC Software Team
 * @version 0.0.1
 * @date 20230417
 * @copyright Copyright(c),2022-9, Hiview Software. All rights reserved.
 * @par History:
 * <table>
 * <tr><th>Author                         <th>Date             <th>Details
 * <tr><td>HiView SoC Software Team   <td>20230417       <td>Create and first Version.
 * </table>
 **/

#include "hv_drv_UsbStorageProtocol.h"
#include "hv_drv_UsbStorageTransport.h"

void usb_stor_pad12_command(struct scsi_cmnd *srb,
                            struct us_data *us) {
    /*
    * Pad the SCSI command with zeros out to 12 bytes.  If the
    * command already is 12 bytes or longer, leave it alone.
    * NOTE: This only works because a scsi_cmnd struct field contains
    * a unsigned char cmnd[16], so we know we have storage available
    */
    for (; srb->cmd_len < 12; srb->cmd_len++)
        srb->cmnd[srb->cmd_len] = 0;

    /* send the command to the transport layer */
    us->srb = srb;
    usb_stor_invoke_transport(srb, us);
    us->srb = NULL;
}

void usb_stor_ufi_command(struct scsi_cmnd *srb,
                          struct us_data *us) {
    return;
}

void usb_stor_transparent_scsi_command(struct scsi_cmnd *srb,
                                       struct us_data *us) {
    us->srb = srb;
    usb_stor_invoke_transport(srb, us);
    us->srb = NULL;
}
