diff --git a/source/Cosmos/Cosmos.Hardware/Audio/Devices/ES1370/Register/ConfigurationRegister1.cs b/source/Cosmos/Cosmos.Hardware/Audio/Devices/ES1370/Register/ConfigurationRegister1.cs
deleted file mode 100644
index dd4415420..000000000
--- a/source/Cosmos/Cosmos.Hardware/Audio/Devices/ES1370/Register/ConfigurationRegister1.cs
+++ /dev/null
@@ -1,115 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Cosmos.Hardware;
-namespace Cosmos.Hardware.Audio.Devices.ES1370.Register
-{
- //TODO: According to real ES1370 (it's just a copy-and-paste of Kudzu original work)
- class ConfigurationRegister1
- {
- #region Constructor
-
- private Kernel.MemoryAddressSpace xMem;
- public static ConfigurationRegister1 Load(Kernel.MemoryAddressSpace aMem)
- {
- return new ConfigurationRegister1(aMem);
- }
-
- private ConfigurationRegister1(Kernel.MemoryAddressSpace aMem)
- {
- xMem = aMem;
- }
-
- ///
- /// Get or Sets the 8 bits in the Config_1 Register.
- ///
- public byte CONFIG1
- {
- get
- {
- //return xMem.Read8((UInt32)Register.MainRegister.Bit.Config1);
- return 0;
- }
- set
- {
- //xMem.Write8((UInt32)Register.MainRegister.Bit.Config1, value);
- }
- }
-
- #endregion
-
- #region Register Data
-
- public bool PowerEnabled
- {
- get
- { //return GetBit(BitPosition.PMEN);
- return true;
- }
- set
- { //SetBit(BitValue.PMEN, value); }
- }
- }
-
- #endregion
-
- #region Accessors
-
- private bool GetBit(BitPosition bit)
- {
- //return BinaryHelper.CheckBit(this.CONFIG1, (byte)bit);
- return false;
- }
-
- private void SetBit(BitValue bit, bool value)
- {
- if (value)
- this.CONFIG1 = (byte)(this.CONFIG1 | (byte)bit);
- else
- this.CONFIG1 = (byte)(this.CONFIG1 & ~(byte)bit);
- }
-
- public override string ToString()
- {
- //return this.CONFIG1.ToBinary(8);
- return null;
- }
-
- #endregion
-
- }
- #region Bits
-
- [Flags]
- public enum BitPosition : byte
- {
- /*
- PMEN = 0, //Power Management Enable
- VPD = 1, //Enable Vital Product Data
- IOMAP = 2, //I/O Mapping
- MEMMAP = 3, //Memory mapping
- LWACT = 4, //LWake Active Mode
- DVRLOAD = 5,//Driver Load
- LEDS0 = 6,
- LEDS1 = 7
- */
- }
-
- [Flags]
- public enum BitValue : uint
- {
- /*
- PMEN = BinaryHelper.BitPos.BIT0,
- VPD = BinaryHelper.BitPos.BIT1,
- IOMAP = BinaryHelper.BitPos.BIT2,
- MEMMAP = BinaryHelper.BitPos.BIT3,
- LWACT = BinaryHelper.BitPos.BIT4,
- DVRLOAD = BinaryHelper.BitPos.BIT5,
- LEDS0 = BinaryHelper.BitPos.BIT6,
- LEDS1 = BinaryHelper.BitPos.BIT7
- */
- }
-
- #endregion
- }
diff --git a/source/Cosmos/Cosmos.Hardware/Audio/Devices/ES1370/Register/ControlRegister.cs b/source/Cosmos/Cosmos.Hardware/Audio/Devices/ES1370/Register/ControlRegister.cs
new file mode 100644
index 000000000..577bd114d
--- /dev/null
+++ b/source/Cosmos/Cosmos.Hardware/Audio/Devices/ES1370/Register/ControlRegister.cs
@@ -0,0 +1,214 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Cosmos.Hardware;
+namespace Cosmos.Hardware.Audio.Devices.ES1370.Register
+{
+ class ControlRegister
+ {
+ #region Constructor
+
+ private Kernel.MemoryAddressSpace xMem;
+ public static ControlRegister Load(Kernel.MemoryAddressSpace aMem)
+ {
+ return new ControlRegister(aMem);
+ }
+
+ private ControlRegister(Kernel.MemoryAddressSpace aMem)
+ {
+ xMem = aMem;
+ }
+
+ ///
+ /// Get or Sets the 8 bits in the Control Register.
+ ///
+ public byte CONTROL
+ {
+ get
+ {
+ return xMem.Read8((UInt32)Register.MainRegister.Bit.Control);
+ }
+ set
+ {
+ xMem.Write8((UInt32)Register.MainRegister.Bit.Control, value);
+ }
+ }
+
+ #endregion
+
+ #region Register Data
+
+ public bool PowerEnabled
+ {
+ get
+ {
+ return GetBit(BitPosition.SERRDis);
+ }
+ set
+ {
+ SetBit(BitValue.SERRDis, !value);
+ }
+ }
+
+ public bool CodecEnabled
+ {
+ get
+ {
+ return GetBit(BitPosition.CodecEn);
+ }
+ set
+ {
+ SetBit(BitValue.CodecEn, value);
+ }
+ }
+
+ public bool DAC1Enabled
+ {
+ get
+ {
+ return GetBit(BitPosition.DAC1En);
+ }
+ set
+ {
+ SetBit(BitValue.DAC1En, value);
+ }
+ }
+
+ public bool DAC2Enabled
+ {
+ get
+ {
+ return GetBit(BitPosition.DAC2En);
+ }
+ set
+ {
+ SetBit(BitValue.DAC2En, value);
+ }
+ }
+
+ public bool UARTEnabled
+ {
+ get
+ {
+ return GetBit(BitPosition.UARTEn);
+ }
+ set
+ {
+ SetBit(BitValue.UARTEn, value);
+ }
+ }
+ public bool MemoryBusRequestEnabled
+ {
+ get
+ {
+ return GetBit(BitPosition.BREQEn);
+ }
+ set
+ {
+ SetBit(BitValue.BREQEn, value);
+ }
+ }
+
+ public ClockSourceType ClockSourceTypeSelected
+ {
+ get
+ {
+ if(GetBit(BitPosition.MSBB))
+ return ClockSourceType.MPEGClock;
+ else
+ return ClockSourceType.GenClock;
+ }
+ set
+ {
+ if(value.Equals(ClockSourceType.GenClock))
+ SetBit(BitValue.MSBB, true);
+ else
+ SetBit(BitValue.MSBB, false);
+ }
+ }
+
+ public MPEGDataType MPEGDataTypeSelected
+ {
+ get
+ {
+ if (GetBit(BitPosition.MSFMTSEL))
+ return MPEGDataType.I2S;
+ else
+ return MPEGDataType.SONY;
+ }
+ set
+ {
+ if (value.Equals(MPEGDataType.I2S))
+ SetBit(BitValue.MSFMTSEL, true);
+ else
+ SetBit(BitValue.MSFMTSEL, false);
+ }
+ }
+ #endregion
+
+ #region Accessors
+
+ private bool GetBit(BitPosition bit)
+ {
+ return BinaryHelper.CheckBit(this.CONTROL, (byte)bit);
+ }
+
+ private void SetBit(BitValue bit, bool value)
+ {
+ if (value)
+ this.CONTROL = (byte)(this.CONTROL | (byte)bit);
+ else
+ this.CONTROL = (byte)(this.CONTROL & ~(byte)bit);
+ }
+
+ public override string ToString()
+ {
+ //return this.CONTROL.ToBinary(8);
+ return null;
+ }
+
+ #endregion
+
+ }
+ #region Bits
+
+ [Flags]
+ public enum BitPosition : byte
+ {
+ SERRDis=0,
+ CodecEn=1,
+ UARTEn=3,
+ DAC2En=5,
+ DAC1En=6,
+ BREQEn = 7, //memory bus request enable
+ MSBB = 14, //clock source for DAC: gen (0) - MPEG(1)
+ MSFMTSEL=15 //MPEG data SONY(0)/I2S(1)
+ }
+
+ [Flags]
+ public enum BitValue : uint
+ {
+ SERRDis = BinaryHelper.BitPos.BIT0,
+ CodecEn = BinaryHelper.BitPos.BIT1,
+ UARTEn = BinaryHelper.BitPos.BIT3,
+ DAC2En = BinaryHelper.BitPos.BIT5,
+ DAC1En = BinaryHelper.BitPos.BIT6,
+ BREQEn = BinaryHelper.BitPos.BIT7,
+ MSBB = BinaryHelper.BitPos.BIT14,
+ MSFMTSEL = BinaryHelper.BitPos.BIT15
+ }
+
+ public enum ClockSourceType : uint
+ {
+ GenClock=0,
+ MPEGClock=1
+ }
+
+ public enum MPEGDataType : uint
+ {
+ SONY=0,
+ I2S=1
+ }
+ #endregion
+ }
diff --git a/source/Cosmos/Cosmos.Hardware/Audio/Devices/ES1370/Register/InterruptMaskRegister.cs b/source/Cosmos/Cosmos.Hardware/Audio/Devices/ES1370/Register/InterruptMaskRegister.cs
index 14b88acdb..04c004edc 100644
--- a/source/Cosmos/Cosmos.Hardware/Audio/Devices/ES1370/Register/InterruptMaskRegister.cs
+++ b/source/Cosmos/Cosmos.Hardware/Audio/Devices/ES1370/Register/InterruptMaskRegister.cs
@@ -47,15 +47,17 @@ namespace Cosmos.Hardware.Audio.Devices.ES1370.Register
private bool GetBit(BitPosition bit)
{
- return BinaryHelper.CheckBit(this.IMR, (byte)bit);
+ //return BinaryHelper.CheckBit(this.IMR, (byte)bit);
+ return false;
}
private void SetBit(BitValue bit, bool value)
- {
+ {/*
if (value)
this.IMR = (byte)(this.IMR | (byte)bit);
else
this.IMR = (byte)(this.IMR & ~(byte)bit);
+ */
}
#endregion
diff --git a/source/Cosmos/Cosmos.Hardware/Audio/Devices/ES1370/Register/InterruptStatusRegister.cs b/source/Cosmos/Cosmos.Hardware/Audio/Devices/ES1370/Register/InterruptStatusRegister.cs
index aa1c4b981..b7cd2f954 100644
--- a/source/Cosmos/Cosmos.Hardware/Audio/Devices/ES1370/Register/InterruptStatusRegister.cs
+++ b/source/Cosmos/Cosmos.Hardware/Audio/Devices/ES1370/Register/InterruptStatusRegister.cs
@@ -65,15 +65,18 @@ namespace Cosmos.Hardware.Audio.Devices.ES1370.Register
private bool GetBit(BitPosition bit)
{
- return BinaryHelper.CheckBit(this.ISR, (byte)bit);
+ //return BinaryHelper.CheckBit(this.ISR, (byte)bit);
+ return false;
}
private void SetBit(BitValue bit, bool value)
{
+ /*
if (value)
this.ISR = (byte)(this.ISR | (byte)bit);
else
this.ISR = (byte)(this.ISR & ~(byte)bit);
+ */
}
#endregion
diff --git a/source/Cosmos/Cosmos.Hardware/Audio/Devices/ES1370/Register/SerialInterfaceRegister.cs b/source/Cosmos/Cosmos.Hardware/Audio/Devices/ES1370/Register/SerialInterfaceRegister.cs
new file mode 100644
index 000000000..9c0394513
--- /dev/null
+++ b/source/Cosmos/Cosmos.Hardware/Audio/Devices/ES1370/Register/SerialInterfaceRegister.cs
@@ -0,0 +1,11 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Cosmos.Hardware.Audio.Devices.ES1370.Register
+{
+ class SerialInterfaceRegister
+ {
+ }
+}
diff --git a/source/Cosmos/Cosmos.Hardware/Cosmos.Hardware.csproj b/source/Cosmos/Cosmos.Hardware/Cosmos.Hardware.csproj
index a598b8d74..ba4ea6586 100644
--- a/source/Cosmos/Cosmos.Hardware/Cosmos.Hardware.csproj
+++ b/source/Cosmos/Cosmos.Hardware/Cosmos.Hardware.csproj
@@ -52,10 +52,11 @@
-
+
+