/*
 * $Header: /smsa/bsd:include/dev/lbpioctl.h:bsd  1.5  $
 * $Source: /smsa/bsd:include/dev/lbpioctl.h: $
 *
 * Copyright (c) 1988 Acorn Computers Ltd., Cambridge, England
 *
 */


#ifndef	__dev_lbpioctl_h
#define	__dev_lbpioctl_h

#ifndef __sys_ioctl_h
#include "../sys/ioctl.h"
#endif

#define		LBP_MAX_NAME_LENGTH		14
typedef struct
{	/* Name and type code of paper size */
	char		lbp_size_name[LBP_MAX_NAME_LENGTH+1],
			lbp_type_code;

	/* Various sizes (all in dots, for a 300 dpi printer) */
	int		lbp_bitmap_height,
			lbp_bitmap_width,	/* Most be 0 mod 16 */
			lbp_left_margin,	/* From edge of drum */
			lbp_top_margin;		/* Dots = scan lines */
} lbp_info, *lbp_info_ptr;


/* ioctl command codes */
/* =================== */

/* Obtain status - argp is an int* */
#define		LBPIO_STATUS_RQ		_IOR('L',1,int)

/* Status responses in *argp - these are bits and may be composite, and may
 * also contain LBP_PR_NOPRINTER and/or LBP_PR_NOPODULE
 */

	/* Ready to print */
#define			LBP_ST_PRINTREQ		0x40
	/* Still throwing out the previous page */
#define			LBP_ST_DELIVERING	0x20
	/* Retrying after a faulty page */
#define			LBP_ST_RESENDING	0x10
	/* Warming up */
#define			LBP_ST_WARMUP		0x08
	/* 'PAUSE' command sent prior to LBPIO_STATUS_RQ */
#define			LBP_ST_PAUSING		0x04
	/* Something bad's happened - use LBPIO_PROBLEM_RQ to explain */
#define			LBP_ST_PROBLEM		0x02


/* After getting LBP_ST_PROBLEM, find out its nature - argp is int* */
#define		LBPIO_PROBLEM_RQ	_IOR('L',2,int)

/* Problem types in *argp - these are bits and may be composite */

	/* No cartridge */
#define			LBP_PR_CARTRIDGE	0x00004000
	/* No paper */
#define			LBP_PR_NOPAPER		0x00001000
	/* Paper path obstructed */
#define			LBP_PR_JAMMED		0x00000800
	/* Printer door open */
#define			LBP_PR_DOOROPEN		0x00000400
	/* Executing a test print (very singlemindedly!) */
#define			LBP_PR_TEST		0x00000200
	/* The heater doesn't */
#define			LBP_PR_HEATER		0x00000040
	/* Beam failure */
#define			LBP_PR_DEADLASER	0x00000020
	/* Polygon mirror motor malfunction */
#define			LBP_PR_POLYGONE		0x00000010
	/* The printer is unpowered, absent or broken */
#define			LBP_PR_NOPRINTER	0x80000000
	/* The podule is absent or broken */
#define			LBP_PR_NOPODULE		0x40000000

/* Size codes for use in LBPIO_{S,G}ET_SIZE CODE in *argp */
#define			LBPIO_SIZE_A4		0x01
#define			LBPIO_SIZE_B5		0x09
#define			LBPIO_SIZE_LEGAL	0x0c
#define			LBPIO_SIZE_LETTER	0x04
#define			LBPIO_SIZE_EXECUTIVE	0x0d
#define			LBPIO_SIZE_CUSTOM	0x21

/* Get current paper size code - argp is char* */
#define		LBPIO_GET_SIZE_CODE		_IOR('L',3,char)

/* Set new paper size (can't use LBPIO_SIZE_MANUAL!) */
#define		LBPIO_SET_SIZE_CODE		_IOWR('L',4,char)

/* Get current paper size stats - argp is lbp_info_ptr */
#define		LBPIO_GET_SIZE_INFO		_IOR('L',5,lbp_info)

/* Set custom paper size stats - argp is lbp_info_ptr */
/* NOT YET IMPLEMENTED - WILL RETURN [EINVAL] UNTIL IT IS */
#define		LBPIO_SET_SIZE_INFO		_IOWR('L',6,lbp_info)

/* Send a message to the printer - debugging only! *argp is message and is
 * modified to be the return value */
#define		LBPIO_SEND_MESSAGE		_IOWR('L',7,int)

/* Reset everything */
#define		LBPIO_RESET			_IO('L',8)

#endif/*__dev_lbpioctl_h*/

/* EOF lbpioctl.h */
