code: def init_chain(self):
          
          if not self._hasinit:
              self._hasinit = True
              self._devices = []
  
              self.jtag_enable()
              while True:
                  # pylint: disable=no-member
                  idcode = self.rw_dr(bitcount=32, read=True,
                                      lastbit=False)()
                  if idcode in NULL_ID_CODES: break
                  dev = self.initialize_device_from_id(self, idcode)
                  if self._debug:
                      print(dev)
                  self._devices.append(dev)
                  if len(self._devices) >= 128:
                      raise JTAGTooManyDevicesError("This is an arbitrary "
                          "limit to deal with breaking infinite loops. If "
                          "you have more devices, please open a bug")
  
              self.jtag_disable()
  
              #The chain comes out last first. Reverse it to get order.
              self._devices.reverse()
docs: Autodetect the devices attached to the Controller, and initialize a JTAGDevice for each.
  
          This is a required call before device specific Primitives can
          be used.