Search
lxdream.org :: lxdream/src/maple/maple.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/maple/maple.h
changeset 2:42349f6ea216
prev1:eea311cfd33e
next15:5194dd0fdb60
author nkeynes
date Sat Aug 21 06:15:49 2004 +0000 (15 years ago)
permissions -rw-r--r--
last change Commit changes into cvs
file annotate diff log raw
nkeynes@1
     1
/**
nkeynes@1
     2
 * Maple bus routines
nkeynes@1
     3
 */
nkeynes@1
     4
#ifndef dream_maple_H
nkeynes@1
     5
#define dream_maple_H 1
nkeynes@1
     6
nkeynes@1
     7
#define MAPLE_CMD_INFO        1  /* Request device information */
nkeynes@1
     8
#define MAPLE_CMD_EXT_INFO    2  /* Request extended information */
nkeynes@1
     9
#define MAPLE_CMD_RESET       3  /* Reset device */
nkeynes@1
    10
#define MAPLE_CMD_SHUTDOWN    4  /* Shutdown device */
nkeynes@1
    11
#define MAPLE_CMD_GET_COND    9  /* Get condition */
nkeynes@1
    12
#define MAPLE_CMD_MEM_INFO    10 /* Get memory information */
nkeynes@2
    13
#define MAPLE_CMD_READ_BLOCK  11 /* Block read */
nkeynes@2
    14
#define MAPLE_CMD_WRITE_BLOCK 12 /* Block write */
nkeynes@1
    15
#define MAPLE_CMD_SET_COND    14 /* Set condition */
nkeynes@1
    16
#define MAPLE_RESP_INFO       5  /* Device information response */
nkeynes@1
    17
#define MAPLE_RESP_EXT_INFO   6  /* Extended device information response */
nkeynes@1
    18
#define MAPLE_RESP_ACK        7  /* Acknowledge command */
nkeynes@1
    19
#define MAPLE_RESP_DATA       8  /* Bytes read */
nkeynes@1
    20
#define MAPLE_ERR_NO_RESPONSE -1 /* Device did not respond */
nkeynes@1
    21
#define MAPLE_ERR_FUNC_UNSUP  -2 /* Function code unsupported */
nkeynes@1
    22
#define MAPLE_ERR_CMD_UNKNOWN -3 /* Command code unknown */
nkeynes@1
    23
#define MAPLE_ERR_RETRY       -4 /* Retry command */
nkeynes@1
    24
#define MAPLE_ERR_FILE        -5 /* File error? */
nkeynes@1
    25
nkeynes@2
    26
#define MAPLE_FUNC_CONTROLLER 0x01000000
nkeynes@2
    27
#define MAPLE_FUNC_MEMORY     0x02000000
nkeynes@2
    28
#define MAPLE_FUNC_LCD        0x04000000
nkeynes@2
    29
#define MAPLE_FUNC_CLOCK      0x08000000
nkeynes@2
    30
#define MAPLE_FUNC_MICROPHONE 0x10000000
nkeynes@2
    31
#define MAPLE_FUNC_AR_GUN     0x20000000
nkeynes@2
    32
#define MAPLE_FUNC_KEYBOARD   0x40000000
nkeynes@2
    33
#define MAPLE_FUNC_LIGHT_GUN  0x80000000
nkeynes@2
    34
#define MAPLE_FUNC_PURU_PURU  0x00010000
nkeynes@2
    35
#define MAPLE_FUNC_MOUSE      0x00020000
nkeynes@2
    36
nkeynes@2
    37
#define MAPLE_DEVICE_TAG 0x4D41504C
nkeynes@2
    38
#define MAPLE_DEVICE(x) ((maple_device_t)x)
nkeynes@2
    39
nkeynes@2
    40
typedef struct maple_device {
nkeynes@2
    41
    uint32_t _tag;
nkeynes@2
    42
    unsigned char ident[112];
nkeynes@2
    43
    unsigned char version[80];
nkeynes@2
    44
    int (*reset)(struct maple_device *dev);
nkeynes@2
    45
    int (*shutdown)(struct maple_device *dev);
nkeynes@2
    46
    int (*get_condition)(struct maple_device *dev,
nkeynes@2
    47
                         int function, char *outbuf, int *buflen);
nkeynes@2
    48
    int (*set_condition)(struct maple_device *dev,
nkeynes@2
    49
                         int function, char *inbuf, int buflen);
nkeynes@2
    50
    int (*read_block)(struct maple_device *dev,
nkeynes@2
    51
                      int function, uint32_t block, char *outbuf, int *buflen);
nkeynes@2
    52
    int (*write_block)(struct maple_device *dev,
nkeynes@2
    53
                       int function, uint32_t block, char *inbuf, int buflen);
nkeynes@2
    54
    void (*attach)(struct maple_device *dev);
nkeynes@2
    55
    void (*detach)(struct maple_device *dev);
nkeynes@2
    56
} *maple_device_t;
nkeynes@2
    57
nkeynes@2
    58
maple_device_t controller_new(void);
nkeynes@1
    59
nkeynes@1
    60
void maple_handle_buffer( uint32_t buffer );
nkeynes@2
    61
void maple_attach_device( maple_device_t dev, unsigned int port, unsigned int periph );
nkeynes@2
    62
void maple_detach_device( unsigned int port, unsigned int periph );
nkeynes@1
    63
nkeynes@1
    64
#endif /* !dream_maple_H */
.