/* This is a wrapper function for consistent dma-able Memory allocation routine. In linux Kernel, it depends on pci dev structure  */
void* plat_alloc_consistent_dmaable_memory(synopGMACdevice *pcidev, u32 size, u32 *addr)
/* This is a wrapper function for consistent dma-able Memory allocation routine. In linux Kernel, it depends on pci dev structure  */
void* plat_alloc_consistent_dmaable_memory(synopGMACdevice *pcidev, u32 size, u32 *addr)
{
    void *buf;
    buf = (void*)rt_malloc((u32)(size+16));
    unsigned long i = (unsigned long)buf;
    if(i%16 == 8){
        i += 8;
    }
    else if(i%16 == 4){
        i += 12;
    }
    else if(i%16 == 12){
        i += 4;
    }
    flush_cache(i, size);
    *addr =gmac_dmamap(i, size);
    buf = (unsigned char *)CACHED_TO_UNCACHED(i);
    return buf;
}