/*
 *   Random resource header
 *   
 *   :set tabstop=4 
 */

#ifndef __PLI_RD_RES
#define __PLI_RD_RES

#define DA_BLOCK_SIZE       1024
#define MAX_DA_SIZE         (320 * 1024)
#define MAX_DA_BLOCK_NUM    (MAX_DA_SIZE / DA_BLOCK_SIZE)

#define SD_BLOCK_SIZE       (16 * 1024)
#define MAX_SD_SIZE         (32 * 1024 * 1024)
#define MAX_SD_BLOCK_NUM    (MAX_SD_SIZE / SD_BLOCK_SIZE)

#define RD_MEM_AVAIL        255
#define RD_MEM_SYS          250

void RdSetPliBuf(int ptr, unsigned int v);
unsigned int RdGetPliBuf(int ptr);

int RdResInit();
int RdAllocLock(int lock);
int RdFreeLock(int lock);

int RdGetDaBlkNum();
int RdDaFree(int tid, unsigned int addr, int sz);
int RdDaAlloc(int tid, int reqSz, unsigned int *addr, int *sz);

int RdGetSdBlkNum();
int RdSdFree(int tid, unsigned int addr, int sz);
int RdSdAlloc(int tid, int reqSz, unsigned int *addr, int *sz, int gbaLock);

int RdAllocRes(int tid, int lock, int reqDaSz, int reqSdSz,
		unsigned int *daAddr,  unsigned int *daSz,
		unsigned int *sdAddr, unsigned int *sdSz);
int RdFreeRes(int tid, int lock, u32 daAddr, u32 daSz, u32 sdAddr, u32 sdSz);

#endif
