/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: root
  • Date: 2011-06-17 21:40:33 UTC
  • Revision ID: root@iss-tomyspiel-l-20110617214033-np5x6881odzlfgmg
Enumerate DMA engines

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
#define _PCITOOL_PCILIB_H
3
3
 
4
4
#define PCILIB_MAX_BANKS 6
 
5
#define PCILIB_MAX_DMA_ENGINES 32
5
6
 
6
7
#include <time.h>
7
8
#include <stdint.h>
18
19
 
19
20
typedef struct pcilib_s pcilib_t;
20
21
typedef void pcilib_context_t;
 
22
typedef void pcilib_dma_context_t;
21
23
 
22
24
typedef uint8_t pcilib_bar_t;                   /**< Type holding the PCI Bar number */
23
25
typedef uint8_t pcilib_register_t;              /**< Type holding the register ID within the Bank */
71
73
#define PCILIB_REGISTER_BANK1           1
72
74
#define PCILIB_REGISTER_BANK2           2
73
75
#define PCILIB_REGISTER_BANK3           3
 
76
#define PCILIB_REGISTER_BANK_DMA        128
74
77
#define PCILIB_EVENT0                   1
75
78
#define PCILIB_EVENT1                   2
76
79
#define PCILIB_EVENT2                   4
139
142
 
140
143
typedef enum {
141
144
    PCILIB_DMA_TYPE_BLOCK,
142
 
    PCILIB_DMA_TYPE_PACKET
 
145
    PCILIB_DMA_TYPE_PACKET,
 
146
    PCILIB_DMA_TYPE_UNKNOWN
143
147
} pcilib_dma_type_t;
144
148
 
145
149
typedef struct {
146
150
    pcilib_dma_addr_t addr;
147
151
    pcilib_dma_type_t type;
148
152
    pcilib_dma_direction_t direction;
149
 
    size_t max_bytes;
 
153
    size_t addr_bits;
150
154
} pcilib_dma_engine_description_t;
151
155
 
152
156
typedef struct {
153
 
    pcilib_dma_engine_description_t **engines;
 
157
    pcilib_dma_engine_description_t *engines[PCILIB_MAX_DMA_ENGINES +  1];
154
158
} pcilib_dma_info_t;
155
159
 
156
160
typedef int (*pcilib_callback_t)(pcilib_event_t event, pcilib_event_id_t event_id, void *user);
198
202
int pcilib_set_error_handler(void (*err)(const char *msg, ...), void (*warn)(const char *msg, ...));
199
203
 
200
204
pcilib_model_t pcilib_get_model(pcilib_t *ctx);
 
205
pcilib_model_description_t *pcilib_get_model_description(pcilib_t *ctx);
201
206
pcilib_context_t *pcilib_get_implementation_context(pcilib_t *ctx);
202
207
 
203
208
pcilib_t *pcilib_open(const char *device, pcilib_model_t model);
205
210
 
206
211
void *pcilib_map_bar(pcilib_t *ctx, pcilib_bar_t bar);
207
212
void pcilib_unmap_bar(pcilib_t *ctx, pcilib_bar_t bar, void *data);
208
 
char *pcilib_resolve_register_address(pcilib_t *ctx, pcilib_bar_t bar, uintptr_t addr);
 
213
char *pcilib_resolve_register_address(pcilib_t *ctx, pcilib_bar_t bar, uintptr_t addr); // addr is offset if bar is specified
209
214
char *pcilib_resolve_data_space(pcilib_t *ctx, uintptr_t addr, size_t *size);
210
215
 
211
216
pcilib_register_bank_t pcilib_find_bank_by_addr(pcilib_t *ctx, pcilib_register_bank_addr_t bank);