Search
lxdream.org :: lxdream/test/ide.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename test/ide.c
changeset 243:df1671d533bf
prev185:6755a04c447f
next247:b356d391d02a
author nkeynes
date Sat Dec 16 12:37:44 2006 +0000 (13 years ago)
permissions -rw-r--r--
last change Add activation and status functions
file annotate diff log raw
1.1 --- a/test/ide.c Tue Jul 11 01:35:27 2006 +0000
1.2 +++ b/test/ide.c Sat Dec 16 12:37:44 2006 +0000
1.3 @@ -210,6 +210,7 @@
1.4 } else {
1.5 if( status&0x01 ) {
1.6 printf( "[IDE] ERROR! (%02X)\n", status );
1.7 + return -1;
1.8 } else if( (status&0x08) == 0 ) {
1.9 /* No more data */
1.10 return length;
1.11 @@ -286,8 +287,21 @@
1.12 return length;
1.13 }
1.14
1.15 +void ide_activate() {
1.16 + register unsigned long p, x;
1.17 +
1.18 + /* Reactivate GD-ROM drive */
1.19 +
1.20 + *((volatile unsigned long *)0xa05f74e4) = 0x1fffff;
1.21 + for(p=0; p<0x200000/4; p++)
1.22 + x = ((volatile unsigned long *)0xa0000000)[p];
1.23 +}
1.24 +
1.25 +
1.26 int ide_init()
1.27 {
1.28 + ide_activate();
1.29 +
1.30 if( ide_wait_ready() )
1.31 return -1;
1.32
1.33 @@ -415,4 +429,17 @@
1.34 ide_do_packet_command_pio( cmd, result, 10 );
1.35 debug_dump_buffer(result,10);
1.36 return 0;
1.37 -}
1.38 \ No newline at end of file
1.39 +}
1.40 +
1.41 +int ide_read_status( char *buf, int length )
1.42 +{
1.43 + char cmd[12] = { 0x40,0,0,0, 0xFF,0,0,0, 0,0,0,0 };
1.44 +
1.45 + return ide_do_packet_command_pio( cmd, buf, length );
1.46 +}
1.47 +
1.48 +int ide_play_cd( char *buf, int length )
1.49 +{
1.50 + char cmd[12] = { 0x21, 0x04,0,0, 0,0,0,0, 0,0,0,0 };
1.51 + return ide_do_packet_command_pio( cmd, buf, length );
1.52 +}
.