/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 dma/nwl_engine_buffers.h

  • Committer: Suren A. Chilingaryan
  • Date: 2011-10-23 01:17:19 UTC
  • Revision ID: csa@dside.dyndns.org-20111023011719-690ioo0e9jodpey3
Sync only required buffers

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
#define NWL_RING_SET(data, offset, val)  *(uint32_t*)(((char*)(data)) + (offset)) = (val)
3
3
#define NWL_RING_UPDATE(data, offset, mask, val) *(uint32_t*)(((char*)(data)) + (offset)) = ((*(uint32_t*)(((char*)(data)) + (offset)))&(mask))|(val)
4
4
 
5
 
int dma_nwl_sync_buffers(nwl_dma_t *ctx, pcilib_nwl_engine_description_t *info, pcilib_kmem_handle_t *kmem) {
6
 
    switch (info->desc.direction) {
7
 
     case PCILIB_DMA_FROM_DEVICE:
8
 
        return pcilib_sync_kernel_memory(ctx->pcilib, kmem, PCILIB_KMEM_SYNC_FROMDEVICE);
9
 
     case PCILIB_DMA_TO_DEVICE:
10
 
        return pcilib_sync_kernel_memory(ctx->pcilib, kmem, PCILIB_KMEM_SYNC_TODEVICE);
11
 
    }
12
 
    
13
 
    return 0;
14
 
}
15
 
 
16
5
static int dma_nwl_compute_read_s2c_pointers(nwl_dma_t *ctx, pcilib_nwl_engine_description_t *info, unsigned char *ring, uint32_t ring_pa) {
17
6
    size_t pos;
18
7
    uint32_t val;
109
98
    pcilib_kmem_handle_t *ring = pcilib_alloc_kernel_memory(ctx->pcilib, PCILIB_KMEM_TYPE_CONSISTENT, 1, PCILIB_NWL_DMA_PAGES * PCILIB_NWL_DMA_DESCRIPTOR_SIZE, PCILIB_NWL_ALIGNMENT, PCILIB_KMEM_USE(PCILIB_KMEM_USE_DMA_RING, sub_use), flags);
110
99
    pcilib_kmem_handle_t *pages = pcilib_alloc_kernel_memory(ctx->pcilib, type, PCILIB_NWL_DMA_PAGES, 0, 0, PCILIB_KMEM_USE(PCILIB_KMEM_USE_DMA_PAGES, sub_use), flags);
111
100
 
112
 
//    if ((ring)&&(pages)) err = dma_nwl_sync_buffers(ctx, info, pages);
113
 
//    else err = PCILIB_ERROR_FAILED;
114
 
 
115
101
    if (err) {
116
102
        if (pages) pcilib_free_kernel_memory(ctx->pcilib, pages, 0);
117
103
        if (ring) pcilib_free_kernel_memory(ctx->pcilib, ring, 0);