/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool
346.1.17 by Vasilii Chernov
Refactor pcipywrap to object
1
#ifndef PCIPYWRAP_H
2
#define PCIPYWRAP_H
3
4
#include "pci.h"
5
#include "error.h"
6
#include <Python.h>
7
8
typedef struct {
353 by Suren A. Chilingaryan
Merge Python scripting support from Vasiliy Chernov
9
    void* ctx;
10
    int shared;
367 by Suren A. Chilingaryan
Further improvements of Python scripting and web-interface API for register manipulations by Vasiliy Chernov
11
} pcipywrap;
346.1.17 by Vasilii Chernov
Refactor pcipywrap to object
12
13
/*!
14
 * \brief Redirect pcilib standart log stream to exeption text.
15
 * Logger will accumulate errors untill get message, starts with "#E".
16
 * After that, logger will write last error, and all accumulated errors
17
 * to Python exeption text
18
 */
346.1.30 by Vasilii Chernov
1. api-serer:
19
void redirect_logs_to_exeption();
346.1.17 by Vasilii Chernov
Refactor pcipywrap to object
20
21
/*!
22
 * \brief Wraps for pcilib_open function.
23
 * \param[in] fpga_device path to the device file [/dev/fpga0]
24
 * \param[in] model specifies the model of hardware, autodetected if NULL is passed
25
 * \return Pointer to pcilib_t, created by pcilib_open; NULL with exeption text, if failed.
26
 */
27
PyObject* create_pcilib_instance(const char *fpga_device, const char *model);
28
367 by Suren A. Chilingaryan
Further improvements of Python scripting and web-interface API for register manipulations by Vasiliy Chernov
29
pcipywrap *new_pcipywrap(const char* fpga_device, const char* model);
30
pcipywrap *create_pcipywrap(PyObject* ctx);
31
void delete_pcipywrap(pcipywrap *self);
346.1.17 by Vasilii Chernov
Refactor pcipywrap to object
32
33
/*!
34
 * \brief Reads register value. Wrap for pcilib_read_register function.
35
 * \param[in] regname the name of the register
36
 * \param[in] bank should specify the bank name if register with the same name may occur in multiple banks, NULL otherwise
37
 * \return register value, can be integer or float type; NULL with exeption text, if failed.
38
 */
367 by Suren A. Chilingaryan
Further improvements of Python scripting and web-interface API for register manipulations by Vasiliy Chernov
39
PyObject* pcipywrap_read_register(pcipywrap *self, const char *regname, const char *bank);
346.1.17 by Vasilii Chernov
Refactor pcipywrap to object
40
41
/*!
42
 * \brief Writes value to register. Wrap for pcilib_write_register function.
43
 * \param[in] val Register value, that needs to be set. Can be int, float or string.
44
 * \param[in] regname the name of the register
45
 * \param[in] bank should specify the bank name if register with the same name may occur in multiple banks, NULL otherwise
46
 * \return 1, serialized to PyObject or NULL with exeption text, if failed.
47
 */
367 by Suren A. Chilingaryan
Further improvements of Python scripting and web-interface API for register manipulations by Vasiliy Chernov
48
PyObject* pcipywrap_write_register(pcipywrap *self, PyObject* val, const char *regname, const char *bank);
346.1.17 by Vasilii Chernov
Refactor pcipywrap to object
49
50
/*!
51
 * \brief Reads propety value. Wrap for pcilib_get_property function.
52
 * \param[in] prop property name (full name including path)
53
 * \return property value, can be integer or float type; NULL with exeption text, if failed.
54
 */
367 by Suren A. Chilingaryan
Further improvements of Python scripting and web-interface API for register manipulations by Vasiliy Chernov
55
PyObject* pcipywrap_get_property(pcipywrap *self, const char *prop);
346.1.17 by Vasilii Chernov
Refactor pcipywrap to object
56
57
/*!
58
 * \brief Writes value to property. Wrap for pcilib_set_property function.
59
 * \param[in] prop property name (full name including path)
60
 * \param[in] val Property value, that needs to be set. Can be int, float or string.
61
 * \return 1, serialized to PyObject or NULL with exeption text, if failed.
62
 */
367 by Suren A. Chilingaryan
Further improvements of Python scripting and web-interface API for register manipulations by Vasiliy Chernov
63
PyObject* pcipywrap_set_property(pcipywrap *self, PyObject* val, const char *prop);
64
PyObject* pcipywrap_get_registers_list(pcipywrap *self, const char *bank);
65
PyObject* pcipywrap_get_register_info(pcipywrap *self, const char* reg,const char *bank);
66
PyObject* pcipywrap_get_property_list(pcipywrap *self, const char* branch);
67
68
PyObject* pcipywrap_read_dma(pcipywrap *self, unsigned char dma, size_t size);
69
70
PyObject* pcipywrap_lock_global(pcipywrap *self);
71
void pcipywrap_unlock_global(pcipywrap *self);
346.1.22 by Vasilii Chernov
1. Http server add tree view
72
73
/*!
74
 * \brief Wrap for pcilib_lock
346.1.33 by Vasilii Chernov
Move scripts handing code from py.c to Python wrap
75
 * \param lock_id lock identificator
346.1.22 by Vasilii Chernov
1. Http server add tree view
76
 * \warning This function should be called only under Python standart threading lock.
367 by Suren A. Chilingaryan
Further improvements of Python scripting and web-interface API for register manipulations by Vasiliy Chernov
77
 * Otherwise it will stuck with more than 1 threads. See /xml/test/test_prop4.py
346.1.22 by Vasilii Chernov
1. Http server add tree view
78
 * for example.
79
 * \return 1, serialized to PyObject or NULL with exeption text, if failed.
80
 */
367 by Suren A. Chilingaryan
Further improvements of Python scripting and web-interface API for register manipulations by Vasiliy Chernov
81
PyObject* pcipywrap_lock(pcipywrap *self, const char *lock_id);
346.1.37 by Vasilii Chernov
1. Pcipywrap: add persistent locking wrappings
82
PyObject* pcipywrap_lock_persistent(pcipywrap *self, const char *lock_id);
367 by Suren A. Chilingaryan
Further improvements of Python scripting and web-interface API for register manipulations by Vasiliy Chernov
83
PyObject* pcipywrap_try_lock(pcipywrap *self, const char *lock_id);
346.1.37 by Vasilii Chernov
1. Pcipywrap: add persistent locking wrappings
84
PyObject* pcipywrap_try_lock_persistent(pcipywrap *self, const char *lock_id);
367 by Suren A. Chilingaryan
Further improvements of Python scripting and web-interface API for register manipulations by Vasiliy Chernov
85
PyObject* pcipywrap_unlock(pcipywrap *self, const char *lock_id);
346.1.37 by Vasilii Chernov
1. Pcipywrap: add persistent locking wrappings
86
PyObject* pcipywrap_unlock_persistent(pcipywrap *self, const char *lock_id);
346.1.22 by Vasilii Chernov
1. Http server add tree view
87
346.1.17 by Vasilii Chernov
Refactor pcipywrap to object
88
#endif /* PCIPYWRAP_H */