GN4124_CSR = 0x0 DEBUG = 0 # Objects declaration spec = rr.Gennum() # bind to the SPEC board gn4124 = gn4124.CGN4124(spec, GN4124_CSR) print '\nGet physical memory pages address list' pages = gn4124.get_physical_addr() if DEBUG != 0: for i in range(10): print("Host DMA pages %3d: %.8X") % (i, pages[i]) print '\nInitialise memory pages' gn4124.set_memory_page(0, 0x0) gn4124.set_memory_page(1, 0xC0FFEE11) gn4124.set_memory_page(2, 0xDEADBABE) gn4124.set_memory_page(3, 0x0) gn4124.set_memory_page(4, 0x0) print '\nReading data from memory page 2 (before DMA)' page2_data_before = gn4124.get_memory_page(2) print '\nPreparing DMA' dma_length = 0x100 # DMA length in bytes gn4124.add_dma_item(0, pages[1], dma_length, 1, 1) # write from page 1 to SPEC memory gn4124.add_dma_item(0, pages[2], dma_length, 0, 0) # read from SPEC memory to page 2 print '\nPage 0 data - DMA next items' page0_data = gn4124.get_memory_page(0)
# Objects declaration spec = rr.Gennum() # bind to the SPEC board gn4124 = gn4124.CGN4124(spec, GN4124_CSR) adc_csr = csr.CCSR(spec, CSR) print '\n### Configuration ###' # Set local bus frequency gn4124.set_local_bus_freq(160) print("GN4124 local bus frequency: %d") % gn4124.get_local_bus_freq() pages = gn4124.get_physical_addr() gn4124.set_memory_page(0, 0x0) gn4124.set_memory_page(1, 0x0) gn4124.set_memory_page(2, 0x0) gn4124.set_memory_page(3, 0x0) gn4124.set_memory_page(4, 0x0) #print 'Write debugging data (address) to DPRAM' #adc_csr.wr_reg(CSR_CTRL, 0x2) # reset acquisition time.sleep(.1) adc_csr.wr_reg(CSR_CTRL, 0x0) print("Command:%.8X") % adc_csr.rd_reg(CSR_CTRL) time.sleep(.1) # Acquire data