/// <summary>
        /// Creates the device register set (typed registers).
        /// Note that the BAR and offset can be specified by the caller so the same RegisterSet
        /// class can be used to define multiple unique RegisterSet instances (different offset
        /// and or BAR).
        /// </summary>
        /// <param name="manager">the IRegManager instance to add this RegisterSet to</param>
        /// <param name="instrument">the IInstrument instance these registers are for</param>
        /// <param name="groupName">the group name used to access this RegisterSet from IRegManager</param>
        /// <param name="registerSetOffset">an offset added to all register offsets</param>
        /// <param name="barIndex">the BAR to use</param>
        public ReceiverRegisterSet(IRegManager manager, IInstrument module, string groupName, int registerSetOffset, int barIndex)
        {
            // Create the factory
            RegFactory regFactory = new RegFactory(registerSetOffset, module, Reg32.ConstructReg);

            // Determine which IRegDriver (determines default BAR)
            IRegDriver regDriver = (barIndex >= module.RegDrivers.Length) ? null : module.RegDrivers[barIndex];

            if (regDriver == null)
            {
                throw new InternalApplicationException("ReceiverRegisterSet requires RegDriver for BAR" + barIndex);
            }

            // Create the register definitions
            Registers = regFactory.CreateRegArray(
                mRegisterDefinitions,
                typeof(ReceiverRegister),
                regDriver,
                module.Name);

            regFactory.CreateBitFields(mBitFieldDefinitions, Registers, module.Name, string.Empty);

            if (manager != null)
            {
                // Adding as a group creates an IDirtyBit and attaches to each register
                manager.AddGroup(groupName, this);
            }
            SoftwareFpgaReset = new Reg32T <SoftwareFpgaResetBF>((Reg32)Registers[(Int32)ReceiverRegister.SoftwareFpgaReset]);
            RfStatus          = new Reg32T <RfStatusBF>((Reg32)Registers[(Int32)ReceiverRegister.RfStatus]);
            FpgaVersion       = new Reg32T <FpgaVersionBF>((Reg32)Registers[(Int32)ReceiverRegister.FpgaVersion]);
            Reserved          = new Reg32T <ReservedBF>((Reg32)Registers[(Int32)ReceiverRegister.Reserved]);
            RfControl1        = new Reg32T <RfControl1BF>((Reg32)Registers[(Int32)ReceiverRegister.RfControl1]);
            RfControl2        = new Reg32T <RfControl2BF>((Reg32)Registers[(Int32)ReceiverRegister.RfControl2]);
            RfControl3        = new Reg32T <RfControl3BF>((Reg32)Registers[(Int32)ReceiverRegister.RfControl3]);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates the device register set (typed registers).
        /// Note that the BAR and offset can be specified by the caller so the same RegisterSet
        /// class can be used to define multiple unique RegisterSet instances (different offset
        /// and or BAR).
        /// </summary>
        /// <param name="manager">the IRegManager instance to add this RegisterSet to</param>
        /// <param name="instrument">the IInstrument instance these registers are for</param>
        /// <param name="groupName">the group name used to access this RegisterSet from IRegManager</param>
        /// <param name="registerSetOffset">an offset added to all register offsets</param>
        /// <param name="barIndex">the BAR to use</param>
        public SoftwareLatchesRegisterSet(IRegManager manager, IInstrument module, string groupName, int registerSetOffset, int barIndex)
        {
            // Create the factory
            RegFactory regFactory = new RegFactory(registerSetOffset, module, SimulatedReg.ConstructReg);

            // Determine which IRegDriver (determines default BAR)
            IRegDriver regDriver = (barIndex >= module.RegDrivers.Length) ? null : module.RegDrivers[barIndex];

            if (regDriver == null)
            {
                throw new InternalApplicationException("SoftwareLatchesRegisterSet requires RegDriver for BAR" + barIndex);
            }

            // Create the register definitions
            Registers = regFactory.CreateRegArray(
                mRegisterDefinitions,
                typeof(SoftwareLatchesRegister),
                regDriver,
                module.Name);

            regFactory.CreateBitFields(mBitFieldDefinitions, Registers, module.Name, string.Empty);

            if (manager != null)
            {
                // Adding as a group creates an IDirtyBit and attaches to each register
                manager.AddGroup(groupName, this);
            }
            LatchOne   = new Reg64T <LatchOneBF>((SimulatedReg)Registers[(Int32)SoftwareLatchesRegister.LatchOne]);
            TxSwLatch1 = new Reg64T <TxSwLatch1BF>((SimulatedReg)Registers[(Int32)SoftwareLatchesRegister.TxSwLatch1]);
            RxSwLatch1 = new Reg64T <RxSwLatch1BF>((SimulatedReg)Registers[(Int32)SoftwareLatchesRegister.RxSwLatch1]);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Construct the specified registers and bitfields.
        ///
        /// Also, set up the register accessors (by calling virtual method InitializeRegisterAccessors)
        /// </summary>
        /// <param name="manager">Optional IRegManager, if non-null the created registers will be added as a group</param>
        /// <param name="module">The module the register will be part of</param>
        /// <param name="groupName">The group name to use when adding register to 'manager'</param>
        /// <param name="factory">The register factory to use to create the registers</param>
        /// <param name="registerEnumType">The type of the register enumeration, used to size the register array and determine register names</param>
        /// <param name="registers">The register definitions</param>
        /// <param name="bitFields">The bit field definitions</param>
        protected void ConstructRegisters(IRegManager manager,
                                          IInstrument module,
                                          string groupName,
                                          RegFactory factory,
                                          Type registerEnumType,
                                          ICollection <RegDef> registers,
                                          ICollection <BitFieldDef> bitFields)
        {
            const object[] args = null;

            ConstructRegisters(manager, module, groupName, factory, registerEnumType, registers, bitFields, args);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Creates the device register set (typed registers).
        /// Note that the BAR and offset can be specified by the caller so the same RegisterSet
        /// class can be used to define multiple unique RegisterSet instances (different offset
        /// and or BAR).
        /// </summary>
        /// <param name="manager">the IRegManager instance to add this RegisterSet to</param>
        /// <param name="instrument">the IInstrument instance these registers are for</param>
        /// <param name="groupName">the group name used to access this RegisterSet from IRegManager</param>
        /// <param name="registerSetOffset">an offset added to all register offsets</param>
        /// <param name="barIndex">the BAR to use</param>
        public SourceRegisterSet(IRegManager manager, IInstrument module, string groupName, int registerSetOffset, int barIndex)
        {
            // Create the factory
            RegFactory regFactory = new RegFactory(registerSetOffset, module, Reg32.ConstructReg);

            // Determine which IRegDriver (determines default BAR)
            IRegDriver regDriver = (barIndex >= module.RegDrivers.Length) ? null : module.RegDrivers[barIndex];

            if (regDriver == null)
            {
                throw new InternalApplicationException("SourceRegisterSet requires RegDriver for BAR" + barIndex);
            }

            // Create the register definitions
            Registers = regFactory.CreateRegArray(
                mRegisterDefinitions,
                typeof(SourceRegister),
                regDriver,
                module.Name);

            regFactory.CreateBitFields(mBitFieldDefinitions, Registers, module.Name, string.Empty);

            if (manager != null)
            {
                // Adding as a group creates an IDirtyBit and attaches to each register
                manager.AddGroup(groupName, this);
            }
            RFCntrl_path    = new Reg32T <RFCntrl_pathBF>((Reg32)Registers[(Int32)SourceRegister.RFCntrl_path]);
            RFCntrl_Port    = new Reg32T <RFCntrl_PortBF>((Reg32)Registers[(Int32)SourceRegister.RFCntrl_Port]);
            LOCntrl         = new Reg32T <LOCntrlBF>((Reg32)Registers[(Int32)SourceRegister.LOCntrl]);
            IQCntrl         = new Reg32T <IQCntrlBF>((Reg32)Registers[(Int32)SourceRegister.IQCntrl]);
            PowerCntrl      = new Reg32T <PowerCntrlBF>((Reg32)Registers[(Int32)SourceRegister.PowerCntrl]);
            RFAtten         = new Reg32T <RFAttenBF>((Reg32)Registers[(Int32)SourceRegister.RFAtten]);
            TempSensorCntrl = new Reg32T <TempSensorCntrlBF>((Reg32)Registers[(Int32)SourceRegister.TempSensorCntrl]);
            AbusRegister    = new Reg32T <AbusRegisterBF>((Reg32)Registers[(Int32)SourceRegister.AbusRegister]);
            RFUtility       = new Reg32T <RFUtilityBF>((Reg32)Registers[(Int32)SourceRegister.RFUtility]);
            RfStatus        = new Reg32T <RfStatusBF>((Reg32)Registers[(Int32)SourceRegister.RfStatus]);
            ChipID_L        = new Reg32T <ChipID_LBF>((Reg32)Registers[(Int32)SourceRegister.ChipID_L]);
            ChipID_H        = new Reg32T <ChipID_HBF>((Reg32)Registers[(Int32)SourceRegister.ChipID_H]);
            RfFpgaVersion   = new Reg32T <RfFpgaVersionBF>((Reg32)Registers[(Int32)SourceRegister.RfFpgaVersion]);
            RfFpgaSoftReset = new Reg32T <RfFpgaSoftResetBF>((Reg32)Registers[(Int32)SourceRegister.RfFpgaSoftReset]);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Construct the specified registers and bitfields.
        ///
        /// Also, set up the register accessors (by calling virtual method InitializeRegisterAccessors)
        /// </summary>
        /// <param name="manager">Optional IRegManager, if non-null the created registers will be added as a group</param>
        /// <param name="module">The module the register will be part of</param>
        /// <param name="groupName">The group name to use when adding register to 'manager'</param>
        /// <param name="factory">The register factory to use to create the registers</param>
        /// <param name="registerEnumType">The type of the register enumeration, used to size the register array and determine register names</param>
        /// <param name="registers">The register definitions</param>
        /// <param name="bitFields">The bit field definitions</param>
        /// <param name="args">optional arguments to pass to CreateRegArray - interpretation depends on the specific RegFactory implementation</param>
        protected void ConstructRegisters(IRegManager manager,
                                          IInstrument module,
                                          string groupName,
                                          RegFactory factory,
                                          Type registerEnumType,
                                          ICollection <RegDef> registers,
                                          ICollection <BitFieldDef> bitFields,
                                          object[] args)
        {
            string middleName = string.Empty;

            Registers = factory.CreateRegArray(registers,
                                               registerEnumType,
                                               module.RegDriver,
                                               module.Name,
                                               middleName,
                                               args);

            factory.CreateBitFields(bitFields,
                                    Registers,
                                    module.Name);

            // TODO CORE: should this be optional?
            // Verify bit fields...
            foreach (IRegister register in Registers)
            {
                if (register != null)
                {
                    register.VerifyBitFields();
                }
            }

            // "Install" the registers into IRegManager
            if (manager != null && !string.IsNullOrEmpty(groupName))
            {
                manager.AddGroup(groupName, Registers);
            }

            // Set up register accessors (normally public properties to expose commonly accessed
            // registers and/or wrap registers in Reg32T).
            InitializeRegisterAccessors();
        }
Exemplo n.º 6
0
 /// <summary>
 /// Creates the device register set (typed registers). Uses the 'default' BAR
 /// (which is normally specified in the register spreadsheet).
 /// </summary>
 /// <param name="manager">the IRegManager instance to add this RegisterSet to</param>
 /// <param name="instrument">the IInstrument instance these registers are for</param>
 /// <param name="groupName">the group name used to access this RegisterSet from IRegManager</param>
 /// <param name="registerSetOffset">an offset added to all register offsets</param>
 public SourceRegisterSet(IRegManager manager, IInstrument module, string groupName, int registerSetOffset)
     : this(manager, module, groupName, registerSetOffset, /*barIndex=*/ 0)
 {
 }
Exemplo n.º 7
0
 /// <summary>
 /// Creates the device register set (typed registers). Uses the 'default' BAR
 /// (which is normally specified in the register spreadsheet).
 /// </summary>
 /// <param name="manager">the IRegManager instance to add this RegisterSet to</param>
 /// <param name="instrument">the IInstrument instance these registers are for</param>
 /// <param name="groupName">the group name used to access this RegisterSet from IRegManager</param>
 public SourceRegisterSet(IRegManager manager, IInstrument module, string groupName)
     : this(manager, module, groupName, (int)BaseAddress.Source0, /*barIndex=*/ 0)
 {
 }