OpenCores
URL https://opencores.org/ocsvn/pcie_ds_dma/pcie_ds_dma/trunk

Subversion Repositories pcie_ds_dma

[/] [pcie_ds_dma/] [trunk/] [soft/] [linux/] [driver/] [pexdrv/] [memory.h] - Blame information for rev 55

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 7 v.karak
 
2
#ifndef _MEMORY_H_
3
#define _MEMORY_H_
4
 
5
//-----------------------------------------------------------------------------
6
 
7
struct address_t {
8
 
9
    size_t physical_address;
10
    void  *virtual_address;
11
    size_t size;
12
 
13
};
14
 
15
//-----------------------------------------------------------------------------
16
 
17
struct mem_t {
18
 
19
    struct list_head list;
20
    dma_addr_t dma_handle;
21
    void  *cpu_addr;
22
    size_t size;
23
 
24
};
25
 
26
//-----------------------------------------------------------------------------
27
 
28
struct dma_channel {
29
    int                     m_Number;
30
    int                     m_Use;
31
    struct pci_dev         *m_pci;
32
    spinlock_t              m_MemListLock;
33
    atomic_t                m_MemListCount;
34
    struct list_head        m_MemList;
35
    struct mem_t            m_MemStub;
36
};
37
 
38
//-----------------------------------------------------------------------------
39 54 v.karak
 
40
typedef struct _SHARED_PHYSMEMORY_DESCRIPTION {
41
    void                    *PhysAddress;   // OUT - user memory address
42
    void                    *KernAddress;   // OUT - user memory address
43
    void                    *UserAddress;   // OUT - user memory address
44
} SHARED_PHYSMEMORY_DESCRIPTION, *PSHARED_PHYSMEMORY_DESCRIPTION;
45
 
46
//-----------------------------------------------------------------------------
47
 
48
typedef struct _SHARED_MEMORY_DESCRIPTION {
49
 
50
        void*           SystemAddress;  // адрес блока памяти выделенного в пространстве ядра
51
        dma_addr_t      LogicalAddress; // физический адрес блока памяти выделенного в пространстве ядра
52
        struct page**   LockedPages;    // указатели на страницы блока памяти выделенного в пространстве пользователя
53
        size_t          PageCount;      // количество страниц составляющи блок памяти выделенный в пространстве пользователя
54
 
55
} SHARED_MEMORY_DESCRIPTION, *PSHARED_MEMORY_DESCRIPTION;
56
 
57
//-----------------------------------------------------------------------------
58
 
59 7 v.karak
struct pex_device;
60
struct memory_block;
61 54 v.karak
struct CDmaChannel;
62
 
63 7 v.karak
//-----------------------------------------------------------------------------
64
 
65
int lock_pages( void *va, u32 size );
66
int unlock_pages( void *va, u32 size );
67
void* allocate_memory_block(struct pex_device *brd, size_t block_size, dma_addr_t *dma_addr);
68
int free_memory_block(struct pex_device *brd, struct memory_block mb);
69 54 v.karak
int lock_user_memory( SHARED_MEMORY_DESCRIPTION *MemDscr, void* userSpaceAddress, size_t userSpaceSize );
70
int unlock_user_memory( SHARED_MEMORY_DESCRIPTION *MemDscr );
71 7 v.karak
 
72
//--------------------------------------------------------------------
73
 
74
#endif //_MEMORY_H_

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.