/*
 * Copyright (c) 2000-2003 MIPS Technologies, Inc.
 * 
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 
 *      * Redistributions of source code must retain the above copyright
 *        notice, this list of conditions and the following disclaimer.
 *      * Redistributions in binary form must reproduce the above
 *      copyright
 *        notice, this list of conditions and the following disclaimer
 *        in the documentation and/or other materials provided with
 *        the distribution.
 *      * Neither the name of MIPS Technologies Inc. nor the names of its
 *        contributors may be used to endorse or promote products derived
 *        from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * sys/panelio.h: panel display ioctl interface
 */


#ifndef _sys_panelio_H_
#define _sys_panelio_H_

#ifdef __cplusplus
extern "C" {
#endif

struct panelinfo {
    unsigned char	type;
    unsigned char	flags;
    unsigned char	rows;
    unsigned char	cols;
};

#define PANELTYPE_ALPHA		0	/* alphanumeric display */
#define PANELTYPE_HEX		1	/* hex display */
#define PANELTYPE_LED		2	/* individual leds */

#define PANELFLGS_BRIGHTNESS	0x01	/* can set brightness */
#define PANELFLGS_CONTRAST	0x02	/* can set contrast */
#define PANELFLGS_BLINK		0x04	/* display can be blinked */
#define PANELFLGS_FLASH		0x08	/* chars can be flashed */
#define PANELFLGS_SCROLL	0x10	/* display can be scrolled */
#define PANELFLGS_PROGRESS	0x20	/* display can show progress */

struct panelmode {
    unsigned char	options;	/* display options */
    unsigned char	brighton;	/* brightness (0 to 100%) */
    unsigned char	brightoff;	/* brightness (0 to 100%) */
    unsigned char	contrast;	/* contrast (0 to 100%) */
    unsigned long	blinkon;	/* on period in ns */
    unsigned long	blinkoff;	/* off period in ns */
    unsigned long	scrollrate;	/* scroll rate in ns */
    int			scrollchars;	/* scroll amount */
};

#define PANELOPT_PAD	0x01		/* clear to end of row */
#define PANELOPT_CENTRE	0x02		/* centre within row  */
#define PANELOPT_WRAP	0x04		/* wrap at end of row */
#define PANELOPT_IGNLF	0x08		/* ignore linefeed char */
#define PANELOPT_IGNNUL	0x10		/* ignore null char */
#define PANELOPT_ROTATE	0x20		/* rotate text until rewritten */
#define PANELOPT_FADE	0x40		/* slow blinking/flashing */
#define PANELOPT_FLASH	0x80		/* next chars flash */

struct panelcoord {
    unsigned short	row;		
    unsigned short	col;
};

#define	PANELIOINFO	 _IOR('p', 0, struct panelinfo)	/* get info  */
#define	PANELIOGMODE	 _IOR('p', 1, struct panelmode) /* get mode */
#define	PANELIOSMODE	 _IOW('p', 2, struct panelmode) /* set mode */
#define	PANELIOCLEAR	 _IO('p', 3) 			/* clear display */
#define	PANELIOPROGRESS	 _IOW('p', 4, int) 		/* display progress */
#define	PANELIOSCOORD	 _IOW('p', 5, struct panelcoord) /* next display coord */

#ifdef __cplusplus
}
#endif

#endif /* _sys_panelio_H_ */
