Home | History | Annotate | Line # | Download | only in maple
maple.h revision 1.1
      1  1.1  marcus /* $NetBSD: maple.h,v 1.1 2001/01/16 00:32:42 marcus Exp $ */
      2  1.1  marcus /*
      3  1.1  marcus  * Copyright (c) 2001 Marcus Comstedt
      4  1.1  marcus  * All rights reserved.
      5  1.1  marcus  *
      6  1.1  marcus  * Redistribution and use in source and binary forms, with or without
      7  1.1  marcus  * modification, are permitted provided that the following conditions
      8  1.1  marcus  * are met:
      9  1.1  marcus  * 1. Redistributions of source code must retain the above copyright
     10  1.1  marcus  *    notice, this list of conditions and the following disclaimer.
     11  1.1  marcus  * 2. Redistributions in binary form must reproduce the above copyright
     12  1.1  marcus  *    notice, this list of conditions and the following disclaimer in the
     13  1.1  marcus  *    documentation and/or other materials provided with the distribution.
     14  1.1  marcus  * 3. All advertising materials mentioning features or use of this software
     15  1.1  marcus  *    must display the following acknowledgement:
     16  1.1  marcus  *      This product includes software developed by Matt DeBergalis
     17  1.1  marcus  * 4. The name of the author may not be used to endorse or promote products
     18  1.1  marcus  *    derived from this software without specific prior written permission
     19  1.1  marcus  *
     20  1.1  marcus  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     21  1.1  marcus  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     22  1.1  marcus  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     23  1.1  marcus  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     24  1.1  marcus  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     25  1.1  marcus  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     26  1.1  marcus  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     27  1.1  marcus  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     28  1.1  marcus  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     29  1.1  marcus  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     30  1.1  marcus  */
     31  1.1  marcus 
     32  1.1  marcus 
     33  1.1  marcus #define MAPLE_PORTS 4
     34  1.1  marcus #define MAPLE_SUBUNITS 6
     35  1.1  marcus 
     36  1.1  marcus /* Maple Bus command and response codes */
     37  1.1  marcus 
     38  1.1  marcus #define MAPLE_RESPONSE_FILEERR -5
     39  1.1  marcus #define MAPLE_RESPONSE_AGAIN   -4  /* request should be retransmitted */
     40  1.1  marcus #define MAPLE_RESPONSE_BADCMD  -3
     41  1.1  marcus #define MAPLE_RESPONSE_BADFUNC -2
     42  1.1  marcus #define MAPLE_RESPONSE_NONE    -1  /* unit didn't respond at all */
     43  1.1  marcus #define MAPLE_COMMAND_DEVINFO  1
     44  1.1  marcus #define MAPLE_COMMAND_ALLINFO  2
     45  1.1  marcus #define MAPLE_COMMAND_RESET    3
     46  1.1  marcus #define MAPLE_COMMAND_KILL     4
     47  1.1  marcus #define MAPLE_RESPONSE_DEVINFO 5
     48  1.1  marcus #define MAPLE_RESPONSE_ALLINFO 6
     49  1.1  marcus #define MAPLE_RESPONSE_OK      7
     50  1.1  marcus #define MAPLE_RESPONSE_DATATRF 8
     51  1.1  marcus #define MAPLE_COMMAND_GETCOND  9
     52  1.1  marcus #define MAPLE_COMMAND_GETMINFO 10
     53  1.1  marcus #define MAPLE_COMMAND_BREAD    11
     54  1.1  marcus #define MAPLE_COMMAND_BWRITE   12
     55  1.1  marcus #define MAPLE_COMMAND_SETCOND  14
     56  1.1  marcus 
     57  1.1  marcus 
     58  1.1  marcus /* Function codes */
     59  1.1  marcus 
     60  1.1  marcus #define MAPLE_FUNC_CONTROLLER 0x001
     61  1.1  marcus #define MAPLE_FUNC_MEMCARD    0x002
     62  1.1  marcus #define MAPLE_FUNC_LCD        0x004
     63  1.1  marcus #define MAPLE_FUNC_CLOCK      0x008
     64  1.1  marcus #define MAPLE_FUNC_MICROPHONE 0x010
     65  1.1  marcus #define MAPLE_FUNC_ARGUN      0x020
     66  1.1  marcus #define MAPLE_FUNC_KEYBOARD   0x040
     67  1.1  marcus #define MAPLE_FUNC_LIGHTGUN   0x080
     68  1.1  marcus #define MAPLE_FUNC_PURUPURU   0x100
     69  1.1  marcus #define MAPLE_FUNC_MOUSE      0x200
     70  1.1  marcus 
     71  1.1  marcus struct maple_devinfo {
     72  1.1  marcus 	u_int32_t di_func;		/* function code */
     73  1.1  marcus 	u_int32_t di_function_data[3];  /* function data */
     74  1.1  marcus 	u_int8_t di_area_code;		/* region settings */
     75  1.1  marcus 	u_int8_t di_connector_direction;	/* ? */
     76  1.1  marcus 	char di_product_name[30];	/* name of the device */
     77  1.1  marcus 	char di_product_license[60];	/* manufacturer info */
     78  1.1  marcus 	u_int16_t di_standby_power;	/* standby power consumption */
     79  1.1  marcus 	u_int16_t di_max_power;		/* maximum power consumption */
     80  1.1  marcus };
     81  1.1  marcus 
     82  1.1  marcus struct maple_unit {
     83  1.1  marcus 	int port, subunit;
     84  1.1  marcus 	int status;
     85  1.1  marcus 	u_int32_t getcond_func;
     86  1.1  marcus 	void (*getcond_callback)(void *, void *, int);
     87  1.1  marcus 	void *getcond_data;
     88  1.1  marcus 	struct maple_devinfo devinfo;
     89  1.1  marcus };
     90  1.1  marcus 
     91  1.1  marcus extern void	maple_set_condition_callback __P((struct device *, int, int, u_int32_t, void (*)(void *, void *, int), void *));
     92  1.1  marcus extern u_int32_t maple_get_function_data __P((struct maple_devinfo *, u_int32_t));
     93  1.1  marcus extern void	maple_run_polling __P((struct device *));
     94