Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)

          @staticmethod
  def pre_process(bitstream, jtag, chain, progressCallback=None):
    CHUNK_SIZE = 4096*4
    chunk = ""
    chunks = []
    
    bytetotal = len(bitstream)
    start_time = time.time()
    last_update = 0
    written = 0

    for b in bitstream[:-1]:
      d = ord(b)
      
      for i in range(7, -1, -1):
        x = (d >> i) & 1
        chunk += jtag._formatJtagClock(tdi=x)
          
        if len(chunk) >= CHUNK_SIZE:
          chunks.append(chunk)
          chunk = ""
      
      written += 1
      if time.time() > (last_update + 1) and progressCallback:
        progressCallback(start_time, time.time(), written, bytetotal)
        last_update = time.time()
    
    if len(chunk) > 0:
      chunks.append(chunk)

    last_bits = []
    d = ord(bitstream[-1])
    for i in range(7, -1, -1):
      last_bits.append((d >> i) & 1)
    
    progressCallback(start_time, time.time(), bytetotal, bytetotal)

    #for i in range(self.current_part):
    #  last_bits.append(0)
    
    processed_bitstream = Object()
    processed_bitstream.chunks = chunks
    processed_bitstream.last_bits = last_bits
    
    return processed_bitstream
        


src/f/t/FT232R-JTAG-HEAD/program.py   FT232R-JTAG(Download)
    logger.log("Pre-processing bitstream for chain = %d..." % settings.chain, False)
    start_time = time.time()
    processed_bitstream = BitFile.pre_process(bitfile.bitstream, jtag, settings.chain, logger.updateProgress)
    logger.log("Pre-processed bitstream in %f seconds" % (time.time() - start_time), False)
    logger.log("Saving pre-processed bitstream...", False)