/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 pci.c

  • 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:
47
47
//    size_t data_size;
48
48
    
49
49
 
 
50
    pcilib_model_description_t *model_info;
 
51
    
50
52
    pcilib_dma_context_t *dma_ctx;
51
 
    
52
 
    pcilib_event_context_t *event_ctx;
 
53
    pcilib_context_t *event_ctx;
53
54
    
54
55
#ifdef PCILIB_FILE_IO
55
56
    int file_io_handle;
93
94
        ctx->model = model;
94
95
 
95
96
        if (!model) model = pcilib_get_model(ctx);
 
97
        
 
98
        ctx->model_info = pcilib_model + model;
 
99
        
96
100
        api = pcilib_model[model].event_api;
97
101
        if ((api)&&(api->init)) ctx->event_ctx = api->init(ctx);
98
102
    }
100
104
    return ctx;
101
105
}
102
106
 
 
107
pcilib_model_description_t *pcilib_get_model_description(pcilib_t *ctx) {
 
108
    return ctx->model_info;
 
109
}
 
110
 
103
111
const pcilib_board_info_t *pcilib_get_board_info(pcilib_t *ctx) {
104
112
    int ret;
105
113
    
116
124
    return &ctx->board_info;
117
125
}
118
126
 
119
 
const pcilib_dma_info_t *pcilib_get_dma_info(pcilib_t *ctx) {
120
 
    if (!ctx->dma_ctx) {
121
 
        pcilib_model_t model = pcilib_get_model(ctx);
122
 
        pcilib_dma_api_description_t *api = pcilib_model[model].dma_api;
123
 
        if ((api)&&(api->init)) ctx->dma_ctx = api->init(ctx);
124
 
        
125
 
        if (!ctx->dma_ctx) return NULL;
126
 
    }
127
 
    
128
 
    return &ctx->dma_info;
129
 
}
130
 
 
131
127
pcilib_context_t *pcilib_get_implementation_context(pcilib_t *ctx) {
132
128
    return ctx->event_ctx;
133
129
}
507
503
    return NULL;
508
504
}
509
505
 
 
506
const pcilib_dma_info_t *pcilib_get_dma_info(pcilib_t *ctx) {
 
507
    if (!ctx->dma_ctx) {
 
508
        pcilib_model_t model = pcilib_get_model(ctx);
 
509
        pcilib_dma_api_description_t *api = pcilib_model[model].dma_api;
 
510
        
 
511
        if ((api)&&(api->init)) {
 
512
            pcilib_map_register_space(ctx);
 
513
            ctx->dma_ctx = api->init(ctx);
 
514
        }
 
515
        
 
516
        if (!ctx->dma_ctx) return NULL;
 
517
    }
 
518
    
 
519
    return &ctx->dma_info;
 
520
}
 
521
 
 
522
int pcilib_set_dma_engine_description(pcilib_t *ctx, pcilib_dma_t engine, pcilib_dma_engine_description_t *desc) {
 
523
    ctx->dma_info.engines[engine] = desc;
 
524
}
 
525
 
510
526
char *pcilib_resolve_data_space(pcilib_t *ctx, uintptr_t addr, size_t *size) {
511
527
    int err;
512
528