Home | History | Annotate | Line # | Download | only in maple
maple.h revision 1.7.2.2
      1  1.7.2.2   skrll /*	$NetBSD: maple.h,v 1.7.2.2 2005/03/04 16:38:13 skrll Exp $	*/
      2      1.5   itohy 
      3      1.5   itohy /*-
      4      1.5   itohy  * Copyright (c) 2002 The NetBSD Foundation, Inc.
      5      1.5   itohy  * All rights reserved.
      6      1.5   itohy  *
      7      1.5   itohy  * This code is derived from software contributed to The NetBSD Foundation
      8      1.5   itohy  * by ITOH Yasufumi.
      9      1.5   itohy  *
     10      1.5   itohy  * Redistribution and use in source and binary forms, with or without
     11      1.5   itohy  * modification, are permitted provided that the following conditions
     12      1.5   itohy  * are met:
     13      1.5   itohy  * 1. Redistributions of source code must retain the above copyright
     14      1.5   itohy  *    notice, this list of conditions and the following disclaimer.
     15      1.5   itohy  * 2. Redistributions in binary form must reproduce the above copyright
     16      1.5   itohy  *    notice, this list of conditions and the following disclaimer in the
     17      1.5   itohy  *    documentation and/or other materials provided with the distribution.
     18      1.5   itohy  * 3. All advertising materials mentioning features or use of this software
     19      1.5   itohy  *    must display the following acknowledgement:
     20      1.5   itohy  *	This product includes software developed by the NetBSD
     21      1.5   itohy  *	Foundation, Inc. and its contributors.
     22      1.5   itohy  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23      1.5   itohy  *    contributors may be used to endorse or promote products derived
     24      1.5   itohy  *    from this software without specific prior written permission.
     25      1.5   itohy  *
     26      1.5   itohy  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27      1.5   itohy  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28      1.5   itohy  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29      1.5   itohy  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30      1.5   itohy  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31      1.5   itohy  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32      1.5   itohy  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33      1.5   itohy  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34      1.5   itohy  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35      1.5   itohy  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36      1.5   itohy  * POSSIBILITY OF SUCH DAMAGE.
     37      1.5   itohy  */
     38      1.4     uch 
     39      1.2  marcus /*-
     40      1.1  marcus  * Copyright (c) 2001 Marcus Comstedt
     41      1.1  marcus  * All rights reserved.
     42      1.1  marcus  *
     43      1.1  marcus  * Redistribution and use in source and binary forms, with or without
     44      1.1  marcus  * modification, are permitted provided that the following conditions
     45      1.1  marcus  * are met:
     46      1.1  marcus  * 1. Redistributions of source code must retain the above copyright
     47      1.1  marcus  *    notice, this list of conditions and the following disclaimer.
     48      1.1  marcus  * 2. Redistributions in binary form must reproduce the above copyright
     49      1.1  marcus  *    notice, this list of conditions and the following disclaimer in the
     50      1.1  marcus  *    documentation and/or other materials provided with the distribution.
     51      1.1  marcus  * 3. All advertising materials mentioning features or use of this software
     52      1.1  marcus  *    must display the following acknowledgement:
     53      1.2  marcus  *	This product includes software developed by Marcus Comstedt.
     54      1.2  marcus  * 4. Neither the name of The NetBSD Foundation nor the names of its
     55      1.2  marcus  *    contributors may be used to endorse or promote products derived
     56      1.2  marcus  *    from this software without specific prior written permission.
     57      1.1  marcus  *
     58      1.2  marcus  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     59      1.2  marcus  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     60      1.2  marcus  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     61      1.2  marcus  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     62      1.2  marcus  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     63      1.2  marcus  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     64      1.2  marcus  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     65      1.2  marcus  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     66      1.2  marcus  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     67      1.2  marcus  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     68      1.2  marcus  * POSSIBILITY OF SUCH DAMAGE.
     69      1.1  marcus  */
     70      1.1  marcus 
     71      1.3  marcus #ifndef _DREAMCAST_DEV_MAPLE_MAPLE_H_
     72      1.3  marcus #define _DREAMCAST_DEV_MAPLE_MAPLE_H_
     73      1.3  marcus 
     74      1.5   itohy /* signed is more effective than unsigned on SH */
     75      1.5   itohy typedef int8_t maple_response_t;
     76      1.1  marcus 
     77      1.1  marcus /* Maple Bus command and response codes */
     78      1.1  marcus 
     79      1.5   itohy #define MAPLE_RESPONSE_LCDERR	 (-6)
     80      1.5   itohy #define MAPLE_RESPONSE_FILEERR	 (-5)
     81      1.5   itohy #define MAPLE_RESPONSE_AGAIN	 (-4)	/* request should be retransmitted */
     82      1.5   itohy #define MAPLE_RESPONSE_BADCMD	 (-3)
     83      1.5   itohy #define MAPLE_RESPONSE_BADFUNC	 (-2)
     84      1.5   itohy #define MAPLE_RESPONSE_NONE	 (-1)	/* unit didn't respond at all */
     85      1.5   itohy #define MAPLE_COMMAND_DEVINFO	 1
     86      1.5   itohy #define MAPLE_COMMAND_ALLINFO	 2
     87      1.5   itohy #define MAPLE_COMMAND_RESET	 3
     88      1.5   itohy #define MAPLE_COMMAND_KILL	 4
     89      1.5   itohy #define MAPLE_RESPONSE_DEVINFO	 5
     90      1.5   itohy #define MAPLE_RESPONSE_ALLINFO	 6
     91      1.5   itohy #define MAPLE_RESPONSE_OK	 7
     92      1.5   itohy #define MAPLE_RESPONSE_DATATRF	 8
     93      1.5   itohy #define MAPLE_COMMAND_GETCOND	 9
     94      1.5   itohy #define MAPLE_COMMAND_GETMINFO	 10
     95      1.5   itohy #define MAPLE_COMMAND_BREAD	 11
     96      1.5   itohy #define MAPLE_COMMAND_BWRITE	 12
     97      1.5   itohy #define MAPLE_COMMAND_GETLASTERR 13
     98      1.5   itohy #define MAPLE_COMMAND_SETCOND	 14
     99      1.1  marcus 
    100      1.1  marcus /* Function codes */
    101      1.5   itohy #define MAPLE_FN_CONTROLLER	0
    102      1.5   itohy #define MAPLE_FN_MEMCARD	1
    103      1.5   itohy #define MAPLE_FN_LCD		2
    104      1.5   itohy #define MAPLE_FN_CLOCK		3
    105      1.5   itohy #define MAPLE_FN_MICROPHONE	4
    106      1.5   itohy #define MAPLE_FN_ARGUN		5
    107      1.5   itohy #define MAPLE_FN_KEYBOARD	6
    108      1.5   itohy #define MAPLE_FN_LIGHTGUN	7
    109      1.5   itohy #define MAPLE_FN_PURUPURU	8
    110      1.5   itohy #define MAPLE_FN_MOUSE		9
    111      1.1  marcus 
    112      1.5   itohy #define MAPLE_FUNC(fn)		(1 << (fn))
    113      1.1  marcus 
    114      1.1  marcus struct maple_devinfo {
    115  1.7.2.2   skrll 	uint32_t di_func;		/* function code */
    116  1.7.2.2   skrll 	uint32_t di_function_data[3];	/* function data */
    117  1.7.2.2   skrll 	uint8_t di_area_code;		/* region settings */
    118  1.7.2.2   skrll 	uint8_t di_connector_direction; /* direction of expansion connector */
    119      1.1  marcus 	char di_product_name[30];	/* name of the device */
    120      1.1  marcus 	char di_product_license[60];	/* manufacturer info */
    121  1.7.2.2   skrll 	uint16_t di_standby_power;	/* standby power consumption */
    122  1.7.2.2   skrll 	uint16_t di_max_power;		/* maximum power consumption */
    123      1.1  marcus };
    124      1.6   itohy 
    125      1.6   itohy #define MAPLE_CONN_TOP		0	/* connector is to the top */
    126      1.6   itohy #define MAPLE_CONN_BOTTOM	1	/* connector is to the bottom */
    127      1.1  marcus 
    128      1.5   itohy struct maple_response {
    129  1.7.2.2   skrll 	uint32_t	response_code;
    130  1.7.2.2   skrll 	uint32_t	data[1];	/* variable length */
    131      1.1  marcus };
    132      1.1  marcus 
    133      1.5   itohy #define MAPLE_FLAG_PERIODIC		1
    134      1.5   itohy #define MAPLE_FLAG_CMD_PERIODIC_TIMING	2
    135      1.5   itohy 
    136      1.5   itohy struct maple_unit;
    137      1.5   itohy 
    138      1.5   itohy extern void	maple_set_callback(struct device *, struct maple_unit *, int,
    139      1.5   itohy 		    void (*)(void *, struct maple_response *, int, int),
    140      1.5   itohy 		    void *);
    141      1.5   itohy extern void	maple_enable_unit_ping(struct device *, struct maple_unit *,
    142      1.5   itohy 		    int /*func*/, int /*enable*/);
    143      1.5   itohy extern void	maple_enable_periodic(struct device *, struct maple_unit *,
    144      1.5   itohy 		    int /*func*/, int /*on*/);
    145      1.5   itohy extern void	maple_command(struct device *, struct maple_unit *,
    146      1.7   itohy 		    int /*func*/, int /*command*/, int /*datalen*/,
    147      1.7   itohy 		    const void *, int /*flags*/);
    148  1.7.2.2   skrll extern uint32_t	maple_get_function_data(struct maple_devinfo *, int);
    149      1.4     uch extern void	maple_run_polling(struct device *);
    150      1.5   itohy extern int	maple_unit_ioctl(struct device *, struct maple_unit *,
    151  1.7.2.1   skrll 		    u_long, caddr_t, int, struct lwp *);
    152      1.3  marcus 
    153      1.3  marcus #endif /* _DREAMCAST_DEV_MAPLE_MAPLE_H_ */
    154