Esempio n. 1
0
File: fd.c Progetto: huangrui/Thunix
/* debug fd write */
void Debug_wr(void)
{
        char str[512 * 10] = "hello word! This is just a floppy writing test";
	char *buf = (char *)0x800000;
	memcpy(buf, str, sizeof(str));

	LOG("STRING addr: %p\n", str);

        floppy_write(0, str);
	floppy_writes(0, buf, 10);
	LOG("interrupts happens %d times\n", times);
}
Esempio n. 2
0
File: fd.c Progetto: huangrui/Thunix
int floppy_writes(int sector, void *buf, unsigned int sectors)
{
	int res = 0;

	while (sectors--) {
		res = floppy_write(sector++, buf);
		if (res < 0)
			break;
		buf += 512;
	}

	return res;
}
Esempio n. 3
0
int main()
{
    unsigned k = 0;
    BYTE     buffer[512];
    unsigned long long start_time;

    fd32_event_init();
    if (fdc_setup(drive_detected) < 0) return -1;
    atexit(dispose);

    printf("Going to write some data in all sectors...\n");
    getchar();
    start_time = uclock();
    do
    {
        memset(buffer, k, sizeof(buffer));
        int res = floppy_write(&drive0, k, 1, buffer);
        if (res == FDC_NODISK) break;
        else if (res < 0) printf("Error on block %u\n", k);
        if (k % (drive0.fdd->fmt->sec_per_trk * drive0.fdd->fmt->heads) == 0)
            printf("%llu: block %u written\n", uclock() * 1000 / UCLOCKS_PER_SEC, k);
    }
    while (++k < drive0.fdd->fmt->size);
    printf("Write test elapsed in %llu ms\n", (uclock() - start_time) * 1000 / UCLOCKS_PER_SEC);
    puts("Going to read data from all sectors...\n");
    getchar();
    k = 0;
    start_time = uclock();
    do
    {
        BYTE check[512];
        memset(check, k, sizeof(check));
        int res = floppy_read(&drive0, k, 1, buffer);
        if (res == FDC_NODISK) break;
        else if (res < 0) printf("Error on block %u\n", k);
        if (k % (drive0.fdd->fmt->sec_per_trk * drive0.fdd->fmt->heads) == 0)
            printf("%llu: block %u read\n", uclock() * 1000 / UCLOCKS_PER_SEC, k);
        if (memcmp(buffer, check, sizeof(buffer)))
            printf("Block %u MISMATCH!\n", k);
    }
    while (++k < drive0.fdd->fmt->size);
    printf("Read test elapsed in %llu ms\n", (uclock() - start_time) * 1000 / UCLOCKS_PER_SEC);
    printf("All tests completed.\n");
    return 0;
}
Esempio n. 4
0
static void wd_floppy_write()
{
	floppy_write(wd.dsr);
	wd.crc = crc_add(wd.crc, wd.dsr);
}