Search
lxdream.org :: lxdream/src/asic.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/asic.c
changeset 753:1fe39c3a9bbc
prev736:a02d1475ccfd
next833:1ea87e0221f8
author nkeynes
date Sun Jul 20 11:36:48 2008 +0000 (11 years ago)
permissions -rw-r--r--
last change Initial implementation for sort-dma channel
file annotate diff log raw
1.1 --- a/src/asic.c Mon Jul 14 07:44:42 2008 +0000
1.2 +++ b/src/asic.c Sun Jul 20 11:36:48 2008 +0000
1.3 @@ -355,9 +355,42 @@
1.4 sh4addr_t table_addr = MMIO_READ( ASIC, SORTDMATBL );
1.5 sh4addr_t data_addr = MMIO_READ( ASIC, SORTDMADATA );
1.6 int table_size = MMIO_READ( ASIC, SORTDMATSIZ );
1.7 - int data_size = MMIO_READ( ASIC, SORTDMADSIZ );
1.8 + int addr_shift = MMIO_READ( ASIC, SORTDMAASIZ ) ? 5 : 0;
1.9 + int count = 1;
1.10
1.11 - WARN( "Sort DMA not implemented" );
1.12 + uint32_t *table32 = (uint32_t *)mem_get_region( table_addr );
1.13 + uint16_t *table16 = (uint16_t *)table32;
1.14 + uint32_t next = table_size ? (*table32++) : (uint32_t)(*table16++);
1.15 + while(1) {
1.16 + next &= 0x07FFFFFF;
1.17 + if( next == 1 ) {
1.18 + next = table_size ? (*table32++) : (uint32_t)(*table16++);
1.19 + count++;
1.20 + continue;
1.21 + } else if( next == 2 ) {
1.22 + asic_event( EVENT_SORT_DMA );
1.23 + break;
1.24 + }
1.25 + uint32_t *data = (uint32_t *)mem_get_region(data_addr + (next<<addr_shift));
1.26 + if( data == NULL ) {
1.27 + break;
1.28 + }
1.29 +
1.30 + uint32_t *poly = pvr2_ta_find_polygon_context(data, 128);
1.31 + if( poly == NULL ) {
1.32 + asic_event( EVENT_SORT_DMA_ERR );
1.33 + break;
1.34 + }
1.35 + uint32_t size = poly[6] & 0xFF;
1.36 + if( size == 0 ) {
1.37 + size = 0x100;
1.38 + }
1.39 + next = poly[7];
1.40 + pvr2_ta_write( (unsigned char *)data, size<<5 );
1.41 + }
1.42 +
1.43 + MMIO_WRITE( ASIC, SORTDMACNT, count );
1.44 + MMIO_WRITE( ASIC, SORTDMACTL, 0 );
1.45 }
1.46
1.47 void mmio_region_ASIC_write( uint32_t reg, uint32_t val )
1.48 @@ -422,7 +455,7 @@
1.49 case SORTDMATBL: case SORTDMADATA:
1.50 MMIO_WRITE( ASIC, reg, (val & 0x0FFFFFE0) | 0x08000000 );
1.51 break;
1.52 - case SORTDMATSIZ: case SORTDMADSIZ:
1.53 + case SORTDMATSIZ: case SORTDMAASIZ:
1.54 MMIO_WRITE( ASIC, reg, (val & 1) );
1.55 break;
1.56 case SORTDMACTL:
.