event.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. pcilib_context_t *(*init)(pcilib_t *ctx);
  17. void (*free)(pcilib_context_t *ctx);
  18. int (*reset)(pcilib_context_t *ctx);
  19. int (*start)(pcilib_context_t *ctx, pcilib_event_t event_mask, pcilib_event_flags_t flags);
  20. int (*stop)(pcilib_context_t *ctx, pcilib_event_flags_t flags);
  21. int (*trigger)(pcilib_context_t *ctx, pcilib_event_t event, size_t trigger_size, void *trigger_data);
  22. int (*stream)(pcilib_context_t *ctx, pcilib_event_callback_t callback, void *user);
  23. 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);
  24. 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);
  25. int (*return_data)(pcilib_context_t *ctx, pcilib_event_id_t event_id, pcilib_event_data_type_t data_type, void *data);
  26. pcilib_dma_context_t *(*init_dma)(pcilib_context_t *ctx);
  27. };
  28. typedef struct {
  29. size_t max_events;
  30. pcilib_timeout_t duration;
  31. } pcilib_autostop_parameters_t;
  32. typedef struct {
  33. pcilib_event_rawdata_callback_t callback;
  34. void *user;
  35. } pcilib_rawdata_parameters_t;
  36. typedef struct {
  37. pcilib_autostop_parameters_t autostop;
  38. pcilib_rawdata_parameters_t rawdata;
  39. } pcilib_event_parameters_t;
  40. struct pcilib_event_context_s {
  41. pcilib_event_parameters_t params;
  42. pcilib_t *pcilib;
  43. };
  44. int pcilib_init_event_engine(pcilib_t *ctx);
  45. #endif /* _PCILIB_EVENT_H */