int iop_heap_dma_upload(void *src,u32 dst,int size) { int i=0,len=0,size2; u8 *pkt; int ret=0; int ret2=0; int p=0; int cont1=0; while(size>0) // send data with src unaligned { if(size>512) size2=512; else size2=size; CD_memcpy2(memsend,((unsigned char *) src)+p,size2); do { FlushCache(0); /* build packet */ pkt = send_buffer2; PUSHDATA( u32, pkt, (u32)memsend, i); pkt += i; len += i; PUSHDATA( u32, pkt, dst, i); pkt += i; len += i; PUSHDATA( int, pkt, size2, i); pkt += i; len += i; PUSHDATA( int, pkt, 0, i); pkt += i; len += i; ret = SifSetDma((SifDmaTransfer_t*)send_buffer2,1); if(ret==0) {nopdelay();cont1++;} if(ret==0 && cont1>=3) {cont1=0;SifSetDChain();} }while(ret==0); // modificado por Hermes while((ret2 = SifDmaStat(ret))>=0); FlushCache(0); size-=size2; p+=size2; dst+=size2; } return (ret2 < -1); }
inline void push_thread_func() { int i = 0; node_t* p_root; node_t* p_push; node_t* p_tmp, *tmp; arc_t* p_arc; arc_t* p_stop_arcs; long p_nr_group; while (1) { while (!inter_push_flag); if (inter_push_flag==1) { p_arc = g_arc; p_stop_arcs = g_stop_arcs; p_nr_group = g_nr_group; for (i = 0 ; i < 5 && p_arc < p_stop_arcs; i++ , p_arc += p_nr_group); for (; p_arc < p_stop_arcs; p_arc += p_nr_group) { PUSHDATA(p_arc->head); PUSHDATA(p_arc->tail); } } else { if (inter_push_flag==2) { p_root = g_root; p_tmp = p_push = p_root->child; while ( p_push!=p_root) { for (i=0; i<LOOKAHEAD && (p_push != p_root); i++) { while (p_push) { p_tmp = p_push; p_push = p_push->child; } p_push = p_tmp; while (p_push->pred) { p_tmp = p_push->sibling; if (p_tmp) { p_push = p_tmp; break; } else { p_push = p_push->pred; } } } for (i=0; i<STRIDE && (p_push != p_root); i++) { while (p_push) { PUSHDATA(&(p_push->basic_arc->cost)); p_tmp = p_push; p_push = p_push->child; } p_push = p_tmp; while (p_push->pred) { p_tmp = p_push->sibling; if (p_tmp) { p_push = p_tmp; break; } else { p_push = p_push->pred; } } } } } } inter_push_flag = 0; } }