Search
lxdream.org :: lxdream/test/testide.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename test/testide.c
changeset 258:8864fae65928
prev252:cfd0ec3bfeec
next263:6f641270b2aa
author nkeynes
date Wed Jan 03 09:00:17 2007 +0000 (17 years ago)
permissions -rw-r--r--
last change Adjust timers when they're read rather than waiting until the next time
slice. Also temporarily cut the CPU time by 4.
Initialize the FRQCR register to 0x0E0A for convenience
file annotate diff log raw
1.1 --- a/test/testide.c Thu Dec 21 10:14:24 2006 +0000
1.2 +++ b/test/testide.c Wed Jan 03 09:00:17 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: testide.c,v 1.4 2006-12-21 10:14:24 nkeynes Exp $
1.6 + * $Id: testide.c,v 1.5 2006-12-29 00:23:16 nkeynes Exp $
1.7 *
1.8 * IDE interface test cases. Covers all (known) IDE registers in the
1.9 * 5F7000 - 5F74FF range including DMA, but does not cover any GD-Rom
1.10 @@ -377,7 +377,6 @@
1.11 byte_write( IDE_COUNT, 0x0B );
1.12 byte_write( IDE_COMMAND, 0xEF );
1.13 EXPECT_READY();
1.14 - CHECK_INTRQ_CLEAR();
1.15 CHECK_REGS( post_set_feature_regs );
1.16
1.17 /** Set Multi-word DMA mode 2 */
1.18 @@ -450,6 +449,8 @@
1.19 return 0;
1.20 }
1.21
1.22 +
1.23 +
1.24 /**
1.25 * Test DMA transfer (using the Inquiry packet comand)
1.26 */
1.27 @@ -477,6 +478,41 @@
1.28 return 0;
1.29 }
1.30
1.31 +int test_read_pio()
1.32 +{
1.33 + int i,j;
1.34 + char cmd[12] = {0x30, 0x28, 0, 0x2E, 0x4C, 0, 0, 0, 0, 0, 7, 0 };
1.35 + uint32_t read_pio_ready_regs[] =
1.36 + { IDE_ALTSTATUS, 0x58,
1.37 + IDE_ERROR, 0x00,
1.38 + IDE_COUNT, 0x02,
1.39 + IDE_LBA1, 0x00,
1.40 + IDE_LBA2, 0x08,
1.41 + IDE_DEVICE, 0,
1.42 + IDE_STATUS, 0x58, 0, 0 };
1.43 +
1.44 + if( send_packet_command(cmd) != 0 ) {
1.45 + return -1;
1.46 + }
1.47 +
1.48 + for( j=0; j<7; j++ ) {
1.49 + CHECK_REGS(read_pio_ready_regs);
1.50 + CHECK_INTRQ_CLEAR();
1.51 + for( i=0; i<0x0800; i+=2 ) {
1.52 + word_read(IDE_DATA); // throw away for now.
1.53 + }
1.54 +
1.55 + EXPECT_INTRQ();
1.56 + EXPECT_READY();
1.57 + }
1.58 +
1.59 + read_pio_ready_regs[1] = 0x50;
1.60 + read_pio_ready_regs[5] = 0x03;
1.61 + read_pio_ready_regs[13] = 0x50;
1.62 + CHECK_REGS( read_pio_ready_regs );
1.63 + return 0;
1.64 +}
1.65 +
1.66 /**
1.67 * Test interaction of Read CD (0x30) with Status (0x40,1)
1.68 */
1.69 @@ -519,7 +555,7 @@
1.70 typedef int (*test_func_t)();
1.71
1.72 test_func_t test_fns[] = { test_enable, test_reset, test_packet,
1.73 - test_dma, test_dma_abort,
1.74 + test_dma, test_dma_abort, test_read_pio,
1.75 test_read_toc,
1.76 test_status1, NULL };
1.77
.