Class: C99::NVM
- Inherits:
-
Object
- Object
- C99::NVM
- Includes:
- Origen::Pins, Origen::Registers
- Defined in:
- lib/c99/nvm.rb
Instance Attribute Summary collapse
-
#blocks ⇒ Object
Returns the value of attribute blocks.
Instance Method Summary collapse
- #find_block_by_id(id) ⇒ Object
-
#initialize ⇒ NVM
constructor
A new instance of NVM.
- #override_method ⇒ Object
- #reg_owner_alias ⇒ Object
Constructor Details
#initialize ⇒ NVM
Returns a new instance of NVM.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/c99/nvm.rb', line 8 def initialize reg :mclkdiv, 0x03, size: 16 do |reg| reg.bit 15, :osch reg.bit 14, :asel reg.bit 13, :failctl reg.bit 12, :parsel reg.bit 11, :eccen reg.bit 10..8, :cmdloc, res: 0b001 reg.bit 7..0, :clkdiv, res: 0x18 end reg :data, 0x4, size: 16 do |reg| reg.bits 15..0, :d end @blocks = [Block.new(0, self), Block.new(1, self), Block.new(2, self)] end |
Instance Attribute Details
#blocks ⇒ Object
Returns the value of attribute blocks.
3 4 5 |
# File 'lib/c99/nvm.rb', line 3 def blocks @blocks end |
Instance Method Details
#find_block_by_id(id) ⇒ Object
26 27 28 |
# File 'lib/c99/nvm.rb', line 26 def find_block_by_id(id) @blocks.find { |block| block.id == id } end |
#override_method ⇒ Object
30 31 32 |
# File 'lib/c99/nvm.rb', line 30 def override_method :original end |
#reg_owner_alias ⇒ Object
34 35 36 |
# File 'lib/c99/nvm.rb', line 34 def reg_owner_alias %w(flash fmu) end |