From ed9d8f285f4d81e1ce8bb5e7a5b9e471a73c1590 Mon Sep 17 00:00:00 2001 From: Vasilii Chernov Date: Tue, 16 Feb 2016 16:30:40 +0100 Subject: 1. Add python thread initialization to pcilib_init_py() -Fix pcilib_script_run_func() work in multithread mode 2. pcilib_close() - Move free_py() code after free views to make view destructors work properly 3. Move script hash to pcilib_py_s 4. Move pcilib_get_logger() pcilib_get_logger_min_prio() and pcilib_get_logger_argument() declarations to error.h 5. Refactor pcilib_get_value_as_pyobject pcilib_set_value_from_pyobject to more unified form 6. Add more memory checks. Fix some string memory allocations. 7. Refactor pcilib_py_s member names. 8. Merge pcilib_script_read() and pcilib_script_write() to pcilib_script_run_func() 9. Update test_pywrap views scripts --- pywrap/pcipywrap.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'pywrap/pcipywrap.c') diff --git a/pywrap/pcipywrap.c b/pywrap/pcipywrap.c index b1ee630..40dbdfc 100644 --- a/pywrap/pcipywrap.c +++ b/pywrap/pcipywrap.c @@ -127,7 +127,6 @@ PyObject* create_pcilib_instance(const char *fpga_device, const char *model) pcilib_error("#E Failed pcilib_open(%s, %s)", fpga_device, model); return NULL; } - return PyCObject_FromVoidPtr((void*)ctx, close_pcilib_instance); } @@ -204,7 +203,7 @@ PyObject* read_register(const char *regname, const char *bank) return NULL; } - return pcilib_get_value_as_pyobject(__ctx, &val); + return pcilib_get_value_as_pyobject(__ctx, &val, NULL); } /*! @@ -228,7 +227,7 @@ PyObject* write_register(PyObject* val, const char *regname, const char *bank) int err; - err = pcilib_set_value_from_pyobject(__ctx, val, &val_internal); + err = pcilib_set_value_from_pyobject(__ctx, &val_internal, val); if(err) { @@ -279,7 +278,7 @@ PyObject* get_property(const char *prop) return NULL; } - return pcilib_get_value_as_pyobject(__ctx, &val); + return pcilib_get_value_as_pyobject(__ctx, &val, NULL); } /*! @@ -299,7 +298,7 @@ PyObject* set_property(PyObject* val, const char *prop) } pcilib_value_t val_internal = {0}; - err = pcilib_set_value_from_pyobject(__ctx, val, &val_internal); + err = pcilib_set_value_from_pyobject(__ctx, &val_internal, val); if(err) { pcilib_error("#E pcilib_set_value_from_pyobject, (error %i)", err); @@ -339,7 +338,7 @@ void pcilib_pylist_append(PyObject* list, PyObject* value) void add_pcilib_value_to_dict(PyObject* dict, pcilib_value_t* val, const char *name) { - PyObject *py_val = (PyObject*)pcilib_get_value_as_pyobject(__ctx, val); + PyObject *py_val = (PyObject*)pcilib_get_value_as_pyobject(__ctx, val, NULL); if(py_val) pcilib_pydict_set_item(dict, -- cgit v1.2.3