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] - Rev 55

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

 
#ifndef _MEMORY_H_
#define _MEMORY_H_
 
//-----------------------------------------------------------------------------
 
struct address_t {
 
    size_t physical_address;
    void  *virtual_address;
    size_t size;
 
};
 
//-----------------------------------------------------------------------------
 
struct mem_t {
 
    struct list_head list;
    dma_addr_t dma_handle;
    void  *cpu_addr;
    size_t size;
 
};
 
//-----------------------------------------------------------------------------
 
struct dma_channel {
    int                     m_Number;
    int                     m_Use;
    struct pci_dev         *m_pci;
    spinlock_t              m_MemListLock;
    atomic_t                m_MemListCount;
    struct list_head        m_MemList;
    struct mem_t            m_MemStub;
};
 
//-----------------------------------------------------------------------------
 
typedef struct _SHARED_PHYSMEMORY_DESCRIPTION {
    void                    *PhysAddress;   // OUT - user memory address
    void                    *KernAddress;   // OUT - user memory address
    void                    *UserAddress;   // OUT - user memory address
} SHARED_PHYSMEMORY_DESCRIPTION, *PSHARED_PHYSMEMORY_DESCRIPTION;
 
//-----------------------------------------------------------------------------
 
typedef struct _SHARED_MEMORY_DESCRIPTION {
 
        void*           SystemAddress;  // адрес блока памяти выделенного в пространстве ядра
        dma_addr_t      LogicalAddress; // физический адрес блока памяти выделенного в пространстве ядра
        struct page**   LockedPages;    // указатели на страницы блока памяти выделенного в пространстве пользователя
        size_t          PageCount;      // количество страниц составляющи блок памяти выделенный в пространстве пользователя
 
} SHARED_MEMORY_DESCRIPTION, *PSHARED_MEMORY_DESCRIPTION;
 
//-----------------------------------------------------------------------------
 
struct pex_device;
struct memory_block;
struct CDmaChannel;
 
//-----------------------------------------------------------------------------
 
int lock_pages( void *va, u32 size );
int unlock_pages( void *va, u32 size );
void* allocate_memory_block(struct pex_device *brd, size_t block_size, dma_addr_t *dma_addr);
int free_memory_block(struct pex_device *brd, struct memory_block mb);
int lock_user_memory( SHARED_MEMORY_DESCRIPTION *MemDscr, void* userSpaceAddress, size_t userSpaceSize );
int unlock_user_memory( SHARED_MEMORY_DESCRIPTION *MemDscr );
 
//--------------------------------------------------------------------
 
#endif //_MEMORY_H_
 

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

powered by: WebSVN 2.1.0

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