Search
lxdream.org :: lxdream :: r244:4c2b7291d3b0
lxdream 0.9.1
released Jun 29
Download Now
changeset244:4c2b7291d3b0
parent243:df1671d533bf
child245:a1d0655a88d3
authornkeynes
dateTue Dec 19 09:51:35 2006 +0000 (13 years ago)
First cut of port 576890 (sysreset) and ide enable/disable
src/asic.c
src/asic.h
1.1 --- a/src/asic.c Sat Dec 16 12:37:44 2006 +0000
1.2 +++ b/src/asic.c Tue Dec 19 09:51:35 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: asic.c,v 1.20 2006-12-15 10:18:39 nkeynes Exp $
1.6 + * $Id: asic.c,v 1.21 2006-12-19 09:51:35 nkeynes Exp $
1.7 *
1.8 * Support for the miscellaneous ASIC functions (Primarily event multiplexing,
1.9 * and DMA).
1.10 @@ -213,6 +213,13 @@
1.11 MMIO_WRITE( ASIC, reg, MMIO_READ(ASIC, reg)&~val );
1.12 asic_check_cleared_events();
1.13 break;
1.14 + case SYSRESET:
1.15 + if( val == 0x7611 ) {
1.16 + dreamcast_reset();
1.17 + } else {
1.18 + WARN( "Unknown value %08X written to SYSRESET port", val );
1.19 + }
1.20 + break;
1.21 case MAPLE_STATE:
1.22 MMIO_WRITE( ASIC, reg, val );
1.23 if( val & 1 ) {
1.24 @@ -279,6 +286,10 @@
1.25
1.26 MMIO_REGION_WRITE_FN( EXTDMA, reg, val )
1.27 {
1.28 + if( !idereg.interface_enabled && IS_IDE_REGISTER(reg) ) {
1.29 + return; /* disabled */
1.30 + }
1.31 +
1.32 switch( reg ) {
1.33 case IDEALTSTATUS: /* Device control */
1.34 ide_write_control( val );
1.35 @@ -321,6 +332,15 @@
1.36 MMIO_WRITE( EXTDMA, reg, val );
1.37 asic_ide_dma_transfer( );
1.38 break;
1.39 + case IDEACTIVATE:
1.40 + if( val == 0x001FFFFF ) {
1.41 + idereg.interface_enabled = TRUE;
1.42 + /* Conventional wisdom says that this is necessary but not
1.43 + * sufficient to enable the IDE interface.
1.44 + */
1.45 + } else if( val == 0x000042FE ) {
1.46 + idereg.interface_enabled = FALSE;
1.47 + }
1.48 default:
1.49 MMIO_WRITE( EXTDMA, reg, val );
1.50 }
1.51 @@ -329,6 +349,10 @@
1.52 MMIO_REGION_READ_FN( EXTDMA, reg )
1.53 {
1.54 uint32_t val;
1.55 + if( !idereg.interface_enabled && IS_IDE_REGISTER(reg) ) {
1.56 + return 0xFFFFFFFF; /* disabled */
1.57 + }
1.58 +
1.59 switch( reg ) {
1.60 case IDEALTSTATUS:
1.61 val = idereg.status;
2.1 --- a/src/asic.h Sat Dec 16 12:37:44 2006 +0000
2.2 +++ b/src/asic.h Tue Dec 19 09:51:35 2006 +0000
2.3 @@ -1,5 +1,5 @@
2.4 /**
2.5 - * $Id: asic.h,v 1.13 2006-08-02 04:06:42 nkeynes Exp $
2.6 + * $Id: asic.h,v 1.14 2006-12-19 09:51:35 nkeynes Exp $
2.7 *
2.8 * Support for the miscellaneous ASIC functions (Primarily event multiplexing,
2.9 * and DMA). Includes MMIO definitions for the 5f6000 and 5f7000 regions,
2.10 @@ -41,6 +41,7 @@
2.11 LONG_PORT( 0x884, PVRDMARGN, PORT_MRW, 0, "PVR DMA Dest region" )
2.12 LONG_PORT( 0x888, ASICUNKA, PORT_MRW, 0, "ASIC <unknownA>" )
2.13 LONG_PORT( 0x88C, G2STATUS, PORT_MR|PORT_NOTRACE, 0, "G2 Bus status" )
2.14 + LONG_PORT( 0x890, SYSRESET, PORT_W, 0, "System reset port" )
2.15 LONG_PORT( 0x89C, ASICUNKB, PORT_MRW, 0xB, "Unknown, always 0xB?" )
2.16 LONG_PORT( 0x8A0, ASICUNKC, PORT_MRW, 0, "ASIC <unknownC>" )
2.17 LONG_PORT( 0x8A4, ASICUNKD, PORT_MRW, 0, "ASIC <unknownD>" )
2.18 @@ -198,6 +199,8 @@
2.19 #define EVENT_PVR_MATRIX_ALLOC_FAIL 67
2.20 #define EVENT_PVR_BAD_INPUT 68
2.21
2.22 +#define IS_IDE_REGISTER(x) ( (x) <= IDEDMACTL2 )
2.23 +
2.24 /**
2.25 * Raise an ASIC event
2.26 */
.