Search
lxdream.org :: lxdream/src/maple/controller.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/maple/controller.c
changeset 2:42349f6ea216
next31:495e480360d7
author nkeynes
date Sat Aug 21 06:15:49 2004 +0000 (16 years ago)
permissions -rw-r--r--
last change Commit changes into cvs
file annotate diff log raw
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/maple/controller.c Sat Aug 21 06:15:49 2004 +0000
1.3 @@ -0,0 +1,56 @@
1.4 +#include <stdlib.h>
1.5 +#include "dream.h"
1.6 +#include "maple.h"
1.7 +#include "maple/controller.h"
1.8 +
1.9 +void controller_attach( maple_device_t dev );
1.10 +void controller_detach( maple_device_t dev );
1.11 +int controller_get_cond( maple_device_t dev, int function, char *outbuf,
1.12 + int *outlen );
1.13 +
1.14 +static struct maple_device base_controller = {
1.15 + MAPLE_DEVICE_TAG, CONTROLLER_IDENT, CONTROLLER_VERSION, NULL, NULL,
1.16 + controller_get_cond, NULL, NULL, NULL,
1.17 + controller_attach, controller_detach };
1.18 +
1.19 +typedef struct controller_device {
1.20 + struct maple_device dev;
1.21 + uint32_t condition[2];
1.22 +} *controller_device_t;
1.23 +
1.24 +
1.25 +
1.26 +maple_device_t controller_new( )
1.27 +{
1.28 + controller_device_t dev = malloc( sizeof(struct controller_device) );
1.29 + memcpy( dev, &base_controller, sizeof(base_controller) );
1.30 + memset( dev->condition, 0, 8 );
1.31 + dev->condition[0] = 0x0000FFFF;
1.32 + return MAPLE_DEVICE(dev);
1.33 +}
1.34 +
1.35 +
1.36 +void controller_attach( maple_device_t dev )
1.37 +{
1.38 +
1.39 +}
1.40 +
1.41 +void controller_detach( maple_device_t dev )
1.42 +{
1.43 +
1.44 +}
1.45 +
1.46 +
1.47 +int controller_get_cond( maple_device_t mdev, int function, char *outbuf,
1.48 + int *outlen )
1.49 +{
1.50 + controller_device_t dev = (controller_device_t)mdev;
1.51 + if( function == MAPLE_FUNC_CONTROLLER ) {
1.52 + *outlen = 2;
1.53 + memcpy( outbuf, dev->condition, 8 );
1.54 + return 0;
1.55 + } else {
1.56 + return MAPLE_ERR_FUNC_UNSUP;
1.57 + }
1.58 +}
1.59 +
.