/// <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 WordRegister DefineRegister(long offset, ushort resetValue = 0)
        {
            var reg = new WordRegister(parent, resetValue);

            registers.Add(offset, reg);
            return(reg);
        }
示例#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 WordRegister 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 WordRegister(null, resetValue);

            register.DefineValueField(0, register.MaxRegisterLength);
            return(register);
        }
示例#3
0
 /// <summary>
 /// Fluent API for change callback registration. For description see <see cref="WordRegister.DefineChangeCallback"/>.
 /// </summary>
 /// <returns>This register with a defined callback.</returns>
 public static WordRegister WithChangeCallback(this WordRegister register, Action <ushort, ushort> changeCallback)
 {
     register.DefineChangeCallback(changeCallback);
     return(register);
 }
示例#4
0
 /// <summary>
 /// Fluent API for write callback registration. For description see <see cref="WordRegister.DefineWriteCallback"/>.
 /// </summary>
 /// <returns>This register with a defined callback.</returns>
 public static WordRegister WithWriteCallback(this WordRegister register, Action <ushort, ushort> writeCallback)
 {
     register.DefineWriteCallback(writeCallback);
     return(register);
 }
示例#5
0
 /// <summary>
 /// Fluent API for read callback registration. For description see <see cref="WordRegister.DefineReadCallback"/>.
 /// </summary>
 /// <returns>This register with a defined callback.</returns>
 public static WordRegister WithReadCallback(this WordRegister register, Action <ushort, ushort> readCallback)
 {
     register.DefineReadCallback(readCallback);
     return(register);
 }
示例#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 WordRegister WithReservedBits(this WordRegister register, int position, int width)
 {
     register.Reserved(position, width);
     return(register);
 }
示例#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 WordRegister WithReservedBits(this WordRegister 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 WordRegister AddRegister(long offset, WordRegister register)
 {
     registers.Add(offset, register);
     return(register);
 }