/// <summary>
        /// Defines a new register and adds it to the collection.
        /// </summary>
        /// <param name="offset">Register offset.</param>
        /// <param name="resetValue">Register reset value.</param>
        /// <returns>Newly added register.</returns>
        public DoubleWordRegister DefineRegister(long offset, uint resetValue = 0)
        {
            var reg = new DoubleWordRegister(parent, resetValue);

            registers.Add(offset, reg);
            return(reg);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a register with one field, serving a purpose of read and write register.
        /// </summary>
        /// <returns>A new register.</returns>
        /// <param name="resetValue">Reset value.</param>
        /// <param name="name">Ignored parameter, for convenience. Treat it as a comment.</param>
        public static DoubleWordRegister CreateRWRegister(uint resetValue = 0, string name = null)
        {
            //null because parent is used for logging purposes only - this will never happen in this case.
            var register = new DoubleWordRegister(null, resetValue);

            register.DefineValueField(0, register.MaxRegisterLength);
            return(register);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Fluent API for read callback registration. For description see <see cref="DoubleWordRegister.DefineReadCallback"/>.
 /// </summary>
 /// <returns>This register with a defined callback.</returns>
 public static DoubleWordRegister WithReadCallback(this DoubleWordRegister register, Action <uint, uint> readCallback)
 {
     register.DefineReadCallback(readCallback);
     return(register);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Fluent API for change callback registration. For description see <see cref="DoubleWordRegister.DefineChangeCallback"/>.
 /// </summary>
 /// <returns>This register with a defined callback.</returns>
 public static DoubleWordRegister WithChangeCallback(this DoubleWordRegister register, Action <uint, uint> changeCallback)
 {
     register.DefineChangeCallback(changeCallback);
     return(register);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Fluent API for write callback registration. For description see <see cref="DoubleWordRegister.DefineWriteCallback"/>.
 /// </summary>
 /// <returns>This register with a defined callback.</returns>
 public static DoubleWordRegister WithWriteCallback(this DoubleWordRegister register, Action <uint, uint> writeCallback)
 {
     register.DefineWriteCallback(writeCallback);
     return(register);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Fluent API for tagging bits as "RESERVED". For description see <see cref="PeripheralRegister.Reserved"/>.
 /// </summary>
 /// <returns>This register with a new "RESERVED" tag.</returns>
 public static DoubleWordRegister WithReservedBits(this DoubleWordRegister register, int position, int width)
 {
     register.Reserved(position, width);
     return(register);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Fluent API for tagging bits as "RESERVED". For description see <see cref="PeripheralRegister.Reserved"/>.
 /// </summary>
 /// <returns>This register with a new "RESERVED" tag.</returns>
 public static DoubleWordRegister WithReservedBits(this DoubleWordRegister register, int position, int width, uint?allowedValue = null)
 {
     register.Reserved(position, width, allowedValue);
     return(register);
 }
 /// <summary>
 /// Adds an existing register to the collection.
 /// </summary>
 /// <param name="offset">Register offset.</param>
 /// <param name="register">Register to add.</param>
 /// <returns>Added register (the same passed in <see cref="register"> argument).</returns>
 public DoubleWordRegister AddRegister(long offset, DoubleWordRegister register)
 {
     registers.Add(offset, register);
     return(register);
 }