示例#1
0
文件: arqueue.c 项目: Antidote/libogc
static void __ARQServiceQueueLo()
{
	ARQRequest *req;

	if(!__ARQReqPendingLo) {
		req = (ARQRequest*)__lwp_queue_getI(&__ARQReqQueueLo);
		__ARQReqPendingLo = req;
	}
	
	req = __ARQReqPendingLo;
	if(req) {
		req->state = ARQ_TASK_RUNNING;
#ifdef _ARQ_DEBUG
		printf("__ARQServiceQueueLo(%02x,%08x,%08x,%d,%d)\n",req->dir,req->aram_addr,req->mram_addr,req->len,__ARQChunkSize);
#endif
		if(req->len<=__ARQChunkSize) {
			AR_StartDMA(req->dir,req->mram_addr,req->aram_addr,req->len);
			__ARQCallbackLo = __ARQReqPendingLo->callback;
		} else {
			AR_StartDMA(req->dir,req->mram_addr,req->aram_addr,__ARQChunkSize);
			__ARQReqPendingLo->len -= __ARQChunkSize;
			__ARQReqPendingLo->aram_addr += __ARQChunkSize;
			__ARQReqPendingLo->mram_addr += __ARQChunkSize;
		}
	}
}
示例#2
0
/**
 * ARAMFetch
 *
 * This function will move data from ARAM to MAIN memory
 */
void
ARAMFetch (char *dst, char *src, int len)
{
  DCInvalidateRange(dst, len);
  AR_StartDMA( ARAM_READ, (u32) dst, (u32) src, len);
  while (AR_GetDMAStatus());
}
示例#3
0
/****************************************************************************
 * ARAMPut
 *
 * Move data from MAIN memory to ARAM
 ***************************************************************************/
void
ARAMPut (char *src, char *dst, int len)
{
	DCFlushRange (src, len);
	AR_StartDMA (ARAM_WRITE, (u32) src, (u32) dst, len);
	while (AR_GetDMAStatus());
}
示例#4
0
文件: arqueue.c 项目: Antidote/libogc
void ARQ_PostRequestAsync(ARQRequest *req,u32 owner,u32 dir,u32 prio,u32 aram_addr,u32 mram_addr,u32 len,ARQCallback cb)
{
	u32 level;
	ARQRequest *p;

	req->state = ARQ_TASK_READY;
	req->dir = dir;
	req->owner = owner;
	req->aram_addr = aram_addr;
	req->mram_addr = mram_addr;
	req->len = len;
	req->prio = prio;
	req->callback = (cb==NULL) ? __ARQCallbackDummy : cb;
	
	_CPU_ISR_Disable(level);

	if(prio==ARQ_PRIO_LO) __lwp_queue_appendI(&__ARQReqQueueLo,&req->node);
	else __lwp_queue_appendI(&__ARQReqQueueHi,&req->node);

	if(!__ARQReqPendingLo && !__ARQReqPendingHi) {
		p = (ARQRequest*)__lwp_queue_getI(&__ARQReqQueueHi);
		if(p) {
			p->state = ARQ_TASK_RUNNING;
#ifdef _ARQ_DEBUG
			printf("ARQ_PostRequest(%02x,%08x,%08x,%d)\n",p->dir,p->aram_addr,p->mram_addr,p->len);
#endif
			AR_StartDMA(p->dir,p->mram_addr,p->aram_addr,p->len);
			__ARQCallbackHi = p->callback;
			__ARQReqPendingHi = p;
		}
		if(!__ARQReqPendingHi) __ARQServiceQueueLo();
	}
	_CPU_ISR_Restore(level);
}
示例#5
0
文件: arqueue.c 项目: Antidote/libogc
static __inline__ void __ARQPopTaskQueueHi()
{
	ARQRequest *req;

	req = (ARQRequest*)__lwp_queue_getI(&__ARQReqQueueHi);
	if(!req) return;

	req->state = ARQ_TASK_RUNNING;
#ifdef _ARQ_DEBUG
	printf("__ARQPopTaskQueueHi(%02x,%08x,%08x,%d)\n",req->dir,req->aram_addr,req->mram_addr,req->len);
#endif
	AR_StartDMA(req->dir,req->mram_addr,req->aram_addr,req->len);
	__ARQCallbackHi = req->callback;
	__ARQReqPendingHi = req;
}
示例#6
0
// Write Wrapper
void write_aram(char *src, char *dst, int len)
{
    AR_StartDMA(ARAM_Write, (u32)src, (u32)dst, len);
	DCFlushRange(src, len);
	while (AR_GetDMAStatus());
}