/*
 * VIDEO MOTION CODECs internal API for video devices
 *
 * Interface for MJPEG (and maybe later MPEG/WAVELETS) codec's
 * bound to a master device.
 *
 * (c) 2002 Wolfgang Scherr <scherr@net4you.at>
 *
 * $Id: videocodec.h,v 1.1.2.4 2003/01/14 21:15:03 rbultje Exp $
 *
 * ------------------------------------------------------------------------
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * ------------------------------------------------------------------------
 */

/* =================== */
/* general description */
/* =================== */

/* Should ease the (re-)usage of drivers supporting cards with (different)
   video codecs. The codecs register to this module their functionality,
   and the processors (masters) can attach to them if they fit.

   The codecs are typically have a "strong" binding to their master - so I
   don't think it makes sense to have a full blown interfacing as with e.g.
   i2c. If you have an other opinion, let's discuss & implement it :-)))

   Usage:

   The slave has just to setup the videocodec structure and use two functions:
   videocodec_register(codecdata);
   videocodec_unregister(codecdata);
   The best is just calling them at module (de-)initialisation.

   The master sets up the structure videocodec_master and calls:
   codecdata=videocodec_attach(master_codecdata);
   videocodec_detach(codecdata);

   The slave is called during attach/detach via functions setup previously
   during register. At that time, the master_data pointer is set up
   and the slave can access any io registers of the master device (in the case
   the slave is bound to it). Otherwise it doesn't need this functions and
   therfor they may not be initialized.

   The other fuctions are just for convenience, as they are for sure used by
   most/all of the codecs. The last ones may be ommited, too. 

   See the structure declaration below for more information and which data has
   to be set up for the master and the slave.

   ----------------------------------------------------------------------------
   The master should have "knowledge" of the slave and vice versa.  So the data
   structures sent to/from slave via set_data/get_data set_image/get_image are
   device dependent and vary between MJPEG/MPEG/WAVELET/... devices. (!!!!)
   ----------------------------------------------------------------------------
*/


/* ========================================== */
/* description of the videocodec_io structure */
/* ========================================== */

/*
   ==== master setup ==== 
   name -> name of the device structure for reference and debugging
   master_data ->  data ref. for the master (e.g. the zr36055,57,67)
   readreg -> ref. to read-fn from register (setup by master, used by slave)
   writereg -> ref. to write-fn to register (setup by master, used by slave)
               this two functions do the lowlevel I/O job

   ==== slave functionality setup ==== 
   slave_data -> data ref. for the slave (e.g. the zr36050,60) 
   check -> fn-ref. checks availability of an device, returns -EIO on failure or
            the type on success
            this makes espcecially sense if a driver module supports more than
            one codec which may be quite similar to access, nevertheless it
            is good for a first functionality check 

   -- main functions you always need for compression/decompression -- 

   set_mode -> this fn-ref. resets the entire codec, and sets up the mode
               with the last defined norm/size (or device default if not
               available) - it returns 0 if the mode is possible 
   set_size -> this fn-ref. sets the norm and image size for
               compression/decompression (returns 0 on success) 
               the norm param is defined in videodev.h (VIDEO_MODE_*) 

   additional setup may be available, too - but the codec should work with
   some default values even without this 

   set_data -> sets device-specific data (tables, quality etc.) 
   get_data -> query device-specific data (tables, quality etc.) 

   if the device delivers interrupts, they may be setup/handled here 
   setup_interrupt -> codec irq setup (not needed for 36050/60) 
   handle_interrupt -> codec irq handling (not needed for 36050/60) 

   if the device delivers pictures, they may be handled here 
   put_image -> puts image data to the codec (not needed for 36050/60) 
   get_image -> gets image data from the codec (not needed for 36050/60) 
                the calls include frame numbers and flags (even/odd/...) 
                if needed and a flag which allows blocking until its ready 
*/

/* ============== */
/* user interface */
/* ============== */

/* 
   Currently there is only a information display planned, as the layer
   is not visible for the user space at all.

   Information is available via procfs. The current entry is "/proc/videocodecs"
   but it makes sense to "hide" it in the /proc/video tree of v4l(2) --TODO--.

A example for such an output is:

<S>lave or attached <M>aster name  type flags    magic    (connected as)
S                          zr36050 0002 0000d001 00000000 (TEMPLATE)
M                       zr36055[0] 0001 0000c001 00000000 (zr36050[0])
M                       zr36055[1] 0001 0000c001 00000000 (zr36050[1])

*/


/* =============================================== */
/* special defines for the videocodec_io structure */
/* =============================================== */

#ifndef __LINUX_VIDEOCODEC_H
#define __LINUX_VIDEOCODEC_H

#include <linux/videodev.h>

//should be in videodev.h ??? (VID_DO_....)
#define CODEC_DO_COMPRESSION 0
#define CODEC_DO_EXPANSION   1

/* this are the current codec flags I think they are needed */
/*  -> type value in structure */
#define CODEC_FLAG_JPEG      0x00000001L	// JPEG codec
#define CODEC_FLAG_MPEG      0x00000002L	// MPEG1/2/4 codec
#define CODEC_FLAG_DIVX      0x00000004L	// DIVX codec
#define CODEC_FLAG_WAVELET   0x00000008L	// WAVELET codec
					  // room for other types

#define CODEC_FLAG_MAGIC     0x00000800L	// magic key must match
#define CODEC_FLAG_HARDWARE  0x00001000L	// is a hardware codec
#define CODEC_FLAG_VFE       0x00002000L	// has direct video frontend
#define CODEC_FLAG_ENCODER   0x00004000L	// compression capability
#define CODEC_FLAG_DECODER   0x00008000L	// decompression capability
#define CODEC_FLAG_NEEDIRQ   0x00010000L	// needs irq handling
#define CODEC_FLAG_RDWRPIC   0x00020000L	// handles picture I/O

/* a list of modes, some are just examples (is there any HW?) */
#define CODEC_MODE_BJPG      0x0001	// Baseline JPEG
#define CODEC_MODE_LJPG      0x0002	// Lossless JPEG
#define CODEC_MODE_MPEG1     0x0003	// MPEG 1
#define CODEC_MODE_MPEG2     0x0004	// MPEG 2
#define CODEC_MODE_MPEG4     0x0005	// MPEG 4
#define CODEC_MODE_MSDIVX    0x0006	// MS DivX
#define CODEC_MODE_ODIVX     0x0007	// Open DivX
#define CODEC_MODE_WAVELET   0x0008	// Wavelet

/* this are the current codec types I want to implement */
/*  -> type value in structure */
#define CODEC_TYPE_NONE    0
#define CODEC_TYPE_L64702  1
#define CODEC_TYPE_ZR36050 2
#define CODEC_TYPE_ZR36016 3
#define CODEC_TYPE_ZR36060 4

/* the type of data may be enhanced by future implementations (data-fn.'s) */
/*  -> used in command                                                     */
#define CODEC_G_STATUS         0x0000	/* codec status (query only) */
#define CODEC_S_CODEC_MODE     0x0001	/* codec mode (baseline JPEG, MPEG1,... */
#define CODEC_G_CODEC_MODE     0x8001
#define CODEC_S_VFE            0x0002	/* additional video frontend setup */
#define CODEC_G_VFE            0x8002
#define CODEC_S_MMAP           0x0003	/* MMAP setup (if available) */

#define CODEC_S_JPEG_TDS_BYTE  0x0010	/* target data size in bytes */
#define CODEC_G_JPEG_TDS_BYTE  0x8010
#define CODEC_S_JPEG_SCALE     0x0011	/* scaling factor for quant. tables */
#define CODEC_G_JPEG_SCALE     0x8011
#define CODEC_S_JPEG_HDT_DATA  0x0018	/* huffman-tables */
#define CODEC_G_JPEG_HDT_DATA  0x8018
#define CODEC_S_JPEG_QDT_DATA  0x0019	/* quantizing-tables */
#define CODEC_G_JPEG_QDT_DATA  0x8019
#define CODEC_S_JPEG_APP_DATA  0x001A	/* APP marker */
#define CODEC_G_JPEG_APP_DATA  0x801A
#define CODEC_S_JPEG_COM_DATA  0x001B	/* COM marker */
#define CODEC_G_JPEG_COM_DATA  0x801B

#define CODEC_S_PRIVATE        0x1000	/* "private" commands start here */
#define CODEC_G_PRIVATE        0x9000

#define CODEC_G_FLAG           0x8000	/* this is how 'get' is detected */

/* types of transfer, directly user space or a kernel buffer (image-fn.'s) */
/*  -> used in get_image, put_image                                        */
#define CODEC_TRANSFER_KERNEL 0	/* use "memcopy" */
#define CODEC_TRANSFER_USER   1	/* use "to/from_user" */


/* ========================= */
/* the structures itself ... */
/* ========================= */

struct vfe_polarity {
	int vsync_pol:1;
	int hsync_pol:1;
	int field_pol:1;
	int blank_pol:1;
	int subimg_pol:1;
	int poe_pol:1;
	int pvalid_pol:1;
	int vclk_pol:1;
};

struct vfe_settings {
	__u32 x, y;		/* Offsets into image */
	__u32 width, height;	/* Area to capture */
	__u16 decimation;	/* Decimation divider */
	__u16 flags;		/* Flags for capture */
/* flags are the same as in struct video_capture - see videodev.h:
#define VIDEO_CAPTURE_ODD		0
#define VIDEO_CAPTURE_EVEN		1
*/
	__u16 quality;		/* quality of the video */
};

struct tvnorm {
	u16 Wt, Wa, HStart, HSyncStart, Ht, Ha, VStart;
};

struct jpeg_com_marker {
	int len; /* number of usable bytes in data */
	char data[60];
};

struct jpeg_app_marker {
	int appn; /* number app segment */
	int len; /* number of usable bytes in data */
	char data[60];
};

struct videocodec {
	struct module *owner;
	/* -- filled in by slave device during register -- */
	char name[32];
	unsigned long magic;	/* may be used for client<->master attaching */
	unsigned long flags;	/* functionality flags */
	unsigned int type;	/* codec type */

	/* -- these is filled in later during master device attach -- */

	struct videocodec_master *master_data;

	/* -- these are filled in by the slave device during register -- */

	void *data;		/* private slave data */

	/* attach/detach client functions (indirect call) */
	int (*setup) (struct videocodec * codec);
	int (*unset) (struct videocodec * codec);

	/* main functions, every client needs them for sure! */
	// set compression or decompression (or freeze, stop, standby, etc)
	int (*set_mode) (struct videocodec * codec,
			 int mode);
	// setup picture size and norm (for the codec's video frontend)
	int (*set_video) (struct videocodec * codec,
			  struct tvnorm * norm,
			  struct vfe_settings * cap,
			  struct vfe_polarity * pol);
	// other control commands, also mmap setup etc.
	int (*control) (struct videocodec * codec,
			int type,
			int size,
			void *data);

	/* additional setup/query/processing (may be NULL pointer) */
	// interrupt setup / handling (for irq's delivered by master)
	int (*setup_interrupt) (struct videocodec * codec,
				long mode);
	int (*handle_interrupt) (struct videocodec * codec,
				 int source,
				 long flag);
	// picture interface (if any)
	long (*put_image) (struct videocodec * codec,
			   int tr_type,
			   int block,
			   long *fr_num,
			   long *flag,
			   long size,
			   void *buf);
	long (*get_image) (struct videocodec * codec,
			   int tr_type,
			   int block,
			   long *fr_num,
			   long *flag,
			   long size,
			   void *buf);
};

struct videocodec_master {
	/* -- filled in by master device for registration -- */
	char name[32];
	unsigned long magic;	/* may be used for client<->master attaching */
	unsigned long flags;	/* functionality flags */
	unsigned int type;	/* master type */

	void *data;		/* private master data */

	 __u32(*readreg) (struct videocodec * codec,
			  __u16 reg);
	void (*writereg) (struct videocodec * codec,
			  __u16 reg,
			  __u32 value);
};


/* ================================================= */
/* function prototypes of the master/slave interface */
/* ================================================= */

/* attach and detach commands for the master */
// * master structure needs to be kmalloc'ed before calling attach
//   and free'd after calling detach
// * returns pointer on success, NULL on failure
extern struct videocodec *videocodec_attach(struct videocodec_master *);
// * 0 on success, <0 (errno) on failure
extern int videocodec_detach(struct videocodec *);

/* register and unregister commands for the slaves */
// * 0 on success, <0 (errno) on failure
extern int videocodec_register(const struct videocodec *);
// * 0 on success, <0 (errno) on failure
extern int videocodec_unregister(const struct videocodec *);

/* the other calls are directly done via the videocodec structure! */

#endif				/*ifndef __LINUX_VIDEOCODEC_H */
