Example #1
0
        public SATAPI(PortRegisters aSATAPIPort)
        {
            // Check if it is really a SATAPI Port!
            if (aSATAPIPort.mPortType != PortType.SATAPI || (aSATAPIPort.CMD & (1U << 24)) == 0)
            {
                throw new Exception($"SATAPI Error: 0:{mPortNumber} is not SATAPI port!");
            }
            mSATAPIDebugger.Send("SATAPI Constructor");

            mPortReg = aSATAPIPort;

            mBlockSize = 2048;
        }
Example #2
0
        public int FindCMDSlot(PortRegisters aPort)
        {
            // If not set in SACT and CI, the slot is free
            var xSlots = (aPort.SACT | aPort.CI);

            for (int i = 1; i < 32; i++)
            {
                if ((xSlots & 1) == 0)
                {
                    return(i);
                }
                xSlots >>= 1;
            }
            mSATAPIDebugger.Send("SATA Error: Cannot find a free command slot!");
            return(-1);
        }