0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef __BESTCOMM_SRAM_H__
0013 #define __BESTCOMM_SRAM_H__
0014
0015 #include <asm/rheap.h>
0016 #include <asm/mmu.h>
0017 #include <linux/spinlock.h>
0018
0019
0020
0021
0022
0023
0024 struct bcom_sram {
0025 phys_addr_t base_phys;
0026 void *base_virt;
0027 unsigned int size;
0028 rh_info_t *rh;
0029 spinlock_t lock;
0030 };
0031
0032 extern struct bcom_sram *bcom_sram;
0033
0034
0035
0036 extern int bcom_sram_init(struct device_node *sram_node, char *owner);
0037 extern void bcom_sram_cleanup(void);
0038
0039 extern void* bcom_sram_alloc(int size, int align, phys_addr_t *phys);
0040 extern void bcom_sram_free(void *ptr);
0041
0042 static inline phys_addr_t bcom_sram_va2pa(void *va) {
0043 return bcom_sram->base_phys +
0044 (unsigned long)(va - bcom_sram->base_virt);
0045 }
0046
0047 static inline void *bcom_sram_pa2va(phys_addr_t pa) {
0048 return bcom_sram->base_virt +
0049 (unsigned long)(pa - bcom_sram->base_phys);
0050 }
0051
0052
0053 #endif
0054