/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to pywrap/pcipywrap.h

  • Committer: Suren A. Chilingaryan
  • Date: 2016-02-23 06:20:33 UTC
  • mfrom: (346.1.18 pcitool)
  • Revision ID: csa@suren.me-20160223062033-mz8qkpm1a2oioveb
Merge Python scripting support from Vasiliy Chernov

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 {
 
9
    void* ctx;
 
10
    int shared;
 
11
} Pcipywrap;
 
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
 */
 
19
void __redirect_logs_to_exeption();
 
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
 
 
29
Pcipywrap *new_Pcipywrap(const char* fpga_device, const char* model);
 
30
Pcipywrap *create_Pcipywrap(PyObject* ctx);
 
31
void delete_Pcipywrap(Pcipywrap *self);
 
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
 */
 
39
PyObject* Pcipywrap_read_register(Pcipywrap *self, const char *regname, const char *bank);
 
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
 */
 
48
PyObject* Pcipywrap_write_register(Pcipywrap *self, PyObject* val, const char *regname, const char *bank);
 
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
 */
 
55
PyObject* Pcipywrap_get_property(Pcipywrap *self, const char *prop);
 
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
 */
 
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
#endif /* PCIPYWRAP_H */