#include <asm/ioctl.h>


#ifndef VIS_H
#define VIS_H

#define VIS_MAJOR 125  /* drivers major number for local/experimental use */
#define VIS_NAME "ETRAX/100 OV5017 ATA"


/* 
 * ioctl commands:
 * ---------------
 *
 * VIS_IOC_GET_IMAGE:
 * argument: pointer to image-buffer (size: VIS_IMAGESIZE)
 *
 * VIS_IOC_GET_BASE_ADR:
 * argument: not used
 * returns : unsigned char *buf[VIS_IMAGESIZE]
 * (WARNING: this is a hack and works only because the ETRAX100
 * does not have a MMU !!!)
 *
 * VIS_IOC_UPDATE_IMAGE:
 * to use with get_base_adr, it just updates the image
 * argument: not used
 *
 * VIS_IOC_REGISTER_WRITE:
 * argument: bit 2..0: register to read (see ov5017 register set below)
 *
 * VIS_IOC_REGISTER_WRITE:
 * argument: bit 19..16: register to set (see ov5017 register set below)
 *           bit   7..0: data
 */
#define VIS_IOC_MAGIC 'o'
#define VIS_IOC_TEST            _IO(VIS_IOC_MAGIC,   0)
#define VIS_IOC_GET_IMAGE       _IO(VIS_IOC_MAGIC,   1)
#define VIS_IOC_GET_BASE_ADR    _IO(VIS_IOC_MAGIC,   2)
#define VIS_IOC_UPDATE_IMAGE    _IO(VIS_IOC_MAGIC,   3)
#define VIS_IOC_REGISTER_READ   _IO(VIS_IOC_MAGIC,   4)
#define VIS_IOC_REGISTER_WRITE  _IO(VIS_IOC_MAGIC,   5)
#define VIS_IOC_MAXNR 5


/* Image Size (Bytes) */
#define VIS_IMAGE_WIDTH 385
#define VIS_IMAGE_HEIGHT 288
#define VIS_IMAGESIZE VIS_IMAGE_WIDTH * VIS_IMAGE_HEIGHT
 
/* TIFF Image Size (Bytes) */
#define VIS_TIFF_HEAD_SIZE 8
#define VIS_TIFF_TAIL_SIZE 312
#define VIS_TIFF_IMAGESIZE VIS_TIFF_HEAD_SIZE + VIS_IMAGESIZE + VIS_TIFF_TAIL_SIZE



/*  
 * ov5017 register set 
 */
#define VIS_REG_STATUS  0  /*  R    */
#define VIS_REG_FCTL    1  /*    W  */
#define VIS_REG_EXCTL   2  /*  R/W  */
#define VIS_REG_GCTL    3  /*  R/W  */
#define VIS_REG_FRCTL   4  /*  R/W  */
#define VIS_REG_MCTL    5  /*  R/W  */
#define VIS_REG_HWCTL   6  /*  R/W  */
#define VIS_REG_VWCTL   7  /*  R/W  */



/*  
 * extern procedures
 */
extern int etrax_vis_ov5017_init (void);

#endif /* VIS_H */

