/// <summary> /// Registers the AC97 driver /// </summary> public static void Init() { Pci.PciDriver driver = new Pci.PciDriver(); driver.Name = "AC97 Driver"; driver.Exit = exitHander; driver.Init = initHandler; Pci.RegisterDriver(0x8086, 0x2415, driver); // TODO AudioFS.SoundDevice device = new AudioFS.SoundDevice(); device.Name = "AC97 audio device"; device.Writer = Writer; device.Reader = Reader; AudioFS.SetDevice(device); }
/// <summary> /// IRQ Handler /// </summary> /// <returns>If we handled the irq</returns> private static bool handler() { ushort sr = PortIO.In16((ushort)(m_nabmbar + REG_SR)); if ((sr & SR_LVBCI) > 0) { PortIO.Out16((ushort)(m_nabmbar + REG_SR), SR_LVBCI); } else if ((sr & SR_BCIS) > 0) { // Load next one already int next = m_lvi + 2; if (next >= BDL_COUNT) { next -= BDL_COUNT; } AudioFS.RequestBuffer(AudioFS.BufferSize, m_bufs[next]); // Set current one m_lvi++; if (m_lvi == BDL_COUNT) { m_lvi = 0; } PortIO.Out8((ushort)(m_nabmbar + REG_LVI), (byte)m_lvi); PortIO.Out16((ushort)(m_nabmbar + REG_SR), SR_BCIS); } else if ((sr & SR_FIFOE) > 0) { PortIO.Out16((ushort)(m_nabmbar + REG_SR), SR_FIFOE); } else { return(false); } return(true); }
/// <summary> /// Initializes sound and its drivers /// </summary> private static void initSound() { AudioFS.Init(); AC97.Init(); }