event.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef _PCILIB_EVENT_H
  2. #define _PCILIB_EVENT_H
  3. #include "pcilib.h"
  4. /*
  5. * get_data: This call is used by get_data and copy_data functions of public
  6. * interface. When copy_data is the caller, the data parameter will be passed.
  7. * Therefore, depending on data the parameter, the function should behave
  8. * diferently. If get get_data function is used (buf == NULL), the caller is
  9. * expected to call return_data afterwards. Otherwise, if buf != NULL and
  10. * copy_data is used, the return call will not be executed.
  11. * Still, the get_data function is not obliged to return the data in the
  12. * passed buf, but a reference to the staticaly allocated memory may be
  13. * returned instead. The copy can be managed by the envelope function.
  14. */
  15. struct pcilib_event_api_description_s {
  16. const char *title;
  17. pcilib_context_t *(*init)(pcilib_t *ctx);
  18. void (*free)(pcilib_context_t *ctx);
  19. pcilib_dma_context_t *(*init_dma)(pcilib_context_t *ctx);
  20. int (*reset)(pcilib_context_t *ctx);
  21. int (*start)(pcilib_context_t *ctx, pcilib_event_t event_mask, pcilib_event_flags_t flags);
  22. int (*stop)(pcilib_context_t *ctx, pcilib_event_flags_t flags);
  23. int (*trigger)(pcilib_context_t *ctx, pcilib_event_t event, size_t trigger_size, void *trigger_data);
  24. int (*stream)(pcilib_context_t *ctx, pcilib_event_callback_t callback, void *user);
  25. int (*next_event)(pcilib_context_t *ctx, pcilib_timeout_t timeout, pcilib_event_id_t *evid, size_t info_size, pcilib_event_info_t *info);
  26. int (*get_data)(pcilib_context_t *ctx, pcilib_event_id_t event_id, pcilib_event_data_type_t data_type, size_t arg_size, void *arg, size_t *size, void **data);
  27. int (*return_data)(pcilib_context_t *ctx, pcilib_event_id_t event_id, pcilib_event_data_type_t data_type, void *data);
  28. };
  29. typedef struct {
  30. size_t max_events;
  31. pcilib_timeout_t duration;
  32. } pcilib_autostop_parameters_t;
  33. typedef struct {
  34. pcilib_event_rawdata_callback_t callback;
  35. void *user;
  36. } pcilib_rawdata_parameters_t;
  37. typedef struct {
  38. size_t max_threads;
  39. } pcilib_parallel_parameters_t;
  40. typedef struct {
  41. pcilib_autostop_parameters_t autostop;
  42. pcilib_rawdata_parameters_t rawdata;
  43. pcilib_parallel_parameters_t parallel;
  44. } pcilib_event_parameters_t;
  45. struct pcilib_event_context_s {
  46. pcilib_event_parameters_t params;
  47. pcilib_t *pcilib;
  48. };
  49. int pcilib_init_event_engine(pcilib_t *ctx);
  50. #endif /* _PCILIB_EVENT_H */