text: #  ISC
  #
  #  Copyright (c) 2022 Adir Vered <adir.vrd@gmail.com>
  #
  #  Permission to use, copy, modify, and/or distribute this software for any purpose
  #  with or without fee is hereby granted, provided that the above copyright notice
  #  and this permission notice appear in all copies.
  #
  #  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  #  REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  #  AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  #  INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  #  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  #  OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  #  OR PERFORMANCE OF THIS SOFTWARE.
  #
  
  #######################################
  ### work in progress, don't use it yet!
  #######################################
  
  from mmap import mmap as _mm
  from importlib import import_module as _il
  from ctypes import c_uint32 as _ct
  
  __name__ = "IRB"
  
  class Setup():
    def __init__(self, board):
      """ board: Board as variable or AMPatio direct call to boards() with board name as argument
      """
      global device, region
  
      device = _il(' '.join(["AMPatio.models.", board["SOC"], ".IRB"]))
  
      # need to make test mechanism if the ir module is loaded and then release it before continue...
      #
  
      # check if board irb pin number isn't 0 and can be manipulated
      if (irbPin := board["AF"]["IRB"]):
        region = [*range(2)]
        size = (1024*4)
        with open("/dev/mem", "rb+") as file:
          region = _mm(file.fileno(), size, offset=device.address)
      else:
        raise ValueError("your board.json file don't have IRB pin set, value must be real header pin and other then 0")
    ### Setup EoC
  
  
  #class Blaster():
  #  def __init__(self, ):
  