Search
lxdream.org :: lxdream/src/maple/maple.h :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/maple/maple.h
changeset 144:7f0714e89aaa
prev31:495e480360d7
next447:3e095bfcb476
author nkeynes
date Mon May 15 08:28:52 2006 +0000 (13 years ago)
permissions -rw-r--r--
last change Rename video_driver to display_driver
Add input source to display
Implement configuration file support
Hook controllers up to configuration
file annotate diff log raw
1.1 --- a/src/maple/maple.h Sun Dec 25 08:24:11 2005 +0000
1.2 +++ b/src/maple/maple.h Mon May 15 08:28:52 2006 +0000
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * $Id: maple.h,v 1.4 2005-12-25 08:24:11 nkeynes Exp $
1.6 + * $Id: maple.h,v 1.5 2006-05-15 08:28:52 nkeynes Exp $
1.7 *
1.8 * Maple bus definitions
1.9 *
1.10 @@ -19,6 +19,8 @@
1.11 #ifndef dream_maple_H
1.12 #define dream_maple_H 1
1.13
1.14 +#include "dreamcast.h"
1.15 +
1.16 #define MAPLE_CMD_INFO 1 /* Request device information */
1.17 #define MAPLE_CMD_EXT_INFO 2 /* Request extended information */
1.18 #define MAPLE_CMD_RESET 3 /* Reset device */
1.19 @@ -52,13 +54,27 @@
1.20 #define MAPLE_DEVICE_TAG 0x4D41504C
1.21 #define MAPLE_DEVICE(x) ((maple_device_t)x)
1.22
1.23 +typedef struct maple_device_class *maple_device_class_t;
1.24 +typedef struct maple_device *maple_device_t;
1.25 +
1.26 +struct maple_device_class {
1.27 + const char *name;
1.28 + maple_device_t (*new_device)();
1.29 +};
1.30 +
1.31 /**
1.32 * Table of functions to be implemented by any maple device.
1.33 */
1.34 -typedef struct maple_device {
1.35 +struct maple_device {
1.36 uint32_t _tag;
1.37 + maple_device_class_t device_class;
1.38 unsigned char ident[112];
1.39 unsigned char version[80];
1.40 + dreamcast_config_entry_t (*get_config)(struct maple_device *dev);
1.41 + void (*attach)(struct maple_device *dev);
1.42 + void (*detach)(struct maple_device *dev);
1.43 + void (*destroy)(struct maple_device *dev);
1.44 +
1.45 int (*reset)(struct maple_device *dev);
1.46 int (*shutdown)(struct maple_device *dev);
1.47 int (*get_condition)(struct maple_device *dev,
1.48 @@ -69,14 +85,18 @@
1.49 int function, uint32_t block, unsigned char *outbuf, int *buflen);
1.50 int (*write_block)(struct maple_device *dev,
1.51 int function, uint32_t block, unsigned char *inbuf, int buflen);
1.52 - void (*attach)(struct maple_device *dev);
1.53 - void (*detach)(struct maple_device *dev);
1.54 -} *maple_device_t;
1.55 +};
1.56
1.57 -maple_device_t controller_new(void);
1.58 +extern struct maple_device_class controller_class;
1.59 +
1.60 +maple_device_t maple_new_device( const char *name );
1.61 +maple_device_t maple_get_device( unsigned int port, unsigned int periph );
1.62 +dreamcast_config_entry_t maple_get_device_config( maple_device_t dev );
1.63
1.64 void maple_handle_buffer( uint32_t buffer );
1.65 void maple_attach_device( maple_device_t dev, unsigned int port, unsigned int periph );
1.66 void maple_detach_device( unsigned int port, unsigned int periph );
1.67 +void maple_detach_all( );
1.68 +void maple_reattach_all( );
1.69
1.70 #endif /* !dream_maple_H */
.