From 58fd605f35ef786e6c18d9403ad6692da3fbe0b3 Mon Sep 17 00:00:00 2001 From: Jonathan O'Brien Date: Mon, 28 Mar 2016 10:50:08 -0700 Subject: [PATCH 1/2] Add support for 64 bit arch and python 3 Added signature to pass *data as pointer instead of int (default) which was causing problems on 64 bit systems. Use truncating division operator to support python 3. --- python/riffa.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/python/riffa.py b/python/riffa.py index 1213677..94c76aa 100644 --- a/python/riffa.py +++ b/python/riffa.py @@ -1,5 +1,5 @@ # ---------------------------------------------------------------------- -# Copyright (c) 2016, The Regents of the University of California All +# Copyright (c) 2015, The Regents of the University of California All # rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -48,6 +48,9 @@ if platform.system() == "Linux": else: libriffa = ctypes.CDLL("riffa.dll") +libriffa.fpga_recv.argtypes = [ctypes.c_void_p, ctypes.c_int, ctypes.c_void_p, ctypes.c_int, ctypes.c_longlong] +libriffa.fpga_send.argtypes = [ctypes.c_void_p, ctypes.c_int, ctypes.c_void_p, ctypes.c_int, ctypes.c_int, ctypes.c_int, ctypes.c_longlong] + class FpgaInfoList(ctypes.Structure): _fields_ = [("num_fpgas", ctypes.c_int), ("id", ctypes.c_int * NUM_FPGAS), @@ -156,7 +159,7 @@ def fpga_recv(fd, chnl, data, timeout): ctypes.pythonapi.PyObject_AsReadBuffer(obj, ctypes.byref(a), ctypes.byref(l)) ptr = a.value datalen = l.value - return libriffa.fpga_recv(fd, chnl, ptr, datalen/4, timeout) + return libriffa.fpga_recv(fd, chnl, ptr, datalen//4, timeout) # Resets the state of the FPGA and all transfers across all channels. This is From 718d167823a07b4cab903127c88db8888052dab8 Mon Sep 17 00:00:00 2001 From: Jonathan O'Brien Date: Mon, 28 Mar 2016 11:09:18 -0700 Subject: [PATCH 2/2] Manually fixed up copyright date. --- python/riffa.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/riffa.py b/python/riffa.py index 94c76aa..565cb6d 100644 --- a/python/riffa.py +++ b/python/riffa.py @@ -1,5 +1,5 @@ # ---------------------------------------------------------------------- -# Copyright (c) 2015, The Regents of the University of California All +# Copyright (c) 2016, The Regents of the University of California All # rights reserved. # # Redistribution and use in source and binary forms, with or without