瀏覽代碼

fixed board.flush_dma function and added calls at begining of acquisition and begining and end of external trigger function

Miriam Brosi 7 年之前
父節點
當前提交
8614b94f1f
共有 2 個文件被更改,包括 6 次插入0 次删除
  1. 3 0
      KCG/base/backend/board/actions.py
  2. 3 0
      KCG/base/backendinterface.py

+ 3 - 0
KCG/base/backend/board/actions.py

@@ -18,6 +18,7 @@ def acquire_data(board_id, filename, simulate=False):
     if simulate:
         start_pilot_bunch_emulator(board_id)
 
+    flush_dma(board_id)
     start_acquisition(board_id)
     wait_for_revolutions(board_id)
     stop_acquisition(board_id)
@@ -47,6 +48,8 @@ def flush_dma(board_id, dma='dma0'):
     """
     log.vinfo('Flushing DMA Pipeline')
     pci.write(board_id, '03f0', hex_mask='CF0')
+    time.sleep(0.05)
+    pci.write(board_id, '007f0', hex_mask='CF0')
     pci.read(board_id, dma=dma, destination='/dev/null')
 
 

+ 3 - 0
KCG/base/backendinterface.py

@@ -1308,6 +1308,7 @@ def _bif_start_wait_on_trigger(board_id, num_of_acquisitions=None, skip=None, ti
             read sequentially
     :return: -
     """
+    board.flush_dma(board_id) # TODO: really at beginning and end of function necessary?
     thread = storage.get_board_specific_storage(board_id).setdefault('TriggerThread', storage.ThreadStorage())
     if thread.running:
         logging.info("Wait already running on board {}".format(board_id))
@@ -1449,6 +1450,7 @@ def _bif_start_wait_on_trigger(board_id, num_of_acquisitions=None, skip=None, ti
             board.pci.write(board_id, '0', '902C')
             time.sleep(0.1)
             board.pci.write(board_id, '3f0', hex_mask='ff0')  # TODO: This writes t/h 3/4 but enable_transfer etc do not
+            board.flush_dma(board_id)
 
     def finished():
         '''Handle the end of the thread'''
@@ -1457,6 +1459,7 @@ def _bif_start_wait_on_trigger(board_id, num_of_acquisitions=None, skip=None, ti
         board.pci.write(board_id, '0', '902C')
         time.sleep(0.1)
         board.pci.write(board_id, '3f0', hex_mask='ff0')  # TODO: This writes t/h 3/4 but enable_transfer etc do not
+        board.flush_dma(board_id)
 
         thread.stop()
         board.get_board_status(board_id).wait = False