/* * bmm_lib.h * * Buffer Management Module * * User level BMM Defines/Globals/Functions * * Li Li (lea.li@marvell.com) *(C) Copyright 2007 Marvell International Ltd. * All Rights Reserved */ #if !defined (__BMM_LIB_H__) #define __BMM_LIB_H__ /* ioctl arguments: memory attributes */ #define BMM_ATTR_DEFAULT (0) /* cacheable bufferable */ #define BMM_ATTR_WRITECOMBINE (1 << 0) /* non-cacheable & bufferable */ #define BMM_ATTR_NONCACHED (1 << 1) /* non-cacheable & non-bufferable */ /* Note: extra attributes below are not supported yet! */ #define BMM_ATTR_HUGE_PAGE (1 << 2) /* 64KB page size */ #define BMM_ATTR_WRITETHROUGH (1 << 3) /* implies L1 Cacheable */ #define BMM_ATTR_L2_CACHEABLE (1 << 4) /* implies L1 Cacheable */ /* obsolete */ #define BMM_ATTR_NONBUFFERABLE (1 << 5) /* non-bufferable */ #define BMM_ATTR_NONCACHEABLE (1 << 6) /* non-cacheable */ /* ioctl arguments: cache flush direction */ #define BMM_DMA_BIDIRECTIONAL (0) /* DMA_BIDIRECTIONAL */ #define BMM_DMA_TO_DEVICE (1) /* DMA_TO_DEVICE */ #define BMM_DMA_FROM_DEVICE (2) /* DMA_FROM_DEVICE */ #define BMM_DMA_NONE (3) /* DMA_NONE */ #if defined (__cplusplus) extern "C" { #endif int bmm_init(void); void bmm_exit(void); int bmm_dmabuf_alloc(unsigned long size, int attr, unsigned align); void *bmm_dmabuf_map(int fd, unsigned offset, unsigned size); void bmm_dmabuf_unmap(void *addr); int bmm_dmabuf_flush(int fd, void *addr, unsigned offset, unsigned size, unsigned direction); int bmm_dmabuf_fd(void *addr); void bmm_dmabuf_free(int fd); #if defined (__cplusplus) } #endif #endif /* __BMM_LIB_H__ */