Search
lxdream.org :: lxdream/src/asic.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/asic.c
changeset 325:5717ae5d4746
prev305:1191085c5988
next334:59073f812bd3
author nkeynes
date Thu Jan 25 10:16:32 2007 +0000 (13 years ago)
permissions -rw-r--r--
last change Move PVR2 dma handling (0x10000000-0x13FFFFFF) into pvr2mem.c, minor
register cleanups in asic.c
file annotate diff log raw
1.1 --- a/src/asic.c Thu Jan 18 11:14:01 2007 +0000
1.2 +++ b/src/asic.c Thu Jan 25 10:16:32 2007 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: asic.c,v 1.25 2007-01-18 11:14:01 nkeynes Exp $
1.6 + * $Id: asic.c,v 1.26 2007-01-25 10:16:32 nkeynes Exp $
1.7 *
1.8 * Support for the miscellaneous ASIC functions (Primarily event multiplexing,
1.9 * and DMA).
1.10 @@ -303,9 +303,26 @@
1.11 MMIO_WRITE( EXTDMA, IDEDMACTL2, 0 );
1.12 }
1.13 }
1.14 -
1.15 }
1.16
1.17 +void pvr_dma_transfer( )
1.18 +{
1.19 + sh4addr_t destaddr = MMIO_READ( ASIC, PVRDMADEST) &0x1FFFFFE0;
1.20 + uint32_t count = MMIO_READ( ASIC, PVRDMACNT );
1.21 + char *data = alloca( count );
1.22 + uint32_t rcount = DMAC_get_buffer( 2, data, count );
1.23 + if( rcount != count )
1.24 + WARN( "PVR received %08X bytes from DMA, expected %08X", rcount, count );
1.25 +
1.26 + pvr2_dma_write( destaddr, data, rcount );
1.27 +
1.28 + MMIO_WRITE( ASIC, PVRDMACTL, 0 );
1.29 + MMIO_WRITE( ASIC, PVRDMACNT, 0 );
1.30 + if( destaddr & 0x01000000 ) { /* Write to texture RAM */
1.31 + MMIO_WRITE( ASIC, PVRDMADEST, destaddr + rcount );
1.32 + }
1.33 + asic_event( EVENT_PVR_DMA );
1.34 +}
1.35
1.36 void mmio_region_ASIC_write( uint32_t reg, uint32_t val )
1.37 {
1.38 @@ -342,22 +359,20 @@
1.39 MMIO_WRITE( ASIC, reg, 0 );
1.40 }
1.41 break;
1.42 + case PVRDMADEST:
1.43 + MMIO_WRITE( ASIC, reg, (val & 0x03FFFFE0) | 0x10000000 );
1.44 + break;
1.45 + case PVRDMACNT:
1.46 + MMIO_WRITE( ASIC, reg, val & 0x00FFFFE0 );
1.47 + break;
1.48 case PVRDMACTL: /* Initiate PVR DMA transfer */
1.49 + val = val & 0x01;
1.50 MMIO_WRITE( ASIC, reg, val );
1.51 - if( val & 1 ) {
1.52 - uint32_t dest_addr = MMIO_READ( ASIC, PVRDMADEST) &0x1FFFFFE0;
1.53 - uint32_t count = MMIO_READ( ASIC, PVRDMACNT );
1.54 - char *data = alloca( count );
1.55 - uint32_t rcount = DMAC_get_buffer( 2, data, count );
1.56 - if( rcount != count )
1.57 - WARN( "PVR received %08X bytes from DMA, expected %08X", rcount, count );
1.58 - mem_copy_to_sh4( dest_addr, data, rcount );
1.59 - asic_event( EVENT_PVR_DMA );
1.60 - MMIO_WRITE( ASIC, PVRDMACTL, 0 );
1.61 - MMIO_WRITE( ASIC, PVRDMACNT, 0 );
1.62 + if( val == 1 ) {
1.63 + pvr_dma_transfer();
1.64 }
1.65 break;
1.66 - case PVRDMADEST: case PVRDMACNT: case MAPLE_DMA:
1.67 + case MAPLE_DMA:
1.68 MMIO_WRITE( ASIC, reg, val );
1.69 break;
1.70 default:
.