/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 pcilib.h

  • Committer: Suren A. Chilingaryan
  • Date: 2011-10-26 05:12:31 UTC
  • Revision ID: csa@dside.dyndns.org-20111026051231-5ntkozz31hvjzvb5
Improvements of DMA engine

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
typedef struct pcilib_s pcilib_t;
13
13
typedef void pcilib_context_t;
14
 
typedef void pcilib_dma_context_t;
 
14
typedef struct pcilib_dma_context_s pcilib_dma_context_t;
 
15
 
15
16
 
16
17
typedef struct pcilib_dma_api_description_s pcilib_dma_api_description_t;
17
18
typedef struct pcilib_event_api_description_s pcilib_event_api_description_t;
63
64
 
64
65
typedef enum {
65
66
    PCILIB_DMA_FLAGS_DEFAULT = 0,
66
 
    PCILIB_DMA_FLAG_EOP = 1,
67
 
    PCILIB_DMA_FLAG_WAIT = 2,
68
 
    PCILIB_DMA_FLAG_PERSISTENT = 4
 
67
    PCILIB_DMA_FLAG_EOP = 1,            /**< last buffer of the packet */
 
68
    PCILIB_DMA_FLAG_WAIT = 2,           /**< wait completion of write operation / wait for data during read operation */
 
69
    PCILIB_DMA_FLAG_MULTIPACKET = 4,    /**< read multiple packets */
 
70
    PCILIB_DMA_FLAG_PERSISTENT = 8,     /**< do not stop DMA engine on application termination / permanently close DMA engine on dma_stop */
 
71
    PCILIB_DMA_FLAG_IGNORE_ERRORS = 16  /**< do not crash on errors, but return appropriate error codes */
69
72
} pcilib_dma_flags_t;
70
73
 
71
74
typedef enum {
102
105
#define PCILIB_TIMEOUT_TRIGGER          0
103
106
#define PCILIB_IRQ_SOURCE_DEFAULT       0
104
107
 
105
 
typedef int (*pcilib_dma_callback_t)(void *ctx, pcilib_dma_flags_t flags, size_t bufsize, void *buf);
 
108
/**<
 
109
 * Callback function called when new data is read by DMA streaming function
 
110
 * @ctx - DMA Engine context
 
111
 * @flags - DMA Flags
 
112
 * @bufsize - size of data in bytes
 
113
 * @buf - data
 
114
 * @returns 
 
115
 * <0 - error, stop streaming (the value is negative error code)
 
116
 *  0 - stop streaming
 
117
 *  1 - wait & read next buffer, fail if no data
 
118
 *  2 - wait & read next buffer, but don't fail if timeout expired
 
119
 *  3 - read next buffer if available (don't wait), don't fail
 
120
 */
 
121
typedef int (*pcilib_dma_callback_t)(void *ctx, pcilib_dma_flags_t flags, size_t bufsize, void *buf); 
106
122
typedef int (*pcilib_event_callback_t)(pcilib_event_t event, pcilib_event_id_t event_id, void *user);
107
123
 
108
124
typedef struct {
237
253
int pcilib_stream_dma(pcilib_t *ctx, pcilib_dma_engine_t dma, uintptr_t addr, size_t size, pcilib_dma_flags_t flags, pcilib_timeout_t timeout, pcilib_dma_callback_t cb, void *cbattr);
238
254
int pcilib_push_dma(pcilib_t *ctx, pcilib_dma_engine_t dma, uintptr_t addr, size_t size, pcilib_dma_flags_t flags, pcilib_timeout_t timeout, void *buf, size_t *written_bytes);
239
255
int pcilib_read_dma(pcilib_t *ctx, pcilib_dma_engine_t dma, uintptr_t addr, size_t size, void *buf, size_t *read_bytes);
 
256
int pcilib_read_dma_custom(pcilib_t *ctx, pcilib_dma_engine_t dma, uintptr_t addr, size_t size, pcilib_dma_flags_t flags, pcilib_timeout_t timeout, void *buf, size_t *read_bytes);
240
257
int pcilib_write_dma(pcilib_t *ctx, pcilib_dma_engine_t dma, uintptr_t addr, size_t size, void *buf, size_t *written_bytes);
241
258
double pcilib_benchmark_dma(pcilib_t *ctx, pcilib_dma_engine_addr_t dma, uintptr_t addr, size_t size, size_t iterations, pcilib_dma_direction_t direction);
242
259