Search
lxdream.org :: lxdream/src/maple/maple.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/maple/maple.c
changeset 1237:377077d10d62
prev1172:43eef98ff265
next1261:644f66135e94
author nkeynes
date Sat Feb 25 09:56:10 2012 +1000 (8 years ago)
permissions -rw-r--r--
last change Add a 200us delay time for Maple requests, to avoid problems with games that
continually poll maple.

Patch by guinux, thanks!
file annotate diff log raw
1.1 --- a/src/maple/maple.c Wed May 11 08:45:31 2011 +1000
1.2 +++ b/src/maple/maple.c Sat Feb 25 09:56:10 2012 +1000
1.3 @@ -19,6 +19,7 @@
1.4
1.5 #include <assert.h>
1.6 #include <glib/gstrfuncs.h>
1.7 +#include "eventq.h"
1.8 #include "dream.h"
1.9 #include "mem.h"
1.10 #include "asic.h"
1.11 @@ -32,9 +33,18 @@
1.12 struct maple_device_class *maple_device_classes[] = {
1.13 &controller_class, &keyboard_class, &lightgun_class, &mouse_class, &vmu_class, NULL };
1.14
1.15 +/**
1.16 + * Fire interrupt to notify the completion of DMA transfer
1.17 + */
1.18 +static void maple_event_handler( int eventid )
1.19 +{
1.20 + MMIO_WRITE( ASIC, MAPLE_STATE, 0 );
1.21 + asic_event( EVENT_MAPLE_DMA );
1.22 +}
1.23 +
1.24 void maple_init( void )
1.25 {
1.26 -
1.27 + register_event_callback( EVENT_MAPLE_DMA, maple_event_handler );
1.28 }
1.29
1.30 maple_device_t maple_new_device( const gchar *name )
1.31 @@ -130,7 +140,11 @@
1.32 dev->start_gun(dev);
1.33 return; // Pending
1.34 } else {
1.35 - asic_event( EVENT_MAPLE_DMA );
1.36 + /* FIXME: Determine how long maple IO really takes to process,
1.37 + * which is probably a function of the number of requests.
1.38 + * For now, just use 0.2ms as a reasonable value.
1.39 + */
1.40 + event_schedule( EVENT_MAPLE_DMA, 200000 );
1.41 return;
1.42 }
1.43 case 7: /* skip */
1.44 @@ -299,7 +313,7 @@
1.45 buf += 12 + (length<<2);
1.46 address += 12 + (length<<2);
1.47 }
1.48 - asic_event( EVENT_MAPLE_DMA );
1.49 + event_schedule( EVENT_MAPLE_DMA, 200000 );
1.50 }
1.51 }
1.52
.