Exemple #1
0
void calculate_speed(void* dst, u32 len, u32 *speed)
{
	tb_t start, end;
	mftb(&start);
	device_frag_read(dst, len, 0);
	mftb(&end);
	*speed = tb_diff_usec(&end, &start);
}
Exemple #2
0
void dvd_read_patched_section() {
	// Check if this read offset+size lies in our patched area, if so, we write a 0xE000 cmd to the drive and read from SDGecko.
	volatile unsigned long* dvd = (volatile unsigned long*)0xCC006000;
	u32 dst = dvd[5];
	u32 len = dvd[4];
	u32 offset = (dvd[3]<<2);
	int ret = 0;

#ifdef DEBUG
	usb_sendbuffer_safe("New Read: ",10);
	print_read((void*)dst,len,offset);
#endif

	// If it doesn't let the value about to be passed to the DVD drive be DVD_DMA | DVD_START
	if((ret=is_frag_read(offset, len))) {
#ifdef DEBUG
		if(ret == 2) {
			usb_sendbuffer_safe("SPLIT FRAG\r\n",12);
		}
		usb_sendbuffer_safe("FRAG READ!\r\n",12);
#endif
		device_frag_read((void*)(dst | 0x80000000), len, offset);
		dcache_flush_icache_inv((void*)(dst | 0x80000000), len);
		dvd[3] = 0;
		dvd[4] = 0x20;
		dvd[5] = 0;
		dvd[6] = 0x20;
		dvd[7] = 3;
	}
	else {
#ifdef DEBUG
		usb_sendbuffer_safe("NORM READ!\r\n",12);
#endif
		dvd[7] = 3;	// DVD_DMA | DVD_START
	}
}