コード例 #1
0
 private static void Sleep(int cnt)
 {
     for (int i = 0; i < cnt; i++)
     {
         PortIO.In32(0x80);
     }
 }
コード例 #2
0
ファイル: Acpica.cs プロジェクト: valentinbreiz/Sharpen
        public static int AcpiOsReadPort(ulong Address, uint *Value, uint Width)
        {
            if (Width == 8)
            {
                *Value = PortIO.In8((ushort)Address);
            }
            else if (Width == 16)
            {
                *Value = PortIO.In16((ushort)Address);
            }
            else if (Width == 32)
            {
                *Value = PortIO.In32((ushort)Address);
            }
            else
            {
                return(AE_BAD_PARAMETER);
            }

            return(AE_OK);
        }
コード例 #3
0
        private static void SoftwareReset()
        {
            // RESET
            PortIO.In32((ushort)(m_io_base + 0x18));
            PortIO.In16((ushort)(m_io_base + 0x14));

            Sleep(5);

            // SET BCR
            PortIO.Out32((ushort)(m_io_base + REG_RDP), 0);

            // Enable 32bit :)
            writeBCR(20, 1);

            // sws style 2 please
            uint csr58 = readCSR(58);

            csr58 &= 0xFFF0;
            csr58 |= 2;
            writeCSR(58, csr58);
        }
コード例 #4
0
        /// <summary>
        /// Handle interrupt
        /// </summary>
        /// <returns>If this IRQ was handled by the device</returns>
        private static unsafe bool handler()
        {
            ushort ISR = PortIO.In16((ushort)(m_io_base + REG_ISR));

            if ((ISR & ISR_TOK) > 0)
            {
                // We need to read every TX
                for (int i = 0; i < 4; i++)
                {
                    if (((int)PortIO.In32((ushort)(m_io_base + REG_TSD0 + (i * 4))) & TX_STATUS_OK) > 0)
                    {
                        m_mutexes[i].Unlock();
                    }
                }
            }

#if RTL_DEBUG
            if ((ISR & ISR_TER) > 0)
            {
                Console.WriteLine("[RTL8139] Transmit error!");
            }

            if ((ISR & ISR_RER) > 0)
            {
                Console.WriteLine("[RTL8139] Receive error!");
            }
#endif

            if ((ISR & ISR_ROK) > 0)
            {
                HandlePackets();
            }

            PortIO.Out16((ushort)(m_io_base + REG_ISR), ISR);

            return(true);
        }
コード例 #5
0
 private static uint readCSR(byte csr_no)
 {
     writeRap(csr_no);
     return(PortIO.In32((ushort)(m_io_base + REG_RDP)));
 }