コード例 #1
0
ファイル: Device.cs プロジェクト: androidhacker/DotNetProjs
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public CommandStatus SetStreaming(SpeedDescriptor desc)
        {
            if (m_logger != null)
            {
                string args = "desc";
                m_logger.LogMessage(new UserMessage(UserMessage.Category.Debug, 8, "Bwg.Scsi.Device.SetStreaming(" + args + ")"));
            }

            using (Command cmd = new Command(ScsiCommandCode.SetStreaming, 12, 28, Command.CmdDirection.Out, 2))
            {
                cmd.SetCDB8(8, 0);          // Performance Descriptor
                cmd.SetCDB16(9, 28);        // Length of the performance descriptor

                byte b = 0;
                if (desc.Exact)
                    b |= 0x02;
                int wrc = (int)(desc.WRC) ;
                b |= (byte)(wrc << 3);
                cmd.SetBuffer8(0, b);               // Control info, byte 0

                cmd.SetBuffer32(4, 0);                          // Start LBA
                cmd.SetBuffer32(8, (uint)desc.EndLBA);                // End LBA
                cmd.SetBuffer32(12, (uint)desc.ReadSpeed);            // Read size
                cmd.SetBuffer32(16, 1000);                      // Read time
                cmd.SetBuffer32(20, (uint)desc.WriteSpeed);           // Write size
                cmd.SetBuffer32(24, 1000);                      // Write time

                CommandStatus st = SendCommand(cmd);
                if (st != CommandStatus.Success)
                    return st;
            }

            return CommandStatus.Success;
        }
コード例 #2
0
ファイル: Device.cs プロジェクト: androidhacker/DotNetProjs
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public CommandStatus SetStreaming(RotationalControl rot, int startlba, int endlba, int readsize, int readtime, int writesize, int writetime)
        {
            if (m_logger != null)
            {
                string args = "desc";
                m_logger.LogMessage(new UserMessage(UserMessage.Category.Debug, 8, "Bwg.Scsi.Device.SetStreaming(" + args + ")"));
            }

            using (Command cmd = new Command(ScsiCommandCode.SetStreaming, 12, 28, Command.CmdDirection.Out, 60*5))
            {
                cmd.SetCDB8(8, 0);          // Performance Descriptor
                cmd.SetCDB16(9, 28);        // Length of the performance descriptor

                byte b = 0;
                int wrc = (int)rot;
                b |= (byte)(wrc << 3);
                cmd.SetBuffer8(0, b);               // Control info, byte 0

                cmd.SetBuffer32(4, (uint)startlba);             // Start LBA
                cmd.SetBuffer32(8, (uint)endlba);               // End LBA
                cmd.SetBuffer32(12, (uint)readsize);            // Read size
                cmd.SetBuffer32(16, (uint)readtime);            // Read time
                cmd.SetBuffer32(20, (uint)writesize);           // Write size
                cmd.SetBuffer32(24, (uint)writetime);           // Write time

                CommandStatus st = SendCommand(cmd);
                if (st != CommandStatus.Success)
                    return st;
            }

            return CommandStatus.Success;
        }
コード例 #3
0
ファイル: Device.cs プロジェクト: androidhacker/DotNetProjs
        /// <summary>
        /// Send the layer boundary information to the drive.
        /// </summary>
        /// <param name="boundary">the location of the boundary between layers in blocks</param>
        /// <returns>the status of the command</returns>
        public CommandStatus SendDvdLayerBoundaryInformation(uint boundary)
        {
            if (m_logger != null)
            {
                string args = "SendDvdLayerBoundaryInformation, boundary=" + boundary.ToString();
                m_logger.LogMessage(new UserMessage(UserMessage.Category.Debug, 8, "Bwg.Scsi.Device.SendDvdStructure(" + args + ")"));
            }

            using (Command cmd = new Command(ScsiCommandCode.SendDvdStructure, 12, 12, Command.CmdDirection.Out, 5 * 60))
            {
                cmd.SetCDB8(7, 0x20);
                cmd.SetCDB16(8, 12);

                cmd.SetBuffer16(0, 10);
                cmd.SetBuffer32(8, boundary);

                CommandStatus st = SendCommand(cmd);
                if (st != CommandStatus.Success)
                    return st;
            }

            return CommandStatus.Success;
        }